@stackwright-pro/mcp 0.2.0-alpha.6 → 0.2.0-alpha.60
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/LICENSE +21 -0
- package/dist/integrity.d.mts +29 -1
- package/dist/integrity.d.ts +29 -1
- package/dist/integrity.js +65 -10
- package/dist/integrity.js.map +1 -1
- package/dist/integrity.mjs +64 -10
- package/dist/integrity.mjs.map +1 -1
- package/dist/server.js +1707 -366
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1682 -325
- package/dist/server.mjs.map +1 -1
- package/dist/tools/type-schemas.d.mts +51 -0
- package/dist/tools/type-schemas.d.ts +51 -0
- package/dist/tools/type-schemas.js +120 -0
- package/dist/tools/type-schemas.js.map +1 -0
- package/dist/tools/type-schemas.mjs +94 -0
- package/dist/tools/type-schemas.mjs.map +1 -0
- package/package.json +17 -8
package/dist/server.js
CHANGED
|
@@ -27,15 +27,44 @@ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
|
27
27
|
var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
28
28
|
|
|
29
29
|
// src/tools/data-explorer.ts
|
|
30
|
-
var
|
|
30
|
+
var import_zod2 = require("zod");
|
|
31
31
|
var import_cli_data_explorer = require("@stackwright-pro/cli-data-explorer");
|
|
32
|
+
|
|
33
|
+
// src/coerce.ts
|
|
34
|
+
var import_zod = require("zod");
|
|
35
|
+
function jsonCoerce(schema) {
|
|
36
|
+
return import_zod.z.preprocess((v) => {
|
|
37
|
+
if (typeof v === "string") {
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(v);
|
|
40
|
+
} catch {
|
|
41
|
+
return v;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return v;
|
|
45
|
+
}, schema);
|
|
46
|
+
}
|
|
47
|
+
function boolCoerce(schema) {
|
|
48
|
+
return import_zod.z.preprocess((v) => v === "true" ? true : v === "false" ? false : v, schema);
|
|
49
|
+
}
|
|
50
|
+
function numCoerce(schema) {
|
|
51
|
+
return import_zod.z.preprocess((v) => {
|
|
52
|
+
if (typeof v === "string" && v.trim() !== "") {
|
|
53
|
+
const n = Number(v);
|
|
54
|
+
if (!Number.isNaN(n)) return n;
|
|
55
|
+
}
|
|
56
|
+
return v;
|
|
57
|
+
}, schema);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// src/tools/data-explorer.ts
|
|
32
61
|
function registerDataExplorerTools(server2) {
|
|
33
62
|
server2.tool(
|
|
34
63
|
"stackwright_pro_list_entities",
|
|
35
64
|
"List all available API entities from OpenAPI specs or generated Zod schemas. Use this to discover what entities are available before generating endpoint filters. Returns entity names, endpoints, and field counts. Part of the Pro Otter Raft for building API-integrated Stackwright applications.",
|
|
36
65
|
{
|
|
37
|
-
specPath:
|
|
38
|
-
projectRoot:
|
|
66
|
+
specPath: import_zod2.z.string().optional().describe("Path to OpenAPI spec file (YAML or JSON)"),
|
|
67
|
+
projectRoot: import_zod2.z.string().optional().describe("Project root directory (auto-detected if omitted)")
|
|
39
68
|
},
|
|
40
69
|
async ({ specPath, projectRoot }) => {
|
|
41
70
|
const result = (0, import_cli_data_explorer.listEntities)({
|
|
@@ -83,9 +112,13 @@ function registerDataExplorerTools(server2) {
|
|
|
83
112
|
"stackwright_pro_generate_filter",
|
|
84
113
|
"Generate endpoint filter configuration from selected entities. Creates include/exclude patterns for stackwright.yml OpenAPI integration. Use this after stackwright_pro_list_entities to select which API endpoints the application needs. Only selected endpoints will generate client code, reducing bundle size and improving security.",
|
|
85
114
|
{
|
|
86
|
-
selectedEntities:
|
|
87
|
-
|
|
88
|
-
|
|
115
|
+
selectedEntities: jsonCoerce(import_zod2.z.array(import_zod2.z.string())).describe(
|
|
116
|
+
'Entity slugs to include (e.g., ["equipment", "supplies"])'
|
|
117
|
+
),
|
|
118
|
+
excludePatterns: jsonCoerce(import_zod2.z.array(import_zod2.z.string()).optional()).describe(
|
|
119
|
+
'Glob patterns to exclude (e.g., ["/admin/**", "/reports/**"])'
|
|
120
|
+
),
|
|
121
|
+
projectRoot: import_zod2.z.string().optional().describe("Project root directory")
|
|
89
122
|
},
|
|
90
123
|
async ({ selectedEntities, excludePatterns, projectRoot }) => {
|
|
91
124
|
const result = (0, import_cli_data_explorer.generateFilter)({
|
|
@@ -141,7 +174,7 @@ function registerDataExplorerTools(server2) {
|
|
|
141
174
|
}
|
|
142
175
|
|
|
143
176
|
// src/tools/security.ts
|
|
144
|
-
var
|
|
177
|
+
var import_zod3 = require("zod");
|
|
145
178
|
var import_crypto = require("crypto");
|
|
146
179
|
var import_fs = __toESM(require("fs"));
|
|
147
180
|
var import_path = __toESM(require("path"));
|
|
@@ -150,8 +183,8 @@ function registerSecurityTools(server2) {
|
|
|
150
183
|
"stackwright_pro_validate_spec",
|
|
151
184
|
"Validate an OpenAPI spec against the enterprise approved-specs configuration. Checks if the spec URL is on the allowlist and verifies SHA-256 hash integrity. Use this in enterprise environments where only pre-approved API specs are allowed. Fails build if spec is not approved or has been modified.",
|
|
152
185
|
{
|
|
153
|
-
specPath:
|
|
154
|
-
configPath:
|
|
186
|
+
specPath: import_zod3.z.string().describe("URL or file path to the OpenAPI spec to validate"),
|
|
187
|
+
configPath: import_zod3.z.string().optional().describe("Path to stackwright.yml with prebuild.security config")
|
|
155
188
|
},
|
|
156
189
|
async ({ specPath, configPath }) => {
|
|
157
190
|
let securityEnabled = false;
|
|
@@ -259,16 +292,15 @@ Status: Valid (${allowlist.length} specs on allowlist)`
|
|
|
259
292
|
"stackwright_pro_add_approved_spec",
|
|
260
293
|
"Add an OpenAPI spec to the approved-specs allowlist in stackwright.yml. Computes the SHA-256 hash of the spec and adds it to the security configuration. Use this when onboarding a new API in enterprise environments.",
|
|
261
294
|
{
|
|
262
|
-
name:
|
|
263
|
-
url:
|
|
264
|
-
configPath:
|
|
295
|
+
name: import_zod3.z.string().describe("Human-readable name for the spec"),
|
|
296
|
+
url: import_zod3.z.string().describe("URL or file path to the OpenAPI spec"),
|
|
297
|
+
configPath: import_zod3.z.string().optional().describe("Path to stackwright.yml")
|
|
265
298
|
},
|
|
266
299
|
async ({ name, url, configPath }) => {
|
|
267
300
|
const configFile = configPath || import_path.default.join(process.cwd(), "stackwright.yml");
|
|
268
301
|
let sha256 = "<computed-at-build>";
|
|
269
302
|
try {
|
|
270
303
|
if (url.startsWith("http://") || url.startsWith("https://")) {
|
|
271
|
-
sha256 = "<computed-at-build>";
|
|
272
304
|
} else if (import_fs.default.existsSync(url)) {
|
|
273
305
|
const specContent = import_fs.default.readFileSync(url, "utf8");
|
|
274
306
|
sha256 = (0, import_crypto.createHash)("sha256").update(specContent).digest("hex");
|
|
@@ -315,7 +347,7 @@ SHA-256 computed: ${sha256}`
|
|
|
315
347
|
"stackwright_pro_list_approved_specs",
|
|
316
348
|
"List all specs currently on the approved-specs allowlist. Shows spec names, URLs, and hash prefixes. Use this to audit what APIs are approved in the project.",
|
|
317
349
|
{
|
|
318
|
-
configPath:
|
|
350
|
+
configPath: import_zod3.z.string().optional().describe("Path to stackwright.yml")
|
|
319
351
|
},
|
|
320
352
|
async ({ configPath }) => {
|
|
321
353
|
const configFile = configPath || import_path.default.join(process.cwd(), "stackwright.yml");
|
|
@@ -384,16 +416,18 @@ SHA-256 computed: ${sha256}`
|
|
|
384
416
|
}
|
|
385
417
|
|
|
386
418
|
// src/tools/isr.ts
|
|
387
|
-
var
|
|
419
|
+
var import_zod4 = require("zod");
|
|
388
420
|
function registerIsrTools(server2) {
|
|
389
421
|
server2.tool(
|
|
390
422
|
"stackwright_pro_configure_isr",
|
|
391
423
|
"Configure Incremental Static Regeneration (ISR) for an API-backed collection. ISR allows API data to be cached and refreshed on a schedule, providing real-time data with the performance of static generation. Use this after stackwright_pro_generate_filter to set revalidation intervals.",
|
|
392
424
|
{
|
|
393
|
-
collection:
|
|
394
|
-
revalidateSeconds:
|
|
395
|
-
|
|
396
|
-
|
|
425
|
+
collection: import_zod4.z.string().describe('Collection name (e.g., "equipment", "supplies")'),
|
|
426
|
+
revalidateSeconds: numCoerce(import_zod4.z.number().optional()).describe(
|
|
427
|
+
"Revalidation interval in seconds (default: 60)"
|
|
428
|
+
),
|
|
429
|
+
fallback: import_zod4.z.enum(["blocking", "true", "false"]).optional().describe("Fallback behavior for new pages"),
|
|
430
|
+
configPath: import_zod4.z.string().optional().describe("Path to stackwright.yml")
|
|
397
431
|
},
|
|
398
432
|
async ({ collection, revalidateSeconds = 60, fallback = "blocking", configPath }) => {
|
|
399
433
|
const revalidate = revalidateSeconds;
|
|
@@ -404,7 +438,7 @@ function registerIsrTools(server2) {
|
|
|
404
438
|
isr:
|
|
405
439
|
revalidate: ${revalidate}
|
|
406
440
|
fallback: ${fallback}`;
|
|
407
|
-
let description
|
|
441
|
+
let description;
|
|
408
442
|
if (revalidate < 60) {
|
|
409
443
|
description = "\u26A1 Very fresh data (revalidate every " + revalidate + "s)";
|
|
410
444
|
} else if (revalidate < 300) {
|
|
@@ -436,14 +470,16 @@ ${yamlSnippet}
|
|
|
436
470
|
"stackwright_pro_configure_isr_batch",
|
|
437
471
|
"Configure ISR for multiple collections at once. More efficient than calling stackwright_pro_configure_isr multiple times. Provide different revalidation intervals based on data freshness requirements.",
|
|
438
472
|
{
|
|
439
|
-
collections:
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
473
|
+
collections: jsonCoerce(
|
|
474
|
+
import_zod4.z.array(
|
|
475
|
+
import_zod4.z.object({
|
|
476
|
+
name: import_zod4.z.string().describe("Collection name"),
|
|
477
|
+
revalidateSeconds: numCoerce(import_zod4.z.number().optional()).describe("Revalidation interval")
|
|
478
|
+
})
|
|
479
|
+
)
|
|
444
480
|
).describe("Array of collection configurations"),
|
|
445
|
-
defaultFallback:
|
|
446
|
-
configPath:
|
|
481
|
+
defaultFallback: import_zod4.z.enum(["blocking", "true", "false"]).optional().describe("Default fallback behavior"),
|
|
482
|
+
configPath: import_zod4.z.string().optional().describe("Path to stackwright.yml")
|
|
447
483
|
},
|
|
448
484
|
async ({ collections, defaultFallback = "blocking", configPath }) => {
|
|
449
485
|
const lines = [`\u2699\uFE0F Batch ISR Configuration:
|
|
@@ -471,17 +507,17 @@ Fallback: ${defaultFallback}`);
|
|
|
471
507
|
}
|
|
472
508
|
|
|
473
509
|
// src/tools/dashboard.ts
|
|
474
|
-
var
|
|
510
|
+
var import_zod5 = require("zod");
|
|
475
511
|
var import_cli_data_explorer2 = require("@stackwright-pro/cli-data-explorer");
|
|
476
512
|
function registerDashboardTools(server2) {
|
|
477
513
|
server2.tool(
|
|
478
514
|
"stackwright_pro_generate_dashboard",
|
|
479
515
|
"Generate a dashboard page configuration for displaying API data. Creates YAML content for a Stackwright page with grid, metric_card, data_table, and collection_list content types. Use this after stackwright_pro_generate_filter to create pages for your API collections.",
|
|
480
516
|
{
|
|
481
|
-
entities:
|
|
482
|
-
layout:
|
|
483
|
-
pageTitle:
|
|
484
|
-
specPath:
|
|
517
|
+
entities: jsonCoerce(import_zod5.z.array(import_zod5.z.string())).describe("Entity slugs to include in dashboard"),
|
|
518
|
+
layout: import_zod5.z.enum(["grid", "table", "mixed"]).optional().describe("Dashboard layout style"),
|
|
519
|
+
pageTitle: import_zod5.z.string().optional().describe("Page title"),
|
|
520
|
+
specPath: import_zod5.z.string().optional().describe("Path to OpenAPI spec for entity details")
|
|
485
521
|
},
|
|
486
522
|
async ({ entities, layout = "mixed", pageTitle, specPath }) => {
|
|
487
523
|
let entityDetails = [];
|
|
@@ -567,9 +603,9 @@ ${yaml}
|
|
|
567
603
|
"stackwright_pro_generate_detail_page",
|
|
568
604
|
"Generate a detail view page for a single API entity. Creates YAML content for displaying all fields of an individual record. Use this to create detail pages that complement collection listing pages.",
|
|
569
605
|
{
|
|
570
|
-
entity:
|
|
571
|
-
slugField:
|
|
572
|
-
specPath:
|
|
606
|
+
entity: import_zod5.z.string().describe('Entity slug (e.g., "equipment")'),
|
|
607
|
+
slugField: import_zod5.z.string().optional().describe('Field to use as URL slug (default: "id")'),
|
|
608
|
+
specPath: import_zod5.z.string().optional().describe("Path to OpenAPI spec for field details")
|
|
573
609
|
},
|
|
574
610
|
async ({ entity, slugField = "id", specPath }) => {
|
|
575
611
|
let fields = [];
|
|
@@ -592,39 +628,49 @@ ${yaml}
|
|
|
592
628
|
` title: "${entityName} Details | {{ ${entity}.${slugField} }}"`,
|
|
593
629
|
"",
|
|
594
630
|
" content_items:",
|
|
595
|
-
" -
|
|
596
|
-
'
|
|
597
|
-
"
|
|
598
|
-
`
|
|
599
|
-
'
|
|
600
|
-
"
|
|
601
|
-
`
|
|
602
|
-
'
|
|
603
|
-
' background: "primary"',
|
|
604
|
-
' color: "text"',
|
|
631
|
+
" - type: text_block",
|
|
632
|
+
' label: "detail-header"',
|
|
633
|
+
" heading:",
|
|
634
|
+
` text: "{{ ${entity}.${slugField} }}"`,
|
|
635
|
+
' textSize: "h1"',
|
|
636
|
+
" textBlocks:",
|
|
637
|
+
` - text: "Details for this ${entity}"`,
|
|
638
|
+
' textSize: "body1"',
|
|
605
639
|
"",
|
|
606
|
-
" - grid
|
|
607
|
-
'
|
|
608
|
-
"
|
|
609
|
-
" items:"
|
|
640
|
+
" - type: grid",
|
|
641
|
+
' label: "detail-fields"',
|
|
642
|
+
" columns:"
|
|
610
643
|
];
|
|
611
644
|
const displayFields = fields.length > 0 ? fields.slice(0, 8) : [
|
|
612
645
|
{ name: slugField, type: "string" },
|
|
613
646
|
{ name: "created_at", type: "datetime" },
|
|
614
647
|
{ name: "updated_at", type: "datetime" }
|
|
615
648
|
];
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
yamlLines.push(
|
|
621
|
-
yamlLines.push(
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
649
|
+
const mid = Math.ceil(displayFields.length / 2);
|
|
650
|
+
const col1 = displayFields.slice(0, mid);
|
|
651
|
+
const col2 = displayFields.slice(mid);
|
|
652
|
+
for (const [colIndex, colFields] of [col1, col2].entries()) {
|
|
653
|
+
yamlLines.push(" - width: 1");
|
|
654
|
+
yamlLines.push(" content_items:");
|
|
655
|
+
for (const field of colFields) {
|
|
656
|
+
const label = field.name.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase());
|
|
657
|
+
yamlLines.push(" - type: text_block");
|
|
658
|
+
yamlLines.push(` label: "${field.name}-field"`);
|
|
659
|
+
yamlLines.push(" heading:");
|
|
660
|
+
yamlLines.push(` text: "${label}"`);
|
|
661
|
+
yamlLines.push(' textSize: "h4"');
|
|
662
|
+
yamlLines.push(" textBlocks:");
|
|
663
|
+
yamlLines.push(` - text: "{{ ${entity}.${field.name} }}"`);
|
|
664
|
+
yamlLines.push(' textSize: "body1"');
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
yamlLines.push("");
|
|
668
|
+
yamlLines.push(" - type: action_bar");
|
|
669
|
+
yamlLines.push(" actions:");
|
|
670
|
+
yamlLines.push(` - label: "<- Back to ${entityName}"`);
|
|
671
|
+
yamlLines.push(" action: navigate");
|
|
672
|
+
yamlLines.push(` href: "/${entity}"`);
|
|
673
|
+
yamlLines.push(" style: secondary");
|
|
628
674
|
const yaml = yamlLines.join("\n");
|
|
629
675
|
return {
|
|
630
676
|
content: [
|
|
@@ -645,7 +691,7 @@ ${yaml}
|
|
|
645
691
|
}
|
|
646
692
|
|
|
647
693
|
// src/tools/clarification.ts
|
|
648
|
-
var
|
|
694
|
+
var import_zod6 = require("zod");
|
|
649
695
|
var CONTRADICTION_PATTERNS = [
|
|
650
696
|
{
|
|
651
697
|
keywords: ["minimal", "clean", "simple"],
|
|
@@ -733,12 +779,14 @@ function registerClarificationTools(server2) {
|
|
|
733
779
|
"stackwright_pro_clarify",
|
|
734
780
|
"Ask the user for clarification when a specialist otter encounters ambiguity. This is for MID-EXECUTION questions, NOT upfront question collection (use the Question Manifest Protocol for that). Returns a structured response for the foreman to present to the user via ask_user_question (closed_choice) or directly (open_text).",
|
|
735
781
|
{
|
|
736
|
-
context:
|
|
737
|
-
question_type:
|
|
738
|
-
question:
|
|
739
|
-
choices:
|
|
740
|
-
|
|
741
|
-
|
|
782
|
+
context: import_zod6.z.string().optional().describe("Context about what the otter is trying to do"),
|
|
783
|
+
question_type: import_zod6.z.enum(["closed_choice", "open_text"]).describe("Type of question being asked"),
|
|
784
|
+
question: import_zod6.z.string().describe("The clarification question to ask the user"),
|
|
785
|
+
choices: jsonCoerce(import_zod6.z.array(import_zod6.z.string()).optional()).describe(
|
|
786
|
+
"Options for closed_choice questions"
|
|
787
|
+
),
|
|
788
|
+
priority: import_zod6.z.enum(["blocking", "preferred", "optional"]).optional().default("preferred").describe("How critical is this clarification? Default: preferred"),
|
|
789
|
+
target_field: import_zod6.z.string().optional().describe("What field/config does this clarify?")
|
|
742
790
|
},
|
|
743
791
|
async ({ context, question_type, question, choices, priority, target_field }) => {
|
|
744
792
|
const result = handleClarify({
|
|
@@ -767,8 +815,10 @@ function registerClarificationTools(server2) {
|
|
|
767
815
|
"stackwright_pro_detect_conflict",
|
|
768
816
|
"Detect when a user's stated preference conflicts with their selected choices. Uses keyword heuristics against known contradiction patterns (minimal vs vibrant, dark vs light, etc). Returns conflict details and resolution options.",
|
|
769
817
|
{
|
|
770
|
-
stated_preference:
|
|
771
|
-
selected_values:
|
|
818
|
+
stated_preference: import_zod6.z.string().describe("What the user said they wanted"),
|
|
819
|
+
selected_values: jsonCoerce(import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string())).describe(
|
|
820
|
+
"What the user actually selected (field \u2192 value)"
|
|
821
|
+
)
|
|
772
822
|
},
|
|
773
823
|
async ({ stated_preference, selected_values }) => {
|
|
774
824
|
const result = handleDetectConflict({ stated_preference, selected_values });
|
|
@@ -813,7 +863,7 @@ ${result.resolution_options?.map((o) => ` \u2022 ${o}`).join("\n")}
|
|
|
813
863
|
}
|
|
814
864
|
|
|
815
865
|
// src/tools/packages.ts
|
|
816
|
-
var
|
|
866
|
+
var import_zod7 = require("zod");
|
|
817
867
|
var import_fs2 = require("fs");
|
|
818
868
|
var import_child_process = require("child_process");
|
|
819
869
|
var import_path2 = __toESM(require("path"));
|
|
@@ -834,17 +884,23 @@ function registerPackageTools(server2) {
|
|
|
834
884
|
"Ensures pro packages are present in a project's package.json. Safe to call multiple times \u2014 never overwrites existing version pins. Use this to bootstrap dependencies before specialist otters run. Pass includeBaseline: true to automatically include all required @stackwright-pro/* baseline dependencies. Safe to call on existing projects \u2014 never overwrites pinned versions.",
|
|
835
885
|
{
|
|
836
886
|
// FIX 3 (B-new-1): Zod v4 requires two-arg z.record(keySchema, valueSchema)
|
|
837
|
-
packages:
|
|
838
|
-
'Dependencies to add. Record<packageName, version>. e.g. { "@stackwright-pro/auth": "latest" }'
|
|
887
|
+
packages: jsonCoerce(import_zod7.z.record(import_zod7.z.string(), import_zod7.z.string()).optional().default({})).describe(
|
|
888
|
+
'Dependencies to add. Record<packageName, version>. e.g. { "@stackwright-pro/auth": "latest" }. Omit or pass {} when using includeBaseline: true.'
|
|
889
|
+
),
|
|
890
|
+
devPackages: jsonCoerce(import_zod7.z.record(import_zod7.z.string(), import_zod7.z.string()).optional()).describe(
|
|
891
|
+
"devDependencies to add. Same format as packages."
|
|
839
892
|
),
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
893
|
+
scripts: jsonCoerce(import_zod7.z.record(import_zod7.z.string(), import_zod7.z.string()).optional()).describe(
|
|
894
|
+
"npm scripts to add. Only adds if key does not already exist."
|
|
895
|
+
),
|
|
896
|
+
targetDir: import_zod7.z.string().optional().describe(
|
|
843
897
|
"Project directory containing package.json. Defaults to process.cwd(). Must be an absolute path within the current working directory."
|
|
844
898
|
),
|
|
845
|
-
runInstall:
|
|
846
|
-
|
|
847
|
-
|
|
899
|
+
runInstall: boolCoerce(import_zod7.z.boolean().optional().default(true)).describe(
|
|
900
|
+
"Run pnpm install after writing package.json. Defaults to true. Pass boolean true/false."
|
|
901
|
+
),
|
|
902
|
+
includeBaseline: boolCoerce(import_zod7.z.boolean().optional().default(false)).describe(
|
|
903
|
+
"When true, automatically merges BASELINE_DEPS and BASELINE_DEV_DEPS before applying packages/devPackages args. Safe to call on existing projects \u2014 never overwrites pinned versions. Pass boolean true/false."
|
|
848
904
|
)
|
|
849
905
|
},
|
|
850
906
|
async ({ packages, devPackages, scripts, targetDir, runInstall, includeBaseline }) => {
|
|
@@ -1002,11 +1058,11 @@ function setupPackages(opts) {
|
|
|
1002
1058
|
}
|
|
1003
1059
|
}
|
|
1004
1060
|
const raw = (0, import_fs2.readFileSync)(realPackageJsonPath, "utf8");
|
|
1005
|
-
const PackageJsonSchema =
|
|
1061
|
+
const PackageJsonSchema = import_zod7.z.object({
|
|
1006
1062
|
// Zod v4: z.record(keySchema, valueSchema) — two-arg form required
|
|
1007
|
-
dependencies:
|
|
1008
|
-
devDependencies:
|
|
1009
|
-
scripts:
|
|
1063
|
+
dependencies: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.string()).optional(),
|
|
1064
|
+
devDependencies: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.string()).optional(),
|
|
1065
|
+
scripts: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.string()).optional()
|
|
1010
1066
|
}).passthrough();
|
|
1011
1067
|
const schemaResult = PackageJsonSchema.safeParse(JSON.parse(raw));
|
|
1012
1068
|
if (!schemaResult.success) {
|
|
@@ -1088,8 +1144,9 @@ function setupPackages(opts) {
|
|
|
1088
1144
|
|
|
1089
1145
|
// src/tools/questions.ts
|
|
1090
1146
|
var import_promises = require("fs/promises");
|
|
1147
|
+
var import_node_fs = require("fs");
|
|
1091
1148
|
var import_node_path = require("path");
|
|
1092
|
-
var
|
|
1149
|
+
var import_zod8 = require("zod");
|
|
1093
1150
|
|
|
1094
1151
|
// src/question-adapter.ts
|
|
1095
1152
|
function truncate(str, maxLength) {
|
|
@@ -1275,22 +1332,22 @@ function answersToManifestFormat(answers, questions) {
|
|
|
1275
1332
|
}
|
|
1276
1333
|
|
|
1277
1334
|
// src/tools/questions.ts
|
|
1278
|
-
var ManifestQuestionSchema =
|
|
1279
|
-
id:
|
|
1280
|
-
question:
|
|
1281
|
-
type:
|
|
1282
|
-
required:
|
|
1283
|
-
options:
|
|
1284
|
-
|
|
1285
|
-
label:
|
|
1286
|
-
value:
|
|
1335
|
+
var ManifestQuestionSchema = import_zod8.z.object({
|
|
1336
|
+
id: import_zod8.z.string(),
|
|
1337
|
+
question: import_zod8.z.string(),
|
|
1338
|
+
type: import_zod8.z.enum(["text", "select", "multi-select", "confirm"]),
|
|
1339
|
+
required: import_zod8.z.boolean().optional(),
|
|
1340
|
+
options: import_zod8.z.array(
|
|
1341
|
+
import_zod8.z.object({
|
|
1342
|
+
label: import_zod8.z.string(),
|
|
1343
|
+
value: import_zod8.z.string()
|
|
1287
1344
|
})
|
|
1288
1345
|
).optional(),
|
|
1289
|
-
default:
|
|
1290
|
-
help:
|
|
1291
|
-
dependsOn:
|
|
1292
|
-
questionId:
|
|
1293
|
-
value:
|
|
1346
|
+
default: import_zod8.z.union([import_zod8.z.string(), import_zod8.z.boolean(), import_zod8.z.array(import_zod8.z.string())]).optional(),
|
|
1347
|
+
help: import_zod8.z.string().optional(),
|
|
1348
|
+
dependsOn: import_zod8.z.object({
|
|
1349
|
+
questionId: import_zod8.z.string(),
|
|
1350
|
+
value: import_zod8.z.union([import_zod8.z.string(), import_zod8.z.array(import_zod8.z.string())])
|
|
1294
1351
|
}).optional()
|
|
1295
1352
|
});
|
|
1296
1353
|
function registerQuestionTools(server2) {
|
|
@@ -1298,11 +1355,13 @@ function registerQuestionTools(server2) {
|
|
|
1298
1355
|
"stackwright_pro_present_phase_questions",
|
|
1299
1356
|
"Adapt manifest-format questions from a specialist otter and present them to the user via ask_user_question. Pass only the phase name \u2014 this tool reads questions from .stackwright/question-manifest.json automatically. The questions parameter is optional and only needed if the manifest has not been written yet. Use this instead of calling ask_user_question directly \u2014 it handles label truncation (50-char limit), header generation, confirm/text defaults, and correct array formatting automatically. IMPORTANT: This is the ONLY approved way to prepare questions before calling ask_user_question. Never call ask_user_question with raw manifest questions. Never retry ask_user_question validation errors by calling it directly \u2014 always re-call this tool.",
|
|
1300
1357
|
{
|
|
1301
|
-
phase:
|
|
1302
|
-
questions:
|
|
1358
|
+
phase: import_zod8.z.string().describe('Phase name for display context, e.g. "designer", "api", "auth"'),
|
|
1359
|
+
questions: jsonCoerce(import_zod8.z.array(ManifestQuestionSchema).optional()).describe(
|
|
1303
1360
|
"Questions in Question Manifest format. If omitted, questions are read from .stackwright/question-manifest.json using the phase name."
|
|
1304
1361
|
),
|
|
1305
|
-
answers:
|
|
1362
|
+
answers: jsonCoerce(
|
|
1363
|
+
import_zod8.z.record(import_zod8.z.string(), import_zod8.z.union([import_zod8.z.string(), import_zod8.z.array(import_zod8.z.string()), import_zod8.z.boolean()])).optional()
|
|
1364
|
+
).describe("Previously collected answers used to resolve dependsOn conditions")
|
|
1306
1365
|
},
|
|
1307
1366
|
async ({ phase, questions, answers }) => {
|
|
1308
1367
|
let resolvedQuestions;
|
|
@@ -1353,17 +1412,36 @@ function registerQuestionTools(server2) {
|
|
|
1353
1412
|
}
|
|
1354
1413
|
}
|
|
1355
1414
|
const adapted = adaptQuestions(resolvedQuestions, answers ?? {});
|
|
1415
|
+
const labelSchema = import_zod8.z.string().max(50, "Value should have at most 50 characters");
|
|
1416
|
+
for (const q of adapted) {
|
|
1417
|
+
for (const opt of q.options) {
|
|
1418
|
+
const check = labelSchema.safeParse(opt.label);
|
|
1419
|
+
if (!check.success) {
|
|
1420
|
+
return {
|
|
1421
|
+
content: [
|
|
1422
|
+
{
|
|
1423
|
+
type: "text",
|
|
1424
|
+
text: JSON.stringify({
|
|
1425
|
+
error: `Option label for phase "${phase}" exceeds 50 characters: ${check.error.issues[0]?.message ?? "label too long"}. Truncate option labels to \u226450 characters before calling this tool.`
|
|
1426
|
+
})
|
|
1427
|
+
}
|
|
1428
|
+
],
|
|
1429
|
+
isError: true
|
|
1430
|
+
};
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1356
1434
|
if (adapted.length === 0) {
|
|
1357
1435
|
return {
|
|
1358
1436
|
content: [
|
|
1359
1437
|
{
|
|
1360
1438
|
type: "text",
|
|
1361
|
-
text:
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1439
|
+
text: `Phase "${phase}" has no questions to present. Do NOT call ask_user_question. Call stackwright_pro_save_phase_answers({ phase: "${phase}", rawAnswers: [] }) directly, then proceed to the execution step for this phase.`
|
|
1440
|
+
},
|
|
1441
|
+
{
|
|
1442
|
+
type: "text",
|
|
1443
|
+
// Empty array — second block always present so the foreman's two-block contract holds
|
|
1444
|
+
text: JSON.stringify([])
|
|
1367
1445
|
}
|
|
1368
1446
|
],
|
|
1369
1447
|
isError: false
|
|
@@ -1384,10 +1462,148 @@ function registerQuestionTools(server2) {
|
|
|
1384
1462
|
};
|
|
1385
1463
|
}
|
|
1386
1464
|
);
|
|
1465
|
+
server2.tool(
|
|
1466
|
+
"stackwright_pro_get_next_question",
|
|
1467
|
+
"Returns the next unanswered question for a phase as a plain JSON object \u2014 one question at a time. Returns { done: true } when all questions are answered or the phase has no questions. Call this in a loop: present the question in plain chat, get user reply, call record_answer, repeat.",
|
|
1468
|
+
{ phase: import_zod8.z.string().describe('Phase name e.g. "designer", "api", "auth"') },
|
|
1469
|
+
async ({ phase }) => {
|
|
1470
|
+
const SAFE_PHASE = /^[a-z][a-z0-9-]{0,30}$/;
|
|
1471
|
+
if (!SAFE_PHASE.test(phase)) {
|
|
1472
|
+
return {
|
|
1473
|
+
content: [
|
|
1474
|
+
{
|
|
1475
|
+
type: "text",
|
|
1476
|
+
text: JSON.stringify({ error: `Invalid phase name: "${phase.slice(0, 50)}"` })
|
|
1477
|
+
}
|
|
1478
|
+
],
|
|
1479
|
+
isError: true
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
const cwd = process.cwd();
|
|
1483
|
+
const questionsPath = (0, import_node_path.join)(cwd, ".stackwright", "questions", `${phase}.json`);
|
|
1484
|
+
let questions = [];
|
|
1485
|
+
try {
|
|
1486
|
+
const raw = await (0, import_promises.readFile)(questionsPath, "utf-8");
|
|
1487
|
+
const parsed = JSON.parse(raw);
|
|
1488
|
+
questions = parsed.questions ?? [];
|
|
1489
|
+
} catch {
|
|
1490
|
+
return { content: [{ type: "text", text: JSON.stringify({ done: true }) }] };
|
|
1491
|
+
}
|
|
1492
|
+
if (questions.length === 0) {
|
|
1493
|
+
return { content: [{ type: "text", text: JSON.stringify({ done: true }) }] };
|
|
1494
|
+
}
|
|
1495
|
+
const answersPath = (0, import_node_path.join)(cwd, ".stackwright", "answers", `${phase}.json`);
|
|
1496
|
+
let answeredIds = /* @__PURE__ */ new Set();
|
|
1497
|
+
try {
|
|
1498
|
+
const raw = await (0, import_promises.readFile)(answersPath, "utf-8");
|
|
1499
|
+
const parsed = JSON.parse(raw);
|
|
1500
|
+
answeredIds = new Set(Object.keys(parsed.answers ?? {}));
|
|
1501
|
+
} catch {
|
|
1502
|
+
}
|
|
1503
|
+
const next = questions.find((q) => !answeredIds.has(q.id));
|
|
1504
|
+
if (!next) {
|
|
1505
|
+
return { content: [{ type: "text", text: JSON.stringify({ done: true }) }] };
|
|
1506
|
+
}
|
|
1507
|
+
return {
|
|
1508
|
+
content: [
|
|
1509
|
+
{
|
|
1510
|
+
type: "text",
|
|
1511
|
+
text: JSON.stringify({
|
|
1512
|
+
done: false,
|
|
1513
|
+
questionId: next.id,
|
|
1514
|
+
question: next.question,
|
|
1515
|
+
type: next.type,
|
|
1516
|
+
options: next.options ?? null,
|
|
1517
|
+
help: next.help ?? null,
|
|
1518
|
+
index: questions.indexOf(next) + 1,
|
|
1519
|
+
total: questions.length
|
|
1520
|
+
})
|
|
1521
|
+
}
|
|
1522
|
+
]
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
);
|
|
1526
|
+
server2.tool(
|
|
1527
|
+
"stackwright_pro_record_answer",
|
|
1528
|
+
"Records a single answer to a phase question. Appends to .stackwright/answers/{phase}.json incrementally. Idempotent \u2014 calling twice for the same questionId overwrites. Call after receiving each user reply in the conversational question loop.",
|
|
1529
|
+
{
|
|
1530
|
+
phase: import_zod8.z.string().describe('Phase name e.g. "designer"'),
|
|
1531
|
+
questionId: import_zod8.z.string().describe('The question ID from get_next_question, e.g. "designer-1"'),
|
|
1532
|
+
answer: import_zod8.z.string().describe("The user's free-text answer")
|
|
1533
|
+
},
|
|
1534
|
+
async ({ phase, questionId, answer }) => {
|
|
1535
|
+
const SAFE_PHASE = /^[a-z][a-z0-9-]{0,30}$/;
|
|
1536
|
+
if (!SAFE_PHASE.test(phase)) {
|
|
1537
|
+
return {
|
|
1538
|
+
content: [
|
|
1539
|
+
{ type: "text", text: JSON.stringify({ error: "Invalid phase name" }) }
|
|
1540
|
+
],
|
|
1541
|
+
isError: true
|
|
1542
|
+
};
|
|
1543
|
+
}
|
|
1544
|
+
if (!/^[a-z0-9][a-z0-9-]{0,63}$/i.test(questionId)) {
|
|
1545
|
+
return {
|
|
1546
|
+
content: [
|
|
1547
|
+
{ type: "text", text: JSON.stringify({ error: "Invalid questionId" }) }
|
|
1548
|
+
],
|
|
1549
|
+
isError: true
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
const safeAnswer = answer.slice(0, 2e3);
|
|
1553
|
+
const cwd = process.cwd();
|
|
1554
|
+
const answersDir = (0, import_node_path.join)(cwd, ".stackwright", "answers");
|
|
1555
|
+
const answersPath = (0, import_node_path.join)(answersDir, `${phase}.json`);
|
|
1556
|
+
if ((0, import_node_fs.existsSync)(answersDir) && (0, import_node_fs.lstatSync)(answersDir).isSymbolicLink()) {
|
|
1557
|
+
return {
|
|
1558
|
+
content: [
|
|
1559
|
+
{
|
|
1560
|
+
type: "text",
|
|
1561
|
+
text: JSON.stringify({ error: "answers dir is a symlink \u2014 refusing to write" })
|
|
1562
|
+
}
|
|
1563
|
+
],
|
|
1564
|
+
isError: true
|
|
1565
|
+
};
|
|
1566
|
+
}
|
|
1567
|
+
(0, import_node_fs.mkdirSync)(answersDir, { recursive: true });
|
|
1568
|
+
let existing = {
|
|
1569
|
+
version: "1.0",
|
|
1570
|
+
phase,
|
|
1571
|
+
answers: {}
|
|
1572
|
+
};
|
|
1573
|
+
try {
|
|
1574
|
+
if ((0, import_node_fs.existsSync)(answersPath)) {
|
|
1575
|
+
if ((0, import_node_fs.lstatSync)(answersPath).isSymbolicLink()) {
|
|
1576
|
+
return {
|
|
1577
|
+
content: [
|
|
1578
|
+
{
|
|
1579
|
+
type: "text",
|
|
1580
|
+
text: JSON.stringify({ error: "answers file is a symlink \u2014 refusing to write" })
|
|
1581
|
+
}
|
|
1582
|
+
],
|
|
1583
|
+
isError: true
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1586
|
+
const raw = await (0, import_promises.readFile)(answersPath, "utf-8");
|
|
1587
|
+
existing = JSON.parse(raw);
|
|
1588
|
+
}
|
|
1589
|
+
} catch {
|
|
1590
|
+
}
|
|
1591
|
+
existing.answers[questionId] = safeAnswer;
|
|
1592
|
+
existing.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1593
|
+
const tmp = `${answersPath}.tmp`;
|
|
1594
|
+
await (0, import_promises.writeFile)(tmp, JSON.stringify(existing, null, 2), "utf-8");
|
|
1595
|
+
(0, import_node_fs.renameSync)(tmp, answersPath);
|
|
1596
|
+
return {
|
|
1597
|
+
content: [
|
|
1598
|
+
{ type: "text", text: JSON.stringify({ recorded: true, phase, questionId }) }
|
|
1599
|
+
]
|
|
1600
|
+
};
|
|
1601
|
+
}
|
|
1602
|
+
);
|
|
1387
1603
|
}
|
|
1388
1604
|
|
|
1389
1605
|
// src/tools/orchestration.ts
|
|
1390
|
-
var
|
|
1606
|
+
var import_zod9 = require("zod");
|
|
1391
1607
|
var import_fs3 = require("fs");
|
|
1392
1608
|
var import_path3 = require("path");
|
|
1393
1609
|
var OTTER_NAME_TO_PHASE = [
|
|
@@ -1398,7 +1614,9 @@ var OTTER_NAME_TO_PHASE = [
|
|
|
1398
1614
|
["dashboard", "dashboard"],
|
|
1399
1615
|
["data", "data"],
|
|
1400
1616
|
["page", "pages"],
|
|
1401
|
-
["workflow", "workflow"]
|
|
1617
|
+
["workflow", "workflow"],
|
|
1618
|
+
["polish", "polish"],
|
|
1619
|
+
["geo", "geo"]
|
|
1402
1620
|
];
|
|
1403
1621
|
var PHASE_TO_OTTER = {
|
|
1404
1622
|
designer: "stackwright-pro-designer-otter",
|
|
@@ -1408,7 +1626,9 @@ var PHASE_TO_OTTER = {
|
|
|
1408
1626
|
pages: "stackwright-pro-page-otter",
|
|
1409
1627
|
dashboard: "stackwright-pro-dashboard-otter",
|
|
1410
1628
|
data: "stackwright-pro-data-otter",
|
|
1411
|
-
workflow: "stackwright-pro-workflow-otter"
|
|
1629
|
+
workflow: "stackwright-pro-workflow-otter",
|
|
1630
|
+
polish: "stackwright-pro-polish-otter",
|
|
1631
|
+
geo: "stackwright-pro-geo-otter"
|
|
1412
1632
|
};
|
|
1413
1633
|
function detectPhase(otterName) {
|
|
1414
1634
|
const lower = otterName.toLowerCase();
|
|
@@ -1555,13 +1775,63 @@ function handleGetOtterName(input) {
|
|
|
1555
1775
|
isError: false
|
|
1556
1776
|
};
|
|
1557
1777
|
}
|
|
1778
|
+
function handleSaveBuildContext(input) {
|
|
1779
|
+
const cwd = input._cwd ?? process.cwd();
|
|
1780
|
+
const dir = (0, import_path3.join)(cwd, ".stackwright");
|
|
1781
|
+
const filePath = (0, import_path3.join)(dir, "build-context.json");
|
|
1782
|
+
try {
|
|
1783
|
+
(0, import_fs3.mkdirSync)(dir, { recursive: true });
|
|
1784
|
+
if ((0, import_fs3.existsSync)(filePath)) {
|
|
1785
|
+
const stat = (0, import_fs3.lstatSync)(filePath);
|
|
1786
|
+
if (stat.isSymbolicLink()) {
|
|
1787
|
+
return {
|
|
1788
|
+
text: JSON.stringify({
|
|
1789
|
+
success: false,
|
|
1790
|
+
error: `Refusing to write to symlink: ${filePath}`
|
|
1791
|
+
}),
|
|
1792
|
+
isError: true
|
|
1793
|
+
};
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1796
|
+
const payload = {
|
|
1797
|
+
version: "1.0",
|
|
1798
|
+
savedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1799
|
+
buildContext: input.buildContext
|
|
1800
|
+
};
|
|
1801
|
+
(0, import_fs3.writeFileSync)(filePath, JSON.stringify(payload, null, 2) + "\n");
|
|
1802
|
+
return {
|
|
1803
|
+
text: JSON.stringify({ success: true, path: filePath }),
|
|
1804
|
+
isError: false
|
|
1805
|
+
};
|
|
1806
|
+
} catch (err) {
|
|
1807
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1808
|
+
return {
|
|
1809
|
+
text: JSON.stringify({ success: false, error: message }),
|
|
1810
|
+
isError: true
|
|
1811
|
+
};
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1558
1814
|
function registerOrchestrationTools(server2) {
|
|
1815
|
+
server2.tool(
|
|
1816
|
+
"stackwright_pro_save_build_context",
|
|
1817
|
+
`Save the user's initial build description to .stackwright/build-context.json. Call this once at startup after the user answers the opening "what are you building" question. The saved context is automatically prepended to specialist prompts by stackwright_pro_build_specialist_prompt.`,
|
|
1818
|
+
{
|
|
1819
|
+
buildContext: import_zod9.z.string().describe("Free-text description of what the user wants to build")
|
|
1820
|
+
},
|
|
1821
|
+
async ({ buildContext }) => {
|
|
1822
|
+
const { text, isError } = handleSaveBuildContext({ buildContext });
|
|
1823
|
+
return {
|
|
1824
|
+
content: [{ type: "text", text }],
|
|
1825
|
+
isError
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
);
|
|
1559
1829
|
server2.tool(
|
|
1560
1830
|
"stackwright_pro_parse_otter_response",
|
|
1561
1831
|
"Parse and validate a specialist otter's QUESTION_COLLECTION_MODE JSON response. Handles JSON extraction from LLM responses (strips markdown, fixes single quotes, trailing commas). Detects the phase from the otter name. Use this immediately after invoke_agent() to get a validated manifest phase object.",
|
|
1562
1832
|
{
|
|
1563
|
-
otterName:
|
|
1564
|
-
responseText:
|
|
1833
|
+
otterName: import_zod9.z.string().describe('The agent name, e.g. "stackwright-pro-api-otter"'),
|
|
1834
|
+
responseText: import_zod9.z.string().describe("Raw text response from the otter's QUESTION_COLLECTION_MODE invocation")
|
|
1565
1835
|
},
|
|
1566
1836
|
async ({ otterName, responseText }) => {
|
|
1567
1837
|
const { result, isError } = handleParseOtterResponse({ otterName, responseText });
|
|
@@ -1575,16 +1845,18 @@ function registerOrchestrationTools(server2) {
|
|
|
1575
1845
|
"stackwright_pro_save_manifest",
|
|
1576
1846
|
"Write the question manifest to .stackwright/question-manifest.json. Call this after collecting and parsing questions from all otters via stackwright_pro_parse_otter_response.",
|
|
1577
1847
|
{
|
|
1578
|
-
phases:
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1848
|
+
phases: jsonCoerce(
|
|
1849
|
+
import_zod9.z.array(
|
|
1850
|
+
import_zod9.z.object({
|
|
1851
|
+
phase: import_zod9.z.string(),
|
|
1852
|
+
otter: import_zod9.z.string(),
|
|
1853
|
+
questions: import_zod9.z.array(import_zod9.z.any()),
|
|
1854
|
+
requiredPackages: import_zod9.z.object({
|
|
1855
|
+
dependencies: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.string()).optional(),
|
|
1856
|
+
devPackages: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.string()).optional()
|
|
1857
|
+
}).optional()
|
|
1858
|
+
})
|
|
1859
|
+
)
|
|
1588
1860
|
).describe("Array of parsed phase objects from stackwright_pro_parse_otter_response")
|
|
1589
1861
|
},
|
|
1590
1862
|
async ({ phases }) => {
|
|
@@ -1599,15 +1871,21 @@ function registerOrchestrationTools(server2) {
|
|
|
1599
1871
|
"stackwright_pro_save_phase_answers",
|
|
1600
1872
|
"Save user answers for a phase to .stackwright/answers/{phase}.json. Pass rawAnswers directly from ask_user_question and the original manifest questions for label-to-value reverse mapping.",
|
|
1601
1873
|
{
|
|
1602
|
-
phase:
|
|
1603
|
-
rawAnswers:
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1874
|
+
phase: import_zod9.z.string().describe('Phase name, e.g. "designer"'),
|
|
1875
|
+
rawAnswers: jsonCoerce(
|
|
1876
|
+
import_zod9.z.array(
|
|
1877
|
+
import_zod9.z.object({
|
|
1878
|
+
question_header: import_zod9.z.string(),
|
|
1879
|
+
selected_options: import_zod9.z.array(import_zod9.z.string()),
|
|
1880
|
+
other_text: import_zod9.z.string().nullable().optional()
|
|
1881
|
+
})
|
|
1882
|
+
)
|
|
1883
|
+
).describe(
|
|
1884
|
+
"Answers as returned by ask_user_question \u2014 pass the native array, not a JSON string"
|
|
1885
|
+
),
|
|
1886
|
+
questions: jsonCoerce(import_zod9.z.array(import_zod9.z.any()).optional()).describe(
|
|
1887
|
+
"Original manifest questions for label\u2192value reverse-mapping \u2014 pass the native array, not a JSON string"
|
|
1888
|
+
)
|
|
1611
1889
|
},
|
|
1612
1890
|
async ({ phase, rawAnswers, questions }) => {
|
|
1613
1891
|
const { text, isError } = handleSavePhaseAnswers({
|
|
@@ -1625,7 +1903,7 @@ function registerOrchestrationTools(server2) {
|
|
|
1625
1903
|
"stackwright_pro_read_phase_answers",
|
|
1626
1904
|
"Read saved answers for a phase from .stackwright/answers/{phase}.json. Returns { missing: true } when no answers exist yet \u2014 use this to skip phases safely in the execution loop.",
|
|
1627
1905
|
{
|
|
1628
|
-
phase:
|
|
1906
|
+
phase: import_zod9.z.string().describe('Phase name, e.g. "designer"')
|
|
1629
1907
|
},
|
|
1630
1908
|
async ({ phase }) => {
|
|
1631
1909
|
const { text, isError } = handleReadPhaseAnswers({ phase });
|
|
@@ -1639,7 +1917,7 @@ function registerOrchestrationTools(server2) {
|
|
|
1639
1917
|
"stackwright_pro_get_otter_name",
|
|
1640
1918
|
"Get the agent name for a phase (e.g. 'designer' \u2192 'stackwright-pro-designer-otter'). Use this in the execution loop to invoke the correct specialist otter without hardcoding names in the prompt.",
|
|
1641
1919
|
{
|
|
1642
|
-
phase:
|
|
1920
|
+
phase: import_zod9.z.string().describe('Phase name, e.g. "designer", "api", "pages"')
|
|
1643
1921
|
},
|
|
1644
1922
|
async ({ phase }) => {
|
|
1645
1923
|
const { text, isError } = handleGetOtterName({ phase });
|
|
@@ -1652,82 +1930,435 @@ function registerOrchestrationTools(server2) {
|
|
|
1652
1930
|
}
|
|
1653
1931
|
|
|
1654
1932
|
// src/tools/pipeline.ts
|
|
1655
|
-
var
|
|
1933
|
+
var import_zod11 = require("zod");
|
|
1934
|
+
var import_fs5 = require("fs");
|
|
1935
|
+
var import_path5 = require("path");
|
|
1936
|
+
var import_crypto3 = require("crypto");
|
|
1937
|
+
|
|
1938
|
+
// src/artifact-signing.ts
|
|
1939
|
+
var import_crypto2 = require("crypto");
|
|
1656
1940
|
var import_fs4 = require("fs");
|
|
1657
1941
|
var import_path4 = require("path");
|
|
1658
|
-
var
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
theme: ["designer"],
|
|
1671
|
-
api: [],
|
|
1672
|
-
auth: [],
|
|
1673
|
-
data: ["api"],
|
|
1674
|
-
pages: ["designer", "theme", "api", "data", "auth"],
|
|
1675
|
-
dashboard: ["designer", "theme", "api", "data"],
|
|
1676
|
-
workflow: ["auth"]
|
|
1677
|
-
};
|
|
1678
|
-
var PHASE_ARTIFACT = {
|
|
1679
|
-
designer: "design-language.json",
|
|
1680
|
-
theme: "theme-tokens.json",
|
|
1681
|
-
api: "api-config.json",
|
|
1682
|
-
auth: "auth-config.json",
|
|
1683
|
-
data: "data-config.json",
|
|
1684
|
-
pages: "pages-manifest.json",
|
|
1685
|
-
dashboard: "dashboard-manifest.json",
|
|
1686
|
-
workflow: "workflow-config.json"
|
|
1687
|
-
};
|
|
1688
|
-
var PHASE_TO_OTTER2 = {
|
|
1689
|
-
designer: "stackwright-pro-designer-otter",
|
|
1690
|
-
theme: "stackwright-pro-theme-otter",
|
|
1691
|
-
api: "stackwright-pro-api-otter",
|
|
1692
|
-
auth: "stackwright-pro-auth-otter",
|
|
1693
|
-
data: "stackwright-pro-data-otter",
|
|
1694
|
-
pages: "stackwright-pro-page-otter",
|
|
1695
|
-
dashboard: "stackwright-pro-dashboard-otter",
|
|
1696
|
-
workflow: "stackwright-pro-workflow-otter"
|
|
1697
|
-
};
|
|
1698
|
-
function isValidPhase(phase) {
|
|
1699
|
-
return PHASE_ORDER.includes(phase);
|
|
1942
|
+
var import_zod10 = require("zod");
|
|
1943
|
+
var ALGORITHM = "ECDSA-P384-SHA384";
|
|
1944
|
+
var KEY_FILE = "pipeline-keys.json";
|
|
1945
|
+
var KEY_DIR = ".stackwright";
|
|
1946
|
+
var SIGNATURE_MANIFEST = "signatures.json";
|
|
1947
|
+
var ARTIFACTS_DIR = ".stackwright/artifacts";
|
|
1948
|
+
function rejectSymlink(filePath, context) {
|
|
1949
|
+
if (!(0, import_fs4.existsSync)(filePath)) return;
|
|
1950
|
+
const stat = (0, import_fs4.lstatSync)(filePath);
|
|
1951
|
+
if (stat.isSymbolicLink()) {
|
|
1952
|
+
throw new Error(`Security: refusing to follow symlink at ${context}: ${filePath}`);
|
|
1953
|
+
}
|
|
1700
1954
|
}
|
|
1701
|
-
function
|
|
1702
|
-
return
|
|
1703
|
-
questionsCollected: false,
|
|
1704
|
-
answered: false,
|
|
1705
|
-
executed: false,
|
|
1706
|
-
artifactWritten: false,
|
|
1707
|
-
retryCount: 0
|
|
1708
|
-
};
|
|
1955
|
+
function computeSha384(data) {
|
|
1956
|
+
return (0, import_crypto2.createHash)("sha384").update(data).digest("hex");
|
|
1709
1957
|
}
|
|
1710
|
-
function
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
}
|
|
1958
|
+
function safeDigestEqual(a, b) {
|
|
1959
|
+
if (a.length !== b.length) return false;
|
|
1960
|
+
return (0, import_crypto2.timingSafeEqual)(Buffer.from(a, "utf8"), Buffer.from(b, "utf8"));
|
|
1961
|
+
}
|
|
1962
|
+
function emptyManifest() {
|
|
1716
1963
|
return {
|
|
1717
1964
|
version: "1.0",
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
phases,
|
|
1721
|
-
startedAt: now,
|
|
1722
|
-
updatedAt: now
|
|
1965
|
+
algorithm: ALGORITHM,
|
|
1966
|
+
signatures: {}
|
|
1723
1967
|
};
|
|
1724
1968
|
}
|
|
1725
|
-
function
|
|
1726
|
-
|
|
1969
|
+
function initPipelineKeys(cwd) {
|
|
1970
|
+
const keyDir = (0, import_path4.join)(cwd, KEY_DIR);
|
|
1971
|
+
const keyPath = (0, import_path4.join)(keyDir, KEY_FILE);
|
|
1972
|
+
rejectSymlink(keyPath, "pipeline-keys.json");
|
|
1973
|
+
(0, import_fs4.mkdirSync)(keyDir, { recursive: true });
|
|
1974
|
+
const { publicKey, privateKey } = (0, import_crypto2.generateKeyPairSync)("ec", {
|
|
1975
|
+
namedCurve: "P-384"
|
|
1976
|
+
});
|
|
1977
|
+
const publicKeyPem = publicKey.export({ type: "spki", format: "pem" });
|
|
1978
|
+
const privateKeyPem = privateKey.export({ type: "pkcs8", format: "pem" });
|
|
1979
|
+
const fingerprint = (0, import_crypto2.createHash)("sha256").update(publicKeyPem).digest("hex");
|
|
1980
|
+
const keyFile = {
|
|
1981
|
+
version: "1.0",
|
|
1982
|
+
algorithm: ALGORITHM,
|
|
1983
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1984
|
+
publicKeyPem,
|
|
1985
|
+
privateKeyPem
|
|
1986
|
+
};
|
|
1987
|
+
(0, import_fs4.writeFileSync)(keyPath, JSON.stringify(keyFile, null, 2), { encoding: "utf-8" });
|
|
1988
|
+
return { publicKeyPem, fingerprint };
|
|
1989
|
+
}
|
|
1990
|
+
function loadPipelineKeys(cwd) {
|
|
1991
|
+
const keyPath = (0, import_path4.join)(cwd, KEY_DIR, KEY_FILE);
|
|
1992
|
+
rejectSymlink(keyPath, "pipeline-keys.json");
|
|
1993
|
+
if (!(0, import_fs4.existsSync)(keyPath)) {
|
|
1994
|
+
throw new Error("Pipeline keys not found \u2014 call initPipelineKeys() first");
|
|
1995
|
+
}
|
|
1996
|
+
let raw;
|
|
1997
|
+
try {
|
|
1998
|
+
raw = (0, import_fs4.readFileSync)(keyPath, "utf-8");
|
|
1999
|
+
} catch (err) {
|
|
2000
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2001
|
+
throw new Error(`Cannot read pipeline keys: ${msg}`, { cause: err });
|
|
2002
|
+
}
|
|
2003
|
+
let parsed;
|
|
2004
|
+
try {
|
|
2005
|
+
parsed = JSON.parse(raw);
|
|
2006
|
+
} catch {
|
|
2007
|
+
throw new Error("Pipeline keys file is not valid JSON");
|
|
2008
|
+
}
|
|
2009
|
+
if (typeof parsed.publicKeyPem !== "string" || !parsed.publicKeyPem.includes("-----BEGIN PUBLIC KEY-----")) {
|
|
2010
|
+
throw new Error("Invalid public key PEM in pipeline keys file");
|
|
2011
|
+
}
|
|
2012
|
+
if (typeof parsed.privateKeyPem !== "string" || !parsed.privateKeyPem.includes("-----BEGIN")) {
|
|
2013
|
+
throw new Error("Invalid private key PEM in pipeline keys file");
|
|
2014
|
+
}
|
|
2015
|
+
const publicKey = (0, import_crypto2.createPublicKey)(parsed.publicKeyPem);
|
|
2016
|
+
const privateKey = (0, import_crypto2.createPrivateKey)(parsed.privateKeyPem);
|
|
2017
|
+
return { privateKey, publicKey };
|
|
2018
|
+
}
|
|
2019
|
+
function signArtifact(artifactBytes, privateKey) {
|
|
2020
|
+
const digest = computeSha384(artifactBytes);
|
|
2021
|
+
const sig = (0, import_crypto2.sign)("SHA384", artifactBytes, privateKey);
|
|
2022
|
+
return {
|
|
2023
|
+
digest,
|
|
2024
|
+
signature: sig.toString("base64"),
|
|
2025
|
+
algorithm: ALGORITHM,
|
|
2026
|
+
signedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2027
|
+
};
|
|
2028
|
+
}
|
|
2029
|
+
function verifyArtifact(artifactBytes, signature, publicKey) {
|
|
2030
|
+
const sigValid = (0, import_crypto2.verify)(
|
|
2031
|
+
"SHA384",
|
|
2032
|
+
artifactBytes,
|
|
2033
|
+
publicKey,
|
|
2034
|
+
Buffer.from(signature.signature, "base64")
|
|
2035
|
+
);
|
|
2036
|
+
if (!sigValid) return false;
|
|
2037
|
+
const actualDigest = computeSha384(artifactBytes);
|
|
2038
|
+
return safeDigestEqual(actualDigest, signature.digest);
|
|
2039
|
+
}
|
|
2040
|
+
function loadSignatureManifest(cwd) {
|
|
2041
|
+
const manifestPath = (0, import_path4.join)(cwd, ARTIFACTS_DIR, SIGNATURE_MANIFEST);
|
|
2042
|
+
rejectSymlink(manifestPath, "signatures.json");
|
|
2043
|
+
if (!(0, import_fs4.existsSync)(manifestPath)) return emptyManifest();
|
|
2044
|
+
let raw;
|
|
2045
|
+
try {
|
|
2046
|
+
raw = (0, import_fs4.readFileSync)(manifestPath, "utf-8");
|
|
2047
|
+
} catch (err) {
|
|
2048
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2049
|
+
throw new Error(`Cannot read signature manifest: ${msg}`, { cause: err });
|
|
2050
|
+
}
|
|
2051
|
+
try {
|
|
2052
|
+
const parsed = JSON.parse(raw);
|
|
2053
|
+
if (parsed.version !== "1.0" || typeof parsed.signatures !== "object") {
|
|
2054
|
+
throw new Error("Malformed signature manifest: invalid version or missing signatures object");
|
|
2055
|
+
}
|
|
2056
|
+
return parsed;
|
|
2057
|
+
} catch (err) {
|
|
2058
|
+
if (err instanceof Error && err.message.startsWith("Malformed")) throw err;
|
|
2059
|
+
throw new Error("Signature manifest is not valid JSON", { cause: err });
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
function saveArtifactSignature(cwd, artifactFilename, sig, signerOtter) {
|
|
2063
|
+
const artifactsDir = (0, import_path4.join)(cwd, ARTIFACTS_DIR);
|
|
2064
|
+
const manifestPath = (0, import_path4.join)(artifactsDir, SIGNATURE_MANIFEST);
|
|
2065
|
+
rejectSymlink(manifestPath, "signatures.json (save)");
|
|
2066
|
+
(0, import_fs4.mkdirSync)(artifactsDir, { recursive: true });
|
|
2067
|
+
const manifest = loadSignatureManifest(cwd);
|
|
2068
|
+
manifest.signatures[artifactFilename] = {
|
|
2069
|
+
...sig,
|
|
2070
|
+
signedBy: signerOtter
|
|
2071
|
+
};
|
|
2072
|
+
(0, import_fs4.writeFileSync)(manifestPath, JSON.stringify(manifest, null, 2), { encoding: "utf-8" });
|
|
2073
|
+
}
|
|
2074
|
+
function getArtifactSignature(cwd, artifactFilename) {
|
|
2075
|
+
const manifest = loadSignatureManifest(cwd);
|
|
2076
|
+
const entry = manifest.signatures[artifactFilename];
|
|
2077
|
+
if (!entry) return null;
|
|
2078
|
+
return {
|
|
2079
|
+
digest: entry.digest,
|
|
2080
|
+
signature: entry.signature,
|
|
2081
|
+
algorithm: entry.algorithm,
|
|
2082
|
+
signedAt: entry.signedAt
|
|
2083
|
+
};
|
|
2084
|
+
}
|
|
2085
|
+
function emitSignatureAuditEvent(params) {
|
|
2086
|
+
const record = JSON.stringify({
|
|
2087
|
+
level: "AUDIT",
|
|
2088
|
+
event: "ARTIFACT_SIGNATURE_FAIL",
|
|
2089
|
+
timestamp: params.timestamp,
|
|
2090
|
+
source: params.source,
|
|
2091
|
+
artifactFilename: params.artifactFilename,
|
|
2092
|
+
expectedDigest: params.expectedDigest,
|
|
2093
|
+
actualDigest: params.actualDigest,
|
|
2094
|
+
phase: params.phase
|
|
2095
|
+
});
|
|
2096
|
+
process.stderr.write(`ARTIFACT_SIGNATURE_FAIL ${record}
|
|
2097
|
+
`);
|
|
2098
|
+
}
|
|
2099
|
+
function registerArtifactSigningTools(server2) {
|
|
2100
|
+
server2.tool(
|
|
2101
|
+
"stackwright_pro_verify_artifact_signatures",
|
|
2102
|
+
"Verify ECDSA P-384 signatures for all pipeline artifacts in .stackwright/artifacts/. Auto-discovers keys from .stackwright/pipeline-keys.json. Returns per-artifact verification status.",
|
|
2103
|
+
{
|
|
2104
|
+
cwd: import_zod10.z.string().optional().describe("Project root directory. Defaults to process.cwd().")
|
|
2105
|
+
},
|
|
2106
|
+
async ({ cwd: cwdParam }) => {
|
|
2107
|
+
const cwd = cwdParam ?? process.cwd();
|
|
2108
|
+
let publicKey;
|
|
2109
|
+
try {
|
|
2110
|
+
const keys = loadPipelineKeys(cwd);
|
|
2111
|
+
publicKey = keys.publicKey;
|
|
2112
|
+
} catch (err) {
|
|
2113
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2114
|
+
return {
|
|
2115
|
+
content: [
|
|
2116
|
+
{
|
|
2117
|
+
type: "text",
|
|
2118
|
+
text: JSON.stringify({
|
|
2119
|
+
error: true,
|
|
2120
|
+
message: `Cannot load pipeline keys: ${msg}`
|
|
2121
|
+
})
|
|
2122
|
+
}
|
|
2123
|
+
],
|
|
2124
|
+
isError: true
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
let manifest;
|
|
2128
|
+
try {
|
|
2129
|
+
manifest = loadSignatureManifest(cwd);
|
|
2130
|
+
} catch (err) {
|
|
2131
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2132
|
+
return {
|
|
2133
|
+
content: [
|
|
2134
|
+
{
|
|
2135
|
+
type: "text",
|
|
2136
|
+
text: JSON.stringify({
|
|
2137
|
+
error: true,
|
|
2138
|
+
message: `Cannot load signature manifest: ${msg}`
|
|
2139
|
+
})
|
|
2140
|
+
}
|
|
2141
|
+
],
|
|
2142
|
+
isError: true
|
|
2143
|
+
};
|
|
2144
|
+
}
|
|
2145
|
+
const artifactsPath = (0, import_path4.join)(cwd, ARTIFACTS_DIR);
|
|
2146
|
+
let artifactFiles = [];
|
|
2147
|
+
try {
|
|
2148
|
+
if ((0, import_fs4.existsSync)(artifactsPath)) {
|
|
2149
|
+
artifactFiles = (0, import_fs4.readdirSync)(artifactsPath).filter(
|
|
2150
|
+
(f) => f.endsWith(".json") && f !== SIGNATURE_MANIFEST
|
|
2151
|
+
);
|
|
2152
|
+
}
|
|
2153
|
+
} catch {
|
|
2154
|
+
}
|
|
2155
|
+
const results = [];
|
|
2156
|
+
let hasFailure = false;
|
|
2157
|
+
for (const filename of artifactFiles) {
|
|
2158
|
+
const filePath = (0, import_path4.join)(artifactsPath, filename);
|
|
2159
|
+
try {
|
|
2160
|
+
rejectSymlink(filePath, `artifact ${filename}`);
|
|
2161
|
+
} catch {
|
|
2162
|
+
results.push({
|
|
2163
|
+
filename,
|
|
2164
|
+
verified: false,
|
|
2165
|
+
error: "Refusing to verify symlink"
|
|
2166
|
+
});
|
|
2167
|
+
hasFailure = true;
|
|
2168
|
+
continue;
|
|
2169
|
+
}
|
|
2170
|
+
let artifactBytes;
|
|
2171
|
+
try {
|
|
2172
|
+
artifactBytes = (0, import_fs4.readFileSync)(filePath);
|
|
2173
|
+
} catch (err) {
|
|
2174
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
2175
|
+
results.push({
|
|
2176
|
+
filename,
|
|
2177
|
+
verified: false,
|
|
2178
|
+
error: `Cannot read artifact: ${msg}`
|
|
2179
|
+
});
|
|
2180
|
+
hasFailure = true;
|
|
2181
|
+
continue;
|
|
2182
|
+
}
|
|
2183
|
+
const entry = manifest.signatures[filename];
|
|
2184
|
+
if (!entry) {
|
|
2185
|
+
results.push({
|
|
2186
|
+
filename,
|
|
2187
|
+
verified: false,
|
|
2188
|
+
error: "No signature found in manifest"
|
|
2189
|
+
});
|
|
2190
|
+
hasFailure = true;
|
|
2191
|
+
continue;
|
|
2192
|
+
}
|
|
2193
|
+
const sig = {
|
|
2194
|
+
digest: entry.digest,
|
|
2195
|
+
signature: entry.signature,
|
|
2196
|
+
algorithm: entry.algorithm,
|
|
2197
|
+
signedAt: entry.signedAt
|
|
2198
|
+
};
|
|
2199
|
+
const verified = verifyArtifact(artifactBytes, sig, publicKey);
|
|
2200
|
+
if (!verified) {
|
|
2201
|
+
const actualDigest = computeSha384(artifactBytes);
|
|
2202
|
+
emitSignatureAuditEvent({
|
|
2203
|
+
artifactFilename: filename,
|
|
2204
|
+
expectedDigest: sig.digest,
|
|
2205
|
+
actualDigest,
|
|
2206
|
+
phase: entry.signedBy ?? "unknown",
|
|
2207
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2208
|
+
source: "stackwright_pro_verify_artifact_signatures"
|
|
2209
|
+
});
|
|
2210
|
+
results.push({
|
|
2211
|
+
filename,
|
|
2212
|
+
verified: false,
|
|
2213
|
+
error: `Signature verification failed \u2014 artifact may have been tampered with`,
|
|
2214
|
+
signedBy: entry.signedBy,
|
|
2215
|
+
signedAt: entry.signedAt
|
|
2216
|
+
});
|
|
2217
|
+
hasFailure = true;
|
|
2218
|
+
} else {
|
|
2219
|
+
results.push({
|
|
2220
|
+
filename,
|
|
2221
|
+
verified: true,
|
|
2222
|
+
signedBy: entry.signedBy,
|
|
2223
|
+
signedAt: entry.signedAt
|
|
2224
|
+
});
|
|
2225
|
+
}
|
|
2226
|
+
}
|
|
2227
|
+
for (const manifestFilename of Object.keys(manifest.signatures)) {
|
|
2228
|
+
if (!artifactFiles.includes(manifestFilename)) {
|
|
2229
|
+
results.push({
|
|
2230
|
+
filename: manifestFilename,
|
|
2231
|
+
verified: false,
|
|
2232
|
+
error: "Artifact referenced in manifest but missing from disk"
|
|
2233
|
+
});
|
|
2234
|
+
hasFailure = true;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
const verifiedCount = results.filter((r) => r.verified).length;
|
|
2238
|
+
const failedCount = results.filter((r) => !r.verified).length;
|
|
2239
|
+
return {
|
|
2240
|
+
content: [
|
|
2241
|
+
{
|
|
2242
|
+
type: "text",
|
|
2243
|
+
text: JSON.stringify({
|
|
2244
|
+
totalArtifacts: artifactFiles.length,
|
|
2245
|
+
verifiedCount,
|
|
2246
|
+
failedCount,
|
|
2247
|
+
results,
|
|
2248
|
+
...hasFailure ? {
|
|
2249
|
+
error: "SIGNATURE VERIFICATION FAILED: One or more artifact signatures are invalid. Do not proceed \u2014 artifacts may have been tampered with."
|
|
2250
|
+
} : {}
|
|
2251
|
+
})
|
|
2252
|
+
}
|
|
2253
|
+
],
|
|
2254
|
+
isError: hasFailure
|
|
2255
|
+
};
|
|
2256
|
+
}
|
|
2257
|
+
);
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
// src/tools/pipeline.ts
|
|
2261
|
+
var import_types = require("@stackwright-pro/types");
|
|
2262
|
+
var PHASE_ORDER = [
|
|
2263
|
+
"designer",
|
|
2264
|
+
"theme",
|
|
2265
|
+
"api",
|
|
2266
|
+
"data",
|
|
2267
|
+
"geo",
|
|
2268
|
+
"workflow",
|
|
2269
|
+
"services",
|
|
2270
|
+
"pages",
|
|
2271
|
+
"dashboard",
|
|
2272
|
+
"auth",
|
|
2273
|
+
"polish"
|
|
2274
|
+
];
|
|
2275
|
+
var PHASE_DEPENDENCIES = {
|
|
2276
|
+
designer: [],
|
|
2277
|
+
theme: ["designer"],
|
|
2278
|
+
api: [],
|
|
2279
|
+
data: ["api"],
|
|
2280
|
+
geo: ["data"],
|
|
2281
|
+
// workflow: no hard deps — uses service: references with Prism mock fallback
|
|
2282
|
+
// when API artifacts aren't available; roles come from user answers
|
|
2283
|
+
workflow: [],
|
|
2284
|
+
// services: needs API endpoints to know what to wire, and optionally
|
|
2285
|
+
// workflow states as trigger sources. Produces OpenAPI specs consumed
|
|
2286
|
+
// by pages and dashboard for typed data wiring.
|
|
2287
|
+
services: ["api", "workflow"],
|
|
2288
|
+
// pages/dashboard: now also depend on services for typed endpoint wiring
|
|
2289
|
+
// via the OpenAPI specs that services produces.
|
|
2290
|
+
// 'api' is still transitive through 'data'; auth removed — page-otter has
|
|
2291
|
+
// graceful fallback and reads role names from workflow artifacts instead
|
|
2292
|
+
pages: ["designer", "theme", "data", "services"],
|
|
2293
|
+
dashboard: ["designer", "theme", "data", "services"],
|
|
2294
|
+
// auth is the penultimate phase — runs after all content-producing phases
|
|
2295
|
+
// so it can read pages, dashboard, workflow, and geo artifacts for route
|
|
2296
|
+
// protection and RBAC wiring. Skipped upstream phases still satisfy deps
|
|
2297
|
+
// (the foreman marks them executed=true), so auth always runs.
|
|
2298
|
+
auth: ["pages", "dashboard", "workflow", "geo"],
|
|
2299
|
+
// polish is the terminal phase — runs after auth so the landing page and
|
|
2300
|
+
// nav reflect the final set of protected routes and all generated pages.
|
|
2301
|
+
polish: ["auth"]
|
|
2302
|
+
};
|
|
2303
|
+
var PHASE_ARTIFACT = {
|
|
2304
|
+
designer: "design-language.json",
|
|
2305
|
+
theme: "theme-tokens.json",
|
|
2306
|
+
api: "api-config.json",
|
|
2307
|
+
auth: "auth-config.json",
|
|
2308
|
+
data: "data-config.json",
|
|
2309
|
+
pages: "pages-manifest.json",
|
|
2310
|
+
dashboard: "dashboard-manifest.json",
|
|
2311
|
+
workflow: "workflow-config.json",
|
|
2312
|
+
services: "services-config.json",
|
|
2313
|
+
polish: "polish-manifest.json",
|
|
2314
|
+
geo: "geo-manifest.json"
|
|
2315
|
+
};
|
|
2316
|
+
var PHASE_TO_OTTER2 = {
|
|
2317
|
+
designer: "stackwright-pro-designer-otter",
|
|
2318
|
+
theme: "stackwright-pro-theme-otter",
|
|
2319
|
+
api: "stackwright-pro-api-otter",
|
|
2320
|
+
auth: "stackwright-pro-auth-otter",
|
|
2321
|
+
data: "stackwright-pro-data-otter",
|
|
2322
|
+
pages: "stackwright-pro-page-otter",
|
|
2323
|
+
dashboard: "stackwright-pro-dashboard-otter",
|
|
2324
|
+
workflow: "stackwright-pro-workflow-otter",
|
|
2325
|
+
services: "stackwright-services-otter",
|
|
2326
|
+
polish: "stackwright-pro-polish-otter",
|
|
2327
|
+
geo: "stackwright-pro-geo-otter"
|
|
2328
|
+
};
|
|
2329
|
+
function isValidPhase(phase) {
|
|
2330
|
+
return PHASE_ORDER.includes(phase);
|
|
2331
|
+
}
|
|
2332
|
+
function defaultPhaseStatus() {
|
|
2333
|
+
return {
|
|
2334
|
+
questionsCollected: false,
|
|
2335
|
+
answered: false,
|
|
2336
|
+
executed: false,
|
|
2337
|
+
artifactWritten: false,
|
|
2338
|
+
retryCount: 0
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2341
|
+
function createDefaultState() {
|
|
2342
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2343
|
+
const phases = {};
|
|
2344
|
+
for (const p of PHASE_ORDER) {
|
|
2345
|
+
phases[p] = defaultPhaseStatus();
|
|
2346
|
+
}
|
|
2347
|
+
return {
|
|
2348
|
+
version: "1.0",
|
|
2349
|
+
currentPhase: PHASE_ORDER[0],
|
|
2350
|
+
status: "setup",
|
|
2351
|
+
phases,
|
|
2352
|
+
startedAt: now,
|
|
2353
|
+
updatedAt: now
|
|
2354
|
+
};
|
|
2355
|
+
}
|
|
2356
|
+
function statePath(cwd) {
|
|
2357
|
+
return (0, import_path5.join)(cwd, ".stackwright", "pipeline-state.json");
|
|
1727
2358
|
}
|
|
1728
2359
|
function readState(cwd) {
|
|
1729
2360
|
const p = statePath(cwd);
|
|
1730
|
-
if (!(0,
|
|
2361
|
+
if (!(0, import_fs5.existsSync)(p)) return createDefaultState();
|
|
1731
2362
|
const raw = JSON.parse(safeReadSync(p));
|
|
1732
2363
|
if (typeof raw !== "object" || raw === null || raw.version !== "1.0") {
|
|
1733
2364
|
return createDefaultState();
|
|
@@ -1735,26 +2366,26 @@ function readState(cwd) {
|
|
|
1735
2366
|
return raw;
|
|
1736
2367
|
}
|
|
1737
2368
|
function safeWriteSync(filePath, content) {
|
|
1738
|
-
if ((0,
|
|
1739
|
-
const stat = (0,
|
|
2369
|
+
if ((0, import_fs5.existsSync)(filePath)) {
|
|
2370
|
+
const stat = (0, import_fs5.lstatSync)(filePath);
|
|
1740
2371
|
if (stat.isSymbolicLink()) {
|
|
1741
2372
|
throw new Error(`Refusing to write to symlink: ${filePath}`);
|
|
1742
2373
|
}
|
|
1743
2374
|
}
|
|
1744
|
-
(0,
|
|
2375
|
+
(0, import_fs5.writeFileSync)(filePath, content);
|
|
1745
2376
|
}
|
|
1746
2377
|
function safeReadSync(filePath) {
|
|
1747
|
-
if ((0,
|
|
1748
|
-
const stat = (0,
|
|
2378
|
+
if ((0, import_fs5.existsSync)(filePath)) {
|
|
2379
|
+
const stat = (0, import_fs5.lstatSync)(filePath);
|
|
1749
2380
|
if (stat.isSymbolicLink()) {
|
|
1750
2381
|
throw new Error(`Refusing to read symlink: ${filePath}`);
|
|
1751
2382
|
}
|
|
1752
2383
|
}
|
|
1753
|
-
return (0,
|
|
2384
|
+
return (0, import_fs5.readFileSync)(filePath, "utf-8");
|
|
1754
2385
|
}
|
|
1755
2386
|
function writeState(cwd, state) {
|
|
1756
|
-
const dir = (0,
|
|
1757
|
-
(0,
|
|
2387
|
+
const dir = (0, import_path5.join)(cwd, ".stackwright");
|
|
2388
|
+
(0, import_fs5.mkdirSync)(dir, { recursive: true });
|
|
1758
2389
|
state.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1759
2390
|
safeWriteSync(statePath(cwd), JSON.stringify(state, null, 2) + "\n");
|
|
1760
2391
|
}
|
|
@@ -1775,6 +2406,15 @@ function handleGetPipelineState(_cwd) {
|
|
|
1775
2406
|
const cwd = _cwd ?? process.cwd();
|
|
1776
2407
|
try {
|
|
1777
2408
|
const state = readState(cwd);
|
|
2409
|
+
const keyPath = (0, import_path5.join)(cwd, ".stackwright", "pipeline-keys.json");
|
|
2410
|
+
if (!(0, import_fs5.existsSync)(keyPath)) {
|
|
2411
|
+
try {
|
|
2412
|
+
const { fingerprint } = initPipelineKeys(cwd);
|
|
2413
|
+
state["signingKeyFingerprint"] = fingerprint;
|
|
2414
|
+
writeState(cwd, state);
|
|
2415
|
+
} catch {
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
1778
2418
|
return { text: JSON.stringify(state), isError: false };
|
|
1779
2419
|
} catch (err) {
|
|
1780
2420
|
return { text: JSON.stringify({ error: true, message: String(err) }), isError: true };
|
|
@@ -1826,28 +2466,62 @@ function handleSetPipelineState(input) {
|
|
|
1826
2466
|
return { text: JSON.stringify({ error: true, message: String(err) }), isError: true };
|
|
1827
2467
|
}
|
|
1828
2468
|
}
|
|
1829
|
-
function handleCheckExecutionReady(_cwd) {
|
|
2469
|
+
function handleCheckExecutionReady(_cwd, phase) {
|
|
1830
2470
|
const cwd = _cwd ?? process.cwd();
|
|
2471
|
+
if (phase) {
|
|
2472
|
+
if (!isValidPhase(phase)) {
|
|
2473
|
+
return {
|
|
2474
|
+
text: JSON.stringify({
|
|
2475
|
+
error: true,
|
|
2476
|
+
message: `Invalid phase: ${phase}. Valid phases are: ${PHASE_ORDER.join(", ")}`
|
|
2477
|
+
}),
|
|
2478
|
+
isError: true
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
const answerFile = (0, import_path5.join)(cwd, ".stackwright", "answers", `${phase}.json`);
|
|
2482
|
+
if (!(0, import_fs5.existsSync)(answerFile)) {
|
|
2483
|
+
return {
|
|
2484
|
+
text: JSON.stringify({ ready: false, phase, reason: "Answer file not found" }),
|
|
2485
|
+
isError: false
|
|
2486
|
+
};
|
|
2487
|
+
}
|
|
2488
|
+
try {
|
|
2489
|
+
const raw = safeReadSync(answerFile);
|
|
2490
|
+
const parsed = JSON.parse(raw);
|
|
2491
|
+
if (typeof parsed["version"] !== "string" || typeof parsed["phase"] !== "string" || typeof parsed["answers"] !== "object" || parsed["answers"] === null) {
|
|
2492
|
+
return {
|
|
2493
|
+
text: JSON.stringify({ ready: false, phase, reason: "Answer file is malformed" }),
|
|
2494
|
+
isError: false
|
|
2495
|
+
};
|
|
2496
|
+
}
|
|
2497
|
+
return { text: JSON.stringify({ ready: true, phase }), isError: false };
|
|
2498
|
+
} catch {
|
|
2499
|
+
return {
|
|
2500
|
+
text: JSON.stringify({ ready: false, phase, reason: "Answer file could not be parsed" }),
|
|
2501
|
+
isError: false
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
1831
2505
|
try {
|
|
1832
|
-
const answersDir = (0,
|
|
2506
|
+
const answersDir = (0, import_path5.join)(cwd, ".stackwright", "answers");
|
|
1833
2507
|
const answeredPhases = [];
|
|
1834
2508
|
const missingPhases = [];
|
|
1835
|
-
for (const
|
|
1836
|
-
const answerFile = (0,
|
|
1837
|
-
if ((0,
|
|
2509
|
+
for (const phase2 of PHASE_ORDER) {
|
|
2510
|
+
const answerFile = (0, import_path5.join)(answersDir, `${phase2}.json`);
|
|
2511
|
+
if ((0, import_fs5.existsSync)(answerFile)) {
|
|
1838
2512
|
try {
|
|
1839
2513
|
const raw = safeReadSync(answerFile);
|
|
1840
2514
|
const parsed = JSON.parse(raw);
|
|
1841
2515
|
if (typeof parsed["version"] !== "string" || typeof parsed["phase"] !== "string" || typeof parsed["answers"] !== "object" || parsed["answers"] === null) {
|
|
1842
|
-
missingPhases.push(
|
|
2516
|
+
missingPhases.push(phase2);
|
|
1843
2517
|
continue;
|
|
1844
2518
|
}
|
|
1845
|
-
answeredPhases.push(
|
|
2519
|
+
answeredPhases.push(phase2);
|
|
1846
2520
|
} catch {
|
|
1847
|
-
missingPhases.push(
|
|
2521
|
+
missingPhases.push(phase2);
|
|
1848
2522
|
}
|
|
1849
2523
|
} else {
|
|
1850
|
-
missingPhases.push(
|
|
2524
|
+
missingPhases.push(phase2);
|
|
1851
2525
|
}
|
|
1852
2526
|
}
|
|
1853
2527
|
return {
|
|
@@ -1863,18 +2537,74 @@ function handleCheckExecutionReady(_cwd) {
|
|
|
1863
2537
|
return { text: JSON.stringify({ error: true, message: String(err) }), isError: true };
|
|
1864
2538
|
}
|
|
1865
2539
|
}
|
|
2540
|
+
function handleGetReadyPhases(_cwd) {
|
|
2541
|
+
const cwd = _cwd ?? process.cwd();
|
|
2542
|
+
try {
|
|
2543
|
+
const state = readState(cwd);
|
|
2544
|
+
const completed = [];
|
|
2545
|
+
const ready = [];
|
|
2546
|
+
const blocked = [];
|
|
2547
|
+
for (const phase of PHASE_ORDER) {
|
|
2548
|
+
const ps = state.phases[phase];
|
|
2549
|
+
if (ps?.executed) {
|
|
2550
|
+
completed.push(phase);
|
|
2551
|
+
continue;
|
|
2552
|
+
}
|
|
2553
|
+
const deps = PHASE_DEPENDENCIES[phase];
|
|
2554
|
+
const unmetDeps = deps.filter((dep) => !state.phases[dep]?.executed);
|
|
2555
|
+
if (unmetDeps.length === 0) {
|
|
2556
|
+
ready.push(phase);
|
|
2557
|
+
} else {
|
|
2558
|
+
blocked.push(phase);
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
return {
|
|
2562
|
+
text: JSON.stringify({
|
|
2563
|
+
readyPhases: ready,
|
|
2564
|
+
completedPhases: completed,
|
|
2565
|
+
blockedPhases: blocked,
|
|
2566
|
+
waveSize: ready.length,
|
|
2567
|
+
allComplete: ready.length === 0 && blocked.length === 0
|
|
2568
|
+
}),
|
|
2569
|
+
isError: false
|
|
2570
|
+
};
|
|
2571
|
+
} catch (err) {
|
|
2572
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
2573
|
+
return { text: JSON.stringify({ error: true, message }), isError: true };
|
|
2574
|
+
}
|
|
2575
|
+
}
|
|
1866
2576
|
function handleListArtifacts(_cwd) {
|
|
1867
2577
|
const cwd = _cwd ?? process.cwd();
|
|
1868
2578
|
try {
|
|
1869
|
-
const artifactsDir = (0,
|
|
2579
|
+
const artifactsDir = (0, import_path5.join)(cwd, ".stackwright", "artifacts");
|
|
2580
|
+
let manifest = null;
|
|
2581
|
+
try {
|
|
2582
|
+
manifest = loadSignatureManifest(cwd);
|
|
2583
|
+
} catch {
|
|
2584
|
+
}
|
|
1870
2585
|
const artifacts = [];
|
|
1871
2586
|
let completedCount = 0;
|
|
1872
2587
|
for (const phase of PHASE_ORDER) {
|
|
1873
2588
|
const expectedFile = PHASE_ARTIFACT[phase];
|
|
1874
|
-
const fullPath = (0,
|
|
1875
|
-
const exists = (0,
|
|
2589
|
+
const fullPath = (0, import_path5.join)(artifactsDir, expectedFile);
|
|
2590
|
+
const exists = (0, import_fs5.existsSync)(fullPath);
|
|
1876
2591
|
if (exists) completedCount++;
|
|
1877
|
-
|
|
2592
|
+
let signed = false;
|
|
2593
|
+
let signatureValid = null;
|
|
2594
|
+
if (exists && manifest) {
|
|
2595
|
+
const entry = manifest.signatures[expectedFile];
|
|
2596
|
+
if (entry) {
|
|
2597
|
+
signed = true;
|
|
2598
|
+
try {
|
|
2599
|
+
const rawBytes = Buffer.from(safeReadSync(fullPath), "utf-8");
|
|
2600
|
+
const { publicKey } = loadPipelineKeys(cwd);
|
|
2601
|
+
signatureValid = verifyArtifact(rawBytes, entry, publicKey);
|
|
2602
|
+
} catch {
|
|
2603
|
+
signatureValid = null;
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
artifacts.push({ phase, expectedFile, exists, path: fullPath, signed, signatureValid });
|
|
1878
2608
|
}
|
|
1879
2609
|
return {
|
|
1880
2610
|
text: JSON.stringify({ artifacts, completedCount, totalCount: PHASE_ORDER.length }),
|
|
@@ -1910,9 +2640,9 @@ function handleWritePhaseQuestions(input) {
|
|
|
1910
2640
|
}
|
|
1911
2641
|
} catch {
|
|
1912
2642
|
}
|
|
1913
|
-
const questionsDir = (0,
|
|
1914
|
-
(0,
|
|
1915
|
-
const filePath = (0,
|
|
2643
|
+
const questionsDir = (0, import_path5.join)(cwd, ".stackwright", "questions");
|
|
2644
|
+
(0, import_fs5.mkdirSync)(questionsDir, { recursive: true });
|
|
2645
|
+
const filePath = (0, import_path5.join)(questionsDir, `${phase}.json`);
|
|
1916
2646
|
const payload = {
|
|
1917
2647
|
version: "1.0",
|
|
1918
2648
|
phase,
|
|
@@ -1952,36 +2682,81 @@ function handleBuildSpecialistPrompt(input) {
|
|
|
1952
2682
|
};
|
|
1953
2683
|
}
|
|
1954
2684
|
try {
|
|
1955
|
-
const answersPath = (0,
|
|
2685
|
+
const answersPath = (0, import_path5.join)(cwd, ".stackwright", "answers", `${phase}.json`);
|
|
1956
2686
|
let answers = {};
|
|
1957
|
-
if ((0,
|
|
2687
|
+
if ((0, import_fs5.existsSync)(answersPath)) {
|
|
1958
2688
|
answers = JSON.parse(safeReadSync(answersPath));
|
|
1959
2689
|
}
|
|
2690
|
+
let buildContextText = "";
|
|
2691
|
+
const buildContextPath = (0, import_path5.join)(cwd, ".stackwright", "build-context.json");
|
|
2692
|
+
if ((0, import_fs5.existsSync)(buildContextPath)) {
|
|
2693
|
+
try {
|
|
2694
|
+
const bcRaw = JSON.parse(safeReadSync(buildContextPath));
|
|
2695
|
+
if (typeof bcRaw.buildContext === "string" && bcRaw.buildContext.trim().length > 0) {
|
|
2696
|
+
buildContextText = bcRaw.buildContext.trim();
|
|
2697
|
+
}
|
|
2698
|
+
} catch {
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
1960
2701
|
const deps = PHASE_DEPENDENCIES[phase];
|
|
1961
2702
|
const artifactSections = [];
|
|
1962
2703
|
const missingDependencies = [];
|
|
1963
2704
|
for (const dep of deps) {
|
|
1964
2705
|
const artifactFile = PHASE_ARTIFACT[dep];
|
|
1965
|
-
const artifactPath = (0,
|
|
1966
|
-
if ((0,
|
|
1967
|
-
const
|
|
2706
|
+
const artifactPath = (0, import_path5.join)(cwd, ".stackwright", "artifacts", artifactFile);
|
|
2707
|
+
if ((0, import_fs5.existsSync)(artifactPath)) {
|
|
2708
|
+
const rawContent = safeReadSync(artifactPath);
|
|
2709
|
+
const rawBytes = Buffer.from(rawContent, "utf-8");
|
|
2710
|
+
const content = JSON.parse(rawContent);
|
|
2711
|
+
let signatureVerified = false;
|
|
2712
|
+
let signatureAvailable = false;
|
|
2713
|
+
try {
|
|
2714
|
+
const sig = getArtifactSignature(cwd, artifactFile);
|
|
2715
|
+
if (sig) {
|
|
2716
|
+
signatureAvailable = true;
|
|
2717
|
+
const { publicKey } = loadPipelineKeys(cwd);
|
|
2718
|
+
signatureVerified = verifyArtifact(rawBytes, sig, publicKey);
|
|
2719
|
+
if (!signatureVerified) {
|
|
2720
|
+
const actualDigest = (0, import_crypto3.createHash)("sha384").update(rawBytes).digest("hex");
|
|
2721
|
+
emitSignatureAuditEvent({
|
|
2722
|
+
artifactFilename: artifactFile,
|
|
2723
|
+
expectedDigest: sig.digest,
|
|
2724
|
+
actualDigest,
|
|
2725
|
+
phase: dep,
|
|
2726
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2727
|
+
source: "stackwright_pro_build_specialist_prompt"
|
|
2728
|
+
});
|
|
2729
|
+
missingDependencies.push(dep);
|
|
2730
|
+
artifactSections.push(
|
|
2731
|
+
`[${artifactFile}]:
|
|
2732
|
+
(integrity check failed: ECDSA-P384 signature verification failed \u2014 artifact may have been tampered with)`
|
|
2733
|
+
);
|
|
2734
|
+
continue;
|
|
2735
|
+
}
|
|
2736
|
+
}
|
|
2737
|
+
} catch {
|
|
2738
|
+
}
|
|
1968
2739
|
const expectedOtter = PHASE_TO_OTTER2[dep];
|
|
1969
2740
|
const artifactOtter = content["generatedBy"];
|
|
2741
|
+
const normalizedOtter = artifactOtter?.replace(/-[a-f0-9]{6}$/, "");
|
|
1970
2742
|
if (!artifactOtter) {
|
|
1971
2743
|
missingDependencies.push(dep);
|
|
1972
2744
|
artifactSections.push(
|
|
1973
2745
|
`[${artifactFile}]:
|
|
1974
2746
|
(integrity check failed: missing generatedBy field)`
|
|
1975
2747
|
);
|
|
1976
|
-
} else if (
|
|
2748
|
+
} else if (normalizedOtter !== expectedOtter) {
|
|
1977
2749
|
missingDependencies.push(dep);
|
|
1978
2750
|
artifactSections.push(
|
|
1979
2751
|
`[${artifactFile}]:
|
|
1980
2752
|
(integrity check failed: artifact claims generatedBy="${artifactOtter}" but expected="${expectedOtter}")`
|
|
1981
2753
|
);
|
|
1982
2754
|
} else {
|
|
1983
|
-
|
|
1984
|
-
|
|
2755
|
+
const sigStatus = signatureAvailable ? signatureVerified ? " [signature verified]" : " [signature check skipped]" : " [unsigned]";
|
|
2756
|
+
artifactSections.push(
|
|
2757
|
+
`[${artifactFile}]${sigStatus}:
|
|
2758
|
+
${JSON.stringify(content, null, 2)}`
|
|
2759
|
+
);
|
|
1985
2760
|
}
|
|
1986
2761
|
} else {
|
|
1987
2762
|
missingDependencies.push(dep);
|
|
@@ -1989,10 +2764,17 @@ ${JSON.stringify(content, null, 2)}`);
|
|
|
1989
2764
|
(not yet available)`);
|
|
1990
2765
|
}
|
|
1991
2766
|
}
|
|
1992
|
-
const parts = [
|
|
2767
|
+
const parts = [];
|
|
2768
|
+
if (buildContextText) {
|
|
2769
|
+
parts.push("BUILD_CONTEXT:", buildContextText, "");
|
|
2770
|
+
}
|
|
2771
|
+
parts.push("ANSWERS:", JSON.stringify(answers, null, 2));
|
|
1993
2772
|
if (artifactSections.length > 0) {
|
|
1994
2773
|
parts.push("", "UPSTREAM ARTIFACTS:", "", ...artifactSections);
|
|
1995
2774
|
}
|
|
2775
|
+
const artifactSchema = PHASE_ARTIFACT_SCHEMA[phase];
|
|
2776
|
+
parts.push("", "REQUIRED_ARTIFACT_SCHEMA:");
|
|
2777
|
+
parts.push(artifactSchema);
|
|
1996
2778
|
parts.push("", "Execute using these answers and the upstream artifacts provided.");
|
|
1997
2779
|
const prompt = parts.join("\n");
|
|
1998
2780
|
const dependenciesSatisfied = missingDependencies.length === 0;
|
|
@@ -2027,45 +2809,295 @@ var OFF_SCRIPT_PATTERNS = [
|
|
|
2027
2809
|
var PHASE_REQUIRED_KEYS = {
|
|
2028
2810
|
designer: ["designLanguage", "themeTokenSeeds"],
|
|
2029
2811
|
theme: ["tokens"],
|
|
2030
|
-
api: ["entities"],
|
|
2812
|
+
api: ["entities", "version", "generatedBy"],
|
|
2031
2813
|
auth: ["version", "generatedBy"],
|
|
2032
|
-
data: ["version", "generatedBy"],
|
|
2814
|
+
data: ["version", "generatedBy", "strategy", "collections"],
|
|
2033
2815
|
pages: ["version", "generatedBy"],
|
|
2034
2816
|
dashboard: ["version", "generatedBy"],
|
|
2035
|
-
workflow: ["version", "generatedBy"]
|
|
2817
|
+
workflow: ["version", "generatedBy"],
|
|
2818
|
+
services: ["version", "generatedBy", "flows"],
|
|
2819
|
+
polish: ["version", "generatedBy"],
|
|
2820
|
+
geo: ["version", "generatedBy", "geoCollections"]
|
|
2821
|
+
};
|
|
2822
|
+
var PHASE_ARTIFACT_SCHEMA = {
|
|
2823
|
+
designer: JSON.stringify(
|
|
2824
|
+
{
|
|
2825
|
+
version: "1.0",
|
|
2826
|
+
generatedBy: "stackwright-pro-designer-otter",
|
|
2827
|
+
application: {
|
|
2828
|
+
type: "<operational|data-explorer|admin|logistics|general>",
|
|
2829
|
+
environment: "<workstation|field|control-room|mixed>",
|
|
2830
|
+
density: "<compact|balanced|spacious>",
|
|
2831
|
+
accessibility: "<wcag-aa|section-508|none>",
|
|
2832
|
+
colorScheme: "<light|dark|both>"
|
|
2833
|
+
},
|
|
2834
|
+
designLanguage: {
|
|
2835
|
+
rationale: "<design rationale>",
|
|
2836
|
+
spacingScale: { base: 8, scale: [0, 4, 8, 16, 24, 32, 48, 64] },
|
|
2837
|
+
colorSemantics: { primary: "#1a365d", accent: "#e53e3e" },
|
|
2838
|
+
typography: {
|
|
2839
|
+
dataFont: "Inter",
|
|
2840
|
+
headingFont: "Inter",
|
|
2841
|
+
monoFont: "monospace",
|
|
2842
|
+
dataSizePx: 12,
|
|
2843
|
+
bodySizePx: 14
|
|
2844
|
+
},
|
|
2845
|
+
contrastRatio: "4.5",
|
|
2846
|
+
borderRadius: "4",
|
|
2847
|
+
shadowElevation: "standard"
|
|
2848
|
+
},
|
|
2849
|
+
themeTokenSeeds: {
|
|
2850
|
+
light: {
|
|
2851
|
+
background: "#ffffff",
|
|
2852
|
+
foreground: "#1a1a1a",
|
|
2853
|
+
primary: "#1a365d",
|
|
2854
|
+
surface: "#f7f7f7",
|
|
2855
|
+
border: "#e2e8f0"
|
|
2856
|
+
},
|
|
2857
|
+
dark: {
|
|
2858
|
+
background: "#1a1a1a",
|
|
2859
|
+
foreground: "#ffffff",
|
|
2860
|
+
primary: "#90cdf4",
|
|
2861
|
+
surface: "#2d2d2d",
|
|
2862
|
+
border: "#4a5568"
|
|
2863
|
+
}
|
|
2864
|
+
},
|
|
2865
|
+
conformsTo: null,
|
|
2866
|
+
operationalNotes: []
|
|
2867
|
+
},
|
|
2868
|
+
null,
|
|
2869
|
+
2
|
|
2870
|
+
),
|
|
2871
|
+
theme: JSON.stringify(
|
|
2872
|
+
{
|
|
2873
|
+
version: "1.0",
|
|
2874
|
+
generatedBy: "stackwright-pro-theme-otter",
|
|
2875
|
+
componentLibrary: "shadcn",
|
|
2876
|
+
colorScheme: "<light|dark|both>",
|
|
2877
|
+
tokens: {
|
|
2878
|
+
colors: { "primary-500": "#1a365d", background: "#ffffff" },
|
|
2879
|
+
spacing: { "spacing-1": "8px", "spacing-2": "16px" },
|
|
2880
|
+
typography: { "font-data": "Inter", "text-sm": "12px" },
|
|
2881
|
+
shape: { "radius-sm": "4px", "radius-md": "8px" },
|
|
2882
|
+
shadows: { "shadow-sm": "0 1px 2px rgba(0,0,0,0.08)" }
|
|
2883
|
+
},
|
|
2884
|
+
cssVariables: {
|
|
2885
|
+
"--background": "0 0% 100%",
|
|
2886
|
+
"--foreground": "222.2 84% 4.9%",
|
|
2887
|
+
"--primary": "222.2 47.4% 11.2%",
|
|
2888
|
+
"--primary-foreground": "210 40% 98%",
|
|
2889
|
+
"--surface": "210 40% 98%",
|
|
2890
|
+
"--border": "214.3 31.8% 91.4%"
|
|
2891
|
+
},
|
|
2892
|
+
dark: { "--background": "222.2 84% 4.9%", "--foreground": "210 40% 98%" }
|
|
2893
|
+
},
|
|
2894
|
+
null,
|
|
2895
|
+
2
|
|
2896
|
+
),
|
|
2897
|
+
api: JSON.stringify(
|
|
2898
|
+
{
|
|
2899
|
+
version: "1.0",
|
|
2900
|
+
generatedBy: "stackwright-pro-api-otter",
|
|
2901
|
+
entities: [
|
|
2902
|
+
{
|
|
2903
|
+
name: "Shipment",
|
|
2904
|
+
endpoint: "/shipments",
|
|
2905
|
+
method: "GET",
|
|
2906
|
+
revalidate: 60,
|
|
2907
|
+
mutationType: null
|
|
2908
|
+
}
|
|
2909
|
+
],
|
|
2910
|
+
auth: { type: "bearer", header: "Authorization", envVar: "API_TOKEN" },
|
|
2911
|
+
baseUrl: "https://api.example.mil/v2",
|
|
2912
|
+
specPath: "./specs/api.yaml"
|
|
2913
|
+
},
|
|
2914
|
+
null,
|
|
2915
|
+
2
|
|
2916
|
+
),
|
|
2917
|
+
data: JSON.stringify(
|
|
2918
|
+
{
|
|
2919
|
+
version: "1.0",
|
|
2920
|
+
generatedBy: "stackwright-pro-data-otter",
|
|
2921
|
+
strategy: "<pulse-fast|isr-fast|isr-standard|isr-slow>",
|
|
2922
|
+
pulseMode: false,
|
|
2923
|
+
collections: [{ name: "equipment", revalidate: 60, pulse: false }],
|
|
2924
|
+
endpoints: { included: ["/equipment/**"], excluded: ["/admin/**"] },
|
|
2925
|
+
requiredPackages: { dependencies: {}, devPackages: {} }
|
|
2926
|
+
},
|
|
2927
|
+
null,
|
|
2928
|
+
2
|
|
2929
|
+
),
|
|
2930
|
+
geo: JSON.stringify(
|
|
2931
|
+
{
|
|
2932
|
+
version: "1.0",
|
|
2933
|
+
generatedBy: "stackwright-pro-geo-otter",
|
|
2934
|
+
geoCollections: [
|
|
2935
|
+
{
|
|
2936
|
+
collection: "vessels",
|
|
2937
|
+
latField: "latitude",
|
|
2938
|
+
lngField: "longitude",
|
|
2939
|
+
labelField: "vesselName",
|
|
2940
|
+
colorField: "navigationStatus"
|
|
2941
|
+
}
|
|
2942
|
+
],
|
|
2943
|
+
pages: [
|
|
2944
|
+
{
|
|
2945
|
+
slug: "fleet-tracker",
|
|
2946
|
+
type: "<tracker|zone|route|combined>",
|
|
2947
|
+
collections: ["vessels"],
|
|
2948
|
+
hasLayers: false
|
|
2949
|
+
}
|
|
2950
|
+
]
|
|
2951
|
+
},
|
|
2952
|
+
null,
|
|
2953
|
+
2
|
|
2954
|
+
),
|
|
2955
|
+
workflow: JSON.stringify(
|
|
2956
|
+
{
|
|
2957
|
+
version: "1.0",
|
|
2958
|
+
generatedBy: "stackwright-pro-workflow-otter",
|
|
2959
|
+
workflowConfig: {
|
|
2960
|
+
id: "procurement-approval",
|
|
2961
|
+
route: "/procurement",
|
|
2962
|
+
files: ["workflows/procurement-approval.yml"],
|
|
2963
|
+
serviceDependencies: ["service:workflow-state"],
|
|
2964
|
+
warnings: []
|
|
2965
|
+
}
|
|
2966
|
+
},
|
|
2967
|
+
null,
|
|
2968
|
+
2
|
|
2969
|
+
),
|
|
2970
|
+
services: JSON.stringify(
|
|
2971
|
+
{
|
|
2972
|
+
version: "1.0",
|
|
2973
|
+
generatedBy: "stackwright-services-otter",
|
|
2974
|
+
flows: [
|
|
2975
|
+
{
|
|
2976
|
+
name: "at-risk-patients",
|
|
2977
|
+
trigger: "<http|event|schedule|queue>",
|
|
2978
|
+
steps: 3,
|
|
2979
|
+
outputSpec: "at-risk-patients.openapi.json"
|
|
2980
|
+
}
|
|
2981
|
+
],
|
|
2982
|
+
workflows: [
|
|
2983
|
+
{
|
|
2984
|
+
name: "evacuation-coordination",
|
|
2985
|
+
states: 4,
|
|
2986
|
+
transitions: 5
|
|
2987
|
+
}
|
|
2988
|
+
],
|
|
2989
|
+
openApiSpecs: ["at-risk-patients.openapi.json"],
|
|
2990
|
+
capabilitiesUsed: ["service.call", "collection.join", "collection.filter"]
|
|
2991
|
+
},
|
|
2992
|
+
null,
|
|
2993
|
+
2
|
|
2994
|
+
),
|
|
2995
|
+
pages: JSON.stringify(
|
|
2996
|
+
{
|
|
2997
|
+
version: "1.0",
|
|
2998
|
+
generatedBy: "stackwright-pro-page-otter",
|
|
2999
|
+
pages: [
|
|
3000
|
+
{
|
|
3001
|
+
slug: "catalog",
|
|
3002
|
+
type: "collection_listing",
|
|
3003
|
+
collection: "products",
|
|
3004
|
+
themeApplied: true,
|
|
3005
|
+
authRequired: false
|
|
3006
|
+
},
|
|
3007
|
+
{
|
|
3008
|
+
slug: "admin",
|
|
3009
|
+
type: "protected",
|
|
3010
|
+
collection: null,
|
|
3011
|
+
themeApplied: true,
|
|
3012
|
+
authRequired: true
|
|
3013
|
+
}
|
|
3014
|
+
]
|
|
3015
|
+
},
|
|
3016
|
+
null,
|
|
3017
|
+
2
|
|
3018
|
+
),
|
|
3019
|
+
dashboard: JSON.stringify(
|
|
3020
|
+
{
|
|
3021
|
+
version: "1.0",
|
|
3022
|
+
generatedBy: "stackwright-pro-dashboard-otter",
|
|
3023
|
+
pages: [
|
|
3024
|
+
{
|
|
3025
|
+
slug: "dashboard",
|
|
3026
|
+
layout: "<grid|table|mixed>",
|
|
3027
|
+
collections: ["equipment", "supplies"],
|
|
3028
|
+
mode: "<ISR|Pulse>"
|
|
3029
|
+
}
|
|
3030
|
+
]
|
|
3031
|
+
},
|
|
3032
|
+
null,
|
|
3033
|
+
2
|
|
3034
|
+
),
|
|
3035
|
+
auth: JSON.stringify(
|
|
3036
|
+
{
|
|
3037
|
+
version: "1.0",
|
|
3038
|
+
generatedBy: "stackwright-pro-auth-otter",
|
|
3039
|
+
authConfig: {
|
|
3040
|
+
method: "<cac|oidc|oauth2|none>",
|
|
3041
|
+
provider: "<azure-ad|okta|ping|cognito \u2014 if OIDC, else null>",
|
|
3042
|
+
rbacRoles: ["ADMIN", "ANALYST"],
|
|
3043
|
+
rbacDefaultRole: "ANALYST",
|
|
3044
|
+
protectedRoutes: ["/dashboard/:path*", "/procurement/:path*"],
|
|
3045
|
+
auditEnabled: true,
|
|
3046
|
+
auditRetentionDays: 90
|
|
3047
|
+
}
|
|
3048
|
+
},
|
|
3049
|
+
null,
|
|
3050
|
+
2
|
|
3051
|
+
),
|
|
3052
|
+
polish: JSON.stringify(
|
|
3053
|
+
{
|
|
3054
|
+
version: "1.0",
|
|
3055
|
+
generatedBy: "stackwright-pro-polish-otter",
|
|
3056
|
+
landingPage: { slug: "", rewritten: true },
|
|
3057
|
+
navigation: { itemCount: 5, items: ["/dashboard", "/equipment", "/workflows"] },
|
|
3058
|
+
gettingStarted: "<rewritten|redirected|not-found>"
|
|
3059
|
+
},
|
|
3060
|
+
null,
|
|
3061
|
+
2
|
|
3062
|
+
)
|
|
2036
3063
|
};
|
|
2037
3064
|
function handleValidateArtifact(input) {
|
|
2038
3065
|
const cwd = input._cwd ?? process.cwd();
|
|
2039
|
-
const { phase, responseText } = input;
|
|
3066
|
+
const { phase, responseText, artifact: directArtifact } = input;
|
|
2040
3067
|
if (!isValidPhase(phase)) {
|
|
2041
3068
|
return {
|
|
2042
3069
|
text: JSON.stringify({ error: true, message: `Unknown phase: ${phase}` }),
|
|
2043
3070
|
isError: true
|
|
2044
3071
|
};
|
|
2045
3072
|
}
|
|
2046
|
-
|
|
2047
|
-
|
|
3073
|
+
let artifact;
|
|
3074
|
+
if (directArtifact) {
|
|
3075
|
+
artifact = directArtifact;
|
|
3076
|
+
} else {
|
|
3077
|
+
const text = responseText ?? "";
|
|
3078
|
+
for (const { pattern, label } of OFF_SCRIPT_PATTERNS) {
|
|
3079
|
+
if (pattern.test(text)) {
|
|
3080
|
+
const result = {
|
|
3081
|
+
valid: false,
|
|
3082
|
+
phase,
|
|
3083
|
+
violation: "off-script",
|
|
3084
|
+
retryPrompt: `You returned code output (detected: ${label}). Return ONLY a JSON artifact \u2014 no code, no files.`
|
|
3085
|
+
};
|
|
3086
|
+
return { text: JSON.stringify(result), isError: false };
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
try {
|
|
3090
|
+
artifact = extractJsonFromResponse(text);
|
|
3091
|
+
} catch {
|
|
2048
3092
|
const result = {
|
|
2049
3093
|
valid: false,
|
|
2050
3094
|
phase,
|
|
2051
|
-
violation: "
|
|
2052
|
-
retryPrompt:
|
|
3095
|
+
violation: "invalid-json",
|
|
3096
|
+
retryPrompt: "Your response did not contain valid JSON. Return a single JSON object with no surrounding text."
|
|
2053
3097
|
};
|
|
2054
3098
|
return { text: JSON.stringify(result), isError: false };
|
|
2055
3099
|
}
|
|
2056
3100
|
}
|
|
2057
|
-
let artifact;
|
|
2058
|
-
try {
|
|
2059
|
-
artifact = extractJsonFromResponse(responseText);
|
|
2060
|
-
} catch {
|
|
2061
|
-
const result = {
|
|
2062
|
-
valid: false,
|
|
2063
|
-
phase,
|
|
2064
|
-
violation: "invalid-json",
|
|
2065
|
-
retryPrompt: "Your response did not contain valid JSON. Return a single JSON object with no surrounding text."
|
|
2066
|
-
};
|
|
2067
|
-
return { text: JSON.stringify(result), isError: false };
|
|
2068
|
-
}
|
|
2069
3101
|
if (!artifact.version || !artifact.generatedBy) {
|
|
2070
3102
|
const result = {
|
|
2071
3103
|
valid: false,
|
|
@@ -2086,12 +3118,58 @@ function handleValidateArtifact(input) {
|
|
|
2086
3118
|
};
|
|
2087
3119
|
return { text: JSON.stringify(result), isError: false };
|
|
2088
3120
|
}
|
|
3121
|
+
const PHASE_ZOD_VALIDATORS = {
|
|
3122
|
+
workflow: (artifact2) => {
|
|
3123
|
+
const workflowConfig = artifact2["workflowConfig"];
|
|
3124
|
+
if (!workflowConfig) return { success: true };
|
|
3125
|
+
const result = import_types.WorkflowFileSchema.safeParse(workflowConfig);
|
|
3126
|
+
if (!result.success) {
|
|
3127
|
+
const issues = result.error.issues.slice(0, 3).map((i) => `${i.path.join(".")}: ${i.message}`).join("; ");
|
|
3128
|
+
return { success: false, error: { message: issues } };
|
|
3129
|
+
}
|
|
3130
|
+
return { success: true };
|
|
3131
|
+
},
|
|
3132
|
+
auth: (artifact2) => {
|
|
3133
|
+
const authConfig = artifact2["authConfig"];
|
|
3134
|
+
if (!authConfig) return { success: true };
|
|
3135
|
+
const result = import_types.authConfigSchema.safeParse(authConfig);
|
|
3136
|
+
if (!result.success) {
|
|
3137
|
+
const issues = result.error.issues.slice(0, 3).map((i) => `${i.path.join(".")}: ${i.message}`).join("; ");
|
|
3138
|
+
return { success: false, error: { message: issues } };
|
|
3139
|
+
}
|
|
3140
|
+
return { success: true };
|
|
3141
|
+
}
|
|
3142
|
+
};
|
|
3143
|
+
const zodValidator = PHASE_ZOD_VALIDATORS[phase];
|
|
3144
|
+
if (zodValidator) {
|
|
3145
|
+
const zodResult = zodValidator(artifact);
|
|
3146
|
+
if (!zodResult.success) {
|
|
3147
|
+
const result = {
|
|
3148
|
+
valid: false,
|
|
3149
|
+
phase,
|
|
3150
|
+
violation: "schema-mismatch",
|
|
3151
|
+
retryPrompt: `Your artifact failed schema validation: ${zodResult.error?.message}. Fix these fields and return the corrected JSON artifact.`
|
|
3152
|
+
};
|
|
3153
|
+
return { text: JSON.stringify(result), isError: false };
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
2089
3156
|
try {
|
|
2090
|
-
const artifactsDir = (0,
|
|
2091
|
-
(0,
|
|
3157
|
+
const artifactsDir = (0, import_path5.join)(cwd, ".stackwright", "artifacts");
|
|
3158
|
+
(0, import_fs5.mkdirSync)(artifactsDir, { recursive: true });
|
|
2092
3159
|
const artifactFile = PHASE_ARTIFACT[phase];
|
|
2093
|
-
const artifactPath = (0,
|
|
2094
|
-
|
|
3160
|
+
const artifactPath = (0, import_path5.join)(artifactsDir, artifactFile);
|
|
3161
|
+
const serialized = JSON.stringify(artifact, null, 2) + "\n";
|
|
3162
|
+
const artifactBytes = Buffer.from(serialized, "utf-8");
|
|
3163
|
+
safeWriteSync(artifactPath, serialized);
|
|
3164
|
+
let signed = false;
|
|
3165
|
+
try {
|
|
3166
|
+
const { privateKey } = loadPipelineKeys(cwd);
|
|
3167
|
+
const sig = signArtifact(artifactBytes, privateKey);
|
|
3168
|
+
const signerOtter = PHASE_TO_OTTER2[phase];
|
|
3169
|
+
saveArtifactSignature(cwd, artifactFile, sig, signerOtter);
|
|
3170
|
+
signed = true;
|
|
3171
|
+
} catch {
|
|
3172
|
+
}
|
|
2095
3173
|
const state = readState(cwd);
|
|
2096
3174
|
if (!state.phases[phase]) state.phases[phase] = defaultPhaseStatus();
|
|
2097
3175
|
const ps = state.phases[phase];
|
|
@@ -2102,7 +3180,7 @@ function handleValidateArtifact(input) {
|
|
|
2102
3180
|
valid: true,
|
|
2103
3181
|
phase,
|
|
2104
3182
|
artifactPath,
|
|
2105
|
-
summary: `Wrote ${artifactFile} (keys: ${topKeys}${Object.keys(artifact).length > 5 ? ", ..." : ""})`
|
|
3183
|
+
summary: `Wrote ${artifactFile} (keys: ${topKeys}${Object.keys(artifact).length > 5 ? ", ..." : ""})${signed ? " [signed]" : ""}`
|
|
2106
3184
|
};
|
|
2107
3185
|
return { text: JSON.stringify(result), isError: false };
|
|
2108
3186
|
} catch (err) {
|
|
@@ -2126,11 +3204,15 @@ function registerPipelineTools(server2) {
|
|
|
2126
3204
|
"stackwright_pro_set_pipeline_state",
|
|
2127
3205
|
`Atomic read\u2192modify\u2192write pipeline state. ${DESC}`,
|
|
2128
3206
|
{
|
|
2129
|
-
phase:
|
|
2130
|
-
field:
|
|
2131
|
-
value:
|
|
2132
|
-
|
|
2133
|
-
|
|
3207
|
+
phase: import_zod11.z.string().optional().describe('Phase to update, e.g. "designer"'),
|
|
3208
|
+
field: import_zod11.z.enum(["questionsCollected", "answered", "executed", "artifactWritten"]).optional().describe("Boolean field to set"),
|
|
3209
|
+
value: boolCoerce(import_zod11.z.boolean().optional()).describe(
|
|
3210
|
+
'Value for the field \u2014 must be a JSON boolean (true/false), NOT the string "true"/"false"'
|
|
3211
|
+
),
|
|
3212
|
+
status: import_zod11.z.enum(["setup", "questions", "execution", "done"]).optional().describe("Top-level status override"),
|
|
3213
|
+
incrementRetry: boolCoerce(import_zod11.z.boolean().optional()).describe(
|
|
3214
|
+
"Bump retryCount by 1 \u2014 must be a JSON boolean"
|
|
3215
|
+
)
|
|
2134
3216
|
},
|
|
2135
3217
|
async (args) => res(
|
|
2136
3218
|
handleSetPipelineState({
|
|
@@ -2144,9 +3226,17 @@ function registerPipelineTools(server2) {
|
|
|
2144
3226
|
);
|
|
2145
3227
|
server2.tool(
|
|
2146
3228
|
"stackwright_pro_check_execution_ready",
|
|
2147
|
-
`Check all phases have answer files in .stackwright/answers/. ${DESC}`,
|
|
3229
|
+
`Check all phases have answer files in .stackwright/answers/. If phase is provided, check only that phase. ${DESC}`,
|
|
3230
|
+
{
|
|
3231
|
+
phase: import_zod11.z.string().optional().describe("If provided, check only this phase's readiness. Omit to check all phases.")
|
|
3232
|
+
},
|
|
3233
|
+
async ({ phase }) => res(handleCheckExecutionReady(void 0, phase))
|
|
3234
|
+
);
|
|
3235
|
+
server2.tool(
|
|
3236
|
+
"stackwright_pro_get_ready_phases",
|
|
3237
|
+
`Return phases whose dependencies are all satisfied (executed=true). Use to determine which phases can run next \u2014 enables wave-based execution. ${DESC}`,
|
|
2148
3238
|
{},
|
|
2149
|
-
async () => res(
|
|
3239
|
+
async () => res(handleGetReadyPhases())
|
|
2150
3240
|
);
|
|
2151
3241
|
server2.tool(
|
|
2152
3242
|
"stackwright_pro_list_artifacts",
|
|
@@ -2156,40 +3246,92 @@ function registerPipelineTools(server2) {
|
|
|
2156
3246
|
);
|
|
2157
3247
|
server2.tool(
|
|
2158
3248
|
"stackwright_pro_write_phase_questions",
|
|
2159
|
-
`Parse otter question-collection response \u2192 .stackwright/questions/{phase}.json. ${DESC}`,
|
|
3249
|
+
`Parse otter question-collection response \u2192 .stackwright/questions/{phase}.json. Specialists may also call this directly with a parsed questions array. ${DESC}`,
|
|
2160
3250
|
{
|
|
2161
|
-
phase:
|
|
2162
|
-
responseText:
|
|
3251
|
+
phase: import_zod11.z.string().optional().describe('Phase name, e.g. "designer" (required for direct write)'),
|
|
3252
|
+
responseText: import_zod11.z.string().optional().describe("Raw LLM response from QUESTION_COLLECTION_MODE"),
|
|
3253
|
+
questions: jsonCoerce(import_zod11.z.array(import_zod11.z.any()).optional()).describe(
|
|
3254
|
+
"Questions array for direct specialist write"
|
|
3255
|
+
)
|
|
2163
3256
|
},
|
|
2164
|
-
async ({ phase, responseText }) =>
|
|
3257
|
+
async ({ phase, responseText, questions }) => {
|
|
3258
|
+
if (phase && questions && Array.isArray(questions)) {
|
|
3259
|
+
const SAFE_PHASE = /^[a-z][a-z0-9-]{0,30}$/;
|
|
3260
|
+
if (!SAFE_PHASE.test(phase)) {
|
|
3261
|
+
return {
|
|
3262
|
+
content: [
|
|
3263
|
+
{ type: "text", text: JSON.stringify({ error: `Invalid phase name` }) }
|
|
3264
|
+
],
|
|
3265
|
+
isError: true
|
|
3266
|
+
};
|
|
3267
|
+
}
|
|
3268
|
+
const questionsDir = (0, import_path5.join)(process.cwd(), ".stackwright", "questions");
|
|
3269
|
+
(0, import_fs5.mkdirSync)(questionsDir, { recursive: true });
|
|
3270
|
+
const outPath = (0, import_path5.join)(questionsDir, `${phase}.json`);
|
|
3271
|
+
(0, import_fs5.writeFileSync)(
|
|
3272
|
+
outPath,
|
|
3273
|
+
JSON.stringify({ phase, questions, writtenAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)
|
|
3274
|
+
);
|
|
3275
|
+
return {
|
|
3276
|
+
content: [
|
|
3277
|
+
{
|
|
3278
|
+
type: "text",
|
|
3279
|
+
text: JSON.stringify({
|
|
3280
|
+
written: true,
|
|
3281
|
+
phase,
|
|
3282
|
+
count: questions.length
|
|
3283
|
+
})
|
|
3284
|
+
}
|
|
3285
|
+
]
|
|
3286
|
+
};
|
|
3287
|
+
}
|
|
3288
|
+
return res(
|
|
3289
|
+
handleWritePhaseQuestions({ phase: phase ?? "", responseText: responseText ?? "" })
|
|
3290
|
+
);
|
|
3291
|
+
}
|
|
2165
3292
|
);
|
|
2166
3293
|
server2.tool(
|
|
2167
3294
|
"stackwright_pro_build_specialist_prompt",
|
|
2168
3295
|
`Assemble execution prompt from answers + upstream artifacts. Foreman passes verbatim. ${DESC}`,
|
|
2169
|
-
{ phase:
|
|
3296
|
+
{ phase: import_zod11.z.string().describe('Phase to build prompt for, e.g. "pages"') },
|
|
2170
3297
|
async ({ phase }) => res(handleBuildSpecialistPrompt({ phase }))
|
|
2171
3298
|
);
|
|
2172
3299
|
server2.tool(
|
|
2173
3300
|
"stackwright_pro_validate_artifact",
|
|
2174
|
-
`Validate
|
|
3301
|
+
`Validate and write artifact to .stackwright/artifacts/. Returns retryPrompt on failure. ${DESC}`,
|
|
2175
3302
|
{
|
|
2176
|
-
phase:
|
|
2177
|
-
responseText:
|
|
3303
|
+
phase: import_zod11.z.string().describe('Phase that produced this artifact, e.g. "designer"'),
|
|
3304
|
+
responseText: import_zod11.z.string().optional().describe("Raw response text from the specialist otter (Foreman-mediated path, legacy)"),
|
|
3305
|
+
artifact: jsonCoerce(import_zod11.z.record(import_zod11.z.string(), import_zod11.z.unknown()).optional()).describe(
|
|
3306
|
+
"Artifact object to validate and write directly (specialist direct path \u2014 skips off-script detection and JSON parsing)"
|
|
3307
|
+
)
|
|
2178
3308
|
},
|
|
2179
|
-
async ({ phase, responseText }) =>
|
|
3309
|
+
async ({ phase, responseText, artifact }) => {
|
|
3310
|
+
if (artifact) {
|
|
3311
|
+
return res(
|
|
3312
|
+
handleValidateArtifact({ phase, artifact })
|
|
3313
|
+
);
|
|
3314
|
+
}
|
|
3315
|
+
return res(handleValidateArtifact({ phase, responseText: responseText ?? "" }));
|
|
3316
|
+
}
|
|
2180
3317
|
);
|
|
2181
3318
|
}
|
|
2182
3319
|
|
|
2183
3320
|
// src/tools/safe-write.ts
|
|
2184
|
-
var
|
|
2185
|
-
var
|
|
2186
|
-
var
|
|
3321
|
+
var import_zod12 = require("zod");
|
|
3322
|
+
var import_fs6 = require("fs");
|
|
3323
|
+
var import_path6 = require("path");
|
|
2187
3324
|
var OTTER_WRITE_ALLOWLISTS = {
|
|
2188
3325
|
"stackwright-pro-designer-otter": [
|
|
2189
3326
|
{ prefix: ".stackwright/artifacts/", suffix: ".json", description: "Design language artifact" }
|
|
2190
3327
|
],
|
|
2191
3328
|
"stackwright-pro-theme-otter": [
|
|
2192
|
-
{ prefix: ".stackwright/artifacts/", suffix: ".json", description: "Theme tokens artifact" }
|
|
3329
|
+
{ prefix: ".stackwright/artifacts/", suffix: ".json", description: "Theme tokens artifact" },
|
|
3330
|
+
{
|
|
3331
|
+
prefix: "stackwright.theme.",
|
|
3332
|
+
suffix: ".yml",
|
|
3333
|
+
description: "Theme config YAML (merged at build time)"
|
|
3334
|
+
}
|
|
2193
3335
|
],
|
|
2194
3336
|
"stackwright-pro-auth-otter": [
|
|
2195
3337
|
{ prefix: ".stackwright/artifacts/", suffix: ".json", description: "Auth config artifact" },
|
|
@@ -2222,19 +3364,50 @@ var OTTER_WRITE_ALLOWLISTS = {
|
|
|
2222
3364
|
],
|
|
2223
3365
|
"stackwright-pro-api-otter": [
|
|
2224
3366
|
{ prefix: ".stackwright/artifacts/", suffix: ".json", description: "API config artifact" }
|
|
3367
|
+
],
|
|
3368
|
+
"stackwright-pro-geo-otter": [
|
|
3369
|
+
{ prefix: ".stackwright/artifacts/", suffix: ".json", description: "Geo manifest artifact" },
|
|
3370
|
+
{ prefix: "pages/", suffix: "/content.yml", description: "Map page content" },
|
|
3371
|
+
{ prefix: "pages/", suffix: "/content.yaml", description: "Map page content" }
|
|
3372
|
+
],
|
|
3373
|
+
"stackwright-pro-polish-otter": [
|
|
3374
|
+
{
|
|
3375
|
+
prefix: "stackwright.yml",
|
|
3376
|
+
suffix: "",
|
|
3377
|
+
description: "Stackwright config (navigation updates)"
|
|
3378
|
+
},
|
|
3379
|
+
{ prefix: "pages/", suffix: "/content.yml", description: "Landing page content" },
|
|
3380
|
+
{ prefix: "pages/", suffix: "/content.yaml", description: "Landing page content" },
|
|
3381
|
+
{ prefix: ".stackwright/artifacts/", suffix: ".json", description: "Polish artifact" }
|
|
2225
3382
|
]
|
|
2226
3383
|
};
|
|
2227
3384
|
var PROTECTED_PATH_PREFIXES = [
|
|
2228
3385
|
".stackwright/pipeline-state.json",
|
|
3386
|
+
".stackwright/pipeline-keys.json",
|
|
3387
|
+
// ephemeral signing keys
|
|
3388
|
+
".stackwright/artifacts/signatures.json",
|
|
3389
|
+
// artifact signature manifest
|
|
2229
3390
|
".stackwright/questions/",
|
|
2230
3391
|
".stackwright/answers/"
|
|
2231
3392
|
];
|
|
3393
|
+
var MAX_SAFE_WRITE_BYTES_JSON = 512 * 1024;
|
|
3394
|
+
var MAX_SAFE_WRITE_BYTES_YAML = 256 * 1024;
|
|
3395
|
+
var MAX_SAFE_WRITE_BYTES_ENV = 4 * 1024;
|
|
3396
|
+
var MAX_SAFE_WRITE_BYTES_DEFAULT = 256 * 1024;
|
|
3397
|
+
function getMaxBytesForPath(filePath) {
|
|
3398
|
+
if (filePath.endsWith(".json")) return { limit: MAX_SAFE_WRITE_BYTES_JSON, label: "JSON" };
|
|
3399
|
+
if (filePath.endsWith(".yml") || filePath.endsWith(".yaml"))
|
|
3400
|
+
return { limit: MAX_SAFE_WRITE_BYTES_YAML, label: "YAML" };
|
|
3401
|
+
if (filePath === ".env" || /^\.env\.[a-zA-Z0-9]+/.test(filePath))
|
|
3402
|
+
return { limit: MAX_SAFE_WRITE_BYTES_ENV, label: "env" };
|
|
3403
|
+
return { limit: MAX_SAFE_WRITE_BYTES_DEFAULT, label: "default" };
|
|
3404
|
+
}
|
|
2232
3405
|
function checkPathAllowed(callerOtter, filePath) {
|
|
2233
|
-
const normalized = (0,
|
|
3406
|
+
const normalized = (0, import_path6.normalize)(filePath);
|
|
2234
3407
|
if (normalized.includes("..")) {
|
|
2235
3408
|
return { allowed: false, error: 'Path traversal detected: ".." segments are not allowed' };
|
|
2236
3409
|
}
|
|
2237
|
-
if ((0,
|
|
3410
|
+
if ((0, import_path6.isAbsolute)(normalized)) {
|
|
2238
3411
|
return {
|
|
2239
3412
|
allowed: false,
|
|
2240
3413
|
error: "Absolute paths are not allowed \u2014 use paths relative to project root"
|
|
@@ -2354,11 +3527,23 @@ function handleSafeWrite(input) {
|
|
|
2354
3527
|
};
|
|
2355
3528
|
return { text: JSON.stringify(result), isError: true };
|
|
2356
3529
|
}
|
|
2357
|
-
const
|
|
2358
|
-
const
|
|
2359
|
-
if (
|
|
3530
|
+
const contentBytes = Buffer.byteLength(content, "utf-8");
|
|
3531
|
+
const { limit: maxBytes, label: fileTypeLabel } = getMaxBytesForPath(filePath);
|
|
3532
|
+
if (contentBytes > maxBytes) {
|
|
3533
|
+
const result = {
|
|
3534
|
+
success: false,
|
|
3535
|
+
error: `Content size ${contentBytes} bytes exceeds ${fileTypeLabel} limit of ${maxBytes} bytes (${maxBytes / 1024} KB)`,
|
|
3536
|
+
callerOtter,
|
|
3537
|
+
attemptedPath: filePath,
|
|
3538
|
+
allowedPaths: []
|
|
3539
|
+
};
|
|
3540
|
+
return { text: JSON.stringify(result), isError: true };
|
|
3541
|
+
}
|
|
3542
|
+
const normalized = (0, import_path6.normalize)(filePath);
|
|
3543
|
+
const fullPath = (0, import_path6.join)(cwd, normalized);
|
|
3544
|
+
if ((0, import_fs6.existsSync)(fullPath)) {
|
|
2360
3545
|
try {
|
|
2361
|
-
const stat = (0,
|
|
3546
|
+
const stat = (0, import_fs6.lstatSync)(fullPath);
|
|
2362
3547
|
if (stat.isSymbolicLink()) {
|
|
2363
3548
|
const result = {
|
|
2364
3549
|
success: false,
|
|
@@ -2385,9 +3570,9 @@ function handleSafeWrite(input) {
|
|
|
2385
3570
|
}
|
|
2386
3571
|
try {
|
|
2387
3572
|
if (createDirectories) {
|
|
2388
|
-
(0,
|
|
3573
|
+
(0, import_fs6.mkdirSync)((0, import_path6.dirname)(fullPath), { recursive: true });
|
|
2389
3574
|
}
|
|
2390
|
-
(0,
|
|
3575
|
+
(0, import_fs6.writeFileSync)(fullPath, content, { encoding: "utf-8" });
|
|
2391
3576
|
const result = {
|
|
2392
3577
|
success: true,
|
|
2393
3578
|
path: normalized,
|
|
@@ -2413,10 +3598,12 @@ function registerSafeWriteTools(server2) {
|
|
|
2413
3598
|
"stackwright_pro_safe_write",
|
|
2414
3599
|
DESC,
|
|
2415
3600
|
{
|
|
2416
|
-
callerOtter:
|
|
2417
|
-
filePath:
|
|
2418
|
-
content:
|
|
2419
|
-
createDirectories:
|
|
3601
|
+
callerOtter: import_zod12.z.string().describe('The otter agent name requesting the write, e.g. "stackwright-pro-page-otter"'),
|
|
3602
|
+
filePath: import_zod12.z.string().describe('Relative path from project root, e.g. "pages/dashboard/content.yml"'),
|
|
3603
|
+
content: import_zod12.z.string().describe("File content to write"),
|
|
3604
|
+
createDirectories: boolCoerce(import_zod12.z.boolean().optional().default(true)).describe(
|
|
3605
|
+
"Create parent directories if they don't exist. Default: true"
|
|
3606
|
+
)
|
|
2420
3607
|
},
|
|
2421
3608
|
async ({ callerOtter, filePath, content, createDirectories }) => {
|
|
2422
3609
|
const result = handleSafeWrite({
|
|
@@ -2431,9 +3618,9 @@ function registerSafeWriteTools(server2) {
|
|
|
2431
3618
|
}
|
|
2432
3619
|
|
|
2433
3620
|
// src/tools/auth.ts
|
|
2434
|
-
var
|
|
2435
|
-
var
|
|
2436
|
-
var
|
|
3621
|
+
var import_zod13 = require("zod");
|
|
3622
|
+
var import_fs7 = require("fs");
|
|
3623
|
+
var import_path7 = require("path");
|
|
2437
3624
|
function buildHierarchy(roles) {
|
|
2438
3625
|
const h = {};
|
|
2439
3626
|
for (let i = 0; i < roles.length - 1; i++) {
|
|
@@ -2695,7 +3882,7 @@ async function configureAuthHandler(params, cwd) {
|
|
|
2695
3882
|
auditRetentionDays,
|
|
2696
3883
|
protectedRoutes
|
|
2697
3884
|
);
|
|
2698
|
-
(0,
|
|
3885
|
+
(0, import_fs7.writeFileSync)((0, import_path7.join)(cwd, "middleware.ts"), middlewareContent, "utf8");
|
|
2699
3886
|
filesWritten.push("middleware.ts");
|
|
2700
3887
|
} catch (err) {
|
|
2701
3888
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -2711,12 +3898,12 @@ async function configureAuthHandler(params, cwd) {
|
|
|
2711
3898
|
}
|
|
2712
3899
|
try {
|
|
2713
3900
|
const envBlock = generateEnvBlock(method, params);
|
|
2714
|
-
const envPath = (0,
|
|
2715
|
-
if ((0,
|
|
2716
|
-
const existing = (0,
|
|
2717
|
-
(0,
|
|
3901
|
+
const envPath = (0, import_path7.join)(cwd, ".env.example");
|
|
3902
|
+
if ((0, import_fs7.existsSync)(envPath)) {
|
|
3903
|
+
const existing = (0, import_fs7.readFileSync)(envPath, "utf8");
|
|
3904
|
+
(0, import_fs7.writeFileSync)(envPath, existing.trimEnd() + "\n\n" + envBlock, "utf8");
|
|
2718
3905
|
} else {
|
|
2719
|
-
(0,
|
|
3906
|
+
(0, import_fs7.writeFileSync)(envPath, envBlock, "utf8");
|
|
2720
3907
|
}
|
|
2721
3908
|
filesWritten.push(".env.example");
|
|
2722
3909
|
} catch (err) {
|
|
@@ -2742,12 +3929,12 @@ async function configureAuthHandler(params, cwd) {
|
|
|
2742
3929
|
auditRetentionDays,
|
|
2743
3930
|
protectedRoutes
|
|
2744
3931
|
);
|
|
2745
|
-
const ymlPath = (0,
|
|
2746
|
-
if (!(0,
|
|
2747
|
-
(0,
|
|
3932
|
+
const ymlPath = (0, import_path7.join)(cwd, "stackwright.yml");
|
|
3933
|
+
if (!(0, import_fs7.existsSync)(ymlPath)) {
|
|
3934
|
+
(0, import_fs7.writeFileSync)(ymlPath, authYaml, "utf8");
|
|
2748
3935
|
} else {
|
|
2749
|
-
const existing = (0,
|
|
2750
|
-
(0,
|
|
3936
|
+
const existing = (0, import_fs7.readFileSync)(ymlPath, "utf8");
|
|
3937
|
+
(0, import_fs7.writeFileSync)(ymlPath, upsertAuthBlock(existing, authYaml), "utf8");
|
|
2751
3938
|
}
|
|
2752
3939
|
filesWritten.push("stackwright.yml");
|
|
2753
3940
|
} catch (err) {
|
|
@@ -2786,35 +3973,35 @@ function registerAuthTools(server2) {
|
|
|
2786
3973
|
"stackwright_pro_configure_auth",
|
|
2787
3974
|
"Generate authentication middleware and configuration for a Next.js Stackwright application. Writes `middleware.ts` from a secure template, appends/updates the `auth:` section in `stackwright.yml`, and generates `.env.example` with required environment variables. \u26A0\uFE0F For CAC/PKI: generated `middleware.ts` carries a SECURITY REVIEW REQUIRED comment \u2014 certificate chain validation must be verified by a DoD security officer before production deployment. This is the ONLY approved path to generating `middleware.ts`. Never write TypeScript auth files directly.",
|
|
2788
3975
|
{
|
|
2789
|
-
method:
|
|
2790
|
-
provider:
|
|
3976
|
+
method: import_zod13.z.enum(["cac", "oidc", "oauth2", "none"]),
|
|
3977
|
+
provider: import_zod13.z.enum(["azure-ad", "okta", "ping", "cognito", "custom"]).optional(),
|
|
2791
3978
|
// CAC
|
|
2792
|
-
cacCaBundle:
|
|
2793
|
-
cacEdipiLookup:
|
|
2794
|
-
cacOcspEndpoint:
|
|
2795
|
-
cacCertHeader:
|
|
3979
|
+
cacCaBundle: import_zod13.z.string().optional(),
|
|
3980
|
+
cacEdipiLookup: import_zod13.z.string().optional(),
|
|
3981
|
+
cacOcspEndpoint: import_zod13.z.string().optional(),
|
|
3982
|
+
cacCertHeader: import_zod13.z.string().optional(),
|
|
2796
3983
|
// OIDC
|
|
2797
|
-
oidcDiscoveryUrl:
|
|
2798
|
-
oidcClientId:
|
|
2799
|
-
oidcClientSecret:
|
|
2800
|
-
oidcScopes:
|
|
2801
|
-
oidcRoleClaim:
|
|
3984
|
+
oidcDiscoveryUrl: import_zod13.z.string().optional(),
|
|
3985
|
+
oidcClientId: import_zod13.z.string().optional(),
|
|
3986
|
+
oidcClientSecret: import_zod13.z.string().optional(),
|
|
3987
|
+
oidcScopes: import_zod13.z.string().optional(),
|
|
3988
|
+
oidcRoleClaim: import_zod13.z.string().optional(),
|
|
2802
3989
|
// OAuth2
|
|
2803
|
-
oauth2AuthUrl:
|
|
2804
|
-
oauth2TokenUrl:
|
|
2805
|
-
oauth2ClientId:
|
|
2806
|
-
oauth2ClientSecret:
|
|
2807
|
-
oauth2Scopes:
|
|
3990
|
+
oauth2AuthUrl: import_zod13.z.string().optional(),
|
|
3991
|
+
oauth2TokenUrl: import_zod13.z.string().optional(),
|
|
3992
|
+
oauth2ClientId: import_zod13.z.string().optional(),
|
|
3993
|
+
oauth2ClientSecret: import_zod13.z.string().optional(),
|
|
3994
|
+
oauth2Scopes: import_zod13.z.string().optional(),
|
|
2808
3995
|
// RBAC
|
|
2809
|
-
rbacRoles:
|
|
2810
|
-
rbacDefaultRole:
|
|
3996
|
+
rbacRoles: jsonCoerce(import_zod13.z.array(import_zod13.z.string()).optional()),
|
|
3997
|
+
rbacDefaultRole: import_zod13.z.string().optional(),
|
|
2811
3998
|
// Audit
|
|
2812
|
-
auditEnabled:
|
|
2813
|
-
auditRetentionDays:
|
|
3999
|
+
auditEnabled: boolCoerce(import_zod13.z.boolean().optional()),
|
|
4000
|
+
auditRetentionDays: numCoerce(import_zod13.z.number().int().positive().optional()),
|
|
2814
4001
|
// Routes
|
|
2815
|
-
protectedRoutes:
|
|
4002
|
+
protectedRoutes: jsonCoerce(import_zod13.z.array(import_zod13.z.string()).optional()),
|
|
2816
4003
|
// Injection for tests
|
|
2817
|
-
_cwd:
|
|
4004
|
+
_cwd: import_zod13.z.string().optional()
|
|
2818
4005
|
},
|
|
2819
4006
|
async (params) => {
|
|
2820
4007
|
const cwd = params._cwd ?? process.cwd();
|
|
@@ -2824,45 +4011,61 @@ function registerAuthTools(server2) {
|
|
|
2824
4011
|
}
|
|
2825
4012
|
|
|
2826
4013
|
// src/integrity.ts
|
|
2827
|
-
var
|
|
2828
|
-
var
|
|
2829
|
-
var
|
|
4014
|
+
var import_crypto4 = require("crypto");
|
|
4015
|
+
var import_fs8 = require("fs");
|
|
4016
|
+
var import_path8 = require("path");
|
|
2830
4017
|
var _checksums = /* @__PURE__ */ new Map([
|
|
2831
4018
|
[
|
|
2832
4019
|
"stackwright-pro-api-otter.json",
|
|
2833
|
-
"
|
|
4020
|
+
"9fbaed0ce6116b82d0289f24432037d04637c89b8e73062ed946e5d49b294734"
|
|
2834
4021
|
],
|
|
2835
4022
|
[
|
|
2836
4023
|
"stackwright-pro-auth-otter.json",
|
|
2837
|
-
"
|
|
4024
|
+
"bf0e66e35d15ba818ba6ff1a007df34975565bacbb35cc0c80151fb1da13e573"
|
|
2838
4025
|
],
|
|
2839
4026
|
[
|
|
2840
4027
|
"stackwright-pro-dashboard-otter.json",
|
|
2841
|
-
"
|
|
4028
|
+
"f5a83b74ad7c44edc6f39b45a568fa122d82aa4788f741ce14614da56d4e29a4"
|
|
2842
4029
|
],
|
|
2843
4030
|
[
|
|
2844
4031
|
"stackwright-pro-data-otter.json",
|
|
2845
|
-
"
|
|
4032
|
+
"c406e1c775bcb1f2b038b40a92d9bd23172b40d774fc0fa50bad4c9714f53445"
|
|
2846
4033
|
],
|
|
2847
4034
|
[
|
|
2848
4035
|
"stackwright-pro-designer-otter.json",
|
|
2849
|
-
"
|
|
4036
|
+
"af09ac8f06385bdbac63e2820daa2ff7d38b8ff1ff383c161f07e3fb9d9359c5"
|
|
4037
|
+
],
|
|
4038
|
+
[
|
|
4039
|
+
"stackwright-pro-domain-expert-otter.json",
|
|
4040
|
+
"bfe5c167d73fef3f2ef280fff56dcb552073c218e1394a43ecf983a03169ed55"
|
|
2850
4041
|
],
|
|
2851
4042
|
[
|
|
2852
4043
|
"stackwright-pro-foreman-otter.json",
|
|
2853
|
-
"
|
|
4044
|
+
"a3a4c6b3dde05d8bed213759b1b6644d345b3107b73624ff5654d30b98297649"
|
|
4045
|
+
],
|
|
4046
|
+
[
|
|
4047
|
+
"stackwright-pro-geo-otter.json",
|
|
4048
|
+
"6eb7ecf97254dbd79c09ad24348bf16001423cce9585c14bef81afd67b7b901b"
|
|
2854
4049
|
],
|
|
2855
4050
|
[
|
|
2856
4051
|
"stackwright-pro-page-otter.json",
|
|
2857
|
-
"
|
|
4052
|
+
"9a5672f0758c81539337d86955e2892cd412547b4f111c2aa098eed1e62d7626"
|
|
4053
|
+
],
|
|
4054
|
+
[
|
|
4055
|
+
"stackwright-pro-polish-otter.json",
|
|
4056
|
+
"d31116995fdb417798af6056efd03bb1c71e0891371aba1774d283c03c9d77e8"
|
|
2858
4057
|
],
|
|
2859
4058
|
[
|
|
2860
4059
|
"stackwright-pro-theme-otter.json",
|
|
2861
|
-
"
|
|
4060
|
+
"08bb04009fdfb8743b10ac4d503cbaddaf8d7c804ba9b606aaed9cc516fd8e93"
|
|
2862
4061
|
],
|
|
2863
4062
|
[
|
|
2864
4063
|
"stackwright-pro-workflow-otter.json",
|
|
2865
|
-
"
|
|
4064
|
+
"c90d6773b2287aa9a640c2715ca0e75f44c13e99fddcfb89ced36603f38930ce"
|
|
4065
|
+
],
|
|
4066
|
+
[
|
|
4067
|
+
"stackwright-services-otter.json",
|
|
4068
|
+
"2a99df3e50415d027c0bc2a57f509882928bb1ae516e61dda667641ce1652ac3"
|
|
2866
4069
|
]
|
|
2867
4070
|
]);
|
|
2868
4071
|
Object.freeze(_checksums);
|
|
@@ -2877,21 +4080,21 @@ for (const [name, digest] of CANONICAL_CHECKSUMS) {
|
|
|
2877
4080
|
}
|
|
2878
4081
|
var MAX_OTTER_BYTES = 1 * 1024 * 1024;
|
|
2879
4082
|
function computeSha256(data) {
|
|
2880
|
-
return (0,
|
|
4083
|
+
return (0, import_crypto4.createHash)("sha256").update(data).digest("hex");
|
|
2881
4084
|
}
|
|
2882
4085
|
function safeEqual(a, b) {
|
|
2883
4086
|
if (a.length !== b.length) return false;
|
|
2884
|
-
return (0,
|
|
4087
|
+
return (0, import_crypto4.timingSafeEqual)(Buffer.from(a, "utf8"), Buffer.from(b, "utf8"));
|
|
2885
4088
|
}
|
|
2886
4089
|
function verifyOtterFile(filePath) {
|
|
2887
|
-
const filename = (0,
|
|
4090
|
+
const filename = (0, import_path8.basename)(filePath);
|
|
2888
4091
|
const expected = CANONICAL_CHECKSUMS.get(filename);
|
|
2889
4092
|
if (expected === void 0) {
|
|
2890
4093
|
return { verified: false, filename, error: `Unknown otter file: not in canonical set` };
|
|
2891
4094
|
}
|
|
2892
4095
|
let stat;
|
|
2893
4096
|
try {
|
|
2894
|
-
stat = (0,
|
|
4097
|
+
stat = (0, import_fs8.lstatSync)(filePath);
|
|
2895
4098
|
} catch (err) {
|
|
2896
4099
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2897
4100
|
return { verified: false, filename, error: `Cannot stat file: ${msg}` };
|
|
@@ -2909,7 +4112,7 @@ function verifyOtterFile(filePath) {
|
|
|
2909
4112
|
}
|
|
2910
4113
|
let raw;
|
|
2911
4114
|
try {
|
|
2912
|
-
raw = (0,
|
|
4115
|
+
raw = (0, import_fs8.readFileSync)(filePath);
|
|
2913
4116
|
} catch (err) {
|
|
2914
4117
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2915
4118
|
return { verified: false, filename, error: `Cannot read file: ${msg}` };
|
|
@@ -2942,12 +4145,24 @@ function verifyOtterFile(filePath) {
|
|
|
2942
4145
|
return { verified: true, filename };
|
|
2943
4146
|
}
|
|
2944
4147
|
function verifyAllOtters(otterDir) {
|
|
4148
|
+
if (/(?:^|[/\\])\.\.(?:[/\\]|$)/.test(otterDir) || otterDir.includes("..")) {
|
|
4149
|
+
return {
|
|
4150
|
+
verified: [],
|
|
4151
|
+
failed: [
|
|
4152
|
+
{
|
|
4153
|
+
filename: "<directory>",
|
|
4154
|
+
error: `Security: path traversal sequence detected in otter directory parameter`
|
|
4155
|
+
}
|
|
4156
|
+
],
|
|
4157
|
+
unknown: []
|
|
4158
|
+
};
|
|
4159
|
+
}
|
|
2945
4160
|
const verified = [];
|
|
2946
4161
|
const failed = [];
|
|
2947
4162
|
const unknown = [];
|
|
2948
4163
|
let entries;
|
|
2949
4164
|
try {
|
|
2950
|
-
entries = (0,
|
|
4165
|
+
entries = (0, import_fs8.readdirSync)(otterDir);
|
|
2951
4166
|
} catch (err) {
|
|
2952
4167
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2953
4168
|
return {
|
|
@@ -2958,9 +4173,9 @@ function verifyAllOtters(otterDir) {
|
|
|
2958
4173
|
}
|
|
2959
4174
|
const otterFiles = entries.filter((f) => f.endsWith("-otter.json"));
|
|
2960
4175
|
for (const filename of otterFiles) {
|
|
2961
|
-
const filePath = (0,
|
|
4176
|
+
const filePath = (0, import_path8.join)(otterDir, filename);
|
|
2962
4177
|
try {
|
|
2963
|
-
if ((0,
|
|
4178
|
+
if ((0, import_fs8.lstatSync)(filePath).isSymbolicLink()) {
|
|
2964
4179
|
failed.push({ filename, error: "Skipped: symlink" });
|
|
2965
4180
|
continue;
|
|
2966
4181
|
}
|
|
@@ -2986,15 +4201,30 @@ var DEFAULT_SEARCH_PATHS = ["node_modules/@stackwright-pro/otters/src/", "packag
|
|
|
2986
4201
|
function resolveOtterDir() {
|
|
2987
4202
|
const cwd = process.cwd();
|
|
2988
4203
|
for (const relative of DEFAULT_SEARCH_PATHS) {
|
|
2989
|
-
const candidate = (0,
|
|
4204
|
+
const candidate = (0, import_path8.join)(cwd, relative);
|
|
2990
4205
|
try {
|
|
2991
|
-
(0,
|
|
4206
|
+
(0, import_fs8.lstatSync)(candidate);
|
|
2992
4207
|
return candidate;
|
|
2993
4208
|
} catch {
|
|
2994
4209
|
}
|
|
2995
4210
|
}
|
|
2996
4211
|
return null;
|
|
2997
4212
|
}
|
|
4213
|
+
function emitIntegrityAuditEvent(params) {
|
|
4214
|
+
const record = JSON.stringify({
|
|
4215
|
+
level: "AUDIT",
|
|
4216
|
+
event: "INTEGRITY_FAIL",
|
|
4217
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4218
|
+
source: "stackwright_pro_verify_otter_integrity",
|
|
4219
|
+
otterDir: params.otterDir,
|
|
4220
|
+
failedCount: params.failed.length,
|
|
4221
|
+
unknownCount: params.unknown.length,
|
|
4222
|
+
failures: params.failed,
|
|
4223
|
+
unknown: params.unknown
|
|
4224
|
+
});
|
|
4225
|
+
process.stderr.write(`INTEGRITY_FAIL ${record}
|
|
4226
|
+
`);
|
|
4227
|
+
}
|
|
2998
4228
|
function registerIntegrityTools(server2) {
|
|
2999
4229
|
server2.tool(
|
|
3000
4230
|
"stackwright_pro_verify_otter_integrity",
|
|
@@ -3018,6 +4248,13 @@ function registerIntegrityTools(server2) {
|
|
|
3018
4248
|
}
|
|
3019
4249
|
const result = verifyAllOtters(resolved);
|
|
3020
4250
|
const allGood = result.failed.length === 0 && result.unknown.length === 0;
|
|
4251
|
+
if (!allGood) {
|
|
4252
|
+
emitIntegrityAuditEvent({
|
|
4253
|
+
otterDir: resolved,
|
|
4254
|
+
failed: result.failed,
|
|
4255
|
+
unknown: result.unknown
|
|
4256
|
+
});
|
|
4257
|
+
}
|
|
3021
4258
|
return {
|
|
3022
4259
|
content: [
|
|
3023
4260
|
{
|
|
@@ -3030,7 +4267,10 @@ function registerIntegrityTools(server2) {
|
|
|
3030
4267
|
unknownCount: result.unknown.length,
|
|
3031
4268
|
verified: result.verified,
|
|
3032
4269
|
failed: result.failed,
|
|
3033
|
-
unknown: result.unknown
|
|
4270
|
+
unknown: result.unknown,
|
|
4271
|
+
...allGood ? {} : {
|
|
4272
|
+
error: "INTEGRITY CHECK FAILED: SHA-256 mismatch detected in otter agent definitions. Do not proceed \u2014 otter files may have been tampered with."
|
|
4273
|
+
}
|
|
3034
4274
|
})
|
|
3035
4275
|
}
|
|
3036
4276
|
],
|
|
@@ -3041,14 +4281,14 @@ function registerIntegrityTools(server2) {
|
|
|
3041
4281
|
}
|
|
3042
4282
|
|
|
3043
4283
|
// src/tools/domain.ts
|
|
3044
|
-
var
|
|
3045
|
-
var
|
|
3046
|
-
var
|
|
4284
|
+
var import_zod14 = require("zod");
|
|
4285
|
+
var import_fs9 = require("fs");
|
|
4286
|
+
var import_path9 = require("path");
|
|
3047
4287
|
function handleListCollections(input) {
|
|
3048
4288
|
const cwd = input._cwd ?? process.cwd();
|
|
3049
4289
|
const sources = [
|
|
3050
4290
|
{
|
|
3051
|
-
path: (0,
|
|
4291
|
+
path: (0, import_path9.join)(cwd, ".stackwright", "artifacts", "data-config.json"),
|
|
3052
4292
|
source: "data-config.json",
|
|
3053
4293
|
parse: (raw) => {
|
|
3054
4294
|
const parsed = JSON.parse(raw);
|
|
@@ -3059,15 +4299,15 @@ function handleListCollections(input) {
|
|
|
3059
4299
|
}
|
|
3060
4300
|
},
|
|
3061
4301
|
{
|
|
3062
|
-
path: (0,
|
|
4302
|
+
path: (0, import_path9.join)(cwd, "stackwright.yml"),
|
|
3063
4303
|
source: "stackwright.yml",
|
|
3064
4304
|
parse: extractCollectionsFromYaml
|
|
3065
4305
|
}
|
|
3066
4306
|
];
|
|
3067
4307
|
for (const { path: path3, source, parse } of sources) {
|
|
3068
|
-
if (!(0,
|
|
4308
|
+
if (!(0, import_fs9.existsSync)(path3)) continue;
|
|
3069
4309
|
try {
|
|
3070
|
-
const collections = parse((0,
|
|
4310
|
+
const collections = parse((0, import_fs9.readFileSync)(path3, "utf8"));
|
|
3071
4311
|
return {
|
|
3072
4312
|
text: JSON.stringify({ collections, source, collectionCount: collections.length }),
|
|
3073
4313
|
isError: false
|
|
@@ -3218,8 +4458,8 @@ function handleValidateWorkflow(input) {
|
|
|
3218
4458
|
if (input.workflow && Object.keys(input.workflow).length > 0) {
|
|
3219
4459
|
raw = input.workflow;
|
|
3220
4460
|
} else {
|
|
3221
|
-
const artifactPath = (0,
|
|
3222
|
-
if (!(0,
|
|
4461
|
+
const artifactPath = (0, import_path9.join)(cwd, ".stackwright", "artifacts", "workflow-config.json");
|
|
4462
|
+
if (!(0, import_fs9.existsSync)(artifactPath)) {
|
|
3223
4463
|
return fail([
|
|
3224
4464
|
{
|
|
3225
4465
|
code: "NO_WORKFLOW",
|
|
@@ -3228,7 +4468,7 @@ function handleValidateWorkflow(input) {
|
|
|
3228
4468
|
]);
|
|
3229
4469
|
}
|
|
3230
4470
|
try {
|
|
3231
|
-
raw = JSON.parse((0,
|
|
4471
|
+
raw = JSON.parse((0, import_fs9.readFileSync)(artifactPath, "utf8"));
|
|
3232
4472
|
} catch (err) {
|
|
3233
4473
|
return fail([{ code: "INVALID_JSON", message: `Failed to parse workflow artifact: ${err}` }]);
|
|
3234
4474
|
}
|
|
@@ -3427,7 +4667,7 @@ function registerDomainTools(server2) {
|
|
|
3427
4667
|
"stackwright_pro_resolve_data_strategy",
|
|
3428
4668
|
"Look up the data freshness strategy configuration from the user's answer. Returns mechanism, revalidation seconds, required packages, and the exact MCP tool call to make. Replaces the strategy table in the data-otter prompt.",
|
|
3429
4669
|
{
|
|
3430
|
-
strategy:
|
|
4670
|
+
strategy: import_zod14.z.string().describe(
|
|
3431
4671
|
'The data-1 answer value: "pulse-fast", "isr-fast", "isr-standard", or "isr-slow"'
|
|
3432
4672
|
)
|
|
3433
4673
|
},
|
|
@@ -3437,7 +4677,7 @@ function registerDomainTools(server2) {
|
|
|
3437
4677
|
"stackwright_pro_validate_workflow",
|
|
3438
4678
|
"Validate a workflow definition against the Stackwright workflow schema. Checks step ID uniqueness, transition targets, terminal state existence, and service references. Call this after the workflow otter produces output.",
|
|
3439
4679
|
{
|
|
3440
|
-
workflow:
|
|
4680
|
+
workflow: jsonCoerce(import_zod14.z.record(import_zod14.z.string(), import_zod14.z.unknown()).optional()).describe(
|
|
3441
4681
|
"Parsed workflow object. If omitted, reads from .stackwright/artifacts/workflow-config.json"
|
|
3442
4682
|
)
|
|
3443
4683
|
},
|
|
@@ -3445,18 +4685,109 @@ function registerDomainTools(server2) {
|
|
|
3445
4685
|
);
|
|
3446
4686
|
}
|
|
3447
4687
|
|
|
4688
|
+
// src/tools/type-schemas.ts
|
|
4689
|
+
var import_zod15 = require("zod");
|
|
4690
|
+
function buildTypeSchemaSummary() {
|
|
4691
|
+
return {
|
|
4692
|
+
version: "1.0",
|
|
4693
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4694
|
+
domains: {
|
|
4695
|
+
workflow: {
|
|
4696
|
+
description: "Workflow DSL \u2014 step definitions, auth blocks, field types, conditions",
|
|
4697
|
+
schemas: [
|
|
4698
|
+
"WorkflowFileSchema",
|
|
4699
|
+
"WorkflowDefinitionSchema",
|
|
4700
|
+
"WorkflowStepSchema",
|
|
4701
|
+
"WorkflowStepTypeSchema",
|
|
4702
|
+
"WorkflowFieldSchema",
|
|
4703
|
+
"WorkflowActionSchema",
|
|
4704
|
+
"WorkflowAuthSchema",
|
|
4705
|
+
"WorkflowThemeSchema",
|
|
4706
|
+
"TransitionConditionSchema",
|
|
4707
|
+
"PersistenceSchema"
|
|
4708
|
+
],
|
|
4709
|
+
otter: "stackwright-pro-workflow-otter",
|
|
4710
|
+
artifactKey: "workflowConfig"
|
|
4711
|
+
},
|
|
4712
|
+
auth: {
|
|
4713
|
+
description: "Authentication providers \u2014 PKI/CAC, OIDC, RBAC configuration",
|
|
4714
|
+
schemas: [
|
|
4715
|
+
"authConfigSchema",
|
|
4716
|
+
"pkiConfigSchema",
|
|
4717
|
+
"oidcConfigSchema",
|
|
4718
|
+
"rbacConfigSchema",
|
|
4719
|
+
"componentAuthSchema",
|
|
4720
|
+
"authUserSchema",
|
|
4721
|
+
"authSessionSchema"
|
|
4722
|
+
],
|
|
4723
|
+
otter: "stackwright-pro-auth-otter",
|
|
4724
|
+
artifactKey: "authConfig"
|
|
4725
|
+
},
|
|
4726
|
+
openapi: {
|
|
4727
|
+
description: "OpenAPI spec integration \u2014 collection config, endpoint filters, actions",
|
|
4728
|
+
interfaces: [
|
|
4729
|
+
"OpenAPIConfig",
|
|
4730
|
+
"ActionConfig",
|
|
4731
|
+
"EndpointFilter",
|
|
4732
|
+
"ApprovedSpec",
|
|
4733
|
+
"PrebuildSecurityConfig",
|
|
4734
|
+
"SiteConfig",
|
|
4735
|
+
"ValidationResult"
|
|
4736
|
+
],
|
|
4737
|
+
otter: "stackwright-pro-api-otter",
|
|
4738
|
+
artifactKey: "apiConfig"
|
|
4739
|
+
},
|
|
4740
|
+
pulse: {
|
|
4741
|
+
description: "Real-time data polling \u2014 source-agnostic polling options and states",
|
|
4742
|
+
interfaces: ["PulseOptions", "PulseMeta", "PulseState"],
|
|
4743
|
+
note: "React-bound types (PulseProps, PulseIndicatorProps) remain in @stackwright-pro/pulse"
|
|
4744
|
+
},
|
|
4745
|
+
enterprise: {
|
|
4746
|
+
description: "Enterprise collection access \u2014 multi-tenant provider extension",
|
|
4747
|
+
interfaces: [
|
|
4748
|
+
"EnterpriseCollectionProvider",
|
|
4749
|
+
"CollectionProvider",
|
|
4750
|
+
"CollectionEntry",
|
|
4751
|
+
"CollectionListOptions",
|
|
4752
|
+
"CollectionListResult",
|
|
4753
|
+
"TenantFilter",
|
|
4754
|
+
"Collection"
|
|
4755
|
+
],
|
|
4756
|
+
note: "CollectionProvider, CollectionEntry, CollectionListOptions, and CollectionListResult are re-exported from @stackwright/types (^1.5.0). EnterpriseCollectionProvider, TenantFilter, and Collection are Pro-only extensions."
|
|
4757
|
+
}
|
|
4758
|
+
}
|
|
4759
|
+
};
|
|
4760
|
+
}
|
|
4761
|
+
function registerTypeSchemasTool(server2) {
|
|
4762
|
+
server2.tool(
|
|
4763
|
+
"stackwright_pro_get_type_schemas",
|
|
4764
|
+
"Returns a structured summary of all canonical @stackwright-pro/types schemas, organized by domain. Use this to determine which otter owns a given schema and what artifact key to expect.",
|
|
4765
|
+
{
|
|
4766
|
+
format: import_zod15.z.enum(["full", "domains-only"]).optional().default("full").describe("full = complete summary with all fields; domains-only = just domain names")
|
|
4767
|
+
},
|
|
4768
|
+
async ({ format }) => {
|
|
4769
|
+
const summary = buildTypeSchemaSummary();
|
|
4770
|
+
const output = format === "domains-only" ? Object.keys(summary.domains) : summary;
|
|
4771
|
+
return {
|
|
4772
|
+
content: [{ type: "text", text: JSON.stringify(output, null, 2) }]
|
|
4773
|
+
};
|
|
4774
|
+
}
|
|
4775
|
+
);
|
|
4776
|
+
}
|
|
4777
|
+
|
|
3448
4778
|
// package.json
|
|
3449
4779
|
var package_default = {
|
|
3450
4780
|
dependencies: {
|
|
4781
|
+
"@stackwright-pro/types": "workspace:*",
|
|
3451
4782
|
"@modelcontextprotocol/sdk": "^1.10.0",
|
|
3452
4783
|
"@stackwright-pro/cli-data-explorer": "workspace:*",
|
|
3453
|
-
zod: "^4.3
|
|
4784
|
+
zod: "^4.4.3"
|
|
3454
4785
|
},
|
|
3455
4786
|
devDependencies: {
|
|
3456
|
-
"@types/node": "
|
|
3457
|
-
tsup: "
|
|
3458
|
-
typescript: "
|
|
3459
|
-
vitest: "
|
|
4787
|
+
"@types/node": "catalog:",
|
|
4788
|
+
tsup: "catalog:",
|
|
4789
|
+
typescript: "catalog:",
|
|
4790
|
+
vitest: "catalog:"
|
|
3460
4791
|
},
|
|
3461
4792
|
scripts: {
|
|
3462
4793
|
prepublishOnly: "node scripts/verify-integrity-sync.js",
|
|
@@ -3467,10 +4798,13 @@ var package_default = {
|
|
|
3467
4798
|
"test:coverage": "vitest run --coverage"
|
|
3468
4799
|
},
|
|
3469
4800
|
name: "@stackwright-pro/mcp",
|
|
3470
|
-
version: "0.2.0-alpha.
|
|
4801
|
+
version: "0.2.0-alpha.60",
|
|
3471
4802
|
description: "MCP tools for Stackwright Pro - Data Explorer, Security, ISR, and Dashboard generation",
|
|
3472
|
-
license: "
|
|
4803
|
+
license: "SEE LICENSE IN LICENSE",
|
|
3473
4804
|
main: "./dist/server.js",
|
|
4805
|
+
bin: {
|
|
4806
|
+
"stackwright-pro-mcp": "./dist/server.js"
|
|
4807
|
+
},
|
|
3474
4808
|
module: "./dist/server.mjs",
|
|
3475
4809
|
types: "./dist/server.d.ts",
|
|
3476
4810
|
exports: {
|
|
@@ -3483,6 +4817,11 @@ var package_default = {
|
|
|
3483
4817
|
types: "./dist/integrity.d.ts",
|
|
3484
4818
|
import: "./dist/integrity.mjs",
|
|
3485
4819
|
require: "./dist/integrity.js"
|
|
4820
|
+
},
|
|
4821
|
+
"./type-schemas": {
|
|
4822
|
+
types: "./dist/tools/type-schemas.d.ts",
|
|
4823
|
+
import: "./dist/tools/type-schemas.mjs",
|
|
4824
|
+
require: "./dist/tools/type-schemas.js"
|
|
3486
4825
|
}
|
|
3487
4826
|
},
|
|
3488
4827
|
files: [
|
|
@@ -3510,7 +4849,9 @@ registerPipelineTools(server);
|
|
|
3510
4849
|
registerSafeWriteTools(server);
|
|
3511
4850
|
registerAuthTools(server);
|
|
3512
4851
|
registerIntegrityTools(server);
|
|
4852
|
+
registerArtifactSigningTools(server);
|
|
3513
4853
|
registerDomainTools(server);
|
|
4854
|
+
registerTypeSchemasTool(server);
|
|
3514
4855
|
async function main() {
|
|
3515
4856
|
const transport = new import_stdio.StdioServerTransport();
|
|
3516
4857
|
await server.connect(transport);
|