@stackwright-pro/mcp 0.2.0-alpha.114 → 0.2.0-alpha.117

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.
@@ -23,69 +23,253 @@ function getAllowedProps(schema) {
23
23
  }
24
24
  var COLUMN_ALLOWED_PROPS = getAllowedProps(ColumnSchema);
25
25
 
26
- // src/tools/validate-api-integration.ts
27
- var CANONICAL_API_AUTH_TYPES = ["apiKey", "bearer", "oauth2", "oidc", "none"];
28
- var CANONICAL_SET = new Set(CANONICAL_API_AUTH_TYPES);
29
- var VALID_SET_DISPLAY = CANONICAL_API_AUTH_TYPES.map((t) => `\`${t}\``).join(", ");
26
+ // src/tools/validate-theme-tokens.ts
27
+ import { load as yamlLoad2 } from "js-yaml";
30
28
 
31
- // src/tools/auth-manifest-aggregator.ts
29
+ // src/tools/schema-registry.ts
32
30
  import { z as z3 } from "zod";
33
-
34
- // src/tools/pipeline.ts
35
- import { WorkflowFileSchema, authConfigSchema as authConfigSchema3 } from "@stackwright-pro/types";
36
-
37
- // src/tools/get-schema.ts
38
- import { z as z5 } from "zod";
39
- import {
40
- WorkflowStepSchema as WorkflowStepSchema2,
41
- WorkflowDefinitionSchema as WorkflowDefinitionSchema2,
42
- WorkflowFieldSchema as WorkflowFieldSchema2,
43
- WorkflowActionSchema as WorkflowActionSchema2,
44
- authConfigSchema as authConfigSchema2
45
- } from "@stackwright-pro/types";
46
-
47
- // src/tools/validate-yaml-fragment.ts
48
- import { z as z4 } from "zod";
49
- import { load as yamlLoad2 } from "js-yaml";
31
+ import { readFileSync, existsSync } from "fs";
32
+ import { join } from "path";
50
33
  import {
51
34
  WorkflowStepSchema,
52
35
  WorkflowDefinitionSchema,
53
36
  WorkflowFieldSchema,
54
37
  WorkflowActionSchema,
55
- authConfigSchema
38
+ WorkflowWizardContentSchema,
39
+ authConfigSchema,
40
+ themeTokensFileSchema
56
41
  } from "@stackwright-pro/types";
57
- var NavigationLinkSchema = z4.lazy(
58
- () => z4.object({
59
- label: z4.string().min(1),
60
- href: z4.string().min(1),
61
- children: z4.array(NavigationLinkSchema).optional()
42
+ import {
43
+ MetricCardPulseSchema,
44
+ DataTablePulseSchema,
45
+ StatusBadgePulseSchema,
46
+ MapPulseSchema
47
+ } from "@stackwright-pro/pulse";
48
+ var NavigationLinkSchema = z3.lazy(
49
+ () => z3.object({
50
+ label: z3.string().min(1),
51
+ href: z3.string().min(1),
52
+ children: z3.array(NavigationLinkSchema).optional()
62
53
  })
63
54
  );
64
- var NavigationSectionSchema = z4.object({
65
- section: z4.string().min(1),
66
- items: z4.array(NavigationLinkSchema)
55
+ var NavigationSectionSchema = z3.object({
56
+ section: z3.string().min(1),
57
+ items: z3.array(NavigationLinkSchema)
67
58
  });
68
- var NavigationItemSchema = z4.union([
59
+ var NavigationItemSchema = z3.union([
69
60
  NavigationLinkSchema,
70
61
  NavigationSectionSchema
71
62
  ]);
63
+ var THEME_TOKENS_PATHS = [
64
+ join(".stackwright", "artifacts", "theme-tokens.json"),
65
+ join("public", "stackwright-content", "_theme.json")
66
+ ];
67
+ function resolveStatusLadder(projectRoot) {
68
+ for (const relPath of THEME_TOKENS_PATHS) {
69
+ const fullPath = join(projectRoot, relPath);
70
+ if (!existsSync(fullPath)) continue;
71
+ try {
72
+ const raw = readFileSync(fullPath, "utf-8");
73
+ const parsed = JSON.parse(raw);
74
+ if (Array.isArray(parsed["statusLadder"]) && parsed["statusLadder"].length > 0) {
75
+ return parsed["statusLadder"].filter(
76
+ (t) => typeof t === "string" && t.startsWith("status-")
77
+ );
78
+ }
79
+ const colors = parsed["tokens"]?.["colors"];
80
+ if (colors && typeof colors === "object") {
81
+ const statusKeys = Object.keys(colors).filter((k) => k.startsWith("status-"));
82
+ if (statusKeys.length > 0) return statusKeys;
83
+ }
84
+ } catch {
85
+ }
86
+ }
87
+ return [];
88
+ }
89
+ function buildThemeStatusTokenSchema(ctx) {
90
+ const ladder = resolveStatusLadder(ctx.projectRoot);
91
+ if (ladder.length === 0) {
92
+ return z3.string();
93
+ }
94
+ return z3.enum(ladder);
95
+ }
96
+ var REGISTRY = /* @__PURE__ */ new Map([
97
+ // ── Workflow schemas ──────────────────────────────────────────────────────
98
+ [
99
+ "workflow_step",
100
+ {
101
+ schema: WorkflowStepSchema,
102
+ synonyms: {
103
+ label: ["title", "name"],
104
+ message: ["description"],
105
+ "theme.variant": ["style"],
106
+ "on_submit.transition": ["transitions"]
107
+ },
108
+ phaseAffinity: ["workflow"]
109
+ }
110
+ ],
111
+ [
112
+ "workflow_definition",
113
+ {
114
+ schema: WorkflowDefinitionSchema,
115
+ synonyms: {
116
+ label: ["title", "name"],
117
+ id: ["type"]
118
+ },
119
+ phaseAffinity: ["workflow"]
120
+ }
121
+ ],
122
+ [
123
+ "workflow_field",
124
+ {
125
+ schema: WorkflowFieldSchema,
126
+ synonyms: {
127
+ name: ["id"],
128
+ label: ["title", "description"]
129
+ },
130
+ phaseAffinity: ["workflow"]
131
+ }
132
+ ],
133
+ [
134
+ "workflow_action",
135
+ {
136
+ schema: WorkflowActionSchema,
137
+ synonyms: {
138
+ label: ["title", "name"],
139
+ transition: ["then"],
140
+ "theme.variant": ["style"],
141
+ action: ["on_click"]
142
+ },
143
+ phaseAffinity: ["workflow"]
144
+ }
145
+ ],
146
+ // ── Navigation ────────────────────────────────────────────────────────────
147
+ [
148
+ "navigation_item",
149
+ {
150
+ schema: NavigationItemSchema,
151
+ synonyms: {
152
+ items: ["children"],
153
+ section: ["label", "title"]
154
+ },
155
+ phaseAffinity: ["pages", "dashboard", "polish"]
156
+ }
157
+ ],
158
+ // ── Auth ──────────────────────────────────────────────────────────────────
159
+ [
160
+ "auth_config",
161
+ {
162
+ schema: authConfigSchema,
163
+ synonyms: {
164
+ type: ["method", "provider_type", "strategy"]
165
+ },
166
+ phaseAffinity: ["auth"]
167
+ }
168
+ ],
169
+ // ── Pulse content types ───────────────────────────────────────────────────
170
+ [
171
+ "metric_card_pulse",
172
+ {
173
+ schema: MetricCardPulseSchema,
174
+ synonyms: {
175
+ field: ["valueField", "valuePath", "dataField", "value"]
176
+ },
177
+ phaseAffinity: ["dashboard", "pages"]
178
+ }
179
+ ],
180
+ [
181
+ "data_table_pulse",
182
+ {
183
+ schema: DataTablePulseSchema,
184
+ synonyms: {
185
+ header: ["label"],
186
+ type: ["renderAs"],
187
+ colorMap: ["severityMap"]
188
+ },
189
+ phaseAffinity: ["dashboard", "pages"]
190
+ }
191
+ ],
192
+ [
193
+ "status_badge_pulse",
194
+ {
195
+ schema: StatusBadgePulseSchema,
196
+ synonyms: {},
197
+ phaseAffinity: ["dashboard", "pages"]
198
+ }
199
+ ],
200
+ [
201
+ "map_pulse",
202
+ {
203
+ schema: MapPulseSchema,
204
+ synonyms: {},
205
+ phaseAffinity: ["geo", "dashboard", "pages"]
206
+ }
207
+ ],
208
+ // ── Workflow container page content type (swp-dvde) ───────────────────────
209
+ [
210
+ "workflow_wizard",
211
+ {
212
+ schema: WorkflowWizardContentSchema,
213
+ synonyms: {
214
+ workflowFile: ["workflowPath", "file", "path", "yamlFile"],
215
+ workflowId: ["id", "workflowName", "name"],
216
+ persistenceKey: ["stateKey", "storageKey"]
217
+ },
218
+ phaseAffinity: ["workflow"]
219
+ }
220
+ ],
221
+ // ── Theme schemas (swp-cxwu) ──────────────────────────────────────────────
222
+ [
223
+ "theme_tokens",
224
+ {
225
+ schema: themeTokensFileSchema,
226
+ synonyms: {},
227
+ phaseAffinity: ["theme"]
228
+ }
229
+ ],
230
+ [
231
+ "theme_status_token",
232
+ {
233
+ // No static schema — this is a project-specific runtime enum.
234
+ // Call getSchemaForEntry(entry, { projectRoot }) to get the project's ladder.
235
+ schemaFactory: buildThemeStatusTokenSchema,
236
+ synonyms: {},
237
+ phaseAffinity: ["pages", "dashboard", "geo"]
238
+ }
239
+ ]
240
+ ]);
241
+ var REGISTRY_SCHEMA_NAMES = Array.from(REGISTRY.keys());
242
+ function buildPhaseSchemaNames() {
243
+ const phaseMap = {};
244
+ for (const [name, entry] of REGISTRY.entries()) {
245
+ for (const phase of entry.phaseAffinity ?? []) {
246
+ if (!phaseMap[phase]) phaseMap[phase] = [];
247
+ phaseMap[phase].push(name);
248
+ }
249
+ }
250
+ return phaseMap;
251
+ }
252
+
253
+ // src/tools/validate-build-context-globals.ts
254
+ import { load as yamlLoad3 } from "js-yaml";
255
+
256
+ // src/tools/validate-workflow-container-pages.ts
257
+ import { load as yamlLoad4 } from "js-yaml";
258
+
259
+ // src/tools/validate-api-integration.ts
260
+ var CANONICAL_API_AUTH_TYPES = ["apiKey", "bearer", "oauth2", "oidc", "none"];
261
+ var CANONICAL_SET = new Set(CANONICAL_API_AUTH_TYPES);
262
+ var VALID_SET_DISPLAY = CANONICAL_API_AUTH_TYPES.map((t) => `\`${t}\``).join(", ");
263
+
264
+ // src/tools/auth-manifest-aggregator.ts
265
+ import { z as z4 } from "zod";
266
+
267
+ // src/tools/pipeline.ts
268
+ import { WorkflowFileSchema, authConfigSchema as authConfigSchema2 } from "@stackwright-pro/types";
72
269
 
73
270
  // src/tools/get-schema.ts
74
- var NavigationLinkSchema2 = z5.lazy(
75
- () => z5.object({
76
- label: z5.string().min(1),
77
- href: z5.string().min(1),
78
- children: z5.array(NavigationLinkSchema2).optional()
79
- })
80
- );
81
- var NavigationSectionSchema2 = z5.object({
82
- section: z5.string().min(1),
83
- items: z5.array(NavigationLinkSchema2)
84
- });
85
- var NavigationItemSchema2 = z5.union([
86
- NavigationLinkSchema2,
87
- NavigationSectionSchema2
88
- ]);
271
+ import { z as z5 } from "zod";
272
+ var PHASE_SCHEMA_NAMES = buildPhaseSchemaNames();
89
273
 
90
274
  // src/tools/pipeline.ts
91
275
  import { emit } from "@stackwright-pro/telemetry";
@@ -215,7 +399,12 @@ var PHASE_ARTIFACT_SCHEMA = {
215
399
  "--surface": "210 40% 98%",
216
400
  "--border": "214.3 31.8% 91.4%"
217
401
  },
218
- dark: { "--background": "222.2 84% 4.9%", "--foreground": "210 40% 98%" }
402
+ dark: { "--background": "222.2 84% 4.9%", "--foreground": "210 40% 98%" },
403
+ // Optional — include when design language has status semantics (swp-cxwu).
404
+ // Array of status-* token names emitted in tokens.colors.
405
+ // Consumed by validate_artifact theme enforcement to reject unknown status tokens.
406
+ // OMIT if project has no status-coded data.
407
+ statusLadder: ["status-ok", "status-warning", "status-error", "status-info"]
219
408
  },
220
409
  null,
221
410
  2