@spectratools/graphic-designer-cli 0.14.1 → 0.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +160 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +163 -9
- package/dist/qa.d.ts +1 -1
- package/dist/qa.js +23 -0
- package/dist/renderer.d.ts +1 -1
- package/dist/renderer.js +23 -0
- package/dist/{spec.schema-De-IkUjn.d.ts → spec.schema-BY5MjmA8.d.ts} +1655 -1586
- package/dist/spec.schema.d.ts +1 -1
- package/dist/spec.schema.js +57 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1378,6 +1378,60 @@ function deriveSafeFrame(spec) {
|
|
|
1378
1378
|
function parseDesignSpec(input) {
|
|
1379
1379
|
return designSpecSchema.parse(input);
|
|
1380
1380
|
}
|
|
1381
|
+
var graphNodeSchema = z2.object({
|
|
1382
|
+
id: z2.string().min(1).max(120),
|
|
1383
|
+
label: z2.string().min(1).max(200),
|
|
1384
|
+
shape: z2.enum([
|
|
1385
|
+
"box",
|
|
1386
|
+
"rounded-box",
|
|
1387
|
+
"diamond",
|
|
1388
|
+
"circle",
|
|
1389
|
+
"pill",
|
|
1390
|
+
"cylinder",
|
|
1391
|
+
"parallelogram",
|
|
1392
|
+
"hexagon"
|
|
1393
|
+
]).optional()
|
|
1394
|
+
}).strict();
|
|
1395
|
+
var graphEdgeSchema = z2.object({
|
|
1396
|
+
from: z2.string().min(1).max(120),
|
|
1397
|
+
to: z2.string().min(1).max(120),
|
|
1398
|
+
label: z2.string().min(1).max(200).optional()
|
|
1399
|
+
}).strict();
|
|
1400
|
+
var graphSpecSchema = z2.object({
|
|
1401
|
+
nodes: z2.array(graphNodeSchema).min(1),
|
|
1402
|
+
edges: z2.array(graphEdgeSchema).default([])
|
|
1403
|
+
}).strict();
|
|
1404
|
+
function isGraphSpecInput(input) {
|
|
1405
|
+
return typeof input === "object" && input !== null && "nodes" in input;
|
|
1406
|
+
}
|
|
1407
|
+
function graphSpecToDesignSpec(graph) {
|
|
1408
|
+
const elements = [
|
|
1409
|
+
...graph.nodes.map((n) => ({
|
|
1410
|
+
type: "flow-node",
|
|
1411
|
+
id: n.id,
|
|
1412
|
+
label: n.label,
|
|
1413
|
+
...n.shape ? { shape: n.shape } : {}
|
|
1414
|
+
})),
|
|
1415
|
+
...graph.edges.map((e) => ({
|
|
1416
|
+
type: "connection",
|
|
1417
|
+
from: e.from,
|
|
1418
|
+
to: e.to,
|
|
1419
|
+
...e.label ? { label: e.label } : {}
|
|
1420
|
+
}))
|
|
1421
|
+
];
|
|
1422
|
+
return designSpecSchema.parse({
|
|
1423
|
+
version: 2,
|
|
1424
|
+
elements,
|
|
1425
|
+
layout: { mode: "auto", algorithm: "layered", direction: "TB" }
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
function parseSpecInput(input) {
|
|
1429
|
+
if (isGraphSpecInput(input)) {
|
|
1430
|
+
const graph = graphSpecSchema.parse(input);
|
|
1431
|
+
return graphSpecToDesignSpec(graph);
|
|
1432
|
+
}
|
|
1433
|
+
return designSpecSchema.parse(input);
|
|
1434
|
+
}
|
|
1381
1435
|
|
|
1382
1436
|
// src/qa.ts
|
|
1383
1437
|
function rectWithin(outer, inner) {
|
|
@@ -5997,11 +6051,89 @@ async function runRenderPipeline(spec, options) {
|
|
|
5997
6051
|
}
|
|
5998
6052
|
};
|
|
5999
6053
|
}
|
|
6054
|
+
var renderOptions = z3.object({
|
|
6055
|
+
spec: z3.string().describe('Path to DesignSpec JSON file (or "-" to read JSON from stdin)'),
|
|
6056
|
+
out: z3.string().optional().describe("Output file path (.png) or output directory"),
|
|
6057
|
+
output: z3.string().optional().describe("Alias for --out. Output file path (.png) or output directory"),
|
|
6058
|
+
specOut: z3.string().optional().describe("Optional explicit output path for normalized spec JSON"),
|
|
6059
|
+
iteration: z3.number().int().positive().optional().describe("Optional iteration number for iterative workflows (1-indexed)"),
|
|
6060
|
+
iterationNotes: z3.string().optional().describe("Optional notes for the current iteration metadata"),
|
|
6061
|
+
maxIterations: z3.number().int().positive().optional().describe("Optional maximum planned iteration count"),
|
|
6062
|
+
previousHash: z3.string().optional().describe("Optional artifact hash from the previous iteration"),
|
|
6063
|
+
allowQaFail: z3.boolean().default(false).describe("Allow render success even if QA fails")
|
|
6064
|
+
});
|
|
6065
|
+
function resolveOut(options) {
|
|
6066
|
+
const resolved = options.out ?? options.output;
|
|
6067
|
+
if (!resolved) {
|
|
6068
|
+
throw new Error("Either --out or --output is required.");
|
|
6069
|
+
}
|
|
6070
|
+
return resolved;
|
|
6071
|
+
}
|
|
6000
6072
|
cli.command("render", {
|
|
6001
6073
|
description: "Render a deterministic design artifact from a DesignSpec JSON file.",
|
|
6074
|
+
options: renderOptions,
|
|
6075
|
+
output: renderOutputSchema,
|
|
6076
|
+
examples: [
|
|
6077
|
+
{
|
|
6078
|
+
options: {
|
|
6079
|
+
spec: "./specs/pipeline.json",
|
|
6080
|
+
out: "./output"
|
|
6081
|
+
},
|
|
6082
|
+
description: "Render a design spec and write .png/.meta/.spec artifacts"
|
|
6083
|
+
}
|
|
6084
|
+
],
|
|
6085
|
+
async run(c) {
|
|
6086
|
+
let out;
|
|
6087
|
+
try {
|
|
6088
|
+
out = resolveOut(c.options);
|
|
6089
|
+
} catch (error) {
|
|
6090
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6091
|
+
return c.error({
|
|
6092
|
+
code: "MISSING_OUTPUT",
|
|
6093
|
+
message,
|
|
6094
|
+
retryable: false
|
|
6095
|
+
});
|
|
6096
|
+
}
|
|
6097
|
+
const spec = parseDesignSpec(await readJson(c.options.spec));
|
|
6098
|
+
let iteration;
|
|
6099
|
+
try {
|
|
6100
|
+
iteration = parseIterationMeta({
|
|
6101
|
+
...c.options.iteration != null ? { iteration: c.options.iteration } : {},
|
|
6102
|
+
...c.options.maxIterations != null ? { maxIterations: c.options.maxIterations } : {},
|
|
6103
|
+
...c.options.iterationNotes ? { iterationNotes: c.options.iterationNotes } : {},
|
|
6104
|
+
...c.options.previousHash ? { previousHash: c.options.previousHash } : {}
|
|
6105
|
+
});
|
|
6106
|
+
} catch (error) {
|
|
6107
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6108
|
+
return c.error({
|
|
6109
|
+
code: "INVALID_ITERATION_OPTIONS",
|
|
6110
|
+
message,
|
|
6111
|
+
retryable: false
|
|
6112
|
+
});
|
|
6113
|
+
}
|
|
6114
|
+
const runReport = await runRenderPipeline(spec, {
|
|
6115
|
+
out,
|
|
6116
|
+
...c.options.specOut ? { specOut: c.options.specOut } : {},
|
|
6117
|
+
...iteration ? { iteration } : {}
|
|
6118
|
+
});
|
|
6119
|
+
if (!runReport.qa.pass && !c.options.allowQaFail) {
|
|
6120
|
+
return c.error({
|
|
6121
|
+
code: "QA_FAILED",
|
|
6122
|
+
message: `Render completed but QA failed (${runReport.qa.issueCount} issues). Review qa output.`,
|
|
6123
|
+
retryable: false
|
|
6124
|
+
});
|
|
6125
|
+
}
|
|
6126
|
+
return c.ok(runReport);
|
|
6127
|
+
}
|
|
6128
|
+
});
|
|
6129
|
+
cli.command("draw", {
|
|
6130
|
+
description: "Alias for render. Render a deterministic design artifact from a DesignSpec JSON.",
|
|
6131
|
+
args: z3.object({
|
|
6132
|
+
spec: z3.string().describe('Path to DesignSpec JSON file (or "-" to read JSON from stdin)')
|
|
6133
|
+
}),
|
|
6002
6134
|
options: z3.object({
|
|
6003
|
-
|
|
6004
|
-
|
|
6135
|
+
out: z3.string().optional().describe("Output file path (.png) or output directory"),
|
|
6136
|
+
output: z3.string().optional().describe("Alias for --out. Output file path (.png) or output directory"),
|
|
6005
6137
|
specOut: z3.string().optional().describe("Optional explicit output path for normalized spec JSON"),
|
|
6006
6138
|
iteration: z3.number().int().positive().optional().describe("Optional iteration number for iterative workflows (1-indexed)"),
|
|
6007
6139
|
iterationNotes: z3.string().optional().describe("Optional notes for the current iteration metadata"),
|
|
@@ -6012,15 +6144,34 @@ cli.command("render", {
|
|
|
6012
6144
|
output: renderOutputSchema,
|
|
6013
6145
|
examples: [
|
|
6014
6146
|
{
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
},
|
|
6019
|
-
description: "Render a design spec and write .png/.meta/.spec artifacts"
|
|
6147
|
+
args: { spec: "/tmp/spec.json" },
|
|
6148
|
+
options: { output: "/tmp/out" },
|
|
6149
|
+
description: "Render a spec using the draw alias with --output"
|
|
6020
6150
|
}
|
|
6021
6151
|
],
|
|
6022
6152
|
async run(c) {
|
|
6023
|
-
|
|
6153
|
+
let out;
|
|
6154
|
+
try {
|
|
6155
|
+
out = resolveOut(c.options);
|
|
6156
|
+
} catch (error) {
|
|
6157
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6158
|
+
return c.error({
|
|
6159
|
+
code: "MISSING_OUTPUT",
|
|
6160
|
+
message,
|
|
6161
|
+
retryable: false
|
|
6162
|
+
});
|
|
6163
|
+
}
|
|
6164
|
+
let spec;
|
|
6165
|
+
try {
|
|
6166
|
+
spec = parseSpecInput(await readJson(c.args.spec));
|
|
6167
|
+
} catch (error) {
|
|
6168
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6169
|
+
return c.error({
|
|
6170
|
+
code: "UNKNOWN",
|
|
6171
|
+
message,
|
|
6172
|
+
retryable: false
|
|
6173
|
+
});
|
|
6174
|
+
}
|
|
6024
6175
|
let iteration;
|
|
6025
6176
|
try {
|
|
6026
6177
|
iteration = parseIterationMeta({
|
|
@@ -6038,7 +6189,7 @@ cli.command("render", {
|
|
|
6038
6189
|
});
|
|
6039
6190
|
}
|
|
6040
6191
|
const runReport = await runRenderPipeline(spec, {
|
|
6041
|
-
out
|
|
6192
|
+
out,
|
|
6042
6193
|
...c.options.specOut ? { specOut: c.options.specOut } : {},
|
|
6043
6194
|
...iteration ? { iteration } : {}
|
|
6044
6195
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cli } from 'incur';
|
|
2
|
-
import { T as ThemeInput, D as DesignSpec, a as Rect$1, b as DrawCommand, c as Theme, d as RenderedElement, A as AnchorHint, C as ConnectionElement } from './spec.schema-
|
|
3
|
-
export { e as AutoLayoutConfig, B as BuiltInTheme, f as CardElement, g as CodeBlockElement, h as ConstraintSpec, i as DEFAULT_GENERATOR_VERSION, j as DEFAULT_RAINBOW_COLORS, k as Decorator, l as DesignCardSpec, m as DesignSafeFrame, n as DesignTheme, o as DiagramElement, p as DiagramLayout, q as DiagramSpec, r as DrawArc, s as DrawBadge, t as DrawBezier, u as DrawCircle, v as DrawFontFamily, w as DrawGradientRect, x as DrawLine, y as DrawPath, z as DrawPoint, E as DrawRect, F as DrawShadow, G as DrawText, H as DrawTextRow, I as DrawTextRowSegment, J as Element, K as EllipseLayoutConfig, L as FlowNodeElement, M as Gradient, N as GradientOverlayDecorator, O as GradientSpec, P as GradientStop, Q as
|
|
2
|
+
import { T as ThemeInput, D as DesignSpec, a as Rect$1, b as DrawCommand, c as Theme, d as RenderedElement, A as AnchorHint, C as ConnectionElement } from './spec.schema-BY5MjmA8.js';
|
|
3
|
+
export { e as AutoLayoutConfig, B as BuiltInTheme, f as CardElement, g as CodeBlockElement, h as ConstraintSpec, i as DEFAULT_GENERATOR_VERSION, j as DEFAULT_RAINBOW_COLORS, k as Decorator, l as DesignCardSpec, m as DesignSafeFrame, n as DesignTheme, o as DiagramElement, p as DiagramLayout, q as DiagramSpec, r as DrawArc, s as DrawBadge, t as DrawBezier, u as DrawCircle, v as DrawFontFamily, w as DrawGradientRect, x as DrawLine, y as DrawPath, z as DrawPoint, E as DrawRect, F as DrawShadow, G as DrawText, H as DrawTextRow, I as DrawTextRowSegment, J as Element, K as EllipseLayoutConfig, L as FlowNodeElement, M as Gradient, N as GradientOverlayDecorator, O as GradientSpec, P as GradientStop, Q as GraphSpec, S as GridLayoutConfig, U as ImageElement, V as IterationMeta, W as LayoutConfig, X as LayoutSnapshot, Y as ManualLayoutConfig, Z as RainbowRuleDecorator, _ as RenderDesignOptions, R as RenderMetadata, $ as RenderResult, a0 as ShapeElement, a1 as StackLayoutConfig, a2 as TerminalElement, a3 as TextElement, a4 as ThemeInput, a5 as VignetteDecorator, a6 as WrittenArtifacts, a7 as builtInThemeBackgrounds, a8 as builtInThemes, a9 as computeSpecHash, aa as connectionElementSchema, ab as defaultAutoLayout, ac as defaultCanvas, ad as defaultConstraints, ae as defaultGridLayout, af as defaultLayout, ag as defaultStackLayout, ah as defaultTheme, ai as deriveSafeFrame, aj as designSpecSchema, ak as diagramElementSchema, al as diagramLayoutSchema, am as diagramSpecSchema, an as drawGradientRect, ao as drawRainbowRule, ap as drawVignette, aq as flowNodeElementSchema, ar as graphSpecSchema, as as graphSpecToDesignSpec, at as inferLayout, au as inferSidecarPath, av as parseDesignSpec, aw as parseDiagramSpec, ax as parseSpecInput, ay as renderDesign, az as resolveTheme, aA as writeRenderArtifacts } from './spec.schema-BY5MjmA8.js';
|
|
4
4
|
import { SKRSContext2D } from '@napi-rs/canvas';
|
|
5
5
|
export { QaIssue, QaReferenceResult, QaReport, QaSeverity, readMetadata, runQa } from './qa.js';
|
|
6
6
|
import { Highlighter } from 'shiki';
|
package/dist/index.js
CHANGED
|
@@ -1391,6 +1391,60 @@ function parseDiagramSpec(input) {
|
|
|
1391
1391
|
function parseDesignSpec(input) {
|
|
1392
1392
|
return designSpecSchema.parse(input);
|
|
1393
1393
|
}
|
|
1394
|
+
var graphNodeSchema = z2.object({
|
|
1395
|
+
id: z2.string().min(1).max(120),
|
|
1396
|
+
label: z2.string().min(1).max(200),
|
|
1397
|
+
shape: z2.enum([
|
|
1398
|
+
"box",
|
|
1399
|
+
"rounded-box",
|
|
1400
|
+
"diamond",
|
|
1401
|
+
"circle",
|
|
1402
|
+
"pill",
|
|
1403
|
+
"cylinder",
|
|
1404
|
+
"parallelogram",
|
|
1405
|
+
"hexagon"
|
|
1406
|
+
]).optional()
|
|
1407
|
+
}).strict();
|
|
1408
|
+
var graphEdgeSchema = z2.object({
|
|
1409
|
+
from: z2.string().min(1).max(120),
|
|
1410
|
+
to: z2.string().min(1).max(120),
|
|
1411
|
+
label: z2.string().min(1).max(200).optional()
|
|
1412
|
+
}).strict();
|
|
1413
|
+
var graphSpecSchema = z2.object({
|
|
1414
|
+
nodes: z2.array(graphNodeSchema).min(1),
|
|
1415
|
+
edges: z2.array(graphEdgeSchema).default([])
|
|
1416
|
+
}).strict();
|
|
1417
|
+
function isGraphSpecInput(input) {
|
|
1418
|
+
return typeof input === "object" && input !== null && "nodes" in input;
|
|
1419
|
+
}
|
|
1420
|
+
function graphSpecToDesignSpec(graph) {
|
|
1421
|
+
const elements = [
|
|
1422
|
+
...graph.nodes.map((n) => ({
|
|
1423
|
+
type: "flow-node",
|
|
1424
|
+
id: n.id,
|
|
1425
|
+
label: n.label,
|
|
1426
|
+
...n.shape ? { shape: n.shape } : {}
|
|
1427
|
+
})),
|
|
1428
|
+
...graph.edges.map((e) => ({
|
|
1429
|
+
type: "connection",
|
|
1430
|
+
from: e.from,
|
|
1431
|
+
to: e.to,
|
|
1432
|
+
...e.label ? { label: e.label } : {}
|
|
1433
|
+
}))
|
|
1434
|
+
];
|
|
1435
|
+
return designSpecSchema.parse({
|
|
1436
|
+
version: 2,
|
|
1437
|
+
elements,
|
|
1438
|
+
layout: { mode: "auto", algorithm: "layered", direction: "TB" }
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
function parseSpecInput(input) {
|
|
1442
|
+
if (isGraphSpecInput(input)) {
|
|
1443
|
+
const graph = graphSpecSchema.parse(input);
|
|
1444
|
+
return graphSpecToDesignSpec(graph);
|
|
1445
|
+
}
|
|
1446
|
+
return designSpecSchema.parse(input);
|
|
1447
|
+
}
|
|
1394
1448
|
|
|
1395
1449
|
// src/qa.ts
|
|
1396
1450
|
function rectWithin(outer, inner) {
|
|
@@ -6065,11 +6119,89 @@ async function runRenderPipeline(spec, options) {
|
|
|
6065
6119
|
}
|
|
6066
6120
|
};
|
|
6067
6121
|
}
|
|
6122
|
+
var renderOptions = z3.object({
|
|
6123
|
+
spec: z3.string().describe('Path to DesignSpec JSON file (or "-" to read JSON from stdin)'),
|
|
6124
|
+
out: z3.string().optional().describe("Output file path (.png) or output directory"),
|
|
6125
|
+
output: z3.string().optional().describe("Alias for --out. Output file path (.png) or output directory"),
|
|
6126
|
+
specOut: z3.string().optional().describe("Optional explicit output path for normalized spec JSON"),
|
|
6127
|
+
iteration: z3.number().int().positive().optional().describe("Optional iteration number for iterative workflows (1-indexed)"),
|
|
6128
|
+
iterationNotes: z3.string().optional().describe("Optional notes for the current iteration metadata"),
|
|
6129
|
+
maxIterations: z3.number().int().positive().optional().describe("Optional maximum planned iteration count"),
|
|
6130
|
+
previousHash: z3.string().optional().describe("Optional artifact hash from the previous iteration"),
|
|
6131
|
+
allowQaFail: z3.boolean().default(false).describe("Allow render success even if QA fails")
|
|
6132
|
+
});
|
|
6133
|
+
function resolveOut(options) {
|
|
6134
|
+
const resolved = options.out ?? options.output;
|
|
6135
|
+
if (!resolved) {
|
|
6136
|
+
throw new Error("Either --out or --output is required.");
|
|
6137
|
+
}
|
|
6138
|
+
return resolved;
|
|
6139
|
+
}
|
|
6068
6140
|
cli.command("render", {
|
|
6069
6141
|
description: "Render a deterministic design artifact from a DesignSpec JSON file.",
|
|
6142
|
+
options: renderOptions,
|
|
6143
|
+
output: renderOutputSchema,
|
|
6144
|
+
examples: [
|
|
6145
|
+
{
|
|
6146
|
+
options: {
|
|
6147
|
+
spec: "./specs/pipeline.json",
|
|
6148
|
+
out: "./output"
|
|
6149
|
+
},
|
|
6150
|
+
description: "Render a design spec and write .png/.meta/.spec artifacts"
|
|
6151
|
+
}
|
|
6152
|
+
],
|
|
6153
|
+
async run(c) {
|
|
6154
|
+
let out;
|
|
6155
|
+
try {
|
|
6156
|
+
out = resolveOut(c.options);
|
|
6157
|
+
} catch (error) {
|
|
6158
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6159
|
+
return c.error({
|
|
6160
|
+
code: "MISSING_OUTPUT",
|
|
6161
|
+
message,
|
|
6162
|
+
retryable: false
|
|
6163
|
+
});
|
|
6164
|
+
}
|
|
6165
|
+
const spec = parseDesignSpec(await readJson(c.options.spec));
|
|
6166
|
+
let iteration;
|
|
6167
|
+
try {
|
|
6168
|
+
iteration = parseIterationMeta({
|
|
6169
|
+
...c.options.iteration != null ? { iteration: c.options.iteration } : {},
|
|
6170
|
+
...c.options.maxIterations != null ? { maxIterations: c.options.maxIterations } : {},
|
|
6171
|
+
...c.options.iterationNotes ? { iterationNotes: c.options.iterationNotes } : {},
|
|
6172
|
+
...c.options.previousHash ? { previousHash: c.options.previousHash } : {}
|
|
6173
|
+
});
|
|
6174
|
+
} catch (error) {
|
|
6175
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6176
|
+
return c.error({
|
|
6177
|
+
code: "INVALID_ITERATION_OPTIONS",
|
|
6178
|
+
message,
|
|
6179
|
+
retryable: false
|
|
6180
|
+
});
|
|
6181
|
+
}
|
|
6182
|
+
const runReport = await runRenderPipeline(spec, {
|
|
6183
|
+
out,
|
|
6184
|
+
...c.options.specOut ? { specOut: c.options.specOut } : {},
|
|
6185
|
+
...iteration ? { iteration } : {}
|
|
6186
|
+
});
|
|
6187
|
+
if (!runReport.qa.pass && !c.options.allowQaFail) {
|
|
6188
|
+
return c.error({
|
|
6189
|
+
code: "QA_FAILED",
|
|
6190
|
+
message: `Render completed but QA failed (${runReport.qa.issueCount} issues). Review qa output.`,
|
|
6191
|
+
retryable: false
|
|
6192
|
+
});
|
|
6193
|
+
}
|
|
6194
|
+
return c.ok(runReport);
|
|
6195
|
+
}
|
|
6196
|
+
});
|
|
6197
|
+
cli.command("draw", {
|
|
6198
|
+
description: "Alias for render. Render a deterministic design artifact from a DesignSpec JSON.",
|
|
6199
|
+
args: z3.object({
|
|
6200
|
+
spec: z3.string().describe('Path to DesignSpec JSON file (or "-" to read JSON from stdin)')
|
|
6201
|
+
}),
|
|
6070
6202
|
options: z3.object({
|
|
6071
|
-
|
|
6072
|
-
|
|
6203
|
+
out: z3.string().optional().describe("Output file path (.png) or output directory"),
|
|
6204
|
+
output: z3.string().optional().describe("Alias for --out. Output file path (.png) or output directory"),
|
|
6073
6205
|
specOut: z3.string().optional().describe("Optional explicit output path for normalized spec JSON"),
|
|
6074
6206
|
iteration: z3.number().int().positive().optional().describe("Optional iteration number for iterative workflows (1-indexed)"),
|
|
6075
6207
|
iterationNotes: z3.string().optional().describe("Optional notes for the current iteration metadata"),
|
|
@@ -6080,15 +6212,34 @@ cli.command("render", {
|
|
|
6080
6212
|
output: renderOutputSchema,
|
|
6081
6213
|
examples: [
|
|
6082
6214
|
{
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
},
|
|
6087
|
-
description: "Render a design spec and write .png/.meta/.spec artifacts"
|
|
6215
|
+
args: { spec: "/tmp/spec.json" },
|
|
6216
|
+
options: { output: "/tmp/out" },
|
|
6217
|
+
description: "Render a spec using the draw alias with --output"
|
|
6088
6218
|
}
|
|
6089
6219
|
],
|
|
6090
6220
|
async run(c) {
|
|
6091
|
-
|
|
6221
|
+
let out;
|
|
6222
|
+
try {
|
|
6223
|
+
out = resolveOut(c.options);
|
|
6224
|
+
} catch (error) {
|
|
6225
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6226
|
+
return c.error({
|
|
6227
|
+
code: "MISSING_OUTPUT",
|
|
6228
|
+
message,
|
|
6229
|
+
retryable: false
|
|
6230
|
+
});
|
|
6231
|
+
}
|
|
6232
|
+
let spec;
|
|
6233
|
+
try {
|
|
6234
|
+
spec = parseSpecInput(await readJson(c.args.spec));
|
|
6235
|
+
} catch (error) {
|
|
6236
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6237
|
+
return c.error({
|
|
6238
|
+
code: "UNKNOWN",
|
|
6239
|
+
message,
|
|
6240
|
+
retryable: false
|
|
6241
|
+
});
|
|
6242
|
+
}
|
|
6092
6243
|
let iteration;
|
|
6093
6244
|
try {
|
|
6094
6245
|
iteration = parseIterationMeta({
|
|
@@ -6106,7 +6257,7 @@ cli.command("render", {
|
|
|
6106
6257
|
});
|
|
6107
6258
|
}
|
|
6108
6259
|
const runReport = await runRenderPipeline(spec, {
|
|
6109
|
-
out
|
|
6260
|
+
out,
|
|
6110
6261
|
...c.options.specOut ? { specOut: c.options.specOut } : {},
|
|
6111
6262
|
...iteration ? { iteration } : {}
|
|
6112
6263
|
});
|
|
@@ -6630,6 +6781,8 @@ export {
|
|
|
6630
6781
|
edgeAnchor,
|
|
6631
6782
|
ellipseRoute,
|
|
6632
6783
|
flowNodeElementSchema,
|
|
6784
|
+
graphSpecSchema,
|
|
6785
|
+
graphSpecToDesignSpec,
|
|
6633
6786
|
highlightCode,
|
|
6634
6787
|
inferEllipseParams,
|
|
6635
6788
|
inferLayout,
|
|
@@ -6640,6 +6793,7 @@ export {
|
|
|
6640
6793
|
outwardNormal,
|
|
6641
6794
|
parseDesignSpec,
|
|
6642
6795
|
parseDiagramSpec,
|
|
6796
|
+
parseSpecInput,
|
|
6643
6797
|
publishToGist,
|
|
6644
6798
|
publishToGitHub,
|
|
6645
6799
|
readMetadata,
|
package/dist/qa.d.ts
CHANGED
package/dist/qa.js
CHANGED
|
@@ -1121,6 +1121,29 @@ function deriveSafeFrame(spec) {
|
|
|
1121
1121
|
function parseDesignSpec(input) {
|
|
1122
1122
|
return designSpecSchema.parse(input);
|
|
1123
1123
|
}
|
|
1124
|
+
var graphNodeSchema = z2.object({
|
|
1125
|
+
id: z2.string().min(1).max(120),
|
|
1126
|
+
label: z2.string().min(1).max(200),
|
|
1127
|
+
shape: z2.enum([
|
|
1128
|
+
"box",
|
|
1129
|
+
"rounded-box",
|
|
1130
|
+
"diamond",
|
|
1131
|
+
"circle",
|
|
1132
|
+
"pill",
|
|
1133
|
+
"cylinder",
|
|
1134
|
+
"parallelogram",
|
|
1135
|
+
"hexagon"
|
|
1136
|
+
]).optional()
|
|
1137
|
+
}).strict();
|
|
1138
|
+
var graphEdgeSchema = z2.object({
|
|
1139
|
+
from: z2.string().min(1).max(120),
|
|
1140
|
+
to: z2.string().min(1).max(120),
|
|
1141
|
+
label: z2.string().min(1).max(200).optional()
|
|
1142
|
+
}).strict();
|
|
1143
|
+
var graphSpecSchema = z2.object({
|
|
1144
|
+
nodes: z2.array(graphNodeSchema).min(1),
|
|
1145
|
+
edges: z2.array(graphEdgeSchema).default([])
|
|
1146
|
+
}).strict();
|
|
1124
1147
|
|
|
1125
1148
|
// src/qa.ts
|
|
1126
1149
|
function rectWithin(outer, inner) {
|
package/dist/renderer.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { i as DEFAULT_GENERATOR_VERSION,
|
|
1
|
+
export { i as DEFAULT_GENERATOR_VERSION, V as IterationMeta, X as LayoutSnapshot, a as Rect, _ as RenderDesignOptions, R as RenderMetadata, $ as RenderResult, d as RenderedElement, a6 as WrittenArtifacts, a9 as computeSpecHash, au as inferSidecarPath, ay as renderDesign, aA as writeRenderArtifacts } from './spec.schema-BY5MjmA8.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import '@napi-rs/canvas';
|
package/dist/renderer.js
CHANGED
|
@@ -4477,6 +4477,29 @@ function deriveSafeFrame(spec) {
|
|
|
4477
4477
|
function parseDesignSpec(input) {
|
|
4478
4478
|
return designSpecSchema.parse(input);
|
|
4479
4479
|
}
|
|
4480
|
+
var graphNodeSchema = z2.object({
|
|
4481
|
+
id: z2.string().min(1).max(120),
|
|
4482
|
+
label: z2.string().min(1).max(200),
|
|
4483
|
+
shape: z2.enum([
|
|
4484
|
+
"box",
|
|
4485
|
+
"rounded-box",
|
|
4486
|
+
"diamond",
|
|
4487
|
+
"circle",
|
|
4488
|
+
"pill",
|
|
4489
|
+
"cylinder",
|
|
4490
|
+
"parallelogram",
|
|
4491
|
+
"hexagon"
|
|
4492
|
+
]).optional()
|
|
4493
|
+
}).strict();
|
|
4494
|
+
var graphEdgeSchema = z2.object({
|
|
4495
|
+
from: z2.string().min(1).max(120),
|
|
4496
|
+
to: z2.string().min(1).max(120),
|
|
4497
|
+
label: z2.string().min(1).max(200).optional()
|
|
4498
|
+
}).strict();
|
|
4499
|
+
var graphSpecSchema = z2.object({
|
|
4500
|
+
nodes: z2.array(graphNodeSchema).min(1),
|
|
4501
|
+
edges: z2.array(graphEdgeSchema).default([])
|
|
4502
|
+
}).strict();
|
|
4480
4503
|
|
|
4481
4504
|
// src/utils/hash.ts
|
|
4482
4505
|
import { createHash } from "crypto";
|