Skip to content

Latest commit

 

History

History
50 lines (32 loc) · 1.33 KB

File metadata and controls

50 lines (32 loc) · 1.33 KB

Zig Native

Semantic Zig tools for Codex, backed by zls and the Zig compiler.

This plugin exposes a local MCP server that gives Codex token-efficient Zig code intelligence without relying on text search alone. It starts zls per project root for semantic LSP queries and shells out to zig for builds, tests, formatting checks, AST checks, and environment probes.

Features

  • zls hover, definitions, references, document symbols, workspace symbols, diagnostics, and code actions.
  • zig build.
  • zig test <file>.
  • zig ast-check.
  • Non-mutating zig fmt --check.
  • Lightweight --selftest fixture for smoke testing the MCP server.

Requirements

  • Python 3.11 or newer.
  • zig on PATH.
  • zls on PATH.

Installation

Place this directory at:

%USERPROFILE%\.codex\plugins\zig-native

The plugin metadata is in .codex-plugin/plugin.json, and the MCP server command is in .mcp.json.

Smoke Test

Run from the plugin root:

python scripts\zig_native_mcp.py --selftest

Expected result: JSON output with "ok": true.

Tooling Notes

  • LSP positions use 1-based line and 1-based character inputs.
  • Call zig_lsp_diagnostics before zig_lsp_code_actions when asking for quick fixes on a problematic range.
  • zig_fmt_check checks formatting without rewriting files.

License

MIT.