Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
93b5370dbf
commit
b3d4c3f7f0
1 file changed
+15
-9
@@ -6,8 +6,8 @@ Guidance for AI coding agents working in `zag`, the Zig port of the
|
||||
## Toolchain
|
||||
|
||||
- Zig 0.16.0 (`zig build`, `zig build test`). The 0.16 std API differs from older
|
||||
releases (`std.Io`, `std.process.Init`); check the scaffold in `src/main.zig` first.
|
||||
- Library code lives in `src/` and is exposed through `src/root.zig`; `src/main.zig` is the CLI.
|
||||
releases (`std.Io`, `std.process.Init`); look at `src/main.zig` and `src/daemon.zig` for working examples.
|
||||
- Library code lives in `src/` and is exposed through `src/root.zig`; `src/main.zig` is the thin binary entry point over `src/cli.zig`.
|
||||
|
||||
## Porting rules
|
||||
|
||||
@@ -48,13 +48,6 @@ Guidance for AI coding agents working in `zag`, the Zig port of the
|
||||
| `src/service.zig` | Daemon core: recovery, scheduler, IPC handlers, cleanup timer, reload |
|
||||
| `src/daemon.zig` | pid file, foreground run loop + signals, detached start, stop (TERM/KILL) |
|
||||
| `src/output.zig` | JSON/XML rendering of a value tree, human helpers (bytes, ages, local time, colour) |
|
||||
|
||||
## Build notes
|
||||
|
||||
- `build.zig` links libc (for `localtime_r`) and defaults Linux builds to `x86_64-linux-musl` so the
|
||||
binary is static and does not depend on the host's crt files (the host linker fails on newer gcc
|
||||
`.sframe` sections).
|
||||
- Width/fill on a signed integer prints a leading `+` (`{d:0>2}` of an `i64`); cast to unsigned first.
|
||||
| `src/args.zig` | Option parser (long/short, `=`/separate values, `--`, stop-at-positional) |
|
||||
| `src/query.zig` | Job listing filter shared by the daemon and offline CLI |
|
||||
| `src/logging.zig` | Timestamped stderr logging with a runtime level |
|
||||
@@ -64,3 +57,16 @@ Guidance for AI coding agents working in `zag`, the Zig port of the
|
||||
| `src/main.zig` | Binary entry point |
|
||||
| `test/e2e.sh` | End-to-end smoke test (`zig build e2e`) |
|
||||
| `src/servicemgr.zig` | systemd unit / launchd plist generation, install detection, manager commands |
|
||||
|
||||
## Build notes
|
||||
|
||||
- `build.zig` links libc (for `localtime_r`) and defaults Linux builds to `x86_64-linux-musl` so the
|
||||
binary is static and does not depend on the host's crt files (the host linker fails on newer gcc
|
||||
`.sframe` sections).
|
||||
- Width/fill on a signed integer prints a leading `+` (`{d:0>2}` of an `i64`); cast to unsigned first.
|
||||
- `zig build e2e` runs `test/e2e.sh` against the built binary; CI runs `zig fmt --check`, unit tests,
|
||||
the e2e test and a cross-compile of all four release targets (`.github/workflows/ci.yml`).
|
||||
- Releases: tag `vX.Y.Z` (must equal `.version` in `build.zig.zon`); `.github/workflows/release.yml`
|
||||
builds the static binaries and publishes them to Gitea.
|
||||
- Gotchas: never return a struct holding a pointer into itself (e.g. an `Allocating` writer plus a
|
||||
`jsonpretty.Writer` over it) -- initialise it in place (`Payload.init` in `cli_jobs.zig`).
|
||||
Reference in new issue
Block a user