HK-hub/AgentSkills / archify
archify
FlaggedCreate polished, validated architecture, workflow, sequence, data-flow, and lifecycle/state diagrams as explorable standalone HTML with inline SVG, dark/light themes, semantic navigation, optional trace motion, an optional 1200×630 Share Card PNG, 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, approval or CI/CD flows, API call sequences, request lifecycles, data pipelines, ETL/ELT, data lineage, state machines, or to convert/beautify Mermaid. Prefer typed JSON IR renderers and deterministic validation; deliver static output by default, enable motion only when requested, and use optional post-commit opening only for an interactive local handoff.
test/preset-tryon.test.mjs
View on GitHubimport { 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 { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const skillRoot = path.resolve(__dirname, '..');
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-preset-tryon-'));
const CASES = {
architecture: 'web-app.architecture.json',
workflow: 'agent-tool-call.workflow.json',
sequence: 'cache-miss-request.sequence.json',
dataflow: 'product-analytics.dataflow.json',
lifecycle: 'agent-run.lifecycle.json',
};
function render(mode, preset = 'classic') {
const source = JSON.parse(fs.readFileSync(path.join(skillRoot, 'examples', CASES[mode]), 'utf8'));
source.meta.visual_preset = preset;
source.meta.animation = 'none';
const input = path.join(tmp, `${mode}-${preset}.json`);
const output = path.join(tmp, `${mode}-${preset}.html`);
fs.writeFileSync(input, JSON.stringify(source));
execFileSync(process.execPath, [path.join(skillRoot, `renderers/${mode}/render-${mode}.mjs`), input, output]);
return fs.readFileSync(output, 'utf8');
}
function svgBlock(html) {
return html.match(/<svg\b[\s\S]*?<\/svg>/)?.[0] || '';
}
function presetRuntime(html) {
return html.match(/Archify\.preset = \(function \(\) \{[\s\S]*?\n \}\)\(\);/)?.[0] || '';
}
test('all five renderers expose one reader-controlled visual style picker', () => {
for (const mode of Object.keys(CASES)) {
const html = render(mode);
assert.match(html, /id="btn-preset"[^>]+aria-haspopup="menu"[^>]+aria-controls="preset-menu"/, mode);
assert.match(html, /id="preset-label"/, mode);
assert.match(html, /title="Choose visual style \(S cycles\)"/, mode);
assert.match(html, /id="preset-menu" role="menu" aria-label="Visual style"/, mode);
for (const preset of ['classic', 'signal-flow', 'blueprint', 'editorial']) {
assert.match(html, new RegExp(`data-preset-value="${preset}"[^>]+role="menuitemradio"`), `${mode}: ${preset}`);
}
assert.match(html, /Archify\.preset = \(function \(\)/, mode);
assert.match(html, /S -> cycle visual style/, mode);
}
});
test('style selection synchronizes page, picker, and canonical SVG without touching geometry', () => {
const html = render('architecture');
const runtime = presetRuntime(html);
assert.match(runtime, /\['classic', 'signal-flow', 'blueprint', 'editorial'\]/);
assert.match(runtime, /html\.setAttribute\('data-preset', preset\)/);
assert.match(runtime, /svg\.setAttribute\('data-preset', preset\)/);
assert.match(runtime, /data-preset-option/);
assert.match(runtime, /option\.setAttribute\('aria-checked', String\(selected\)\)/);
assert.match(runtime, /return \{ cycle: cycle, apply: apply, current: current, authored: authored, open: open, close: close, isOpen: isOpen \}/);
});
test('style picker follows the accessible menu-button interaction contract', () => {
const html = render('architecture');
const runtime = presetRuntime(html);
assert.match(runtime, /function open\(focusLast\)/);
assert.match(runtime, /function close\(focusTrigger\)/);
assert.match(runtime, /e\.key === 'ArrowDown' \|\| e\.key === 'ArrowUp'/);
assert.match(runtime, /e\.key === 'Escape'/);
assert.match(runtime, /e\.key === 'Tab'/);
assert.match(runtime, /case 'Home':/);
assert.match(runtime, /case 'End':/);
assert.match(runtime, /document\.addEventListener\('click'/);
assert.match(html, /\.preset-option-swatch\.editorial/);
assert.match(
html,
/@media \(max-width: 720px\)[\s\S]*?\.toolbar \{[\s\S]*?position: relative;/,
'the mobile toolbar must preserve its stacking context so the fixed preset menu stays above guided views',
);
});
test('style try-on is session-only and unavailable to passive embeds', () => {
const html = render('workflow', 'signal-flow');
const runtime = presetRuntime(html);
assert.match(runtime, /html\.getAttribute\('data-embed'\) === 'true'/);
assert.doesNotMatch(runtime, /localStorage|sessionStorage|history\.|location\.|URLSearchParams/);
assert.match(html, /html\[data-embed="true"\] \.toolbar/);
assert.match(html, /@media print/);
});
test('same topology keeps identical canonical SVG geometry across all four styles', () => {
const normalize = (svg) => svg.replace(/ data-preset="(?:classic|signal-flow|blueprint|editorial)"/, '');
const variants = ['classic', 'signal-flow', 'blueprint', 'editorial'].map((preset) => normalize(svgBlock(render('architecture', preset))));
assert.equal(variants[1], variants[0]);
assert.equal(variants[2], variants[0]);
assert.equal(variants[3], variants[0]);
});
process.on('exit', () => fs.rmSync(tmp, { recursive: true, force: true }));
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |