@stackwright-pro/mcp 0.2.0-alpha.24 → 0.2.0-alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.mjs CHANGED
@@ -1877,6 +1877,7 @@ function registerOrchestrationTools(server2) {
1877
1877
  import { z as z10 } from "zod";
1878
1878
  import { readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync4, mkdirSync as mkdirSync3, lstatSync as lstatSync4 } from "fs";
1879
1879
  import { join as join3 } from "path";
1880
+ import { WorkflowFileSchema, authConfigSchema } from "@stackwright-pro/types";
1880
1881
  var PHASE_ORDER = [
1881
1882
  "designer",
1882
1883
  "theme",
@@ -2358,6 +2359,41 @@ function handleValidateArtifact(input) {
2358
2359
  };
2359
2360
  return { text: JSON.stringify(result), isError: false };
2360
2361
  }
2362
+ const PHASE_ZOD_VALIDATORS = {
2363
+ workflow: (artifact2) => {
2364
+ const workflowConfig = artifact2["workflowConfig"];
2365
+ if (!workflowConfig) return { success: true };
2366
+ const result = WorkflowFileSchema.safeParse(workflowConfig);
2367
+ if (!result.success) {
2368
+ const issues = result.error.issues.slice(0, 3).map((i) => `${i.path.join(".")}: ${i.message}`).join("; ");
2369
+ return { success: false, error: { message: issues } };
2370
+ }
2371
+ return { success: true };
2372
+ },
2373
+ auth: (artifact2) => {
2374
+ const authConfig = artifact2["authConfig"];
2375
+ if (!authConfig) return { success: true };
2376
+ const result = authConfigSchema.safeParse(authConfig);
2377
+ if (!result.success) {
2378
+ const issues = result.error.issues.slice(0, 3).map((i) => `${i.path.join(".")}: ${i.message}`).join("; ");
2379
+ return { success: false, error: { message: issues } };
2380
+ }
2381
+ return { success: true };
2382
+ }
2383
+ };
2384
+ const zodValidator = PHASE_ZOD_VALIDATORS[phase];
2385
+ if (zodValidator) {
2386
+ const zodResult = zodValidator(artifact);
2387
+ if (!zodResult.success) {
2388
+ const result = {
2389
+ valid: false,
2390
+ phase,
2391
+ violation: "schema-mismatch",
2392
+ retryPrompt: `Your artifact failed schema validation: ${zodResult.error?.message}. Fix these fields and return the corrected JSON artifact.`
2393
+ };
2394
+ return { text: JSON.stringify(result), isError: false };
2395
+ }
2396
+ }
2361
2397
  try {
2362
2398
  const artifactsDir = join3(cwd, ".stackwright", "artifacts");
2363
2399
  mkdirSync3(artifactsDir, { recursive: true });
@@ -3167,7 +3203,7 @@ var _checksums = /* @__PURE__ */ new Map([
3167
3203
  ],
3168
3204
  [
3169
3205
  "stackwright-pro-foreman-otter.json",
3170
- "7464523d7288374dc6efa5c213c825ec0616e00cf4f739d8039eb41df812cbc5"
3206
+ "a1145de792e2e38b5c5b2899664ceade989ecf1ec465a333c5b185387df59fe4"
3171
3207
  ],
3172
3208
  [
3173
3209
  "stackwright-pro-page-otter.json",
@@ -3763,9 +3799,100 @@ function registerDomainTools(server2) {
3763
3799
  );
3764
3800
  }
3765
3801
 
3802
+ // src/tools/type-schemas.ts
3803
+ import { z as z14 } from "zod";
3804
+ function buildTypeSchemaSummary() {
3805
+ return {
3806
+ version: "1.0",
3807
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
3808
+ domains: {
3809
+ workflow: {
3810
+ description: "Workflow DSL \u2014 step definitions, auth blocks, field types, conditions",
3811
+ schemas: [
3812
+ "WorkflowFileSchema",
3813
+ "WorkflowDefinitionSchema",
3814
+ "WorkflowStepSchema",
3815
+ "WorkflowStepTypeSchema",
3816
+ "WorkflowFieldSchema",
3817
+ "WorkflowActionSchema",
3818
+ "WorkflowAuthSchema",
3819
+ "WorkflowThemeSchema",
3820
+ "TransitionConditionSchema",
3821
+ "PersistenceSchema"
3822
+ ],
3823
+ otter: "stackwright-pro-workflow-otter",
3824
+ artifactKey: "workflowConfig"
3825
+ },
3826
+ auth: {
3827
+ description: "Authentication providers \u2014 PKI/CAC, OIDC, RBAC configuration",
3828
+ schemas: [
3829
+ "authConfigSchema",
3830
+ "pkiConfigSchema",
3831
+ "oidcConfigSchema",
3832
+ "rbacConfigSchema",
3833
+ "componentAuthSchema",
3834
+ "authUserSchema",
3835
+ "authSessionSchema"
3836
+ ],
3837
+ otter: "stackwright-pro-auth-otter",
3838
+ artifactKey: "authConfig"
3839
+ },
3840
+ openapi: {
3841
+ description: "OpenAPI spec integration \u2014 collection config, endpoint filters, actions",
3842
+ interfaces: [
3843
+ "OpenAPIConfig",
3844
+ "ActionConfig",
3845
+ "EndpointFilter",
3846
+ "ApprovedSpec",
3847
+ "PrebuildSecurityConfig",
3848
+ "SiteConfig",
3849
+ "ValidationResult"
3850
+ ],
3851
+ otter: "stackwright-pro-api-otter",
3852
+ artifactKey: "apiConfig"
3853
+ },
3854
+ pulse: {
3855
+ description: "Real-time data polling \u2014 source-agnostic polling options and states",
3856
+ interfaces: ["PulseOptions", "PulseMeta", "PulseState"],
3857
+ note: "React-bound types (PulseProps, PulseIndicatorProps) remain in @stackwright-pro/pulse"
3858
+ },
3859
+ enterprise: {
3860
+ description: "Enterprise collection access \u2014 multi-tenant provider extension",
3861
+ interfaces: [
3862
+ "EnterpriseCollectionProvider",
3863
+ "CollectionProvider",
3864
+ "CollectionEntry",
3865
+ "CollectionListOptions",
3866
+ "CollectionListResult",
3867
+ "TenantFilter",
3868
+ "Collection"
3869
+ ],
3870
+ note: "CollectionProvider stubs will be replaced with @stackwright/types imports once v1.5.0 publishes"
3871
+ }
3872
+ }
3873
+ };
3874
+ }
3875
+ function registerTypeSchemasTool(server2) {
3876
+ server2.tool(
3877
+ "stackwright_pro_get_type_schemas",
3878
+ "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.",
3879
+ {
3880
+ format: z14.enum(["full", "domains-only"]).optional().default("full").describe("full = complete summary with all fields; domains-only = just domain names")
3881
+ },
3882
+ async ({ format }) => {
3883
+ const summary = buildTypeSchemaSummary();
3884
+ const output = format === "domains-only" ? Object.keys(summary.domains) : summary;
3885
+ return {
3886
+ content: [{ type: "text", text: JSON.stringify(output, null, 2) }]
3887
+ };
3888
+ }
3889
+ );
3890
+ }
3891
+
3766
3892
  // package.json
3767
3893
  var package_default = {
3768
3894
  dependencies: {
3895
+ "@stackwright-pro/types": "workspace:*",
3769
3896
  "@modelcontextprotocol/sdk": "^1.10.0",
3770
3897
  "@stackwright-pro/cli-data-explorer": "workspace:*",
3771
3898
  zod: "^4.3.6"
@@ -3785,7 +3912,7 @@ var package_default = {
3785
3912
  "test:coverage": "vitest run --coverage"
3786
3913
  },
3787
3914
  name: "@stackwright-pro/mcp",
3788
- version: "0.2.0-alpha.24",
3915
+ version: "0.2.0-alpha.25",
3789
3916
  description: "MCP tools for Stackwright Pro - Data Explorer, Security, ISR, and Dashboard generation",
3790
3917
  license: "PROPRIETARY",
3791
3918
  main: "./dist/server.js",
@@ -3801,6 +3928,11 @@ var package_default = {
3801
3928
  types: "./dist/integrity.d.ts",
3802
3929
  import: "./dist/integrity.mjs",
3803
3930
  require: "./dist/integrity.js"
3931
+ },
3932
+ "./type-schemas": {
3933
+ types: "./dist/tools/type-schemas.d.ts",
3934
+ import: "./dist/tools/type-schemas.mjs",
3935
+ require: "./dist/tools/type-schemas.js"
3804
3936
  }
3805
3937
  },
3806
3938
  files: [
@@ -3829,6 +3961,7 @@ registerSafeWriteTools(server);
3829
3961
  registerAuthTools(server);
3830
3962
  registerIntegrityTools(server);
3831
3963
  registerDomainTools(server);
3964
+ registerTypeSchemasTool(server);
3832
3965
  async function main() {
3833
3966
  const transport = new StdioServerTransport();
3834
3967
  await server.connect(transport);