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:
@@ -60,6 +60,28 @@ for (const file of fs.readdirSync(path.join(skill, 'schemas'))) {
|
||||
fs.writeFileSync(path.join(schemaOut, file), `${JSON.stringify(schema, null, 2)}\n`);
|
||||
}
|
||||
|
||||
// *.archify files carry their type only in diagram_type, so they get one
|
||||
// schema that dispatches to the per-type schema.
|
||||
const TYPES = ['architecture', 'workflow', 'sequence', 'dataflow', 'lifecycle'];
|
||||
const dispatcher = {
|
||||
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
||||
title: 'Archify Diagram',
|
||||
description: 'An Archify diagram source. diagram_type selects the schema that applies.',
|
||||
type: 'object',
|
||||
required: ['diagram_type'],
|
||||
properties: {
|
||||
diagram_type: {
|
||||
enum: TYPES,
|
||||
description: 'Kind of diagram: architecture, workflow, sequence, dataflow or lifecycle.',
|
||||
},
|
||||
},
|
||||
allOf: TYPES.map((type) => ({
|
||||
if: { properties: { diagram_type: { const: type } }, required: ['diagram_type'] },
|
||||
then: { $ref: `${type}.schema.json` },
|
||||
})),
|
||||
};
|
||||
fs.writeFileSync(path.join(schemaOut, 'archify.schema.json'), `${JSON.stringify(dispatcher, null, 2)}\n`);
|
||||
|
||||
let revision = 'unknown';
|
||||
try {
|
||||
revision = execFileSync('git', ['-C', source, 'rev-parse', 'HEAD'], { encoding: 'utf8' }).trim();
|
||||
|
||||
Reference in New Issue
Block a user