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:
@@ -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);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user