Skip to content

Commit f408c19

Browse files
committed
release: v0.4.0
1 parent 57369e6 commit f408c19

492 files changed

Lines changed: 16740 additions & 1795 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"authentication": "ON_USE"
1717
},
1818
"category": "Developer Tools",
19-
"version": "0.3.8",
19+
"version": "0.4.0",
2020
"description": "Cross-language code lint enforcement for AI coding assistants (ZCode, Claude Code, Codex CLI, Kimi Code): Java, Rust, TypeScript, Python. PostToolUse hook auto-runs the native linter on every AI-written file and blocks on failure in strict mode.",
2121
"icon": "https://raw.githubusercontent.com/partme-ai/partme-codeguard-plugin/main/assets/official-logo.png",
2222
"interface": {

‎.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.3.8+codex.20260919",
3+
"version": "0.4.0+codex.20260919",
44
"description": "Cross-language code lint enforcement for AI coding assistants (ZCode, Claude Code, Codex CLI, Kimi Code): Java, Rust, TypeScript, Python. PostToolUse hook auto-runs the native linter on every AI-written file and blocks on failure in strict mode.",
55
"author": {
66
"name": "Full Stack Skills / PartMe.AI",

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

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: skills-check
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
vendor-check:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
13+
with:
14+
fetch-depth: 0
15+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
16+
with:
17+
python-version: "3.12"
18+
- name: Verify vendored skills match the lockfile digests
19+
run: python3 scripts/vendor/skill_vendor.py check --offline
20+
- name: Verify lockfile pins still match upstream refs and content
21+
run: python3 scripts/vendor/skill_vendor.py check
22+
- name: Exercise vendor mutation and preservation behavior
23+
run: python3 -m unittest tests/test_skill_vendor.py -v
24+
- name: Reject direct edits to externally managed skills
25+
if: github.event_name == 'pull_request'
26+
run: |
27+
changed="$(git diff --name-only "origin/${{ github.base_ref }}...HEAD")"
28+
CHANGED="$changed" python3 - <<'PY'
29+
import json
30+
import os
31+
import sys
32+
33+
changed = {line for line in os.environ["CHANGED"].splitlines() if line}
34+
if "skills.lock.json" in changed:
35+
raise SystemExit(0)
36+
lock = json.load(open("skills.lock.json", encoding="utf-8"))
37+
prefixes = {
38+
f"{source['dest'].rstrip('/')}/{name}/"
39+
for source in lock["sources"]
40+
for name in source["skills"]
41+
}
42+
bypassed = sorted(path for path in changed if any(path.startswith(prefix) for prefix in prefixes))
43+
if bypassed:
44+
print("::error::Externally managed skills changed without skills.lock.json: " + ", ".join(bypassed))
45+
print("Edit codeguard-skills, release a new tag, then run scripts/vendor/skill_vendor.py update.")
46+
sys.exit(1)
47+
PY

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

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: skills-sync
2+
3+
on:
4+
repository_dispatch:
5+
types: [skills-updated]
6+
schedule:
7+
- cron: "41 3 * * *"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
sync:
16+
runs-on: ubuntu-latest
17+
env:
18+
GH_TOKEN: ${{ secrets.SKILLS_SYNC_TOKEN || secrets.GITHUB_TOKEN }}
19+
steps:
20+
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
21+
with:
22+
token: ${{ secrets.SKILLS_SYNC_TOKEN || secrets.GITHUB_TOKEN }}
23+
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
24+
with:
25+
python-version: "3.12"
26+
- name: Vendor skills from pinned sources
27+
run: python3 scripts/vendor/skill_vendor.py update
28+
- name: Verify the fresh snapshot
29+
run: python3 scripts/vendor/skill_vendor.py check
30+
- name: Push a sync branch when the snapshot changed
31+
id: push
32+
run: |
33+
if git diff --quiet && git diff --cached --quiet; then
34+
echo "vendored skills already current; nothing to sync"
35+
echo "changed=false" >> "$GITHUB_OUTPUT"
36+
exit 0
37+
fi
38+
git config user.name "github-actions[bot]"
39+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
40+
git checkout -B chore/skills-sync
41+
git add skills/ skills.lock.json
42+
git commit -m "chore: sync vendored skills from codeguard-skills"
43+
git push --force-with-lease origin chore/skills-sync
44+
echo "changed=true" >> "$GITHUB_OUTPUT"
45+
- name: Open the sync PR if none exists
46+
if: steps.push.outputs.changed == 'true'
47+
run: |
48+
if gh pr view chore/skills-sync >/dev/null 2>&1; then
49+
echo "sync PR already open; branch updated"
50+
exit 0
51+
fi
52+
gh pr create \
53+
--title "chore: sync vendored Codeguard skills" \
54+
--body "Automated refresh of the checksummed skill snapshot from skills.lock.json. Externally managed skills come from full-stack-skills/codeguard-skills; unlisted plugin-local skills are preserved." \
55+
--head chore/skills-sync --base main \
56+
--label skills-sync

‎.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.3.8",
8+
"version": "0.4.0",
99
"description": "Cross-language code lint enforcement for AI coding assistants (ZCode, Claude Code, Codex CLI, Kimi Code): Java, Rust, TypeScript, Python. PostToolUse hook auto-runs the native linter on every AI-written file and blocks on failure in strict mode.",
1010
"description_i18n": {
1111
"en": "Cross-language code lint enforcement. PostToolUse hook auto-runs the language-specific linter on every AI-written file; failed lint blocks further writes when strict_mode is on. Ships ready-to-go .pre-commit-config.yaml templates for Java/Rust/TypeScript/Python.",

‎AGENTS.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# AGENTS.md — 代码规范守卫
22

3+
## 技能来源边界(强制)
4+
5+
- `skills.lock.json` 中列出的技能以 `full-stack-skills/codeguard-skills` 为事实源;不得直接编辑插件内对应目录。
6+
- 更新受管技能时,先在外部技能仓完成修改、TRACE 评估和不可变 tag,再更新 lock ref,执行 `python3 scripts/vendor/skill_vendor.py update`。
7+
- 提交前必须执行 `python3 scripts/vendor/skill_vendor.py check --offline` 和在线 `check`。
8+
- 只有插件内部定制技能可以在本仓 `skills/` 直接维护,并且必须不出现在 `skills.lock.json` 中;vendor 工具会保留这些目录。
9+
- Hooks、linters、commands、MCP 配置和可执行脚本仍由插件仓维护。
10+
311
## 版本升级要求(强制,AI 必须遵守)
412

513
任何代码改动——无论大小——都必须 bump 版本并发布。PartMe.AI 插件市场

‎README.md‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ AI code that passes lint on first try
6565
|---|---|
6666
| Plugin ID | `partme-codeguard-plugin` |
6767
| Hosts | ZCode, Claude Code, Codex CLI, Kimi Code |
68-
| Current version | `0.2.0` |
68+
| Current version | `0.4.0` |
6969
| ZCode manifest | `.zcode-plugin/plugin.json` |
7070
| Codex manifest | `.codex-plugin/plugin.json` |
7171
| MCP server | `python3 scripts/run_check.py --mcp` (stdio JSON-RPC) |
@@ -95,9 +95,17 @@ Beyond linting, codeguard ships standalone governance skills sourced from the te
9595

9696
The commit gate is pre-wired in the pre-commit template (`stages: [commit-msg]`); branch and security skills guide the AI during branch creation, interface development, and pre-merge review.
9797

98-
### Skill architecture
98+
### External skill source
9999

100-
All 18 skills follow a unified authoring standard abstracted from [rust-skills](https://github.com/full-stack-skills/rust-skills): a lean `SKILL.md` (trigger metadata, capability boundaries, workflow, gotchas) plus `references/` for progressive disclosure of deep material. The standard is documented in [docs/CODEGUARD_SKILLS_SPEC.md](docs/CODEGUARD_SKILLS_SPEC.md). Skills cross-route to each other (e.g. the main entry routes deep Java questions to the java-skills repository, commit format to codeguard-git-commit).
100+
The 68 portable skills are authored in [full-stack-skills/codeguard-skills](https://github.com/full-stack-skills/codeguard-skills), not independently inside this plugin. This repository vendors the complete `v0.1.0` snapshot so installed plugins work offline:
101+
102+
- `skills.lock.json` pins the upstream repository, immutable tag, resolved commit, managed skill names, and per-skill SHA-256 digests.
103+
- `python3 scripts/vendor/skill_vendor.py update` refreshes only the skill names listed in the lock.
104+
- `python3 scripts/vendor/skill_vendor.py check --offline` verifies the packaged snapshot; omit `--offline` to verify the upstream ref and content too.
105+
- Do not directly edit a locked skill directory. Change and release `codeguard-skills`, update the lock ref, then run the vendor update.
106+
- Plugin-specific skills may remain under `skills/` only when they are intentionally absent from `skills.lock.json`; the vendor leaves those directories untouched.
107+
108+
Hooks, linters, commands, MCP wiring, and executable scripts remain plugin-owned. The authoring standard is documented in [docs/CODEGUARD_SKILLS_SPEC.md](docs/CODEGUARD_SKILLS_SPEC.md).
101109

102110
## Capabilities and boundaries
103111

@@ -211,8 +219,10 @@ partme-codeguard-plugin/
211219
├── scripts/
212220
│ ├── detect_lang.py # language detection + linter command table (shared)
213221
│ ├── run_check.py # main CLI: detect + run all linters + report
214-
│ └── fix.py # auto-fix CLI
215-
├── skills/ # 68 SKILL.md (main + init + 22 languages + 2 git + 3 security + planned-language skeletons)
222+
│ ├── fix.py # auto-fix CLI
223+
│ └── vendor/skill_vendor.py # lock-driven external skill vendor/check
224+
├── skills.lock.json # upstream tag/commit + managed skills + SHA-256 digests
225+
├── skills/ # 68 vendored skills from codeguard-skills v0.1.0
216226
│ ├── codeguard/ # main entry
217227
│ ├── codeguard-init/ # one-line bootstrap
218228
│ ├── codeguard-{java,rust,typescript,python}/

‎README.zh-CN.md‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ AI 一次写出就过 lint 的代码
6565
|---|---|
6666
| 插件 ID | `partme-codeguard-plugin` |
6767
| 宿主 | ZCode、Claude Code、Codex CLI、Kimi Code |
68-
| 当前版本 | `0.2.0` |
68+
| 当前版本 | `0.4.0` |
6969
| ZCode manifest | `.zcode-plugin/plugin.json` |
7070
| Codex manifest | `.codex-plugin/plugin.json` |
7171
| MCP 服务 | `python3 scripts/run_check.py --mcp`(stdio JSON-RPC) |
@@ -81,6 +81,18 @@ AI 一次写出就过 lint 的代码
8181
| **Stable**(53 种,默认强制) | Java、Rust、TypeScript/JavaScript、Python、Go、C#、Kotlin、Swift、PHP、Ruby、Scala、Shell、Dockerfile、YAML、Elixir、CSS/SCSS、Markdown、SQL、TOML、HTML、Protobuf、Terraform/OpenTofu、Nix、Dart、Solidity、Ansible、Perl、Groovy、Clojure、PowerShell、Zig、Nim、Crystal、Julia(仅格式化)、Pascal(仅格式化)、Elm、Lua、Luau、C++(clang-tidy)、Objective-C、CUDA、GraphQL、VB.NET、Erlang、R、CFML 等,详见 LANGUAGES.md |
8282
| **Planned**(4 种,无独立 CLI linter) | Metal、ArkTS(HarmonyOS)、COBOL、Liquid(theme-check 待接通) |
8383

84+
## 外部技能来源
85+
86+
68 个可复用技能统一在 [full-stack-skills/codeguard-skills](https://github.com/full-stack-skills/codeguard-skills) 编写,插件不再维护一份独立手写副本。为保证插件安装后离线可用,本仓库 vendor 了完整的 `v0.1.0` 快照:
87+
88+
- `skills.lock.json` 固定上游仓库、不可变 tag、解析后的 commit、受管技能清单与逐技能 SHA-256。
89+
- `python3 scripts/vendor/skill_vendor.py update` 只刷新 lock 中列出的技能。
90+
- `python3 scripts/vendor/skill_vendor.py check --offline` 校验插件内快照;去掉 `--offline` 还会校验上游 ref 与内容。
91+
- 不得直接修改 lock 管理的技能目录。应先在 `codeguard-skills` 修改并发布,再更新 lock ref 并执行 vendor update。
92+
- 只有插件内部定制技能可以直接保留在 `skills/`,且必须明确不列入 `skills.lock.json`;vendor 不会删除或覆盖这些目录。
93+
94+
Hooks、linters、commands、MCP 接线和可执行脚本仍由插件仓负责。
95+
8496
## 能力与边界
8597

8698
### 已支持
@@ -192,8 +204,10 @@ partme-codeguard-plugin/
192204
├── scripts/
193205
│ ├── detect_lang.py # 语言检测 + linter 命令表(共享)
194206
│ ├── run_check.py # 主 CLI:检测 + 跑全量 + 报告
195-
│ └── fix.py # 自动修复 CLI
196-
├── skills/ # 68 个 SKILL.md(主入口 + init + 22 语言强制 + 2 Git + 3 安全 + planned 语言骨架)
207+
│ ├── fix.py # 自动修复 CLI
208+
│ └── vendor/skill_vendor.py # lock 驱动的外部技能 vendor/check
209+
├── skills.lock.json # 上游 tag/commit + 受管技能 + SHA-256
210+
├── skills/ # 从 codeguard-skills v0.1.0 vendor 的 68 个技能
197211
│ ├── codeguard/ # 主入口
198212
│ ├── codeguard-init/ # 一行接入
199213
│ ├── codeguard-{java,rust,typescript,python}/

‎docs/CODEGUARD_SKILLS_SPEC.md‎

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# codeguard 技能编写标准(CODEGUARD_SKILLS_SPEC)
22

3-
> **文档说明**:定义 partme-codeguard-plugin 内置技能(skills/)的抽象标准与结构规范。标准从 [rust-skills](https://github.com/full-stack-skills/rust-skills) 抽象而来,并结合 codeguard「门禁型插件」的定位做了裁剪。
3+
> **文档说明**:定义 Codeguard 技能的抽象标准与结构规范。可复用技能的事实源是 [full-stack-skills/codeguard-skills](https://github.com/full-stack-skills/codeguard-skills);插件内 `skills/` 是由 `skills.lock.json` 固定并校验的离线 vendor 快照。
44
>
5-
> **版本**:V1.0 **最后更新**:2026-09-18
5+
> **版本**:V1.1 **最后更新**:2026-09-19
66
77
---
88

@@ -21,6 +21,17 @@ skills/codeguard-java/
2121

2222
核心思想(学自 rust-skills):**SKILL.md 保持精瘦可一次读完,深度资料放 references/ 按需加载**——让 AI 快速拿到 80% 高频规则,需要 20% 深度时再展开。
2323

24+
### 1.1 所有权与发布边界
25+
26+
| 内容 | 事实源 | 修改方式 |
27+
|---|---|---|
28+
| 可复用 Codeguard 技能 | `full-stack-skills/codeguard-skills` | 在外部仓修改、评估、发布新 tag,再更新插件 lock |
29+
| 插件离线技能快照 | 本仓 `skills/` 中被 lock 列出的目录 | 只允许由 `scripts/vendor/skill_vendor.py update` 生成 |
30+
| 插件内部定制技能 | 本仓 `skills/` 中未被 lock 列出的目录 | 可在插件仓直接维护,vendor 会保留 |
31+
| Hooks、linters、commands、MCP、运行脚本 | `codeguard-plugin` | 在插件仓开发、测试和发布 |
32+
33+
禁止直接修改 lock 管理的技能目录,否则离线/在线 vendor check 会失败。
34+
2435
## 2. SKILL.md 结构规范(九段式)
2536

2637
```markdown
@@ -82,7 +93,7 @@ description: |
8293
| 族 | 技能 | 职责 |
8394
|---|---|---|
8495
| **元** | codeguard(主入口)、codeguard-init | 全局路由、项目接入 |
85-
| **语言族**(11) | codeguard-{java,rust,typescript,python,go,csharp,kotlin,swift,php,ruby,scala} | 各语言 lint/format 门禁与规范速查 |
96+
| **语言/文件族**(57) | codeguard-{java,rust,typescript,python,...} | 53 个 stable 与 4 个 planned 的 lint/format 门禁及规范速查 |
8697
| **Git 治理族**(2) | codeguard-git-branch、codeguard-git-commit | 分支模型门禁、提交格式门禁 |
8798
| **安全治理族**(3) | codeguard-security-{code,api,data} | 泄露/CVE、越权/上传、加密/脱敏/等保密评 |
8899

@@ -91,7 +102,18 @@ description: |
91102
- 语言的**深度语言问题**(语法、框架、库用法)→ 路由到对应语言技能仓(如 full-stack-skills/java-skills)
92103
- codeguard 只负责「规范门禁」:lint/format/安全检查/提交与分支治理
93104

94-
## 4. 结构升级路线
105+
## 4. Vendor 工作流
106+
107+
```bash
108+
# 上游发布新不可变 tag 后,先更新 skills.lock.json 中的 ref
109+
python3 scripts/vendor/skill_vendor.py update
110+
python3 scripts/vendor/skill_vendor.py check --offline
111+
python3 scripts/vendor/skill_vendor.py check
112+
```
113+
114+
`update` 只替换 lock 中列出的目录,不会触碰未列出的插件内部定制技能。CI 同时执行离线与在线校验,并拒绝未同步 lock 的受管技能直接编辑。
115+
116+
## 5. 结构升级路线
95117

96118
| 阶段 | 状态 | 说明 |
97119
|---|---|---|
@@ -102,4 +124,4 @@ description: |
102124

103125
---
104126

105-
**文档版本**:V1.0 **状态**:✅ 生效
127+
**文档版本**:V1.1 **状态**:✅ 生效

‎docs/LANGUAGES.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383

8484
1. `scripts/languages.json` 注册表加一条语言定义(id/extensions/markers/lint/format/status)。
8585
2. `linters/<lang>/` 放配置模板。
86-
3. `skills/codeguard-<lang>/SKILL.md` 写规范速查(frontmatter `name` == 目录名)。
87-
4. 重跑 `python3 scripts/gen_language_docs.py` 同步本文档。
88-
5. `python3 scripts/detect_lang.py <项目>` 冒烟验证。
89-
86+
3. 在外部 `full-stack-skills/codeguard-skills` 新增或更新 `skills/codeguard-<lang>/`,完成 lint、TRACE 评估并发布不可变 tag。
87+
4. 更新插件 `skills.lock.json` 的 ref 和技能清单,运行 `python3 scripts/vendor/skill_vendor.py update`。
88+
5. 重跑 `python3 scripts/gen_language_docs.py` 同步本文档。
89+
6. 执行 vendor 离线/在线检查,并用 `python3 scripts/detect_lang.py <项目>` 冒烟验证。

0 commit comments

Comments
 (0)