Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

Merge PR #362 into dev with isolated atlas navigation and browser gate

tt-a1ib6f6d2356f5a
diff --cc CHANGELOG.md
index 30a3f04c,2d39c3ce..ca4635d0
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -4,21 -4,14 +4,26 @@@ All notable changes are documented here
## [Unreleased]
+ ### Improved reading
+
+ - Showcase sequence message names use larger primary type and matching label plates; real browser readability checks now include message labels.
+ - Optional `atlas` packages checked overview/detail HTML with explicit node links, keyboard navigation, preserved overview position, synchronized themes and artifact fingerprints. Browser and perceptual acceptance remain separate.
+
> Development identity: `v2.17.0-dev.1`. Not a stable release.
+### Added
+- **Hermes Agent community opt-in.** `integrations/hermes-agent` is a Skill-only directory plugin: it registers the existing Node Archify `SKILL.md` for Hermes. The documented install is `hermes skills install skills-sh/tt-a1i/archify/archify -y` (published GitHub Skill). A checkout symlink remains the local-dev path. Hermes still runs `node bin/archify.mjs`. This is not an official Nous product and is not an agent-switcher target.
+- **GitHub Copilot agent-switcher target.** The Start page agent switcher, README EN/ZH quick start, and landing copy add `github-copilot` alongside `cursor`, `codex`, `claude-code`, and `opencode`. It installs the same checked Skill and zero-dependency renderers via `npx skills add tt-a1i/archify --skill archify --agent github-copilot ...`; no vendor-specific fork, renderer, or schema behavior was added.
+
### Fixed
+- **Conservative VS15 text-width estimates.** Text-presentation selectors retain the base character's estimated width instead of forcing every sequence to one unit. This prevents wide labels, including CJK text whose font ignores VS15, from passing layout checks at half their estimated width. Actual glyph widths remain font-dependent; some text-presentation labels may now need more space. VS16 emoji estimates and text without selectors are unchanged.
+- **Readable renderer failures.** `render` and direct renderer entry points format classified input, schema, layout, and output failures without Node stacks. Filesystem failures identify the failing operation instead of labelling output errors as unreadable input; successful artifact bytes and existing validation/delivery receipt formats remain unchanged.
+- **Architecture Delta baseline arrowheads (#433).** Removed and rerouted baseline relationships retain their marker definitions in the composed Delta SVG, preserving their authored direction alongside current relationships.
+- **Compare rollback recovery (#438).** If restoring a previous output fails, compare preserves its recovery directory and reports backup-to-target paths instead of deleting the remaining backups during cleanup.
+- **固定提交的来源校验 (#420)。** 校验忽略本地 Git replacement refs,始终读取指定提交的原始对象,避免替换后的文件或行范围造成误接受或误拒绝;保留原有来源链接、诊断与用户 Git 配置。
+- **导出的独立 SVG 声明 UTF-8 编码。** 架构图「下载 SVG」和架构对比(compare)导出的 SVG 文档现在以 `<?xml version="1.0" encoding="UTF-8"?>` 声明开头;缺少声明时,部分消费方不按 XML 规范默认 UTF-8 而猜测编码,导致中文等非 ASCII 文本乱码。
+- **Architecture Delta provenance visibility.** Repository revision, provider, link-mode, and location-representation changes now produce a separate redacted provenance receipt and visible Delta notice instead of an empty authored-change claim. Provenance-only comparisons keep graph counts at zero, leave Review disabled, avoid false SVG change states, and carry the same truthful distinction into Share Cards.
+- **Compare 输入快照一致性 (#400)。** 原始输入校验使用首次读取的字节快照,使其与回执哈希和差异计算保持一致;读取后原文件发生变化不会影响本次比较,非法原始字段仍会被拒绝。
- **DSH plugin refresh.** Adapter 0.2.0 pins the current Archify development snapshot, includes the newer runtime and CLI fixes, and targets DSH 0.1.2-rc.1. Release metadata replaces the frozen 0.1.0 packaging source; the tarball uses the canonical clean-Skill stager and documents independent plugin upgrades.
- **Machine-readable CLI argument failures (#330).** `validate --json` and `deliver --json` now keep invalid or missing option values, unknown options and diagram types, unsupported option combinations, and usage errors inside one versioned failure receipt on stdout. These failures use the `arguments` stage, stable diagnostic codes, and exit status 2, while human-mode stderr behavior remains unchanged.
- **Complete artifact-check receipts (#311).** The checker now lets stdout drain before exiting, so large JSON receipts remain complete through pipes. Validation, delivery, and architecture comparison retain their original success/failure status without truncated-JSON errors.
diff --cc archify.zip
index 05b49c97,e7c24410..1f256e23
Binary files differ
diff --cc archify/assets/atlas.html
index 00000000,ea3798a2..dd9ef5d1
mode 000000,100644..100644
--- a/archify/assets/atlas.html
+++ b/archify/assets/atlas.html
@@@ -1,0 -1,306 +1,312 @@@
+ <!doctype html>
+ <html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Archify</title>
+ <style>
+ :root {
+ color-scheme: light;
+ --bg: #f8fafc;
+ --ink: #172438;
+ --line: #cbd5e1;
+ }
+ html[data-theme="dark"] {
+ color-scheme: dark;
+ --bg: #101827;
+ --ink: #e2e8f0;
+ --line: #475569;
+ }
+ * {
+ box-sizing: border-box;
+ }
+ body {
+ margin: 0;
+ background: var(--bg);
+ color: var(--ink);
+ font:
+ 14px "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
+ }
++ #diagrams {
++ position: absolute;
++ inset: 0 0 44px;
++ }
+ iframe {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ border: 0;
+ }
+ iframe[hidden] {
+ display: none;
+ }
+ nav {
+ position: fixed;
- bottom: 12px;
++ bottom: 4px;
+ left: 12px;
+ z-index: 2;
+ display: flex;
+ gap: 8px;
- padding: 6px;
++ padding: 4px;
+ background: var(--bg);
+ border: 1px solid var(--line);
+ border-radius: 8px;
+ max-width: calc(100% - 24px);
+ }
+ button {
+ font: inherit;
++ font-size: 13px;
+ cursor: pointer;
+ color: var(--ink);
+ background: var(--bg);
+ border: 1px solid var(--line);
+ border-radius: 5px;
- padding: 8px 12px;
++ padding: 6px 10px;
+ }
+ button:focus-visible {
+ outline: 3px solid #0891b2;
+ outline-offset: 2px;
+ }
+ button[hidden] {
+ display: none;
+ }
+ dialog {
+ color: var(--ink);
+ background: var(--bg);
+ border: 1px solid var(--line);
+ border-radius: 10px;
+ max-width: calc(100% - 32px);
+ }
+ dialog::backdrop {
+ background: #0007;
+ }
+ h2 {
+ font-size: 18px;
+ }
+ #choices {
+ display: grid;
+ gap: 8px;
+ margin-bottom: 16px;
+ }
+ #status {
+ position: fixed;
+ top: 12px;
+ left: 12px;
+ background: var(--bg);
+ padding: 8px;
+ }
+ #status:empty {
+ display: none;
+ }
+ @media print {
++ #diagrams { inset: 0; }
+ nav,
+ dialog,
+ #status {
+ display: none;
+ }
+ }
+ </style>
+ </head>
+ <body>
+ <main id="diagrams"></main>
+ <nav aria-label="Diagram navigation">
+ <button id="back" hidden></button><button id="theme"></button>
+ </nav>
+ <p id="status" role="status"></p>
+ <dialog id="details">
+ <h2 id="detail-title"></h2>
+ <div id="choices"></div>
+ <button id="close"></button>
+ </dialog>
+ <script id="atlas-data" type="application/json">
+ __ARCHIFY_ATLAS_DATA__
+ </script>
+ <script>
+ (() => {
+ "use strict";
+ const data = JSON.parse(
+ document.getElementById("atlas-data").textContent,
+ ),
+ frames = new Map();
+ const zh = data.locale === "zh-CN",
+ back = document.getElementById("back"),
+ themeButton = document.getElementById("theme"),
+ dialog = document.getElementById("details"),
+ status = document.getElementById("status");
+ document.documentElement.lang = zh ? "zh-CN" : "en";
+ document.title = data.title;
+ document
+ .querySelector("nav")
+ .setAttribute("aria-label", zh ? "图表导航" : "Diagram navigation");
+ back.textContent = zh ? "返回总览" : "Back to overview";
+ document.getElementById("close").textContent = zh ? "关闭" : "Close";
+ let current = data.overview,
+ opener = null;
+ let theme = matchMedia("(prefers-color-scheme: light)").matches
+ ? "light"
+ : "dark";
+ try {
+ const saved = localStorage.getItem("archify-theme");
+ if (["light", "dark"].includes(saved)) theme = saved;
+ } catch {}
+ function syncTheme(value) {
+ theme = value;
+ document.documentElement.dataset.theme = value;
+ themeButton.textContent =
+ value === "dark" ? (zh ? "浅色" : "Light") : zh ? "深色" : "Dark";
+ try {
+ localStorage.setItem("archify-theme", value);
+ } catch {}
+ for (const frame of frames.values()) {
+ const win = frame.contentWindow,
+ d = frame.contentDocument;
+ if (
+ win?.Archify?.theme &&
+ d.documentElement.dataset.theme !== value
+ )
+ win.Archify.theme.toggle();
+ }
+ }
+ // Chrome file:// srcdoc does not reliably paint CSS data-URI masks.
+ // Adapt viewer chrome only; the diagram SVG and canonical exports stay intact.
+ function paintIcons(frame) {
+ const d = frame.contentDocument;
+ for (const icon of d.querySelectorAll('span')) {
+ if (icon.dataset.atlasIcon) {
+ icon.style.removeProperty('mask-image');
+ icon.style.removeProperty('-webkit-mask-image');
+ icon.style.removeProperty('background');
+ }
+ const mask = frame.contentWindow.getComputedStyle(icon).maskImage;
+ const match = /^url\("data:image\/svg\+xml,([^"\n]+)"\)$/.exec(mask);
+ if (!match) continue;
+ const svg = new DOMParser().parseFromString(decodeURIComponent(match[1]), 'image/svg+xml').documentElement;
+ if (svg.localName !== 'svg') continue;
+ for (const element of [svg, ...svg.querySelectorAll('*')]) {
+ for (const attribute of ['fill', 'stroke']) {
+ if (element.getAttribute(attribute) === 'black') element.setAttribute(attribute, 'currentColor');
+ }
+ }
+ svg.setAttribute('width', '100%'); svg.setAttribute('height', '100%');
+ icon.dataset.atlasIcon = 'true';
+ icon.style.maskImage = 'none'; icon.style.webkitMaskImage = 'none';
+ icon.style.background = 'transparent';
+ icon.replaceChildren(d.importNode(svg, true));
+ }
+ }
+ function show(id) {
+ if (!data.diagrams.some((item) => item.id === id)) id = data.overview;
+ current = id;
+ for (const [key, frame] of frames) frame.hidden = key !== id;
+ if (!frames.has(id)) {
+ const item = data.diagrams.find((item) => item.id === id),
+ frame = document.createElement("iframe");
+ frame.title = item.title;
+ frame.dataset.diagramId = id;
+ frames.set(id, frame);
+ frame.addEventListener("load", () => {
+ const d = frame.contentDocument;
+ if (!frame.contentWindow.Archify?.theme) {
+ status.textContent = zh
+ ? "图表加载失败"
+ : "Diagram could not be loaded";
+ return;
+ }
+ syncTheme(theme);
+ paintIcons(frame);
+ const icons = new MutationObserver(() => paintIcons(frame));
+ for (const element of [d.documentElement, d.body]) icons.observe(element, {attributes:true, attributeFilter:['data-theme','data-preset','class']});
+ new MutationObserver(() => {
+ const value = d.documentElement.dataset.theme;
+ if (value !== theme && ["light", "dark"].includes(value))
+ syncTheme(value);
+ }).observe(d.documentElement, {
+ attributes: true,
+ attributeFilter: ["data-theme"],
+ });
+ if (id === data.overview)
+ for (const link of data.links) {
+ const node = [...d.querySelectorAll("[data-node-id]")].find(
+ (node) => node.dataset.nodeId === link.node,
+ );
+ if (!node) continue;
+ const hint = zh ? "查看细节" : "Open details";
+ node.setAttribute(
+ "aria-label",
+ (node.getAttribute("aria-label") || link.node) +
+ " — " +
+ hint,
+ );
+ node.setAttribute(
+ "aria-haspopup",
+ link.details.length > 1 ? "dialog" : "true",
+ );
+ function activate(event) {
+ if (
+ event.type === "keydown" &&
+ !["Enter", " "].includes(event.key)
+ )
+ return;
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ opener = node;
+ if (link.details.length === 1) {
+ location.hash = link.details[0];
+ return;
+ }
+ document.getElementById("detail-title").textContent =
+ node.dataset.nodeLabel || link.node;
+ const choices = document.getElementById("choices");
+ choices.replaceChildren();
+ for (const target of link.details) {
+ const button = document.createElement("button");
+ button.textContent = data.diagrams.find(
+ (item) => item.id === target,
+ ).title;
+ button.addEventListener("click", () => {
+ dialog.close();
+ location.hash = target;
+ });
+ choices.append(button);
+ }
+ dialog.showModal();
+ }
+ node.addEventListener("click", activate, true);
+ node.addEventListener("keydown", activate, true);
+ }
+ frame.dataset.ready = "true";
+ if (current === id) status.textContent = "";
+ });
+ frame.srcdoc = item.html;
+ document.getElementById("diagrams").append(frame);
+ }
+ back.hidden = id === data.overview;
+ status.textContent = frames.get(id).dataset.ready
+ ? ""
+ : zh
+ ? "正在载入…"
+ : "Loading…";
+ if (id === data.overview && opener)
+ requestAnimationFrame(() => opener.focus());
+ }
+ back.addEventListener("click", () => {
+ location.hash = data.overview;
+ });
+ themeButton.addEventListener("click", () =>
+ syncTheme(theme === "dark" ? "light" : "dark"),
+ );
+ document
+ .getElementById("close")
+ .addEventListener("click", () => dialog.close());
+ dialog.addEventListener("close", () => opener?.focus());
+ window.addEventListener("hashchange", () =>
+ show(location.hash.slice(1)),
+ );
+ syncTheme(theme);
+ show(location.hash.slice(1) || data.overview);
+ })();
+ </script>
+ </body>
+ </html>
diff --cc archify/bin/archify.mjs
index de3a1b16,b6b6ce7f..adfb3e8a
--- a/archify/bin/archify.mjs
+++ b/archify/bin/archify.mjs
@@@ -20,9 -20,10 +20,10 @@@ function usage()
archify preview <type> <input.json> [output.html] [--no-open] [--quality standard|showcase] [--repo-root path (architecture only)]
archify validate <type> <input.json> [--json] [--layout-json] [--quality standard|showcase] [--repo-root path (architecture only)]
archify migrate workflow <old.json> <new.json> --to-schema 2 [--json]
+ archify atlas <manifest.json> <output.html> [--json]
archify inspect <type> <input.json>
archify check <output.html>
- archify visual-check <output.html> [--json]
+ archify visual-check <output.html> [--json] [--out-dir <dir>]
archify guide [scenario or question] [--json] [--lang en|zh]
archify brands [name, alias, domain, or category] [--json]
archify brands capture <url> [--json]
diff --cc archify/test/atlas-browser.test.mjs
index 00000000,4f95ea01..b73fd31b
mode 000000,100644..100644
--- a/archify/test/atlas-browser.test.mjs
+++ b/archify/test/atlas-browser.test.mjs
@@@ -1,0 -1,238 +1,242 @@@
+ import { test } from "node:test";
+ import assert from "node:assert/strict";
+ import fs from "node:fs";
+ import os from "node:os";
+ import path from "node:path";
+ import { execFileSync } from "node:child_process";
+ import { pathToFileURL, fileURLToPath } from "node:url";
+ import {
+ ChromeVisualBrowser,
+ findChrome,
+ runVisualCheck,
+ } from "../bin/visual-check.mjs";
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
-const chrome = process.env.ARCHIFY_CHROME ? findChrome() : null;
++const chrome = Object.hasOwn(process.env, "ARCHIFY_CHROME") ? findChrome() : null;
+
+ test(
+ "offline layered reading preserves overview state, keyboard access and themes",
+ { skip: !chrome },
+ async (t) => {
+ const dir = fs.mkdtempSync(
+ path.join(os.tmpdir(), "archify-layered-browser-"),
+ );
+ t.after(() => fs.rmSync(dir, { recursive: true, force: true }));
+ const child = path.join(dir, "sequence.html");
+ execFileSync(process.execPath, [
+ path.join(root, "bin/archify.mjs"),
+ "deliver",
+ "sequence",
+ path.join(root, "examples/cache-miss-request.sequence.json"),
+ child,
+ ]);
+ const html = fs.readFileSync(child, "utf8"),
+ nodes = [...html.matchAll(/data-node-id="([^"]+)"/g)].map((m) => m[1]);
+ const manifest = {
+ schema_version: 1,
+ title: "Request details",
+ overview: "overview",
+ diagrams: ["overview", "detail", "alternative"].map((id) => ({
+ id,
+ title: id,
+ file: child,
+ })),
+ links: [
+ { node: nodes[0], details: ["detail"] },
+ { node: nodes[1], details: ["detail", "alternative"] },
+ ],
+ };
+ const input = path.join(dir, "atlas.json"),
+ output = path.join(dir, "atlas.html");
+ fs.writeFileSync(input, JSON.stringify(manifest));
+ execFileSync(process.execPath, [
+ path.join(root, "bin/archify.mjs"),
+ "atlas",
+ input,
+ output,
+ ]);
+ const browser = new ChromeVisualBrowser(chrome);
+ t.after(() => browser.close());
+ const session = await browser.sessionPromise,
+ send = (method, params = {}) => browser.cdp.send(method, params, session);
+ const evaluate = async (expression) => {
+ const r = await send("Runtime.evaluate", {
+ expression,
+ returnByValue: true,
+ awaitPromise: true,
+ });
+ if (r.exceptionDetails) throw Error(JSON.stringify(r.exceptionDetails));
+ return r.result.value;
+ };
+ const ready = () =>
+ evaluate(
+ `new Promise((resolve,reject)=>{let count=0;const timer=setInterval(()=>{const f=document.querySelector('iframe:not([hidden])');if(f?.dataset.ready==='true'){clearInterval(timer);resolve(true)}else if(++count>100){clearInterval(timer);reject(Error('frame timeout'))}},50)})`,
+ );
+ await send("Network.enable");
+ await send("Network.setBlockedURLs", { urls: ["http://*", "https://*"] });
+ await send("Emulation.setDeviceMetricsOverride", {
+ width: 1440,
+ height: 900,
+ deviceScaleFactor: 1,
+ mobile: false,
+ });
+ await send("Page.navigate", { url: pathToFileURL(output).href });
+ await ready();
+ const frame = `document.querySelector('iframe:not([hidden])')`;
+ await evaluate(`${frame}.contentWindow.Archify.view.zoomIn()`);
+ const before = await evaluate(
+ `${frame}.contentDocument.querySelector('.diagram-container svg').style.transform`,
+ );
+ await evaluate(
+ `${frame}.contentDocument.querySelector('[data-node-id="${nodes[0]}"]').focus()`,
+ );
+ await send("Input.dispatchKeyEvent", {
+ type: "keyDown",
+ key: "Enter",
+ code: "Enter",
+ windowsVirtualKeyCode: 13,
+ });
+ await send("Input.dispatchKeyEvent", {
+ type: "keyUp",
+ key: "Enter",
+ code: "Enter",
+ windowsVirtualKeyCode: 13,
+ });
+ await new Promise((r) => setTimeout(r, 100));
+ await ready();
+ assert.equal(await evaluate(`${frame}.dataset.diagramId`), "detail");
+ await evaluate(`document.getElementById('theme').click()`);
+ const theme = await evaluate(`document.documentElement.dataset.theme`);
+ assert.equal(
+ await evaluate(`${frame}.contentDocument.documentElement.dataset.theme`),
+ theme,
+ );
+ await evaluate(`document.getElementById('back').click()`);
+ await new Promise((r) => setTimeout(r, 100));
+ await ready();
+ assert.equal(await evaluate(`${frame}.dataset.diagramId`), "overview");
+ assert.equal(
+ await evaluate(
+ `${frame}.contentDocument.querySelector('.diagram-container svg').style.transform`,
+ ),
+ before,
+ );
+ assert.equal(
+ await evaluate(`${frame}.contentDocument.activeElement.dataset.nodeId`),
+ nodes[0],
+ );
+ await evaluate(
+ `${frame}.contentDocument.querySelector('[data-node-id="${nodes[1]}"]').dispatchEvent(new MouseEvent('click',{bubbles:true}))`,
+ );
+ assert.equal(
+ await evaluate(`document.getElementById('details').open`),
+ true,
+ );
+ assert.equal(
+ await evaluate(`document.getElementById('choices').children.length`),
+ 2,
+ );
+ await evaluate(
+ `document.getElementById('choices').lastElementChild.click()`,
+ );
+ await new Promise((r) => setTimeout(r, 100));
+ await ready();
+ assert.equal(await evaluate(`${frame}.dataset.diagramId`), "alternative");
+ await evaluate(`${frame}.contentWindow.Archify.theme.toggle()`);
+ await new Promise((r) => setTimeout(r, 100));
+ assert.notEqual(
+ await evaluate(`document.documentElement.dataset.theme`),
+ theme,
+ );
+ for (const [width, height] of [
+ [1440, 900],
+ [1600, 1000],
+ [1920, 1080],
+ [2048, 1320],
+ ]) {
+ await send("Emulation.setDeviceMetricsOverride", {
+ width,
+ height,
+ deviceScaleFactor: 1,
+ mobile: false,
+ });
+ await new Promise((r) => setTimeout(r, 350));
++ assert.equal(
++ await evaluate(`${frame}.getBoundingClientRect().bottom <= document.querySelector('nav').getBoundingClientRect().top`),
++ true,
++ "atlas navigation must not cover child reading content",
++ );
+ assert.equal(
+ await evaluate(
+ `document.documentElement.scrollWidth<=innerWidth&&document.documentElement.scrollHeight<=innerHeight`,
+ ),
+ true,
+ );
+ assert.equal(
+ await evaluate(
+ `(()=>{const w=${frame}.contentWindow,d=w.document.documentElement;return d.scrollWidth<=w.innerWidth&&d.scrollHeight<=w.innerHeight})()`,
+ ),
+ true,
++ JSON.stringify(await evaluate(`(()=>{const w=${frame}.contentWindow,d=w.document.documentElement;return {width:innerWidth,height:innerHeight,child:[w.innerWidth,w.innerHeight,d.scrollWidth,d.scrollHeight],overflow:d.dataset.readerOverflow}})()`)),
+ );
+ }
+ await evaluate(`${frame}.contentWindow.Archify.exportMenu.run('svg')`);
+ assert.equal(await evaluate(`${frame}.contentDocument.documentElement.getAttribute('data-last-export-canonical')`), 'true');
+ assert.equal(await evaluate(`${frame}.contentDocument.documentElement.getAttribute('data-last-export-format')`), 'svg');
+ assert.ok(await evaluate(`${frame}.contentDocument.querySelectorAll('span[data-atlas-icon] svg').length`) > 0);
+ if (process.env.ARCHIFY_READING_EVIDENCE) {
+ fs.mkdirSync(process.env.ARCHIFY_READING_EVIDENCE, { recursive: true });
+ for (const mode of ["light", "dark"]) {
+ await evaluate(
+ `if(document.documentElement.dataset.theme!=='${mode}')document.getElementById('theme').click()`,
+ );
+ await new Promise((r) => setTimeout(r, 150));
+ const shot = await send("Page.captureScreenshot", { format: "png" });
+ fs.writeFileSync(
+ path.join(
+ process.env.ARCHIFY_READING_EVIDENCE,
+ `layered-${mode}.png`,
+ ),
+ Buffer.from(shot.data, "base64"),
+ );
+ }
+ }
+ },
+ );
+
+ test(
+ "real visual-check catches unreadable sequence message text",
+ { skip: !chrome },
+ async (t) => {
+ const dir = fs.mkdtempSync(
+ path.join(os.tmpdir(), "archify-message-browser-"),
+ );
+ t.after(() => fs.rmSync(dir, { recursive: true, force: true }));
+ const child = path.join(dir, "sequence.html");
+ execFileSync(process.execPath, [
+ path.join(root, "bin/archify.mjs"),
+ "render",
+ "sequence",
+ path.join(root, "examples/cache-miss-request.sequence.json"),
+ child,
+ ]);
+ // Simulate a regression in an artifact, independently of renderer constants.
- fs.writeFileSync(
- child,
- fs
- .readFileSync(child, "utf8")
- .replace(
- /(<text[^>]*class="t-backend"[^>]*font-size=")11("[^>]*>)/g,
- "$13$2",
- ),
++ const original = fs.readFileSync(child, "utf8");
++ const unreadable = original.replace(
++ /(<text[^>]*class="t-backend"[^>]*font-size=")11("[^>]*>)/g,
++ "$13$2",
+ );
++ assert.notEqual(unreadable, original, "the negative fixture must shrink message text");
++ fs.writeFileSync(child, unreadable);
+ const result = await runVisualCheck({
+ artifactPath: child,
+ chromePath: chrome,
+ });
+ assert.equal(result.exitCode, 1);
+ assert.equal(result.receipt.readability.status, "fail");
+ assert.ok(
+ result.receipt.readability.viewports.some(
+ (v) => v.minimumProjectedNodeTextDetail === "message",
+ ),
+ );
+ },
+ );
diff --cc archify/test/sequence-column-fit.test.mjs
index bee4d9e1,29e300ce..7778e72b
--- a/archify/test/sequence-column-fit.test.mjs
+++ b/archify/test/sequence-column-fit.test.mjs
@@@ -135,3 -135,26 +135,32 @@@ test('the fast authoring path explains
assert.match(rendererReadme, /Use `"spread"` when a wide/);
assert.match(rendererReadme, /try `meta\.column_fit: "spread"` before shortening/);
});
+
+ test('message names use readable primary type with a plate wide enough for the same text', () => {
+ const doc = wideSequence('spread');
+ doc.meta.quality_profile = 'showcase';
+ const html = render(doc);
+ const match = html.match(/<rect x="[^"]+" y="[^"]+" width="([^"]+)" height="[^"]+" rx="3" class="c-mask"\/>\s*<text[^>]*font-size="([^"]+)"[^>]*>authorize<\/text>/);
+ assert.ok(match, 'message and its plate are present');
+ assert.ok(Number(match[2]) >= 11, 'primary message text should be at least 11 source px');
+ assert.ok(Number(match[1]) >= 9 * 6.4 + 12, 'plate must fit the larger monospace text');
+ });
+
+
+ test('standard retains acceptance for parallel schema-v1 labels with legacy spacing', () => {
+ const doc = {
+ schema_version: 1, diagram_type: 'sequence', meta: { title: 'Parallel requests' },
+ participants: ['a', 'b', 'c', 'd'].map(id => ({ id, type: 'backend', label: id })),
+ messages: [
+ { from: 'a', to: 'b', y: 200, label: '123456789012345678901234567890123' },
+ { from: 'c', to: 'd', y: 200, label: '123456789012345678901234567890123' },
+ ],
+ };
- assert.equal(renderOutcome(doc).code, 0);
++ const result = renderOutcome(doc);
++ assert.equal(result.code, 0);
++ const plate = result.html.match(/<rect x="[^"]+" y="[^"]+" width="([^"]+)" height="([^"]+)" rx="3" class="c-mask"\/>\s*<text[^>]*font-size="([^"]+)"[^>]*>123456789012345678901234567890123<\/text>/);
++ assert.ok(plate, 'legacy parallel message label is present');
++ assert.equal(Number(plate[1]), textUnits(doc.messages[0].label) * 5.2 + 12);
++ assert.equal(Number(plate[2]), 16);
++ assert.equal(Number(plate[3]), 9);
+ });
diff --cc docs/assets/archify-live-proof.gif
index 31e8c473,69aafcaa..72cbcac6
Binary files differ
diff --cc docs/assets/archify-live-proof.json
index 4a0068e8,79d0e817..d476a306
--- a/docs/assets/archify-live-proof.json
+++ b/docs/assets/archify-live-proof.json
@@@ -7,8 -7,8 +7,8 @@@
"fps": 10,
"frameCount": 54,
"durationSeconds": 5.4,
- "bytes": 1642392,
- "sha256": "cbf4f175504d74624737d7883ea942dbb425a16d37a10d7f92969215b1d696e7",
- "bytes": 1598800,
- "sha256": "829b208ed55b79b728f8a6449c00cddd6ea4c4f97ad701270aed861a23404969",
++ "bytes": 1668210,
++ "sha256": "6fa7924a9dd1b3d7a2d32ccb060544fbb61631370e3cb2ee0c8a5f1fc01a1cce",
"scenes": [
{
"id": "signal-flow",
@@@ -31,7 -31,7 +31,7 @@@
{
"id": "classic",
"artifact": "docs/gallery/artifacts/cache-miss.sequence.html",
- "artifactSha256": "8ae1bd7d8e44fde9ab6d6d94403a6c377645975e133006453432e2641d4f243c",
- "artifactSha256": "677c37de5ed31f73d6ae126a681bba22575ec0a8fe89434dbaed6bdcf6d226c8",
++ "artifactSha256": "ff09c5d5b7aad90651b27cc7e59d356ff3a3986b2c457224cc5848004f3298fa",
"view": "cache-fallback",
"eyebrow": "SEQUENCE · CLASSIC",
"title": "Cache Miss Request",
diff --cc docs/gallery.html
index 73f84e9f,747de820..a0bbe83a
--- a/docs/gallery.html
+++ b/docs/gallery.html
@@@ -357,7 -357,7 +357,7 @@@
<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">7N · 12E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="8ae1bd7d8e44fde9ab6d6d94403a6c377645975e133006453432e2641d4f243c">8ae1bd7d8e44</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="677c37de5ed31f73d6ae126a681bba22575ec0a8fe89434dbaed6bdcf6d226c8">677c37de5ed3</span></div>
++ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="ff09c5d5b7aad90651b27cc7e59d356ff3a3986b2c457224cc5848004f3298fa">ff09c5d5b7aa</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/cache-miss.sequence.html?present=1&amp;play=1#view=cache-fallback" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@@ -473,7 -473,7 +473,7 @@@
<div class="receipt-cell"><span class="receipt-label">Artifact</span><span class="receipt-value ok">9/9 pass</span></div>
<div class="receipt-cell"><span class="receipt-label">Composition</span><span class="receipt-value ok" title="0 crossings · 0 border runs · 0 micro segments · 0 cramped turns">SHOWCASE · PASS</span></div>
<div class="receipt-cell"><span class="receipt-label">Graph</span><span class="receipt-value">7N · 14E</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="f1b94e9f090eed5891600087e1985c0cd90fb0baf341912b1e50ee33b99a843f">f1b94e9f090e</span></div>
- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="9b9d0fab19a48ccb62467354f543e30a86b6e5dd205c453bcd20d813f08e09eb">9b9d0fab19a4</span></div>
++ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="16489c3e61f4733b398ffee6cc5b969f5fd82cb1462d0b007c441632b2497e07">16489c3e61f4</span></div>
</div>
<div class="card-actions">
<a class="card-link primary" href="gallery/artifacts/async-job-roundtrip.sequence.html?present=1&amp;play=1#view=work-and-retry" target="_blank" rel="noopener" data-en="Play named chapter ↗" data-zh="播放命名章节 ↗">Play named chapter ↗</a>
@@@ -877,8 -875,8 +877,8 @@@ receipt 99 checks / 11 artifacts / dete
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 12,
- "artifactBytes": 825115,
- "artifactSha256": "8ae1bd7d8e44fde9ab6d6d94403a6c377645975e133006453432e2641d4f243c",
- "artifactBytes": 814106,
- "artifactSha256": "677c37de5ed31f73d6ae126a681bba22575ec0a8fe89434dbaed6bdcf6d226c8",
++ "artifactBytes": 825119,
++ "artifactSha256": "ff09c5d5b7aad90651b27cc7e59d356ff3a3986b2c457224cc5848004f3298fa",
"sourceBytes": 4374,
"sourceSha256": "9a799a3661c16cd6ab4f6373ff6a04da95a9ab70d93b0a349b668466f4912fd7",
"checks": [
@@@ -1281,8 -1275,8 +1281,8 @@@
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 14,
- "artifactBytes": 824206,
- "artifactSha256": "f1b94e9f090eed5891600087e1985c0cd90fb0baf341912b1e50ee33b99a843f",
- "artifactBytes": 813224,
- "artifactSha256": "9b9d0fab19a48ccb62467354f543e30a86b6e5dd205c453bcd20d813f08e09eb",
++ "artifactBytes": 824237,
++ "artifactSha256": "16489c3e61f4733b398ffee6cc5b969f5fd82cb1462d0b007c441632b2497e07",
"sourceBytes": 4370,
"sourceSha256": "545f20920c89b69c2bb1f15508d5543fddbeb15cffba61e102206e04bd5a5cd9",
"checks": [
diff --cc docs/gallery/manifest.json
index 29829448,3a77766d..2dc04eae
--- a/docs/gallery/manifest.json
+++ b/docs/gallery/manifest.json
@@@ -229,8 -227,8 +229,8 @@@
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 12,
- "artifactBytes": 825115,
- "artifactSha256": "8ae1bd7d8e44fde9ab6d6d94403a6c377645975e133006453432e2641d4f243c",
- "artifactBytes": 814106,
- "artifactSha256": "677c37de5ed31f73d6ae126a681bba22575ec0a8fe89434dbaed6bdcf6d226c8",
++ "artifactBytes": 825119,
++ "artifactSha256": "ff09c5d5b7aad90651b27cc7e59d356ff3a3986b2c457224cc5848004f3298fa",
"sourceBytes": 4374,
"sourceSha256": "9a799a3661c16cd6ab4f6373ff6a04da95a9ab70d93b0a349b668466f4912fd7",
"checks": [
@@@ -633,8 -627,8 +633,8 @@@
"engineeringProfile": null,
"nodeCount": 7,
"edgeCount": 14,
- "artifactBytes": 824206,
- "artifactSha256": "f1b94e9f090eed5891600087e1985c0cd90fb0baf341912b1e50ee33b99a843f",
- "artifactBytes": 813224,
- "artifactSha256": "9b9d0fab19a48ccb62467354f543e30a86b6e5dd205c453bcd20d813f08e09eb",
++ "artifactBytes": 824237,
++ "artifactSha256": "16489c3e61f4733b398ffee6cc5b969f5fd82cb1462d0b007c441632b2497e07",
"sourceBytes": 4370,
"sourceSha256": "545f20920c89b69c2bb1f15508d5543fddbeb15cffba61e102206e04bd5a5cd9",
"checks": [
diff --cc scripts/run-browser-tests.mjs
index 59579e2c,00000000..0b0a88a2
mode 100644,000000..100644
--- a/scripts/run-browser-tests.mjs
+++ b/scripts/run-browser-tests.mjs
@@@ -1,51 -1,0 +1,52 @@@
+#!/usr/bin/env node
+
+import { spawnSync } from 'node:child_process';
+import path from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { findChrome } from '../archify/bin/visual-check.mjs';
+
+const skillRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'archify');
+// Shared by PR CI and tag releases. WebM decoding stays in test:webm.
+const testFiles = [
+ 'desktop-reader-browser.test.mjs',
++ 'atlas-browser.test.mjs',
+ 'reader-layout-browser.test.mjs',
+ 'sequence-header-clearance.test.mjs',
+ 'lifecycle-rail-browser.test.mjs',
+ 'export-cleanup-browser.test.mjs',
+ 'offline-font-browser.test.mjs',
+ 'i18n.test.mjs',
+ 'semantic-radar.test.mjs',
+ 'viewer-chrome-layout.test.mjs',
+ 'viewer-camera-browser.test.mjs',
+ 'motion-governor-browser.test.mjs',
+ 'finder-browser.test.mjs',
+ 'intent-trace-browser.test.mjs',
+ 'semantic-lens-browser.test.mjs',
+ 'route-probe-browser.test.mjs',
+ 'guided-views-browser.test.mjs',
+ 'focus-browser.test.mjs',
+ 'semantic-passport-move-browser.test.mjs',
+ 'export-browser.test.mjs',
+ 'viewer-identifiers-browser.test.mjs',
+ 'repository-evidence.test.mjs',
+];
+
+const chrome = findChrome();
+if (!chrome) {
+ console.error('Browser tests require an executable Chrome/Chromium. Set ARCHIFY_CHROME to its path; this gate cannot skip browser coverage.');
+ process.exit(1);
+}
+
+const args = ['--test'];
+const [major, minor] = process.versions.node.split('.').map(Number);
+if (major > 18 || (major === 18 && minor >= 19)) args.push('--test-concurrency=2');
+args.push(...testFiles.map((file) => path.join('test', file)));
+const result = spawnSync(process.execPath, args, {
+ cwd: skillRoot,
+ env: { ...process.env, ARCHIFY_CHROME: chrome },
+ stdio: 'inherit',
+});
+if (result.error) throw result.error;
+if (result.signal) console.error(`browser test runner terminated by ${result.signal}`);
+process.exitCode = result.status ?? 1;