算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
archify【设计与创意】Create polished, validated architecture, workflow, sequence, data-flow, and lifecycle/state diagrams as explorable standalone HTML with inline SVG, dark/light themes, 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 …
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
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.
本技能不内置运行时源码,首次使用前需从上游拉取 CLI 与渲染器:
./install.sh
./install.sh --force 强制重装,./install.sh --check 仅检查。https://github.com/tt-a1i/archify 的 v2.16.0 tag 浅克隆,只拷贝运行时必需内容(排除 test/),装到本目录 _runtime/(git 忽略)。_runtime/bin/archify.mjs。下文所有 node bin/archify.mjs 请对应替换为 node _runtime/bin/archify.mjs(或先 cd _runtime)。验证安装:
./install.sh --check && node _runtime/bin/archify.mjs doctor
Use this bounded path for ordinary generation. Do not read the optional Viewer Runtime reference unless the user asks about those features.
Choose architecture, workflow, sequence, dataflow, or lifecycle from the question.
Read one matching schema in _runtime/schemas/, _runtime/schemas/common.schema.json, and one matching JSON example in _runtime/examples/. Read only those files. Fresh authorship means new stable IDs, domain wording, and layout; use the example for field shape, not facts. New workflow sources use schema_version: 2 and its readable layout contract; keep schema_version: 1 only when preserving an existing workflow's fixed geometry. Only read *.json examples — never open *.html files under examples/ (they are rendered demo artifacts, not authoring references).
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.
Validate after every candidate edit and immediately before handoff:
node _runtime/bin/archify.mjs validate <type> <candidate.json> --quality showcase --json
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 _runtime/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.
For a delivered HTML, deliver is the final acceptance command:
node _runtime/bin/archify.mjs deliver <type> <candidate.json> <output.html> --quality showcase --json
A non-zero exit can never be described as success. A failed delivery preserves any previous output, so do not run visual-check on that path: it would inspect the stale last-good artifact, not the failed candidate. If validation fails, change only the diagnosed subject, verify evidence, choose from supportedFixes, and rerun. Continue focused correction while the objective error count reaches a new minimum. If two consecutive rounds do not improve that best count, stop and report the unresolved diagnostics truthfully.
Do not read _runtime/renderers/shared/geometry.mjs, renderer source, validator source, tests, or benchmarks before the first candidate. Inspect implementation only for an unsupported internal diagnostic or after two focused repairs fail.
Workflow note: use schema v2 for new workflows; preserve schema v1 when an
existing source needs fixed legacy geometry. Keep semantic edge labels and act
on the compiler diagnostic. The canonical layout, pin, migration, and receipt
contract is in _runtime/renderers/workflow/README.md.
Lifecycle note: phase columns 0..4 occupy the main rail; event/terminal column N in 0..2 aligns exactly beneath main column N + 2. A recoverable state uses type: "failure" plus a real transition back to the active state.
| Type | Use for |
|---|---|
architecture | Components, services, cloud/security boundaries, infrastructure |
workflow | Processes, approval gates, tool calls, runbooks, CI/CD |
sequence | API call chains, request lifecycles, async traces, returns |
dataflow | Pipelines, ETL/ELT, lineage, governance, consumers |
lifecycle | State/status transitions, retries, waiting and terminal states |
When ambiguous, run node _runtime/bin/archify.mjs guide "<scenario>" --json. Scenario proof examples are structural references, not facts to copy.
Read Mermaid for topology and meaning, then author fresh Archify JSON; do not mechanically render Mermaid styling.
flowchart / graph → workflow, or architecture for a component map.sequenceDiagram → sequence; participants become semantic participants and arrows become messages.stateDiagram → lifecycle; states and transitions retain meaning, not Mermaid style.meta.visual_preset by default so every diagram opens in classic, regardless of whether its resolved color mode is light or dark. Color mode and visual preset are independent: switching Light / Dark must preserve the current preset. Set signal-flow, blueprint, or editorial only when the user explicitly requests that visual style.meta.subtitle by default. Never invent a subtitle that restates the title, nodes, or cards; include one short supporting line only when the user explicitly asks for it.meta.viewBox. Before handoff, open the real HTML at 1440×900, 1600×1000, and 1920×1080; additionally check 2048×1320 whenever the composition is intended for a large desktop display. Require document.documentElement.scrollWidth <= window.innerWidth and scrollHeight <= window.innerHeight at every checked size, while visually checking that the diagram remains comfortably readable and vertically balanced at the largest checked viewport. Repair overflow by removing only genuinely redundant content or compacting spacing before shrinking nodes, labels, or the main panel. Never counterfeit a pass with overflow: hidden, clipped content, an internal diagram scroller, stretched SVG height, or smaller typography. Narrow/mobile layouts may scroll vertically when containment requires it.meta.legend for the truthful auto default. When needed, use only mode: auto|all|hidden and renderer-supported entries.<kind>.label|visible; labels never change semantics.meta.locale controls only renderer-owned Viewer UI: use "en" or "zh-CN" for the corresponding supported primary language. For every other language, omit meta.locale and explicitly disclose that the fixed Viewer UI and <html lang> fall back to English. The renderer never translates authored content. See _runtime/references/authoring-contract.md for details.brand when the node names that real product. If no preset matches and the user supplied the official HTTP(S) URL, first run node _runtime/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.meta.column_fit for the stable fixed layout. Set it to "spread" when a wide viewBox would otherwise leave unused horizontal space or when meaningful participant labels do not fit the fixed boxes; do not shorten semantic labels before trying spread.frontend, backend, database, cloud, security, messagebus, and external; variants are default, emphasis, security, and dashed.meta.engineering_profile by default. Region, cluster, and security boundary wording do not by themselves enable it. Enable deployment-ownership only when the user explicitly asks for a production deployment topology, ownership handoff, or fail-closed deployment review and the source facts are known. Once enabled, must not remove the engineering profile merely to pass validation; repair the facts or report the diagnostics truthfully.via, channelX, channelY, labelAt, or non-auto routes. Near parallel ports use an outside bridge so automatic routing cannot create a sub-8px segment or sub-16px interior turn. Architecture separately keeps unobstructed facing automatic ports (left/right or top/bottom) on one shared axis when their offset is under 16px and both ports retain corner clearance. If exactly one endpoint was spread, only the unshared endpoint may move onto that axis; if both endpoints were spread, keep the outside bridge so competing ports remain distinct.Read _runtime/references/authoring-contract.md only when you need field enums, spacing math, geometry repair rules, repository evidence, or mode-specific placement.
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.
After delivery, collect bounded desktop evidence without modifying or rerendering the trusted HTML:
node _runtime/bin/archify.mjs visual-check <output.html> --json
visual-check measures containment at 1440×900, 1600×1000, 1920×1080, and 2048×1320; captures light/dark screenshots at the smallest and largest sizes; and writes a relative-path contact sheet plus JSON sidecars beside the artifact. Its automated receipt always reports visualReview: "pending": screenshots are evidence for inspection, never an automatic polish claim. Exit 0 means containment and captures passed, 1 means overflow or capture failure, and 2 means Chrome/Chromium was unavailable and the receipt is skipped. The command never changes the delivered HTML.
Add --open only when the user wants an immediate local preview. For an active desktop authoring loop, the optional command is:
node _runtime/bin/archify.mjs preview <type> <input>.json <output>.html --quality showcase
Never start preview by default. Read _runtime/references/delivery-contract.md when using preview, repository evidence, export receipts, visual review, or post-commit opening.
Generated HTML already contains theme switching, pan/zoom, search, focus, relationship tracing, semantic views, presentation, and truthful exports. These are reader capabilities, not extra authoring work. meta.animation: "trace" is opt-in; meta.views is optional and should contain at most five curated chapters.
Read _runtime/references/viewer-runtime.md only when the user explicitly asks for Share Cards, Route/Reach cards, motion, guided stories, deep links, presentation, search/focus, or another Viewer Runtime feature.
Return the checked HTML path, diagram type, validation summary, specification/artifact receipt, and truthful visual-review status. Do not claim success for a non-zero command or claim visual inspection you did not perform.