Support .archify diagram files (0.2.0)

.archify files are Archify JSON diagram sources. They open as JSON,
preview with the same commands, report validation problems, and get
completion from a schema that dispatches on diagram_type. Adds a
hello.archify example and tests for detection, the dispatching schema
and the VS Code behaviour.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-30 12:56:12 +03:00
co-authored by Claude Opus 5.5
parent 22815a9940
commit 30e2faa38c
15 changed files with 458 additions and 24 deletions
+12
View File
@@ -47,3 +47,15 @@ test('json pointer ranges point at keys for containers and values for leaves', (
const missing = rangeForPointer(text, '/components/0/label');
assert.equal(text.slice(missing.start, missing.end), '{', 'falls back to the nearest existing ancestor');
});
test('.archify files are diagram sources typed by their content', async () => {
const { diagramBaseName, isArchifyFile, isDiagramFileName } = await import('../src/detect');
assert.ok(isArchifyFile('/w/My Platform.archify'));
assert.ok(isDiagramFileName('/w/x.ARCHIFY'));
assert.ok(isDiagramFileName('/w/x.workflow.json'));
assert.ok(!isDiagramFileName('/w/archify.json'));
assert.equal(diagramBaseName('/w/web.archify'), 'web');
assert.equal(diagramBaseName('/w/web.architecture.json'), 'web.architecture');
assert.equal(readDiagramSource('{"diagram_type":"lifecycle"}', 'run.archify')?.type, 'lifecycle');
assert.equal(readDiagramSource('{"title":"no type yet"}', 'run.archify'), undefined);
});