Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.
HTML agent-skillsai-agentsarchitecture-diagramclaude-codeclaude-skillscodexcoding-agentsdeepseek-harnessdeveloper-toolsdiagramsdiagrams-as-codedsh-pluginflowchartllmmermaidopencodesequence-diagramsoftware-architecturesystem-designvisualization
fix: align eligible lifecycle port groups atomically
杨嘉伟b28df4c374ea
diff --git a/archify/examples/lifecycle-agent-run.html b/archify/examples/lifecycle-agent-run.htmlindex 6cb3511c..a52457cb 100644--- a/archify/examples/lifecycle-agent-run.html+++ b/archify/examples/lifecycle-agent-run.html@@ -5038,12 +5038,12 @@ OTHER DEALINGS IN THE FONT SOFTWARE.<path data-edge-from="failed" data-edge-to="executing" data-edge-label="retry" data-edge-key="8" data-edge-id="failed-executing" data-composition-points="683,202;683,126;615,126;615,92" data-composition-crossover="halo" data-composition-independent="true" d="M 683 202 L 683 138 Q 683 126 671 126 L 627 126 Q 615 126 615 114 L 615 92" class="a-dashed" data-animate="edge" style="--step:8" stroke-width="1.2" marker-end="url(#arrowhead-dashed)"/></g><g data-graph-role="automatic-crossover" style="--step:9">- <path data-graph-role="automatic-crossover-underlay" d="M 801 92 L 801 132 Q 801 144 813 144 L 829 144 Q 841 144 841 156 L 841 202" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>- <path data-edge-from="reviewing" data-edge-to="blocked" data-edge-label="needs input" data-edge-key="9" data-edge-id="reviewing-blocked" data-composition-points="801,92;801,144;841,144;841,202" data-composition-crossover="halo" data-composition-independent="true" d="M 801 92 L 801 132 Q 801 144 813 144 L 829 144 Q 841 144 841 156 L 841 202" class="a-default" data-animate="edge" style="--step:9" stroke-width="1.2" marker-end="url(#arrowhead)"/>+ <path data-graph-role="automatic-crossover-underlay" d="M 801 92 L 801 202" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>+ <path data-edge-from="reviewing" data-edge-to="blocked" data-edge-label="needs input" data-edge-key="9" data-edge-id="reviewing-blocked" data-composition-points="801,92;801,202" data-composition-crossover="halo" data-composition-independent="true" d="M 801 92 L 801 202" class="a-default" data-animate="edge" style="--step:9" stroke-width="1.2" marker-end="url(#arrowhead)"/></g><g data-graph-role="automatic-crossover" style="--step:10">- <path data-graph-role="automatic-crossover-underlay" d="M 867 202 L 867 138 Q 867 126 855 126 L 839 126 Q 827 126 827 114 L 827 92" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>- <path data-edge-from="blocked" data-edge-to="reviewing" data-edge-label="input given" data-edge-key="10" data-edge-id="blocked-reviewing" data-composition-points="867,202;867,126;827,126;827,92" data-composition-crossover="halo" data-composition-independent="true" d="M 867 202 L 867 138 Q 867 126 855 126 L 839 126 Q 827 126 827 114 L 827 92" class="a-default" data-animate="edge" style="--step:10" stroke-width="1.2" marker-end="url(#arrowhead)"/>+ <path data-graph-role="automatic-crossover-underlay" d="M 827 202 L 827 92" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>+ <path data-edge-from="blocked" data-edge-to="reviewing" data-edge-label="input given" data-edge-key="10" data-edge-id="blocked-reviewing" data-composition-points="827,202;827,92" data-composition-crossover="halo" data-composition-independent="true" d="M 827 202 L 827 92" class="a-default" data-animate="edge" style="--step:10" stroke-width="1.2" marker-end="url(#arrowhead)"/></g><g data-graph-role="automatic-crossover" style="--step:11"><path data-graph-role="automatic-crossover-underlay" d="M 854 266 L 854 358" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>@@ -5217,12 +5217,12 @@ OTHER DEALINGS IN THE FONT SOFTWARE.<text x="710" y="167.5" class="t-edge-dashed" font-size="10" text-anchor="middle">retry</text></g><g data-detail="context" data-edge-from="reviewing" data-edge-to="blocked" data-edge-label="needs input" data-edge-key="9" data-edge-id="reviewing-blocked">- <rect x="757" y="165" width="78" height="16" rx="4" class="c-mask"/>- <text x="796" y="176.5" class="t-edge-default" font-size="10" text-anchor="middle">needs input</text>+ <rect x="717" y="129" width="78" height="16" rx="4" class="c-mask"/>+ <text x="756" y="140.5" class="t-edge-default" font-size="10" text-anchor="middle">needs input</text></g><g data-detail="context" data-edge-from="blocked" data-edge-to="reviewing" data-edge-label="input given" data-edge-key="10" data-edge-id="blocked-reviewing">- <rect x="873" y="156" width="78" height="16" rx="4" class="c-mask"/>- <text x="912" y="167.5" class="t-edge-default" font-size="10" text-anchor="middle">input given</text>+ <rect x="833" y="139" width="78" height="16" rx="4" class="c-mask"/>+ <text x="872" y="150.5" class="t-edge-default" font-size="10" text-anchor="middle">input given</text></g><g data-detail="context" data-edge-from="blocked" data-edge-to="expired" data-edge-label="no reply 24h" data-edge-key="11" data-edge-id="blocked-expired"><rect x="764" y="304" width="84" height="16" rx="4" class="c-mask"/>diff --git a/archify/renderers/lifecycle/render-lifecycle.mjs b/archify/renderers/lifecycle/render-lifecycle.mjsindex 85ca8246..f84e923f 100644--- a/archify/renderers/lifecycle/render-lifecycle.mjs+++ b/archify/renderers/lifecycle/render-lifecycle.mjs@@ -666,6 +666,17 @@ function snapPorts(ports, mode) {if (!slot.endsWith('|top')) continue;const lowerId = slot.split('|')[0];if (onSpine(lowerId)) continue;+ // Validate the final group, since neighboring ports may move together.+ const group = [...entries.values()].sort((a, b) => a.x - b.x);+ const state = states.get(lowerId);+ const targets = group.map((port) => port.key?.kind === 'single'+ ? ports.get(`${port.key.upperId}|bottom`)?.get(port.key)?.x : undefined);+ if (targets.every((x, index) => Number.isFinite(x)+ && x >= state.x + PORT_PAD - 8 && x <= state.x + state.width - PORT_PAD + 8+ && (index === 0 || x - targets[index - 1] >= 12))) {+ group.forEach((port, index) => { port.x = targets[index]; });+ continue;+ }for (const port of entries.values()) {const connector = port.key;if (connector?.kind === 'single') {diff --git a/docs/assets/archify-lifecycle.png b/docs/assets/archify-lifecycle.pngindex 0f562112..450e4a5e 100644Binary files a/docs/assets/archify-lifecycle.png and b/docs/assets/archify-lifecycle.png differdiff --git a/docs/gallery.html b/docs/gallery.htmlindex 149ef7b4..f902632b 100644--- a/docs/gallery.html+++ b/docs/gallery.html@@ -535,7 +535,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">10N · 12E</span></div>- <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="7963901ba300e8c7dec6376fd02a456ea8260cb98240620b38b55dc78e3bcd7d">7963901ba300</span></div>+ <div class="receipt-cell"><span class="receipt-label">SHA-256</span><span class="receipt-value" title="b7b085551c6d8434b17e5e450ccb9a77e54fdb481d3dada41566b50de950dc79">b7b085551c6d</span></div></div><div class="card-actions"><a class="card-link primary" href="gallery/artifacts/agent-run.lifecycle.html#focus=approval" target="_blank" rel="noopener" data-en="Explore focus ↗" data-zh="探索聚焦路径 ↗">Explore focus ↗</a>@@ -1868,8 +1868,8 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>"engineeringProfile": null,"nodeCount": 10,"edgeCount": 12,- "artifactBytes": 784490,- "artifactSha256": "7963901ba300e8c7dec6376fd02a456ea8260cb98240620b38b55dc78e3bcd7d",+ "artifactBytes": 784234,+ "artifactSha256": "b7b085551c6d8434b17e5e450ccb9a77e54fdb481d3dada41566b50de950dc79","sourceBytes": 3260,"sourceSha256": "5ba36f5ce91ed428cb48b599e275424916d82b619b9a3231cbd1bbc3966fc54b","checks": [@@ -1935,7 +1935,7 @@ receipt 108 checks / 12 artifacts / deterministic hashes</pre>"maxStretch": 1,"routesOverSuggestedStretch": 0,"minSegmentPx": 34,- "minInteriorSegmentPx": 40,+ "minInteriorSegmentPx": 64,"shortSegmentCount": 0,"shortEndpointSegmentCount": 0,"shortInteriorSegmentCount": 0,diff --git a/docs/gallery/artifacts/agent-run.lifecycle.html b/docs/gallery/artifacts/agent-run.lifecycle.htmlindex 6cb3511c..a52457cb 100644--- a/docs/gallery/artifacts/agent-run.lifecycle.html+++ b/docs/gallery/artifacts/agent-run.lifecycle.html@@ -5038,12 +5038,12 @@ OTHER DEALINGS IN THE FONT SOFTWARE.<path data-edge-from="failed" data-edge-to="executing" data-edge-label="retry" data-edge-key="8" data-edge-id="failed-executing" data-composition-points="683,202;683,126;615,126;615,92" data-composition-crossover="halo" data-composition-independent="true" d="M 683 202 L 683 138 Q 683 126 671 126 L 627 126 Q 615 126 615 114 L 615 92" class="a-dashed" data-animate="edge" style="--step:8" stroke-width="1.2" marker-end="url(#arrowhead-dashed)"/></g><g data-graph-role="automatic-crossover" style="--step:9">- <path data-graph-role="automatic-crossover-underlay" d="M 801 92 L 801 132 Q 801 144 813 144 L 829 144 Q 841 144 841 156 L 841 202" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>- <path data-edge-from="reviewing" data-edge-to="blocked" data-edge-label="needs input" data-edge-key="9" data-edge-id="reviewing-blocked" data-composition-points="801,92;801,144;841,144;841,202" data-composition-crossover="halo" data-composition-independent="true" d="M 801 92 L 801 132 Q 801 144 813 144 L 829 144 Q 841 144 841 156 L 841 202" class="a-default" data-animate="edge" style="--step:9" stroke-width="1.2" marker-end="url(#arrowhead)"/>+ <path data-graph-role="automatic-crossover-underlay" d="M 801 92 L 801 202" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>+ <path data-edge-from="reviewing" data-edge-to="blocked" data-edge-label="needs input" data-edge-key="9" data-edge-id="reviewing-blocked" data-composition-points="801,92;801,202" data-composition-crossover="halo" data-composition-independent="true" d="M 801 92 L 801 202" class="a-default" data-animate="edge" style="--step:9" stroke-width="1.2" marker-end="url(#arrowhead)"/></g><g data-graph-role="automatic-crossover" style="--step:10">- <path data-graph-role="automatic-crossover-underlay" d="M 867 202 L 867 138 Q 867 126 855 126 L 839 126 Q 827 126 827 114 L 827 92" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>- <path data-edge-from="blocked" data-edge-to="reviewing" data-edge-label="input given" data-edge-key="10" data-edge-id="blocked-reviewing" data-composition-points="867,202;867,126;827,126;827,92" data-composition-crossover="halo" data-composition-independent="true" d="M 867 202 L 867 138 Q 867 126 855 126 L 839 126 Q 827 126 827 114 L 827 92" class="a-default" data-animate="edge" style="--step:10" stroke-width="1.2" marker-end="url(#arrowhead)"/>+ <path data-graph-role="automatic-crossover-underlay" d="M 827 202 L 827 92" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>+ <path data-edge-from="blocked" data-edge-to="reviewing" data-edge-label="input given" data-edge-key="10" data-edge-id="blocked-reviewing" data-composition-points="827,202;827,92" data-composition-crossover="halo" data-composition-independent="true" d="M 827 202 L 827 92" class="a-default" data-animate="edge" style="--step:10" stroke-width="1.2" marker-end="url(#arrowhead)"/></g><g data-graph-role="automatic-crossover" style="--step:11"><path data-graph-role="automatic-crossover-underlay" d="M 854 266 L 854 358" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>@@ -5217,12 +5217,12 @@ OTHER DEALINGS IN THE FONT SOFTWARE.<text x="710" y="167.5" class="t-edge-dashed" font-size="10" text-anchor="middle">retry</text></g><g data-detail="context" data-edge-from="reviewing" data-edge-to="blocked" data-edge-label="needs input" data-edge-key="9" data-edge-id="reviewing-blocked">- <rect x="757" y="165" width="78" height="16" rx="4" class="c-mask"/>- <text x="796" y="176.5" class="t-edge-default" font-size="10" text-anchor="middle">needs input</text>+ <rect x="717" y="129" width="78" height="16" rx="4" class="c-mask"/>+ <text x="756" y="140.5" class="t-edge-default" font-size="10" text-anchor="middle">needs input</text></g><g data-detail="context" data-edge-from="blocked" data-edge-to="reviewing" data-edge-label="input given" data-edge-key="10" data-edge-id="blocked-reviewing">- <rect x="873" y="156" width="78" height="16" rx="4" class="c-mask"/>- <text x="912" y="167.5" class="t-edge-default" font-size="10" text-anchor="middle">input given</text>+ <rect x="833" y="139" width="78" height="16" rx="4" class="c-mask"/>+ <text x="872" y="150.5" class="t-edge-default" font-size="10" text-anchor="middle">input given</text></g><g data-detail="context" data-edge-from="blocked" data-edge-to="expired" data-edge-label="no reply 24h" data-edge-key="11" data-edge-id="blocked-expired"><rect x="764" y="304" width="84" height="16" rx="4" class="c-mask"/>diff --git a/docs/gallery/manifest.json b/docs/gallery/manifest.jsonindex 5593718b..54a017d9 100644--- a/docs/gallery/manifest.json+++ b/docs/gallery/manifest.json@@ -1186,8 +1186,8 @@"engineeringProfile": null,"nodeCount": 10,"edgeCount": 12,- "artifactBytes": 784490,- "artifactSha256": "7963901ba300e8c7dec6376fd02a456ea8260cb98240620b38b55dc78e3bcd7d",+ "artifactBytes": 784234,+ "artifactSha256": "b7b085551c6d8434b17e5e450ccb9a77e54fdb481d3dada41566b50de950dc79","sourceBytes": 3260,"sourceSha256": "5ba36f5ce91ed428cb48b599e275424916d82b619b9a3231cbd1bbc3966fc54b","checks": [@@ -1253,7 +1253,7 @@"maxStretch": 1,"routesOverSuggestedStretch": 0,"minSegmentPx": 34,- "minInteriorSegmentPx": 40,+ "minInteriorSegmentPx": 64,"shortSegmentCount": 0,"shortEndpointSegmentCount": 0,"shortInteriorSegmentCount": 0,diff --git a/examples/lifecycle-agent-run.html b/examples/lifecycle-agent-run.htmlindex 6cb3511c..a52457cb 100644--- a/examples/lifecycle-agent-run.html+++ b/examples/lifecycle-agent-run.html@@ -5038,12 +5038,12 @@ OTHER DEALINGS IN THE FONT SOFTWARE.<path data-edge-from="failed" data-edge-to="executing" data-edge-label="retry" data-edge-key="8" data-edge-id="failed-executing" data-composition-points="683,202;683,126;615,126;615,92" data-composition-crossover="halo" data-composition-independent="true" d="M 683 202 L 683 138 Q 683 126 671 126 L 627 126 Q 615 126 615 114 L 615 92" class="a-dashed" data-animate="edge" style="--step:8" stroke-width="1.2" marker-end="url(#arrowhead-dashed)"/></g><g data-graph-role="automatic-crossover" style="--step:9">- <path data-graph-role="automatic-crossover-underlay" d="M 801 92 L 801 132 Q 801 144 813 144 L 829 144 Q 841 144 841 156 L 841 202" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>- <path data-edge-from="reviewing" data-edge-to="blocked" data-edge-label="needs input" data-edge-key="9" data-edge-id="reviewing-blocked" data-composition-points="801,92;801,144;841,144;841,202" data-composition-crossover="halo" data-composition-independent="true" d="M 801 92 L 801 132 Q 801 144 813 144 L 829 144 Q 841 144 841 156 L 841 202" class="a-default" data-animate="edge" style="--step:9" stroke-width="1.2" marker-end="url(#arrowhead)"/>+ <path data-graph-role="automatic-crossover-underlay" d="M 801 92 L 801 202" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>+ <path data-edge-from="reviewing" data-edge-to="blocked" data-edge-label="needs input" data-edge-key="9" data-edge-id="reviewing-blocked" data-composition-points="801,92;801,202" data-composition-crossover="halo" data-composition-independent="true" d="M 801 92 L 801 202" class="a-default" data-animate="edge" style="--step:9" stroke-width="1.2" marker-end="url(#arrowhead)"/></g><g data-graph-role="automatic-crossover" style="--step:10">- <path data-graph-role="automatic-crossover-underlay" d="M 867 202 L 867 138 Q 867 126 855 126 L 839 126 Q 827 126 827 114 L 827 92" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>- <path data-edge-from="blocked" data-edge-to="reviewing" data-edge-label="input given" data-edge-key="10" data-edge-id="blocked-reviewing" data-composition-points="867,202;867,126;827,126;827,92" data-composition-crossover="halo" data-composition-independent="true" d="M 867 202 L 867 138 Q 867 126 855 126 L 839 126 Q 827 126 827 114 L 827 92" class="a-default" data-animate="edge" style="--step:10" stroke-width="1.2" marker-end="url(#arrowhead)"/>+ <path data-graph-role="automatic-crossover-underlay" d="M 827 202 L 827 92" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>+ <path data-edge-from="blocked" data-edge-to="reviewing" data-edge-label="input given" data-edge-key="10" data-edge-id="blocked-reviewing" data-composition-points="827,202;827,92" data-composition-crossover="halo" data-composition-independent="true" d="M 827 202 L 827 92" class="a-default" data-animate="edge" style="--step:10" stroke-width="1.2" marker-end="url(#arrowhead)"/></g><g data-graph-role="automatic-crossover" style="--step:11"><path data-graph-role="automatic-crossover-underlay" d="M 854 266 L 854 358" fill="none" stroke="var(--mask)" stroke-width="5.2" stroke-linecap="round" stroke-linejoin="round" pointer-events="none"/>@@ -5217,12 +5217,12 @@ OTHER DEALINGS IN THE FONT SOFTWARE.<text x="710" y="167.5" class="t-edge-dashed" font-size="10" text-anchor="middle">retry</text></g><g data-detail="context" data-edge-from="reviewing" data-edge-to="blocked" data-edge-label="needs input" data-edge-key="9" data-edge-id="reviewing-blocked">- <rect x="757" y="165" width="78" height="16" rx="4" class="c-mask"/>- <text x="796" y="176.5" class="t-edge-default" font-size="10" text-anchor="middle">needs input</text>+ <rect x="717" y="129" width="78" height="16" rx="4" class="c-mask"/>+ <text x="756" y="140.5" class="t-edge-default" font-size="10" text-anchor="middle">needs input</text></g><g data-detail="context" data-edge-from="blocked" data-edge-to="reviewing" data-edge-label="input given" data-edge-key="10" data-edge-id="blocked-reviewing">- <rect x="873" y="156" width="78" height="16" rx="4" class="c-mask"/>- <text x="912" y="167.5" class="t-edge-default" font-size="10" text-anchor="middle">input given</text>+ <rect x="833" y="139" width="78" height="16" rx="4" class="c-mask"/>+ <text x="872" y="150.5" class="t-edge-default" font-size="10" text-anchor="middle">input given</text></g><g data-detail="context" data-edge-from="blocked" data-edge-to="expired" data-edge-label="no reply 24h" data-edge-key="11" data-edge-id="blocked-expired"><rect x="764" y="304" width="84" height="16" rx="4" class="c-mask"/>diff --git a/test/lifecycle-layout.test.mjs b/test/lifecycle-layout.test.mjsindex 29630a4d..052dfdc9 100644--- a/test/lifecycle-layout.test.mjs+++ b/test/lifecycle-layout.test.mjs@@ -68,6 +68,25 @@ test('bundled examples pass the showcase artifact check without crossings', () =}});+test('a lower state aligns its complete return-port group without changing mixed-fit branches', () => {+ const doc = JSON.parse(fs.readFileSync(path.join(skillRoot, 'examples', 'agent-run.lifecycle.json'), 'utf8'));+ const result = render(doc);+ assert.equal(result.code, 0, result.stderr);+ assert.equal(result.check.ok, true, JSON.stringify(result.check.composition.issues));+ for (const [from, to] of [['reviewing', 'blocked'], ['blocked', 'reviewing']]) {+ const route = points(result.svg, from, to);+ assert.ok(route.every(([x]) => x === route[0][0]), `${from} -> ${to} is straight`);+ }+ for (const [from, to, expected] of [+ ['executing', 'approval', [[537, 92], [537, 126], [473, 126], [473, 202]]],+ ['approval', 'executing', [[499, 202], [499, 144], [563, 144], [563, 92]]],+ ['executing', 'failed', [[589, 92], [589, 144], [657, 144], [657, 202]]],+ ['failed', 'executing', [[683, 202], [683, 126], [615, 126], [615, 92]]],+ ]) {+ assert.deepEqual(points(result.svg, from, to), expected, `${from} -> ${to} retains its mixed-fit route`);+ }+});+test('main path is one row, loops arc above it and other states sit one row per step below', () => {const result = render(base({mainPath: ['draft', 'review', 'done'],