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.
Files changed (117) hide show
  1. package/AGENTS.md +67 -0
  2. package/AUDIT.md +802 -0
  3. package/BEST-PRACTICES.md +268 -0
  4. package/CLAUDE.md +1 -0
  5. package/CONTRIBUTING.md +42 -0
  6. package/DEVELOPMENT.md +112 -0
  7. package/HANDOFF.md +124 -0
  8. package/LICENSE +21 -0
  9. package/PUBLISHING.md +66 -0
  10. package/README.en.md +71 -0
  11. package/README.md +71 -0
  12. package/REPO-AUDIT.md +107 -0
  13. package/REPO-CLASSIFICATION.md +137 -0
  14. package/SECURITY.md +19 -0
  15. package/docs/repo-audit/AGENT-GUIDE.md +474 -0
  16. package/docs/repo-audit/HUMAN-GUIDE.md +749 -0
  17. package/package.json +36 -0
  18. package/repo-audit.mjs +1507 -0
  19. package/rules/categories/archive.yaml +48 -0
  20. package/rules/categories/content.yaml +34 -0
  21. package/rules/categories/dsh-plugin.yaml +79 -0
  22. package/rules/categories/go-service.yaml +67 -0
  23. package/rules/categories/product-oss.yaml +75 -0
  24. package/rules/categories/python-app.yaml +60 -0
  25. package/rules/categories/sandbox.yaml +33 -0
  26. package/rules/domains/docs.yaml +105 -0
  27. package/rules/domains/git.yaml +52 -0
  28. package/rules/domains/quality.yaml +69 -0
  29. package/rules/domains/security.yaml +79 -0
  30. package/shim/repo-audit.cmd +7 -0
  31. package/shim/repo-audit.ps1 +4 -0
  32. package/shim/repo-audit.sh +5 -0
  33. package/templates/AGENT-GUIDE.md +331 -0
  34. package/templates/README.md +192 -0
  35. package/templates/UPDATE-MODEL.md +141 -0
  36. package/templates/UPDATE-PLAN.md +79 -0
  37. package/templates/categories/content/AGENTS-append.md +6 -0
  38. package/templates/categories/content/CATEGORY.md +26 -0
  39. package/templates/categories/content/README.en.md +12 -0
  40. package/templates/categories/content/README.md +14 -0
  41. package/templates/categories/content/gitignore-append.md +6 -0
  42. package/templates/categories/dsh-plugin/AGENTS-append.md +21 -0
  43. package/templates/categories/dsh-plugin/CATEGORY.md +9 -0
  44. package/templates/categories/dsh-plugin/CONTRIBUTING-append.md +22 -0
  45. package/templates/categories/dsh-plugin/DEVELOPMENT-append.md +71 -0
  46. package/templates/categories/dsh-plugin/PUBLISHING-append.md +53 -0
  47. package/templates/categories/dsh-plugin/README-append.md +28 -0
  48. package/templates/categories/dsh-plugin/README.en.md +44 -0
  49. package/templates/categories/dsh-plugin/gitignore-append.md +15 -0
  50. package/templates/categories/go-service/.githooks/pre-commit +13 -0
  51. package/templates/categories/go-service/.github/workflows/ci.yml +31 -0
  52. package/templates/categories/go-service/.github/workflows/release.yml +58 -0
  53. package/templates/categories/go-service/.goreleaser.yaml +86 -0
  54. package/templates/categories/go-service/AGENTS-append.md +7 -0
  55. package/templates/categories/go-service/CATEGORY.md +33 -0
  56. package/templates/categories/go-service/CONTRIBUTING-append.md +13 -0
  57. package/templates/categories/go-service/DEVELOPMENT-append.md +21 -0
  58. package/templates/categories/go-service/Makefile +21 -0
  59. package/templates/categories/go-service/PUBLISHING-append.md +48 -0
  60. package/templates/categories/go-service/PUBLISHING.md +59 -0
  61. package/templates/categories/go-service/README-append.md +26 -0
  62. package/templates/categories/go-service/README.en.md +43 -0
  63. package/templates/categories/go-service/gitignore-append.md +13 -0
  64. package/templates/categories/product-oss/.github/CODEOWNERS +6 -0
  65. package/templates/categories/product-oss/.github/ISSUE_TEMPLATE/bug_report.yml +52 -0
  66. package/templates/categories/product-oss/.github/ISSUE_TEMPLATE/config.yml +8 -0
  67. package/templates/categories/product-oss/.github/dependabot.yml +28 -0
  68. package/templates/categories/product-oss/.github/workflows/dependency-review.yml +18 -0
  69. package/templates/categories/product-oss/.github/workflows/release-please.yml +39 -0
  70. package/templates/categories/product-oss/.release-please-manifest.json +3 -0
  71. package/templates/categories/product-oss/CATEGORY.md +27 -0
  72. package/templates/categories/product-oss/CHANGELOG.md +14 -0
  73. package/templates/categories/product-oss/PULL_REQUEST_TEMPLATE.md +15 -0
  74. package/templates/categories/product-oss/SUPPORT.md +71 -0
  75. package/templates/categories/product-oss/release-please-config.json +10 -0
  76. package/templates/categories/python-app/.githooks/pre-commit +13 -0
  77. package/templates/categories/python-app/.github/workflows/ci.yml +33 -0
  78. package/templates/categories/python-app/.github/workflows/publish.yml +112 -0
  79. package/templates/categories/python-app/AGENTS-append.md +18 -0
  80. package/templates/categories/python-app/CATEGORY.md +34 -0
  81. package/templates/categories/python-app/CONTRIBUTING-append.md +13 -0
  82. package/templates/categories/python-app/DEVELOPMENT-append.md +21 -0
  83. package/templates/categories/python-app/PUBLISHING-append.md +52 -0
  84. package/templates/categories/python-app/PUBLISHING.md +61 -0
  85. package/templates/categories/python-app/README-append.md +27 -0
  86. package/templates/categories/python-app/README.en.md +44 -0
  87. package/templates/categories/python-app/gitignore-append.md +19 -0
  88. package/templates/categories/python-app/pyproject.toml +41 -0
  89. package/templates/categories/python-app/scripts/verify.py +39 -0
  90. package/templates/categories/sandbox/AGENTS-append.md +7 -0
  91. package/templates/categories/sandbox/CATEGORY.md +31 -0
  92. package/templates/categories/sandbox/README.en.md +24 -0
  93. package/templates/categories/sandbox/README.md +23 -0
  94. package/templates/check-single-source.mjs +107 -0
  95. package/templates/common/AGENTS-core.md +28 -0
  96. package/templates/common/CONTRIBUTING-core.md +21 -0
  97. package/templates/common/DEVELOPMENT-core.md +45 -0
  98. package/templates/common/PUBLISHING-core.md +31 -0
  99. package/templates/common/README-core.md +60 -0
  100. package/templates/common/SECURITY-core.md +19 -0
  101. package/templates/common/copilot-instructions.md +5 -0
  102. package/templates/common/gitignore-core.md +11 -0
  103. package/templates/repo-root/.githooks/pre-commit +20 -0
  104. package/templates/repo-root/.github/workflows/ci.yml +45 -0
  105. package/templates/repo-root/.github/workflows/publish.yml +77 -0
  106. package/templates/repo-root/CLAUDE.md +3 -0
  107. package/templates/repo-root/LICENSE +21 -0
  108. package/templates/repo-root/package.json +71 -0
  109. package/templates/repo-root/scripts/build.mjs +24 -0
  110. package/templates/repo-root/scripts/check-deploy.mjs +176 -0
  111. package/templates/repo-root/scripts/verify.mjs +52 -0
  112. package/templates/repo-root/src/config.ts +25 -0
  113. package/templates/repo-root/src/index.ts +40 -0
  114. package/templates/repo-root/tsconfig.build.json +22 -0
  115. package/templates/repo-root/tsconfig.json +23 -0
  116. package/templates/scaffold.mjs +793 -0
  117. package/templates/skill/SKILL.md +47 -0
@@ -0,0 +1,48 @@
1
+ rules:
2
+ - id: SEC-001
3
+ title: "无硬编码密钥/凭证"
4
+ severity: critical
5
+ domain: security
6
+ applies_to: ["archive"]
7
+ check: grep
8
+ params:
9
+ patterns:
10
+ - "(?i)(password|secret|api.?key|token|credential)\\s*[=:]\s*['\"]?[^\\s'\"]{8,}"
11
+ exclude:
12
+ - ".git/"
13
+ - "node_modules/"
14
+ - ".scaffold/"
15
+ - "audit-report/"
16
+ - "templates/"
17
+ - "CHANGELOG.md"
18
+ - "HANDOFF.md"
19
+ - "HANDOFF-ARCHIVE/"
20
+ - ".agents/"
21
+ max_match: 0
22
+ description: "归档仓仍不应含硬编码密钥(安全底线,不因归档豁免)"
23
+ note: "归档仓仅保留安全/脱敏检查,其余工程规范不适用"
24
+
25
+ - id: SEC-003
26
+ title: "无本机绝对路径泄漏"
27
+ severity: minor
28
+ domain: security
29
+ applies_to: ["archive"]
30
+ check: grep
31
+ params:
32
+ patterns:
33
+ - "/home/[a-z]"
34
+ - "/Users/[a-z]"
35
+ - "/mnt/[a-z]"
36
+ exclude:
37
+ - ".git/"
38
+ - "node_modules/"
39
+ - ".scaffold/"
40
+ - "audit-report/"
41
+ - "templates/"
42
+ - "CHANGELOG.md"
43
+ - "HANDOFF.md"
44
+ - "HANDOFF-ARCHIVE/"
45
+ - ".agents/"
46
+ max_match: 0
47
+ description: "归档仓不应含本机绝对路径(脱敏底线)"
48
+ note: "severity=minor:描述性路径文本容忍"
@@ -0,0 +1,34 @@
1
+ rules:
2
+ - id: CONTENT-001
3
+ title: "主文 Markdown 文件"
4
+ severity: minor
5
+ domain: docs
6
+ applies_to: ["content"]
7
+ check: glob_count
8
+ params:
9
+ pattern: "*.md"
10
+ min: 1
11
+ description: "内容仓库应至少有 1 个 Markdown 主文文件"
12
+
13
+ - id: CONTENT-002
14
+ title: "review 笔记分离结构"
15
+ severity: info
16
+ domain: docs
17
+ applies_to: ["content"]
18
+ check: file_exists
19
+ params:
20
+ paths: ["review.md", "revision-notes.md"]
21
+ anyOf: true
22
+ description: "内容仓库建议有 review.md 或 revision-notes.md(正文与评审分离)"
23
+ note: "推荐项,非硬性"
24
+
25
+ - id: CONTENT-003
26
+ title: "README 包含导航"
27
+ severity: minor
28
+ domain: docs
29
+ applies_to: ["content"]
30
+ check: file_contains
31
+ params:
32
+ path: "README.md"
33
+ patterns: ["# ", "## "]
34
+ description: "内容仓库 README 应包含标题结构"
@@ -0,0 +1,79 @@
1
+ rules:
2
+ - id: DSH-001
3
+ title: "package.json 含 dsh 字段"
4
+ severity: critical
5
+ domain: dsh
6
+ applies_to: ["dsh-plugin"]
7
+ check: json_field
8
+ params:
9
+ path: "package.json"
10
+ field: "dsh"
11
+ description: "dsh 插件应在 package.json 中包含 dsh 字段(bundle.patch/client.inject/platform)"
12
+ template_ref: "templates/repo-root/package.json"
13
+
14
+ - id: DSH-002
15
+ title: "@deepseek-ai/dsh-session 依赖声明"
16
+ severity: major
17
+ domain: dsh
18
+ applies_to: ["dsh-plugin"]
19
+ check: json_field
20
+ params:
21
+ path: "package.json"
22
+ field: "peerDependencies.@deepseek-ai/dsh-session"
23
+ fallback_field: "devDependencies.@deepseek-ai/dsh-session"
24
+ description: "dsh 插件应声明 @deepseek-ai/dsh-session 依赖(peerDependencies 或 devDependencies 均可)"
25
+
26
+ - id: DSH-003
27
+ title: "src/ 目录存在"
28
+ severity: major
29
+ domain: dsh
30
+ applies_to: ["dsh-plugin"]
31
+ check: directory_exists
32
+ params:
33
+ path: "src"
34
+ description: "dsh 插件应有 src/ 目录(host TypeScript + client bundle 结构)"
35
+
36
+ - id: DSH-004
37
+ title: "publish workflow 存在"
38
+ severity: major
39
+ domain: dsh
40
+ applies_to: ["dsh-plugin"]
41
+ check: file_exists
42
+ params:
43
+ paths: [".github/workflows/publish.yml"]
44
+ description: "dsh 插件应有 publish workflow"
45
+ template_ref: "templates/repo-root/.github/workflows/publish.yml"
46
+
47
+ - id: DSH-005
48
+ title: "verify.mjs 存在"
49
+ severity: major
50
+ domain: dsh
51
+ applies_to: ["dsh-plugin"]
52
+ check: file_exists
53
+ params:
54
+ paths: ["verify.mjs", "scripts/verify.mjs"]
55
+ anyOf: true
56
+ template_ref: "templates/repo-root/scripts/verify.mjs"
57
+
58
+ - id: DSH-006
59
+ title: "build.mjs 存在"
60
+ severity: major
61
+ domain: dsh
62
+ applies_to: ["dsh-plugin"]
63
+ check: file_exists
64
+ params:
65
+ paths: ["scripts/build.mjs"]
66
+ description: "build 链需有 build.mjs 探测包装"
67
+ template_ref: "templates/repo-root/scripts/build.mjs"
68
+
69
+ - id: DSH-007
70
+ title: "CONTRIBUTING.md 含 pre-commit 纪律"
71
+ severity: minor
72
+ domain: dsh
73
+ applies_to: ["dsh-plugin"]
74
+ check: file_contains
75
+ params:
76
+ path: "CONTRIBUTING.md"
77
+ patterns: ["pre-commit", "verify"]
78
+ description: "dsh 插件 CONTRIBUTING.md 应提及 pre-commit 验证链"
79
+ template_ref: "templates/common/CONTRIBUTING-core.md"
@@ -0,0 +1,67 @@
1
+ rules:
2
+ - id: GO-001
3
+ title: "go.mod 存在且含 module 声明"
4
+ severity: critical
5
+ domain: go
6
+ applies_to: ["go-service"]
7
+ check: file_exists
8
+ params:
9
+ paths: ["go.mod"]
10
+ description: "Go 服务应有 go.mod"
11
+
12
+ - id: GO-002
13
+ title: "cmd/ 目录结构"
14
+ severity: major
15
+ domain: go
16
+ applies_to: ["go-service"]
17
+ check: directory_exists
18
+ params:
19
+ path: "cmd"
20
+ description: "Go 服务应有 cmd/ 目录(含服务入口 main.go)"
21
+
22
+ - id: GO-003
23
+ title: "Makefile 含 build/test"
24
+ severity: major
25
+ domain: go
26
+ applies_to: ["go-service"]
27
+ check: file_contains
28
+ params:
29
+ path: "Makefile"
30
+ patterns: ["build:", "test:"]
31
+ anyOf: false
32
+ description: "Go 服务 Makefile 应有 build 和 test target(lint 为推荐项,见 GO-003b)"
33
+ template_ref: "templates/categories/go-service/Makefile"
34
+
35
+ - id: GO-003b
36
+ title: "Makefile 含 lint target"
37
+ severity: minor
38
+ domain: go
39
+ applies_to: ["go-service"]
40
+ check: file_contains
41
+ params:
42
+ path: "Makefile"
43
+ patterns: ["lint:"]
44
+ description: "Go 服务 Makefile 建议含 lint target(go vet / gofmt)"
45
+ note: "个人/单作者项目豁免"
46
+
47
+ - id: GO-004
48
+ title: "CI workflow(go test/go vet)"
49
+ severity: minor
50
+ domain: go
51
+ applies_to: ["go-service"]
52
+ check: file_exists
53
+ params:
54
+ paths: [".github/workflows/ci.yml"]
55
+ description: "Go 服务建议有 CI workflow(与 QUA-002 重复检查,降级为 minor)"
56
+ template_ref: "templates/categories/go-service/.github/workflows/ci.yml"
57
+ note: "个人/单作者项目豁免;多人协作项目建议配置"
58
+
59
+ - id: GO-005
60
+ title: "release workflow"
61
+ severity: minor
62
+ domain: go
63
+ applies_to: ["go-service"]
64
+ check: file_exists
65
+ params:
66
+ paths: [".github/workflows/release.yml"]
67
+ description: "Go 服务建议有 release workflow(goreleaser)"
@@ -0,0 +1,75 @@
1
+ rules:
2
+ - id: OSS-001
3
+ title: "CHANGELOG.md 存在"
4
+ severity: critical
5
+ domain: oss
6
+ applies_to: ["product-oss"]
7
+ check: file_exists
8
+ params:
9
+ paths: ["CHANGELOG.md"]
10
+ description: "产品 OSS 仓库必须有 CHANGELOG.md(Keep a Changelog 格式,overlay 标准)"
11
+ template_ref: "templates/categories/product-oss/CHANGELOG.md"
12
+
13
+ - id: OSS-002
14
+ title: "CODEOWNERS 存在"
15
+ severity: major
16
+ domain: oss
17
+ applies_to: ["product-oss"]
18
+ check: file_exists
19
+ params:
20
+ paths: [".github/CODEOWNERS"]
21
+ description: "多人协作仓库应有 CODEOWNERS 定义评审责任人"
22
+ template_ref: "templates/categories/product-oss/.github/CODEOWNERS"
23
+
24
+ - id: OSS-003
25
+ title: "dependabot 配置"
26
+ severity: major
27
+ domain: oss
28
+ applies_to: ["product-oss"]
29
+ check: file_exists
30
+ params:
31
+ paths: [".github/dependabot.yml"]
32
+ description: "产品 OSS 仓库应有 dependabot 自动升级配置"
33
+ template_ref: "templates/categories/product-oss/.github/dependabot.yml"
34
+
35
+ - id: OSS-004
36
+ title: "issue forms 配置"
37
+ severity: minor
38
+ domain: oss
39
+ applies_to: ["product-oss"]
40
+ check: file_exists
41
+ params:
42
+ paths: [".github/ISSUE_TEMPLATE/bug_report.yml"]
43
+ description: "产品 OSS 仓库建议配置 issue forms"
44
+
45
+ - id: OSS-005
46
+ title: "PR template 存在"
47
+ severity: minor
48
+ domain: oss
49
+ applies_to: ["product-oss"]
50
+ check: file_exists
51
+ params:
52
+ paths: [".github/PULL_REQUEST_TEMPLATE.md"]
53
+ description: "产品 OSS 仓库应有 PR template"
54
+ template_ref: "templates/categories/product-oss/PULL_REQUEST_TEMPLATE.md"
55
+
56
+ - id: OSS-006
57
+ title: "release-please 配置"
58
+ severity: major
59
+ domain: oss
60
+ applies_to: ["product-oss"]
61
+ check: file_exists
62
+ params:
63
+ paths: ["release-please-config.json"]
64
+ description: "产品 OSS 仓库应有 release-please 自动化发版配置"
65
+ template_ref: "templates/categories/product-oss/release-please-config.json"
66
+
67
+ - id: OSS-007
68
+ title: "SUPPORT.md 存在"
69
+ severity: minor
70
+ domain: oss
71
+ applies_to: ["product-oss"]
72
+ check: file_exists
73
+ params:
74
+ paths: ["SUPPORT.md"]
75
+ description: "产品 OSS 仓库应有 SUPPORT.md(协作流/发布节奏说明)"
@@ -0,0 +1,60 @@
1
+ rules:
2
+ - id: PY-001
3
+ title: "pyproject.toml 含 project.name"
4
+ severity: critical
5
+ domain: python
6
+ applies_to: ["python-app"]
7
+ check: toml_field
8
+ params:
9
+ path: "pyproject.toml"
10
+ field: "project.name"
11
+ description: "Python 项目应有符合 PEP 621 的 pyproject.toml 且含 project.name"
12
+ template_ref: "templates/categories/python-app/pyproject.toml"
13
+
14
+ - id: PY-002
15
+ title: "tests/ 目录存在"
16
+ severity: major
17
+ domain: python
18
+ applies_to: ["python-app"]
19
+ check: directory_exists
20
+ params:
21
+ path: "tests"
22
+ description: "Python 项目应有 tests/ 目录"
23
+
24
+ - id: PY-003
25
+ title: "pytest 配置存在"
26
+ severity: major
27
+ domain: python
28
+ applies_to: ["python-app"]
29
+ check: toml_field
30
+ params:
31
+ path: "pyproject.toml"
32
+ field: "tool.pytest.ini_options"
33
+ expect_table: true
34
+ description: "Python 项目应有 pytest 配置([tool.pytest.ini_options] 表存在)"
35
+ note: "pytest.ini 或 setup.cfg 中也接受"
36
+
37
+ - id: PY-004
38
+ title: "PyPI publish workflow"
39
+ severity: major
40
+ domain: python
41
+ applies_to: ["python-app"]
42
+ check: file_exists
43
+ params:
44
+ paths: [".github/workflows/publish.yml"]
45
+ skip_if_no_file: ".github/workflows/publish.yml"
46
+ description: "已发布 PyPI 的 Python 项目应有 publish workflow(未发布仓豁免)"
47
+ template_ref: "templates/categories/python-app/.github/workflows/publish.yml"
48
+ note: "未发布仓库可豁免"
49
+
50
+ - id: PY-005
51
+ title: "ruff 依赖声明"
52
+ severity: minor
53
+ domain: python
54
+ applies_to: ["python-app"]
55
+ check: toml_field
56
+ params:
57
+ path: "pyproject.toml"
58
+ field: "dependency-groups.test"
59
+ description: "pyproject.toml 应有 test dependency-group(ruff + pytest)"
60
+ note: "dev-dependencies 形式也接受"
@@ -0,0 +1,33 @@
1
+ rules:
2
+ - id: SANDBOX-001
3
+ title: "最小集:README+AGENTS"
4
+ severity: minor
5
+ domain: docs
6
+ applies_to: ["sandbox"]
7
+ check: file_exists
8
+ params:
9
+ paths: ["README.md", "AGENTS.md"]
10
+ description: "沙盒仓库至少应有 README.md 和 AGENTS.md(最小集设计)"
11
+ template_ref: "templates/categories/sandbox/"
12
+
13
+ - id: SANDBOX-002
14
+ title: "无 CI workflow"
15
+ severity: info
16
+ domain: quality
17
+ applies_to: ["sandbox"]
18
+ check: not_exists
19
+ params:
20
+ paths: [".github/workflows/"]
21
+ description: "沙盒仓库不应有 CI workflow(生命周期短,无发布面)"
22
+ note: "符合为 pass;如有属用户自选,不视为问题"
23
+
24
+ - id: SANDBOX-003
25
+ title: "无 publish workflow"
26
+ severity: info
27
+ domain: quality
28
+ applies_to: ["sandbox"]
29
+ check: not_exists
30
+ params:
31
+ paths: [".github/workflows/publish.yml"]
32
+ description: "沙盒仓库不应有 publish workflow"
33
+ note: "符合为 pass"
@@ -0,0 +1,105 @@
1
+ rules:
2
+ - id: DOC-001
3
+ title: "README.md 存在且非空"
4
+ severity: critical
5
+ domain: docs
6
+ applies_to: ["*"]
7
+ check: file_exists
8
+ params:
9
+ paths: ["README.md"]
10
+ description: "每个仓库必须有 README.md;结构应符合 templates/common/README-core.md"
11
+ template_ref: "templates/common/README-core.md"
12
+ fix_hint: "参考 templates/common/README-core.md"
13
+
14
+ - id: DOC-002
15
+ title: "双语 README 标配"
16
+ severity: minor
17
+ domain: docs
18
+ applies_to: ["dsh-plugin", "python-app", "go-service", "javascript", "npm-package"]
19
+ check: file_exists
20
+ params:
21
+ paths: ["README.en.md"]
22
+ description: "工程类仓库应有英文镜像 README.en.md(README-core 双语策略)"
23
+ note: "sandbox/content 类不设硬性要求"
24
+
25
+ - id: DOC-003
26
+ title: "LICENSE 存在且许可声明一致"
27
+ severity: critical
28
+ domain: docs
29
+ applies_to: ["*"]
30
+ check: file_exists
31
+ params:
32
+ paths: ["LICENSE", "LICENSE.txt", "LICENSE.md"]
33
+ description: "开源仓库必须有 LICENSE 文件;许可类型(MIT/Apache-2.0/GPL/BSD 等)均为合规"
34
+ template_ref: "templates/repo-root/LICENSE"
35
+
36
+ - id: DOC-003b
37
+ title: "package.json license 字段与 LICENSE 文件一致"
38
+ severity: minor
39
+ domain: docs
40
+ applies_to: ["javascript", "npm-package"]
41
+ check: json_field
42
+ params:
43
+ path: "package.json"
44
+ field: "license"
45
+ fallback_field: ["dependencies", "peerDependencies", "devDependencies"]
46
+ description: "package.json 应有 license 字段(SPDX 标识)"
47
+ note: "仅对含 package.json 的 JS 项目检查"
48
+
49
+ - id: DOC-004
50
+ title: "AGENTS.md 存在且含 AI 协作守则"
51
+ severity: major
52
+ domain: docs
53
+ applies_to: ["dsh-plugin", "python-app", "product-oss"]
54
+ check: file_contains
55
+ params:
56
+ path: "AGENTS.md"
57
+ patterns: ["AI 协作守则", "完成的定义"]
58
+ description: "AI 协作仓库应有 AGENTS.md,且含 AI 协作守则(templates/common/AGENTS-core.md)"
59
+ template_ref: "templates/common/AGENTS-core.md"
60
+ note: "无 AI 协作需求的个人/solo 项目豁免"
61
+
62
+ - id: DOC-005
63
+ title: "CONTRIBUTING.md 存在"
64
+ severity: minor
65
+ domain: docs
66
+ applies_to: ["dsh-plugin", "python-app", "go-service", "product-oss", "javascript", "npm-package"]
67
+ check: file_exists
68
+ params:
69
+ paths: ["CONTRIBUTING.md"]
70
+ description: "工程仓库应有贡献指南"
71
+ template_ref: "templates/common/CONTRIBUTING-core.md"
72
+
73
+ - id: DOC-006
74
+ title: "DEVELOPMENT.md 存在(工程类)"
75
+ severity: minor
76
+ domain: docs
77
+ applies_to: ["dsh-plugin", "python-app", "go-service", "javascript", "npm-package"]
78
+ check: file_exists
79
+ params:
80
+ paths: ["DEVELOPMENT.md"]
81
+ description: "工程仓库应有开发流程文档"
82
+ template_ref: "templates/common/DEVELOPMENT-core.md"
83
+ note: "sandbox/content 豁免"
84
+
85
+ - id: DOC-007
86
+ title: "PUBLISHING.md 存在(有发布面)"
87
+ severity: minor
88
+ domain: docs
89
+ applies_to: ["dsh-plugin", "python-app", "go-service"]
90
+ check: file_exists
91
+ params:
92
+ paths: ["PUBLISHING.md"]
93
+ description: "有发布流程的仓库应有发布文档"
94
+ template_ref: "templates/common/PUBLISHING-core.md"
95
+
96
+ - id: DOC-008
97
+ title: "SECURITY.md 存在"
98
+ severity: minor
99
+ domain: docs
100
+ applies_to: ["dsh-plugin", "python-app", "go-service", "javascript", "npm-package"]
101
+ check: file_exists
102
+ params:
103
+ paths: ["SECURITY.md"]
104
+ description: "有安全关注的仓库应有漏洞报告渠道"
105
+ template_ref: "templates/common/SECURITY-core.md"
@@ -0,0 +1,52 @@
1
+ rules:
2
+ - id: GIT-001
3
+ title: "Conventional Commits 规范"
4
+ severity: major
5
+ domain: git
6
+ applies_to: ["*"]
7
+ check: regex
8
+ params:
9
+ command: "git log --format=%s -20"
10
+ pattern: "^(feat|fix|docs|refactor|test|chore|style|perf|build|ci|revert)(\\(.+\\))?: .+"
11
+ description: "最近 20 条提交应符合 Conventional Commits 规范(AGENTS-core 提交规范节)"
12
+ fix_hint: "使用 standard-version 或手动 reword;参考 templates/common/AGENTS-core.md"
13
+
14
+ - id: GIT-002
15
+ title: ".gitignore 含机密防护段"
16
+ severity: major
17
+ domain: git
18
+ applies_to: ["dsh-plugin", "javascript", "npm-package"]
19
+ check: file_contains
20
+ params:
21
+ path: ".gitignore"
22
+ patterns: ["node_modules/", "*.log"]
23
+ description: ".gitignore 应排除构建产物和日志(gitignore-core 通用段)"
24
+ template_ref: "templates/common/gitignore-core.md"
25
+ note: "仅对 JS/TS 类仓库适用;Python/Go 等分类豁免"
26
+
27
+ - id: GIT-003
28
+ title: "至少有一个有效提交"
29
+ severity: major
30
+ domain: git
31
+ applies_to: ["*"]
32
+ check: command_result
33
+ params:
34
+ command: "git rev-list --count HEAD"
35
+ min: 1
36
+ skip_if_zero: true
37
+ description: "仓库必须有至少一个提交(零提交仓自动豁免)"
38
+ fix_hint: "git add -A && git commit -m 'chore: initial commit'"
39
+ note: "scaffold 生成后未初始化提交时豁免"
40
+
41
+ - id: GIT-004
42
+ title: ".scaffold/lock 存在"
43
+ severity: info
44
+ domain: git
45
+ applies_to: ["*"]
46
+ check: file_exists
47
+ params:
48
+ paths: [".scaffold/lock/manifest.json"]
49
+ anyOf: false
50
+ skip_if_no_parent: ".scaffold"
51
+ description: "经 scaffold --update 的仓库应有 .scaffold/lock/manifest.json(非 scaffold 管理仓自然 pass)"
52
+ note: "仅对 adopt/update 过的仓库有意义;从未接管的仓视为 pass"
@@ -0,0 +1,69 @@
1
+ rules:
2
+ - id: QUA-001
3
+ title: "验证链存在"
4
+ severity: major
5
+ domain: quality
6
+ applies_to: ["dsh-plugin", "python-app", "go-service", "javascript", "npm-package"]
7
+ check: file_exists
8
+ params:
9
+ paths:
10
+ - "verify.mjs"
11
+ - "scripts/verify.mjs"
12
+ - "scripts/verify.py"
13
+ - "Makefile"
14
+ anyOf: true
15
+ fallback_paths: ["package.json"]
16
+ fallback_field: "scripts.test"
17
+ description: "工程仓库应有验证链(verify.mjs / Makefile / npm scripts.test 任一形态)"
18
+ template_ref: "templates/repo-root/scripts/verify.mjs"
19
+
20
+ - id: QUA-002
21
+ title: "CI workflow 存在"
22
+ severity: major
23
+ domain: quality
24
+ applies_to: ["dsh-plugin", "python-app", "go-service", "javascript", "npm-package"]
25
+ check: regex
26
+ params:
27
+ command: "ls .github/workflows/ 2>/dev/null | grep -cE '\\.(yml|yaml)$'"
28
+ patterns: ["[1-9]"]
29
+ description: "工程仓库应有 CI workflow(任意 .github/workflows/*.yml|yaml,命名不绑定 ci.yml)"
30
+ note: "glob_count 无法遍历隐藏目录(E4),改用 regex+command 方案"
31
+
32
+ - id: QUA-003
33
+ title: "pre-commit 钩子配置"
34
+ severity: minor
35
+ domain: quality
36
+ applies_to: ["dsh-plugin", "python-app", "go-service", "javascript", "npm-package"]
37
+ check: file_exists
38
+ params:
39
+ paths: [".githooks/pre-commit", ".husky/pre-commit", "lefthook.yml"]
40
+ description: "工程仓库应有 pre-commit 钩子(AGENTS-core 部署纪律)"
41
+ template_ref: "templates/repo-root/.githooks/pre-commit"
42
+ note: "sandbox/content 豁免"
43
+
44
+ - id: QUA-004
45
+ title: "锁文件入库"
46
+ severity: major
47
+ domain: quality
48
+ applies_to: ["dsh-plugin", "python-app", "go-service", "javascript", "npm-package"]
49
+ check: file_exists
50
+ params:
51
+ paths:
52
+ - "package-lock.json"
53
+ - "poetry.lock"
54
+ - "go.sum"
55
+ - "requirements.lock"
56
+ anyOf: true
57
+ description: "锁文件应入库以确保可复现构建(BEST-PRACTICES §5.4 验证链)"
58
+ note: "无包管理的仓库豁免"
59
+
60
+ - id: QUA-005
61
+ title: "CLAUDE.md 桥接"
62
+ severity: info
63
+ domain: quality
64
+ applies_to: ["*"]
65
+ check: file_exists
66
+ params:
67
+ paths: ["CLAUDE.md"]
68
+ description: "仓库有 CLAUDE.md 则 Claude Code 用户可直接读取 AGENTS.md"
69
+ note: "推荐项,非硬性要求"