repo-audit-tool 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +67 -0
- package/AUDIT.md +802 -0
- package/BEST-PRACTICES.md +268 -0
- package/CLAUDE.md +1 -0
- package/CONTRIBUTING.md +42 -0
- package/DEVELOPMENT.md +112 -0
- package/HANDOFF.md +124 -0
- package/LICENSE +21 -0
- package/PUBLISHING.md +66 -0
- package/README.en.md +71 -0
- package/README.md +71 -0
- package/REPO-AUDIT.md +107 -0
- package/REPO-CLASSIFICATION.md +137 -0
- package/SECURITY.md +19 -0
- package/docs/repo-audit/AGENT-GUIDE.md +474 -0
- package/docs/repo-audit/HUMAN-GUIDE.md +749 -0
- package/package.json +36 -0
- package/repo-audit.mjs +1507 -0
- package/rules/categories/archive.yaml +48 -0
- package/rules/categories/content.yaml +34 -0
- package/rules/categories/dsh-plugin.yaml +79 -0
- package/rules/categories/go-service.yaml +67 -0
- package/rules/categories/product-oss.yaml +75 -0
- package/rules/categories/python-app.yaml +60 -0
- package/rules/categories/sandbox.yaml +33 -0
- package/rules/domains/docs.yaml +105 -0
- package/rules/domains/git.yaml +52 -0
- package/rules/domains/quality.yaml +69 -0
- package/rules/domains/security.yaml +79 -0
- package/shim/repo-audit.cmd +7 -0
- package/shim/repo-audit.ps1 +4 -0
- package/shim/repo-audit.sh +5 -0
- package/templates/AGENT-GUIDE.md +331 -0
- package/templates/README.md +192 -0
- package/templates/UPDATE-MODEL.md +141 -0
- package/templates/UPDATE-PLAN.md +79 -0
- package/templates/categories/content/AGENTS-append.md +6 -0
- package/templates/categories/content/CATEGORY.md +26 -0
- package/templates/categories/content/README.en.md +12 -0
- package/templates/categories/content/README.md +14 -0
- package/templates/categories/content/gitignore-append.md +6 -0
- package/templates/categories/dsh-plugin/AGENTS-append.md +21 -0
- package/templates/categories/dsh-plugin/CATEGORY.md +9 -0
- package/templates/categories/dsh-plugin/CONTRIBUTING-append.md +22 -0
- package/templates/categories/dsh-plugin/DEVELOPMENT-append.md +71 -0
- package/templates/categories/dsh-plugin/PUBLISHING-append.md +53 -0
- package/templates/categories/dsh-plugin/README-append.md +28 -0
- package/templates/categories/dsh-plugin/README.en.md +44 -0
- package/templates/categories/dsh-plugin/gitignore-append.md +15 -0
- package/templates/categories/go-service/.githooks/pre-commit +13 -0
- package/templates/categories/go-service/.github/workflows/ci.yml +31 -0
- package/templates/categories/go-service/.github/workflows/release.yml +58 -0
- package/templates/categories/go-service/.goreleaser.yaml +86 -0
- package/templates/categories/go-service/AGENTS-append.md +7 -0
- package/templates/categories/go-service/CATEGORY.md +33 -0
- package/templates/categories/go-service/CONTRIBUTING-append.md +13 -0
- package/templates/categories/go-service/DEVELOPMENT-append.md +21 -0
- package/templates/categories/go-service/Makefile +21 -0
- package/templates/categories/go-service/PUBLISHING-append.md +48 -0
- package/templates/categories/go-service/PUBLISHING.md +59 -0
- package/templates/categories/go-service/README-append.md +26 -0
- package/templates/categories/go-service/README.en.md +43 -0
- package/templates/categories/go-service/gitignore-append.md +13 -0
- package/templates/categories/product-oss/.github/CODEOWNERS +6 -0
- package/templates/categories/product-oss/.github/ISSUE_TEMPLATE/bug_report.yml +52 -0
- package/templates/categories/product-oss/.github/ISSUE_TEMPLATE/config.yml +8 -0
- package/templates/categories/product-oss/.github/dependabot.yml +28 -0
- package/templates/categories/product-oss/.github/workflows/dependency-review.yml +18 -0
- package/templates/categories/product-oss/.github/workflows/release-please.yml +39 -0
- package/templates/categories/product-oss/.release-please-manifest.json +3 -0
- package/templates/categories/product-oss/CATEGORY.md +27 -0
- package/templates/categories/product-oss/CHANGELOG.md +14 -0
- package/templates/categories/product-oss/PULL_REQUEST_TEMPLATE.md +15 -0
- package/templates/categories/product-oss/SUPPORT.md +71 -0
- package/templates/categories/product-oss/release-please-config.json +10 -0
- package/templates/categories/python-app/.githooks/pre-commit +13 -0
- package/templates/categories/python-app/.github/workflows/ci.yml +33 -0
- package/templates/categories/python-app/.github/workflows/publish.yml +112 -0
- package/templates/categories/python-app/AGENTS-append.md +18 -0
- package/templates/categories/python-app/CATEGORY.md +34 -0
- package/templates/categories/python-app/CONTRIBUTING-append.md +13 -0
- package/templates/categories/python-app/DEVELOPMENT-append.md +21 -0
- package/templates/categories/python-app/PUBLISHING-append.md +52 -0
- package/templates/categories/python-app/PUBLISHING.md +61 -0
- package/templates/categories/python-app/README-append.md +27 -0
- package/templates/categories/python-app/README.en.md +44 -0
- package/templates/categories/python-app/gitignore-append.md +19 -0
- package/templates/categories/python-app/pyproject.toml +41 -0
- package/templates/categories/python-app/scripts/verify.py +39 -0
- package/templates/categories/sandbox/AGENTS-append.md +7 -0
- package/templates/categories/sandbox/CATEGORY.md +31 -0
- package/templates/categories/sandbox/README.en.md +24 -0
- package/templates/categories/sandbox/README.md +23 -0
- package/templates/check-single-source.mjs +107 -0
- package/templates/common/AGENTS-core.md +28 -0
- package/templates/common/CONTRIBUTING-core.md +21 -0
- package/templates/common/DEVELOPMENT-core.md +45 -0
- package/templates/common/PUBLISHING-core.md +31 -0
- package/templates/common/README-core.md +60 -0
- package/templates/common/SECURITY-core.md +19 -0
- package/templates/common/copilot-instructions.md +5 -0
- package/templates/common/gitignore-core.md +11 -0
- package/templates/repo-root/.githooks/pre-commit +20 -0
- package/templates/repo-root/.github/workflows/ci.yml +45 -0
- package/templates/repo-root/.github/workflows/publish.yml +77 -0
- package/templates/repo-root/CLAUDE.md +3 -0
- package/templates/repo-root/LICENSE +21 -0
- package/templates/repo-root/package.json +71 -0
- package/templates/repo-root/scripts/build.mjs +24 -0
- package/templates/repo-root/scripts/check-deploy.mjs +176 -0
- package/templates/repo-root/scripts/verify.mjs +52 -0
- package/templates/repo-root/src/config.ts +25 -0
- package/templates/repo-root/src/index.ts +40 -0
- package/templates/repo-root/tsconfig.build.json +22 -0
- package/templates/repo-root/tsconfig.json +23 -0
- package/templates/scaffold.mjs +793 -0
- package/templates/skill/SKILL.md +47 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# AGENTS(AI 协作与工程纪律)
|
|
2
|
+
|
|
3
|
+
> 本文件由模板**单源拼装**(`common/AGENTS-core.md` + 分类 append)——重复段不要在仓库里手改;
|
|
4
|
+
> 改规则先改模板源,再重新生成。人工协作者同样适用本文件全部条款。
|
|
5
|
+
|
|
6
|
+
## 提交规范
|
|
7
|
+
|
|
8
|
+
- **Conventional Commits 前缀 + 中文描述**:`feat(scope):` / `fix(scope):` / `refactor:` / `docs:` / `test:` / `chore:`;scope 用模块名;发布提交固定 `chore: release v<版本> — <一句话主旨>`。
|
|
9
|
+
- **提交前必须跑本仓验证链单源**并全绿;CI 与本地同源。FAIL 修根因,不绕过;确需 `--no-verify` 必须在提交说明注明原因。
|
|
10
|
+
|
|
11
|
+
## AI 协作守则(agent 贡献者必读)
|
|
12
|
+
|
|
13
|
+
1. **不猜 API/契约**:写代码前用宿主/依赖的检查工具查精确签名;测试 stub 必须按真实契约形状写(实践库教训:失真的 stub 会掩盖契约 bug)。
|
|
14
|
+
2. **完成的定义 = 验证链全绿 + 实机/测试验收**,不是"代码写完";声称完成前附验证输出。
|
|
15
|
+
3. **机密红线**:本机绝对路径、个人邮箱、token/密钥、会过时的部署实况描述一律不入库;提交前 `git grep` 自查(模式见本仓 .gitignore 注释区)。
|
|
16
|
+
4. **不静默绕过门禁**:pre-commit/CI FAIL 先修根因;中间态确需跳过必须留痕注明。
|
|
17
|
+
5. **改动最小化**:不顺手重构、不改无关文件;构建产物与锁文件按仓库既定规则处理(产物不入库、锁文件必须入库)。
|
|
18
|
+
6. **文档同步**:行为/接口变化同步 README、DEVELOPMENT 速查表(或等价文档)、CHANGELOG(如有)。
|
|
19
|
+
7. **冲突处理**:本文件与生成它的模板源冲突时以模板源为准并回写;用户显式指示优先于本文件,但需在 PR/提交说明中标注冲突点。
|
|
20
|
+
|
|
21
|
+
## 分类纪律:repo-audit 工具仓库
|
|
22
|
+
|
|
23
|
+
### 验证链(提交前必跑,全绿方可提交)
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 本仓自审计(期望 100/A)
|
|
27
|
+
npm run audit
|
|
28
|
+
|
|
29
|
+
# 验证链(规则加载 / 引擎运行 / 跨平台 shim / 手册完整)
|
|
30
|
+
npm run verify
|
|
31
|
+
|
|
32
|
+
# 单元测试
|
|
33
|
+
npm test
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 开发规范
|
|
37
|
+
|
|
38
|
+
- **零 npm 依赖**:不引入任何 npm 依赖,全部用 Node 内置模块(`node:fs`、`node:child_process`、`node:path` 等)
|
|
39
|
+
- **ESM 模块**:`"type": "module"`,所有 `.mjs` 文件使用 `import`/`export`
|
|
40
|
+
- **Node ≥18**:使用 Node 18+ 特性(如 `node:util` 的 `parseArgs`)
|
|
41
|
+
- **规则 YAML**:`rules/` 下的 YAML 按 `domains/` + `categories/` 组织,规则 ID 前缀对应域(SEC/DOC/GIT/QUA/COM/DEP)
|
|
42
|
+
- **模板生成**:`templates/` 下的 scaffold 使用单源拼装(core + 分类 append),产物内勿手改拼装段
|
|
43
|
+
- **工具只读**:`repo-audit.mjs` 是纯只读工具,不修改目标仓库任何文件
|
|
44
|
+
|
|
45
|
+
### 文档同步
|
|
46
|
+
|
|
47
|
+
- 规则/引擎变更 → 同步更新 `docs/repo-audit/AGENT-GUIDE.md` 和 `HUMAN-GUIDE.md`
|
|
48
|
+
- 审计方法论变更 → 同步更新 `AUDIT.md`
|
|
49
|
+
- 最佳实践调研更新 → 同步更新 `BEST-PRACTICES.md`
|
|
50
|
+
- 分类检测逻辑变更 → 同步更新 `REPO-CLASSIFICATION.md`
|
|
51
|
+
|
|
52
|
+
### 机密自查
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# 提交前检查(排除 docs/ 和模板目录)
|
|
56
|
+
# 1) API 密钥 / Token(GitHub/DeepSeek/OpenAI 等常见前缀)
|
|
57
|
+
git grep -nE '(sk-|ghp_|gho_|ghu_|github_pat_|AKIA|sk-or-|ollama)' -- '*.mjs' '*.yaml' '*.json' '*.yml' '*.sh' '*.cmd' '*.ps1'
|
|
58
|
+
# 2) 本机绝对路径(任何用户目录)
|
|
59
|
+
git grep -nE '/home/[^/]+/|/Users/[^/]+/|C:\\Users\\' -- '*.mjs' '*.yaml' '*.json' '*.yml'
|
|
60
|
+
# 3) 凭证字面量(排除 rules/ 中规则 ID 和描述)
|
|
61
|
+
git grep -nE 'password|secret|api_key|apikey|token' -- '*.mjs' '*.yaml' '*.json' '*.yml' | grep -v 'rules/'
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## 安全考虑
|
|
65
|
+
|
|
66
|
+
- 漏洞**不要**公开披露:走 SECURITY.md 指定的私密漏洞报告渠道。
|
|
67
|
+
- 依赖与 CI action 升级走仓库既定自动化(如有);引入新依赖需在 PR 说明中给出理由。
|