Skip to content

Commit fb95bba

Browse files
authored
Merge pull request #45 from full-stack-plugins/release/v0.13.0
refactor: CodeGuard 架构收敛与 v0.13.0 阶段发布
2 parents 61e2592 + a46147b commit fb95bba

95 files changed

Lines changed: 7931 additions & 3633 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.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/partme-ai/partme-codeguard-plugin.git",
12-
"ref": "v0.12.1"
12+
"ref": "v0.13.0"
1313
},
1414
"policy": {
1515
"installation": "AVAILABLE",
1616
"authentication": "ON_USE"
1717
},
1818
"category": "Developer Tools",
19-
"version": "0.12.1",
19+
"version": "0.13.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.12.1/assets/official-logo.png",
21+
"icon": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.13.0/assets/official-logo.png",
2222
"interface": {
2323
"displayName": "代码规范守卫",
2424
"shortDescription": "Trustworthy code checks and Java impact analysis",
25-
"logo": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.12.1/assets/official-logo.png"
25+
"logo": "https://cdn.jsdelivr.net/gh/full-stack-plugins/codeguard-plugin@v0.13.0/assets/official-logo.png"
2626
}
2727
}
2828
]

‎.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.12.1+codex.20260923",
3+
"version": "0.13.0+codex.20260923",
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: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
run: python3 -m pip install --disable-pip-version-check ruff==0.16.8
2222
- name: Check executable code quality
2323
run: ruff check hooks scripts tests
24+
- name: Verify core dependency boundaries and import cycles
25+
run: python3 scripts/check_architecture.py
2426
- name: Verify vendored skills match the lockfile digests
2527
run: python3 scripts/vendor/skill_vendor.py check --offline
2628
- name: Verify lockfile pins still match upstream refs and content

‎.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.12.1",
8+
"version": "0.13.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.",

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
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-
Current development version: **0.12.0**. No new skills were added for this release: priority is verdict integrity and Java project awareness.
13+
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.
1414

1515
### Runtime boundaries
1616

@@ -138,12 +138,13 @@ python3 scripts/vendor/skill_vendor.py check
138138
python3 -m unittest discover -s tests -q
139139
python3 tests/run_all.py
140140
python3 scripts/validate_languages_json.py
141+
python3 scripts/check_architecture.py
141142
ruff check hooks scripts tests
142143
```
143144

144145
Tests include real temporary Git repositories, native subprocess fixtures and official-SDK stdio MCP calls. Fixture wrapper success is not a real Maven/Gradle integration build. Live Codex/ZCode/Kimi loading, real project builds, online CVE scanner runs and precision/recall benchmarks require separate acceptance.
145146

146-
Current implementation and evidence: [architecture](docs/verdict-java-architecture.md), [verification report](docs/verification-verdict-java.md). Earlier design documents remain historical context: [original architecture](docs/partme-codeguard-plugin-Architecture.zh_CN.md), [roadmap](docs/technical-roadmap.zh_CN.md).
147+
Current implementation and evidence: [architecture and extension guide](docs/current-architecture.md), [refactor verification](openspec/changes/refactor-codeguard-architecture/verification.md). Earlier documents remain historical context: [verdict and Java architecture](docs/verdict-java-architecture.md), [prior verification](docs/verification-verdict-java.md), [original architecture](docs/partme-codeguard-plugin-Architecture.zh_CN.md), [roadmap](docs/technical-roadmap.zh_CN.md).
147148

148149
## License and privacy
149150

‎README.zh-CN.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

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

13-
当前开发版本:**0.12.0**。本版没有增加技能数量,重点是判定可信度与 Java 项目感知。
13+
已安装插件的版本以各清单为准。本次架构重构保留现有 68 个受管技能,重点收敛判定证据、模块职责与 Java 项目感知。
1414

1515
### 运行边界
1616

@@ -138,12 +138,13 @@ python3 scripts/vendor/skill_vendor.py check
138138
python3 -m unittest discover -s tests -q
139139
python3 tests/run_all.py
140140
python3 scripts/validate_languages_json.py
141+
python3 scripts/check_architecture.py
141142
ruff check hooks scripts tests
142143
```
143144

144145
测试包含真实临时 Git 仓库、原生子进程 fixture 与官方 SDK stdio MCP 调用。fixture wrapper 成功不是真实 Maven/Gradle 集成构建。Codex/ZCode/Kimi 当前版本加载、真实项目构建、在线漏洞扫描与准确率/召回率基准仍需独立验收。
145146

146-
当前实现与证据:[架构](docs/verdict-java-architecture.md)、[验证报告](docs/verification-verdict-java.md)。早期设计保留为历史参考:[原架构](docs/partme-codeguard-plugin-Architecture.zh_CN.md)、[路线图](docs/technical-roadmap.zh_CN.md)。
147+
当前实现与证据:[架构及扩展指南](docs/current-architecture.md)、[重构验证记录](openspec/changes/refactor-codeguard-architecture/verification.md)。旧文档保留为历史参考:[判定与 Java 架构](docs/verdict-java-architecture.md)、[此前验证报告](docs/verification-verdict-java.md)、[原架构](docs/partme-codeguard-plugin-Architecture.zh_CN.md)、[路线图](docs/technical-roadmap.zh_CN.md)。
147148

148149
## 许可与隐私
149150

‎docs/current-architecture.md‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# CodeGuard 当前架构与扩展指南
2+
3+
本文描述当前工作树的职责边界。发布版本以 `.zcode-plugin/plugin.json` 及其它生成清单为准;历史设计、计划和测试数量不能替代运行证据。
4+
5+
## 请求到结论
6+
7+
```mermaid
8+
flowchart TD
9+
Host[Codex / ZCode / Kimi] --> Entry[CLI / MCP / 五类 Hook]
10+
Entry --> Check[check_application / language_check]
11+
Entry --> Gate[gate / gate_checks]
12+
Entry --> Scan[cve / dockerfile]
13+
Check --> Plan[planning / Java 模块分析]
14+
Gate --> Plan
15+
Gate --> Git[Git 意图 / 暂存快照 / 基线]
16+
Check --> Exec[execution: argv + cwd + 原始输出]
17+
Gate --> Exec
18+
Scan --> Exec
19+
Exec --> Verdict[verdict / 报告解析]
20+
Plan --> Verdict
21+
Git --> Verdict
22+
Verdict --> Report[reporting / 宿主协议输出]
23+
Entry -. 会话与去重 .-> State[storage / hook_state / cache]
24+
```
25+
26+
`execution` 只记录进程证据,不把非零退出自动认定为代码违规。`verdict`、CVE 与 Dockerfile 报告解析决定 PASS、FAIL 或 UNVERIFIED;入口仅按各自协议呈现和聚合退出码。Git 提交检查使用 index 或预测暂存快照,推送检查使用 HEAD;保存钩子只给反馈。计划、未执行和未验证不能宣传为通过。
27+
28+
## 模块所有权
29+
30+
| 位置 | 责任 | 扩展边界 |
31+
|---|---|---|
32+
| `bin/codeguard`、`scripts/run_check.py`、`scripts/fix.py` | CLI 参数、输出与 MCP stdio 注册 | 不复制扫描器或判定逻辑 |
33+
| `hooks/` | 宿主 JSON、会话事件、通知与退出协议 | PreToolUse/PostToolUse 仍有待迁移的编排,不能称为纯适配器 |
34+
| `scripts/codeguard/check_application.py`、`language_check.py` | 语言选择、检查与修复请求、MCP 工具分发 | 不导入 MCP SDK;旧 `run_per_language.py` 仅再导出 |
35+
| `gate.py`、`gate_checks.py`、`repository_policy.py`、`baseline.py` | Git 门禁、单语言结果、安全规则及有证据的存量比较 | 只有准确基线失败且每条诊断及次数覆盖当前结果才可豁免 |
36+
| `java_build.py`、`java_impact.py`、`java_planning.py` 等 | 构建读取、纯影响闭包、命令选择与环境观察 | 默认保留跳过测试的行为;复杂构建保守扩大检查范围 |
37+
| `cve_reports.py`、`cve_policy.py`、`cve_scanners.py`、`cve.py` | 漏洞报告、阈值、进程适配与复扫编排 | 无有效结构化报告就没有安全通过结论 |
38+
| `dockerfile_reports.py`、`dockerfile.py` | hadolint/Trivy 结构化证据与逐文件扫描 | `dockerfile_security.py` 只解析参数和呈现报告 |
39+
| `execution.py`、`git_staging.py`、`git_snapshot.py`、`storage.py` | 外部进程、Git 内容面、原子状态读改写 | Git blob 保持字节,不经过文本检查执行器 |
40+
| `registry.py`、`registry_schema.py`、`discovery.py`、`config.py` | 已校验的语言表、发现与配置 | `languages.json` 是语言清单的事实源 |
41+
42+
这些是源代码层的边界。`scripts/check_architecture.py` 对第一方静态导入和环做门禁;动态加载、进程副作用和宿主行为仍需测试。
43+
44+
## 添加或修改能力
45+
46+
1. 先在现有 OpenSpec change 中描述用户可观察行为、失败和未验证场景,确定归属模块。新的入口只做参数与协议转换;应用服务编排,纯策略解析证据,执行器保留原始进程结果。
47+
2. 添加语言时修改 `scripts/languages.json`,跑 schema 与文档生成/一致性测试。稳定项必须有明确检查命令、探活、项目配置前提及范围规则;`{file}` 命令需要项目级 gate 或明确返回 UNVERIFIED。
48+
3. 添加扫描器时先定义有效报告结构、非零返回语义与阈值,再实现进程适配。缺工具、超时、坏报告、修复后复扫失败均要保留为未验证;不得从空 stdout 推断安全。
49+
4. 添加 Git 命令形态时在 `git_syntax` 解释意图,在 `git_staging` 绑定真实仓和 pathspec,在快照层保留字节;用临时 Git 仓验证实际 index 不被修改。
50+
5. 更新 `scripts/check_architecture.py` 的依赖白名单,并用反例测试证明逆向依赖或环会被拒绝。保留 CLI 路径、MCP 工具名、五类 hook JSON/退出协议及旧 Python 导入接口,除非有单独的兼容性变更。
51+
52+
## 本地验证与未覆盖面
53+
54+
```bash
55+
python3 -m unittest discover -s tests -q
56+
python3 tests/run_all.py
57+
ruff check hooks scripts tests
58+
python3 scripts/check_architecture.py
59+
python3 scripts/validate_languages_json.py
60+
python3 scripts/vendor/skill_vendor.py check --offline
61+
python3 scripts/vendor/skill_vendor.py check
62+
openspec validate refactor-codeguard-architecture --strict
63+
```
64+
65+
真实 Maven/Gradle 大型项目、联网漏洞数据库、57 种工具链、Windows 与三宿主已安装运行均需要独立证据。临时 Git 快照不是执行沙箱;构建和扫描命令以当前用户权限运行。当前重构的任务进度和本地证据见 `openspec/changes/refactor-codeguard-architecture/verification.md`,发布记录需待版本、CI、tag、市场和宿主分别核对。

‎docs/partme-codeguard-plugin-Architecture.zh_CN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# partme-codeguard-plugin 系统架构设计
22

3-
> **历史设计,不作为当前行为证明**:下文保存早期架构思路,其中 PostToolUse 阻断、javadoc 默认命令、延迟和“全覆盖”等叙述已不适用。当前 0.12.0 实现以[判定与 Java 架构](verdict-java-architecture.md)、[钩子协议](../hooks/__protocol__.md)及 OpenSpec 为准;历史图表中的指标不是本次实测。
3+
> **历史设计,不作为当前行为证明**:下文保存早期架构思路,其中 PostToolUse 阻断、javadoc 默认命令、延迟和“全覆盖”等叙述已不适用。当前模块职责见[架构及扩展指南](current-architecture.md)、[钩子协议](../hooks/__protocol__.md)及 OpenSpec;历史图表中的指标不是本次实测。
44
55
> **文档说明**:本架构文档描述 partme-codeguard-plugin 插件的内部结构、模块划分、数据流与三端适配设计。
66
>

‎docs/technical-roadmap.zh_CN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PartMe CodeGuard 技术方案与路线
22

3-
> **历史路线档案,不代表当前验收**:下文的 100% 准确率、<2 秒、零网络等数字未在本轮测量,不能当完成证据。0.12.0 已实现判定可信度与 Java 模块影响规划;当前事实见[架构与下一阶段](verdict-java-architecture.md)和[验证报告](verification-verdict-java.md)。后续优先真实项目验收、符号级影响、基线差分和修复复验,不扩张技能数量。
3+
> **历史路线档案,不代表当前验收**:下文的 100% 准确率、<2 秒、零网络等数字未在本轮测量,不能当完成证据。当前模块职责见[架构及扩展指南](current-architecture.md),本次重构进度见[验证记录](../openspec/changes/refactor-codeguard-architecture/verification.md)。后续真实项目、符号级影响与三宿主验收须分别取得证据。
44
55
> **文档说明**:本文档描述 partme-codeguard-plugin 插件的技术选型、关键决策、ADR(架构决策记录)和版本路线图。
66
>

‎docs/verdict-java-architecture.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# 判定可信度与 Java 项目感知
22

3-
版本:0.12.0(本地开发态)。规格事实源:`openspec/specs/`;实施记录归档为 `openspec/changes/archive/2026-09-22-converge-verdicts-java-impact/`。本轮不增加技能,不改外部受管技能。
3+
> 历史范围:本页记录 v0.12.0 的判定与 Java 感知设计;当前模块职责见[架构及扩展指南](current-architecture.md)。下文默认命令与后续计划仅适用于当时状态,不能代替当前 manifest、OpenSpec 或实测证据。
4+
5+
版本:0.12.0(当时的开发态)。规格事实源:`openspec/specs/`;实施记录归档为 `openspec/changes/archive/2026-09-22-converge-verdicts-java-impact/`。当时未增加技能,也未改外部受管技能。
46

57
## 1. 可执行链路
68

0 commit comments

Comments
 (0)