@contractspec/lib.contracts 1.46.2 → 1.47.0

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.
Files changed (103) hide show
  1. package/dist/app-config/app-config.capability.d.ts +7 -0
  2. package/dist/app-config/app-config.capability.js +23 -0
  3. package/dist/app-config/app-config.feature.d.ts +1 -2
  4. package/dist/app-config/app-config.feature.js +9 -2
  5. package/dist/app-config/contracts.d.ts +50 -50
  6. package/dist/app-config/events.d.ts +27 -27
  7. package/dist/app-config/index.d.ts +4 -3
  8. package/dist/app-config/index.js +3 -2
  9. package/dist/app-config/lifecycle-contracts.d.ts +55 -55
  10. package/dist/app-config/runtime.d.ts +6 -6
  11. package/dist/app-config/spec.d.ts +9 -5
  12. package/dist/app-config/spec.js +5 -1
  13. package/dist/contract-registry/schemas.d.ts +2 -2
  14. package/dist/data-views/runtime.d.ts +5 -1
  15. package/dist/data-views/runtime.js +34 -7
  16. package/dist/data-views/spec.d.ts +1 -1
  17. package/dist/docs/index.js +2 -1
  18. package/dist/docs/tech/cli.docblock.d.ts +6 -0
  19. package/dist/docs/tech/cli.docblock.js +138 -0
  20. package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +106 -1
  21. package/dist/docs/tech/studio/project-access-teams.docblock.js +3 -1
  22. package/dist/examples/index.d.ts +9 -1
  23. package/dist/examples/index.js +8 -1
  24. package/dist/examples/registry.d.ts +3 -25
  25. package/dist/examples/registry.js +4 -60
  26. package/dist/examples/schema.d.ts +17 -17
  27. package/dist/examples/types.d.ts +1 -1
  28. package/dist/features/types.d.ts +1 -1
  29. package/dist/index.d.ts +27 -26
  30. package/dist/index.js +6 -6
  31. package/dist/install.d.ts +1 -1
  32. package/dist/integrations/index.d.ts +2 -2
  33. package/dist/integrations/index.js +2 -2
  34. package/dist/integrations/integrations.capability.d.ts +7 -0
  35. package/dist/integrations/integrations.capability.js +17 -0
  36. package/dist/integrations/integrations.feature.d.ts +1 -2
  37. package/dist/integrations/integrations.feature.js +9 -2
  38. package/dist/integrations/openbanking/contracts/accounts.d.ts +66 -66
  39. package/dist/integrations/openbanking/contracts/balances.d.ts +34 -34
  40. package/dist/integrations/openbanking/models.d.ts +55 -55
  41. package/dist/integrations/openbanking/openbanking.capability.d.ts +7 -0
  42. package/dist/integrations/openbanking/openbanking.capability.js +21 -0
  43. package/dist/integrations/openbanking/openbanking.feature.d.ts +1 -2
  44. package/dist/integrations/openbanking/openbanking.feature.js +9 -2
  45. package/dist/integrations/operations.d.ts +102 -102
  46. package/dist/integrations/providers/elevenlabs.d.ts +1 -0
  47. package/dist/integrations/providers/elevenlabs.js +3 -2
  48. package/dist/integrations/providers/gcs-storage.d.ts +1 -0
  49. package/dist/integrations/providers/gcs-storage.js +3 -2
  50. package/dist/integrations/providers/gmail.d.ts +1 -0
  51. package/dist/integrations/providers/gmail.js +3 -2
  52. package/dist/integrations/providers/google-calendar.d.ts +1 -0
  53. package/dist/integrations/providers/google-calendar.js +3 -2
  54. package/dist/integrations/providers/impls/provider-factory.js +2 -1
  55. package/dist/integrations/providers/mistral.d.ts +1 -0
  56. package/dist/integrations/providers/mistral.js +3 -2
  57. package/dist/integrations/providers/postmark.d.ts +1 -0
  58. package/dist/integrations/providers/postmark.js +3 -2
  59. package/dist/integrations/providers/powens.d.ts +1 -0
  60. package/dist/integrations/providers/powens.js +3 -2
  61. package/dist/integrations/providers/qdrant.d.ts +1 -0
  62. package/dist/integrations/providers/qdrant.js +3 -2
  63. package/dist/integrations/providers/stripe.d.ts +1 -0
  64. package/dist/integrations/providers/stripe.js +3 -2
  65. package/dist/integrations/providers/twilio-sms.d.ts +1 -0
  66. package/dist/integrations/providers/twilio-sms.js +3 -2
  67. package/dist/integrations/spec.d.ts +5 -1
  68. package/dist/integrations/spec.js +5 -1
  69. package/dist/knowledge/knowledge.capability.d.ts +7 -0
  70. package/dist/knowledge/knowledge.capability.js +21 -0
  71. package/dist/knowledge/knowledge.feature.d.ts +1 -2
  72. package/dist/knowledge/knowledge.feature.js +9 -2
  73. package/dist/knowledge/operations.d.ts +66 -66
  74. package/dist/llm/exporters.d.ts +1 -1
  75. package/dist/llm/types.d.ts +1 -1
  76. package/dist/onboarding-base.d.ts +29 -29
  77. package/dist/operations/operation.d.ts +1 -1
  78. package/dist/server/mcp/createMcpServer.js +1 -1
  79. package/dist/server/mcp/mcpTypes.d.ts +1 -1
  80. package/dist/server/mcp/registerPresentations.js +1 -1
  81. package/dist/server/mcp/registerResources.js +2 -2
  82. package/dist/tests/index.d.ts +2 -2
  83. package/dist/tests/index.js +2 -2
  84. package/dist/tests/spec.d.ts +2 -1
  85. package/dist/tests/spec.js +4 -1
  86. package/dist/types.d.ts +2 -2
  87. package/dist/workflow/index.d.ts +8 -1
  88. package/dist/workflow/index.js +8 -1
  89. package/dist/workflow/runner.d.ts +2 -2
  90. package/dist/workflow/spec.d.ts +1 -1
  91. package/dist/workflow/validation.d.ts +1 -1
  92. package/dist/workspace-config/contractsrc-schema.d.ts +45 -974
  93. package/dist/workspace-config/contractsrc-schema.js +89 -55
  94. package/dist/workspace-config/contractsrc-types.d.ts +346 -0
  95. package/dist/workspace-config/contractsrc-types.js +0 -0
  96. package/dist/workspace-config/index.d.ts +3 -2
  97. package/package.json +27 -25
  98. package/dist/docs/tech/contracts/create-subscription.docblock.d.ts +0 -6
  99. package/dist/docs/tech/contracts/create-subscription.docblock.js +0 -21
  100. package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.d.ts +0 -6
  101. package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +0 -21
  102. package/dist/docs/tech/templates/runtime.docblock.d.ts +0 -6
  103. package/dist/docs/tech/templates/runtime.docblock.js +0 -21
@@ -22,13 +22,13 @@ const SchemaFormatSchema = z$2.enum([
22
22
  */
23
23
  const OpenApiSourceConfigSchema = z$2.object({
24
24
  name: z$2.string(),
25
- url: z$2.url().optional(),
25
+ url: z$2.string().url().optional(),
26
26
  file: z$2.string().optional(),
27
27
  syncMode: z$2.enum([
28
28
  "import",
29
29
  "sync",
30
30
  "validate"
31
- ]).default("validate"),
31
+ ]).default("validate").optional(),
32
32
  tags: z$2.array(z$2.string()).optional(),
33
33
  exclude: z$2.array(z$2.string()).optional(),
34
34
  include: z$2.array(z$2.string()).optional(),
@@ -45,11 +45,11 @@ const OpenApiSourceConfigSchema = z$2.object({
45
45
  "admin"
46
46
  ]).optional(),
47
47
  defaultOwners: z$2.array(z$2.string()).optional(),
48
- schemaFormat: SchemaFormatSchema.default("contractspec")
48
+ schemaFormat: SchemaFormatSchema.default("contractspec").optional()
49
49
  });
50
50
  const OpenApiExportConfigSchema = z$2.object({
51
- outputPath: z$2.string().default("./openapi.json"),
52
- format: z$2.enum(["json", "yaml"]).default("json"),
51
+ outputPath: z$2.string().default("./openapi.json").optional(),
52
+ format: z$2.enum(["json", "yaml"]).default("json").optional(),
53
53
  title: z$2.string().optional(),
54
54
  version: z$2.string().optional(),
55
55
  description: z$2.string().optional(),
@@ -89,12 +89,12 @@ const GroupingRuleSchema = z$2.object({
89
89
  * Output directory conventions for generated specs.
90
90
  */
91
91
  const FolderConventionsSchema = z$2.object({
92
- models: z$2.string().default("models"),
93
- operations: z$2.string().default("operations/commands|queries"),
94
- events: z$2.string().default("events"),
95
- presentations: z$2.string().default("presentations"),
96
- forms: z$2.string().default("forms"),
97
- groupByFeature: z$2.boolean().default(true),
92
+ models: z$2.string().default("models").optional(),
93
+ operations: z$2.string().default("operations/commands|queries").optional(),
94
+ events: z$2.string().default("events").optional(),
95
+ presentations: z$2.string().default("presentations").optional(),
96
+ forms: z$2.string().default("forms").optional(),
97
+ groupByFeature: z$2.boolean().default(true).optional(),
98
98
  operationsGrouping: GroupingRuleSchema.optional(),
99
99
  modelsGrouping: GroupingRuleSchema.optional(),
100
100
  eventsGrouping: GroupingRuleSchema.optional()
@@ -103,24 +103,24 @@ const FolderConventionsSchema = z$2.object({
103
103
  * PR comment configuration for CI/CD.
104
104
  */
105
105
  const PrCommentConfigSchema = z$2.object({
106
- enabled: z$2.boolean().default(true),
107
- template: z$2.enum(["minimal", "detailed"]).default("detailed"),
108
- updateExisting: z$2.boolean().default(true)
106
+ enabled: z$2.boolean().default(true).optional(),
107
+ template: z$2.enum(["minimal", "detailed"]).default("detailed").optional(),
108
+ updateExisting: z$2.boolean().default(true).optional()
109
109
  });
110
110
  /**
111
111
  * GitHub check run configuration for CI/CD.
112
112
  */
113
113
  const CheckRunConfigSchema = z$2.object({
114
- enabled: z$2.boolean().default(true),
115
- name: z$2.string().default("ContractSpec Impact"),
116
- failOnBreaking: z$2.boolean().default(true),
117
- failOnChanges: z$2.boolean().default(false)
114
+ enabled: z$2.boolean().default(true).optional(),
115
+ name: z$2.string().default("ContractSpec Impact").optional(),
116
+ failOnBreaking: z$2.boolean().default(true).optional(),
117
+ failOnChanges: z$2.boolean().default(false).optional()
118
118
  });
119
119
  /**
120
120
  * Impact detection configuration for CI/CD.
121
121
  */
122
122
  const ImpactConfigSchema = z$2.object({
123
- baseline: z$2.string().default("default-branch"),
123
+ baseline: z$2.string().default("default-branch").optional(),
124
124
  include: z$2.array(z$2.string()).optional(),
125
125
  exclude: z$2.array(z$2.string()).optional()
126
126
  });
@@ -132,10 +132,10 @@ const CiConfigSchema = z$2.object({
132
132
  "structure",
133
133
  "integrity",
134
134
  "deps"
135
- ]),
135
+ ]).optional(),
136
136
  skipChecks: z$2.array(z$2.string()).optional(),
137
- failOnWarnings: z$2.boolean().default(false),
138
- uploadSarif: z$2.boolean().default(true),
137
+ failOnWarnings: z$2.boolean().default(false).optional(),
138
+ uploadSarif: z$2.boolean().default(true).optional(),
139
139
  prComment: PrCommentConfigSchema.optional(),
140
140
  checkRun: CheckRunConfigSchema.optional(),
141
141
  impact: ImpactConfigSchema.optional()
@@ -147,7 +147,7 @@ const ExternalWorkspaceSchema = z$2.object({
147
147
  alias: z$2.string(),
148
148
  submodule: z$2.string(),
149
149
  packages: z$2.array(z$2.string()).optional(),
150
- autoResolve: z$2.boolean().default(true)
150
+ autoResolve: z$2.boolean().default(true).optional()
151
151
  });
152
152
  /**
153
153
  * Meta-repo configuration section.
@@ -155,7 +155,7 @@ const ExternalWorkspaceSchema = z$2.object({
155
155
  const MetaRepoConfigSchema = z$2.object({
156
156
  activeScope: z$2.string().optional(),
157
157
  externalWorkspaces: z$2.array(ExternalWorkspaceSchema).optional(),
158
- crossWorkspaceSearch: z$2.boolean().default(false)
158
+ crossWorkspaceSearch: z$2.boolean().default(false).optional()
159
159
  });
160
160
  /**
161
161
  * Supported formatter tools.
@@ -171,11 +171,11 @@ const FormatterTypeSchema = z$2.enum([
171
171
  * Formatter configuration for code generation.
172
172
  */
173
173
  const FormatterConfigSchema = z$2.object({
174
- enabled: z$2.boolean().default(true),
174
+ enabled: z$2.boolean().default(true).optional(),
175
175
  type: FormatterTypeSchema.optional(),
176
176
  command: z$2.string().optional(),
177
177
  args: z$2.array(z$2.string()).optional(),
178
- timeout: z$2.number().default(3e4)
178
+ timeout: z$2.number().default(3e4).optional()
179
179
  });
180
180
  /**
181
181
  * Bump strategy for version management.
@@ -201,19 +201,19 @@ const ChangelogTierSchema = z$2.enum([
201
201
  * Versioning configuration for changelog and version management.
202
202
  */
203
203
  const VersioningConfigSchema = z$2.object({
204
- autoBump: z$2.boolean().default(false),
205
- bumpStrategy: BumpStrategySchema.default("impact"),
206
- integrateWithChangesets: z$2.boolean().default(false),
204
+ autoBump: z$2.boolean().default(false).optional(),
205
+ bumpStrategy: BumpStrategySchema.default("impact").optional(),
206
+ integrateWithChangesets: z$2.boolean().default(false).optional(),
207
207
  changelogTiers: z$2.array(ChangelogTierSchema).default([
208
208
  "spec",
209
209
  "library",
210
210
  "monorepo"
211
- ]),
212
- format: ChangelogFormatSchema.default("keep-a-changelog"),
213
- commitChanges: z$2.boolean().default(false),
214
- commitMessage: z$2.string().default("chore: bump spec versions"),
215
- createTags: z$2.boolean().default(false),
216
- tagPrefix: z$2.string().default("v"),
211
+ ]).optional(),
212
+ format: ChangelogFormatSchema.default("keep-a-changelog").optional(),
213
+ commitChanges: z$2.boolean().default(false).optional(),
214
+ commitMessage: z$2.string().default("chore: bump spec versions").optional(),
215
+ createTags: z$2.boolean().default(false).optional(),
216
+ tagPrefix: z$2.string().default("v").optional(),
217
217
  include: z$2.array(z$2.string()).optional(),
218
218
  exclude: z$2.array(z$2.string()).optional()
219
219
  });
@@ -233,28 +233,28 @@ const RuleSyncTargetSchema = z$2.enum([
233
233
  * Configuration for AI agent rules synchronization (rulesync).
234
234
  */
235
235
  const RuleSyncConfigSchema = z$2.object({
236
- enabled: z$2.boolean().default(false),
237
- rulesDir: z$2.string().default("./.rules"),
238
- rules: z$2.array(z$2.string()).default(["**/*.rule.md"]),
239
- targets: z$2.array(RuleSyncTargetSchema).default(["cursor", "windsurf"]),
240
- autoSync: z$2.boolean().default(true),
241
- ejectMode: z$2.boolean().default(false)
236
+ enabled: z$2.boolean().default(false).optional(),
237
+ rulesDir: z$2.string().default("./.rules").optional(),
238
+ rules: z$2.array(z$2.string()).default(["**/*.rule.md"]).optional(),
239
+ targets: z$2.array(RuleSyncTargetSchema).default(["cursor", "windsurf"]).optional(),
240
+ autoSync: z$2.boolean().default(true).optional(),
241
+ ejectMode: z$2.boolean().default(false).optional()
242
242
  });
243
243
  /**
244
244
  * Claude Agent SDK configuration.
245
245
  */
246
246
  const ClaudeAgentSDKConfigSchema = z$2.object({
247
- enabled: z$2.boolean().default(false),
247
+ enabled: z$2.boolean().default(false).optional(),
248
248
  apiKey: z$2.string().optional(),
249
- model: z$2.string().default("claude-sonnet-4-20250514"),
250
- computerUse: z$2.boolean().default(false),
251
- extendedThinking: z$2.boolean().default(false)
249
+ model: z$2.string().default("claude-sonnet-4-20250514").optional(),
250
+ computerUse: z$2.boolean().default(false).optional(),
251
+ extendedThinking: z$2.boolean().default(false).optional()
252
252
  });
253
253
  /**
254
254
  * OpenCode SDK configuration.
255
255
  */
256
256
  const OpenCodeSDKConfigSchema = z$2.object({
257
- enabled: z$2.boolean().default(false),
257
+ enabled: z$2.boolean().default(false).optional(),
258
258
  serverUrl: z$2.string().optional(),
259
259
  port: z$2.number().optional(),
260
260
  agentType: z$2.enum([
@@ -262,7 +262,7 @@ const OpenCodeSDKConfigSchema = z$2.object({
262
262
  "plan",
263
263
  "general",
264
264
  "explore"
265
- ]).default("general"),
265
+ ]).default("general").optional(),
266
266
  model: z$2.string().optional()
267
267
  });
268
268
  /**
@@ -313,6 +313,39 @@ const LintRulesSchema = z$2.object({
313
313
  "data-view-fields": RuleSeveritySchema.optional()
314
314
  });
315
315
  /**
316
+ * Test linking strategy for discovering test coverage.
317
+ */
318
+ const TestLinkingStrategySchema = z$2.enum([
319
+ "target-first",
320
+ "convention-only",
321
+ "both"
322
+ ]);
323
+ /**
324
+ * Test linking configuration for contract-first test discovery.
325
+ */
326
+ const TestLinkingConfigSchema = z$2.object({
327
+ strategy: TestLinkingStrategySchema.default("both").optional(),
328
+ warnOnConvention: z$2.boolean().default(false).optional()
329
+ });
330
+ /**
331
+ * Testing configuration section.
332
+ */
333
+ const TestingConfigSchema = z$2.object({
334
+ runner: z$2.enum([
335
+ "internal",
336
+ "jest",
337
+ "vitest",
338
+ "bun"
339
+ ]).default("internal").optional(),
340
+ testMatch: z$2.array(z$2.string()).default(["**/*.{test,spec}.{ts,js}"]).optional(),
341
+ autoGenerate: z$2.boolean().default(false).optional(),
342
+ integrity: z$2.object({
343
+ requireTestsFor: z$2.array(SpecKindSchema).optional(),
344
+ minCoverage: z$2.number().optional()
345
+ }).optional(),
346
+ testLinking: TestLinkingConfigSchema.optional()
347
+ });
348
+ /**
316
349
  * Full rules configuration with global defaults and per-kind overrides.
317
350
  */
318
351
  const RulesConfigSchema = z$2.object({
@@ -333,7 +366,7 @@ const ContractsrcSchema = z$2.object({
333
366
  "openai",
334
367
  "ollama",
335
368
  "custom"
336
- ]).default("claude"),
369
+ ]).default("claude").optional(),
337
370
  aiModel: z$2.string().optional(),
338
371
  agentMode: z$2.enum([
339
372
  "simple",
@@ -342,13 +375,13 @@ const ContractsrcSchema = z$2.object({
342
375
  "openai-codex",
343
376
  "claude-agent-sdk",
344
377
  "opencode-sdk"
345
- ]).default("simple"),
378
+ ]).default("simple").optional(),
346
379
  customEndpoint: z$2.url().nullable().optional(),
347
380
  customApiKey: z$2.string().nullable().optional(),
348
- outputDir: z$2.string().default("./src"),
349
- conventions: FolderConventionsSchema,
350
- defaultOwners: z$2.array(z$2.string()).default([]),
351
- defaultTags: z$2.array(z$2.string()).default([]),
381
+ outputDir: z$2.string().default("./src").optional(),
382
+ conventions: FolderConventionsSchema.optional(),
383
+ defaultOwners: z$2.array(z$2.string()).default([]).optional(),
384
+ defaultTags: z$2.array(z$2.string()).default([]).optional(),
352
385
  packages: z$2.array(z$2.string()).optional(),
353
386
  excludePackages: z$2.array(z$2.string()).optional(),
354
387
  recursive: z$2.boolean().optional(),
@@ -356,8 +389,9 @@ const ContractsrcSchema = z$2.object({
356
389
  ci: CiConfigSchema.optional(),
357
390
  metaRepo: MetaRepoConfigSchema.optional(),
358
391
  rules: RulesConfigSchema.optional(),
392
+ testing: TestingConfigSchema.optional(),
359
393
  hooks: HooksConfigSchema.optional(),
360
- schemaFormat: SchemaFormatSchema.default("contractspec"),
394
+ schemaFormat: SchemaFormatSchema.default("contractspec").optional(),
361
395
  formatter: FormatterConfigSchema.optional(),
362
396
  versioning: VersioningConfigSchema.optional(),
363
397
  ruleSync: RuleSyncConfigSchema.optional(),
@@ -384,4 +418,4 @@ const DEFAULT_CONTRACTSRC = {
384
418
  };
385
419
 
386
420
  //#endregion
387
- export { BumpStrategySchema, ChangelogFormatSchema, ChangelogTierSchema, CheckRunConfigSchema, CiConfigSchema, ClaudeAgentSDKConfigSchema, ContractsrcSchema, DEFAULT_CONTRACTSRC, ExternalAgentsConfigSchema, ExternalWorkspaceSchema, FolderConventionsSchema, FormatterConfigSchema, FormatterTypeSchema, GroupingRuleSchema, GroupingStrategySchema, HooksConfigSchema, ImpactConfigSchema, LintRulesSchema, MetaRepoConfigSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema, OpenCodeSDKConfigSchema, PrCommentConfigSchema, RuleSeveritySchema, RuleSyncConfigSchema, RuleSyncTargetSchema, RulesConfigSchema, SchemaFormatSchema, SpecKindSchema, VersioningConfigSchema };
421
+ export { BumpStrategySchema, ChangelogFormatSchema, ChangelogTierSchema, CheckRunConfigSchema, CiConfigSchema, ClaudeAgentSDKConfigSchema, ContractsrcSchema, DEFAULT_CONTRACTSRC, ExternalAgentsConfigSchema, ExternalWorkspaceSchema, FolderConventionsSchema, FormatterConfigSchema, FormatterTypeSchema, GroupingRuleSchema, GroupingStrategySchema, HooksConfigSchema, ImpactConfigSchema, LintRulesSchema, MetaRepoConfigSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema, OpenCodeSDKConfigSchema, PrCommentConfigSchema, RuleSeveritySchema, RuleSyncConfigSchema, RuleSyncTargetSchema, RulesConfigSchema, SchemaFormatSchema, SpecKindSchema, TestLinkingConfigSchema, TestLinkingStrategySchema, TestingConfigSchema, VersioningConfigSchema };
@@ -0,0 +1,346 @@
1
+ //#region src/workspace-config/contractsrc-types.d.ts
2
+ /**
3
+ * Explicit type definitions for ContractSpec configuration.
4
+ *
5
+ * These interfaces mirror the Zod schemas in `contractsrc-schema.ts` but are
6
+ * statically defined to reduce compiler inference cost and memory usage.
7
+ */
8
+ type SchemaFormat = 'contractspec' | 'zod' | 'json-schema' | 'graphql';
9
+ type GroupingStrategy = 'by-tag' | 'by-owner' | 'by-domain' | 'by-url-path-single' | 'by-url-path-multi' | 'by-feature' | 'none';
10
+ type FormatterType = 'prettier' | 'eslint' | 'biome' | 'dprint' | 'custom';
11
+ type BumpStrategy = 'impact' | 'conventional';
12
+ type ChangelogFormat = 'keep-a-changelog' | 'conventional' | 'custom';
13
+ type ChangelogTier = 'spec' | 'library' | 'monorepo';
14
+ type RuleSyncTarget = 'cursor' | 'windsurf' | 'cline' | 'claude-code' | 'copilot' | 'subagent' | 'skill';
15
+ type RuleSeverity = 'off' | 'warn' | 'error';
16
+ type SpecKind = 'operation' | 'event' | 'presentation' | 'feature' | 'workflow' | 'data-view' | 'migration' | 'telemetry' | 'experiment' | 'app-config';
17
+ type TestLinkingStrategy = 'target-first' | 'convention-only' | 'both';
18
+ interface OpenApiSourceConfig {
19
+ /** Friendly name for the source */
20
+ name: string;
21
+ /** Remote URL to fetch OpenAPI spec from */
22
+ url?: string;
23
+ /** Local file path to OpenAPI spec */
24
+ file?: string;
25
+ /** Sync mode: import (one-time), sync (update), validate (check only) */
26
+ syncMode?: 'import' | 'sync' | 'validate';
27
+ /** Only import operations with these tags */
28
+ tags?: string[];
29
+ /** Exclude operations with these operationIds */
30
+ exclude?: string[];
31
+ /** Include operations with these operationIds (overrides exclude) */
32
+ include?: string[];
33
+ /** Prefix for generated spec names */
34
+ prefix?: string;
35
+ /** Default stability for imported specs */
36
+ defaultStability?: 'experimental' | 'beta' | 'stable' | 'deprecated';
37
+ /** Default auth level for imported specs */
38
+ defaultAuth?: 'anonymous' | 'user' | 'admin';
39
+ /** Default owners for imported specs */
40
+ defaultOwners?: string[];
41
+ /** Output schema format for generated models */
42
+ schemaFormat?: SchemaFormat;
43
+ }
44
+ interface OpenApiExportConfig {
45
+ /** Output path for exported OpenAPI document */
46
+ outputPath?: string;
47
+ /** Output format */
48
+ format?: 'json' | 'yaml';
49
+ /** API title for export */
50
+ title?: string;
51
+ /** API version for export */
52
+ version?: string;
53
+ /** API description for export */
54
+ description?: string;
55
+ /** Server URLs to include in export */
56
+ servers?: {
57
+ url: string;
58
+ description?: string;
59
+ }[];
60
+ }
61
+ interface OpenApiConfig {
62
+ /** External OpenAPI sources to import/sync from */
63
+ sources?: OpenApiSourceConfig[];
64
+ /** Export configuration */
65
+ export?: OpenApiExportConfig;
66
+ }
67
+ interface GroupingRule {
68
+ /** Grouping strategy to apply */
69
+ strategy: GroupingStrategy;
70
+ /** For url-path strategies, the level depth (default: 1) */
71
+ urlPathLevel?: number;
72
+ /** Custom key extraction pattern (regex or glob) */
73
+ pattern?: string;
74
+ }
75
+ interface FolderConventions {
76
+ models?: string;
77
+ operations?: string;
78
+ events?: string;
79
+ presentations?: string;
80
+ forms?: string;
81
+ /** Enable feature/module folder grouping (default: true) */
82
+ groupByFeature?: boolean;
83
+ /** Grouping rule for operations */
84
+ operationsGrouping?: GroupingRule;
85
+ /** Grouping rule for models */
86
+ modelsGrouping?: GroupingRule;
87
+ /** Grouping rule for events */
88
+ eventsGrouping?: GroupingRule;
89
+ }
90
+ interface PrCommentConfig {
91
+ /** Enable PR comments */
92
+ enabled?: boolean;
93
+ /** Comment template: 'minimal' | 'detailed' */
94
+ template?: 'minimal' | 'detailed';
95
+ /** Update existing comment instead of creating new */
96
+ updateExisting?: boolean;
97
+ }
98
+ interface CheckRunConfig {
99
+ /** Enable GitHub check run creation */
100
+ enabled?: boolean;
101
+ /** Check run name */
102
+ name?: string;
103
+ /** Fail check on breaking changes */
104
+ failOnBreaking?: boolean;
105
+ /** Fail check on any contract changes */
106
+ failOnChanges?: boolean;
107
+ }
108
+ interface ImpactConfig {
109
+ /** Baseline for comparison: 'default-branch' | 'base-ref' | 'tag:v*' */
110
+ baseline?: string;
111
+ /** Paths to include in impact detection (glob patterns) */
112
+ include?: string[];
113
+ /** Paths to exclude from impact detection (glob patterns) */
114
+ exclude?: string[];
115
+ }
116
+ interface CiConfig {
117
+ /** Default checks to run */
118
+ checks?: string[];
119
+ /** Checks to skip */
120
+ skipChecks?: string[];
121
+ /** Fail CI on warnings */
122
+ failOnWarnings?: boolean;
123
+ /** Upload SARIF to GitHub Code Scanning */
124
+ uploadSarif?: boolean;
125
+ /** PR comment configuration */
126
+ prComment?: PrCommentConfig;
127
+ /** GitHub check run configuration */
128
+ checkRun?: CheckRunConfig;
129
+ /** Impact detection configuration */
130
+ impact?: ImpactConfig;
131
+ }
132
+ interface ExternalWorkspace {
133
+ /** Alias for referencing this workspace (e.g., 'core', 'internal') */
134
+ alias: string;
135
+ /** Submodule name or relative path from meta-repo root */
136
+ submodule: string;
137
+ /** Package patterns to include from this workspace */
138
+ packages?: string[];
139
+ /** Whether to auto-resolve internal dependencies */
140
+ autoResolve?: boolean;
141
+ }
142
+ interface MetaRepoConfig {
143
+ /** Active submodule scope (defaults to auto-detected) */
144
+ activeScope?: string;
145
+ /** External workspace references for cross-workspace dependencies */
146
+ externalWorkspaces?: ExternalWorkspace[];
147
+ /** Whether to search for specs across all submodules */
148
+ crossWorkspaceSearch?: boolean;
149
+ }
150
+ interface FormatterConfig {
151
+ /** Enable/disable formatting (default: true if formatter detected) */
152
+ enabled?: boolean;
153
+ /** Formatter to use (auto-detected if not specified) */
154
+ type?: FormatterType;
155
+ /** Custom command for 'custom' type (e.g., "bunx prettier --write") */
156
+ command?: string;
157
+ /** Extra arguments to pass to formatter */
158
+ args?: string[];
159
+ /** Timeout in milliseconds (default: 30000) */
160
+ timeout?: number;
161
+ }
162
+ interface VersioningConfig {
163
+ /** Enable automated version bumping in CI */
164
+ autoBump?: boolean;
165
+ /** Strategy for determining version bumps */
166
+ bumpStrategy?: BumpStrategy;
167
+ /** Integrate with Changesets (generate .changeset files) */
168
+ integrateWithChangesets?: boolean;
169
+ /** Changelog tiers to generate */
170
+ changelogTiers?: ChangelogTier[];
171
+ /** Changelog format template */
172
+ format?: ChangelogFormat;
173
+ /** Commit changes after version bump (CI mode) */
174
+ commitChanges?: boolean;
175
+ /** Commit message template (supports {version}, {specs}) */
176
+ commitMessage?: string;
177
+ /** Create git tags for versions */
178
+ createTags?: boolean;
179
+ /** Tag prefix (e.g., "v" -> v1.0.0, "spec-" -> spec-1.0.0) */
180
+ tagPrefix?: string;
181
+ /** Paths to include for version analysis (glob patterns) */
182
+ include?: string[];
183
+ /** Paths to exclude from version analysis (glob patterns) */
184
+ exclude?: string[];
185
+ }
186
+ interface RuleSyncConfig {
187
+ /** Enable automated rule synchronization */
188
+ enabled?: boolean;
189
+ /** Root directory for source rule files */
190
+ rulesDir?: string;
191
+ /** Source rule files (glob patterns) */
192
+ rules?: string[];
193
+ /** Synchronization targets (tools to generate rules for) */
194
+ targets?: RuleSyncTarget[];
195
+ /** Automatically synchronize rules on workspace changes or builds */
196
+ autoSync?: boolean;
197
+ /** Whether to eject/copy source rules instead of generating from Unified Rules */
198
+ ejectMode?: boolean;
199
+ }
200
+ interface ClaudeAgentSDKConfig {
201
+ /** Enable Claude Agent SDK provider */
202
+ enabled?: boolean;
203
+ /** API key (defaults to ANTHROPIC_API_KEY env var) */
204
+ apiKey?: string;
205
+ /** Model to use (defaults to claude-sonnet-4-20250514) */
206
+ model?: string;
207
+ /** Enable computer use capabilities */
208
+ computerUse?: boolean;
209
+ /** Enable extended thinking mode */
210
+ extendedThinking?: boolean;
211
+ }
212
+ interface OpenCodeSDKConfig {
213
+ /** Enable OpenCode SDK provider */
214
+ enabled?: boolean;
215
+ /** Server URL (defaults to http://127.0.0.1:4096) */
216
+ serverUrl?: string;
217
+ /** Server port (alternative to full URL) */
218
+ port?: number;
219
+ /** Agent type to use */
220
+ agentType?: 'build' | 'plan' | 'general' | 'explore';
221
+ /** Model to use */
222
+ model?: string;
223
+ }
224
+ interface ExternalAgentsConfig {
225
+ /** Claude Agent SDK configuration */
226
+ claudeAgent?: ClaudeAgentSDKConfig;
227
+ /** OpenCode SDK configuration */
228
+ openCode?: OpenCodeSDKConfig;
229
+ }
230
+ interface LintRules {
231
+ /** Require acceptance scenarios for operations */
232
+ 'require-acceptance'?: RuleSeverity;
233
+ /** Require examples for operations */
234
+ 'require-examples'?: RuleSeverity;
235
+ /** Require stability field */
236
+ 'require-stability'?: RuleSeverity;
237
+ /** Require owners to follow proper format (@team or Enum) */
238
+ 'require-owners-format'?: RuleSeverity;
239
+ /** Require event names to use past tense */
240
+ 'event-past-tense'?: RuleSeverity;
241
+ /** Warn on TODO comments */
242
+ 'no-todo'?: RuleSeverity;
243
+ /** Require workflow transitions */
244
+ 'workflow-transitions'?: RuleSeverity;
245
+ /** Require privacy classification for telemetry */
246
+ 'telemetry-privacy'?: RuleSeverity;
247
+ /** Require allocation config for experiments */
248
+ 'experiment-allocation'?: RuleSeverity;
249
+ /** Require appId for app blueprints */
250
+ 'app-config-appid'?: RuleSeverity;
251
+ /** Require capabilities for app blueprints */
252
+ 'app-config-capabilities'?: RuleSeverity;
253
+ /** Require fields for data views */
254
+ 'data-view-fields'?: RuleSeverity;
255
+ }
256
+ interface TestLinkingConfig {
257
+ /** Strategy for linking tests to specs */
258
+ strategy?: TestLinkingStrategy;
259
+ /** Warn when tests only use naming convention (no TestSpec.target) */
260
+ warnOnConvention?: boolean;
261
+ }
262
+ interface TestingConfig {
263
+ /** Test runner to use */
264
+ runner?: 'internal' | 'jest' | 'vitest' | 'bun';
265
+ /** Glob patterns for matching test files */
266
+ testMatch?: string[];
267
+ /** Enable automatic test generation */
268
+ autoGenerate?: boolean;
269
+ /** Integrity requirements for testing */
270
+ integrity?: {
271
+ /** Spec types that require test coverage */
272
+ requireTestsFor?: SpecKind[];
273
+ /** Minimum coverage percentage (if supported) */
274
+ minCoverage?: number;
275
+ };
276
+ /** Test linking configuration for contract-first test discovery */
277
+ testLinking?: TestLinkingConfig;
278
+ }
279
+ interface RulesConfig {
280
+ /** Global default rule severities */
281
+ defaults?: LintRules;
282
+ /** Per-kind rule severity overrides */
283
+ overrides?: Partial<Record<SpecKind, LintRules>>;
284
+ }
285
+ type HooksConfig = Record<string, string[]>;
286
+ /**
287
+ * Full ContractSpec configuration (.contractsrc.json).
288
+ */
289
+ /**
290
+ * Full ContractSpec configuration (.contractsrc.json).
291
+ * All fields are optional as they come from user configuration.
292
+ */
293
+ interface ContractsrcFileConfig {
294
+ aiProvider?: 'claude' | 'openai' | 'ollama' | 'custom';
295
+ aiModel?: string;
296
+ agentMode?: 'simple' | 'cursor' | 'claude-code' | 'openai-codex' | 'claude-agent-sdk' | 'opencode-sdk';
297
+ customEndpoint?: string | null;
298
+ customApiKey?: string | null;
299
+ outputDir?: string;
300
+ conventions?: FolderConventions;
301
+ defaultOwners?: string[];
302
+ defaultTags?: string[];
303
+ packages?: string[];
304
+ excludePackages?: string[];
305
+ recursive?: boolean;
306
+ openapi?: OpenApiConfig;
307
+ ci?: CiConfig;
308
+ metaRepo?: MetaRepoConfig;
309
+ rules?: RulesConfig;
310
+ testing?: TestingConfig;
311
+ hooks?: HooksConfig;
312
+ schemaFormat?: SchemaFormat;
313
+ formatter?: FormatterConfig;
314
+ versioning?: VersioningConfig;
315
+ ruleSync?: RuleSyncConfig;
316
+ externalAgents?: ExternalAgentsConfig;
317
+ }
318
+ /**
319
+ * Resolved configuration with guaranteed defaults.
320
+ * This is what the application uses at runtime.
321
+ */
322
+ interface ResolvedContractsrcConfig extends ContractsrcFileConfig {
323
+ aiProvider: 'claude' | 'openai' | 'ollama' | 'custom';
324
+ agentMode: 'simple' | 'cursor' | 'claude-code' | 'openai-codex' | 'claude-agent-sdk' | 'opencode-sdk';
325
+ outputDir: string;
326
+ conventions: {
327
+ models: string;
328
+ operations: string;
329
+ events: string;
330
+ presentations: string;
331
+ forms: string;
332
+ groupByFeature: boolean;
333
+ operationsGrouping?: GroupingRule;
334
+ modelsGrouping?: GroupingRule;
335
+ eventsGrouping?: GroupingRule;
336
+ };
337
+ defaultOwners: string[];
338
+ defaultTags: string[];
339
+ schemaFormat: SchemaFormat;
340
+ }
341
+ /**
342
+ * @deprecated Use ContractsrcFileConfig for file inputs or ResolvedContractsrcConfig for app usage.
343
+ */
344
+ type ContractsrcConfig = ContractsrcFileConfig;
345
+ //#endregion
346
+ export { BumpStrategy, ChangelogFormat, ChangelogTier, CheckRunConfig, CiConfig, ClaudeAgentSDKConfig, ContractsrcConfig, ContractsrcFileConfig, ExternalAgentsConfig, ExternalWorkspace, FolderConventions, FormatterConfig, FormatterType, GroupingRule, GroupingStrategy, HooksConfig, ImpactConfig, LintRules, MetaRepoConfig, OpenApiConfig, OpenApiExportConfig, OpenApiSourceConfig, OpenCodeSDKConfig, PrCommentConfig, ResolvedContractsrcConfig, RuleSeverity, RuleSyncConfig, RuleSyncTarget, RulesConfig, SchemaFormat, SpecKind, TestLinkingConfig, TestLinkingStrategy, TestingConfig, VersioningConfig };
File without changes
@@ -1,2 +1,3 @@
1
- import { BumpStrategy, BumpStrategySchema, ChangelogFormat, ChangelogFormatSchema, ChangelogTier, ChangelogTierSchema, ContractsrcConfig, ContractsrcSchema, DEFAULT_CONTRACTSRC, FolderConventions, FolderConventionsSchema, FormatterConfig, FormatterConfigSchema, FormatterType, FormatterTypeSchema, OpenApiConfig, OpenApiConfigSchema, OpenApiExportConfig, OpenApiExportConfigSchema, OpenApiSourceConfig, OpenApiSourceConfigSchema, RuleSyncConfig, RuleSyncConfigSchema, RuleSyncTarget, RuleSyncTargetSchema, SchemaFormat, SchemaFormatSchema, VersioningConfig, VersioningConfigSchema } from "./contractsrc-schema.js";
2
- export { type BumpStrategy, BumpStrategySchema, type ChangelogFormat, ChangelogFormatSchema, type ChangelogTier, ChangelogTierSchema, type ContractsrcConfig, ContractsrcSchema, DEFAULT_CONTRACTSRC, type FolderConventions, FolderConventionsSchema, type FormatterConfig, FormatterConfigSchema, type FormatterType, FormatterTypeSchema, type OpenApiConfig, OpenApiConfigSchema, type OpenApiExportConfig, OpenApiExportConfigSchema, type OpenApiSourceConfig, OpenApiSourceConfigSchema, type RuleSyncConfig, RuleSyncConfigSchema, type RuleSyncTarget, RuleSyncTargetSchema, type SchemaFormat, SchemaFormatSchema, type VersioningConfig, VersioningConfigSchema };
1
+ import { BumpStrategy, ChangelogFormat, ChangelogTier, ContractsrcConfig, ContractsrcFileConfig, FolderConventions, FormatterConfig, FormatterType, OpenApiConfig, OpenApiExportConfig, OpenApiSourceConfig, ResolvedContractsrcConfig, RuleSyncConfig, RuleSyncTarget, SchemaFormat, VersioningConfig } from "./contractsrc-types.js";
2
+ import { BumpStrategySchema, ChangelogFormatSchema, ChangelogTierSchema, ContractsrcSchema, DEFAULT_CONTRACTSRC, FolderConventionsSchema, FormatterConfigSchema, FormatterTypeSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema, RuleSyncConfigSchema, RuleSyncTargetSchema, SchemaFormatSchema, VersioningConfigSchema } from "./contractsrc-schema.js";
3
+ export { type BumpStrategy, BumpStrategySchema, type ChangelogFormat, ChangelogFormatSchema, type ChangelogTier, ChangelogTierSchema, type ContractsrcConfig, type ContractsrcFileConfig, ContractsrcSchema, DEFAULT_CONTRACTSRC, type FolderConventions, FolderConventionsSchema, type FormatterConfig, FormatterConfigSchema, type FormatterType, FormatterTypeSchema, type OpenApiConfig, OpenApiConfigSchema, type OpenApiExportConfig, OpenApiExportConfigSchema, type OpenApiSourceConfig, OpenApiSourceConfigSchema, type ResolvedContractsrcConfig, type RuleSyncConfig, RuleSyncConfigSchema, type RuleSyncTarget, RuleSyncTargetSchema, type SchemaFormat, SchemaFormatSchema, type VersioningConfig, VersioningConfigSchema };