shoplazza-ai-dev-cli 0.1.10 → 0.1.11

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.
@@ -326,15 +326,20 @@ async function create$4(client, args, json) {
326
326
  const { named } = parseNamedArgs(args);
327
327
  const reqId = requireArg(named, "req-id", "req_id");
328
328
  const title = requireArg(named, "title", "title");
329
- const bl = typeof named["bl"] === "string" ? named["bl"] : void 0;
329
+ const bl = requireArg(named, "bl", "business_line");
330
330
  const modulePaths = asArray(named["module-paths"]);
331
+ if (modulePaths.length === 0) {
332
+ printError("Missing required flag: --module-paths <path1,path2,...>");
333
+ process.exitCode = 2;
334
+ return;
335
+ }
331
336
  const feishuUrl = typeof named["feishu-url"] === "string" ? named["feishu-url"] : void 0;
332
337
  const body = {
333
338
  req_id: reqId,
334
- title
339
+ title,
340
+ business_line: bl,
341
+ module_paths: modulePaths
335
342
  };
336
- if (bl) body["business_line"] = bl;
337
- if (modulePaths.length) body["module_paths"] = modulePaths;
338
343
  if (feishuUrl) body["feishu_ticket_url"] = feishuUrl;
339
344
  const data = await client.post("/api/test/requirements", body);
340
345
  if (json) {
@@ -479,11 +484,7 @@ async function runRequirements(client, args, json) {
479
484
  process.exitCode = 2;
480
485
  }
481
486
  }
482
- const VALID_CASE_TYPES = [
483
- "api",
484
- "ui",
485
- "e2e"
486
- ];
487
+ const VALID_CASE_TYPES = ["api", "e2e"];
487
488
  const VALID_PRIORITIES = [
488
489
  "P0",
489
490
  "P1",
@@ -521,9 +522,25 @@ async function create$3(client, args, json) {
521
522
  business_line: requireArg(named, "bl", "business_line"),
522
523
  module_path: requireArg(named, "module-path", "module_path"),
523
524
  case_type: requireArg(named, "type", "case_type"),
524
- expected: requireArg(named, "expected", "expected"),
525
- steps: Array.isArray(named["steps"]) ? named["steps"] : named["steps"] ? [named["steps"]] : []
525
+ steps: (() => {
526
+ const raw = requireArg(named, "steps", "steps");
527
+ try {
528
+ const parsed = JSON.parse(raw);
529
+ if (!Array.isArray(parsed) || parsed.length === 0) throw new Error("steps must be a non-empty JSON array");
530
+ for (let i = 0; i < parsed.length; i++) {
531
+ const s = parsed[i];
532
+ if (!s.step?.trim()) throw new Error(`steps[${i}].step is empty`);
533
+ if (!s.expected?.trim()) throw new Error(`steps[${i}].expected is empty`);
534
+ }
535
+ return parsed;
536
+ } catch (e) {
537
+ printError(`Invalid --steps: ${e.message}`);
538
+ process.exitCode = 2;
539
+ return null;
540
+ }
541
+ })()
526
542
  };
543
+ if (body["steps"] === null) return;
527
544
  const caseType = body["case_type"];
528
545
  if (!VALID_CASE_TYPES.includes(caseType)) {
529
546
  printError(`Invalid --type "${caseType}": must be ${VALID_CASE_TYPES.join("|")}`);
@@ -538,15 +555,10 @@ async function create$3(client, args, json) {
538
555
  }
539
556
  body["priority"] = named["priority"];
540
557
  }
541
- if (typeof named["precondition"] === "string") body["precondition"] = named["precondition"];
558
+ body["precondition"] = requireArg(named, "precondition", "precondition");
542
559
  if (typeof named["source"] === "string") body["source"] = named["source"];
543
560
  const tags = asArray(named["tags"]);
544
561
  if (tags.length) body["tags"] = tags;
545
- if (!body["steps"] || body["steps"].length === 0) {
546
- printError("At least one --steps required");
547
- process.exitCode = 2;
548
- return;
549
- }
550
562
  const data = await client.post("/api/test/cases", body);
551
563
  if (json) {
552
564
  printJson(data);
@@ -652,10 +664,12 @@ async function create$2(client, args, json) {
652
664
  process.exitCode = 2;
653
665
  return;
654
666
  }
667
+ const moduleId = requireArg(named, "module", "module_id (integer)");
655
668
  const body = {
656
669
  name,
657
670
  kind,
658
- selection_mode: "manual"
671
+ selection_mode: "manual",
672
+ primary_module_id: parseInt(moduleId, 10)
659
673
  };
660
674
  const data = await client.post("/api/test/case-sets", body);
661
675
  if (json) {
@@ -774,7 +788,7 @@ async function runCaseSets(client, args, json) {
774
788
  case "--help":
775
789
  case "-h":
776
790
  case void 0:
777
- console.log(`case-sets commands:\n create Create a case set (--name, --kind)\n get Get case set detail with members\n members Batch add/remove members (--add/--remove)\n sync Sync cases to a set (--file <path>)`);
791
+ console.log(`case-sets commands:\n create Create a case set (--name, --kind [--module <id>])\n get Get case set detail with members\n members Batch add/remove members (--add/--remove)\n sync Sync cases to a set (--file <path>)`);
778
792
  return;
779
793
  default:
780
794
  printError(`Unknown case-sets action: ${action}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoplazza-ai-dev-cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Shoplazza AI Dev CLI: install, publish and manage AI agent skills/rules",
5
5
  "type": "module",
6
6
  "bin": {