Skip to content

Add Zig 0.16 support to zig-claude-kit with auto-detection#2

Open
kelp wants to merge 1 commit into
mainfrom
claude/zig-kit-0.16-upgrade-jWiTc
Open

Add Zig 0.16 support to zig-claude-kit with auto-detection#2
kelp wants to merge 1 commit into
mainfrom
claude/zig-kit-0.16-upgrade-jWiTc

Conversation

@kelp

@kelp kelp commented May 24, 2026

Copy link
Copy Markdown
Owner

Summary

Extend zig-claude-kit to support both Zig 0.15.x and 0.16, with automatic version detection from build.zig.zon. Zig 0.16 is a major breaking-change release ("I/O as an Interface") that requires entirely different patterns for I/O, filesystem, process management, and threading. The plugin now detects the target version and injects the correct training corrections.

Key Changes

  • New version detection script (scripts/detect-zig-version.sh): Reads minimum_zig_version from build.zig.zon, falls back to zig version, defaults to 0.16
  • Comprehensive 0.16 breaking changes reference (docs/ZIG_BREAKING_CHANGES-0.16.md): 900-line document covering the I/O-as-Interface redesign, filesystem moves (std.fsstd.Io), "Juicy Main" pattern, process state changes, sync primitive moves, and 40+ API renames
  • 0.16 knowledge audit script (scripts/zig-knowledge-audit-0.16.sh): 469-line test suite with 40+ probes validating breaking change claims against the installed Zig compiler
  • Version-specific training fragments: Separate claude-md-fragment-0.15.md and claude-md-fragment-0.16.md for injection into project CLAUDE.md
  • Updated skill documentation: /zig-patterns and /zig-check now auto-detect version and show matching patterns; /zig-init injects version-appropriate corrections
  • Renamed audit script: zig-knowledge-audit.shzig-knowledge-audit-0.15.sh for clarity; 0.16 variant added
  • Updated README and Makefile: Document dual-version support; add audit-0.15 and audit-0.16 targets

Notable Implementation Details

  • Detection is non-fatal: missing build.zig.zon or unrecognized version strings default to 0.16 (current release as of 2026-04-14)
  • The 0.16 reference document is structured as a "training override sheet" with quick-reference tables, error message diagnostics, and before/after code examples
  • Audit scripts use identical probe structure for both versions, allowing side-by-side validation
  • Skills guide users to run detection first, then apply version-specific patterns
  • All changes are backward-compatible: existing 0.15.x projects continue to work; new projects default to 0.16

Rationale

Zig 0.16's I/O redesign is so extensive that a single "correct pattern" document is insufficient. The plugin must now understand which version the user's project targets and provide matching guidance. This prevents Claude from generating code that compiles under 0.15 but fails under 0.16 (or vice versa).

https://claude.ai/code/session_016FCgpoqJGUY1fGpiB3R3Fj


Note

Low Risk
Changes are confined to plugin docs, shell/Python tooling, and skill instructions—no application runtime or auth/data paths. Main review focus is accuracy of 0.16 guidance and detection edge cases (e.g. wrong fragment if minimum_zig_version is stale).

Overview
zig-claude-kit now targets Zig 0.15.x and 0.16, with auto-detection (detect-zig-version.sh: build.zig.zon → installed zig → default 0.16). Session start, /zig-init, /zig-patterns, and /zig-check pick the matching training fragment and ruleset instead of a single 0.15-only path.

Adds 0.16-specific reference material: ZIG_BREAKING_CHANGES-0.16.md, claude-md-fragment-0.16.md, and zig-knowledge-audit-0.16.sh (compile probes for Io-as-Interface, Juicy Main, find*, etc.). The 0.15 audit is renamed to zig-knowledge-audit-0.15.sh; make audit routes by installed Zig, with explicit audit-0.15 / audit-0.16. Eval output goes under probes/<TARGET>/ via --target (default 0.16). Marketplace/README/CLAUDE.md and plugin manifest bump to 0.3.0 with expanded descriptions.

Reviewed by Cursor Bugbot for commit b786644. Bugbot is set up for automated code reviews on this repo. Configure here.

zig-claude-kit now supports both Zig 0.15.x and 0.16. The
session-start hook and skills auto-detect which version the
project targets by reading minimum_zig_version from
build.zig.zon (falling back to `zig version`, then to 0.16).

Per-version artifacts:
- docs/claude-md-fragment-{0.15,0.16}.md -- CLAUDE.md fragments
- docs/ZIG_BREAKING_CHANGES-{0.15,0.16}.md -- reference sheets
- scripts/zig-knowledge-audit-{0.15,0.16}.sh -- probe suites

The 0.16 reference distills vibeutils's migration documentation:
"Juicy Main" (std.process.Init), std.io -> std.Io rename,
std.fs.File/Dir -> std.Io.File/Dir move, every blocking call
takes io, std.mem.indexOf* -> find*, args/env no longer global,
sync primitives moved to Io (Pool replaced by Io.async/Group),
@type split into 8 builtins, error renames (CrossDevice,
FileBusy, StreamTooLong), managed hash maps removed.

Carry-over 0.15 corrections (usingnamespace, async/await,
BoundedArray, signed division, tokenize renames, for-loop
index, format method signature, build.zig root_module,
ArrayList allocator-per-method) still apply in 0.16.

The /zig-check skill now applies the version-matched ruleset
and reports detected target in its header. /zig-patterns shows
both versions inline. /zig-init injects the right fragment.

Bumps plugin to 0.3.0; updates marketplace.json description.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b786644. Configure here.

changes doc when relevant:

- 0.15: `${CLAUDE_PLUGIN_ROOT}/docs/ZIG_BREAKING_CHANGES-0.15.md`
- 0.16: `${CLAUDE_PLUGIN_ROOT}/docs/ZIG_BREAKING_CHANGES-0.16.md`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Report/fix steps nested under 0.16-only section heading

Medium Severity

Procedure steps ### 5. Report results and ### 6. Suggest fixes are placed after the ## Rules When Project Targets 0.16 heading (line 105), making them structurally nested under the 0.16-only section in the markdown heading hierarchy. For a 0.15 project, Claude may interpret these steps as 0.16-specific and skip reporting results and suggesting fixes entirely. Previously these steps lived directly under ## Procedure alongside the other numbered steps.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit b786644. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants