chore: 同步 DSH 上游笔记,门禁适配新变体

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
czm
2026-10-18 09:15:04 +08:00
co-authored by Claude Code
parent 0e8200c0f8
commit 7e99b275e5
5 changed files with 54 additions and 8 deletions
+2 -2
View File
@@ -12,7 +12,7 @@ AI 每天都能帮你交十几个 PR,但每个新会话都是一张白纸,
npx skills add czm15053/write-notes-like-deepseek
```
📺 先看效果:[在线演示看板](https://czm15053.github.io/write-notes-like-deepseek-demo/)(内置 1,196 篇来自 DeepSeek Harness 的真实决策笔记,可脱机浏览)
📺 先看效果:[在线演示看板](https://czm15053.github.io/write-notes-like-deepseek-demo/)(内置 1,267 篇来自 DeepSeek Harness 的真实决策笔记,可脱机浏览)
---
@@ -267,7 +267,7 @@ npx tsx .agents/skills/write-notes-like-deepseek/scripts/build-board.ts --init b
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/)):
真实界面(来自内嵌 DeepSeek Harness 1,267 篇真实笔记的[在线演示](https://czm15053.github.io/write-notes-like-deepseek-demo/)):
<p align="center">
<img src="assets/board-baseline.png" alt="看板真实界面:四组 KPI 总览与「系统承重墙」——按交叉引用权重萃取的最关键决策" width="100%" />
+41 -2
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env node
import { execSync } from 'node:child_process';
import { readdirSync, readFileSync, writeFileSync, mkdirSync, existsSync } from 'node:fs';
import { readdirSync, readFileSync, writeFileSync, mkdirSync, existsSync, rmSync, rmdirSync } from 'node:fs';
import { join, resolve, relative, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -78,7 +78,46 @@ for (const topDoc of ['README.zh.md', 'README.md', 'AGENTS.md']) {
}
}
// 自动更新归档 Note 密封清单
// 清理已在源端被移除或移动的旧 Note
function cleanTarget(currentDir: string) {
if (!existsSync(currentDir)) return;
const entries = readdirSync(currentDir, { withFileTypes: true });
for (const entry of entries) {
if (entry.name.startsWith('.')) continue;
const fullPath = join(currentDir, entry.name);
if (entry.isDirectory()) {
cleanTarget(fullPath);
try {
if (readdirSync(fullPath).length === 0) {
rmdirSync(fullPath);
}
} catch {}
} else if (entry.isFile() && entry.name.endsWith('.md')) {
const rel = relative(targetNotesDir, fullPath).replace(/\\/g, '/');
if (rel === 'README.md' || rel === 'AGENTS.md' || rel === 'archived/AGENTS.md') continue;
if (!noteMap.has(rel)) {
rmSync(fullPath);
}
}
}
}
cleanTarget(targetNotesDir);
// 拷贝 archived/AGENTS.md
const archivedAgents = join(dshNotesDir, 'archived', 'AGENTS.md');
if (existsSync(archivedAgents)) {
mkdirSync(join(targetNotesDir, 'archived'), { recursive: true });
writeFileSync(join(targetNotesDir, 'archived', 'AGENTS.md'), readFileSync(archivedAgents, 'utf8'), 'utf8');
}
// 重建归档 Note 密封清单:本地笔记经过标准化,与上游原文不同,seal 必须基于本地文件重算
const localManifest = join(targetNotesDir, 'archived', 'manifest.json');
if (existsSync(localManifest)) {
try {
rmSync(localManifest);
} catch {}
}
try {
execSync('npx tsx skills/write-notes-like-deepseek/scripts/verify-archived-agent-notes.ts --write', { stdio: 'ignore' });
} catch {}
@@ -24,7 +24,7 @@ const REQUIRED: Record<string, string[][]> = {
],
implemented: [
["## Decision", "## 决定", "## 决策"],
["## Consequences", "## 后果", "## 影响", "## 结果", "## 结果与代价", "## 影响与验证"],
["## Consequences", "## 后果", "## 影响", "## 结果", "## 结果与代价", "## 影响与验证", "## 后果与边界"],
],
rejected: [
["## Proposal", "## 提议", "## 方案", "## 提案"],
@@ -38,7 +38,7 @@ const BANNED_IMPLEMENTED = new Set([
"## 验收标准", "## 验收条件", "## 接受标准",
]);
const ALTERNATIVES_RE = /^## (?:Alternatives considered|.{0,8}?(?:替代方案|备选(?:方案)?))$/;
const ALTERNATIVES_RE = /^## (?:Alternatives considered|.{0,8}?(?:替代方案|备选(?:方案)?|其他做法))$/;
const FORMAT_ADOPTED = "2026-07-05";
const GRANDFATHER = "<!-- agent-note-format: alternatives-not-recorded (pre-format Agent Note) -->";
@@ -17,9 +17,14 @@ for (const note of notes) {
let match: RegExpExecArray | null;
while ((match = LINK_REGEX.exec(content)) !== null) {
const rawTarget = match[2]?.trim();
let rawTarget = match[2]?.trim();
if (!rawTarget) continue;
// Support CommonMark angle bracket destinations: [text](<path>)
if (rawTarget.startsWith("<") && rawTarget.endsWith(">")) {
rawTarget = rawTarget.slice(1, -1).trim();
}
// Ignore web links, intra-page anchors and ellipsis placeholders
if (rawTarget.startsWith("http://") || rawTarget.startsWith("https://") || rawTarget.startsWith("#") || rawTarget.startsWith("mailto:") || rawTarget.includes("…")) {
continue;
@@ -26,7 +26,9 @@ function scan(dir: string) {
const full = join(dir, entry.name);
if (entry.isDirectory()) scan(full);
else if (entry.isFile() && entry.name.endsWith(".md") && !entry.name.endsWith(".zh.md")) {
files.push(relative(archivedDir, full).split("\\").join("/"));
const rel = relative(archivedDir, full).split("\\").join("/");
if (rel === "AGENTS.md" || rel === "manifest.json") continue;
files.push(rel);
}
}
}