@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.mjs CHANGED
@@ -3498,11 +3498,29 @@ var PHASE_TO_OTTER2 = {
3498
3498
  geo: "stackwright-pro-geo-otter",
3499
3499
  qa: "stackwright-pro-qa-otter"
3500
3500
  };
3501
+ var PhaseStatusSchema = z14.object({
3502
+ status: z14.enum(["pending", "running", "completed", "skipped", "failed"]).default("pending"),
3503
+ questionsCollected: z14.boolean().default(false),
3504
+ answered: z14.boolean().default(false),
3505
+ executed: z14.boolean().default(false),
3506
+ artifactWritten: z14.boolean().default(false),
3507
+ retryCount: z14.number().default(0),
3508
+ inFlight: z14.boolean().default(false)
3509
+ });
3510
+ var PipelineStateSchema = z14.object({
3511
+ version: z14.literal("1.0"),
3512
+ currentPhase: z14.string(),
3513
+ status: z14.enum(["setup", "questions", "execution", "done"]),
3514
+ phases: z14.record(z14.string(), PhaseStatusSchema),
3515
+ startedAt: z14.string(),
3516
+ updatedAt: z14.string()
3517
+ });
3501
3518
  function isValidPhase2(phase) {
3502
3519
  return PHASE_ORDER.includes(phase);
3503
3520
  }
3504
3521
  function defaultPhaseStatus() {
3505
3522
  return {
3523
+ status: "pending",
3506
3524
  questionsCollected: false,
3507
3525
  answered: false,
3508
3526
  executed: false,
@@ -3533,10 +3551,9 @@ function readState(cwd) {
3533
3551
  const p = statePath(cwd);
3534
3552
  if (!existsSync7(p)) return createDefaultState();
3535
3553
  const raw = JSON.parse(safeReadSync(p));
3536
- if (typeof raw !== "object" || raw === null || raw.version !== "1.0") {
3537
- return createDefaultState();
3538
- }
3539
- return raw;
3554
+ const result = PipelineStateSchema.safeParse(raw);
3555
+ if (!result.success) return createDefaultState();
3556
+ return result.data;
3540
3557
  }
3541
3558
  function safeWriteSync(filePath, content) {
3542
3559
  if (existsSync7(filePath)) {
@@ -3625,13 +3642,16 @@ function handleSetPipelineState(input) {
3625
3642
  isError: true
3626
3643
  };
3627
3644
  }
3628
- const VALID_FIELDS = [
3629
- "questionsCollected",
3630
- "answered",
3631
- "executed",
3632
- "artifactWritten",
3633
- "inFlight"
3634
- ];
3645
+ if (input.field === "artifactWritten") {
3646
+ return {
3647
+ text: JSON.stringify({
3648
+ error: true,
3649
+ message: "Cannot set 'artifactWritten' directly. Use stackwright_pro_validate_artifact instead \u2014 it verifies the file exists on disk before flagging."
3650
+ }),
3651
+ isError: true
3652
+ };
3653
+ }
3654
+ const VALID_FIELDS = ["questionsCollected", "answered", "executed", "inFlight"];
3635
3655
  if (input.field && !VALID_FIELDS.includes(input.field)) {
3636
3656
  return {
3637
3657
  text: JSON.stringify({
@@ -3652,6 +3672,15 @@ function handleSetPipelineState(input) {
3652
3672
  isError: true
3653
3673
  };
3654
3674
  }
3675
+ if (update.field === "artifactWritten") {
3676
+ return {
3677
+ text: JSON.stringify({
3678
+ error: true,
3679
+ message: "Cannot set 'artifactWritten' directly. Use stackwright_pro_validate_artifact instead \u2014 it verifies the file exists on disk before flagging."
3680
+ }),
3681
+ isError: true
3682
+ };
3683
+ }
3655
3684
  if (!VALID_FIELDS.includes(update.field)) {
3656
3685
  return {
3657
3686
  text: JSON.stringify({
@@ -3677,6 +3706,9 @@ function handleSetPipelineState(input) {
3677
3706
  if (input.field && input.value !== void 0) {
3678
3707
  phaseState[input.field] = input.value;
3679
3708
  }
3709
+ if (input.phaseStatus !== void 0) {
3710
+ phaseState.status = input.phaseStatus;
3711
+ }
3680
3712
  if (input.incrementRetry) {
3681
3713
  phaseState.retryCount += 1;
3682
3714
  }
@@ -3703,16 +3735,6 @@ function handleSetPipelineState(input) {
3703
3735
  },
3704
3736
  { cwd }
3705
3737
  );
3706
- if (input.field === "artifactWritten" && input.value === true && input.phase) {
3707
- emit({ type: "phase_complete", phase: input.phase }, { cwd });
3708
- }
3709
- if (input.updates) {
3710
- for (const update of input.updates) {
3711
- if (update.field === "artifactWritten" && update.value === true) {
3712
- emit({ type: "phase_complete", phase: update.phase }, { cwd });
3713
- }
3714
- }
3715
- }
3716
3738
  } catch {
3717
3739
  }
3718
3740
  return { text: JSON.stringify(state), isError: false };
@@ -4791,6 +4813,7 @@ function _validateArtifactInner(input) {
4791
4813
  if (!state.phases[phase]) state.phases[phase] = defaultPhaseStatus();
4792
4814
  const ps = state.phases[phase];
4793
4815
  ps.artifactWritten = true;
4816
+ ps.status = "completed";
4794
4817
  });
4795
4818
  const topKeys = Object.keys(artifact).slice(0, 5).join(", ");
4796
4819
  const result = {
@@ -4818,6 +4841,7 @@ function handleValidateArtifact(input) {
4818
4841
  const parsed = JSON.parse(result.text);
4819
4842
  if (parsed.valid === true && parsed.artifactPath) {
4820
4843
  emit({ type: "file_write", path: parsed.artifactPath, phase }, { cwd });
4844
+ emit({ type: "phase_complete", phase }, { cwd });
4821
4845
  }
4822
4846
  emit(
4823
4847
  {
@@ -4918,12 +4942,19 @@ function registerPipelineTools(server2) {
4918
4942
  `Atomic read\u2192modify\u2192write pipeline state. ${DESC}`,
4919
4943
  {
4920
4944
  phase: z14.string().optional().describe('Phase to update, e.g. "designer"'),
4921
- field: z14.enum(["questionsCollected", "answered", "executed", "artifactWritten", "inFlight"]).optional().describe("Boolean field to set"),
4945
+ field: z14.enum(["questionsCollected", "answered", "executed", "inFlight"]).optional().describe(
4946
+ "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)."
4947
+ ),
4922
4948
  // inFlight: set true BEFORE specialist invoke (dataflow mode, swp-ioc7); false after.
4923
4949
  value: boolCoerce(z14.boolean().optional()).describe(
4924
4950
  'Value for the field \u2014 must be a JSON boolean (true/false), NOT the string "true"/"false"'
4925
4951
  ),
4926
- status: z14.enum(["setup", "questions", "execution", "done"]).optional().describe("Top-level status override"),
4952
+ // phaseStatus: per-phase execution enum DISTINCT from top-level `status` (pipeline flow).
4953
+ // Named `phaseStatus` to avoid ambiguity. Sets PhaseStatus.status on the given phase.
4954
+ phaseStatus: z14.enum(["pending", "running", "completed", "skipped", "failed"]).optional().describe(
4955
+ "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."
4956
+ ),
4957
+ status: z14.enum(["setup", "questions", "execution", "done"]).optional().describe("Top-level pipeline flow status override \u2014 distinct from phaseStatus"),
4927
4958
  incrementRetry: boolCoerce(z14.boolean().optional()).describe(
4928
4959
  "Bump retryCount by 1 \u2014 must be a JSON boolean"
4929
4960
  ),
@@ -4935,8 +4966,8 @@ function registerPipelineTools(server2) {
4935
4966
  "questionsCollected",
4936
4967
  "answered",
4937
4968
  "executed",
4938
- "artifactWritten",
4939
4969
  "inFlight"
4970
+ // artifactWritten intentionally absent — use validate_artifact (swp-og9c)
4940
4971
  ]),
4941
4972
  value: z14.boolean()
4942
4973
  })
@@ -4948,6 +4979,7 @@ function registerPipelineTools(server2) {
4948
4979
  ...args.phase != null ? { phase: args.phase } : {},
4949
4980
  ...args.field != null ? { field: args.field } : {},
4950
4981
  ...args.value != null ? { value: args.value } : {},
4982
+ ...args.phaseStatus != null ? { phaseStatus: args.phaseStatus } : {},
4951
4983
  ...args.status != null ? { status: args.status } : {},
4952
4984
  ...args.incrementRetry != null ? { incrementRetry: args.incrementRetry } : {},
4953
4985
  ...args.updates != null ? { updates: args.updates } : {}
@@ -6552,7 +6584,7 @@ var _checksums = /* @__PURE__ */ new Map([
6552
6584
  ],
6553
6585
  [
6554
6586
  "stackwright-pro-foreman-otter.json",
6555
- "88c4101154d44a7c5470ded13562402a39323ee570ed3a90a73b8d85d7fd2817"
6587
+ "65aa3273274b2b1859d432c3d1166c4a73971861036bf18c35acd8a5357fcf26"
6556
6588
  ],
6557
6589
  [
6558
6590
  "stackwright-pro-form-wizard-otter.json",
@@ -8662,7 +8694,7 @@ var package_default = {
8662
8694
  "test:coverage": "vitest run --coverage"
8663
8695
  },
8664
8696
  name: "@stackwright-pro/mcp",
8665
- version: "0.2.0-alpha.111",
8697
+ version: "0.2.0-alpha.112",
8666
8698
  description: "MCP tools for Stackwright Pro - Data Explorer, Security, ISR, and Dashboard generation",
8667
8699
  license: "SEE LICENSE IN LICENSE",
8668
8700
  main: "./dist/server.js",