import assert from 'node:assert/strict'; import { execFileSync, spawnSync } from 'node:child_process'; import fs from 'node:fs'; import os from 'node:os'; import path from 'node:path'; import test from 'node:test'; import { fileURLToPath } from 'node:url'; import { startPreview } from '../bin/preview.mjs'; const here = path.dirname(fileURLToPath(import.meta.url)); const skillRoot = path.resolve(here, '..'); const cli = path.join(skillRoot, 'bin', 'archify.mjs'); // One table for the whole file: every diagram type names its node array // differently, and repository evidence must behave identically across all of // them. `first` is the first authored node id, which is where the fixtures // attach sources and where the verified payload must key them. const TYPES = [ { type: 'architecture', collection: 'components', example: 'web-app.architecture.json', first: 'users' }, { type: 'workflow', collection: 'nodes', example: 'agent-tool-call.workflow.json', first: 'user' }, { type: 'sequence', collection: 'participants', example: 'cache-miss-request.sequence.json', first: 'user' }, { type: 'dataflow', collection: 'nodes', example: 'product-analytics.dataflow.json', first: 'web' }, { type: 'lifecycle', collection: 'states', example: 'agent-run.lifecycle.json', first: 'queued' }, ]; function git(repo, ...args) { return execFileSync('git', ['-C', repo, ...args], { encoding: 'utf8' }).trim(); } function run(args) { return spawnSync(process.execPath, [cli, ...args], { cwd: skillRoot, encoding: 'utf8' }); } function evidencePayload(html) { const match = html.match(/