@contractspec/app.cli-contractspec 0.0.0-canary-20260113170453
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/.contractsrc.example.json +25 -0
- package/AGENTS.md +102 -0
- package/CHANGELOG.md +746 -0
- package/LICENSE +21 -0
- package/README.md +684 -0
- package/contractsrc.schema.json +404 -0
- package/dist/bun/cli.js +52230 -0
- package/dist/node/cli.js +52393 -0
- package/docs/ci-cd.md +598 -0
- package/package.json +80 -0
- package/templates/github-action.yml +117 -0
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "ContractSpec CLI Configuration",
|
|
4
|
+
"description": "Configuration file for ContractSpec CLI and tooling. Supports single projects, monorepos, and meta-repos.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"aiProvider": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"enum": ["claude", "openai", "ollama", "custom"],
|
|
10
|
+
"default": "claude",
|
|
11
|
+
"description": "AI provider for spec generation and code assistance"
|
|
12
|
+
},
|
|
13
|
+
"aiModel": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "Model name to use with the AI provider"
|
|
16
|
+
},
|
|
17
|
+
"agentMode": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"enum": ["simple", "cursor", "claude-code", "openai-codex"],
|
|
20
|
+
"default": "simple",
|
|
21
|
+
"description": "Agent mode for AI-assisted operations"
|
|
22
|
+
},
|
|
23
|
+
"customEndpoint": {
|
|
24
|
+
"type": ["string", "null"],
|
|
25
|
+
"format": "uri",
|
|
26
|
+
"description": "Custom endpoint URL for AI provider (OpenAI-compatible)"
|
|
27
|
+
},
|
|
28
|
+
"customApiKey": {
|
|
29
|
+
"type": ["string", "null"],
|
|
30
|
+
"description": "API key for custom endpoint"
|
|
31
|
+
},
|
|
32
|
+
"outputDir": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"default": "./src",
|
|
35
|
+
"description": "Default output directory for generated files"
|
|
36
|
+
},
|
|
37
|
+
"conventions": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"description": "Directory conventions for organizing specs",
|
|
40
|
+
"properties": {
|
|
41
|
+
"models": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"default": "models",
|
|
44
|
+
"description": "Directory for model specs"
|
|
45
|
+
},
|
|
46
|
+
"operations": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"default": "interactions/commands|queries",
|
|
49
|
+
"description": "Directory pattern for operation specs"
|
|
50
|
+
},
|
|
51
|
+
"events": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"default": "events",
|
|
54
|
+
"description": "Directory for event specs"
|
|
55
|
+
},
|
|
56
|
+
"presentations": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"default": "presentations",
|
|
59
|
+
"description": "Directory for presentation specs"
|
|
60
|
+
},
|
|
61
|
+
"forms": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"default": "forms",
|
|
64
|
+
"description": "Directory for form specs"
|
|
65
|
+
},
|
|
66
|
+
"groupByFeature": {
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"default": true,
|
|
69
|
+
"description": "Enable feature/module folder grouping"
|
|
70
|
+
},
|
|
71
|
+
"operationsGrouping": {
|
|
72
|
+
"$ref": "#/definitions/GroupingRule"
|
|
73
|
+
},
|
|
74
|
+
"modelsGrouping": {
|
|
75
|
+
"$ref": "#/definitions/GroupingRule"
|
|
76
|
+
},
|
|
77
|
+
"eventsGrouping": {
|
|
78
|
+
"$ref": "#/definitions/GroupingRule"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"defaultOwners": {
|
|
83
|
+
"type": "array",
|
|
84
|
+
"items": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"pattern": "^@"
|
|
87
|
+
},
|
|
88
|
+
"default": [],
|
|
89
|
+
"description": "Default owners for new specs"
|
|
90
|
+
},
|
|
91
|
+
"defaultTags": {
|
|
92
|
+
"type": "array",
|
|
93
|
+
"items": {
|
|
94
|
+
"type": "string"
|
|
95
|
+
},
|
|
96
|
+
"default": [],
|
|
97
|
+
"description": "Default tags for new specs"
|
|
98
|
+
},
|
|
99
|
+
"packages": {
|
|
100
|
+
"type": "array",
|
|
101
|
+
"items": {
|
|
102
|
+
"type": "string"
|
|
103
|
+
},
|
|
104
|
+
"description": "Package paths to include when running in monorepo mode. Supports glob patterns."
|
|
105
|
+
},
|
|
106
|
+
"excludePackages": {
|
|
107
|
+
"type": "array",
|
|
108
|
+
"items": {
|
|
109
|
+
"type": "string"
|
|
110
|
+
},
|
|
111
|
+
"description": "Package paths to exclude when running in monorepo mode. Supports glob patterns."
|
|
112
|
+
},
|
|
113
|
+
"recursive": {
|
|
114
|
+
"type": "boolean",
|
|
115
|
+
"default": true,
|
|
116
|
+
"description": "Whether to search recursively in all packages for specs"
|
|
117
|
+
},
|
|
118
|
+
"exclude": {
|
|
119
|
+
"type": "array",
|
|
120
|
+
"items": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
},
|
|
123
|
+
"default": ["**/node_modules/**", "**/dist/**", "**/.turbo/**", "**/.next/**", "**/build/**", "**/coverage/**", "**/*.d.ts"],
|
|
124
|
+
"description": "Glob patterns to exclude from spec discovery. Defaults include common build outputs."
|
|
125
|
+
},
|
|
126
|
+
"openapi": {
|
|
127
|
+
"type": "object",
|
|
128
|
+
"description": "OpenAPI import/export configuration",
|
|
129
|
+
"properties": {
|
|
130
|
+
"sources": {
|
|
131
|
+
"type": "array",
|
|
132
|
+
"description": "External OpenAPI sources to import/sync from",
|
|
133
|
+
"items": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"required": ["name"],
|
|
136
|
+
"properties": {
|
|
137
|
+
"name": {
|
|
138
|
+
"type": "string",
|
|
139
|
+
"description": "Friendly name for the source"
|
|
140
|
+
},
|
|
141
|
+
"url": {
|
|
142
|
+
"type": "string",
|
|
143
|
+
"format": "uri",
|
|
144
|
+
"description": "Remote URL to fetch OpenAPI spec from"
|
|
145
|
+
},
|
|
146
|
+
"file": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"description": "Local file path to OpenAPI spec"
|
|
149
|
+
},
|
|
150
|
+
"syncMode": {
|
|
151
|
+
"type": "string",
|
|
152
|
+
"enum": ["import", "sync", "validate"],
|
|
153
|
+
"default": "validate",
|
|
154
|
+
"description": "Sync mode: import (one-time), sync (update), validate (check only)"
|
|
155
|
+
},
|
|
156
|
+
"tags": {
|
|
157
|
+
"type": "array",
|
|
158
|
+
"items": { "type": "string" },
|
|
159
|
+
"description": "Only import operations with these tags"
|
|
160
|
+
},
|
|
161
|
+
"exclude": {
|
|
162
|
+
"type": "array",
|
|
163
|
+
"items": { "type": "string" },
|
|
164
|
+
"description": "Exclude operations with these operationIds"
|
|
165
|
+
},
|
|
166
|
+
"include": {
|
|
167
|
+
"type": "array",
|
|
168
|
+
"items": { "type": "string" },
|
|
169
|
+
"description": "Include operations with these operationIds (overrides exclude)"
|
|
170
|
+
},
|
|
171
|
+
"prefix": {
|
|
172
|
+
"type": "string",
|
|
173
|
+
"description": "Prefix for generated spec names"
|
|
174
|
+
},
|
|
175
|
+
"defaultStability": {
|
|
176
|
+
"type": "string",
|
|
177
|
+
"enum": ["experimental", "beta", "stable", "deprecated"],
|
|
178
|
+
"description": "Default stability for imported specs"
|
|
179
|
+
},
|
|
180
|
+
"defaultAuth": {
|
|
181
|
+
"type": "string",
|
|
182
|
+
"enum": ["anonymous", "user", "admin"],
|
|
183
|
+
"description": "Default auth level for imported specs"
|
|
184
|
+
},
|
|
185
|
+
"defaultOwners": {
|
|
186
|
+
"type": "array",
|
|
187
|
+
"items": { "type": "string" },
|
|
188
|
+
"description": "Default owners for imported specs"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"export": {
|
|
194
|
+
"type": "object",
|
|
195
|
+
"description": "Export configuration for generating OpenAPI document",
|
|
196
|
+
"properties": {
|
|
197
|
+
"outputPath": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"default": "./openapi.json",
|
|
200
|
+
"description": "Output path for exported OpenAPI document"
|
|
201
|
+
},
|
|
202
|
+
"format": {
|
|
203
|
+
"type": "string",
|
|
204
|
+
"enum": ["json", "yaml"],
|
|
205
|
+
"default": "json",
|
|
206
|
+
"description": "Output format"
|
|
207
|
+
},
|
|
208
|
+
"title": {
|
|
209
|
+
"type": "string",
|
|
210
|
+
"description": "API title for export"
|
|
211
|
+
},
|
|
212
|
+
"version": {
|
|
213
|
+
"type": "string",
|
|
214
|
+
"description": "API version for export"
|
|
215
|
+
},
|
|
216
|
+
"description": {
|
|
217
|
+
"type": "string",
|
|
218
|
+
"description": "API description for export"
|
|
219
|
+
},
|
|
220
|
+
"servers": {
|
|
221
|
+
"type": "array",
|
|
222
|
+
"description": "Server URLs to include in export",
|
|
223
|
+
"items": {
|
|
224
|
+
"type": "object",
|
|
225
|
+
"required": ["url"],
|
|
226
|
+
"properties": {
|
|
227
|
+
"url": {
|
|
228
|
+
"type": "string",
|
|
229
|
+
"description": "Server URL"
|
|
230
|
+
},
|
|
231
|
+
"description": {
|
|
232
|
+
"type": "string",
|
|
233
|
+
"description": "Server description"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"ci": {
|
|
243
|
+
"type": "object",
|
|
244
|
+
"description": "CI/CD configuration",
|
|
245
|
+
"properties": {
|
|
246
|
+
"checks": {
|
|
247
|
+
"type": "array",
|
|
248
|
+
"items": { "type": "string" },
|
|
249
|
+
"default": ["structure", "integrity", "deps"],
|
|
250
|
+
"description": "Default checks to run"
|
|
251
|
+
},
|
|
252
|
+
"skipChecks": {
|
|
253
|
+
"type": "array",
|
|
254
|
+
"items": { "type": "string" },
|
|
255
|
+
"description": "Checks to skip"
|
|
256
|
+
},
|
|
257
|
+
"failOnWarnings": {
|
|
258
|
+
"type": "boolean",
|
|
259
|
+
"default": false,
|
|
260
|
+
"description": "Fail CI on warnings"
|
|
261
|
+
},
|
|
262
|
+
"uploadSarif": {
|
|
263
|
+
"type": "boolean",
|
|
264
|
+
"default": true,
|
|
265
|
+
"description": "Upload SARIF to GitHub Code Scanning"
|
|
266
|
+
},
|
|
267
|
+
"prComment": {
|
|
268
|
+
"type": "object",
|
|
269
|
+
"description": "PR comment configuration",
|
|
270
|
+
"properties": {
|
|
271
|
+
"enabled": {
|
|
272
|
+
"type": "boolean",
|
|
273
|
+
"default": true,
|
|
274
|
+
"description": "Enable PR comments"
|
|
275
|
+
},
|
|
276
|
+
"template": {
|
|
277
|
+
"type": "string",
|
|
278
|
+
"enum": ["minimal", "detailed"],
|
|
279
|
+
"default": "detailed",
|
|
280
|
+
"description": "Comment template style"
|
|
281
|
+
},
|
|
282
|
+
"updateExisting": {
|
|
283
|
+
"type": "boolean",
|
|
284
|
+
"default": true,
|
|
285
|
+
"description": "Update existing comment instead of creating new"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
"checkRun": {
|
|
290
|
+
"type": "object",
|
|
291
|
+
"description": "GitHub check run configuration",
|
|
292
|
+
"properties": {
|
|
293
|
+
"enabled": {
|
|
294
|
+
"type": "boolean",
|
|
295
|
+
"default": true,
|
|
296
|
+
"description": "Enable GitHub check run creation"
|
|
297
|
+
},
|
|
298
|
+
"name": {
|
|
299
|
+
"type": "string",
|
|
300
|
+
"default": "ContractSpec Impact",
|
|
301
|
+
"description": "Check run name"
|
|
302
|
+
},
|
|
303
|
+
"failOnBreaking": {
|
|
304
|
+
"type": "boolean",
|
|
305
|
+
"default": true,
|
|
306
|
+
"description": "Fail check on breaking changes"
|
|
307
|
+
},
|
|
308
|
+
"failOnChanges": {
|
|
309
|
+
"type": "boolean",
|
|
310
|
+
"default": false,
|
|
311
|
+
"description": "Fail check on any contract changes"
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
"impact": {
|
|
316
|
+
"type": "object",
|
|
317
|
+
"description": "Impact detection configuration",
|
|
318
|
+
"properties": {
|
|
319
|
+
"baseline": {
|
|
320
|
+
"type": "string",
|
|
321
|
+
"default": "default-branch",
|
|
322
|
+
"description": "Baseline for comparison: 'default-branch' | 'base-ref' | 'tag:v*'"
|
|
323
|
+
},
|
|
324
|
+
"include": {
|
|
325
|
+
"type": "array",
|
|
326
|
+
"items": { "type": "string" },
|
|
327
|
+
"description": "Paths to include in impact detection (glob patterns)"
|
|
328
|
+
},
|
|
329
|
+
"exclude": {
|
|
330
|
+
"type": "array",
|
|
331
|
+
"items": { "type": "string" },
|
|
332
|
+
"description": "Paths to exclude from impact detection (glob patterns)"
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"metaRepo": {
|
|
339
|
+
"type": "object",
|
|
340
|
+
"description": "Meta-repo configuration for multi-workspace setups",
|
|
341
|
+
"properties": {
|
|
342
|
+
"activeScope": {
|
|
343
|
+
"type": "string",
|
|
344
|
+
"description": "Active submodule scope (defaults to auto-detected)"
|
|
345
|
+
},
|
|
346
|
+
"externalWorkspaces": {
|
|
347
|
+
"type": "array",
|
|
348
|
+
"description": "External workspace references for cross-workspace dependencies",
|
|
349
|
+
"items": {
|
|
350
|
+
"type": "object",
|
|
351
|
+
"required": ["alias", "submodule"],
|
|
352
|
+
"properties": {
|
|
353
|
+
"alias": {
|
|
354
|
+
"type": "string",
|
|
355
|
+
"description": "Alias for referencing this workspace (e.g., 'core', 'internal')"
|
|
356
|
+
},
|
|
357
|
+
"submodule": {
|
|
358
|
+
"type": "string",
|
|
359
|
+
"description": "Submodule name or relative path from meta-repo root"
|
|
360
|
+
},
|
|
361
|
+
"packages": {
|
|
362
|
+
"type": "array",
|
|
363
|
+
"items": { "type": "string" },
|
|
364
|
+
"description": "Package patterns to include from this workspace"
|
|
365
|
+
},
|
|
366
|
+
"autoResolve": {
|
|
367
|
+
"type": "boolean",
|
|
368
|
+
"default": true,
|
|
369
|
+
"description": "Whether to auto-resolve internal dependencies"
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
"crossWorkspaceSearch": {
|
|
375
|
+
"type": "boolean",
|
|
376
|
+
"default": false,
|
|
377
|
+
"description": "Whether to search for specs across all submodules"
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
"definitions": {
|
|
383
|
+
"GroupingRule": {
|
|
384
|
+
"type": "object",
|
|
385
|
+
"description": "Grouping rule configuration",
|
|
386
|
+
"properties": {
|
|
387
|
+
"strategy": {
|
|
388
|
+
"type": "string",
|
|
389
|
+
"enum": ["by-tag", "by-owner", "by-domain", "by-url-path-single", "by-url-path-multi", "by-feature", "none"],
|
|
390
|
+
"description": "Grouping strategy to apply"
|
|
391
|
+
},
|
|
392
|
+
"urlPathLevel": {
|
|
393
|
+
"type": "number",
|
|
394
|
+
"description": "For url-path strategies, the level depth (default: 1)"
|
|
395
|
+
},
|
|
396
|
+
"pattern": {
|
|
397
|
+
"type": "string",
|
|
398
|
+
"description": "Custom key extraction pattern (regex or glob)"
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"additionalProperties": false
|
|
404
|
+
}
|