@stackwright-pro/mcp 0.2.0-alpha.111 → 0.2.0-alpha.112

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/server.js CHANGED
@@ -3494,11 +3494,29 @@ var PHASE_TO_OTTER2 = {
3494
3494
  geo: "stackwright-pro-geo-otter",
3495
3495
  qa: "stackwright-pro-qa-otter"
3496
3496
  };
3497
+ var PhaseStatusSchema = import_zod14.z.object({
3498
+ status: import_zod14.z.enum(["pending", "running", "completed", "skipped", "failed"]).default("pending"),
3499
+ questionsCollected: import_zod14.z.boolean().default(false),
3500
+ answered: import_zod14.z.boolean().default(false),
3501
+ executed: import_zod14.z.boolean().default(false),
3502
+ artifactWritten: import_zod14.z.boolean().default(false),
3503
+ retryCount: import_zod14.z.number().default(0),
3504
+ inFlight: import_zod14.z.boolean().default(false)
3505
+ });
3506
+ var PipelineStateSchema = import_zod14.z.object({
3507
+ version: import_zod14.z.literal("1.0"),
3508
+ currentPhase: import_zod14.z.string(),
3509
+ status: import_zod14.z.enum(["setup", "questions", "execution", "done"]),
3510
+ phases: import_zod14.z.record(import_zod14.z.string(), PhaseStatusSchema),
3511
+ startedAt: import_zod14.z.string(),
3512
+ updatedAt: import_zod14.z.string()
3513
+ });
3497
3514
  function isValidPhase2(phase) {
3498
3515
  return PHASE_ORDER.includes(phase);
3499
3516
  }
3500
3517
  function defaultPhaseStatus() {
3501
3518
  return {
3519
+ status: "pending",
3502
3520
  questionsCollected: false,
3503
3521
  answered: false,
3504
3522
  executed: false,
@@ -3529,10 +3547,9 @@ function readState(cwd) {
3529
3547
  const p = statePath(cwd);
3530
3548
  if (!(0, import_fs8.existsSync)(p)) return createDefaultState();
3531
3549
  const raw = JSON.parse(safeReadSync(p));
3532
- if (typeof raw !== "object" || raw === null || raw.version !== "1.0") {
3533
- return createDefaultState();
3534
- }
3535
- return raw;
3550
+ const result = PipelineStateSchema.safeParse(raw);
3551
+ if (!result.success) return createDefaultState();
3552
+ return result.data;
3536
3553
  }
3537
3554
  function safeWriteSync(filePath, content) {
3538
3555
  if ((0, import_fs8.existsSync)(filePath)) {
@@ -3621,13 +3638,16 @@ function handleSetPipelineState(input) {
3621
3638
  isError: true
3622
3639
  };
3623
3640
  }
3624
- const VALID_FIELDS = [
3625
- "questionsCollected",
3626
- "answered",
3627
- "executed",
3628
- "artifactWritten",
3629
- "inFlight"
3630
- ];
3641
+ if (input.field === "artifactWritten") {
3642
+ return {
3643
+ text: JSON.stringify({
3644
+ error: true,
3645
+ message: "Cannot set 'artifactWritten' directly. Use stackwright_pro_validate_artifact instead \u2014 it verifies the file exists on disk before flagging."
3646
+ }),
3647
+ isError: true
3648
+ };
3649
+ }
3650
+ const VALID_FIELDS = ["questionsCollected", "answered", "executed", "inFlight"];
3631
3651
  if (input.field && !VALID_FIELDS.includes(input.field)) {
3632
3652
  return {
3633
3653
  text: JSON.stringify({
@@ -3648,6 +3668,15 @@ function handleSetPipelineState(input) {
3648
3668
  isError: true
3649
3669
  };
3650
3670
  }
3671
+ if (update.field === "artifactWritten") {
3672
+ return {
3673
+ text: JSON.stringify({
3674
+ error: true,
3675
+ message: "Cannot set 'artifactWritten' directly. Use stackwright_pro_validate_artifact instead \u2014 it verifies the file exists on disk before flagging."
3676
+ }),
3677
+ isError: true
3678
+ };
3679
+ }
3651
3680
  if (!VALID_FIELDS.includes(update.field)) {
3652
3681
  return {
3653
3682
  text: JSON.stringify({
@@ -3673,6 +3702,9 @@ function handleSetPipelineState(input) {
3673
3702
  if (input.field && input.value !== void 0) {
3674
3703
  phaseState[input.field] = input.value;
3675
3704
  }
3705
+ if (input.phaseStatus !== void 0) {
3706
+ phaseState.status = input.phaseStatus;
3707
+ }
3676
3708
  if (input.incrementRetry) {
3677
3709
  phaseState.retryCount += 1;
3678
3710
  }
@@ -3699,16 +3731,6 @@ function handleSetPipelineState(input) {
3699
3731
  },
3700
3732
  { cwd }
3701
3733
  );
3702
- if (input.field === "artifactWritten" && input.value === true && input.phase) {
3703
- (0, import_telemetry.emit)({ type: "phase_complete", phase: input.phase }, { cwd });
3704
- }
3705
- if (input.updates) {
3706
- for (const update of input.updates) {
3707
- if (update.field === "artifactWritten" && update.value === true) {
3708
- (0, import_telemetry.emit)({ type: "phase_complete", phase: update.phase }, { cwd });
3709
- }
3710
- }
3711
- }
3712
3734
  } catch {
3713
3735
  }
3714
3736
  return { text: JSON.stringify(state), isError: false };
@@ -4787,6 +4809,7 @@ function _validateArtifactInner(input) {
4787
4809
  if (!state.phases[phase]) state.phases[phase] = defaultPhaseStatus();
4788
4810
  const ps = state.phases[phase];
4789
4811
  ps.artifactWritten = true;
4812
+ ps.status = "completed";
4790
4813
  });
4791
4814
  const topKeys = Object.keys(artifact).slice(0, 5).join(", ");
4792
4815
  const result = {
@@ -4814,6 +4837,7 @@ function handleValidateArtifact(input) {
4814
4837
  const parsed = JSON.parse(result.text);
4815
4838
  if (parsed.valid === true && parsed.artifactPath) {
4816
4839
  (0, import_telemetry.emit)({ type: "file_write", path: parsed.artifactPath, phase }, { cwd });
4840
+ (0, import_telemetry.emit)({ type: "phase_complete", phase }, { cwd });
4817
4841
  }
4818
4842
  (0, import_telemetry.emit)(
4819
4843
  {
@@ -4914,12 +4938,19 @@ function registerPipelineTools(server2) {
4914
4938
  `Atomic read\u2192modify\u2192write pipeline state. ${DESC}`,
4915
4939
  {
4916
4940
  phase: import_zod14.z.string().optional().describe('Phase to update, e.g. "designer"'),
4917
- field: import_zod14.z.enum(["questionsCollected", "answered", "executed", "artifactWritten", "inFlight"]).optional().describe("Boolean field to set"),
4941
+ field: import_zod14.z.enum(["questionsCollected", "answered", "executed", "inFlight"]).optional().describe(
4942
+ "Boolean field to set. NOTE: artifactWritten is intentionally absent \u2014 use stackwright_pro_validate_artifact instead (it verifies the file exists on disk before flagging)."
4943
+ ),
4918
4944
  // inFlight: set true BEFORE specialist invoke (dataflow mode, swp-ioc7); false after.
4919
4945
  value: boolCoerce(import_zod14.z.boolean().optional()).describe(
4920
4946
  'Value for the field \u2014 must be a JSON boolean (true/false), NOT the string "true"/"false"'
4921
4947
  ),
4922
- status: import_zod14.z.enum(["setup", "questions", "execution", "done"]).optional().describe("Top-level status override"),
4948
+ // phaseStatus: per-phase execution enum DISTINCT from top-level `status` (pipeline flow).
4949
+ // Named `phaseStatus` to avoid ambiguity. Sets PhaseStatus.status on the given phase.
4950
+ phaseStatus: import_zod14.z.enum(["pending", "running", "completed", "skipped", "failed"]).optional().describe(
4951
+ "Per-phase execution status (pending/running/completed/skipped/failed). Distinct from top-level `status` (pipeline flow). Use phaseStatus: 'skipped' when a specialist otter is unregistered."
4952
+ ),
4953
+ status: import_zod14.z.enum(["setup", "questions", "execution", "done"]).optional().describe("Top-level pipeline flow status override \u2014 distinct from phaseStatus"),
4923
4954
  incrementRetry: boolCoerce(import_zod14.z.boolean().optional()).describe(
4924
4955
  "Bump retryCount by 1 \u2014 must be a JSON boolean"
4925
4956
  ),
@@ -4931,8 +4962,8 @@ function registerPipelineTools(server2) {
4931
4962
  "questionsCollected",
4932
4963
  "answered",
4933
4964
  "executed",
4934
- "artifactWritten",
4935
4965
  "inFlight"
4966
+ // artifactWritten intentionally absent — use validate_artifact (swp-og9c)
4936
4967
  ]),
4937
4968
  value: import_zod14.z.boolean()
4938
4969
  })
@@ -4944,6 +4975,7 @@ function registerPipelineTools(server2) {
4944
4975
  ...args.phase != null ? { phase: args.phase } : {},
4945
4976
  ...args.field != null ? { field: args.field } : {},
4946
4977
  ...args.value != null ? { value: args.value } : {},
4978
+ ...args.phaseStatus != null ? { phaseStatus: args.phaseStatus } : {},
4947
4979
  ...args.status != null ? { status: args.status } : {},
4948
4980
  ...args.incrementRetry != null ? { incrementRetry: args.incrementRetry } : {},
4949
4981
  ...args.updates != null ? { updates: args.updates } : {}
@@ -6548,7 +6580,7 @@ var _checksums = /* @__PURE__ */ new Map([
6548
6580
  ],
6549
6581
  [
6550
6582
  "stackwright-pro-foreman-otter.json",
6551
- "88c4101154d44a7c5470ded13562402a39323ee570ed3a90a73b8d85d7fd2817"
6583
+ "65aa3273274b2b1859d432c3d1166c4a73971861036bf18c35acd8a5357fcf26"
6552
6584
  ],
6553
6585
  [
6554
6586
  "stackwright-pro-form-wizard-otter.json",
@@ -8649,7 +8681,7 @@ var package_default = {
8649
8681
  "test:coverage": "vitest run --coverage"
8650
8682
  },
8651
8683
  name: "@stackwright-pro/mcp",
8652
- version: "0.2.0-alpha.111",
8684
+ version: "0.2.0-alpha.112",
8653
8685
  description: "MCP tools for Stackwright Pro - Data Explorer, Security, ISR, and Dashboard generation",
8654
8686
  license: "SEE LICENSE IN LICENSE",
8655
8687
  main: "./dist/server.js",