Files
archify-vscode-ext/vendor/archify/renderers/workflow/render-workflow.mjs
T
root-at-skicandClaude Opus 5.5 22815a9940 Archify Diagram Viewer 0.1.0
VS Code extension that previews Archify diagrams from their JSON sources
(live, as you type) and opens rendered Archify HTML in a viewer tab.
Bundles the Archify 3.0.1 renderer and runs it on VS Code's Node runtime.
Adds validation diagnostics, JSON schema help, source-link navigation,
export saving, render-to-file and open-in-browser commands.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-30 12:44:15 +03:00

38 lines
1.2 KiB
JavaScript

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { loadDiagramWithBrandMarks, writeDiagram } from '../shared/cli.mjs';
import { throwDiagnosticError } from '../shared/diagnostics.mjs';
import { compileWorkflow } from './workflow-compiler.mjs';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const { diagram: workflow, template, outPath, sourceEvidence } = await loadDiagramWithBrandMarks({
rendererDir: __dirname,
diagramType: 'workflow',
defaultExample: 'agent-tool-call.workflow.json'
});
const compiled = compileWorkflow({
workflow,
qualityProfile: process.env.ARCHIFY_QUALITY_PROFILE || workflow.meta?.quality_profile,
sourceEvidence,
});
const layoutJson = process.argv.includes('--layout-json');
if (layoutJson) {
process.stdout.write(`${JSON.stringify(compiled.receipt, null, 2)}\n`);
if (!compiled.ok) process.exitCode = 1;
} else if (!compiled.ok) {
throwDiagnosticError(compiled.error || 'Workflow compilation failed.', compiled.diagnostics);
} else {
writeDiagram({
outPath,
template,
diagramType: 'workflow',
meta: workflow.meta,
svg: compiled.svg,
cards: workflow.cards,
sourceEvidence,
});
}