Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion scripts/check-code-ratio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-heading-preservation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function loadAllowlist(): Map<string, Set<string>> {
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) {
Expand Down
6 changes: 3 additions & 3 deletions scripts/check-no-frontmatter-in-chapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 的识别口径一致;不试图区分
Expand All @@ -36,7 +36,7 @@ import { join } from "node:path";
const DOCS_DIR = "docs";

// 例外白名单:spec 元文档允许 frontmatter;章节正文不允许。
const ALLOWLIST = new Set<string>(["docs/V2-REVISION-SPEC.md"]);
const ALLOWLIST = new Set<string>(["docs/archive/V2-REVISION-SPEC.md"]);

function listChapterFiles(): string[] {
const out: string[] = [];
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint-no-fuzzy-quantifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function scanFile(file: string, lineFilter: Set<number> | 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) {
Expand Down
6 changes: 3 additions & 3 deletions scripts/lint-no-revision-codenames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 当作书内身份称呼的写法。
*
* 默认禁词正则(大小写不敏感):
Expand All @@ -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 内整体豁免;
Expand All @@ -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 };

Expand Down
2 changes: 1 addition & 1 deletion scripts/lint-no-spec-jargon-in-prose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function scanFile(file: string, lineFilter: Set<number> | 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) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint-section-titles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/orphan-allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# scripts/orphan-allowlist.txt
# 一级源码目录在 V2-REVISION-SPEC.md §6.2 中未被任何 v2 章节覆盖,但属预期免覆盖。
# 一级源码目录在 archive/V2-REVISION-SPEC.md §6.2 中未被任何 v2 章节覆盖,但属预期免覆盖。
# 每行一项;# 之后为注释。每条新增必须配 PR 描述里的理由。

# 进程内通用工具堆,跨章共用,不单独成章
Expand Down
9 changes: 2 additions & 7 deletions scripts/revision-codename-allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading