@spectratools/graphic-designer-cli 0.14.1 → 0.14.2
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 +96 -9
- package/dist/index.js +96 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5997,11 +5997,89 @@ async function runRenderPipeline(spec, options) {
|
|
|
5997
5997
|
}
|
|
5998
5998
|
};
|
|
5999
5999
|
}
|
|
6000
|
+
var renderOptions = z3.object({
|
|
6001
|
+
spec: z3.string().describe('Path to DesignSpec JSON file (or "-" to read JSON from stdin)'),
|
|
6002
|
+
out: z3.string().optional().describe("Output file path (.png) or output directory"),
|
|
6003
|
+
output: z3.string().optional().describe("Alias for --out. Output file path (.png) or output directory"),
|
|
6004
|
+
specOut: z3.string().optional().describe("Optional explicit output path for normalized spec JSON"),
|
|
6005
|
+
iteration: z3.number().int().positive().optional().describe("Optional iteration number for iterative workflows (1-indexed)"),
|
|
6006
|
+
iterationNotes: z3.string().optional().describe("Optional notes for the current iteration metadata"),
|
|
6007
|
+
maxIterations: z3.number().int().positive().optional().describe("Optional maximum planned iteration count"),
|
|
6008
|
+
previousHash: z3.string().optional().describe("Optional artifact hash from the previous iteration"),
|
|
6009
|
+
allowQaFail: z3.boolean().default(false).describe("Allow render success even if QA fails")
|
|
6010
|
+
});
|
|
6011
|
+
function resolveOut(options) {
|
|
6012
|
+
const resolved = options.out ?? options.output;
|
|
6013
|
+
if (!resolved) {
|
|
6014
|
+
throw new Error("Either --out or --output is required.");
|
|
6015
|
+
}
|
|
6016
|
+
return resolved;
|
|
6017
|
+
}
|
|
6000
6018
|
cli.command("render", {
|
|
6001
6019
|
description: "Render a deterministic design artifact from a DesignSpec JSON file.",
|
|
6020
|
+
options: renderOptions,
|
|
6021
|
+
output: renderOutputSchema,
|
|
6022
|
+
examples: [
|
|
6023
|
+
{
|
|
6024
|
+
options: {
|
|
6025
|
+
spec: "./specs/pipeline.json",
|
|
6026
|
+
out: "./output"
|
|
6027
|
+
},
|
|
6028
|
+
description: "Render a design spec and write .png/.meta/.spec artifacts"
|
|
6029
|
+
}
|
|
6030
|
+
],
|
|
6031
|
+
async run(c) {
|
|
6032
|
+
let out;
|
|
6033
|
+
try {
|
|
6034
|
+
out = resolveOut(c.options);
|
|
6035
|
+
} catch (error) {
|
|
6036
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6037
|
+
return c.error({
|
|
6038
|
+
code: "MISSING_OUTPUT",
|
|
6039
|
+
message,
|
|
6040
|
+
retryable: false
|
|
6041
|
+
});
|
|
6042
|
+
}
|
|
6043
|
+
const spec = parseDesignSpec(await readJson(c.options.spec));
|
|
6044
|
+
let iteration;
|
|
6045
|
+
try {
|
|
6046
|
+
iteration = parseIterationMeta({
|
|
6047
|
+
...c.options.iteration != null ? { iteration: c.options.iteration } : {},
|
|
6048
|
+
...c.options.maxIterations != null ? { maxIterations: c.options.maxIterations } : {},
|
|
6049
|
+
...c.options.iterationNotes ? { iterationNotes: c.options.iterationNotes } : {},
|
|
6050
|
+
...c.options.previousHash ? { previousHash: c.options.previousHash } : {}
|
|
6051
|
+
});
|
|
6052
|
+
} catch (error) {
|
|
6053
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6054
|
+
return c.error({
|
|
6055
|
+
code: "INVALID_ITERATION_OPTIONS",
|
|
6056
|
+
message,
|
|
6057
|
+
retryable: false
|
|
6058
|
+
});
|
|
6059
|
+
}
|
|
6060
|
+
const runReport = await runRenderPipeline(spec, {
|
|
6061
|
+
out,
|
|
6062
|
+
...c.options.specOut ? { specOut: c.options.specOut } : {},
|
|
6063
|
+
...iteration ? { iteration } : {}
|
|
6064
|
+
});
|
|
6065
|
+
if (!runReport.qa.pass && !c.options.allowQaFail) {
|
|
6066
|
+
return c.error({
|
|
6067
|
+
code: "QA_FAILED",
|
|
6068
|
+
message: `Render completed but QA failed (${runReport.qa.issueCount} issues). Review qa output.`,
|
|
6069
|
+
retryable: false
|
|
6070
|
+
});
|
|
6071
|
+
}
|
|
6072
|
+
return c.ok(runReport);
|
|
6073
|
+
}
|
|
6074
|
+
});
|
|
6075
|
+
cli.command("draw", {
|
|
6076
|
+
description: "Alias for render. Render a deterministic design artifact from a DesignSpec JSON.",
|
|
6077
|
+
args: z3.object({
|
|
6078
|
+
spec: z3.string().describe('Path to DesignSpec JSON file (or "-" to read JSON from stdin)')
|
|
6079
|
+
}),
|
|
6002
6080
|
options: z3.object({
|
|
6003
|
-
|
|
6004
|
-
|
|
6081
|
+
out: z3.string().optional().describe("Output file path (.png) or output directory"),
|
|
6082
|
+
output: z3.string().optional().describe("Alias for --out. Output file path (.png) or output directory"),
|
|
6005
6083
|
specOut: z3.string().optional().describe("Optional explicit output path for normalized spec JSON"),
|
|
6006
6084
|
iteration: z3.number().int().positive().optional().describe("Optional iteration number for iterative workflows (1-indexed)"),
|
|
6007
6085
|
iterationNotes: z3.string().optional().describe("Optional notes for the current iteration metadata"),
|
|
@@ -6012,15 +6090,24 @@ cli.command("render", {
|
|
|
6012
6090
|
output: renderOutputSchema,
|
|
6013
6091
|
examples: [
|
|
6014
6092
|
{
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
},
|
|
6019
|
-
description: "Render a design spec and write .png/.meta/.spec artifacts"
|
|
6093
|
+
args: { spec: "/tmp/spec.json" },
|
|
6094
|
+
options: { output: "/tmp/out" },
|
|
6095
|
+
description: "Render a spec using the draw alias with --output"
|
|
6020
6096
|
}
|
|
6021
6097
|
],
|
|
6022
6098
|
async run(c) {
|
|
6023
|
-
|
|
6099
|
+
let out;
|
|
6100
|
+
try {
|
|
6101
|
+
out = resolveOut(c.options);
|
|
6102
|
+
} catch (error) {
|
|
6103
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6104
|
+
return c.error({
|
|
6105
|
+
code: "MISSING_OUTPUT",
|
|
6106
|
+
message,
|
|
6107
|
+
retryable: false
|
|
6108
|
+
});
|
|
6109
|
+
}
|
|
6110
|
+
const spec = parseDesignSpec(await readJson(c.args.spec));
|
|
6024
6111
|
let iteration;
|
|
6025
6112
|
try {
|
|
6026
6113
|
iteration = parseIterationMeta({
|
|
@@ -6038,7 +6125,7 @@ cli.command("render", {
|
|
|
6038
6125
|
});
|
|
6039
6126
|
}
|
|
6040
6127
|
const runReport = await runRenderPipeline(spec, {
|
|
6041
|
-
out
|
|
6128
|
+
out,
|
|
6042
6129
|
...c.options.specOut ? { specOut: c.options.specOut } : {},
|
|
6043
6130
|
...iteration ? { iteration } : {}
|
|
6044
6131
|
});
|
package/dist/index.js
CHANGED
|
@@ -6065,11 +6065,89 @@ async function runRenderPipeline(spec, options) {
|
|
|
6065
6065
|
}
|
|
6066
6066
|
};
|
|
6067
6067
|
}
|
|
6068
|
+
var renderOptions = z3.object({
|
|
6069
|
+
spec: z3.string().describe('Path to DesignSpec JSON file (or "-" to read JSON from stdin)'),
|
|
6070
|
+
out: z3.string().optional().describe("Output file path (.png) or output directory"),
|
|
6071
|
+
output: z3.string().optional().describe("Alias for --out. Output file path (.png) or output directory"),
|
|
6072
|
+
specOut: z3.string().optional().describe("Optional explicit output path for normalized spec JSON"),
|
|
6073
|
+
iteration: z3.number().int().positive().optional().describe("Optional iteration number for iterative workflows (1-indexed)"),
|
|
6074
|
+
iterationNotes: z3.string().optional().describe("Optional notes for the current iteration metadata"),
|
|
6075
|
+
maxIterations: z3.number().int().positive().optional().describe("Optional maximum planned iteration count"),
|
|
6076
|
+
previousHash: z3.string().optional().describe("Optional artifact hash from the previous iteration"),
|
|
6077
|
+
allowQaFail: z3.boolean().default(false).describe("Allow render success even if QA fails")
|
|
6078
|
+
});
|
|
6079
|
+
function resolveOut(options) {
|
|
6080
|
+
const resolved = options.out ?? options.output;
|
|
6081
|
+
if (!resolved) {
|
|
6082
|
+
throw new Error("Either --out or --output is required.");
|
|
6083
|
+
}
|
|
6084
|
+
return resolved;
|
|
6085
|
+
}
|
|
6068
6086
|
cli.command("render", {
|
|
6069
6087
|
description: "Render a deterministic design artifact from a DesignSpec JSON file.",
|
|
6088
|
+
options: renderOptions,
|
|
6089
|
+
output: renderOutputSchema,
|
|
6090
|
+
examples: [
|
|
6091
|
+
{
|
|
6092
|
+
options: {
|
|
6093
|
+
spec: "./specs/pipeline.json",
|
|
6094
|
+
out: "./output"
|
|
6095
|
+
},
|
|
6096
|
+
description: "Render a design spec and write .png/.meta/.spec artifacts"
|
|
6097
|
+
}
|
|
6098
|
+
],
|
|
6099
|
+
async run(c) {
|
|
6100
|
+
let out;
|
|
6101
|
+
try {
|
|
6102
|
+
out = resolveOut(c.options);
|
|
6103
|
+
} catch (error) {
|
|
6104
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6105
|
+
return c.error({
|
|
6106
|
+
code: "MISSING_OUTPUT",
|
|
6107
|
+
message,
|
|
6108
|
+
retryable: false
|
|
6109
|
+
});
|
|
6110
|
+
}
|
|
6111
|
+
const spec = parseDesignSpec(await readJson(c.options.spec));
|
|
6112
|
+
let iteration;
|
|
6113
|
+
try {
|
|
6114
|
+
iteration = parseIterationMeta({
|
|
6115
|
+
...c.options.iteration != null ? { iteration: c.options.iteration } : {},
|
|
6116
|
+
...c.options.maxIterations != null ? { maxIterations: c.options.maxIterations } : {},
|
|
6117
|
+
...c.options.iterationNotes ? { iterationNotes: c.options.iterationNotes } : {},
|
|
6118
|
+
...c.options.previousHash ? { previousHash: c.options.previousHash } : {}
|
|
6119
|
+
});
|
|
6120
|
+
} catch (error) {
|
|
6121
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6122
|
+
return c.error({
|
|
6123
|
+
code: "INVALID_ITERATION_OPTIONS",
|
|
6124
|
+
message,
|
|
6125
|
+
retryable: false
|
|
6126
|
+
});
|
|
6127
|
+
}
|
|
6128
|
+
const runReport = await runRenderPipeline(spec, {
|
|
6129
|
+
out,
|
|
6130
|
+
...c.options.specOut ? { specOut: c.options.specOut } : {},
|
|
6131
|
+
...iteration ? { iteration } : {}
|
|
6132
|
+
});
|
|
6133
|
+
if (!runReport.qa.pass && !c.options.allowQaFail) {
|
|
6134
|
+
return c.error({
|
|
6135
|
+
code: "QA_FAILED",
|
|
6136
|
+
message: `Render completed but QA failed (${runReport.qa.issueCount} issues). Review qa output.`,
|
|
6137
|
+
retryable: false
|
|
6138
|
+
});
|
|
6139
|
+
}
|
|
6140
|
+
return c.ok(runReport);
|
|
6141
|
+
}
|
|
6142
|
+
});
|
|
6143
|
+
cli.command("draw", {
|
|
6144
|
+
description: "Alias for render. Render a deterministic design artifact from a DesignSpec JSON.",
|
|
6145
|
+
args: z3.object({
|
|
6146
|
+
spec: z3.string().describe('Path to DesignSpec JSON file (or "-" to read JSON from stdin)')
|
|
6147
|
+
}),
|
|
6070
6148
|
options: z3.object({
|
|
6071
|
-
|
|
6072
|
-
|
|
6149
|
+
out: z3.string().optional().describe("Output file path (.png) or output directory"),
|
|
6150
|
+
output: z3.string().optional().describe("Alias for --out. Output file path (.png) or output directory"),
|
|
6073
6151
|
specOut: z3.string().optional().describe("Optional explicit output path for normalized spec JSON"),
|
|
6074
6152
|
iteration: z3.number().int().positive().optional().describe("Optional iteration number for iterative workflows (1-indexed)"),
|
|
6075
6153
|
iterationNotes: z3.string().optional().describe("Optional notes for the current iteration metadata"),
|
|
@@ -6080,15 +6158,24 @@ cli.command("render", {
|
|
|
6080
6158
|
output: renderOutputSchema,
|
|
6081
6159
|
examples: [
|
|
6082
6160
|
{
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
},
|
|
6087
|
-
description: "Render a design spec and write .png/.meta/.spec artifacts"
|
|
6161
|
+
args: { spec: "/tmp/spec.json" },
|
|
6162
|
+
options: { output: "/tmp/out" },
|
|
6163
|
+
description: "Render a spec using the draw alias with --output"
|
|
6088
6164
|
}
|
|
6089
6165
|
],
|
|
6090
6166
|
async run(c) {
|
|
6091
|
-
|
|
6167
|
+
let out;
|
|
6168
|
+
try {
|
|
6169
|
+
out = resolveOut(c.options);
|
|
6170
|
+
} catch (error) {
|
|
6171
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
6172
|
+
return c.error({
|
|
6173
|
+
code: "MISSING_OUTPUT",
|
|
6174
|
+
message,
|
|
6175
|
+
retryable: false
|
|
6176
|
+
});
|
|
6177
|
+
}
|
|
6178
|
+
const spec = parseDesignSpec(await readJson(c.args.spec));
|
|
6092
6179
|
let iteration;
|
|
6093
6180
|
try {
|
|
6094
6181
|
iteration = parseIterationMeta({
|
|
@@ -6106,7 +6193,7 @@ cli.command("render", {
|
|
|
6106
6193
|
});
|
|
6107
6194
|
}
|
|
6108
6195
|
const runReport = await runRenderPipeline(spec, {
|
|
6109
|
-
out
|
|
6196
|
+
out,
|
|
6110
6197
|
...c.options.specOut ? { specOut: c.options.specOut } : {},
|
|
6111
6198
|
...iteration ? { iteration } : {}
|
|
6112
6199
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectratools/graphic-designer-cli",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"description": "Deterministic visual content generator — code screenshots, terminal shots, flowcharts, and infographics. No browser dependency.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|