diff --git a/AGENTS.md b/AGENTS.md index e7038d1..6744b6b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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 This project uses zig 0.17.0 @@ -23,9 +29,3 @@ reference at download a copy once an 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). - diff --git a/engine/build.zig b/engine/build.zig index cc865f8..48c1217 100644 --- a/engine/build.zig +++ b/engine/build.zig @@ -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"); 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); + } } diff --git a/engine/build.zig.zon b/engine/build.zig.zon index a12d9b8..247b523 100644 --- a/engine/build.zig.zon +++ b/engine/build.zig.zon @@ -5,6 +5,8 @@ .minimum_zig_version = "0.17.0", .dependencies = .{ .slugger = .{ .path = "lib/slugger" }, + .p2 = .{ .path = "lib/p2" }, + .lz4 = .{ .path = "lib/lz4" }, }, .paths = .{ "build.zig", "build.zig.zon", "src", "lib", "tools", "programs" }, } diff --git a/engine/lib/slugger/src/reader.zig b/engine/lib/slugger/src/reader.zig index d8b55c0..d5f7498 100644 --- a/engine/lib/slugger/src/reader.zig +++ b/engine/lib/slugger/src/reader.zig @@ -290,7 +290,7 @@ pub const StreamReader = struct { const innerReader = self.reader(); 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..])) { return error.BadMagic; } diff --git a/engine/lib/slugger/src/slugger.zig b/engine/lib/slugger/src/slugger.zig index 051ba44..250b26e 100644 --- a/engine/lib/slugger/src/slugger.zig +++ b/engine/lib/slugger/src/slugger.zig @@ -1161,7 +1161,7 @@ test "testing" { const arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); 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 mtAllocator = if (use_testing) std.testing.allocator else std.heap.smp_allocator; @@ -1243,7 +1243,7 @@ test "testing" { defer loggerFile.destroy(); // new decode from log file test - try reader.sluggerReaderTest(&tdir, "test2.slg", use_testing); + // try reader.sluggerReaderTest(&tdir, "test2.slg", use_testing); } // compressed version @@ -1259,7 +1259,7 @@ test "testing" { defer loggerFile.destroy(); // new decode from log file test - try reader.sluggerReaderTest(&tdir, "test2.slgc", use_testing); + // try reader.sluggerReaderTest(&tdir, "test2.slgc", use_testing); } } diff --git a/engine/tools/interface-parser.zig b/engine/tools/interface-parser.zig index 1aa6f24..5c60c55 100644 --- a/engine/tools/interface-parser.zig +++ b/engine/tools/interface-parser.zig @@ -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 { const args = init.minimal.args; diff --git a/engine/tools/log-reader.zig b/engine/tools/log-reader.zig new file mode 100644 index 0000000..982ca74 --- /dev/null +++ b/engine/tools/log-reader.zig @@ -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"); diff --git a/roadmap.md b/roadmap.md index 91a8a7e..33cdd40 100644 --- a/roadmap.md +++ b/roadmap.md @@ -2,10 +2,11 @@ Chapter 1: core tech -- Logging infrastructure +- Hello world - Logging infrastructure - structured logging - done - compression and streaming - done - - structured logging loading utilities - + - structured logging loading utilities - done + - logging cli and tools directory - logging task (game thread) - API generation - Hot Reloading