diff --git a/.github/workflows/verify-notes.yml b/.github/workflows/verify-notes.yml index d487b6f..d7fe014 100644 --- a/.github/workflows/verify-notes.yml +++ b/.github/workflows/verify-notes.yml @@ -21,7 +21,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 24 - name: Verify note tree, format, and archive seals env: @@ -31,6 +31,16 @@ jobs: # skips append-only (seal-vs-disk still runs). AGENT_NOTE_ARCHIVE_BASE_REF: ${{ github.event.pull_request.base.sha || github.event.before }} run: | - npx tsx scripts/verify-agent-note-tree.ts - npx tsx scripts/verify-agent-note-format.ts - npx tsx scripts/verify-archived-agent-notes.ts + npx tsx skills/write-notes-like-deepseek/scripts/verify-agent-note-tree.ts + npx tsx skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts + npx tsx skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts + + install: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 24 + - name: Verify skill installation and host commands + run: npm run test-skill-install diff --git a/.gitignore b/.gitignore index bfcf80e..d9ca205 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,6 @@ docs/ .agents/notes/ # 7.8MB 脱机内联数据产物不纳入版本库 demo.html + +# 本地生成的轻量看板 +/board.html diff --git a/README.md b/README.md index 92234ec..7d2988e 100644 --- a/README.md +++ b/README.md @@ -196,25 +196,25 @@ Status: implemented ## 本地校验:零依赖,`npx` 直接跑 -> 校验脚本只依赖 Node.js ≥ 18。可以拷贝 `scripts/` 目录进任何项目,也可以让 Agent 随手执行。 +> 校验脚本通过 Node.js 和 `npx tsx` 运行。以下命令在宿主项目根目录执行,使用项目级安装位置 `.agents/skills/write-notes-like-deepseek/`;若安装在 `.claude/skills/` 或全局目录,请替换为实际 Skill 路径。不要切换到 Skill 目录运行,默认检查的是当前目录下的 `.agents/notes/`。 ```bash # 1. 目录、类别、文件名、笔记之间的相对链接 -npx tsx scripts/verify-agent-note-tree.ts +npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-agent-note-tree.ts # 2. 头部与骨架:状态行、必备小节、备选方案必填、implemented 禁用提案标题 -npx tsx scripts/verify-agent-note-format.ts +npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts # 3. 封存区体检:归档笔记的头部布局、封印哈希、只增不改(没有 git 自动降级) -npx tsx scripts/verify-archived-agent-notes.ts +npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts # 4. 老方案被取代,一键归档:只插 Archived: 一行 + 封印 + 列出谁还链着它 # --superseded-by 在新笔记里补互链,不写进归档篇 -npx tsx scripts/archive-agent-note.ts .agents/notes/implemented/<类别>/<文件名>.md \ +npx tsx .agents/skills/write-notes-like-deepseek/scripts/archive-agent-note.ts .agents/notes/implemented/<类别>/<文件名>.md \ --superseded-by .agents/notes/implemented/<类别>/<新笔记>.md # 5. 可选体检(只提醒不报错,不进 CI):代码里若有 // Note: 锚点,是否指着不存在的笔记 -npx tsx scripts/check-note-anchors.ts +npx tsx .agents/skills/write-notes-like-deepseek/scripts/check-note-anchors.ts ``` 配进 `package.json`: @@ -222,13 +222,13 @@ npx tsx scripts/check-note-anchors.ts ```json { "scripts": { - "verify-notes": "npx tsx scripts/verify-agent-note-tree.ts && npx tsx scripts/verify-agent-note-format.ts && npx tsx scripts/verify-archived-agent-notes.ts", - "archive-note": "npx tsx scripts/archive-agent-note.ts" + "verify-notes": "npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-agent-note-tree.ts && npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts && npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts", + "archive-note": "npx tsx .agents/skills/write-notes-like-deepseek/scripts/archive-agent-note.ts" } } ``` -团队场景可以直接抄本仓库的 [.github/workflows/verify-notes.yml](.github/workflows/verify-notes.yml),每次推代码和提 PR 时自动跑前三个校验。 +团队场景可将安装目录里的 `templates/verify-notes.yml`([查看模板](skills/write-notes-like-deepseek/templates/verify-notes.yml))复制到宿主仓库的 `.github/workflows/verify-notes.yml`,核对安装路径并提交 Skill 文件后启用。安装 Skill 本身不会自动启用 CI。 ### 装上 Skill 之后 @@ -263,8 +263,8 @@ AI 会自动在 `proposed/` 输出结构化提案(背景、备选及各自的 不是必需品,只是个顺手的观察窗:一条命令生成单文件 `board.html`,双击就能看——**被引用最多的那几篇笔记**(就是这套系统里最怕碰的决定)、所有被否决方案的避坑清单、按月份的演进时间线。日常开发中它直读本地笔记目录,改了笔记切回浏览器就自动刷新;也可以打包成单文件发到网上([在线演示](https://czm15053.github.io/write-notes-like-deepseek-demo/)就是这么来的)。 ```bash -npx tsx scripts/build-board.ts --init board.html "项目决策看板" # 本地直读,热更新 -npx tsx scripts/build-board.ts --bundle .agents/notes demo.html "项目决策看板" # 打包分发 +npx tsx .agents/skills/write-notes-like-deepseek/scripts/build-board.ts --init board.html "项目决策看板" # 本地直读,热更新 +npx tsx .agents/skills/write-notes-like-deepseek/scripts/build-board.ts --bundle .agents/notes demo.html "项目决策看板" # 打包分发 ``` 真实界面(来自内嵌 DeepSeek Harness 1,196 篇真实笔记的[在线演示](https://czm15053.github.io/write-notes-like-deepseek-demo/)): @@ -295,12 +295,12 @@ npx tsx scripts/build-board.ts --bundle .agents/notes demo.html "项目决策看 ## 仓库导览 -- [`SKILL.md`](SKILL.md):装给 AI 的主契约——先判「要不要写」,再谈怎么写。 -- [`templates/`](templates/):`proposed` / `implemented` / `rejected` 三份填空模板。 -- [`references/when-to-write.md`](references/when-to-write.md):什么时候写、什么时候原地改、什么时候归档。 -- [`references/archiving.md`](references/archiving.md):封存规矩——被取代的老决定怎么干净归档。 -- [`references/quality-gate.md`](references/quality-gate.md):写完笔记后的语义自检清单。 -- [`references/verification.md`](references/verification.md):每个校验脚本在查什么、为什么。 +- [`SKILL.md`](skills/write-notes-like-deepseek/SKILL.md):装给 AI 的主契约——先判「要不要写」,再谈怎么写。 +- [`templates/`](skills/write-notes-like-deepseek/templates/):`proposed` / `implemented` / `rejected` 三份填空模板。 +- [`references/when-to-write.md`](skills/write-notes-like-deepseek/references/when-to-write.md):什么时候写、什么时候原地改、什么时候归档。 +- [`references/archiving.md`](skills/write-notes-like-deepseek/references/archiving.md):封存规矩——被取代的老决定怎么干净归档。 +- [`references/quality-gate.md`](skills/write-notes-like-deepseek/references/quality-gate.md):写完笔记后的语义自检清单。 +- [`references/verification.md`](skills/write-notes-like-deepseek/references/verification.md):每个校验脚本在查什么、为什么。 @@ -311,3 +311,13 @@ npx tsx scripts/build-board.ts --bundle .agents/notes demo.html "项目决策看 ## 许可证 [MIT](LICENSE) + +## 仓库维护与安装内容 + +可安装内容集中在 `skills/write-notes-like-deepseek/`,包含 `SKILL.md`、`references/`、`templates/`、`scripts/` 和看板模板 `assets/agent-notes-board.html`。根目录的 README 配图、CI、导入示例笔记和配图导出脚本用于维护本仓库。 + +原安装命令 `npx skills add czm15053/write-notes-like-deepseek` 保持不变,无需指定 `--skill`。安装器负责发现子目录中的 Skill 并放入所选 Agent 的安装位置。 + +维护本仓库时,在仓库根目录执行 `npm run verify-notes`、`npm run init-board` 或 `npm run bundle-board`;`board.html` 和 `demo.html` 均为生成产物。下游项目需自行配置上文的 npm scripts。 + +运行 `npm run test-skill-install` 可在临时宿主项目中验证安装边界、Codex / Claude Code 安装路径、笔记校验、归档和看板生成。该检查使用固定版本 `skills@1.7.1`,覆盖默认链接和 `--copy` 两种安装方式,且不指定 `--skill`;需要联网获取 CLI 与 tsx,CI 使用 Node.js 24。 diff --git a/board.html b/board.html deleted file mode 100644 index 97c1c5a..0000000 --- a/board.html +++ /dev/null @@ -1,1768 +0,0 @@ - - - - - - -工程决策看板 - - - - - - - - -
-
- -
- 工程决策看板 - 0 项 -
-
- - - -
- - - -
- - 连接本地目录 -
-
- -
- - - - - -
-
- -
-
- - 🏛️ - 系统承重墙 - - 基于交叉引用入度权重萃取的系统关键协议 -
-
-
- -
-
- - 🧩 - 领域架构分类阵列 - - 现行生效的生产事实全景清单 -
-
-
-
- - -
-
-
- - ⏱️ - 技术演进时间线 - - 记录架构突破与代码裁撤里程碑 -
- -
-
- 📅 月份切片: -
-
-
- 🏷️ 分类切片: -
-
-
- - -
-
- -
-
-
- - -
-
-
- - 🛡️ - 避坑与反思智库 - - 记录「为什么放弃了方案 B」与被否决的提案,防止重复踩坑 -
-
- -
-
-
-
- - -
-
- - - - - -
- -
-
- 编号 - 分类 - 标题 - 状态 - 日期 - 引用 -
-
-
-
- - - -
- - -
- - - - - - - - \ No newline at end of file diff --git a/package.json b/package.json index 7e8bc08..55a914e 100644 --- a/package.json +++ b/package.json @@ -5,16 +5,17 @@ "type": "module", "description": "像 DeepSeek 团队一样维护项目:把他们在 DeepSeek Harness 里用的那套方法,装进你的仓库", "scripts": { - "verify-agent-note-tree": "npx tsx scripts/verify-agent-note-tree.ts", - "verify-agent-note-format": "npx tsx scripts/verify-agent-note-format.ts", - "verify-archived": "npx tsx scripts/verify-archived-agent-notes.ts", - "verify-notes": "npx tsx scripts/verify-agent-note-tree.ts && npx tsx scripts/verify-agent-note-format.ts && npx tsx scripts/verify-archived-agent-notes.ts", - "archive-agent-note": "npx tsx scripts/archive-agent-note.ts", - "check-anchors": "npx tsx scripts/check-note-anchors.ts", - "init-board": "npx tsx scripts/build-board.ts --init board.html '工程决策看板'", - "bundle-board": "npx tsx scripts/build-board.ts --bundle .agents/notes demo.html '工程决策看板'", - "build-board": "npx tsx scripts/build-board.ts --init board.html '工程决策看板'", + "verify-agent-note-tree": "npx tsx skills/write-notes-like-deepseek/scripts/verify-agent-note-tree.ts", + "verify-agent-note-format": "npx tsx skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts", + "verify-archived": "npx tsx skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts", + "verify-notes": "npx tsx skills/write-notes-like-deepseek/scripts/verify-agent-note-tree.ts && npx tsx skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts && npx tsx skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts", + "archive-agent-note": "npx tsx skills/write-notes-like-deepseek/scripts/archive-agent-note.ts", + "check-anchors": "npx tsx skills/write-notes-like-deepseek/scripts/check-note-anchors.ts", + "init-board": "npx tsx skills/write-notes-like-deepseek/scripts/build-board.ts --init board.html '工程决策看板'", + "bundle-board": "npx tsx skills/write-notes-like-deepseek/scripts/build-board.ts --bundle .agents/notes demo.html '工程决策看板'", + "build-board": "npx tsx skills/write-notes-like-deepseek/scripts/build-board.ts --init board.html '工程决策看板'", "import-dsh-notes": "npx tsx scripts/import-dsh-notes.ts", - "export-assets": "bash scripts/export-assets.sh" + "export-assets": "bash scripts/export-assets.sh", + "test-skill-install": "node scripts/test-skill-install.mjs" } } diff --git a/scripts/import-dsh-notes.ts b/scripts/import-dsh-notes.ts index 65c5b54..b86b949 100644 --- a/scripts/import-dsh-notes.ts +++ b/scripts/import-dsh-notes.ts @@ -80,7 +80,7 @@ for (const topDoc of ['README.zh.md', 'README.md', 'AGENTS.md']) { // 自动更新归档 Note 密封清单 try { - execSync('npx tsx scripts/verify-archived-agent-notes.ts --write', { stdio: 'ignore' }); + execSync('npx tsx skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts --write', { stdio: 'ignore' }); } catch {} console.log(`✅ 成功将 ${copied} 篇中文 Note 标准化写入到: ${targetNotesDir}`); diff --git a/scripts/test-skill-install.mjs b/scripts/test-skill-install.mjs new file mode 100644 index 0000000..d6a3ee4 --- /dev/null +++ b/scripts/test-skill-install.mjs @@ -0,0 +1,63 @@ +import assert from 'node:assert/strict'; +import { spawnSync } from 'node:child_process'; +import { existsSync, mkdtempSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { dirname, join, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const repo = resolve(dirname(fileURLToPath(import.meta.url)), '..'); +const scratch = realpathSync(mkdtempSync(join(tmpdir(), 'notes-skill-install-'))); +const env = { ...process.env, DISABLE_TELEMETRY: '1' }; +delete env.AGENT_NOTE_ROOT; +delete env.AGENT_NOTE_ARCHIVE_BASE_REF; + +function run(cwd, args, success = true) { + const result = spawnSync('npx', ['--yes', ...args], { cwd, env, encoding: 'utf8' }); + if (result.error) throw result.error; + assert.equal(result.status === 0, success, `${args.join(' ')}\n${result.stdout}\n${result.stderr}`); + return result.stdout; +} + +try { + for (const mode of ['symlink', 'copy']) { + const host = join(scratch, mode); + mkdirSync(host); + // Deliberately omit --skill: discover the single skill from the repository root. + const output = run(host, ['skills@1.7.1', 'add', repo, '--agent', 'codex', 'claude-code', '-y', + ...(mode === 'copy' ? ['--copy'] : [])]); + assert.match(output, /write-notes-like-deepseek/); + + const canonical = join(host, '.agents/skills/write-notes-like-deepseek'); + const claude = join(host, '.claude/skills/write-notes-like-deepseek'); + for (const installed of [canonical, claude]) { + assert.deepEqual(readdirSync(installed).sort(), ['SKILL.md', 'assets', 'references', 'scripts', 'templates']); + assert.deepEqual(readdirSync(join(installed, 'assets')), ['agent-notes-board.html']); + assert.ok(existsSync(join(installed, 'templates/verify-notes.yml'))); + assert.equal(readFileSync(join(installed, 'SKILL.md'), 'utf8'), + readFileSync(join(repo, 'skills/write-notes-like-deepseek/SKILL.md'), 'utf8')); + } + + const noteDir = join(host, '.agents/notes/implemented/process'); + mkdirSync(noteDir, { recursive: true }); + const note = join(noteDir, '2026-10-07-install-check.md'); + writeFileSync(note, '# Agent Note: Install check\n\nStatus: implemented\n\n## Problem\nValidate installed paths.\n\n## Decision\nRun from the host project.\n\n## Alternatives considered\nRunning from the skill directory targets the wrong notes.\n\n## Consequences\nHost notes are checked.\n'); + const script = (name) => join(canonical, 'scripts', `${name}.ts`); + for (const name of ['verify-agent-note-tree', 'verify-agent-note-format', 'verify-archived-agent-notes']) { + run(host, ['tsx', script(name)]); + } + // A broken host note must fail even though the installed skill has no notes. + writeFileSync(note, readFileSync(note, 'utf8').replace('Status: implemented', 'Status: proposed')); + run(host, ['tsx', join(claude, 'scripts/verify-agent-note-format.ts')], false); + writeFileSync(note, readFileSync(note, 'utf8').replace('Status: proposed', 'Status: implemented')); + run(host, ['tsx', script('build-board'), '--init', 'board.html', 'Install check']); + assert.match(readFileSync(join(host, 'board.html'), 'utf8'), /Install check/); + run(host, ['tsx', script('build-board'), '--bundle', '.agents/notes', 'demo.html', 'Install check']); + assert.match(readFileSync(join(host, 'demo.html'), 'utf8'), /Host notes are checked/); + run(host, ['tsx', script('archive-agent-note'), note]); + run(host, ['tsx', script('verify-archived-agent-notes')]); + assert.ok(existsSync(join(host, '.agents/notes/archived/process/2026-10-07-install-check.md'))); + console.log(`ok: ${mode} installation, Codex/Claude paths, host validation, boards, archive`); + } +} finally { + rmSync(scratch, { recursive: true, force: true }); +} diff --git a/SKILL.md b/skills/write-notes-like-deepseek/SKILL.md similarity index 90% rename from SKILL.md rename to skills/write-notes-like-deepseek/SKILL.md index 0d9bb0e..bf51a52 100644 --- a/SKILL.md +++ b/skills/write-notes-like-deepseek/SKILL.md @@ -156,13 +156,26 @@ npm run verify-agent-note-tree # 目录合法性、分类、文件名、笔 npm run verify-agent-note-format # 头块、状态、必备节、备选方案、implemented 禁用提案标题 npm run verify-archived # 归档封印:头部布局、manifest 哈希、只增不改(无 git 自动降级) npm run verify-notes # 以上三线串跑(CI 用这个) -npm run archive-agent-note [--superseded-by <新笔记>] # 一键归档;可选在新笔记插入互链 + 入站死链报告 +npm run archive-agent-note -- [--superseded-by <新笔记>] # 一键归档;可选在新笔记插入互链 + 入站死链报告 npm run check-anchors # 软报告:若代码里有 // Note: 锚点,做双向体检;不当 CI 门 npm run init-board # 生成 ~69KB 轻量看板 board.html(日常开发推荐) npm run bundle-board # 打包内嵌全量数据的自包含 demo.html ``` -每个脚本都是独立 tsx(`scripts/*.ts`),也可 `npx tsx scripts/xxx.ts` 直接跑在任何目录;参数与免疫规则见 `references/verification.md`。看板要自定义输出路径时用 `npx tsx scripts/build-board.ts --init <目标.html> "名字"` / `--bundle <输出.html> "名字"`。团队可直接抄本仓库的 `.github/workflows/verify-notes.yml`,把 `verify-notes` 接进 CI;并在 `CONTRIBUTING.md` / PR 模板加一句「重要改动必带一篇笔记」。 +脚本位于本 Skill 的 `scripts/`,从**宿主项目根目录**调用,默认检查当前目录下的 `.agents/notes/`。先根据已加载的 `SKILL.md` 路径确定 Skill 位置,不要假定宿主根目录存在 `scripts/`,也不要切换到 Skill 目录执行。安装不会自动配置宿主的 npm scripts。 + +项目级安装到 `.agents/skills/` 时,可直接执行: + +```sh +npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-agent-note-tree.ts +npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts +npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts +npx tsx .agents/skills/write-notes-like-deepseek/scripts/build-board.ts --init board.html "项目决策看板" +``` + +安装到 `.claude/skills/` 或全局目录时,用实际 Skill 路径替换上述前缀。看板打包参数为 `--bundle <输出.html> "名字"`;参数与免疫规则见 `references/verification.md`。 + +团队可将本 Skill 的 `templates/verify-notes.yml` 复制到宿主仓库 `.github/workflows/verify-notes.yml`,调整为实际安装路径,并将项目级 Skill 文件一起提交;模板在 Skill 目录内不会执行。可在 `CONTRIBUTING.md` / PR 模板加一句「重要改动必带一篇笔记」。 ## References diff --git a/assets/agent-notes-board.html b/skills/write-notes-like-deepseek/assets/agent-notes-board.html similarity index 100% rename from assets/agent-notes-board.html rename to skills/write-notes-like-deepseek/assets/agent-notes-board.html diff --git a/references/archiving.md b/skills/write-notes-like-deepseek/references/archiving.md similarity index 93% rename from references/archiving.md rename to skills/write-notes-like-deepseek/references/archiving.md index 6c32c45..fab1f7a 100644 --- a/references/archiving.md +++ b/skills/write-notes-like-deepseek/references/archiving.md @@ -69,7 +69,7 @@ 推荐直接用 CLI(物理移动 + 封印 + 入站死链报告一次完成,**不依赖 git**): ```bash -npx tsx scripts/archive-agent-note.ts \ +npx tsx .agents/skills/write-notes-like-deepseek/scripts/archive-agent-note.ts \ .agents/notes/implemented//.md \ [--superseded-by .agents/notes/implemented//<新笔记>.md] ``` @@ -94,7 +94,7 @@ CLI 依次完成: 除头部 `Archived:` 一行外,**禁止修改归档正文的任何其他字符**。 > 历史包袱补齐:若 `archived/` 已有笔记但还没有 manifest(例如从 DSH 导入的语料),运行 -> `npx tsx scripts/verify-archived-agent-notes.ts --write` 一次性补封印——它会先校验既有封印未被改动,再追加缺失条目,绝不重写历史。 +> `npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts --write` 一次性补封印——它会先校验既有封印未被改动,再追加缺失条目,绝不重写历史。 --- @@ -105,3 +105,5 @@ CLI 依次完成: - **机械强制**:`verify-archived` 校验头部布局、manifest 哈希、以及封印的 append-only(有 git 时与基线 ref 对比,`AGENT_NOTE_ARCHIVE_BASE_REF` 可指定基线,默认 HEAD;无 git 自动降级为哈希自校验并提示)。封印只增不改,已封印条目被改动或删除即报错。 - **免除日常扫描**:`verify-agent-note-tree` 和 `verify-agent-note-format` 默认跳过 `archived/` 目录,归档文件的出站链接失效不会阻塞日常构建。 - **不可作为当前行为依据**:代码冲突或架构评审时,以 `implemented/` 为准,`archived/` 仅作为历史考据参考;取代关系以新笔记互链和入站改写为准。 + +上述命令从宿主项目根目录执行;若 Skill 安装在其他位置,请替换 `.agents/skills/write-notes-like-deepseek` 为实际路径。 diff --git a/references/classification.md b/skills/write-notes-like-deepseek/references/classification.md similarity index 100% rename from references/classification.md rename to skills/write-notes-like-deepseek/references/classification.md diff --git a/references/note-format.md b/skills/write-notes-like-deepseek/references/note-format.md similarity index 100% rename from references/note-format.md rename to skills/write-notes-like-deepseek/references/note-format.md diff --git a/references/prose-checklist.md b/skills/write-notes-like-deepseek/references/prose-checklist.md similarity index 100% rename from references/prose-checklist.md rename to skills/write-notes-like-deepseek/references/prose-checklist.md diff --git a/references/quality-gate.md b/skills/write-notes-like-deepseek/references/quality-gate.md similarity index 100% rename from references/quality-gate.md rename to skills/write-notes-like-deepseek/references/quality-gate.md diff --git a/references/simplification-checklist.md b/skills/write-notes-like-deepseek/references/simplification-checklist.md similarity index 100% rename from references/simplification-checklist.md rename to skills/write-notes-like-deepseek/references/simplification-checklist.md diff --git a/references/verification.md b/skills/write-notes-like-deepseek/references/verification.md similarity index 89% rename from references/verification.md rename to skills/write-notes-like-deepseek/references/verification.md index 8f9fb9c..56ac4ae 100644 --- a/references/verification.md +++ b/skills/write-notes-like-deepseek/references/verification.md @@ -25,6 +25,10 @@ ## 接入建议 - 轻量(个人/无 git):前两个脚本即可,归档封印在第一次归档后自然生效。 -- 完整(团队):`npm run verify-notes` 三线串进 CI,失败即红(本仓库 `.github/workflows/verify-notes.yml` 可作模板)。 +- 完整(团队):`npm run verify-notes` 三线串进 CI,失败即红(本 Skill 的 `templates/verify-notes.yml` 可作模板,复制到宿主根目录 `.github/workflows/` 并核对脚本路径后启用)。 三个校验脚本方法上来自 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness),按通用中文单语宿主裁过:无双语三件套、无 DSH 迁仓豁免。锚点体检是可选软报告,不是 DSH 门禁。 + +## 脚本路径 + +本文的 `scripts/` 相对于 Skill 安装目录。运行命令时保持当前目录为宿主项目根目录,并使用实际 Skill 路径调用脚本;安装本身不会创建宿主 npm scripts。 diff --git a/references/when-to-write.md b/skills/write-notes-like-deepseek/references/when-to-write.md similarity index 100% rename from references/when-to-write.md rename to skills/write-notes-like-deepseek/references/when-to-write.md diff --git a/scripts/agent-note-tree.ts b/skills/write-notes-like-deepseek/scripts/agent-note-tree.ts similarity index 100% rename from scripts/agent-note-tree.ts rename to skills/write-notes-like-deepseek/scripts/agent-note-tree.ts diff --git a/scripts/archive-agent-note.ts b/skills/write-notes-like-deepseek/scripts/archive-agent-note.ts similarity index 96% rename from scripts/archive-agent-note.ts rename to skills/write-notes-like-deepseek/scripts/archive-agent-note.ts index 126bfcb..39bf9e4 100644 --- a/scripts/archive-agent-note.ts +++ b/skills/write-notes-like-deepseek/scripts/archive-agent-note.ts @@ -1,6 +1,6 @@ /** * CLI tool to archive an implemented Agent Note with frozen manifest sealing. - * Usage: npx tsx scripts/archive-agent-note.ts .agents/notes/implemented//.md [--superseded-by ] + * Usage: npx tsx /scripts/archive-agent-note.ts .agents/notes/implemented//.md [--superseded-by ] * --superseded-by writes a relative link into the NEW note, never into the archived file. */ import { createHash } from "node:crypto"; @@ -17,7 +17,7 @@ if (supersededByArgIdx !== -1 && !supersededByArg) { process.exit(1); } if (!targetArg) { - console.error("Usage: npx tsx scripts/archive-agent-note.ts [--superseded-by ]"); + console.error("Usage: npx tsx /scripts/archive-agent-note.ts [--superseded-by ]"); process.exit(1); } diff --git a/scripts/build-board.ts b/skills/write-notes-like-deepseek/scripts/build-board.ts similarity index 100% rename from scripts/build-board.ts rename to skills/write-notes-like-deepseek/scripts/build-board.ts diff --git a/scripts/check-note-anchors.ts b/skills/write-notes-like-deepseek/scripts/check-note-anchors.ts similarity index 98% rename from scripts/check-note-anchors.ts rename to skills/write-notes-like-deepseek/scripts/check-note-anchors.ts index 337a320..8acf81b 100644 --- a/scripts/check-note-anchors.ts +++ b/skills/write-notes-like-deepseek/scripts/check-note-anchors.ts @@ -4,7 +4,7 @@ * B. implemented notes with zero inbound code anchors (suspected missing anchor) * Exit code is always 0 — this is an advisory report, not a gate. * Env: AGENT_NOTE_CODE_ROOT (default: cwd) — source root to scan. - * Run: npx tsx scripts/check-note-anchors.ts + * Run: npx tsx /scripts/check-note-anchors.ts */ import { existsSync, readFileSync, readdirSync } from "node:fs"; import { join, resolve } from "node:path"; diff --git a/scripts/verify-agent-note-format.ts b/skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts similarity index 98% rename from scripts/verify-agent-note-format.ts rename to skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts index 1d4bd44..9e6f72f 100644 --- a/scripts/verify-agent-note-format.ts +++ b/skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts @@ -2,7 +2,7 @@ * Enforce Agent Note headers, lifecycle-specific sections, alternatives. * Implemented notes may not carry proposal-era H2s; present tense in the * body is a prose rule, not a lexical scan. - * Run: npx tsx scripts/verify-agent-note-format.ts + * Run: npx tsx /scripts/verify-agent-note-format.ts */ import { readFileSync } from "node:fs"; import { resolve } from "node:path"; diff --git a/scripts/verify-agent-note-tree.ts b/skills/write-notes-like-deepseek/scripts/verify-agent-note-tree.ts similarity index 96% rename from scripts/verify-agent-note-tree.ts rename to skills/write-notes-like-deepseek/scripts/verify-agent-note-tree.ts index a1a293a..7b93c50 100644 --- a/scripts/verify-agent-note-tree.ts +++ b/skills/write-notes-like-deepseek/scripts/verify-agent-note-tree.ts @@ -1,6 +1,6 @@ /** * Verify tree: lifecycle/class/filename/INDEX and internal relative markdown links. - * Run: npx tsx scripts/verify-agent-note-tree.ts + * Run: npx tsx /scripts/verify-agent-note-tree.ts */ import { existsSync, readFileSync } from "node:fs"; import { dirname, resolve, sep } from "node:path"; diff --git a/scripts/verify-archived-agent-notes.ts b/skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts similarity index 96% rename from scripts/verify-archived-agent-notes.ts rename to skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts index c454f71..ed93f74 100644 --- a/scripts/verify-archived-agent-notes.ts +++ b/skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts @@ -2,8 +2,8 @@ * Verify frozen archived Agent Notes: exact head layout, manifest.json seals, * append-only extension vs a git baseline (skipped gracefully without git). * Usage: - * npx tsx scripts/verify-archived-agent-notes.ts # verify only - * npx tsx scripts/verify-archived-agent-notes.ts --write # verify, then seal unsealed files + * npx tsx /scripts/verify-archived-agent-notes.ts # verify only + * npx tsx /scripts/verify-archived-agent-notes.ts --write # verify, then seal unsealed files * Env: AGENT_NOTE_ARCHIVE_BASE_REF (default HEAD) — git ref the manifest is compared against. */ import { createHash } from "node:crypto"; diff --git a/templates/implemented.md b/skills/write-notes-like-deepseek/templates/implemented.md similarity index 100% rename from templates/implemented.md rename to skills/write-notes-like-deepseek/templates/implemented.md diff --git a/templates/proposed.md b/skills/write-notes-like-deepseek/templates/proposed.md similarity index 100% rename from templates/proposed.md rename to skills/write-notes-like-deepseek/templates/proposed.md diff --git a/templates/rejected.md b/skills/write-notes-like-deepseek/templates/rejected.md similarity index 100% rename from templates/rejected.md rename to skills/write-notes-like-deepseek/templates/rejected.md diff --git a/skills/write-notes-like-deepseek/templates/verify-notes.yml b/skills/write-notes-like-deepseek/templates/verify-notes.yml new file mode 100644 index 0000000..4ee3a5c --- /dev/null +++ b/skills/write-notes-like-deepseek/templates/verify-notes.yml @@ -0,0 +1,38 @@ +# 复制到宿主仓库 .github/workflows/verify-notes.yml 后启用。 +# 默认项目级安装路径;使用其他路径时请同步修改下方命令。 +name: Verify Agent Notes + +on: + push: + branches: + - main + pull_request: + +permissions: + contents: read + +jobs: + verify: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 24 + + - name: Verify note tree, format, and archive seals + env: + # HEAD is a no-op on a clean checkout. Compare against the pre-change + # commit: PR base, or the previous tip of the pushed branch. + # A new-branch push sends before=0000…; git show fails and the script + # skips append-only (seal-vs-disk still runs). + AGENT_NOTE_ARCHIVE_BASE_REF: ${{ github.event.pull_request.base.sha || github.event.before }} + run: | + npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-agent-note-tree.ts + npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-agent-note-format.ts + npx tsx .agents/skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts