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(sequence): measure width with participant brand badges
tt-a1if677d75c4d1b
diff --git a/archify.zip b/archify.zipindex 26de75c5..c576504f 100644Binary files a/archify.zip and b/archify.zip differdiff --git a/archify/scripts/check-render-output.mjs b/archify/scripts/check-render-output.mjsindex 9b857eb3..ae6e741a 100644--- a/archify/scripts/check-render-output.mjs+++ b/archify/scripts/check-render-output.mjs@@ -796,11 +796,25 @@ function collectSequenceColumnSpace({ svgAttrs, fragment, nodeRects, arrows }) {const columnFit = svgAttrs['data-sequence-column-fit'];if (!['fixed', 'spread'].includes(columnFit)) return null;const evidence = { measured: false, reviewSuggested: false, columnFit };- if (svgAttrs.transform- || [...fragment.matchAll(/<g\b[^>]*\btransform\s*=[^>]*>/gi)]- .some((match) => !/\bdata-semantic-sigil=/.test(match[0]))- || /<(?:path|line|rect|text)\b[^>]*\btransform\s*=/i.test(fragment)- || /<tspan\b/i.test(fragment)) return evidence;+ if (svgAttrs.transform || /<tspan\b/i.test(fragment)) return evidence;+ // Brand badges stay inside their participant box. Ignore only that subtree's+ // transforms, including the preset path or nested fallback icon's scale.+ const brandGroups = [];+ for (const token of fragment.matchAll(SVG_TAG_TOKEN)) {+ if (!token[2]) continue;+ const name = token[2].toLowerCase();+ if (token[1]) {+ if (name === 'g') brandGroups.pop();+ continue;+ }+ const attrs = parseAttrs(token[0]);+ const inBrand = brandGroups.at(-1) === true || (name === 'g'+ && Boolean(attrs['data-brand-mark'])+ && String(attrs.class || '').split(/\s+/).includes('brand-mark'));+ if (!inBrand && attrs.transform && ['g', 'path', 'line', 'rect', 'text'].includes(name)+ && !(name === 'g' && attrs['data-semantic-sigil'])) return evidence;+ if (name === 'g' && !/\/\s*>$/.test(token[0])) brandGroups.push(inBrand);+ }const [originX, , width, height] = viewBoxRect(svgAttrs);if (![originX, width, height].every(Number.isFinite) || width <= 0 || height <= 0) return evidence;const nodeCount = [...fragment.matchAll(/<g\b[^>]*\bdata-node-id=/gi)].length;diff --git a/archify/test/sequence-width-review.test.mjs b/archify/test/sequence-width-review.test.mjsindex 23a3316d..2b29b7cc 100644--- a/archify/test/sequence-width-review.test.mjs+++ b/archify/test/sequence-width-review.test.mjs@@ -95,6 +95,32 @@ test('explicit fixed remains byte-identical to the legacy default and advice preassert.equal(JSON.parse(fs.readFileSync(explicit.input)).meta.column_fit, 'fixed');});+test('participant brand marks retain width advice while unrelated transforms remain unmeasured', t => {+ const spec = sequence();+ spec.participants[0].brand = 'github';+ const { output, html } = render(t, spec);+ assert.match(html, /data-brand-mark="github"/);+ const { report, exitCode } = check(output);+ const space = report.composition.sequenceColumnSpace;+ assert.equal(exitCode, 0);+ assert.equal(space.measured, true);+ assert.equal(space.participantCount, 6);+ assert.equal(space.occupiedRight, 645);+ assert.equal(space.emptyRightPx, 435);+ assert.equal(space.emptyRightRatio, 0.403);+ assert.equal(summary(report).layoutReviewRecommendation.action, 'inspect-sequence-width');+ assert.equal(fs.readFileSync(output, 'utf8'), html);++ for (const changed of [+ html.replace('<g id="node-p5"', '<g transform="translate(300 0)" id="node-p5"'),+ html.replace('class="a-emphasis"', 'class="a-emphasis" transform="translate(300 0)"'),+ ]) {+ assert.notEqual(changed, html, 'the unsupported transform must be present');+ fs.writeFileSync(output, changed);+ assert.equal(check(output).report.composition.sequenceColumnSpace.measured, false);+ }+});+test('small conversations and a compact fixed canvas are not advised to stretch', t => {for (const count of [2, 3]) {const { output } = render(t, sequence(count));