fix(docs): 문서 경로 검사가 줄임표 「…」를 자리표시자로 본다
문제: 하네스 PR #13이 더한 scripts/hooks/README.md는 `node scripts/…`처럼 줄임표 「…」(U+2026)로 「아무 스크립트」를 적는다. 참조 검사가 살아 있는 문서 전부로 넓어지자 verify:documentation이 `scripts/…`를 없는 경로로 잡아 실패한다. 경로 검사는 `...`만 자리표시자로 알고 「…」는 몰랐다. 같은 repo의 문서 검사(scripts/lib/docs-system.ts의 PLACEHOLDER)는 이미 「…」를 자리표시자로 본다. 고른 방법: verify-documentation-readiness.ts의 경로 후보 거르기에 「…」를 더해 두 검사를 맞춘다. 버린 안: 하네스 문서의 표기를 바꾸는 것(같은 표기를 다른 문서도 쓸 수 있고, 검사 둘이 다르게 판정하는 것이 원인이다). 위험: 「…」가 든 진짜 경로는 검사에서 빠진다. 파일 이름에 「…」를 쓰는 일은 없다고 본다. 검증: documentation-readiness 시험의 자리표시자 사례에 `node scripts/…`를 더했다. 고치기 전 코드에서는 그 사례가 실패하고 고친 뒤 통과한다(desktop).
This commit is contained in:
@@ -283,7 +283,8 @@ function pairedReferenceExists(reference: string): boolean | null {
|
||||
// (`../<name>/…`).
|
||||
function namedPath(token: string, document: string): string | null {
|
||||
const candidate = token.replace(/#.*$/u, "").replace(/:\d[\d,:-]*$/u, "");
|
||||
if (!candidate.includes("/") || candidate.startsWith("/") || /[\s*<>{}$()|]|\.\.\./u.test(candidate)) return null;
|
||||
// An ellipsis, `...` or `…`, stands for any name, as in scripts/lib/docs-system.ts.
|
||||
if (!candidate.includes("/") || candidate.startsWith("/") || /[\s*<>{}$()|…]|\.\.\./u.test(candidate)) return null;
|
||||
const first = candidate.split("/")[0] ?? "";
|
||||
if (topLevelEntries.has(first)) return candidate;
|
||||
if (pairedPins.has(first)) return `../${candidate}`;
|
||||
|
||||
@@ -238,7 +238,8 @@ describe("verify:documentation commands and sibling links (1103/12-05)", () => {
|
||||
it("looks up a command's existing arguments and leaves placeholders alone", async () => {
|
||||
const result = await verify({
|
||||
[CI_DOC]: (text) => `${text}\n\`corepack pnpm exec vitest run tests/unit/documentation-readiness.test.ts -t "x"\`\n` +
|
||||
"```bash\ncorepack pnpm drill:runbook -- FE-RB-005 --release-root <release dir>\n```\n",
|
||||
"```bash\ncorepack pnpm drill:runbook -- FE-RB-005 --release-root <release dir>\n```\n" +
|
||||
"Any script is run as `node scripts/…`.\n",
|
||||
});
|
||||
expect(result.status, result.stderr).toBe(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user