Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .agents/plugins/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
"source": {
"source": "url",
"url": "https://github.com/full-stack-plugins/codeguard-plugin.git",
"ref": "v0.18.3"
"ref": "v0.20.0"
Comment thread
loong10k marked this conversation as resolved.
},
"policy": {
"installation": "AVAILABLE",
"authentication": "ON_USE"
},
"category": "Developer Tools",
"version": "0.18.3",
"version": "0.20.0",
"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.",
"icon": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.18.3/assets/official-logo.png",
"icon": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.20.0/assets/official-logo.png",
"interface": {
"displayName": "CodeGuard",
"shortDescription": "Trustworthy code checks and Java impact analysis",
"logo": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.18.3/assets/official-logo.png"
"logo": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.20.0/assets/official-logo.png"
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
"name": "codeguard",
"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.",
"version": "0.18.3",
"version": "0.20.0",
"source": "./"
}
]
Expand Down
2 changes: 1 addition & 1 deletion .codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeguard",
"version": "0.18.3+codex.20261003",
"version": "0.20.0+codex.20261004",
"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.",
"author": {
"name": "Full Stack Skills / PartMe.AI",
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/skills-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
run: |
node --check runtime/codeguard_runtime.cjs
node --check hooks/rust_runtime_dispatch.cjs
node --test tests/test_rust_runtime.cjs
node --test --test-concurrency=1 tests/test_rust_runtime.cjs tests/test_rust_lifecycle.cjs
vendor-check:
runs-on: ubuntu-latest
strategy:
Expand Down
2 changes: 1 addition & 1 deletion .zcode-plugin/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"en": "CodeGuard",
"zh-CN": "代码规范检查"
},
"version": "0.18.3",
"version": "0.20.0",
"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.",
"description_i18n": {
"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.",
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 0.20.0 — 2026-10-04

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

## 0.18.3 — 2026-10-03

- 各宿主和市场清单的显示名称统一为 `CodeGuard`,保留中文本地化翻译。
Expand Down
23 changes: 17 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,43 @@

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.

### Rust runtime candidate (macOS arm64)
### Rust lifecycle runtime (macOS arm64)

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:
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.

Install explicitly on Apple Silicon macOS, then initialize the selected project:

```bash
node runtime/codeguard_runtime.cjs install --download
node runtime/codeguard_runtime.cjs verify
node runtime/codeguard_runtime.cjs exec init /absolute/project --apply --format=json
node runtime/codeguard_runtime.cjs exec next /absolute/project --format=json
node runtime/codeguard_runtime.cjs exec grammar status --format=json
node runtime/codeguard_runtime.cjs exec check all /absolute/project --format=json
# Use the real ID returned by next:
node runtime/codeguard_runtime.cjs exec task show TASK_ID /absolute/project --format=json
node runtime/codeguard_runtime.cjs exec task verify TASK_ID /absolute/project --zig-tool /absolute/zig --format=json
```

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).
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.

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.

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.
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).

### Runtime boundaries

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

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.

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.
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.

### Verdict contract

Expand Down
23 changes: 17 additions & 6 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,43 @@

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

### Rust 运行时候选(macOS arm64)
### Rust 生命周期运行时(macOS arm64)

插件新增**显式候选** Rust 运行时绑定。[`runtime/codeguard.lock.json`](runtime/codeguard.lock.json) 固定 `@partme.ai/codeguard@0.1.2`、注册表 tarball 和原生二进制摘要、候选源码提交、平台及检查协议主版本。仅在 Apple Silicon macOS 上安装:
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 执行。

在 Apple Silicon macOS 上显式安装,再初始化指定项目:

```bash
node runtime/codeguard_runtime.cjs install --download
node runtime/codeguard_runtime.cjs verify
node runtime/codeguard_runtime.cjs exec init /absolute/project --apply --format=json
node runtime/codeguard_runtime.cjs exec next /absolute/project --format=json
node runtime/codeguard_runtime.cjs exec grammar status --format=json
node runtime/codeguard_runtime.cjs exec check all /absolute/project --format=json
# TASK_ID 使用 next 返回的真实 ID:
node runtime/codeguard_runtime.cjs exec task show TASK_ID /absolute/project --format=json
node runtime/codeguard_runtime.cjs exec task verify TASK_ID /absolute/project --zig-tool /absolute/zig --format=json
```

离线安装可执行 `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)。
离线安装使用 `install --tarball /absolute/path/to/codeguard-public-0.1.4-darwin-arm64.tgz`,仍核对相同摘要。普通 Hook 不下载包;运行时缺失或平台不支持时给出明确未完成与准备指引,不执行 PATH codeguard,不回退 Python。成功保存仅检查本次文件:已接入的 Ruff/ESLint 原生检查优先,再对未覆盖文件执行有界 WASM;疑似语法问题在已初始化工作区形成稳定原生确认任务。零恢复仅推荐原生检查,不能关闭旧任务。包内全部 32 份 grammar 可执行但**未完成精度验收**,包含 Dart、Zig。

提示事件只给固定时机指引,失败保存不扫描,Stop 提供有界 next 指引并处理重入。内部检查预算 5 秒、子进程超时 8 秒、宿主超时 10 秒;不表示所有文件系统 I/O 硬期限和真实宿主延迟已验收。auto_fix_on_save 与旧超时配置仅保留兼容含义,Rust 不静默修复源码;未初始化工作区须先显式 init 才能持久任务。

已安装插件的版本以各清单为准。本次架构重构保留现有 68 个受管技能,重点收敛判定证据、模块职责与 Java 项目感知。
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)。

### 运行边界

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

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

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

### 判定契约

Expand Down
Loading
Loading