@stackwright-pro/mcp 0.2.0-alpha.10 → 0.2.0-alpha.100

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.
@@ -0,0 +1,430 @@
1
+ // src/tools/pipeline.ts
2
+ import { z as z5 } from "zod";
3
+ import { lockSync } from "proper-lockfile";
4
+
5
+ // src/coerce.ts
6
+ import { z } from "zod";
7
+
8
+ // src/artifact-signing.ts
9
+ import { z as z2 } from "zod";
10
+
11
+ // src/tools/pipeline.ts
12
+ import { WorkflowFileSchema, authConfigSchema as authConfigSchema3 } from "@stackwright-pro/types";
13
+
14
+ // src/tools/get-schema.ts
15
+ import { z as z4 } from "zod";
16
+ import {
17
+ WorkflowStepSchema as WorkflowStepSchema2,
18
+ WorkflowDefinitionSchema as WorkflowDefinitionSchema2,
19
+ WorkflowFieldSchema as WorkflowFieldSchema2,
20
+ WorkflowActionSchema as WorkflowActionSchema2,
21
+ authConfigSchema as authConfigSchema2
22
+ } from "@stackwright-pro/types";
23
+
24
+ // src/tools/validate-yaml-fragment.ts
25
+ import { z as z3 } from "zod";
26
+ import { load as yamlLoad } from "js-yaml";
27
+ import {
28
+ WorkflowStepSchema,
29
+ WorkflowDefinitionSchema,
30
+ WorkflowFieldSchema,
31
+ WorkflowActionSchema,
32
+ authConfigSchema
33
+ } from "@stackwright-pro/types";
34
+ var NavigationLinkSchema = z3.lazy(
35
+ () => z3.object({
36
+ label: z3.string().min(1),
37
+ href: z3.string().min(1),
38
+ children: z3.array(NavigationLinkSchema).optional()
39
+ })
40
+ );
41
+ var NavigationSectionSchema = z3.object({
42
+ section: z3.string().min(1),
43
+ items: z3.array(NavigationLinkSchema)
44
+ });
45
+ var NavigationItemSchema = z3.union([
46
+ NavigationLinkSchema,
47
+ NavigationSectionSchema
48
+ ]);
49
+
50
+ // src/tools/get-schema.ts
51
+ var NavigationLinkSchema2 = z4.lazy(
52
+ () => z4.object({
53
+ label: z4.string().min(1),
54
+ href: z4.string().min(1),
55
+ children: z4.array(NavigationLinkSchema2).optional()
56
+ })
57
+ );
58
+ var NavigationSectionSchema2 = z4.object({
59
+ section: z4.string().min(1),
60
+ items: z4.array(NavigationLinkSchema2)
61
+ });
62
+ var NavigationItemSchema2 = z4.union([
63
+ NavigationLinkSchema2,
64
+ NavigationSectionSchema2
65
+ ]);
66
+
67
+ // src/tools/pipeline.ts
68
+ import { emit } from "@stackwright-pro/telemetry";
69
+ var PHASE_ORDER = [
70
+ "designer",
71
+ "theme",
72
+ "scaffold",
73
+ // generates app/ directory from config
74
+ "api",
75
+ "data",
76
+ "auth",
77
+ // moved earlier — only depends on design-language.json (designer)
78
+ "geo",
79
+ "workflow",
80
+ "services",
81
+ "pages",
82
+ "dashboard",
83
+ "polish",
84
+ "qa"
85
+ ];
86
+ var PHASE_ARTIFACT = {
87
+ designer: "design-language.json",
88
+ theme: "theme-tokens.json",
89
+ scaffold: "scaffold-manifest.json",
90
+ api: "api-config.json",
91
+ auth: "auth-config.json",
92
+ data: "data-config.json",
93
+ pages: "pages-manifest.json",
94
+ dashboard: "dashboard-manifest.json",
95
+ workflow: "workflow-config.json",
96
+ services: "services-config.json",
97
+ polish: "polish-manifest.json",
98
+ geo: "geo-manifest.json",
99
+ qa: "qa-findings.json"
100
+ };
101
+ var PHASE_ARTIFACT_SCHEMA = {
102
+ designer: JSON.stringify(
103
+ {
104
+ version: "1.0",
105
+ generatedBy: "stackwright-pro-designer-otter",
106
+ application: {
107
+ type: "<operational|data-explorer|admin|logistics|general>",
108
+ environment: "<workstation|field|control-room|mixed>",
109
+ density: "<compact|balanced|spacious>",
110
+ accessibility: "<wcag-aa|section-508|none>",
111
+ colorScheme: "<light|dark|both>"
112
+ },
113
+ designLanguage: {
114
+ rationale: "<design rationale>",
115
+ spacingScale: { base: 8, scale: [0, 4, 8, 16, 24, 32, 48, 64] },
116
+ colorSemantics: { primary: "#1a365d", accent: "#e53e3e" },
117
+ typography: {
118
+ dataFont: "Inter",
119
+ headingFont: "Inter",
120
+ monoFont: "monospace",
121
+ dataSizePx: 12,
122
+ bodySizePx: 14
123
+ },
124
+ contrastRatio: "4.5",
125
+ borderRadius: "4",
126
+ shadowElevation: "standard"
127
+ },
128
+ themeTokenSeeds: {
129
+ light: {
130
+ background: "#ffffff",
131
+ foreground: "#1a1a1a",
132
+ primary: "#1a365d",
133
+ surface: "#f7f7f7",
134
+ border: "#e2e8f0"
135
+ },
136
+ dark: {
137
+ background: "#1a1a1a",
138
+ foreground: "#ffffff",
139
+ primary: "#90cdf4",
140
+ surface: "#2d2d2d",
141
+ border: "#4a5568"
142
+ }
143
+ },
144
+ conformsTo: null,
145
+ operationalNotes: []
146
+ },
147
+ null,
148
+ 2
149
+ ),
150
+ theme: JSON.stringify(
151
+ {
152
+ version: "1.0",
153
+ generatedBy: "stackwright-pro-theme-otter",
154
+ componentLibrary: "shadcn",
155
+ colorScheme: "<light|dark|both>",
156
+ tokens: {
157
+ colors: { "primary-500": "#1a365d", background: "#ffffff" },
158
+ spacing: { "spacing-1": "8px", "spacing-2": "16px" },
159
+ typography: { "font-data": "Inter", "text-sm": "12px" },
160
+ shape: { "radius-sm": "4px", "radius-md": "8px" },
161
+ shadows: { "shadow-sm": "0 1px 2px rgba(0,0,0,0.08)" }
162
+ },
163
+ cssVariables: {
164
+ "--background": "0 0% 100%",
165
+ "--foreground": "222.2 84% 4.9%",
166
+ "--primary": "222.2 47.4% 11.2%",
167
+ "--primary-foreground": "210 40% 98%",
168
+ "--surface": "210 40% 98%",
169
+ "--border": "214.3 31.8% 91.4%"
170
+ },
171
+ dark: { "--background": "222.2 84% 4.9%", "--foreground": "210 40% 98%" }
172
+ },
173
+ null,
174
+ 2
175
+ ),
176
+ scaffold: JSON.stringify(
177
+ {
178
+ version: "1.0",
179
+ generatedBy: "stackwright-pro-scaffold-otter",
180
+ // REQUIRED: appRouterFiles is a required key — NOT 'files' (see swp-k3mb)
181
+ appRouterFiles: [
182
+ "app/layout.tsx",
183
+ "app/_components/page-client.tsx",
184
+ "app/page.tsx",
185
+ "app/[...slug]/page.tsx",
186
+ "app/_components/providers.tsx",
187
+ "app/not-found.tsx"
188
+ ],
189
+ title: "<title from stackwright.yml>",
190
+ hasCollectionEndpoints: false,
191
+ hasAuthConfig: true
192
+ },
193
+ null,
194
+ 2
195
+ ),
196
+ api: JSON.stringify(
197
+ {
198
+ version: "1.0",
199
+ generatedBy: "stackwright-pro-api-otter",
200
+ entities: [
201
+ {
202
+ name: "Shipment",
203
+ endpoint: "/shipments",
204
+ method: "GET",
205
+ revalidate: 60,
206
+ mutationType: null
207
+ }
208
+ ],
209
+ skipped: [
210
+ {
211
+ spec: "ais-message-models.yaml",
212
+ format: "asyncapi",
213
+ reason: "AsyncAPI spec \u2014 WebSocket/event integration required (no REST endpoints)"
214
+ }
215
+ ],
216
+ warnings: [
217
+ "Spec contains external $ref URLs \u2014 recommend bundle: true in stackwright.yml integration config"
218
+ ],
219
+ auth: { type: "bearer", header: "Authorization", envVar: "API_TOKEN" },
220
+ baseUrl: "https://api.example.mil/v2",
221
+ specPath: "./specs/api.yaml"
222
+ },
223
+ null,
224
+ 2
225
+ ),
226
+ data: JSON.stringify(
227
+ {
228
+ version: "1.0",
229
+ generatedBy: "stackwright-pro-data-otter",
230
+ strategy: "<pulse-fast|isr-fast|isr-standard|isr-slow>",
231
+ pulseMode: false,
232
+ collections: [{ name: "equipment", revalidate: 60, pulse: false }],
233
+ endpoints: { included: ["/equipment/**"], excluded: ["/admin/**"] },
234
+ requiredPackages: { dependencies: {}, devPackages: {} }
235
+ },
236
+ null,
237
+ 2
238
+ ),
239
+ geo: JSON.stringify(
240
+ {
241
+ version: "1.0",
242
+ generatedBy: "stackwright-pro-geo-otter",
243
+ geoCollections: [
244
+ {
245
+ collection: "vessels",
246
+ latField: "latitude",
247
+ lngField: "longitude",
248
+ labelField: "vesselName",
249
+ colorField: "navigationStatus"
250
+ }
251
+ ],
252
+ pages: [
253
+ {
254
+ slug: "fleet-tracker",
255
+ type: "<tracker|zone|route|combined>",
256
+ collections: ["vessels"],
257
+ hasLayers: false
258
+ }
259
+ ]
260
+ },
261
+ null,
262
+ 2
263
+ ),
264
+ workflow: JSON.stringify(
265
+ {
266
+ version: "1.0",
267
+ generatedBy: "stackwright-pro-form-wizard-otter",
268
+ // Root key is `workflow` — NOT `workflowConfig` (see swp-k7cl)
269
+ workflow: {
270
+ id: "procurement-approval",
271
+ route: "/procurement",
272
+ files: ["workflows/procurement-approval.yml"],
273
+ serviceDependencies: ["service:workflow-state"],
274
+ warnings: []
275
+ }
276
+ },
277
+ null,
278
+ 2
279
+ ),
280
+ services: JSON.stringify(
281
+ {
282
+ version: "1.0",
283
+ generatedBy: "stackwright-services-otter",
284
+ flows: [
285
+ {
286
+ name: "at-risk-patients",
287
+ trigger: "<http|event|schedule|queue>",
288
+ steps: 3,
289
+ outputSpec: "at-risk-patients.openapi.json"
290
+ }
291
+ ],
292
+ workflows: [
293
+ {
294
+ name: "evacuation-coordination",
295
+ states: 4,
296
+ transitions: 5
297
+ }
298
+ ],
299
+ openApiSpecs: ["at-risk-patients.openapi.json"],
300
+ capabilitiesUsed: ["service.call", "collection.join", "collection.filter"]
301
+ },
302
+ null,
303
+ 2
304
+ ),
305
+ pages: JSON.stringify(
306
+ {
307
+ version: "1.0",
308
+ generatedBy: "stackwright-pro-page-otter",
309
+ pages: [
310
+ {
311
+ slug: "catalog",
312
+ type: "collection_listing",
313
+ collection: "products",
314
+ themeApplied: true,
315
+ authRequired: false
316
+ },
317
+ {
318
+ slug: "admin",
319
+ type: "protected",
320
+ collection: null,
321
+ themeApplied: true,
322
+ authRequired: true
323
+ }
324
+ ]
325
+ },
326
+ null,
327
+ 2
328
+ ),
329
+ dashboard: JSON.stringify(
330
+ {
331
+ version: "1.0",
332
+ generatedBy: "stackwright-pro-dashboard-otter",
333
+ pages: [
334
+ {
335
+ slug: "dashboard",
336
+ layout: "<grid|table|mixed>",
337
+ collections: ["equipment", "supplies"],
338
+ mode: "<ISR|Pulse>"
339
+ }
340
+ ]
341
+ },
342
+ null,
343
+ 2
344
+ ),
345
+ // type: 'pki' = CAC/DoD certificate auth | 'oidc' = enterprise SSO
346
+ // For dev-only mock auth: use type: 'oidc' with devOnly: true (Zod strips devOnly — it's a convention only)
347
+ auth: JSON.stringify(
348
+ {
349
+ version: "1.0",
350
+ generatedBy: "stackwright-pro-auth-otter",
351
+ authConfig: {
352
+ type: "<pki|oidc>",
353
+ // OIDC-only fields (omit for pki):
354
+ provider: "<azure_ad|okta|cognito|auth0|authentik|keycloak|custom>",
355
+ discoveryUrl: "<IdP OIDC discovery URL>",
356
+ clientId: "<OIDC client ID>",
357
+ clientSecret: "<OIDC client secret>",
358
+ rbacRoles: ["ADMIN", "ANALYST"],
359
+ rbacDefaultRole: "ANALYST",
360
+ protectedRoutes: ["/dashboard/:path*", "/procurement/:path*"],
361
+ auditEnabled: true,
362
+ auditRetentionDays: 90
363
+ },
364
+ // devScripts is OPTIONAL — only present when devOnly: true was used
365
+ // Polish otter and foreman MUST check devScripts.written before referencing scripts
366
+ devScripts: {
367
+ written: true,
368
+ scripts: { "dev:admin": "MOCK_USER=admin next dev" }
369
+ }
370
+ },
371
+ null,
372
+ 2
373
+ ),
374
+ polish: JSON.stringify(
375
+ {
376
+ version: "1.0",
377
+ generatedBy: "stackwright-pro-polish-otter",
378
+ landingPage: { slug: "", rewritten: true },
379
+ navigation: { itemCount: 5, items: ["/dashboard", "/equipment", "/workflows"] },
380
+ gettingStarted: "<rewritten|redirected|not-found>",
381
+ scaffoldCleanup: {
382
+ deleted: ["content/posts/getting-started.yaml"],
383
+ rewritten: ["app/not-found.tsx"],
384
+ skipped: []
385
+ }
386
+ },
387
+ null,
388
+ 2
389
+ ),
390
+ qa: JSON.stringify(
391
+ {
392
+ version: "1.0",
393
+ generatedBy: "stackwright-pro-qa-otter",
394
+ // skipped: true path — when dev server is unreachable at audit time
395
+ // skipped: false path — full audit completed
396
+ skipped: false,
397
+ skipReason: null,
398
+ wcagLevel: "<AA|AAA>",
399
+ summary: {
400
+ routesAudited: 3,
401
+ serious: 0,
402
+ moderate: 1,
403
+ minor: 0
404
+ },
405
+ findings: [
406
+ {
407
+ id: "qa-001",
408
+ route: "/dashboard",
409
+ severity: "<serious|moderate|minor>",
410
+ category: "<visual|a11y|design-contract|runtime>",
411
+ finding: "Human-readable description of what was observed",
412
+ evidence: {
413
+ screenshot: ".stackwright/qa/screenshots/dashboard-light.png",
414
+ consoleErrors: [],
415
+ axeViolations: []
416
+ },
417
+ suggested_otters: ["stackwright-pro-theme-otter"],
418
+ suggested_fix: "Specific, concrete next step the repair otter should take"
419
+ }
420
+ ]
421
+ },
422
+ null,
423
+ 2
424
+ )
425
+ };
426
+ export {
427
+ PHASE_ARTIFACT,
428
+ PHASE_ORDER
429
+ };
430
+ //# sourceMappingURL=pipeline-constants.mjs.map