Stop generating cards from registry descriptions

The extension shows descriptions as tooltips in its Elements panel; the
resolver no longer adds cards to a diagram.
This commit is contained in:
root-at-skic committed 2026-10-19 20:43:16 +03:00
1 parent c68f7df108
commit 90a0c0d109
4 files changed
+3 -26

No files matched your search

-17
View File
@@ -28,18 +28,6 @@ const COPY = {
};
// What a diagram may override on a shared element. Everything else in COPY is fixed.
export const OVERRIDE = ['label', 'sublabel', 'tag'];
// Archify card dot colour per component type (the colour Archify gives the node).
const DOT_BY_TYPE = { frontend: 'cyan', backend: 'emerald', database: 'violet', cloud: 'amber', security: 'rose', messagebus: 'orange', external: 'slate' };
export const dotForType = (type) => DOT_BY_TYPE[type ?? ''] ?? 'slate';
// Archify info cards for shared elements: one per element with a description,
// titled by its label. An architecture diagram without cards of its own gets
// these for the elements it draws, as the extension does.
export function cardsFromElements(elements) {
return elements
.filter((element) => typeof element.description === 'string' && element.description.trim())
.map((element) => ({ dot: dotForType(element.type), title: element.label ?? element.id, items: [element.description.trim()] }));
}
// Registry-only fields, never sent to Archify.
const REGISTRY_ONLY = ['description', 'diagram'];
const SKIP_DIRS = new Set(['node_modules', '.git']);
@@ -253,11 +241,6 @@ export function resolveDiagram(file, { root, elements } = {}) {
}
return merged;
});
if (type === 'architecture' && diagram.cards === undefined && refs.length) {
const drawn = [...new Set(refs)].map((ref) => elements?.[ref]).filter(Boolean);
const cards = cardsFromElements(drawn);
if (cards.length) diagram.cards = cards;
}
result.resolved = diagram;
return result;
}
+2 -4
View File
@@ -80,10 +80,8 @@ try {
assert(json.model === undefined, 'model block leaked into the resolved JSON');
const api = json.components.find((c) => c.id === 'api');
assert(api && api.type === 'backend' && api.brand === 'node-js' && api.description === undefined && api.diagram === undefined, 'api was not resolved from the registry');
const cards = json.cards ?? [];
assert(cards.length === 7 && cards.every((c) => c.dot && c.title && c.items.length === 1), `expected 7 generated cards, got ${JSON.stringify(cards).slice(0, 200)}`);
assert(cards.find((c) => c.title === 'API')?.dot === 'emerald', 'API card has the backend colour');
notes.push(`${json.components.length} components, refs expanded, ${cards.length} cards from the registry`);
assert(json.cards === undefined, 'nothing is generated into the diagram beyond the expanded refs');
notes.push(`${json.components.length} components, refs expanded`);
});
check('model-resolve prints the JSON inline without --out', ['--action', 'model-resolve', '--file', path.join(example, 'main.archify')], (r) => {