archify
description: Create polished, validated architecture, workflow, sequence, data-flow, and lifecycle/state diagrams as explorable standalone HTML with inline SVG, dark/light themes, optional trace motion, and PNG/JPEG/WebP/SVG/WebM export. Accept plain-language requirements or pasted Mermaid flowchart, sequenceDiagram, and stateDiagram input; inspect repository evidence when the diagram must reflect real code. Use when the user asks to visualize system architecture, infrastructure, cloud/security/network topology, technical workflows, API call sequences, request lifecycles, data pipelines, ETL/ELT, data lineage, state machines, or to convert/beautify Mermaid.
1How It Works & Mechanism
The toolchain is essentially a 'JSON-IR → standalone HTML' compiler: authors only need to write a compact, strongly-typed JSON spec, and the Node CLI renders it into a single-file HTML with inline SVG, free of runtime backend dependencies.
Create a self-contained, interactive HTML diagram from a small typed JSON specification. Static output is the default; enable motion only when the user asks for a demo or presentation.
Enforces a 'bounded authoring path': standard generation is strictly limited to reading 1 type schema + common schema + 1 example, prohibiting premature reading of renderer, validator, or test source code—swapping reading budget for tokens and stability.
Use this bounded path for ordinary generation. Do not read the optional Viewer Runtime reference unless the user asks about those features.
'Artifact-first' discipline: the next tool action must be outputting a candidate JSON, strictly forbidding precise coordinate planning in prose; initial constraints start with a single primary path + sparse labels + at most 12 primary nodes.
3. Artifact first: the next tool action must write the candidate. Write the candidate before inspecting renderer internals. Do not plan exact coordinates in prose. Start with one clear main path, short side branches, sparse labels, and at most 12 primary nodes. Set `meta.quality_profile` to `"showcase"` unless the user explicitly requests a dense `standard` map. Start with automatic routes and labels. Do not add `via`, `channelX`, `channelY`, or `labelAt` before a diagnostic calls for one; apply at most one diagnosed geometry control per repair.
Verification relies on machine receipts rather than model self-reports: a validate receipt with only 4 checks indicates basic pass, whereas showcase requires all 9 artifact checks to pass with 0 composition errors and 0 warnings.
A receipt with only 4 artifact checks is basic validation, never showcase acceptance. A showcase pass must report all 9 artifact checks with 0 composition errors and 0 warnings. If the candidate omits or misspells the exact `meta.quality_profile` field, fix it before geometry. For a workflow v2 geometry diagnosis, run `node bin/archify.mjs validate workflow <candidate.json> --layout-json` and use the stable compiler receipt; solver internals are not authoring controls. A passing final validation freezes the candidate: never edit it afterward.
Delivery is deterministic: deliver freezes the specification bytes into a private snapshot in the same directory, renders and validates this snapshot, then atomically commits the HTML, outputting SHA-256 and byte counts for both the spec and the artifact.
Use `validate` during repair and `deliver` once for final acceptance. Delivery freezes the exact specification bytes into a private same-directory snapshot, renders and checks that snapshot, atomically commits the HTML, and reports SHA-256 plus byte counts for both specification and artifact. This is deterministic artifact evidence; it does not exercise the Viewer in a browser.
Update awareness is implemented via a runnable local script that performs read-only checks and never downloads or installs anything: check-update.mjs fetches the official manifest, presents a notification, and acknowledges it via eventKey receipt.
After the first candidate exists, run the packaged checker `scripts/check-update.mjs` once with Node and continue the requested workflow. If the command cannot run, continue without mentioning the check.
The manifest URL is hardcoded: fetchCandidate first asserts that the URL matches the DEFAULT_MANIFEST_URL constant, then performs a GET with redirect:'error', a timeout, and bounded JSON parsing; non-200 responses or non-application/json types fail unconditionally.
export const DEFAULT_MANIFEST_URL = 'https://tt-a1i.github.io/archify/skill-updates/archify/stable.json';
Brand icons use 'digest pinning' rather than guesswork: the built-in Simple Icons catalog supports offline lookups; fetching only occurs when the user provides an official HTTP(S) URL, pinning the fetched graphic as a sha256 into the node, while rendering and validation never perform unpinned fetches.
- Brand identity is optional and explicit. Put a canonical built-in ID in `brand` when the node names that real product. If no preset matches and the user supplied the official HTTP(S) URL, first run `node bin/archify.mjs brands capture "<url>" --json`, then author the returned digest-pinned `brand` object. Render and validate never perform an unpinned capture. Otherwise omit `brand`. Never infer a brand from a vague role such as "database", and never let a badge replace the semantic `type`, label, or relationship facts.
Browser evidence is collected via local Chrome/Chromium headless CDP (--remote-debugging-pipe) without introducing Playwright/Puppeteer dependencies; if no browser is found, it explicitly skips instead of faking a pass.
export function findChrome({ env = process.env, platform = process.platform } = {}) { if (Object.prototype.hasOwnProperty.call(env, 'ARCHIFY_CHROME')) { return executable(env.ARCHIFY_CHROME, platform); }
Uses git forensics when 'diagrams must reflect real code': repository-evidence.mjs inspects remote/revision via `git -C <repo>` and validates repo-relative POSIX paths, forbidding absolute paths and control characters.
function runGit(repoRoot, args) { const result = spawnSync('git', ['-C', repoRoot, ...args], { encoding: 'utf8', maxBuffer: 16 * 1024 * 1024, });
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| network | Archify 官方更新 manifest(唯一固定外发端点) |
| network | 用户提供的官方品牌页/图标 URL(仅在显式 brands capture 或节点钉住品牌时抓取;私网地址被拒绝) |
| cli | Node.js >= 18(技能包内无需 npm install,doctor 可直接自检) |
| cli | git(仅在使用 repository evidence 时调用 `git -C <repo>` 取 remote/revision) |
| cli | 本机 Google Chrome / Chromium(visual-check 的无头 CDP 浏览器;缺失则跳过并解释) |
| package | devDependencies(仅仓库开发/测试用,技能包运行时不依赖):ajv 8.17.1 / parse5 7.3.0 / saxes 6.0.0 / simple-icons 16.28.0 |
| network | 本地预览 HTTP 服务(仅绑定 127.0.0.1,URL 必须是 loopback 根路径) |
4Recommended Governance & Evidence
- scripts/: Executes local scripts or commands: node bin/archify.mjs <validate|deliver|preview|compare|migrate|inspect|chec
- 网络端点: Declares external network access: GET https://tt-a1i.github.io/archify/skill-updates/archify/stable.json —— f
- 本地工作目录: File I/O and artifact output: Delivered artifacts and sidecars: <output.html> and co-located receipt/contact-sheet/screenshots (deliver
5Second-Pass Verification
- [ok] SKILL.md 声明的 9 项 showcase 检查真实存在 — 实跑 validate architecture examples/web-app.architecture.json --quality showcase --json:ok:true,checks 恰 9 项且全 ok:true,composition.errors=0 / warnings=0,与 SKILL.md 第 28 行「must report all 9 artifact checks with 0 composition errors and 0 warnings」逐字对应。
- [ok] 更新检查只读、不下载不安装 — check-update.mjs 只有 fetch GET(candidate manifest)、有界读取与本地状态文件写入,无下载/解包/执行路径;SKILL.md 第 44 行明文承诺 'never downloads, installs, or executes an update';fetchCandidate 首行即断言 manifestUrl === DEFAULT_MANIFEST_URL。
- [ok] 固定外发端点只有一个 — http(s) 字面量扫描后,可执行代码里的外发目标仅 DEFAULT_MANIFEST_URL(scripts/update-contract.mjs:3 = https://tt-a1i.github.io/archify/skill-updates/archify/stable.json);其余 http 命中为 docs/许可声明/品牌 source 元数据/data-URI、以及 preview 的 127.0.0.1。
- [ok] 品牌抓取的 SSRF 防护成立 — validateUrlShape 拒绝非 HTTP(S)、带凭证 URL、非标准端口、localhost/.local;resolveRequestTarget 对解析出的每个地址做 isPrivateBrandAddress 检查;requestPinned 在 transport.request 的 lookup 中直接返回已校验地址,注释明说是为 'closes the DNS-rebinding gap';ARCHIFY_BRAND_ALLOW_PRIVATE=1 才放开(默认关)。
- [ok] 无凭证/密钥读取 — 对 bin/ renderers/ scripts/ delta/ 的 api_key|secret|password|token|keychain|.netrc|.ssh|bearer|authorization 扫描:命中仅为 URL 凭证字段的反向拒绝(brand-marks.mjs:126、repository-location.mjs:24-25、open-artifact.mjs:82)与 SVG tokenizer 变量名;process.env 命中全部为行为开关(ARCHIFY_*、LOCALAPPDATA、XDG_CACHE_HOME、PROGRAMFILES)。
- [ok] visual-check 的浏览器依赖与降级行为 — findChrome 支持 ARCHIFY_CHROME 覆盖 + 三平台固定路径 + linux 命令探测;不可用时 receipt.status='skipped'、exit code 2(EXIT.skipped)、诊断 viewer/chrome-unavailable,绝不谎报通过。本环境未装 Chrome,故本报告未做浏览器证据冒烟(已如实标注)。
- [ok] repository evidence 的 git 调用与路径校验 — runGit 用 spawnSync('git', ['-C', repoRoot, ...])(maxBuffer 16MiB);verifiedSourcePath 拒绝绝对路径、反斜杠、控制字符,只接受 repo-relative POSIX 路径。
- [ok] 预览服务器只在 loopback — bin/preview.mjs:13 `const loopbackHost = '127.0.0.1'`,server.listen(0, loopbackHost);bin/open-artifact.mjs 拒绝非 http/非 127.0.0.1/带端口之外形状的 URL。
6Verdict & Scenarios
6a2bea3e072ab6aa…