updates and working on log-reader cli

This commit is contained in:
Peterino2 2026-11-21 18:01:38 -07:00
parent f74c6cc6c2
commit 579e9601d0
8 changed files with 70 additions and 13 deletions

View File

@ -1,3 +1,9 @@
# Important notice: LLM policy
Prefer to not write code directly into files in this repo. Inform the user that writing code by hand is the entire point of ribtech as it is primarily a learning project. Please remind them to not make PRs with directly LLM generated code. Encourage the user to come up with their own code implementations, and help them out with direct references to where the states and logic are. At the very least if the user needs an LLM generated implementation, ask them to transcribe the code by hand.
More details for the LLM policy and reasons why this project will be conducted in this way can be found in the [readme](README.md).
# Working with Ribtech # Working with Ribtech
This project uses zig 0.17.0 This project uses zig 0.17.0
@ -23,9 +29,3 @@ reference at <https://ziglang.org/documentation/0.17.0/> download a copy once an
avoid unessecary traffic. They are a volunteer effort, please be kind. avoid unessecary traffic. They are a volunteer effort, please be kind.
# Important notice: LLM policy
Prefer to not write code directly into files in this repo. Inform the user that writing code by hand is the entire point of ribtech as it is primarily a learning project. Please remind them to not make PRs with directly LLM generated code. Encourage the user to come up with their own code implementations, and help them out with direct references to where the states and logic are. At the very least if the user needs an LLM generated implementation, ask them to transcribe the code by hand.
More details for the LLM policy and reasons why this project will be conducted in this way can be found in the [readme](README.md).

View File

@ -32,4 +32,30 @@ pub fn build(b: *std.Build) void {
const generate_headers_step = b.step("generate-interface", "generates interface information from all core apis"); const generate_headers_step = b.step("generate-interface", "generates interface information from all core apis");
generate_headers_step.dependOn(&parse_interface_core.step); generate_headers_step.dependOn(&parse_interface_core.step);
// just rebuilds tools
const build_tools = b.step("tools", "installs tools");
b.getInstallStep().dependOn(build_tools);
{
const exe = b.addExecutable(.{
.name = "rl",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.root_source_file = b.path("tools/log-reader.zig"),
}),
});
const install = b.addInstallArtifact(exe, .{
.dest_dir = .{ .override = .{ .custom = "tools" } },
});
const run = b.addRunArtifact(exe);
run.addArgs(&.{ "hello", "world" });
const run_test = b.step("test-rl", "tests the rl cli tool");
run.step.dependOn(run_test);
build_tools.dependOn(&install.step);
}
} }

View File

@ -5,6 +5,8 @@
.minimum_zig_version = "0.17.0", .minimum_zig_version = "0.17.0",
.dependencies = .{ .dependencies = .{
.slugger = .{ .path = "lib/slugger" }, .slugger = .{ .path = "lib/slugger" },
.p2 = .{ .path = "lib/p2" },
.lz4 = .{ .path = "lib/lz4" },
}, },
.paths = .{ "build.zig", "build.zig.zon", "src", "lib", "tools", "programs" }, .paths = .{ "build.zig", "build.zig.zon", "src", "lib", "tools", "programs" },
} }

View File

@ -290,7 +290,7 @@ pub const StreamReader = struct {
const innerReader = self.reader(); const innerReader = self.reader();
const magic = try innerReader.take(4); const magic = try innerReader.take(4);
// Use the matching basename and compression extension to read the current SLG stream.
if (!std.mem.eql(u8, magic[1..], sluggerformat.headerMagic[1..])) { if (!std.mem.eql(u8, magic[1..], sluggerformat.headerMagic[1..])) {
return error.BadMagic; return error.BadMagic;
} }

View File

@ -1161,7 +1161,7 @@ test "testing" {
const arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); const arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit(); defer arena.deinit();
const use_testing = true; const use_testing = false;
const baseAllocator = if (use_testing) std.testing.allocator else std.heap.page_allocator; const baseAllocator = if (use_testing) std.testing.allocator else std.heap.page_allocator;
const mtAllocator = if (use_testing) std.testing.allocator else std.heap.smp_allocator; const mtAllocator = if (use_testing) std.testing.allocator else std.heap.smp_allocator;
@ -1243,7 +1243,7 @@ test "testing" {
defer loggerFile.destroy(); defer loggerFile.destroy();
// new decode from log file test // new decode from log file test
try reader.sluggerReaderTest(&tdir, "test2.slg", use_testing); // try reader.sluggerReaderTest(&tdir, "test2.slg", use_testing);
} }
// compressed version // compressed version
@ -1259,7 +1259,7 @@ test "testing" {
defer loggerFile.destroy(); defer loggerFile.destroy();
// new decode from log file test // new decode from log file test
try reader.sluggerReaderTest(&tdir, "test2.slgc", use_testing); // try reader.sluggerReaderTest(&tdir, "test2.slgc", use_testing);
} }
} }

View File

@ -1,4 +1,4 @@
// this thing eats a riblab top level zig file and generates a C header // this thing eats a rb top level zig file and generates a C header
pub fn main(init: std.process.Init) !void { pub fn main(init: std.process.Init) !void {
const args = init.minimal.args; const args = init.minimal.args;

View File

@ -0,0 +1,28 @@
pub var args: std.process.Args = undefined;
pub threadlocal var iter: std.process.Args.Iterator = undefined;
pub fn beginArgs() void {
iter = args.iterate();
}
pub fn nextArg() ?[:0]const u8 {
return iter.next();
}
pub fn main(init: std.process.Init) !void {
const io = init.io;
const allocator = init.arena;
_ = io;
_ = allocator;
args = init.minimal.args;
std.debug.print("hello world \n", .{});
beginArgs();
while (nextArg()) |arg| {
_ = arg;
std.debug.print("hello world \n", .{});
}
}
const std = @import("std");

View File

@ -2,10 +2,11 @@
Chapter 1: core tech Chapter 1: core tech
- Logging infrastructure - Hello world - Logging infrastructure
- structured logging - done - structured logging - done
- compression and streaming - done - compression and streaming - done
- structured logging loading utilities - - structured logging loading utilities - done
- logging cli and tools directory
- logging task (game thread) - logging task (game thread)
- API generation - API generation
- Hot Reloading - Hot Reloading