0.11.0: arc42 and ArchiMate examples; ref in every diagram kind

Six example models next to the three C4 ones: arc42 (Cinema Tickets, IoT
Telemetry, Team Wiki) by section, ArchiMate (Insurance Claims, HR
Onboarding, Logistics Tracking) by layer, each validated with 0 errors and
0 warnings. resolveRefs and the editor schemas now take ref: in workflow
and dataflow nodes, sequence participants and lifecycle states, as the
skill already did. Example tests check each framework's folders.
This commit is contained in:
root-at-skic committed 2026-11-08 22:54:23 +02:00
1 parent f4df6a0834
commit 0745de822a
85 files changed
+2945 -67

No files matched your search

+17 -9
View File
@@ -5,7 +5,7 @@ import path from 'node:path';
import { test } from 'node:test';
import { parse } from 'yaml';
import { validate } from '../src/archify/cli';
import { MODEL_EXAMPLES, mainFromExample } from '../src/language/examples';
import { EXAMPLE_PREFIX, MODEL_EXAMPLES, mainFromExample } from '../src/language/examples';
import { MAIN_FILE, REGISTRY_EXT, hasDiagramBody, mergeRegistries, parseRegistry, readModelMeta, resolveRefs } from '../src/model/format';
import { DECISION_EXT, mergeDecisions, parseDecision, validateDecisions } from '../src/model/decisions';
import { readDiagramSource } from '../src/sources/detect';
@@ -26,13 +26,21 @@ function walk(dir: string, rel = ''): string[] {
});
}
test('every example folder is listed, every listed example exists, labels are the three C4 examples', () => {
// The folders each framework's examples must have, besides main.archify, registry/ and decisions/.
const FRAMEWORK_FOLDERS: Record<string, string[]> = {
c4: ['0100-context', '0200-containers', '0300-components'],
arc42: ['0300-context', '0500-building-blocks', '0600-runtime', '0700-deployment'],
archimate: ['0100-business', '0200-application', '0300-technology'],
};
test('every example folder is listed, every listed example exists, three examples per framework', () => {
const folders = fs.readdirSync(examples, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name).sort();
assert.deepEqual(MODEL_EXAMPLES.map((e) => e.folder).sort(), folders);
assert.deepEqual(
MODEL_EXAMPLES.map((e) => e.label),
['C4 - Standard Web App', 'C4 - E-Shop', 'C4 - Event-Based Integration'],
);
for (const [framework, label] of [['c4', 'C4'], ['arc42', 'arc42'], ['archimate', 'ArchiMate']]) {
const listed = MODEL_EXAMPLES.filter((e) => e.folder.startsWith(`${framework}-`));
assert.equal(listed.length, 3, framework);
for (const e of listed) assert.ok(e.label.startsWith(`${label} - `), e.label);
}
});
for (const example of MODEL_EXAMPLES) {
@@ -45,7 +53,7 @@ for (const example of MODEL_EXAMPLES) {
assert.ok(files.includes(MAIN_FILE));
const main = parse(read(MAIN_FILE));
const meta = readModelMeta(main);
assert.equal(meta?.id, example.folder.replace(/^c4-/, ''));
assert.equal(meta?.id, example.folder.replace(EXAMPLE_PREFIX, ''));
assert.ok(meta?.name && meta.description);
assert.ok(hasDiagramBody(main));
@@ -68,9 +76,9 @@ for (const example of MODEL_EXAMPLES) {
assert.deepEqual(validateDecisions(decisions, registry, diagramPaths), []);
for (const d of decisions.decisions.values()) assert.ok(d.title && d.status && d.context && d.decision && d.consequences, `${d.id} is complete`);
// Diagrams: the three C4 levels, each resolving without problems and valid for Archify.
// Diagrams: the framework's folders, each diagram resolving without problems and valid for Archify.
const diagrams = files.filter((f) => f.endsWith('.archify')).sort();
for (const level of ['0100-context', '0200-containers', '0300-components']) {
for (const level of FRAMEWORK_FOLDERS[example.folder.split('-')[0]]) {
assert.ok(diagrams.some((d) => d.startsWith(`${level}/`)), `missing ${level}`);
}
const used = new Set<string>();
+5 -1
View File
@@ -449,7 +449,11 @@ export async function run(): Promise<void> {
window.showQuickPick = originalPick;
window.showInputBox = originalInput;
}
assert.deepEqual(labels, ['C4 - Standard Web App', 'C4 - E-Shop', 'C4 - Event-Based Integration']);
assert.deepEqual(labels, [
'C4 - Standard Web App', 'C4 - E-Shop', 'C4 - Event-Based Integration',
'arc42 - Cinema Tickets', 'arc42 - IoT Telemetry', 'arc42 - Team Wiki',
'ArchiMate - Insurance Claims', 'ArchiMate - HR Onboarding', 'ArchiMate - Logistics Tracking',
]);
assert.match(String(existingNameMessage), /already exists/);
const folder = vscode.Uri.joinPath(parent, 'shop-two');
const main = vscode.Uri.joinPath(folder, 'main.archify');