정리 3·4단계 PR #14와 CI 재편 PR #16(main 38c0dc7d)을 받는다. 충돌은 아홉
파일이다. 이 브랜치가 한국어로 다시 쓴 문서에 두 PR이 영어 판에서 바꾼
것을 한국어로 넣었다.
- a11y 기록 경로 `artifacts/tests/a11y-manual/` → `docs/accessibility/route-reviews/`:
README, docs/README.md, manual-checklist, starter-experience,
ci-quality-gates. 문서 검사의 `NOT_DOCUMENT`도 새 경로로 바꿨다(정해진 영어
키 형식의 게이트 입력이라 문서로 보지 않는다)
- ci-quality-gates.md: merge 단계 job 셋, 지운 CI 계약 기준선, main 단계
FE-GATE-029의 `check:ci:gating`
- adapter 재검토 원장: 합친 음성 fixture script
- README 프로젝트 구조: `schemas/`는 `config/schemas/`로, `artifacts/`는
`.gitkeep`만 추적, 최상위 항목 등록부 `config/repository-layout.json`
- verify-documentation-readiness.ts: #14의 배치 규칙 검사(R6·R7)와 이 브랜치의
문서 체계 검사를 둘 다 둔다. R7의 「현재 문서」는 #14의 폴더 목록(옛
`docs/superpowers/` 포함) 대신 문서 검사의 `checkedForDrift`로 고른다
- deletable-history-documents 시험: #14의 등록부 기반 경로와 이 브랜치의
검사기 예외를 같이 둔다
- CHANGELOG: 범위 문장과 표 행을 둘 다 둔다
- 루트 등록부에서 SPEC.md 항목을 뺀다(그 항목이 「문서 체계 작업이 이력 폴더로
옮기고 이 항목을 뺀다」고 적었다)
- #14가 옛 `docs/testing/frontend-platform-testing-strategy.md`를 고친 것이
이름 바뀜을 따라 기록(docs/design/…)에 들어와서, 기록은 옮길 때의 글로 되돌렸다
103 lines
4.0 KiB
TypeScript
103 lines
4.0 KiB
TypeScript
import { readdir, readFile, stat } from "node:fs/promises";
|
|
import path from "node:path";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { selectRepositoryPaths } from "../../scripts/lib/repository-layout.ts";
|
|
|
|
/**
|
|
* README.md, 「복사한 뒤 지워도 되는 것」, tells a new project that
|
|
* the build and the gates read none of the history documents except
|
|
* `docs/reviews/adapters/INVENTORY.md`. The removal fixtures rely on the same
|
|
* promise: they do not copy `docs/`. A test that opens a review document broke
|
|
* all three removal checks (fix of 11-04), so the promise is checked here.
|
|
* The root instruction files left the list on 2026-11-07: they are the
|
|
* template's contract, which a copy keeps (template-contract-documents.test.ts).
|
|
*/
|
|
// The history-free set of config/repository-layout.json (R2). The registry
|
|
// itself names every root item, history documents included (R1); naming a
|
|
// root item is not reading it.
|
|
const CODE_PATHS = selectRepositoryPaths("history-free");
|
|
const LAYOUT_REGISTRY = "config/repository-layout.json";
|
|
|
|
// Built from pieces so that this file does not match itself.
|
|
const REVIEWS = ["docs", "reviews", ""].join("/");
|
|
const KEPT = `${REVIEWS}adapters/INVENTORY.md`;
|
|
// The 2026-09-25 round's task folder moved into the history folder on
|
|
// 2026-11-07 (docs/README.md §3), so the history pattern covers it. A pattern
|
|
// for the old root folder would now only catch a product's own route or
|
|
// folder of that name.
|
|
const DELETABLE = [
|
|
new RegExp(`${REVIEWS}(?!adapters/INVENTORY\\.md)`, "u"),
|
|
new RegExp(["docs", "superpowers"].join("/"), "u"),
|
|
new RegExp(["docs", "history"].join("/"), "u"),
|
|
new RegExp(`\\b${"SPEC"}\\.md\\b`, "u"),
|
|
];
|
|
/**
|
|
* 1101/14-01. A section number without a document name cannot be followed,
|
|
* and the scale design it meant used to live only in the history bundle a
|
|
* copy deletes. Cite it as `scale-architecture.md §N`
|
|
* (docs/architecture/scale-architecture.md, a current contract).
|
|
*/
|
|
const UNNAMED_SECTION = new RegExp(`\\b${"spec"} ?§`, "iu");
|
|
|
|
async function codeFiles(directory: string): Promise<string[]> {
|
|
const entries = await readdir(directory, { withFileTypes: true }).catch(
|
|
() => [],
|
|
);
|
|
const files = await Promise.all(
|
|
entries.map(async (entry) => {
|
|
const target = path.join(directory, entry.name);
|
|
if (entry.isDirectory())
|
|
return entry.name === "node_modules" ? [] : codeFiles(target);
|
|
return /\.(?:[cm]?[jt]sx?|json|ya?ml)$/u.test(entry.name) ? [target] : [];
|
|
}),
|
|
);
|
|
return files.flat();
|
|
}
|
|
|
|
/**
|
|
* The document checker (docs/README.md 「5. 문서 검사」) names the record
|
|
* folders to read the head block of whatever records are there and nothing
|
|
* else of them. A copy that deleted them passes it ("passes a copy that
|
|
* deleted its history" in its test), so it is not a reader this promise is
|
|
* about.
|
|
*/
|
|
const RECORD_FOLDER_CHECKERS: ReadonlySet<string> = new Set([
|
|
"scripts/lib/docs-system.ts",
|
|
"tests/unit/docs-system.test.ts",
|
|
]);
|
|
|
|
async function linesMatching(patterns: readonly RegExp[]): Promise<string[]> {
|
|
const files = (
|
|
await Promise.all(
|
|
CODE_PATHS.map(async (entry) =>
|
|
(await stat(entry).catch(() => null))?.isDirectory() ? codeFiles(entry) : [entry],
|
|
),
|
|
)
|
|
).flat().filter((file) => !RECORD_FOLDER_CHECKERS.has(file));
|
|
const matches: string[] = [];
|
|
for (const file of files) {
|
|
if (file === LAYOUT_REGISTRY) continue;
|
|
const lines = (await readFile(file, "utf8").catch(() => "")).split("\n");
|
|
lines.forEach((line, index) => {
|
|
if (patterns.some((pattern) => pattern.test(line)))
|
|
matches.push(`${file}:${index + 1}`);
|
|
});
|
|
}
|
|
return matches;
|
|
}
|
|
|
|
describe("deletable history documents", () => {
|
|
it("are read by no code, test, script or configuration", async () => {
|
|
expect(await linesMatching(DELETABLE), `only ${KEPT} may be read`).toEqual([]);
|
|
});
|
|
|
|
it("are not cited as an unnamed design section", async () => {
|
|
expect(
|
|
await linesMatching([UNNAMED_SECTION]),
|
|
"name the document: scale-architecture.md §N",
|
|
).toEqual([]);
|
|
});
|
|
});
|