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,31 @@
1
+ <!-- 模板说明(用后删除):E 类"本地实验/dogfood 沙盒"分类 delta 模板(最小集)。
2
+ 实证:11 个 fuyao-* 仓(同构 agents/docs/package.json/src/tests、master、无 origin、生命周期短)。 -->
3
+
4
+ # E 类 · 本地实验/dogfood 沙盒(最小集)
5
+
6
+ > 设计原则:**生命周期短、无发布面**——只保留"跑得起来 + 记得下来"的最小结构。
7
+
8
+ ## 文件集(就这些,不再多)
9
+
10
+ ```
11
+ <repo>/
12
+ ├── README.md # 一句话目标 + 跑法 + 结论/收尾链接
13
+ ├── README.en.md # 英文镜像(双语标配)
14
+ ├── AGENTS.md # core 通用纪律 + 沙盒纪律 3 条(单源拼装)
15
+ ├── .gitignore # 通用段(机密/编辑器)+ Node 段
16
+ ├── package.json # 若 Node:name/description/scripts(按需,可省)
17
+ ├── agents/ docs/ src/ tests/ # 按需;无则不建
18
+ └── HANDOFF.md # 建议本地留(.gitignore 已忽略)
19
+ ```
20
+
21
+ ## 明确去掉的(相对基类,scaffold 已删)
22
+
23
+ - LICENSE/CONTRIBUTING/SECURITY/CHANGELOG/PUBLISHING/DEVELOPMENT/CI workflow/hooks——**无协作、无发布**
24
+ - 版本管理:不打 tag、不发 npm;"收尾"= README 写结论 + 会话归档
25
+ - 分支:master 直提;无 PR、无 CI
26
+ - 双语:README.en.md 骨架已提供(Goal/How to run/Outcome 极简镜像)
27
+
28
+ ## 升级出口
29
+
30
+ 实验转正(要发布/多人)→ 按目标分类(A/B/C/D)走 `scaffold.mjs` 全量脚手架,把本仓内容迁入——
31
+ **不要**在本分类上打补丁凑规范。
@@ -0,0 +1,24 @@
1
+ # <宿主能力面 / 实验目标一句话>(English mirror)
2
+
3
+ [中文](README.md) | English is a mirror; the Chinese README is authoritative and may lag behind.
4
+
5
+ <!-- 模板说明(用后删除):沙盒仓英文镜像极简即可——三件事:Goal / How to run / Outcome。
6
+ 与中文 README 同步更新;结论(Outcome)随实验收尾补写。 -->
7
+
8
+ ## Goal
9
+
10
+ <What hypothesis this experiment/dogfood validates, one short paragraph.>
11
+
12
+ ## How to run
13
+
14
+ ```sh
15
+ <minimal copy-paste command>
16
+ ```
17
+
18
+ ## Structure
19
+
20
+ - `agents/` <说明> · `docs/` <说明> · `src/` <说明> · `tests/` <说明> (remove what's absent)
21
+
22
+ ## Outcome
23
+
24
+ <Written at wrap-up: what was validated / conclusion / promote to a full repo via scaffold.mjs>
@@ -0,0 +1,23 @@
1
+ # <宿主能力面 / 实验目标一句话>
2
+
3
+ [English](README.en.md) | 中文为权威版本,翻译可能滞后。
4
+
5
+ <!-- 模板说明(用后删除):沙盒仓 README 就三件事——目标、跑法、收尾结论。生命周期短,不养规范面。 -->
6
+
7
+ ## 目标
8
+
9
+ <这个实验/dogfood 要验证什么假设,一段话>
10
+
11
+ ## 跑法
12
+
13
+ ```sh
14
+ <最小可复制命令>
15
+ ```
16
+
17
+ ## 结构
18
+
19
+ - `agents/` <说明> · `docs/` <说明> · `src/` <说明> · `tests/` <说明>(没有的删掉)
20
+
21
+ ## 结论
22
+
23
+ <实验收尾时写:验证了什么 / 结论 / 是否升级为正式库(升级走 scaffold.mjs 目标分类全量脚手架,不在本仓打补丁)>
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * 单源漂移检查(多源收敛的常态化守卫)。
4
+ *
5
+ * 原则:AGENTS / CONTRIBUTING / .gitignore 的共性内容只允许存在于 common/*-core 一份源;
6
+ * 分类目录只允许 *-append.md(差异段)与 sandbox/content 的整文件例外(见下)。
7
+ *
8
+ * 检查项:
9
+ * A. core 源存在且唯一
10
+ * B. 任何分类目录/基类不得包含"整份重复"——以 core 特征句为指纹扫描
11
+ * C. 分类 append 文件命名规范(*-append.md 或 sandbox/content 的整文件白名单)
12
+ * D. 基类 repo-root 不再保留三份成文(已迁 common)
13
+ *
14
+ * 用法:node templates/check-single-source.mjs (CI/审计均可挂)
15
+ * 退出码:发现多源 = 1。
16
+ */
17
+
18
+ import { readdirSync, readFileSync, existsSync } from 'node:fs';
19
+ import { join, dirname } from 'node:path';
20
+ import { fileURLToPath } from 'node:url';
21
+
22
+ const ROOT = dirname(fileURLToPath(import.meta.url));
23
+ const COMMON = join(ROOT, 'common');
24
+ const BASE = join(ROOT, 'repo-root');
25
+ const CATS = join(ROOT, 'categories');
26
+ const ENGINEERING = ['dsh-plugin', 'python-app', 'go-service']; // core+append 模式
27
+ const MINIMAL = ['sandbox', 'content']; // core+append(AGENTS)/整文件白名单
28
+ const WHITELIST_FULL = new Set(['categories/sandbox/AGENTS.md', 'categories/content/AGENTS.md']); // 历史例外(现为空集则通过)
29
+
30
+ // core 指纹:这些句子只允许在 common 源出现一次;在分类/基类文件中出现 = 多源漂移
31
+ const CORE_FINGERPRINTS = {
32
+ 'AGENTS-core.md': ['AI 协作守则(agent 贡献者必读)', 'Conventional Commits 前缀 + 中文描述', '完成的定义 = 验证链全绿'],
33
+ 'CONTRIBUTING-core.md': ['main 保持线性历史', '尊重、建设性、对事不对人'],
34
+ 'gitignore-core.md': ['本机私有信息不入库(与 AGENTS.md 机密纪律同源)', 'HANDOFF-ARCHIVE/'],
35
+ 'README-core.md': ['README = 卖点 + 5 分钟上手', 'AI 协作者先读'],
36
+ 'DEVELOPMENT-core.md': ['小步提交、每步可验证、事实落盘', '复盘三问'],
37
+ 'PUBLISHING-core.md': ['每版一行:**做了什么 + 为什么 + 怎么验证的**', '实机重装/升级路径实测一遍'],
38
+ 'SECURITY-core.md': ['确认收到后 72 小时内回复', '严重漏洞优先修复并发布补丁版本'],
39
+ };
40
+ // 串味守卫:非 dsh-plugin 分类禁止出现 A 类专属命名串 `dsh-<name>`
41
+ const DSH_NAME_RE = /dsh-<name>/;
42
+ const DSH_NAME_ALLOWED_PREFIX = 'categories/dsh-plugin/';
43
+
44
+ let failed = 0;
45
+ const fail = (msg) => { console.error(`✗ ${msg}`); failed++; };
46
+ const ok = (msg) => console.log(`✓ ${msg}`);
47
+
48
+ // A. core 存在且唯一
49
+ for (const f of Object.keys(CORE_FINGERPRINTS)) {
50
+ existsSync(join(COMMON, f)) ? ok(`common/${f} 存在`) : fail(`common/${f} 缺失(单源源丢失)`);
51
+ }
52
+
53
+ // B. 指纹扫描:core 特征句只准在 common 出现(覆盖 .md/.toml/.yml/.json——串味不全在 md)
54
+ const SCAN_EXT = /\.(md|toml|ya?ml|json)$/;
55
+ const scanTargets = [];
56
+ function collectMd(dir) {
57
+ for (const e of readdirSync(dir, { withFileTypes: true })) {
58
+ const full = join(dir, e.name);
59
+ if (e.isDirectory()) collectMd(full);
60
+ else if (SCAN_EXT.test(e.name)) scanTargets.push(full);
61
+ }
62
+ }
63
+ collectMd(BASE);
64
+ collectMd(CATS);
65
+ for (const [core, prints] of Object.entries(CORE_FINGERPRINTS)) {
66
+ for (const print of prints) {
67
+ for (const f of scanTargets) {
68
+ const rel = f.slice(ROOT.length + 1);
69
+ if (rel.startsWith(`common${'/'}${core}`)) continue;
70
+ const text = readFileSync(f, 'utf8');
71
+ if (text.includes(print)) fail(`多源漂移:指纹「${print.slice(0, 24)}…」同时出现在 common/${core} 与 ${rel}`);
72
+ }
73
+ }
74
+ }
75
+ ok('B. core 指纹扫描完成(无重复源即通过)');
76
+
77
+ // B2. 串味守卫:非 dsh-plugin 分类禁止 `dsh-<name>`(A 类专属命名)
78
+ for (const f of scanTargets) {
79
+ const rel = f.slice(ROOT.length + 1);
80
+ if (!rel.startsWith('categories/') || rel.startsWith(DSH_NAME_ALLOWED_PREFIX)) continue;
81
+ const text = readFileSync(f, 'utf8');
82
+ if (DSH_NAME_RE.test(text)) fail(`跨分类串味:${rel} 含 A 类专属命名串 dsh-<name>(应用 <repo>)`);
83
+ }
84
+ ok('B2. dsh-<name> 串味扫描完成');
85
+
86
+ // C. 分类 append 命名规范
87
+ for (const cat of readdirSync(CATS)) {
88
+ const d = join(CATS, cat);
89
+ for (const f of readdirSync(d)) {
90
+ if (/^(AGENTS|CONTRIBUTING)\.md$/.test(f) && !WHITELIST_FULL.has(`categories/${cat}/${f}`)) {
91
+ fail(`整份成文应改为 ${f.replace('.md', '')}-append.md(差异段)或入白名单:categories/${cat}/${f}`);
92
+ }
93
+ if (/^(AGENTS|CONTRIBUTING|gitignore)-append\.md$/.test(f) && !ENGINEERING.concat(MINIMAL).includes(cat)) {
94
+ fail(`append 段出现在未知分类:categories/${cat}/${f}`);
95
+ }
96
+ }
97
+ }
98
+ ok('C. append 命名规范检查完成');
99
+
100
+ // D. 基类不留三份成文
101
+ for (const f of ['AGENTS.md', 'CONTRIBUTING.md', '.gitignore']) {
102
+ if (existsSync(join(BASE, f))) fail(`基类残留成文 ${f}(应迁 common + append,scaffold 拼装生成)`);
103
+ }
104
+ ok('D. 基类单源化检查完成');
105
+
106
+ console.log(failed ? `\n共 ${failed} 处多源/违规。` : '\n单源检查全部通过。');
107
+ process.exit(failed ? 1 : 0);
@@ -0,0 +1,28 @@
1
+ # AGENTS(AI 协作与工程纪律)
2
+
3
+ > 本文件由模板**单源拼装**(`common/AGENTS-core.md` + 分类 append)——重复段不要在仓库里手改;
4
+ > 改规则先改模板源,再重新生成。人工协作者同样适用本文件全部条款。
5
+
6
+ ## 项目概览
7
+
8
+ <一句话描述>。仓库根即工程根;分支、提交、验证、发版规范见下与 CONTRIBUTING.md。
9
+
10
+ ## 提交规范
11
+
12
+ - **Conventional Commits 前缀 + 中文描述**:`feat(scope):` / `fix(scope):` / `refactor:` / `docs:` / `test:` / `chore:`;scope 用模块名;发布提交固定 `chore: release v<版本> — <一句话主旨>`。
13
+ - **提交前必须跑本仓验证链单源**(命令见下方分类纪律节)并全绿;CI 与本地同源。FAIL 修根因,不绕过;确需 `--no-verify` 必须在提交说明注明原因。
14
+
15
+ ## AI 协作守则(agent 贡献者必读)
16
+
17
+ 1. **不猜 API/契约**:写代码前用宿主/依赖的检查工具查精确签名;测试 stub 必须按真实契约形状写(实践库教训:失真的 stub 会掩盖契约 bug)。
18
+ 2. **完成的定义 = 验证链全绿 + 实机/测试验收**,不是"代码写完";声称完成前附验证输出。
19
+ 3. **机密红线**:本机绝对路径、个人邮箱、token/密钥、会过时的部署实况描述一律不入库;提交前 `git grep` 自查(模式见本仓 .gitignore 注释区)。
20
+ 4. **不静默绕过门禁**:pre-commit/CI FAIL 先修根因;中间态确需跳过必须留痕注明。
21
+ 5. **改动最小化**:不顺手重构、不改无关文件;构建产物与锁文件按仓库既定规则处理(产物不入库、锁文件必须入库)。
22
+ 6. **文档同步**:行为/接口变化同步 README、DEVELOPMENT 速查表(或等价文档)、CHANGELOG(如有)。
23
+ 7. **冲突处理**:本文件与生成它的模板源冲突时以模板源为准并回写;用户显式指示优先于本文件,但需在 PR/提交说明中标注冲突点。
24
+
25
+ ## 安全考虑
26
+
27
+ - 漏洞**不要**公开披露:走 SECURITY.md 指定的私密漏洞报告渠道。
28
+ - 依赖与 CI action 升级走仓库既定自动化(如有);引入新依赖需在 PR 说明中给出理由。
@@ -0,0 +1,21 @@
1
+ # 贡献指南
2
+
3
+ 感谢贡献!本文件由模板**单源拼装**(`common/CONTRIBUTING-core.md` + 分类 append)——重复段勿在仓库手改。
4
+
5
+ ## 分支与合并
6
+
7
+ - **单维护者(默认)**:直接提交 main;push 即触发 CI 验证链;main 保持线性历史。
8
+ - **多人协作时**:feature 分支(`feat/<短名>` 或 `fix/<issue号>`)→ PR → CI 绿 + 评审通过后 squash 合并。
9
+
10
+ ## 提交规范
11
+
12
+ - **Conventional Commits 前缀 + 中文描述**(改了什么 + 为什么);发布提交格式见下方分类节。
13
+ - **机密红线**:本机绝对路径、个人邮箱、token、部署实况快照一律不入库(与 AGENTS.md 同源纪律)。
14
+
15
+ ## 行为准则
16
+
17
+ 简单说:尊重、建设性、对事不对人。维护者会驳回不友善或与主题无关的 issue / PR。
18
+
19
+ ---
20
+
21
+ <!-- 以下由分类 append 拼装:开发环境命令、部署/验证纪律、发版流程指路 -->
@@ -0,0 +1,45 @@
1
+ # <repo> 开发流程
2
+
3
+ > 通用的**开发 → 验证 → 构建 → 发布**规范(humen 与 agent 均按此执行);流程模型的团队变体
4
+ > (如敏捷迭代)由分类 append 或团队自行补充。原则:**小步提交、每步可验证、事实落盘**。
5
+ > 本文件由模板单源拼装(common/DEVELOPMENT-core.md + 分类 append)——重复段勿手改。
6
+
7
+ ## 1. 开发(Develop)
8
+
9
+ - **动手前**:明确要做的一件事(功能/缺陷/技术债),用户故事格式更佳——`作为 <用户>,我想要 <能力>,以便 <收益>`
10
+ - **契约预检**:用依赖方/宿主的检查工具查清要用的 API/接口**精确签名**——不猜(格式错误运行时才发现 = 一个迭代白做)
11
+ - **实现规范**:见下方「分类纪律」节(语言/宿主专属硬规则)
12
+ - **边界条件**:空输入 / 并发 / 超时 / 取消 / 重启恢复,设计时想过、测试里覆盖
13
+
14
+ ## 2. 验证(Verify)
15
+
16
+ **验证链单源**(命令见 AGENTS.md / CONTRIBUTING.md 的分类纪律节;本地与 CI 同一入口):
17
+
18
+ - 提交前本地全绿;FAIL 修根因,不绕过(`--no-verify` 必须留痕注明)
19
+ - **实机/实测验收**:部署到本机或测试环境真实跑一遍用户路径;无运行中验证 = 未做完
20
+ - 机密自查:`git grep` 本仓既定模式(本机路径/邮箱/token),见 AGENTS.md 机密红线
21
+
22
+ ## 3. 构建与文档(Build & Document)
23
+
24
+ - 构建产物不入库(CI 从源码重建);锁文件必须入库(CI 复现依赖)
25
+ - 文档同步:行为/接口变化同步 README 与等价设计文档;新坑进速查表(见附录机制)
26
+ - CHANGELOG / 版本历史(如有):每版一行「做了什么 + 为什么 + 怎么验证的」
27
+
28
+ ## 4. 发布(Release)
29
+
30
+ - 发布是显式人工决策(tag / Release PR 合并);流程见 [PUBLISHING.md](PUBLISHING.md)
31
+ - 发布后验证:确认 latest 更新、provenance/attestations(按通道)、实机重装路径走一遍
32
+
33
+ ## 5. 反馈与沉淀(Feedback)
34
+
35
+ - 用户的每个反馈都登记:满意点 / 不满意点 / 建议——不满意点优先转成待办缺陷条目
36
+ - **复盘三问**(答案落盘):① 这次什么顺利?② 这次踩了什么坑(新坑 → 立即进速查表)?
37
+ ③ 同类坑重复出现 ≥2 次?是 = 流程缺陷,先补流程再继续
38
+
39
+ ## 附录:高频坑速查表(回顾沉淀)
40
+
41
+ <!-- 模板说明(用后删除):三列 = 坑 | 症状 | 拦截环节;新坑先补表再修码;
42
+ 回顾中发现"清单没拦住"的坑 → 改清单(流程本身也要迭代)。
43
+ 预置行由分类 append 提供,其余按本库回顾追加。 -->
44
+
45
+ ## 6. 新增节(C2 升级实测):升级流程验证。
@@ -0,0 +1,31 @@
1
+ # 发布记录:<repo>
2
+
3
+ > 本文件由模板单源拼装(core + 分类 append):发布通道/发布流程/应急发布由分类 append 决定;
4
+ > 共性纪律在 core。
5
+
6
+ ## 发布状态(<日期> 更新)
7
+
8
+ | 项 | 状态 |
9
+ |---|---|
10
+ | <发布面> | <版本 / dist-tag 状态> |
11
+ | GitHub | `<org>/<repo>` main;发版 tag <tag 格式> |
12
+ | 本地验证 | <验证链全绿 + 实测结论> |
13
+
14
+ ## 版本历史
15
+
16
+ > 每版一行:**做了什么 + 为什么 + 怎么验证的**;重大教训展开写进当版条目。
17
+
18
+ - **x.y.z** — <一句话主旨>(<日期>):<要点;breaking 标注;验证方式>
19
+
20
+ <!-- 模板说明(用后删除):
21
+ - 命名沿革/更名/deprecate 也记录在此(参照实践库"旧包 deprecate 指向新包"条目)
22
+ - "只改产物不进 src = 修复丢失"类教训要写明,让历史可追溯
23
+ -->
24
+
25
+ ## 发布后验证(共性纪律)
26
+
27
+ - 确认 latest 已更新(包管理器或 GitHub Release 页)
28
+ - provenance/attestations 徽章(按通道)或等价完整性校验
29
+ - 实机重装/升级路径实测一遍(面向用户的安装命令照 README 走一遍)
30
+
31
+ > 通道专属验证命令由分类 append 覆盖(按实际通道选择对应命令)。
@@ -0,0 +1,60 @@
1
+ # <repo>
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
4
+ <!-- 分类徽章(npm/PyPI 等)由 append 提供并插到本行之后 -->
5
+
6
+ <一句话描述>(与 GitHub about / 包管理器 description 一致;<120 字符,无节标题——Standard Readme #4)。
7
+
8
+ [English](README.en.md) | 中文为权威版本,翻译可能滞后。
9
+
10
+ <!-- 模板说明(用后删除):
11
+ - 本文件由模板单源拼装(common/README-core.md + 分类 README-append)——重复段勿手改
12
+ - 章节骨架依据 Standard Readme(github.com/RichardLitt/standard-readme,2026-09 核实)+ GitHub
13
+ 官方 5 问 + makeareadme,分三档:
14
+ 必选 = 标题+一句话简介 / 安装·上手 / 用法 / 贡献 / License(最后一节)
15
+ 推荐 = 徽章 / **状态** / 详细简介(Why·Features) / 安全 / **非目标(边界)** / 求助渠道 / 多语言切换行
16
+ 可选 = Banner·截图 / ToC(README<100 行可免) / API·配置参考 / Extra 自定义节 / Roadmap / 维护者 / 致谢 / See Also
17
+ (状态与非目标来自本生态 15 仓实况,为对 Standard Readme 的两处增强)
18
+ - 分工:README = 卖点 + 5 分钟上手;CONTRIBUTING.md = 参与手册;docs/ = 全量参考(>500 KiB 渲染
19
+ 截断,长内容一律外迁且从 README 可达)
20
+ - 分类差异(徽章/安装/使用/配置)由分类 append 拼装(见下)
21
+ - 状态/非目标两节来自本生态 15 仓实况(状态节 3 仓、非目标节 4 仓)——比 Standard Readme 更贴合
22
+ 实际维护节奏,且对 agent 是范围护栏
23
+ -->
24
+
25
+ ## 状态
26
+
27
+ <当前状态:活跃开发 / 维护模式 / 验证期(先 N 周真实使用再决定)/ 已归档(欢迎 fork 接手)>
28
+
29
+ <!-- 模板说明(用后删除):状态声明放 README 顶部区(makeareadme 惯例)——停滞/验证期必须写明,让读者第一屏就知道预期。 -->
30
+
31
+ ## 功能
32
+
33
+ <分类 append 拼装:功能/安装/使用/配置段(Standard Readme 的 Install/Usage/Extra)>
34
+
35
+ <!-- 模板说明(用后删除):双语策略(标配):中文权威;README.en.md 由各分类提供——若暂无英文镜像,删除上方切换行并补 TODO。 -->
36
+
37
+ ## 非目标(边界)
38
+
39
+ <明确不做什么:本版本刻意不覆盖的场景与原因——非目标能防止范围蔓延(humen/agent 都受益);
40
+ 示例措辞:「v0.1 不做 <X>,因为 <原因>」
41
+
42
+ ## 安全
43
+
44
+ 漏洞**不要**公开 issue——走 [SECURITY.md](SECURITY.md) 指定的私密漏洞报告渠道。
45
+
46
+ ## 文档
47
+
48
+ <!-- 无 docs/ 目录时删除本行;可选:ROADMAP / AUDIT 等 -->
49
+ - [设计](docs/DESIGN.md)
50
+ - [开发与验证纪律](DEVELOPMENT.md) · [发布流程](PUBLISHING.md)
51
+
52
+ ## 贡献
53
+
54
+ - 问题与讨论:GitHub Issues / Discussions;是否收 PR 见 [CONTRIBUTING.md](CONTRIBUTING.md)
55
+ - AI 协作者先读 [AGENTS.md](AGENTS.md)(含 AI 协作守则)
56
+ - 行为准则:尊重、建设性、对事不对人(详见 CONTRIBUTING.md)
57
+
58
+ ## License
59
+
60
+ [MIT](LICENSE)
@@ -0,0 +1,19 @@
1
+ # 安全策略
2
+
3
+ ## 支持面
4
+
5
+ 本仓库是<宿主能力面 / 服务用途>。安全边界值得关注的面:
6
+
7
+ - <列出暴露面:网络入口(RPC/HTTP 端点及访问限制)、读写的敏感数据、对外请求>
8
+ - <配置值来源与敏感度说明>
9
+ - <发布产物携带的最小依赖>
10
+
11
+ ## 报告漏洞
12
+
13
+ 若你发现漏洞或安全缺陷,**不要**公开 issue——到 GitHub 仓库 Security 标签页用私密漏洞报告
14
+ (Private vulnerability reporting,首选)。
15
+
16
+ ## 响应
17
+
18
+ - 确认收到后 72 小时内回复。
19
+ - 严重漏洞优先修复并发布补丁版本。
@@ -0,0 +1,5 @@
1
+ <!-- AI 协作入口(GitHub Copilot):规则单源在仓库根 AGENTS.md -->
2
+ Read AGENTS.md at the repository root before making any changes, and follow its
3
+ AI-collaboration rules (verify before claiming done, never guess contracts, keep
4
+ secrets out of the repo). Run the repo's single-source verification command
5
+ before declaring a change complete.
@@ -0,0 +1,11 @@
1
+ # ===== 通用段(scaffold 拼装时本行被剥除;改规则改本文件,勿手改产物)=====
2
+ # 本机私有信息不入库(与 AGENTS.md 机密纪律同源)
3
+ .env
4
+ .env.*
5
+ HANDOFF.md
6
+ HANDOFF-ARCHIVE/
7
+
8
+ # 编辑器与系统
9
+ .DS_Store
10
+ Thumbs.db
11
+ *.log
@@ -0,0 +1,20 @@
1
+ #!/bin/sh
2
+ # 部署纪律硬拦截:提交涉及插件源码(src/,lib/ 为构建产物已 ignore)时,
3
+ # 强制跑装后自检(DEVELOPMENT.md「部署纪律:profile 安装」)。
4
+ # 启用方式:git config core.hooksPath .githooks
5
+
6
+ changed=$(git diff --cached --name-only --diff-filter=ACMR \
7
+ | grep -E '^(src|scripts)/' \
8
+ | head -1)
9
+ [ -z "$changed" ] && exit 0
10
+
11
+ echo "pre-commit:检测到源码改动(src/scripts),执行部署纪律自检 npm run check:deploy ..."
12
+ node scripts/check-deploy.mjs
13
+ code=$?
14
+ if [ $code -ne 0 ]; then
15
+ echo ""
16
+ echo "✗ 部署纪律自检 FAIL:该插件源码与 profile 部署产物不一致(同版本号不同内容事故拦截点)。"
17
+ echo " 修复:npm run build 后执行 dsh plugin --profile web install,再重跑 npm run check:deploy。"
18
+ echo " 若本次提交确属尚未部署的中间态,请 commit --no-verify 并在提交说明注明\"未部署,部署前需自检\"。"
19
+ exit 1
20
+ fi
@@ -0,0 +1,45 @@
1
+ # dsh-<name> CI 工作流(push/PR 验证)
2
+ #
3
+ # 首推前置:package-lock.json 必须已生成并入库(下方 npm ci 与 setup-node cache 都依赖
4
+ # 它——参照实践库踩过的"setup-node cache 找不到 lockfile"坑;首次 commit 前先本地
5
+ # npm install --legacy-peer-deps 生成 lockfile,模板 TODO 第 5 步有此指引)。
6
+ #
7
+ # 与 publish.yml 的分工:
8
+ # - 本 workflow:push 到 main / PR 时跑验证链——把坏提交拦在进 main 当下,
9
+ # 而不是等打 tag 发布时(publish.yml)才暴露
10
+ # - 验证链与发布完全同源:scripts/verify.mjs 单源入口(npm test / publish.yml / 此处三者同调),
11
+ # 链内增删步骤只改 verify.mjs
12
+ # - 无发布语义:不需要 id-token(那是 OIDC 用的),权限只要 contents: read
13
+ # - 新 push 取消同分支旧 run(与 publish.yml 的 cancel-in-progress: false 相反——
14
+ # 发布不取消,验证随时可弃)
15
+ name: ci
16
+
17
+ on:
18
+ push:
19
+ branches: [main]
20
+ pull_request:
21
+
22
+ permissions:
23
+ contents: read
24
+
25
+ concurrency:
26
+ group: ci-${{ github.ref }}
27
+ cancel-in-progress: true
28
+
29
+ jobs:
30
+ verify:
31
+ runs-on: ubuntu-latest
32
+ steps:
33
+ - name: Checkout
34
+ uses: actions/checkout@<commit-SHA> # actions/checkout@v7.0.1
35
+ - name: Setup Node
36
+ uses: actions/setup-node@<commit-SHA> # actions/setup-node@v7.0.0
37
+ # 不加 registry-url:CI 只读验证,不发布(见 publish.yml 内的 OIDC 说明)
38
+ with:
39
+ node-version: 24
40
+ cache: npm
41
+ cache-dependency-path: package-lock.json
42
+ - name: Install
43
+ run: npm ci --legacy-peer-deps
44
+ - name: Verify
45
+ run: node scripts/verify.mjs
@@ -0,0 +1,77 @@
1
+ # dsh-<name> 发布工作流(OIDC Trusted Publishing)
2
+ #
3
+ # 安全模型:
4
+ # - 触发 = 本机人工创建的 tag(<name>-vX.Y.Z),发布决策永远是人的决定
5
+ # - 认证:npm Trusted Publishing(OIDC)——npmjs.com 包设置里配置的 trusted
6
+ # publisher 只接受本仓库 publish.yml 的发布,免长期 token、自动 provenance
7
+ # (来源仓库须 public 才能生成 provenance)
8
+ # - 权限最小化:contents: read + id-token: write(OIDC 签发所需)
9
+ # - 版本一致性守卫:tag 版本必须与 package.json version 完全一致
10
+ # (打 tag 用显式两步:npm version --no-git-tag-version → 手动 git tag <name>-v$V,
11
+ # 见 PUBLISHING.md——npm version 默认打 v%s tag,与本触发器不符)
12
+ # - actions 按 SHA 固定(防供应链;升级 action 时换 SHA 并注明版本)
13
+ name: publish
14
+
15
+ on:
16
+ push:
17
+ tags:
18
+ - '<name>-v*'
19
+
20
+ permissions:
21
+ contents: read
22
+ id-token: write
23
+
24
+ concurrency:
25
+ group: npm-publish
26
+ cancel-in-progress: false
27
+
28
+ # 可选人工审批门:GitHub repo Settings → Environments 建 <env 名> 并设
29
+ # required reviewers,然后取消下行注释(npm 端 trusted publisher 的
30
+ # environment 字段须与这里同名,逐字段一致)。
31
+ # environment: npm-publish
32
+
33
+ jobs:
34
+ publish:
35
+ runs-on: ubuntu-latest
36
+ steps:
37
+ - name: Checkout
38
+ uses: actions/checkout@<commit-SHA> # actions/checkout@v7.0.1
39
+ - name: Setup Node
40
+ uses: actions/setup-node@<commit-SHA> # actions/setup-node@v7.0.0
41
+ # 注意:不加 registry-url。setup-node 的 registry-url 会写一个带占位
42
+ # _authToken 的 .npmrc(NODE_AUTH_TOKEN=XXXXX…),shadow 掉 OIDC 认证,
43
+ # 使 npm publish 走 token 路径而 E404。trusted publishing 纯靠
44
+ # id-token: write,无需 registry-url / NODE_AUTH_TOKEN。
45
+ with:
46
+ node-version: 24
47
+ cache: npm
48
+ cache-dependency-path: package-lock.json
49
+ - name: 'Guard: tag version matches package.json'
50
+ run: |
51
+ EXPECTED="refs/tags/<name>-v$(node -p "require('./package.json').version")"
52
+ if [ "$GITHUB_REF" != "$EXPECTED" ]; then
53
+ echo "::error::tag/version mismatch: $GITHUB_REF vs $EXPECTED"
54
+ exit 1
55
+ fi
56
+ - name: Install
57
+ run: npm ci --legacy-peer-deps
58
+ # 有 Playwright 视觉测试的库再加:env: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
59
+ - name: Verify (build → typecheck → smoke/vitest → mount …)
60
+ # 验证链单源:scripts/verify.mjs——链内增删步骤只改它;此处与 package.json "test" 都只调它。
61
+ # smoke/mount/vitest 为探测式:文件存在才跑,接入即自动进链。
62
+ run: node scripts/verify.mjs
63
+ - name: Publish to npm (OIDC trusted publishing)
64
+ # 升级 npm:trusted publishing 需 npm CLI >= 11.5.1(含 OIDC 支持)。
65
+ # prerelease → dist-tag next(忘加 --tag next 是最常见事故:
66
+ # 用户 npm install 会装到 prerelease);稳定版 → latest。
67
+ run: |
68
+ npm install -g npm@latest
69
+ echo "npm version: $(npm --version)"
70
+ VERSION="$(node -p "require('./package.json').version")"
71
+ if [[ "$VERSION" == *-* ]]; then
72
+ echo "canary prerelease $VERSION → dist-tag next"
73
+ npm publish --access public --tag next --provenance --loglevel verbose
74
+ else
75
+ echo "stable $VERSION → dist-tag latest"
76
+ npm publish --access public --provenance --loglevel verbose
77
+ fi
@@ -0,0 +1,3 @@
1
+ <!-- 模板说明:Claude Code 不直接读 AGENTS.md,官方桥接做法是 CLAUDE.md 用 @ 导入。
2
+ 本文件原样复制即可;如需 Claude 专属指令,追加在 @AGENTS.md 之后。 -->
3
+ @AGENTS.md
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) <year> <org 法律名>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.