@lizard-build/cli 0.3.59 → 0.3.61
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/commands/config.js +4 -3
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/events.js +3 -5
- package/dist/commands/events.js.map +1 -1
- package/dist/commands/git.js +2 -3
- package/dist/commands/git.js.map +1 -1
- package/dist/commands/logs.js +11 -21
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/metrics.js +6 -11
- package/dist/commands/metrics.js.map +1 -1
- package/dist/commands/run.js +7 -5
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/scale.d.ts +1 -1
- package/dist/commands/scale.js +15 -10
- package/dist/commands/scale.js.map +1 -1
- package/dist/commands/skill.js +2 -3
- package/dist/commands/skill.js.map +1 -1
- package/dist/commands/ssh.js +5 -9
- package/dist/commands/ssh.js.map +1 -1
- package/dist/lib/format.d.ts +10 -0
- package/dist/lib/format.js +18 -0
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/updater.d.ts +1 -1
- package/dist/lib/updater.js +1 -1
- package/package.json +1 -1
- package/src/commands/config.ts +4 -3
- package/src/commands/events.ts +3 -5
- package/src/commands/git.ts +2 -3
- package/src/commands/logs.ts +11 -21
- package/src/commands/metrics.ts +6 -11
- package/src/commands/run.ts +8 -6
- package/src/commands/scale.ts +15 -10
- package/src/commands/skill.ts +2 -3
- package/src/commands/ssh.ts +5 -9
- package/src/lib/format.ts +18 -0
- package/src/lib/updater.ts +1 -1
- package/test/unit/json.test.ts +42 -0
package/test/unit/json.test.ts
CHANGED
|
@@ -225,6 +225,48 @@ describe("commander usage errors emit JSON envelopes", () => {
|
|
|
225
225
|
});
|
|
226
226
|
});
|
|
227
227
|
|
|
228
|
+
// ── error path: in-command validation guards (fail()) ───────────────────────
|
|
229
|
+
// These guards live inside the action, behind requireAuth, so a dummy
|
|
230
|
+
// LIZARD_TOKEN gets us past auth to the pre-network validation without
|
|
231
|
+
// touching the API. They must emit the same `{error:{...}}` envelope to
|
|
232
|
+
// stdout (via fail()) instead of a bare human line + process.exit.
|
|
233
|
+
|
|
234
|
+
describe("in-command guards emit JSON envelopes (fail())", () => {
|
|
235
|
+
const AUTHED = { env: { LIZARD_TOKEN: "dummy-token-for-guard-tests" } };
|
|
236
|
+
|
|
237
|
+
test("metrics --range bogus --json", async () => {
|
|
238
|
+
const { stdout, exitCode } = await run(["metrics", "--range", "bogus", "--json"], AUTHED);
|
|
239
|
+
expect(exitCode).toBe(1);
|
|
240
|
+
const out = parseJSON(stdout);
|
|
241
|
+
expect(out.error.code).toBe("ERROR");
|
|
242
|
+
expect(out.error.message).toContain("Invalid --range");
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
test("metrics --watch --json (interactive + json conflict)", async () => {
|
|
246
|
+
const { stdout, exitCode } = await run(["metrics", "--watch", "--json"], AUTHED);
|
|
247
|
+
expect(exitCode).toBe(1);
|
|
248
|
+
const out = parseJSON(stdout);
|
|
249
|
+
expect(out.error.message).toContain("--watch is interactive");
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
test("logs --restarts --restart together --json", async () => {
|
|
253
|
+
const { stdout, exitCode } = await run(
|
|
254
|
+
["logs", "--restarts", "5", "--restart", "latest", "--json"],
|
|
255
|
+
AUTHED,
|
|
256
|
+
);
|
|
257
|
+
expect(exitCode).toBe(1);
|
|
258
|
+
const out = parseJSON(stdout);
|
|
259
|
+
expect(out.error.message).toContain("not both");
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
test("events --limit 0 --json", async () => {
|
|
263
|
+
const { stdout, exitCode } = await run(["events", "--limit", "0", "--json"], AUTHED);
|
|
264
|
+
expect(exitCode).toBe(1);
|
|
265
|
+
const out = parseJSON(stdout);
|
|
266
|
+
expect(out.error.message).toContain("--limit must be a positive integer");
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
228
270
|
// ── --version --json ─────────────────────────────────────────────────────────
|
|
229
271
|
|
|
230
272
|
describe("--version --json", () => {
|