Skip to content

Commit 7f67e34

Browse files
authored
Merge pull request #92 from full-stack-plugins/rust-lifecycle-default-and-grammar-runtime
接通 Rust 默认生命周期、固定原生复检入口与 32-grammar 运行时候选
2 parents f09c074 + 0130198 commit 7f67e34

34 files changed

Lines changed: 709 additions & 83 deletions

‎.agents/plugins/marketplace.json‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
"source": {
1010
"source": "url",
1111
"url": "https://github.com/full-stack-plugins/codeguard-plugin.git",
12-
"ref": "v0.18.3"
12+
"ref": "v0.20.0"
1313
},
1414
"policy": {
1515
"installation": "AVAILABLE",
1616
"authentication": "ON_USE"
1717
},
1818
"category": "Developer Tools",
19-
"version": "0.18.3",
19+
"version": "0.20.0",
2020
"description": "Evidence-backed code checks and Git content gates for AI assistants, with Maven/Gradle module impact analysis. Save hooks provide feedback; unverified checks are explicit.",
21-
"icon": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.18.3/assets/official-logo.png",
21+
"icon": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.20.0/assets/official-logo.png",
2222
"interface": {
2323
"displayName": "CodeGuard",
2424
"shortDescription": "Trustworthy code checks and Java impact analysis",
25-
"logo": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.18.3/assets/official-logo.png"
25+
"logo": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.20.0/assets/official-logo.png"
2626
}
2727
}
2828
]

‎.claude-plugin/marketplace.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"name": "codeguard",
99
"description": "Evidence-backed code checks and Git content gates for AI assistants, with Maven/Gradle module impact analysis. Save hooks provide feedback; unverified checks are explicit.",
10-
"version": "0.18.3",
10+
"version": "0.20.0",
1111
"source": "./"
1212
}
1313
]

‎.codex-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeguard",
3-
"version": "0.18.3+codex.20261003",
3+
"version": "0.20.0+codex.20261004",
44
"description": "Evidence-backed code checks and Git content gates for AI assistants, with Maven/Gradle module impact analysis. Save hooks provide feedback; unverified checks are explicit.",
55
"author": {
66
"name": "Full Stack Skills / PartMe.AI",

‎.github/workflows/skills-check.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
run: |
1919
node --check runtime/codeguard_runtime.cjs
2020
node --check hooks/rust_runtime_dispatch.cjs
21-
node --test tests/test_rust_runtime.cjs
21+
node --test --test-concurrency=1 tests/test_rust_runtime.cjs tests/test_rust_lifecycle.cjs
2222
vendor-check:
2323
runs-on: ubuntu-latest
2424
strategy:

‎.zcode-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"en": "CodeGuard",
66
"zh-CN": "代码规范检查"
77
},
8-
"version": "0.18.3",
8+
"version": "0.20.0",
99
"description": "Evidence-backed code checks and Git content gates for AI assistants, with Maven/Gradle module impact analysis. Save hooks provide feedback; unverified checks are explicit.",
1010
"description_i18n": {
1111
"en": "Evidence-backed code checks and Git content gates for AI assistants, with Maven/Gradle module impact analysis. Save hooks provide feedback; unverified checks are explicit.",

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## 0.20.0 — 2026-10-04
4+
5+
- 固定 Rust CLI 0.1.4 与全部 32 份可执行、未验收 grammar 的公开制品身份。
6+
- canonical 与分发镜像的五类非阻断生命周期改走 Rust:指定保存范围、稳定确认任务、有界修复指引;缺运行时明确未完成,不下载、不回退 Python。
7+
- 同一固定运行时支持显式 init/next/task show/task verify,保留原生复检及可信关闭边界。
8+
- Git PreToolUse 与旧 CLI/MCP 暂留兼容入口;真实宿主、完整原生优先与语法精度未验收。
9+
310
## 0.18.3 — 2026-10-03
411

512
- 各宿主和市场清单的显示名称统一为 `CodeGuard`,保留中文本地化翻译。

‎README.md‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,43 @@
1010

1111
CodeGuard provides native check evidence and guards supported Git commit/push calls from AI coding assistants. PostToolUse gives feedback, not blocking. Verified violations block the Git call; unavailable checks remain explicitly UNVERIFIED. Passing a configured check is not proof of complete code correctness.
1212

13-
### Rust runtime candidate (macOS arm64)
13+
### Rust lifecycle runtime (macOS arm64)
1414

15-
The plugin now contains a **candidate**, explicit Rust runtime binding. It pins `@partme.ai/codeguard@0.1.2`, its registry tarball and native binary hashes, candidate source commit, platform, and check protocol major in [`runtime/codeguard.lock.json`](runtime/codeguard.lock.json). Install only on Apple Silicon macOS:
15+
Canonical [`hooks/hooks.json`](hooks/hooks.json) now routes SessionStart, UserPromptSubmit, PostToolUse, PostToolUseFailure and Stop through [`hooks/rust_runtime_dispatch.cjs`](hooks/rust_runtime_dispatch.cjs) to fixed `@partme.ai/codeguard@0.1.4`. [`runtime/codeguard.lock.json`](runtime/codeguard.lock.json) pins the public tarball, binary, source commit and 32 grammar-license hashes. Node 18+ is the thin host binding; Rust performs discovery, native checks, WASM parsing and task synchronization.
16+
17+
Install explicitly on Apple Silicon macOS, then initialize the selected project:
1618

1719
```bash
1820
node runtime/codeguard_runtime.cjs install --download
1921
node runtime/codeguard_runtime.cjs verify
22+
node runtime/codeguard_runtime.cjs exec init /absolute/project --apply --format=json
23+
node runtime/codeguard_runtime.cjs exec next /absolute/project --format=json
24+
node runtime/codeguard_runtime.cjs exec grammar status --format=json
25+
node runtime/codeguard_runtime.cjs exec check all /absolute/project --format=json
26+
# Use the real ID returned by next:
27+
node runtime/codeguard_runtime.cjs exec task show TASK_ID /absolute/project --format=json
28+
node runtime/codeguard_runtime.cjs exec task verify TASK_ID /absolute/project --zig-tool /absolute/zig --format=json
2029
```
2130

22-
For offline installation, use `install --tarball /absolute/path/to/partme.ai-codeguard-0.1.2.tgz`; the same lock hashes are enforced. Installation stages and verifies the package before switching the active receipt. [`hooks/rust_runtime_dispatch.cjs`](hooks/rust_runtime_dispatch.cjs) is a candidate Claude Code adapter for SessionStart, UserPromptSubmit, PostToolUse, PostToolUseFailure, and Stop. It rechecks the active binary before each call, never selects a random `codeguard` on `PATH`, and reports an incomplete runtime instead of falling back to Python. UserPromptSubmit returns fixed, non-blocking timing guidance; it does not run lint or treat prompt words as a Git gate. The current [`hooks/hooks.json`](hooks/hooks.json) still uses the legacy Python hooks; the Rust candidate has not been made the default, connected to a strict Git gate, or accepted on Codex/ZCode/Kimi. See the [candidate acceptance record](tests/rust-runtime-candidate.md) and [hook protocol](hooks/__protocol__.md).
31+
Offline installation uses `install --tarball /absolute/path/to/codeguard-public-0.1.4-darwin-arm64.tgz` with the same digest checks. Hooks do not download packages. An unavailable or unsupported runtime returns visible incomplete/setup guidance, without PATH codeguard or Python fallback. Successful edits select only the changed file: supported native Ruff/ESLint checks precede bounded WASM; suspected syntax creates a stable native-confirmation task in an initialized workspace. Zero recovery nodes only recommend native checking and never close an old task. The program contains all 32 runnable but **unqualified** grammar candidates, including Dart and Zig.
32+
33+
Prompt events only give fixed timing guidance, failed edits do not scan source, and Stop gives bounded next-task guidance with reentry handling. Internal check budget is 5 seconds, child-process timeout 8 seconds, host timeout 10 seconds. This does not certify all filesystem I/O deadlines or installed-host latency. `auto_fix_on_save` and legacy timeout settings remain compatibility fields; Rust does not silently apply fixes. An uninitialized workspace needs explicit init before durable tasks exist.
2334

24-
The installed plugin version is recorded in its manifests. The architecture refactor keeps the existing 68 managed skills and focuses on reliable evidence, clear module ownership and Java project awareness.
35+
The PreToolUse Git gate and legacy CLI/MCP remain Python compatibility surfaces; Copilot/OpenHands carry identical mirrors of the lifecycle binding for package consistency. Those mirrors are not installed-host acceptance. Installed Claude/Codex/ZCode/Kimi automation, trusted closure policy, full native-first coverage, other platforms and precision remain open. See [default lifecycle acceptance](tests/rust-lifecycle-default.md), [historical candidate evidence](tests/rust-runtime-candidate.md), [historical 32-grammar acceptance](tests/rust-wasm-runtime-candidate.md), and [hook protocol](hooks/__protocol__.md).
2536

2637
### Runtime boundaries
2738

2839
| Surface | What it checks | Result |
2940
|---|---|---|
3041
| PostToolUse | Edited file, for file-scoped tools | Feedback, exit 0; project-level checks deferred |
31-
| UserPromptSubmit | Working-tree changes relevant to commit intent | Advisory, never blocks the user message |
42+
| UserPromptSubmit | Fixed checking-time guidance; no source scan | Advisory, never blocks the user message |
3243
| PreToolUse Git gate | Proposed index snapshot or HEAD snapshot for push | Verified violations exit 2; uncertain checks report UNVERIFIED and fail open |
3344
| CLI check / MCP check_code_style | Project checks, including Java build verification | Explicit status, reason, raw exit code, ordered execution trace and output log |
3445
| pre-commit / CI | Independently configured checks | Separate acceptance; not replaced by hook success |
3546

3647
Hooks do not run in every host command surface automatically. Historical V0.5.4 installation evidence is not acceptance of this version in Codex, ZCode or Kimi.
3748

38-
Claude Code does not support a matcher on `UserPromptSubmit`: it starts the legacy Python Hook for every submitted prompt. The Hook returns before environment or repository work when its own intent filter does not match. A commit-intent prompt may still run the legacy soft check; only the actual Git command reaches the PreToolUse gate. The manifest cannot avoid per-prompt process startup, and installed-host latency has not been measured.
49+
Claude Code invokes the canonical Rust prompt binding on every UserPromptSubmit; no keyword matcher or prompt-triggered lint is used. Copilot/OpenHands carry the same mirror; their actual host protocol compatibility still needs separate acceptance. Actual Git commands still reach PreToolUse. Installed-host latency has not been measured.
3950

4051
### Verdict contract
4152

‎README.zh-CN.md‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,43 @@
1010

1111
CodeGuard 为 AI 编程助手提供原生检查证据,守护已支持的 Git 提交/推送调用。PostToolUse 只反馈、不阻断;确定违规会拦截 Git 调用;检查无法完成时明确 UNVERIFIED。某项检查通过,不等于代码完全正确。
1212

13-
### Rust 运行时候选(macOS arm64)
13+
### Rust 生命周期运行时(macOS arm64)
1414

15-
插件新增**显式候选** Rust 运行时绑定。[`runtime/codeguard.lock.json`](runtime/codeguard.lock.json) 固定 `@partme.ai/codeguard@0.1.2`、注册表 tarball 和原生二进制摘要、候选源码提交、平台及检查协议主版本。仅在 Apple Silicon macOS 上安装:
15+
Canonical [`hooks/hooks.json`](hooks/hooks.json) 现将 SessionStart、UserPromptSubmit、PostToolUse、PostToolUseFailure、Stop 经 [`hooks/rust_runtime_dispatch.cjs`](hooks/rust_runtime_dispatch.cjs) 接到固定 `@partme.ai/codeguard@0.1.4`。[`runtime/codeguard.lock.json`](runtime/codeguard.lock.json) 锁定公开 tarball、程序、源码提交和 32 份 grammar 许可证摘要。Node 18+ 仅绑定宿主;发现、原生检查、WASM 解析和任务同步由 Rust 执行。
16+
17+
在 Apple Silicon macOS 上显式安装,再初始化指定项目:
1618

1719
```bash
1820
node runtime/codeguard_runtime.cjs install --download
1921
node runtime/codeguard_runtime.cjs verify
22+
node runtime/codeguard_runtime.cjs exec init /absolute/project --apply --format=json
23+
node runtime/codeguard_runtime.cjs exec next /absolute/project --format=json
24+
node runtime/codeguard_runtime.cjs exec grammar status --format=json
25+
node runtime/codeguard_runtime.cjs exec check all /absolute/project --format=json
26+
# TASK_ID 使用 next 返回的真实 ID:
27+
node runtime/codeguard_runtime.cjs exec task show TASK_ID /absolute/project --format=json
28+
node runtime/codeguard_runtime.cjs exec task verify TASK_ID /absolute/project --zig-tool /absolute/zig --format=json
2029
```
2130

22-
离线安装可执行 `install --tarball /absolute/path/to/partme.ai-codeguard-0.1.2.tgz`,仍须满足同一锁定摘要。安装器先在暂存目录核验包,再切换活动收据。[`hooks/rust_runtime_dispatch.cjs`](hooks/rust_runtime_dispatch.cjs) 是 Claude Code 的 SessionStart、UserPromptSubmit、PostToolUse、PostToolUseFailure、Stop 候选适配器;每次调用前复核活动二进制,不从 PATH 随机选择 `codeguard`,缺运行时时报告未完成而不回退 Python。UserPromptSubmit 仅返回固定、非阻断的检查时机建议,不运行 lint,也不把提示词当作 Git 门禁。当前 [`hooks/hooks.json`](hooks/hooks.json) 仍使用旧 Python 钩子;Rust 候选尚未成为默认入口,未接严格 Git 门禁,也未在 Codex/ZCode/Kimi 完成宿主验收。见[候选验收记录](tests/rust-runtime-candidate.md)和[钩子协议](hooks/__protocol__.md)。
31+
离线安装使用 `install --tarball /absolute/path/to/codeguard-public-0.1.4-darwin-arm64.tgz`,仍核对相同摘要。普通 Hook 不下载包;运行时缺失或平台不支持时给出明确未完成与准备指引,不执行 PATH codeguard,不回退 Python。成功保存仅检查本次文件:已接入的 Ruff/ESLint 原生检查优先,再对未覆盖文件执行有界 WASM;疑似语法问题在已初始化工作区形成稳定原生确认任务。零恢复仅推荐原生检查,不能关闭旧任务。包内全部 32 份 grammar 可执行但**未完成精度验收**,包含 Dart、Zig。
32+
33+
提示事件只给固定时机指引,失败保存不扫描,Stop 提供有界 next 指引并处理重入。内部检查预算 5 秒、子进程超时 8 秒、宿主超时 10 秒;不表示所有文件系统 I/O 硬期限和真实宿主延迟已验收。auto_fix_on_save 与旧超时配置仅保留兼容含义,Rust 不静默修复源码;未初始化工作区须先显式 init 才能持久任务。
2334

24-
已安装插件的版本以各清单为准。本次架构重构保留现有 68 个受管技能,重点收敛判定证据、模块职责与 Java 项目感知。
35+
PreToolUse Git 门禁与旧 CLI/MCP 暂留 Python 兼容入口,Copilot/OpenHands 镜像与 canonical 绑定保持字节一致,不等于对应宿主验收完成。真实 Claude/Codex/ZCode/Kimi 自动触发、可信关闭策略、完整原生优先、多平台与精度仍缺。见[默认生命周期验收](tests/rust-lifecycle-default.md)、[历史候选证据](tests/rust-runtime-candidate.md)、[历史 32 语法验收](tests/rust-wasm-runtime-candidate.md)与[钩子协议](hooks/__protocol__.md)。
2536

2637
### 运行边界
2738

2839
| 入口 | 检查对象 | 结果 |
2940
|---|---|---|
3041
| PostToolUse | 文件型工具检查本次编辑文件 | 反馈、exit 0;项目级检查延后 |
31-
| UserPromptSubmit | 与提交意图相关的工作树变更 | 建议,不阻断用户消息 |
42+
| UserPromptSubmit | 固定检查时机指引,不扫描源码 | 建议,不阻断用户消息 |
3243
| PreToolUse Git 门禁 | 拟提交 index 快照或推送 HEAD 快照 | 确定违规 exit 2;不确定项明确 UNVERIFIED 并 fail-open |
3344
| CLI check / MCP check_code_style | 项目检查,含 Java 构建验证 | 明确状态、原因、原始退出码、顺序执行证据和日志 |
3445
| pre-commit / CI | 独立配置的检查 | 单独验收,不能由钩子成功代替 |
3546

3647
钩子不会自动覆盖宿主的每个命令入口。历史 V0.5.4 安装证据不能代表当前版本已在 Codex、ZCode、Kimi 验收。
3748

38-
Claude Code 的 `UserPromptSubmit` 不支持 matcher:每次提交提示都会启动旧 Python Hook。内部意图过滤未命中时,Hook 会在环境或仓库探测前退出;提交意图仍可能执行旧软检查,实际 Git 命令才进入 PreToolUse 门禁。清单无法消除每条提示的进程启动,已安装宿主的延迟尚未实测。
49+
Claude Code 每次 UserPromptSubmit 都启动 canonical Rust 提示绑定,不依赖关键词 matcher,也不因提示词启动 lint。Copilot/OpenHands 同步相同绑定镜像,其实际宿主协议仍待独立验收;实际 Git 命令仍由 PreToolUse 检查。真实宿主延迟尚未测量。
3950

4051
### 判定契约
4152

0 commit comments

Comments
 (0)