@stackwright-pro/mcp 0.2.0-alpha.30 → 0.2.0-alpha.32

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
@@ -2305,45 +2305,50 @@ var OFF_SCRIPT_PATTERNS = [
2305
2305
  var PHASE_REQUIRED_KEYS = {
2306
2306
  designer: ["designLanguage", "themeTokenSeeds"],
2307
2307
  theme: ["tokens"],
2308
- api: ["entities"],
2308
+ api: ["entities", "version", "generatedBy"],
2309
2309
  auth: ["version", "generatedBy"],
2310
- data: ["version", "generatedBy"],
2310
+ data: ["version", "generatedBy", "strategy", "collections"],
2311
2311
  pages: ["version", "generatedBy"],
2312
2312
  dashboard: ["version", "generatedBy"],
2313
2313
  workflow: ["version", "generatedBy"]
2314
2314
  };
2315
2315
  function handleValidateArtifact(input) {
2316
2316
  const cwd = input._cwd ?? process.cwd();
2317
- const { phase, responseText } = input;
2317
+ const { phase, responseText, artifact: directArtifact } = input;
2318
2318
  if (!isValidPhase(phase)) {
2319
2319
  return {
2320
2320
  text: JSON.stringify({ error: true, message: `Unknown phase: ${phase}` }),
2321
2321
  isError: true
2322
2322
  };
2323
2323
  }
2324
- for (const { pattern, label } of OFF_SCRIPT_PATTERNS) {
2325
- if (pattern.test(responseText)) {
2324
+ let artifact;
2325
+ if (directArtifact) {
2326
+ artifact = directArtifact;
2327
+ } else {
2328
+ const text = responseText ?? "";
2329
+ for (const { pattern, label } of OFF_SCRIPT_PATTERNS) {
2330
+ if (pattern.test(text)) {
2331
+ const result = {
2332
+ valid: false,
2333
+ phase,
2334
+ violation: "off-script",
2335
+ retryPrompt: `You returned code output (detected: ${label}). Return ONLY a JSON artifact \u2014 no code, no files.`
2336
+ };
2337
+ return { text: JSON.stringify(result), isError: false };
2338
+ }
2339
+ }
2340
+ try {
2341
+ artifact = extractJsonFromResponse(text);
2342
+ } catch {
2326
2343
  const result = {
2327
2344
  valid: false,
2328
2345
  phase,
2329
- violation: "off-script",
2330
- retryPrompt: `You returned code output (detected: ${label}). Return ONLY a JSON artifact \u2014 no code, no files.`
2346
+ violation: "invalid-json",
2347
+ retryPrompt: "Your response did not contain valid JSON. Return a single JSON object with no surrounding text."
2331
2348
  };
2332
2349
  return { text: JSON.stringify(result), isError: false };
2333
2350
  }
2334
2351
  }
2335
- let artifact;
2336
- try {
2337
- artifact = extractJsonFromResponse(responseText);
2338
- } catch {
2339
- const result = {
2340
- valid: false,
2341
- phase,
2342
- violation: "invalid-json",
2343
- retryPrompt: "Your response did not contain valid JSON. Return a single JSON object with no surrounding text."
2344
- };
2345
- return { text: JSON.stringify(result), isError: false };
2346
- }
2347
2352
  if (!artifact.version || !artifact.generatedBy) {
2348
2353
  const result = {
2349
2354
  valid: false,
@@ -2527,12 +2532,22 @@ function registerPipelineTools(server2) {
2527
2532
  );
2528
2533
  server2.tool(
2529
2534
  "stackwright_pro_validate_artifact",
2530
- `Validate specialist response + write artifact to .stackwright/artifacts/. Returns retryPrompt on failure. ${DESC}`,
2535
+ `Validate and write artifact to .stackwright/artifacts/. Returns retryPrompt on failure. ${DESC}`,
2531
2536
  {
2532
2537
  phase: z10.string().describe('Phase that produced this artifact, e.g. "designer"'),
2533
- responseText: z10.string().describe("Raw response text from the specialist otter")
2538
+ responseText: z10.string().optional().describe("Raw response text from the specialist otter (Foreman-mediated path, legacy)"),
2539
+ artifact: z10.record(z10.unknown()).optional().describe(
2540
+ "Artifact object to validate and write directly (specialist direct path \u2014 skips off-script detection and JSON parsing)"
2541
+ )
2534
2542
  },
2535
- async ({ phase, responseText }) => res(handleValidateArtifact({ phase, responseText }))
2543
+ async ({ phase, responseText, artifact }) => {
2544
+ if (artifact) {
2545
+ return res(
2546
+ handleValidateArtifact({ phase, artifact })
2547
+ );
2548
+ }
2549
+ return res(handleValidateArtifact({ phase, responseText: responseText ?? "" }));
2550
+ }
2536
2551
  );
2537
2552
  }
2538
2553
 
@@ -3188,39 +3203,39 @@ import { join as join6, basename } from "path";
3188
3203
  var _checksums = /* @__PURE__ */ new Map([
3189
3204
  [
3190
3205
  "stackwright-pro-api-otter.json",
3191
- "0ac26d85a5ad35b072a58965e1d5e090dd5c5f16dc14e68c452c3e99fcbb5510"
3206
+ "1fd28747ff43121533d40d6446f2d2670d6247afb04e3025cbbcb9ace0e7d1e2"
3192
3207
  ],
3193
3208
  [
3194
3209
  "stackwright-pro-auth-otter.json",
3195
- "e4314897e7dead94cbd07cf58cd9df1a2614a207c85bdddf9259121945903721"
3210
+ "b5e901262d7b3f26ef390f1d3c9aadfa68376c05f5057edc241eb37b32b40afd"
3196
3211
  ],
3197
3212
  [
3198
3213
  "stackwright-pro-dashboard-otter.json",
3199
- "600e8597429c353e5b886f316731be84a86cd8b93617bf046e3cbf390b31a431"
3214
+ "a9e50f26e8b2b687910685f15104b4e76a74ad2e1e5a6021237e1eeb1cbde2ae"
3200
3215
  ],
3201
3216
  [
3202
3217
  "stackwright-pro-data-otter.json",
3203
- "08352843c3dbfd1e20171493fb95ae7c73fde9dca0e2d6eecb5dc2d7d7b3cda7"
3218
+ "04b07f982f73a2904a1d92c6af3c58ecc132b474c57cab3eaec8566d718d2623"
3204
3219
  ],
3205
3220
  [
3206
3221
  "stackwright-pro-designer-otter.json",
3207
- "f4dbff5149051c77be1645de5ee12c0bd7d590c687a0b2d86737b915a5a6d5f0"
3222
+ "41c5b6b9f1f0f6eb0851e473f9d7d6ebd6a7e00dafd5cdeb8a8b12b0b756e245"
3208
3223
  ],
3209
3224
  [
3210
3225
  "stackwright-pro-foreman-otter.json",
3211
- "e361cc30f013e1e423ebb4f59c54fd1452d049fabcc0539ce56b4a49cb5ec3ea"
3226
+ "7c8af9ce5b157ad3030f0255218a6ea923df18a36fe44db9bd5f04897434fc05"
3212
3227
  ],
3213
3228
  [
3214
3229
  "stackwright-pro-page-otter.json",
3215
- "0323d9c9f4b4008b516d7615f24c0ebab9470bdf9cd37e1d48cfc06ccf6fccee"
3230
+ "d672dc4dfd6a3b6d66c6cec93c8db6075dcd4c8f1e8d15e2704aca2fca6856a6"
3216
3231
  ],
3217
3232
  [
3218
3233
  "stackwright-pro-theme-otter.json",
3219
- "a303ec6c045420f2c916583e3f6efcda469e9610fedfc84a508ed8a8a75866bc"
3234
+ "3a37d4bd696f142c4a4278ef653984fca4b776caa610182c2cb82f6732ef9b62"
3220
3235
  ],
3221
3236
  [
3222
3237
  "stackwright-pro-workflow-otter.json",
3223
- "ec203f222b2771f2bc3b29f340d881480c6a23188667e533476f4245e78453ef"
3238
+ "fa2bae06e0f9e6b844008adc933d24b6a210708c0812ce068fc43733ee98b98e"
3224
3239
  ]
3225
3240
  ]);
3226
3241
  Object.freeze(_checksums);
@@ -3917,7 +3932,7 @@ var package_default = {
3917
3932
  "test:coverage": "vitest run --coverage"
3918
3933
  },
3919
3934
  name: "@stackwright-pro/mcp",
3920
- version: "0.2.0-alpha.30",
3935
+ version: "0.2.0-alpha.32",
3921
3936
  description: "MCP tools for Stackwright Pro - Data Explorer, Security, ISR, and Dashboard generation",
3922
3937
  license: "PROPRIETARY",
3923
3938
  main: "./dist/server.js",