Productionize: build.zig.zon, autodoc, examples, agent metadata#2
Productionize: build.zig.zon, autodoc, examples, agent metadata#2Jesssullivan merged 1 commit intomainfrom
Conversation
- Add build.zig.zon with fingerprint for Zig package manager support - Add Zig module export and docs step to build.zig - Add /// doc comments to all exported functions in ffi.zig - Enrich doc comments in notify.zig, notify_linux.zig, notify_macos.zig - Add examples/send_notification.c (C FFI usage demo) - Add CONTRIBUTING.md with install/dev/style instructions - Upgrade AGENTS.md to six-area format (Persona/Stack/Structure/Commands/Style/Boundaries) - Add Installation section to README.md (zig fetch + submodule) - Rename LLMS.txt to llms.txt, rewrite as slim llmstxt.org index - Add llms-full.txt with complete API reference
Greptile SummaryThis PR productionizes
Confidence Score: 3/5Two P1 defects in build.zig cause zig build docs and the Zig package manager integration to fail on Linux; safe to merge only if Linux support is not yet a priority. Two P1 issues both stem from the same root cause: new modules created from src/ffi.zig without the Linux system include paths. This breaks both zig build docs and zig fetch consumers on Linux, which are two of the primary features this PR advertises. All other changes (docs, comments, CONTRIBUTING.md, example) are clean. build.zig — both the b.addModule call (lines 33-37) and the docs_lib module (lines 50-58) need Linux include paths added. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[zig build] --> B[root_module\nsrc/ffi.zig\n+ Linux include paths]
B --> C[lib: libzig-notify.a\nb.installArtifact]
A --> D[b.addModule zig-notify\nsrc/ffi.zig\n⚠️ NO Linux include paths\nresult discarded]
D --> E[dep.module zig-notify\nfor downstream consumers\n❌ fails on Linux]
A --> F[docs step\ndocs_lib module\nsrc/ffi.zig\n⚠️ NO Linux include paths]
F --> G[getEmittedDocs\nzig-out/docs/\n❌ fails on Linux]
A --> H[test step\nroot: src/notify.zig]
H --> I[unit tests]
style D fill:#f99,stroke:#c00
style E fill:#f99,stroke:#c00
style F fill:#f99,stroke:#c00
style G fill:#f99,stroke:#c00
Reviews (1): Last reviewed commit: "Productionize: build.zig.zon, autodoc, e..." | Re-trigger Greptile |
| _ = b.addModule("zig-notify", .{ | ||
| .root_source_file = b.path("src/ffi.zig"), | ||
| .target = target, | ||
| .optimize = optimize, | ||
| }); |
There was a problem hiding this comment.
Zig module missing Linux include paths — breaks
zig fetch consumers on Linux
The module returned by b.addModule is immediately discarded (_ = ...), so there is no way to attach the system include paths that root_module gets. When a downstream consumer calls dep.module("zig-notify") on Linux, the module resolves ffi.zig → notify.zig → notify_linux.zig → @cImport("libnotify/notify.h") without any of the /usr/include/libnotify or glib-2.0 paths, causing a compile error. The result should be retained so the same Linux include paths applied to root_module can be applied here.
| const docs_lib = b.addLibrary(.{ | ||
| .name = "zig-notify", | ||
| .root_module = b.createModule(.{ | ||
| .root_source_file = b.path("src/ffi.zig"), | ||
| .target = target, | ||
| .optimize = optimize, | ||
| }), | ||
| .linkage = .static, | ||
| }); | ||
| const install_docs = b.addInstallDirectory(.{ | ||
| .source_dir = docs_lib.getEmittedDocs(), | ||
| .install_dir = .prefix, | ||
| .install_subdir = "docs", | ||
| }); | ||
| docs_step.dependOn(&install_docs.step); |
There was a problem hiding this comment.
zig build docs fails on Linux — docs module missing C include paths
docs_lib is built from a freshly created module that has none of the Linux system include paths (/usr/include/libnotify, the glib-2.0 paths) that root_module receives. Zig's autodoc step does full semantic analysis, which resolves @cImport in notify_linux.zig. On Linux, this will fail with a "file not found" error for libnotify/notify.h. The fix is to apply the same conditional include paths to the docs module's inner module, or reuse the already-configured root_module for doc emission.
| _ = b.addModule("zig-notify", .{ | ||
| .root_source_file = b.path("src/ffi.zig"), | ||
| .target = target, | ||
| .optimize = optimize, | ||
| }); |
There was a problem hiding this comment.
Zig module root exposes C FFI surface instead of idiomatic Zig API
b.addModule points to src/ffi.zig, which only contains export fn wrappers returning c_int. Zig consumers following the README/CONTRIBUTING instructions (addImport("zig-notify", dep.module("zig-notify"))) will get C-style functions with no error unions or idiomatic types, instead of the ergonomic send/init/deinit from src/notify.zig. Consider using src/notify.zig as the module root so Zig-to-Zig callers get the proper API; the static library for C consumers can still use root_module (which is ffi.zig-rooted).
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| * Demonstrates init, send (with body and title-only), and deinit. | ||
| * | ||
| * Build (after zig build): |
There was a problem hiding this comment.
Build instructions use relative paths that break when run from
examples/
The comment says to compile with -Iinclude and -Lzig-out/lib, but the file lives in examples/, so those paths are only valid when the command is run from the repo root. A user who naturally cd examples/ before compiling will get "directory not found" errors. Either add a note that the commands should be run from the repo root, or adjust the paths.
Summary
build.zig.zonwith fingerprint for Zig package manager (zig fetch --save) supportb.addModule) andzig build docsautodoc step tobuild.zig///doc comments to all 4 FFI exports insrc/ffi.zigand enrich comments innotify.zig,notify_linux.zig,notify_macos.zigexamples/send_notification.cdemonstrating init, send (with body and title-only), deinitCONTRIBUTING.mdwith install, dev prerequisites (libnotify-dev on Linux, none on macOS), and style guideAGENTS.mdto six-area format: Persona, Stack, Structure, Commands, Style, BoundariesREADME.mdwithzig fetchand git submodule instructionsLLMS.txttollms.txt, rewrite as slim llmstxt.org index; addllms-full.txtwith complete API referenceTest plan
zig build -Doptimize=ReleaseFast)zig build docsgenerates autodoc outputexamples/send_notification.ccompiles against the built library