bpmax-cli 0.2.1-beta.39 → 0.2.1-beta.40

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/README.md CHANGED
@@ -335,19 +335,19 @@ Workspace configuration is also typed. Use `bpmax-cli config workspace export --
335
335
  `bpmax-cli test-suite` manages local `.ai_test` case assets for BPMAX E2E regression work:
336
336
 
337
337
  ```bash
338
- bpmax-cli test-suite lint --root .ai_test/suite_draft --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
339
- bpmax-cli test-suite lint --root .ai_test/suite_draft --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json --explain
338
+ bpmax-cli test-suite lint --root .ai_test/suite_draft --scenario <scenario_id> --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
339
+ bpmax-cli test-suite lint --root .ai_test/suite_draft --scenario <scenario_id> --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json --explain
340
340
  bpmax-cli test-suite review init --scenario <scenario_id> --draft-root .ai_test/suite_draft --latest-proof <proof.json>
341
341
  bpmax-cli test-suite review repair --scenario <scenario_id> --draft-root .ai_test/suite_draft --latest-proof <proof.json>
342
342
  bpmax-cli test-suite review explain
343
343
  bpmax-cli test-suite index --root .ai_test/suite --latest-proof .codex/tmp/ai_test_suite/latest-yaditest-proof.json
344
344
  bpmax-cli test-suite draft-update --scenario <scenario_id> --replace --latest-proof <proof.json>
345
- bpmax-cli test-suite promote --scenario <scenario_id> --replace --latest-proof <proof.json>
345
+ bpmax-cli test-suite promote --scenario <scenario_id> [--scenario <same_flow_scenario_id> ...] --replace --latest-proof <proof.json>
346
346
  bpmax-cli test-suite next-report-dir --root .ai_test/report --create
347
347
  bpmax-cli test-suite lint-report --root .ai_test/report
348
348
  ```
349
349
 
350
- The suite commands are local file operations. `lint`, `index`, `draft-update`, and `promote` require a `latest-*` proof JSON so case assets stay tied to a verified sysconfig baseline. Use `lint --explain` or `review explain` to print the required `review.json` schema. `review init` creates a minimal draft review file, and `review repair` fills missing schema fields without replacing existing review text. Promote also requires `review.json` with the required review perspectives and zero unresolved P0/P1 findings. Copy operations return a diff summary plus `.copy_diff/last.diff` so agents can review changed files and case IDs before overwriting.
350
+ The suite commands are local file operations. `lint`, `index`, `draft-update`, and `promote` require a `latest-*` proof JSON so case assets stay tied to a verified sysconfig baseline. In a shared suite, repeat `--scenario` to lint only the scenarios owned by the current flow; omitting it keeps the full-suite governance check. Scoped output reports `scope=selected_scenarios` and must not be treated as proof that unrelated flows pass. Use `lint --explain` or `review explain` to print the required `review.json` schema. `review init` creates a minimal draft review file, and `review repair` fills missing schema fields without replacing existing review text. Promote also requires `review.json` with the required review perspectives and zero unresolved P0/P1 findings. Repeating `--scenario` on promote preflights every scenario from one `flow_type` before any directory is copied. Copy operations return a diff summary plus `.copy_diff/last.diff` so agents can review changed files and case IDs before overwriting.
351
351
 
352
352
  Project detail template runtime defaults are explicit: `bpmax-cli config project-detail-template export --id 0` exports the global default template only. For `/project_detail/0/<project_id>` runtime behavior, first resolve the flow default:
353
353
 
package/dist/bin.js CHANGED
@@ -496,7 +496,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
496
496
  // package.json
497
497
  var package_default = {
498
498
  name: "bpmax-cli",
499
- version: "0.2.1-beta.39",
499
+ version: "0.2.1-beta.40",
500
500
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
501
501
  type: "module",
502
502
  bin: {
@@ -8829,6 +8829,70 @@ function validateFormTemplateControlContracts(payload, errors, warnings, mode) {
8829
8829
  }
8830
8830
  }
8831
8831
  }
8832
+ var FORM_TEMPLATE_TITLELESS_CONTROL_TYPES = /* @__PURE__ */ new Set([
8833
+ "h_label",
8834
+ "description",
8835
+ "i_hr",
8836
+ "divider"
8837
+ ]);
8838
+ function validateFormTemplateDisplayControlTitles(payload, errors) {
8839
+ const rawValueByField = /* @__PURE__ */ new Map();
8840
+ if (Array.isArray(payload.value)) {
8841
+ for (const item of payload.value) {
8842
+ if (isRecord3(item) && typeof item.field === "string" && item.field) {
8843
+ rawValueByField.set(item.field, item);
8844
+ }
8845
+ }
8846
+ }
8847
+ const validatePair = (field, rule, value, pathName) => {
8848
+ const type = typeof rule.type === "string" ? rule.type : "";
8849
+ if (!FORM_TEMPLATE_TITLELESS_CONTROL_TYPES.has(type)) {
8850
+ return;
8851
+ }
8852
+ if (typeof rule.title === "string" && rule.title.trim()) {
8853
+ errors.push(
8854
+ `[form.display_control.title_forbidden] ${pathName} (${type}, field=${field}) \u4E0D\u5F97\u8BBE\u7F6E rule.title\uFF1Bh_label/description \u7684\u53EF\u89C1\u6587\u5B57\u5E94\u653E\u5728 rule.props.text\uFF0C\u5185\u90E8 rule.field \u4EC5\u7528\u4E8E\u5E03\u5C40\u548C\u7F16\u8F91\u5668\u8BC6\u522B\u3002`
8855
+ );
8856
+ }
8857
+ if (value && typeof value.title === "string" && value.title.trim()) {
8858
+ errors.push(
8859
+ `[form.display_control.value_title_forbidden] ${pathName} (${type}, field=${field}) \u4E0D\u5F97\u8BBE\u7F6E value.title\uFF1B\u5C55\u793A\u63A7\u4EF6\u4E0D\u5E94\u6301\u4E45\u5316\u5B57\u6BB5\u6807\u7B7E\u3002`
8860
+ );
8861
+ }
8862
+ };
8863
+ if (isRecord3(payload.fields)) {
8864
+ for (const [field, bundle] of Object.entries(payload.fields)) {
8865
+ if (!isRecord3(bundle) || !isRecord3(bundle.rule)) {
8866
+ continue;
8867
+ }
8868
+ validatePair(
8869
+ field,
8870
+ bundle.rule,
8871
+ isRecord3(bundle.value) ? bundle.value : void 0,
8872
+ `form-template fields.${field}`
8873
+ );
8874
+ }
8875
+ }
8876
+ if (Array.isArray(payload.rule)) {
8877
+ payload.rule.forEach((row, rowIndex) => {
8878
+ if (!Array.isArray(row)) {
8879
+ return;
8880
+ }
8881
+ row.forEach((rule, columnIndex) => {
8882
+ if (!isRecord3(rule)) {
8883
+ return;
8884
+ }
8885
+ const field = typeof rule.field === "string" && rule.field ? rule.field : `#${rowIndex}:${columnIndex}`;
8886
+ validatePair(
8887
+ field,
8888
+ rule,
8889
+ rawValueByField.get(field),
8890
+ `form-template rule[${rowIndex}][${columnIndex}]`
8891
+ );
8892
+ });
8893
+ });
8894
+ }
8895
+ }
8832
8896
  function validateFormTemplateHeaderContract(payload, errors) {
8833
8897
  const basic = isRecord3(payload.basic) ? payload.basic : {};
8834
8898
  const option = isRecord3(basic.option) ? basic.option : isRecord3(payload.option) ? payload.option : {};
@@ -9350,10 +9414,18 @@ function validateFormTemplateWorkLint(payload, errors, warnings = [], mode = pay
9350
9414
  validateFormTemplateValueValidateMaps(payload, errors);
9351
9415
  validateStructuredFormTemplateFieldTypes(payload, errors);
9352
9416
  validateFormTemplateControlContracts(payload, errors, warnings, mode);
9417
+ validateFormTemplateDisplayControlTitles(payload, errors);
9353
9418
  validateFormTemplateHeaderContract(payload, errors);
9354
9419
  validateStructuredFormTemplateVisualReview(payload, errors);
9355
9420
  validateFormTemplateDynamicFieldStates(payload, errors, warnings);
9356
9421
  }
9422
+ function validateFormTemplateSubmitPayload(payload, mode) {
9423
+ const errors = [];
9424
+ validateFormTemplateWorkLint(payload, errors, [], mode);
9425
+ if (errors.length) {
9426
+ throw new Error(`form-template lint failed: ${errors.join("; ")}`);
9427
+ }
9428
+ }
9357
9429
  function stripFormTemplateCreateIds(payload) {
9358
9430
  const next = { ...payload };
9359
9431
  if (Array.isArray(next.rule)) {
@@ -9590,7 +9662,7 @@ function normalizeMemberDetail(member) {
9590
9662
  }
9591
9663
  function flowPermissionKeys(permissions) {
9592
9664
  const result = /* @__PURE__ */ new Set();
9593
- const collect2 = (flowPermissions) => {
9665
+ const collect3 = (flowPermissions) => {
9594
9666
  if (!isRecord3(flowPermissions)) {
9595
9667
  return;
9596
9668
  }
@@ -9602,11 +9674,11 @@ function flowPermissionKeys(permissions) {
9602
9674
  }
9603
9675
  }
9604
9676
  };
9605
- collect2(permissions.flow);
9677
+ collect3(permissions.flow);
9606
9678
  if (isRecord3(permissions.workspace)) {
9607
9679
  for (const workspacePermissions of Object.values(permissions.workspace)) {
9608
9680
  if (isRecord3(workspacePermissions)) {
9609
- collect2(workspacePermissions.flow);
9681
+ collect3(workspacePermissions.flow);
9610
9682
  }
9611
9683
  }
9612
9684
  }
@@ -13328,6 +13400,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
13328
13400
  }
13329
13401
  if (domain === "form-template" && submitMode === "create") {
13330
13402
  validateNonEmptyFormCreatePayload(submit.payload);
13403
+ validateFormTemplateSubmitPayload(submit.payload, "create");
13331
13404
  await ensureConfigCapability(profile, `${definition.capability}.create`);
13332
13405
  const expectedConfirm2 = `submit ${domain} ${id}`;
13333
13406
  const endpoint2 = "/form_template";
@@ -13394,6 +13467,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
13394
13467
  if (isRecord3(current)) {
13395
13468
  validateNonDestructiveFormEdit(submit.payload, current);
13396
13469
  }
13470
+ validateFormTemplateSubmitPayload(submit.payload, "edit");
13397
13471
  assertFormTemplateDraftId(id, current, "submit");
13398
13472
  }
13399
13473
  if (domain === "flow-template" && isRecord3(current)) {
@@ -17393,8 +17467,7 @@ async function validateCase(filePath, row, steps, seen) {
17393
17467
  validateMultiRoleEvidence(filePath, caseId, row, steps, prepTokens);
17394
17468
  validateBusinessTestData(filePath, caseId, row, steps);
17395
17469
  }
17396
- async function collectE2eAccelerationGaps(root) {
17397
- const dirs = await scenarioDirs(root);
17470
+ async function collectE2eAccelerationGaps(dirs) {
17398
17471
  const gaps = [];
17399
17472
  for (const dir of dirs) {
17400
17473
  const scenarioId = path11.basename(dir);
@@ -17426,6 +17499,35 @@ async function scenarioDirs(root) {
17426
17499
  const items = await readdir4(root, { withFileTypes: true });
17427
17500
  return items.filter((item) => item.isDirectory()).map((item) => path11.join(root, item.name)).sort();
17428
17501
  }
17502
+ function normalizedScenarioIds(scenarios) {
17503
+ return [...new Set((scenarios ?? []).map((scenario) => scenario.trim()).filter(Boolean))];
17504
+ }
17505
+ async function selectedScenarioDirs(root, scenarios) {
17506
+ const scenarioIds = normalizedScenarioIds(scenarios);
17507
+ if (scenarioIds.length === 0) {
17508
+ const dirs2 = await scenarioDirs(root);
17509
+ return { dirs: dirs2, scenarioIds: [], allScenarioCount: dirs2.length };
17510
+ }
17511
+ const dirs = [];
17512
+ for (const scenario of scenarioIds) {
17513
+ const dir = scenarioPath(root, scenario);
17514
+ if (!await exists3(dir)) {
17515
+ fail(`selected scenario not found: ${dir}`, {
17516
+ rule_id: "test_suite.scope.scenario_not_found",
17517
+ path: dir,
17518
+ suggestion: "Use a scenario_id that exists under the selected suite root."
17519
+ });
17520
+ }
17521
+ dirs.push(dir);
17522
+ }
17523
+ const allScenarioCount = (await scenarioDirs(root)).length;
17524
+ return { dirs, scenarioIds, allScenarioCount };
17525
+ }
17526
+ async function lintScenarioDirs(dirs) {
17527
+ const results = [];
17528
+ for (const dir of dirs) results.push(await validateScenario(dir));
17529
+ return results;
17530
+ }
17429
17531
  async function validateScenario(scenarioDir) {
17430
17532
  const metadata = await validateReadme(scenarioDir);
17431
17533
  const casesPath = path11.join(scenarioDir, "cases.csv");
@@ -17458,17 +17560,21 @@ async function validateScenario(scenarioDir) {
17458
17560
  tags: [...new Set(rows2.flatMap((row) => row.tags.split(",").map((tag) => tag.trim()).filter(Boolean)))].sort()
17459
17561
  };
17460
17562
  }
17461
- async function lintSuite(root = DEFAULT_SUITE_ROOT) {
17462
- const dirs = await scenarioDirs(root);
17463
- const results = [];
17464
- for (const dir of dirs) results.push(await validateScenario(dir));
17465
- return results;
17563
+ async function lintSuite(root = DEFAULT_SUITE_ROOT, options = {}) {
17564
+ const selection = await selectedScenarioDirs(root, options.scenarios);
17565
+ return lintScenarioDirs(selection.dirs);
17466
17566
  }
17467
17567
  async function lintSuiteDetailed(root = DEFAULT_SUITE_ROOT, options = {}) {
17468
- const scenarios = await lintSuite(root);
17469
- const accelerationGaps = await collectE2eAccelerationGaps(root);
17568
+ const selection = await selectedScenarioDirs(root, options.scenarios);
17569
+ const scenarios = await lintScenarioDirs(selection.dirs);
17570
+ const accelerationGaps = await collectE2eAccelerationGaps(selection.dirs);
17571
+ const selected = selection.scenarioIds.length > 0;
17470
17572
  return {
17471
17573
  ok: true,
17574
+ scope: selected ? "selected_scenarios" : "full_suite",
17575
+ selected_scenarios: selected ? selection.scenarioIds : scenarios.map((scenario) => scenario.scenario_id),
17576
+ ignored_scenario_count: selected ? Math.max(0, selection.allScenarioCount - selection.dirs.length) : 0,
17577
+ flow_types: [...new Set(scenarios.map((scenario) => scenario.flow_type))].sort(),
17472
17578
  scenario_count: scenarios.length,
17473
17579
  e2e_acceleration: {
17474
17580
  ok: accelerationGaps.length === 0,
@@ -18246,8 +18352,8 @@ async function testSuiteRunStatus(manifestPath, profile) {
18246
18352
  if (profile && manifest.profile !== profile) fail(`execution manifest profile is ${manifest.profile}, not ${profile}`, { rule_id: "test_suite.run.profile_mismatch", path: manifestPath });
18247
18353
  return { ok: true, execution: manifest };
18248
18354
  }
18249
- async function indexSuite(root = DEFAULT_SUITE_ROOT, includeInactive = false) {
18250
- const items = await lintSuite(root);
18355
+ async function indexSuite(root = DEFAULT_SUITE_ROOT, includeInactive = false, options = {}) {
18356
+ const items = await lintSuite(root, options);
18251
18357
  return includeInactive ? items : items.filter((item) => item.status === "active");
18252
18358
  }
18253
18359
  async function requireLatestProof(proofPath) {
@@ -18411,6 +18517,61 @@ async function copyScenarioTree(src, dst, replace, operation) {
18411
18517
  await cp3(src, dst, { recursive: true });
18412
18518
  return artifacts ? { path: await writeCopyDiffArtifacts(dst, artifacts), summary: summarizeCopyDiff(artifacts) } : {};
18413
18519
  }
18520
+ async function copyScenarioBatch(candidates, replace) {
18521
+ const suiteRoot = path11.dirname(candidates[0].dst);
18522
+ const transactionRoot = path11.join(
18523
+ path11.dirname(suiteRoot),
18524
+ `.${path11.basename(suiteRoot)}-promote-transaction-${process.pid}-${Date.now()}`
18525
+ );
18526
+ const stagedRoot = path11.join(transactionRoot, "staged");
18527
+ const backupRoot = path11.join(transactionRoot, "backup");
18528
+ const prepared = [];
18529
+ const committed = /* @__PURE__ */ new Set();
18530
+ try {
18531
+ await mkdir9(suiteRoot, { recursive: true });
18532
+ await mkdir9(stagedRoot, { recursive: true });
18533
+ for (const candidate of candidates) {
18534
+ const destinationExists = await exists3(candidate.dst);
18535
+ if (destinationExists && !replace) fail(`destination already exists, pass --replace: ${candidate.dst}`);
18536
+ const copyDiff = destinationExists ? await buildCopyDiff(candidate.src, candidate.dst, "promote") : void 0;
18537
+ const staged = path11.join(stagedRoot, candidate.scenarioId);
18538
+ await cp3(candidate.src, staged, { recursive: true });
18539
+ if (copyDiff) await writeCopyDiffArtifacts(staged, copyDiff);
18540
+ prepared.push({
18541
+ scenarioId: candidate.scenarioId,
18542
+ dst: candidate.dst,
18543
+ staged,
18544
+ backup: path11.join(backupRoot, candidate.scenarioId),
18545
+ copyDiff
18546
+ });
18547
+ }
18548
+ await mkdir9(backupRoot, { recursive: true });
18549
+ for (const item of prepared) {
18550
+ if (await exists3(item.dst)) await rename(item.dst, item.backup);
18551
+ await rename(item.staged, item.dst);
18552
+ committed.add(item.scenarioId);
18553
+ }
18554
+ return prepared.map((item) => ({
18555
+ scenario_id: item.scenarioId,
18556
+ destination: item.dst,
18557
+ copy_diff: item.copyDiff ? path11.join(item.dst, COPY_DIFF_DIR, "last.diff") : void 0,
18558
+ copy_diff_summary: item.copyDiff ? summarizeCopyDiff(item.copyDiff) : void 0
18559
+ }));
18560
+ } catch (error) {
18561
+ for (const item of [...prepared].reverse()) {
18562
+ if (committed.has(item.scenarioId) && await exists3(item.dst)) {
18563
+ await rm4(item.dst, { recursive: true, force: true }).catch(() => void 0);
18564
+ }
18565
+ if (await exists3(item.backup)) {
18566
+ await mkdir9(path11.dirname(item.dst), { recursive: true }).catch(() => void 0);
18567
+ await rename(item.backup, item.dst).catch(() => void 0);
18568
+ }
18569
+ }
18570
+ throw error;
18571
+ } finally {
18572
+ await rm4(transactionRoot, { recursive: true, force: true }).catch(() => void 0);
18573
+ }
18574
+ }
18414
18575
  async function copyDiffPreview(src, dst, operation) {
18415
18576
  const previewDir = path11.join(DEFAULT_TMP_ROOT, `${operation}-${path11.basename(src)}-copy-diff`);
18416
18577
  await rm4(previewDir, { recursive: true, force: true });
@@ -18617,22 +18778,68 @@ async function initOrRepairReview(options) {
18617
18778
  };
18618
18779
  }
18619
18780
  async function promoteScenario(options) {
18620
- const src = scenarioPath(options.draftRoot ?? DEFAULT_DRAFT_ROOT, options.scenario);
18621
- const metadata = await validateScenario(src);
18622
- await validateReviewGate(src);
18623
- if (metadata.status === "draft") fail(`${src}: cannot promote README status draft; set status to active or deprecated`);
18624
- const dst = scenarioPath(options.suiteRoot ?? DEFAULT_SUITE_ROOT, options.scenario);
18625
- if (options.replace && !options.diffReviewed && await exists3(dst)) {
18626
- const preview = await copyDiffPreview(src, dst, "promote");
18627
- return {
18628
- copy_diff: preview.path,
18629
- copy_diff_summary: preview.summary,
18630
- preview: true,
18631
- message: "destination was not changed; review the diff, then rerun with --diff-reviewed to apply the overwrite"
18632
- };
18781
+ const scenarioIds = normalizedScenarioIds(Array.isArray(options.scenario) ? options.scenario : [options.scenario]);
18782
+ if (scenarioIds.length === 0) fail("at least one --scenario is required", { rule_id: "test_suite.promote.scenario_required" });
18783
+ const candidates = [];
18784
+ for (const scenarioId of scenarioIds) {
18785
+ const src = scenarioPath(options.draftRoot ?? DEFAULT_DRAFT_ROOT, scenarioId);
18786
+ const metadata = await validateScenario(src);
18787
+ await validateReviewGate(src);
18788
+ if (metadata.status === "draft") fail(`${src}: cannot promote README status draft; set status to active or deprecated`);
18789
+ candidates.push({
18790
+ scenarioId,
18791
+ src,
18792
+ dst: scenarioPath(options.suiteRoot ?? DEFAULT_SUITE_ROOT, scenarioId),
18793
+ metadata
18794
+ });
18633
18795
  }
18634
- const copyDiff = await copyScenarioTree(src, dst, Boolean(options.replace), "promote");
18635
- return { destination: dst, copy_diff: copyDiff.path, copy_diff_summary: copyDiff.summary };
18796
+ const flowTypes = [...new Set(candidates.map((candidate) => candidate.metadata.flow_type))];
18797
+ if (flowTypes.length !== 1) {
18798
+ fail(`one promote operation must contain scenarios from exactly one flow_type; received ${flowTypes.join(", ")}`, {
18799
+ rule_id: "test_suite.promote.mixed_flow_scope",
18800
+ suggestion: "Run a separate promote command for each flow_type."
18801
+ });
18802
+ }
18803
+ if (options.replace && !options.diffReviewed) {
18804
+ const previews = [];
18805
+ for (const candidate of candidates) {
18806
+ if (!await exists3(candidate.dst)) continue;
18807
+ const preview = await copyDiffPreview(candidate.src, candidate.dst, "promote");
18808
+ previews.push({
18809
+ scenario_id: candidate.scenarioId,
18810
+ copy_diff: preview.path,
18811
+ copy_diff_summary: preview.summary
18812
+ });
18813
+ }
18814
+ if (previews.length > 0) {
18815
+ if (candidates.length === 1) {
18816
+ return {
18817
+ ...previews[0],
18818
+ preview: true,
18819
+ message: "destination was not changed; review the diff, then rerun with --diff-reviewed to apply the overwrite"
18820
+ };
18821
+ }
18822
+ return {
18823
+ preview: true,
18824
+ scope: "single_flow",
18825
+ flow_type: flowTypes[0],
18826
+ scenario_count: candidates.length,
18827
+ scenarios: previews,
18828
+ message: "no destination was changed; review every scenario diff, then rerun with --diff-reviewed"
18829
+ };
18830
+ }
18831
+ }
18832
+ if (candidates.length === 1) {
18833
+ return (await copyScenarioBatch(candidates, Boolean(options.replace)))[0];
18834
+ }
18835
+ const promoted = await copyScenarioBatch(candidates, Boolean(options.replace));
18836
+ return {
18837
+ ok: true,
18838
+ scope: "single_flow",
18839
+ flow_type: flowTypes[0],
18840
+ scenario_count: promoted.length,
18841
+ scenarios: promoted
18842
+ };
18636
18843
  }
18637
18844
  async function nextReportDir(root = DEFAULT_REPORT_ROOT, create = false, today = /* @__PURE__ */ new Date()) {
18638
18845
  const prefix = [
@@ -26225,6 +26432,10 @@ function registerTaskbookCommands(program2) {
26225
26432
  // src/commands/test-suite.ts
26226
26433
  import { readFile as readFile18 } from "fs/promises";
26227
26434
  import path15 from "path";
26435
+ function collect2(value, previous = []) {
26436
+ previous.push(value);
26437
+ return previous;
26438
+ }
26228
26439
  function effectiveProfileOption(options, command) {
26229
26440
  return options.profile || command.optsWithGlobals().profile;
26230
26441
  }
@@ -26251,13 +26462,18 @@ async function resolveE2eSkillSource(sourceSkill) {
26251
26462
  }
26252
26463
  function registerTestSuiteCommands(program2) {
26253
26464
  const suite = program2.command("test-suite").description("Manage local BPMAX AI test case suites under .ai_test").option("--profile <profile>", "Profile name (accepted for workspace-rule compatibility; ignored by local-only commands)");
26254
- suite.command("lint").description("Lint BPMAX AI test case suite scenarios").option("--root <path>", "Suite root directory", DEFAULT_SUITE_ROOT).requiredOption("--latest-proof <path>", "latest-* proof JSON written after syncing the sysconfig repo").option("--explain", "Include review.json schema and test_data alignment rules in the output").option("--format <format>", "Output format", "json").action(async (options) => {
26465
+ suite.command("lint").description("Lint BPMAX AI test case suite scenarios").option("--root <path>", "Suite root directory", DEFAULT_SUITE_ROOT).option("--scenario <id>", "Lint only this scenario; repeat for multiple scenarios in the same flow", collect2, []).requiredOption("--latest-proof <path>", "latest-* proof JSON written after syncing the sysconfig repo").option("--explain", "Include review.json schema and test_data alignment rules in the output").option("--format <format>", "Output format", "json").action(async (options) => {
26255
26466
  await requireLatestProof(options.latestProof);
26256
- printResult(options.format, await lintSuiteDetailed(options.root, { explain: Boolean(options.explain) }));
26467
+ printResult(options.format, await lintSuiteDetailed(options.root, {
26468
+ explain: Boolean(options.explain),
26469
+ scenarios: options.scenario
26470
+ }));
26257
26471
  });
26258
- suite.command("index").description("Print the BPMAX AI test case suite index").option("--root <path>", "Suite root directory", DEFAULT_SUITE_ROOT).option("--include-inactive", "Include draft and deprecated scenarios").requiredOption("--latest-proof <path>", "latest-* proof JSON written after syncing the sysconfig repo").option("--format <format>", "Output format", "json").action(async (options) => {
26472
+ suite.command("index").description("Print the BPMAX AI test case suite index").option("--root <path>", "Suite root directory", DEFAULT_SUITE_ROOT).option("--scenario <id>", "Index only this scenario; repeat for multiple scenarios", collect2, []).option("--include-inactive", "Include draft and deprecated scenarios").requiredOption("--latest-proof <path>", "latest-* proof JSON written after syncing the sysconfig repo").option("--format <format>", "Output format", "json").action(async (options) => {
26259
26473
  await requireLatestProof(options.latestProof);
26260
- printResult(options.format, await indexSuite(options.root, Boolean(options.includeInactive)));
26474
+ printResult(options.format, await indexSuite(options.root, Boolean(options.includeInactive), {
26475
+ scenarios: options.scenario
26476
+ }));
26261
26477
  });
26262
26478
  const review = suite.command("review").description("Create, repair, or explain review.json required before promoting a draft scenario");
26263
26479
  review.command("init").description("Create a minimal review.json for a draft scenario").requiredOption("--scenario <id>", "Scenario id").option("--draft-root <path>", "Draft suite root directory", DEFAULT_DRAFT_ROOT).requiredOption("--latest-proof <path>", "latest-* proof JSON written after syncing the sysconfig repo").option("--format <format>", "Output format", "json").action(async (options) => {
@@ -26306,9 +26522,12 @@ function registerTestSuiteCommands(program2) {
26306
26522
  await requireLatestProof(options.latestProof);
26307
26523
  printResult(options.format, await draftUpdate(options));
26308
26524
  });
26309
- suite.command("promote").description("Promote one reviewed draft scenario to the formal suite").requiredOption("--scenario <id>", "Scenario id").option("--draft-root <path>", "Draft suite root directory", DEFAULT_DRAFT_ROOT).option("--suite-root <path>", "Formal suite root directory", DEFAULT_SUITE_ROOT).option("--replace", "Allow replacing an existing formal scenario").option("--diff-reviewed", "Confirm the copy diff preview was reviewed").requiredOption("--latest-proof <path>", "latest-* proof JSON written after syncing the sysconfig repo").option("--format <format>", "Output format", "json").action(async (options) => {
26525
+ suite.command("promote").description("Promote reviewed draft scenarios from one flow to the formal suite").requiredOption("--scenario <id>", "Scenario id; repeat to preflight and promote multiple scenarios from one flow", collect2, []).option("--draft-root <path>", "Draft suite root directory", DEFAULT_DRAFT_ROOT).option("--suite-root <path>", "Formal suite root directory", DEFAULT_SUITE_ROOT).option("--replace", "Allow replacing an existing formal scenario").option("--diff-reviewed", "Confirm the copy diff preview was reviewed").requiredOption("--latest-proof <path>", "latest-* proof JSON written after syncing the sysconfig repo").option("--format <format>", "Output format", "json").action(async (options) => {
26310
26526
  await requireLatestProof(options.latestProof);
26311
- printResult(options.format, await promoteScenario(options));
26527
+ printResult(options.format, await promoteScenario({
26528
+ ...options,
26529
+ scenario: options.scenario
26530
+ }));
26312
26531
  });
26313
26532
  suite.command("next-report-dir").description("Print or create the next BPMAX E2E test report run directory").option("--root <path>", "Report root directory", DEFAULT_REPORT_ROOT).option("--create", "Create the report directory, screenshots directory, and summary.md").option("--format <format>", "Output format", "json").action(async (options) => {
26314
26533
  const reportDir = await nextReportDir(options.root, Boolean(options.create));