import { test } from 'node:test'; import assert from 'node:assert/strict'; import { execFileSync } from 'node:child_process'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import vm from 'node:vm'; import { fileURLToPath } from 'node:url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const skillRoot = path.resolve(__dirname, '..'); const repoRoot = path.resolve(skillRoot, '..'); test('start page: checked-in HTML is reproducible from canonical scenario recipes', () => { const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-start-page-')); const generated = path.join(tmp, 'start.html'); try { execFileSync(process.execPath, [path.join(repoRoot, 'scripts/build-start.mjs'), generated]); assert.equal( fs.readFileSync(generated, 'utf8'), fs.readFileSync(path.join(repoRoot, 'docs/start.html'), 'utf8'), ); } finally { fs.rmSync(tmp, { recursive: true, force: true }); } }); test('start page: offers five bounded bilingual starts without ingesting source content', () => { const html = fs.readFileSync(path.join(repoRoot, 'docs/start.html'), 'utf8'); assert.doesNotMatch(html, /\[\[[A-Z0-9_]+\]\]/); assert.match(html, /npx -y skills add tt-a1i\/archify --skill archify --agent codex --global --copy --yes/); assert.match(html, /npx -y skills add tt-a1i\/archify --skill archify --agent codex --copy --yes/); for (const agent of ['cursor', 'codex', 'claude-code', 'opencode']) { assert.match(html, new RegExp(`role="tab" data-agent="${agent}"`)); } assert.match(html, /data-en="One install\."/); assert.match(html, /data-en="One bounded prompt\."/); assert.match(html, /data-zh="一次安装,"/); assert.match(html, /data-zh="一段有边界的提示词。"/); assert.match(html, /No repository content or diagram data is sent to this page\./); assert.match(html, /这个页面不会接收仓库内容或图表数据/); assert.match(html, /id="copy-starter"/); assert.match(html, /data-en="Copy install \+ prompt"/); assert.match(html, /data-zh="复制安装命令 \+ 提示词"/); const dataMatch = html.match(/