@test-lab-ai/cli 0.2.18 → 0.2.19
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/bin/testlab.mjs +17 -1
- package/package.json +1 -1
package/bin/testlab.mjs
CHANGED
|
@@ -43,6 +43,8 @@ Usage:
|
|
|
43
43
|
testlab plans update <id> [-f patch.json] [--prompt P] [--name N]
|
|
44
44
|
Update an existing plan; only the
|
|
45
45
|
fields you pass change
|
|
46
|
+
testlab plans delete <id> Soft-delete a plan (reversible; kept
|
|
47
|
+
in run history + the audit log)
|
|
46
48
|
testlab projects list List your projects
|
|
47
49
|
testlab credentials set <key> --value <value> Set a credential ({{credentials.<key>}})
|
|
48
50
|
testlab credentials list List credential keys (values never shown)
|
|
@@ -247,6 +249,19 @@ async function cmdPlansUpdate(flags, args) {
|
|
|
247
249
|
log(`✓ Updated plan #${r.json.testPlan.id}: ${r.json.testPlan.name}`)
|
|
248
250
|
}
|
|
249
251
|
|
|
252
|
+
async function cmdPlansDelete(flags, args) {
|
|
253
|
+
const { apiKey, apiUrl } = requireAuth(flags)
|
|
254
|
+
const planId = parsePlanIdArg(args[2] ?? flags.plan)
|
|
255
|
+
if (!Number.isInteger(planId)) {
|
|
256
|
+
errExit("usage: testlab plans delete <id> (numeric plan id; see `testlab plans list`)")
|
|
257
|
+
}
|
|
258
|
+
// Soft delete server-side (reversible; run history kept). Recorded in the
|
|
259
|
+
// account's audit log.
|
|
260
|
+
const r = await apiFetch(apiUrl, apiKey, "DELETE", `/api/v1/test-plans/${planId}`)
|
|
261
|
+
if (!r.ok) errExit(`${r.status}: ${r.json?.error || ""}`)
|
|
262
|
+
log(`✓ Deleted plan #${planId}`)
|
|
263
|
+
}
|
|
264
|
+
|
|
250
265
|
async function cmdCredentialsSet(flags, args) {
|
|
251
266
|
const { apiKey, apiUrl } = requireAuth(flags)
|
|
252
267
|
const key = args[2]
|
|
@@ -671,7 +686,8 @@ async function main() {
|
|
|
671
686
|
if (args[1] === "list") return cmdPlansList(flags)
|
|
672
687
|
if (args[1] === "create") return cmdPlansCreate(flags)
|
|
673
688
|
if (args[1] === "update") return cmdPlansUpdate(flags, args)
|
|
674
|
-
|
|
689
|
+
if (args[1] === "delete") return cmdPlansDelete(flags, args)
|
|
690
|
+
return errExit("usage: testlab plans <list|create|update|delete>")
|
|
675
691
|
case "projects":
|
|
676
692
|
if (args[1] === "list") return cmdProjectsList(flags)
|
|
677
693
|
return errExit("usage: testlab projects list")
|