diff --git a/docs/V2-REVISION-SPEC.md b/docs/archive/V2-REVISION-SPEC.md similarity index 100% rename from docs/V2-REVISION-SPEC.md rename to docs/archive/V2-REVISION-SPEC.md diff --git a/scripts/check-code-ratio.ts b/scripts/check-code-ratio.ts index b4714c9..e553562 100644 --- a/scripts/check-code-ratio.ts +++ b/scripts/check-code-ratio.ts @@ -21,7 +21,7 @@ * * **判定范围(OC-R PR #17 反馈收窄)**:候选文件限制为顶层章节文件 * `docs/NN-标题.md`(两位数字前缀),由 `CHAPTER_FILE_RE` 控制。 - * `docs/appendix/{A..F}.md`(自动生成附录)、`docs/V2-REVISION-SPEC.md` + * `docs/appendix/{A..F}.md`(自动生成附录)、`docs/archive/V2-REVISION-SPEC.md` * (spec 本体)以及任何子目录散页都不进入新章判定。 * * 仅统计源码 fenced block:`ts / tsx / js / jsx / bash / sh / typescript / diff --git a/scripts/check-heading-preservation.ts b/scripts/check-heading-preservation.ts index cff531a..7c788c4 100644 --- a/scripts/check-heading-preservation.ts +++ b/scripts/check-heading-preservation.ts @@ -95,7 +95,7 @@ function loadAllowlist(): Map> { const allowlist = loadAllowlist(); const files = (explicitFiles ?? getChangedFiles(base)).filter( - (f) => f.startsWith("docs/") && f.endsWith(".md") && f !== "docs/V2-REVISION-SPEC.md", + (f) => f.startsWith("docs/") && f.endsWith(".md") && f !== "docs/archive/V2-REVISION-SPEC.md", ); if (files.length === 0) { diff --git a/scripts/check-no-frontmatter-in-chapters.ts b/scripts/check-no-frontmatter-in-chapters.ts index 32dd2c8..f4b33a3 100644 --- a/scripts/check-no-frontmatter-in-chapters.ts +++ b/scripts/check-no-frontmatter-in-chapters.ts @@ -12,11 +12,11 @@ * * 硬约束:`docs/` 下所有面向读者的章节 markdown(即 `docs/*.md`)**不允许** * 出现任何 YAML frontmatter。所有 chapter 元数据只活在 PR 描述、issue body、 - * `docs/V2-REVISION-SPEC.md` 内部、或 `scripts/` 外部 manifest 里——这些位置 + * `docs/archive/V2-REVISION-SPEC.md` 内部、或 `scripts/` 外部 manifest 里——这些位置 * 读者根本不会看到。 * * 例外白名单(必须在文件首列出原因): - * - docs/V2-REVISION-SPEC.md —— 这是 spec 元文档,不是面向读者的书章节。 + * - docs/archive/V2-REVISION-SPEC.md —— 这是 spec 元文档,不是面向读者的书章节。 * * 检测口径:文件第一行 + 第二行(去除 BOM 后)若出现 `^---\s*$`,直接 fail。 * ——这与 markdown 工具链对 YAML frontmatter 的识别口径一致;不试图区分 @@ -36,7 +36,7 @@ import { join } from "node:path"; const DOCS_DIR = "docs"; // 例外白名单:spec 元文档允许 frontmatter;章节正文不允许。 -const ALLOWLIST = new Set(["docs/V2-REVISION-SPEC.md"]); +const ALLOWLIST = new Set(["docs/archive/V2-REVISION-SPEC.md"]); function listChapterFiles(): string[] { const out: string[] = []; diff --git a/scripts/lint-no-fuzzy-quantifiers.ts b/scripts/lint-no-fuzzy-quantifiers.ts index a075086..60cf64c 100644 --- a/scripts/lint-no-fuzzy-quantifiers.ts +++ b/scripts/lint-no-fuzzy-quantifiers.ts @@ -168,7 +168,7 @@ function scanFile(file: string, lineFilter: Set | null): Hit[] { const useExplicit = explicitFiles !== null; const files = (explicitFiles ?? getChangedFiles(base)).filter( - (f) => f.startsWith("docs/") && f.endsWith(".md") && f !== "docs/V2-REVISION-SPEC.md", + (f) => f.startsWith("docs/") && f.endsWith(".md") && f !== "docs/archive/V2-REVISION-SPEC.md", ); if (files.length === 0) { diff --git a/scripts/lint-no-revision-codenames.ts b/scripts/lint-no-revision-codenames.ts index 000123d..1c714c9 100644 --- a/scripts/lint-no-revision-codenames.ts +++ b/scripts/lint-no-revision-codenames.ts @@ -2,7 +2,7 @@ /** * Lint: no revision codenames in reader-facing prose. * - * 背景:v1 / v2 是内部修订代号(见 docs/V2-REVISION-SPEC.md),不应渗入读者侧成书正文。 + * 背景:v1 / v2 是内部修订代号(见 docs/archive/V2-REVISION-SPEC.md),不应渗入读者侧成书正文。 * 本 lint 扫描 docs/**\/*.md 的正文,拦截把 v1 / v2 当作书内身份称呼的写法。 * * 默认禁词正则(大小写不敏感): @@ -13,7 +13,7 @@ * 排除规则(按顺序应用,先排除后判禁): * 1) frontmatter(首尾 --- 之间)整体豁免; * 2) HTML 注释 整体豁免(含跨行); - * 3) docs/V2-REVISION-SPEC.md 整体豁免(它本身就在讨论 v1/v2 流程); + * 3) docs/archive/V2-REVISION-SPEC.md 整体豁免(它本身就在讨论 v1/v2 流程); * 4) docs/appendix/*.manifest.json 的 notes 字段不在扫描范围(本脚本只扫 .md); * docs/appendix/*.md 仍受扫描,命中需进白名单; * 5) 代码块 ``` fence 内整体豁免; @@ -34,7 +34,7 @@ import { join, relative, resolve } from "node:path"; const REPO_ROOT = resolve(import.meta.dir, ".."); const ALLOWLIST_PATH = join(REPO_ROOT, "scripts", "revision-codename-allowlist.txt"); const DOCS_DIR = join(REPO_ROOT, "docs"); -const SPEC_PATH_REL = "docs/V2-REVISION-SPEC.md"; +const SPEC_PATH_REL = "docs/archive/V2-REVISION-SPEC.md"; type Hit = { file: string; line: number; col: number; rule: string; text: string }; diff --git a/scripts/lint-no-spec-jargon-in-prose.ts b/scripts/lint-no-spec-jargon-in-prose.ts index f0255dd..ec8102e 100644 --- a/scripts/lint-no-spec-jargon-in-prose.ts +++ b/scripts/lint-no-spec-jargon-in-prose.ts @@ -178,7 +178,7 @@ function scanFile(file: string, lineFilter: Set | null): Hit[] { const useExplicit = explicitFiles !== null; // spec 元文档不扫——它的工作就是讨论这些 squad 内部术语。 const files = (explicitFiles ?? getChangedFiles(base)).filter( - (f) => f.startsWith("docs/") && f.endsWith(".md") && f !== "docs/V2-REVISION-SPEC.md", + (f) => f.startsWith("docs/") && f.endsWith(".md") && f !== "docs/archive/V2-REVISION-SPEC.md", ); if (files.length === 0) { diff --git a/scripts/lint-section-titles.ts b/scripts/lint-section-titles.ts index e741787..9ea7b62 100644 --- a/scripts/lint-section-titles.ts +++ b/scripts/lint-section-titles.ts @@ -57,7 +57,7 @@ function extractTitles(text: string): { line: number; title: string }[] { } const files = (explicitFiles ?? getChangedFiles(base)).filter( - (f) => f.startsWith("docs/") && f.endsWith(".md") && f !== "docs/V2-REVISION-SPEC.md", + (f) => f.startsWith("docs/") && f.endsWith(".md") && f !== "docs/archive/V2-REVISION-SPEC.md", ); if (files.length === 0) { diff --git a/scripts/orphan-allowlist.txt b/scripts/orphan-allowlist.txt index f95dc85..88b0ff2 100644 --- a/scripts/orphan-allowlist.txt +++ b/scripts/orphan-allowlist.txt @@ -1,5 +1,5 @@ # scripts/orphan-allowlist.txt -# 一级源码目录在 V2-REVISION-SPEC.md §6.2 中未被任何 v2 章节覆盖,但属预期免覆盖。 +# 一级源码目录在 archive/V2-REVISION-SPEC.md §6.2 中未被任何 v2 章节覆盖,但属预期免覆盖。 # 每行一项;# 之后为注释。每条新增必须配 PR 描述里的理由。 # 进程内通用工具堆,跨章共用,不单独成章 diff --git a/scripts/revision-codename-allowlist.txt b/scripts/revision-codename-allowlist.txt index dbd89d6..a8616c6 100644 --- a/scripts/revision-codename-allowlist.txt +++ b/scripts/revision-codename-allowlist.txt @@ -9,12 +9,7 @@ # footnote, semver of upstream binary, chapter title that legitimately # contains "v2", etc.). -# 与上游 CLI 的 semver(v2.1.8)相关的源码注释复述,不是修订代号。 -# 行号是 docs/20-API调用与错误恢复.md 的硬引用,源码注释升级时同步调整。 -docs/20-API调用与错误恢复.md:619 - # CCR v2 是上游 CLI 的协议代号(见 cli/transports/ccrClient.ts:255 的源码注释 # 与 cli/transports/transportUtils.ts:12 / CLAUDE_CODE_USE_CCR_V2 env), -# 不是本书的修订代号。行号是 docs/20-API调用与错误恢复.md 的硬引用。 -docs/20-API调用与错误恢复.md:668 -docs/20-API调用与错误恢复.md:670 +# 不是本书的修订代号。用 regex 模式避免行号漂移。 +docs/23-客户端传输与API重试.md:regex:CCR\s*v2