Files
Codeman/test/wiki-home-index.test.ts
T
Codeman maintainer 9d38cbf51a fix(build,docs): dependency preflight before the build wipes dist, docs drift for 1.40.0
- scripts/build.mjs resolves exceljs/dist/exceljs.min.js and fflate first,
  before tsc and before rm -rf dist/web/public. A tree whose node_modules
  predate those devDependencies (pulled but never ran npm install) used to
  fail in prepare-spreadsheet-assets.mjs with the live dist assets already
  deleted, so the running server served an index.html whose hashed files
  were gone. It now exits 1 with "run `npm install` first", nothing touched.
  test/spreadsheet-assets.test.ts pins the order, that the list covers every
  require.resolve in the prepare script, and runs a relocated copy of the
  build to prove the exit and message.
- CLAUDE.md: the header visibility rule's stock desktop default now lists
  Tiles (1180px and wider), which ships ON on desktop.
- docs/wiki/Agent-CLIs.md: "Before 1.36.0" becomes "Before 1.40.0" (four
  places); 1.36.0 never ships.
- docs/wiki/Home.md: the "Everything in the manual" index lists Tile Grid
  and Custom Model Endpoints, matching the sidebar. test/wiki-home-index
  fails when a sidebar page is missing from that index.
- docs/wiki/Tile-Grid.md: the Tiles default is off on tablets too since the
  touch-primary default landed, not only on phones.
- docs/browser-testing-guide.md: the fixed port table and new WebServer(PORT)
  snippet give way to the port-0 pattern (new WebServer(0, false, true),
  server.boundPort) that test/test-ports-guard.test.ts enforces; the
  examples that opened localhost:3000, the live instance, use BASE_URL.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-09 09:47:22 +02:00

38 lines
1.6 KiB
TypeScript

/**
* @fileoverview Static guard: the wiki Home page's "Everything in the manual" index
* links every page the sidebar lists.
*
* docs/wiki/ is mirrored to the GitHub wiki, where _Sidebar.md shows on every page and
* Home.md calls itself the whole manual. A new page added to the sidebar alone (Tile
* Grid, Custom Model Endpoints) silently dropped out of that index. Compared by link
* target, since the two files label some pages differently.
*
* Port: N/A (pure static analysis).
*/
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
const wiki = resolve(import.meta.dirname, '..', 'docs', 'wiki');
const read = (name: string) => readFileSync(resolve(wiki, name), 'utf8');
/** Internal wiki page targets of `[label](Target)` links, external URLs excluded. */
const pageTargets = (markdown: string): Set<string> =>
new Set(
[...markdown.matchAll(/\]\(([^)\s#]+)(?:#[^)]*)?\)/g)]
.map((m) => m[1])
.filter((target) => !/^[a-z]+:/i.test(target) && target !== 'Home')
);
describe('wiki Home index', () => {
it('links every page the sidebar lists', () => {
const sidebar = pageTargets(read('_Sidebar.md'));
expect(sidebar.size).toBeGreaterThan(20);
const index = read('Home.md').split('## Everything in the manual')[1] ?? '';
expect(index, 'Home.md has an "Everything in the manual" section').not.toBe('');
const indexed = pageTargets(index);
const missing = [...sidebar].filter((target) => !indexed.has(target));
expect(missing, 'add these to the "Everything in the manual" tables in docs/wiki/Home.md').toEqual([]);
});
});