atdd 0.1.0__py3-none-any.whl

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 (183) hide show
  1. atdd/__init__.py +0 -0
  2. atdd/cli.py +404 -0
  3. atdd/coach/__init__.py +0 -0
  4. atdd/coach/commands/__init__.py +0 -0
  5. atdd/coach/commands/add_persistence_metadata.py +215 -0
  6. atdd/coach/commands/analyze_migrations.py +188 -0
  7. atdd/coach/commands/consumers.py +720 -0
  8. atdd/coach/commands/infer_governance_status.py +149 -0
  9. atdd/coach/commands/initializer.py +177 -0
  10. atdd/coach/commands/interface.py +1078 -0
  11. atdd/coach/commands/inventory.py +565 -0
  12. atdd/coach/commands/migration.py +240 -0
  13. atdd/coach/commands/registry.py +1560 -0
  14. atdd/coach/commands/session.py +430 -0
  15. atdd/coach/commands/sync.py +405 -0
  16. atdd/coach/commands/test_interface.py +399 -0
  17. atdd/coach/commands/test_runner.py +141 -0
  18. atdd/coach/commands/tests/__init__.py +1 -0
  19. atdd/coach/commands/tests/test_telemetry_array_validation.py +235 -0
  20. atdd/coach/commands/traceability.py +4264 -0
  21. atdd/coach/conventions/session.convention.yaml +754 -0
  22. atdd/coach/overlays/__init__.py +2 -0
  23. atdd/coach/overlays/claude.md +2 -0
  24. atdd/coach/schemas/config.schema.json +34 -0
  25. atdd/coach/schemas/manifest.schema.json +101 -0
  26. atdd/coach/templates/ATDD.md +282 -0
  27. atdd/coach/templates/SESSION-TEMPLATE.md +327 -0
  28. atdd/coach/utils/__init__.py +0 -0
  29. atdd/coach/utils/graph/__init__.py +0 -0
  30. atdd/coach/utils/graph/urn.py +875 -0
  31. atdd/coach/validators/__init__.py +0 -0
  32. atdd/coach/validators/shared_fixtures.py +365 -0
  33. atdd/coach/validators/test_enrich_wagon_registry.py +167 -0
  34. atdd/coach/validators/test_registry.py +575 -0
  35. atdd/coach/validators/test_session_validation.py +1183 -0
  36. atdd/coach/validators/test_traceability.py +448 -0
  37. atdd/coach/validators/test_update_feature_paths.py +108 -0
  38. atdd/coach/validators/test_validate_contract_consumers.py +297 -0
  39. atdd/coder/__init__.py +1 -0
  40. atdd/coder/conventions/adapter.recipe.yaml +88 -0
  41. atdd/coder/conventions/backend.convention.yaml +460 -0
  42. atdd/coder/conventions/boundaries.convention.yaml +666 -0
  43. atdd/coder/conventions/commons.convention.yaml +460 -0
  44. atdd/coder/conventions/complexity.recipe.yaml +109 -0
  45. atdd/coder/conventions/component-naming.convention.yaml +178 -0
  46. atdd/coder/conventions/design.convention.yaml +327 -0
  47. atdd/coder/conventions/design.recipe.yaml +273 -0
  48. atdd/coder/conventions/dto.convention.yaml +660 -0
  49. atdd/coder/conventions/frontend.convention.yaml +542 -0
  50. atdd/coder/conventions/green.convention.yaml +1012 -0
  51. atdd/coder/conventions/presentation.convention.yaml +587 -0
  52. atdd/coder/conventions/refactor.convention.yaml +535 -0
  53. atdd/coder/conventions/technology.convention.yaml +206 -0
  54. atdd/coder/conventions/tests/__init__.py +0 -0
  55. atdd/coder/conventions/tests/test_adapter_recipe.py +302 -0
  56. atdd/coder/conventions/tests/test_complexity_recipe.py +289 -0
  57. atdd/coder/conventions/tests/test_component_taxonomy.py +278 -0
  58. atdd/coder/conventions/tests/test_component_urn_naming.py +165 -0
  59. atdd/coder/conventions/tests/test_thinness_recipe.py +286 -0
  60. atdd/coder/conventions/thinness.recipe.yaml +82 -0
  61. atdd/coder/conventions/train.convention.yaml +325 -0
  62. atdd/coder/conventions/verification.protocol.yaml +53 -0
  63. atdd/coder/schemas/design_system.schema.json +361 -0
  64. atdd/coder/validators/__init__.py +0 -0
  65. atdd/coder/validators/test_commons_structure.py +485 -0
  66. atdd/coder/validators/test_complexity.py +416 -0
  67. atdd/coder/validators/test_cross_language_consistency.py +431 -0
  68. atdd/coder/validators/test_design_system_compliance.py +413 -0
  69. atdd/coder/validators/test_dto_testing_patterns.py +268 -0
  70. atdd/coder/validators/test_green_cross_stack_layers.py +168 -0
  71. atdd/coder/validators/test_green_layer_dependencies.py +148 -0
  72. atdd/coder/validators/test_green_python_layer_structure.py +103 -0
  73. atdd/coder/validators/test_green_supabase_layer_structure.py +103 -0
  74. atdd/coder/validators/test_import_boundaries.py +396 -0
  75. atdd/coder/validators/test_init_file_urns.py +593 -0
  76. atdd/coder/validators/test_preact_layer_boundaries.py +221 -0
  77. atdd/coder/validators/test_presentation_convention.py +260 -0
  78. atdd/coder/validators/test_python_architecture.py +674 -0
  79. atdd/coder/validators/test_quality_metrics.py +420 -0
  80. atdd/coder/validators/test_station_master_pattern.py +244 -0
  81. atdd/coder/validators/test_train_infrastructure.py +454 -0
  82. atdd/coder/validators/test_train_urns.py +293 -0
  83. atdd/coder/validators/test_typescript_architecture.py +616 -0
  84. atdd/coder/validators/test_usecase_structure.py +421 -0
  85. atdd/coder/validators/test_wagon_boundaries.py +586 -0
  86. atdd/conftest.py +126 -0
  87. atdd/planner/__init__.py +1 -0
  88. atdd/planner/conventions/acceptance.convention.yaml +538 -0
  89. atdd/planner/conventions/appendix.convention.yaml +187 -0
  90. atdd/planner/conventions/artifact-naming.convention.yaml +852 -0
  91. atdd/planner/conventions/component.convention.yaml +670 -0
  92. atdd/planner/conventions/criteria.convention.yaml +141 -0
  93. atdd/planner/conventions/feature.convention.yaml +371 -0
  94. atdd/planner/conventions/interface.convention.yaml +382 -0
  95. atdd/planner/conventions/steps.convention.yaml +141 -0
  96. atdd/planner/conventions/train.convention.yaml +552 -0
  97. atdd/planner/conventions/wagon.convention.yaml +275 -0
  98. atdd/planner/conventions/wmbt.convention.yaml +258 -0
  99. atdd/planner/schemas/acceptance.schema.json +336 -0
  100. atdd/planner/schemas/appendix.schema.json +78 -0
  101. atdd/planner/schemas/component.schema.json +114 -0
  102. atdd/planner/schemas/feature.schema.json +197 -0
  103. atdd/planner/schemas/train.schema.json +192 -0
  104. atdd/planner/schemas/wagon.schema.json +281 -0
  105. atdd/planner/schemas/wmbt.schema.json +59 -0
  106. atdd/planner/validators/__init__.py +0 -0
  107. atdd/planner/validators/conftest.py +5 -0
  108. atdd/planner/validators/test_draft_wagon_registry.py +374 -0
  109. atdd/planner/validators/test_plan_cross_refs.py +240 -0
  110. atdd/planner/validators/test_plan_uniqueness.py +224 -0
  111. atdd/planner/validators/test_plan_urn_resolution.py +268 -0
  112. atdd/planner/validators/test_plan_wagons.py +174 -0
  113. atdd/planner/validators/test_train_validation.py +514 -0
  114. atdd/planner/validators/test_wagon_urn_chain.py +648 -0
  115. atdd/planner/validators/test_wmbt_consistency.py +327 -0
  116. atdd/planner/validators/test_wmbt_vocabulary.py +632 -0
  117. atdd/tester/__init__.py +1 -0
  118. atdd/tester/conventions/artifact.convention.yaml +257 -0
  119. atdd/tester/conventions/contract.convention.yaml +1009 -0
  120. atdd/tester/conventions/filename.convention.yaml +555 -0
  121. atdd/tester/conventions/migration.convention.yaml +509 -0
  122. atdd/tester/conventions/red.convention.yaml +797 -0
  123. atdd/tester/conventions/routing.convention.yaml +51 -0
  124. atdd/tester/conventions/telemetry.convention.yaml +458 -0
  125. atdd/tester/schemas/a11y.tmpl.json +17 -0
  126. atdd/tester/schemas/artifact.schema.json +189 -0
  127. atdd/tester/schemas/contract.schema.json +591 -0
  128. atdd/tester/schemas/contract.tmpl.json +95 -0
  129. atdd/tester/schemas/db.tmpl.json +20 -0
  130. atdd/tester/schemas/e2e.tmpl.json +17 -0
  131. atdd/tester/schemas/edge_function.tmpl.json +17 -0
  132. atdd/tester/schemas/event.tmpl.json +17 -0
  133. atdd/tester/schemas/http.tmpl.json +19 -0
  134. atdd/tester/schemas/job.tmpl.json +18 -0
  135. atdd/tester/schemas/load.tmpl.json +21 -0
  136. atdd/tester/schemas/metric.tmpl.json +19 -0
  137. atdd/tester/schemas/pack.schema.json +139 -0
  138. atdd/tester/schemas/realtime.tmpl.json +20 -0
  139. atdd/tester/schemas/rls.tmpl.json +18 -0
  140. atdd/tester/schemas/script.tmpl.json +16 -0
  141. atdd/tester/schemas/sec.tmpl.json +18 -0
  142. atdd/tester/schemas/storage.tmpl.json +18 -0
  143. atdd/tester/schemas/telemetry.schema.json +128 -0
  144. atdd/tester/schemas/telemetry_tracking_manifest.schema.json +143 -0
  145. atdd/tester/schemas/test_filename.schema.json +194 -0
  146. atdd/tester/schemas/test_intent.schema.json +179 -0
  147. atdd/tester/schemas/unit.tmpl.json +18 -0
  148. atdd/tester/schemas/visual.tmpl.json +18 -0
  149. atdd/tester/schemas/ws.tmpl.json +17 -0
  150. atdd/tester/utils/__init__.py +0 -0
  151. atdd/tester/utils/filename.py +300 -0
  152. atdd/tester/validators/__init__.py +0 -0
  153. atdd/tester/validators/cleanup_duplicate_headers.py +116 -0
  154. atdd/tester/validators/cleanup_duplicate_headers_v2.py +135 -0
  155. atdd/tester/validators/conftest.py +5 -0
  156. atdd/tester/validators/coverage_gap_report.py +321 -0
  157. atdd/tester/validators/fix_dual_ac_references.py +179 -0
  158. atdd/tester/validators/remove_duplicate_lines.py +93 -0
  159. atdd/tester/validators/test_acceptance_urn_filename_mapping.py +359 -0
  160. atdd/tester/validators/test_acceptance_urn_separator.py +166 -0
  161. atdd/tester/validators/test_artifact_naming_category.py +307 -0
  162. atdd/tester/validators/test_contract_schema_compliance.py +706 -0
  163. atdd/tester/validators/test_contracts_structure.py +200 -0
  164. atdd/tester/validators/test_coverage_adequacy.py +797 -0
  165. atdd/tester/validators/test_dual_ac_reference.py +225 -0
  166. atdd/tester/validators/test_fixture_validity.py +372 -0
  167. atdd/tester/validators/test_isolation.py +487 -0
  168. atdd/tester/validators/test_migration_coverage.py +204 -0
  169. atdd/tester/validators/test_migration_criteria.py +276 -0
  170. atdd/tester/validators/test_migration_generation.py +116 -0
  171. atdd/tester/validators/test_python_test_naming.py +410 -0
  172. atdd/tester/validators/test_red_layer_validation.py +95 -0
  173. atdd/tester/validators/test_red_python_layer_structure.py +87 -0
  174. atdd/tester/validators/test_red_supabase_layer_structure.py +90 -0
  175. atdd/tester/validators/test_telemetry_structure.py +634 -0
  176. atdd/tester/validators/test_typescript_test_naming.py +301 -0
  177. atdd/tester/validators/test_typescript_test_structure.py +84 -0
  178. atdd-0.1.0.dist-info/METADATA +191 -0
  179. atdd-0.1.0.dist-info/RECORD +183 -0
  180. atdd-0.1.0.dist-info/WHEEL +5 -0
  181. atdd-0.1.0.dist-info/entry_points.txt +2 -0
  182. atdd-0.1.0.dist-info/licenses/LICENSE +674 -0
  183. atdd-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,591 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://wagons.dev/schemas/tester/contract.schema.json",
4
+ "title": "Contract Schema Meta-Schema",
5
+ "description": "Meta-schema that validates the common structure of all contract schemas. Enforces required fields and x-artifact-metadata structure, but allows flexible content (properties vs patternProperties).",
6
+ "type": "object",
7
+ "required": [
8
+ "$schema",
9
+ "$id",
10
+ "title",
11
+ "description",
12
+ "type",
13
+ "version",
14
+ "x-artifact-metadata"
15
+ ],
16
+ "properties": {
17
+ "$schema": {
18
+ "type": "string",
19
+ "const": "http://json-schema.org/draft-07/schema#",
20
+ "description": "Must use JSON Schema Draft-07"
21
+ },
22
+ "$id": {
23
+ "type": "string",
24
+ "pattern": "^([a-z][a-z0-9\\-]*:)+[a-z][a-z0-9\\-.]*$",
25
+ "description": "Contract ID pattern: {theme}(:{path})*:{resource} - hierarchical with colons, dots allowed temporarily during migration, NO 'contract:' prefix, NO version (e.g., commons:ux:foundations:color)"
26
+ },
27
+ "title": {
28
+ "type": "string",
29
+ "minLength": 1,
30
+ "description": "Human-readable title (PascalCase recommended)"
31
+ },
32
+ "description": {
33
+ "type": "string",
34
+ "minLength": 10,
35
+ "description": "Contract purpose description"
36
+ },
37
+ "version": {
38
+ "type": "string",
39
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
40
+ "description": "Semantic version (REQUIRED): 0.x.x for draft, 1.x.x+ for stable. Major=breaking, Minor=additive, Patch=docs/metadata"
41
+ },
42
+ "type": {
43
+ "type": "string",
44
+ "const": "object",
45
+ "description": "Contracts must be objects"
46
+ },
47
+ "x-artifact-metadata": {
48
+ "type": "object",
49
+ "required": [
50
+ "domain",
51
+ "resource",
52
+ "api",
53
+ "producer",
54
+ "consumers",
55
+ "dependencies",
56
+ "traceability",
57
+ "governance"
58
+ ],
59
+ "properties": {
60
+ "domain": {
61
+ "type": "string",
62
+ "pattern": "^[a-z_]+$",
63
+ "description": "Domain from artifact name (before colon)"
64
+ },
65
+ "resource": {
66
+ "type": "string",
67
+ "pattern": "^[a-z_]+(\\.[a-z_]+)?$",
68
+ "description": "Resource from artifact name (after colon)"
69
+ },
70
+ "collection": {
71
+ "type": "boolean",
72
+ "description": "True if this schema is part of a collection (multiple schemas for single artifact)"
73
+ },
74
+ "member": {
75
+ "type": "string",
76
+ "pattern": "^[a-z][a-z0-9\\-_]*$",
77
+ "description": "For collection pattern: identifies specific schema within collection (e.g., 'color', 'system-persona' for ux:foundations collection)"
78
+ },
79
+ "version": {
80
+ "type": "string",
81
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
82
+ "description": "Contract version (semver)"
83
+ },
84
+ "hash": {
85
+ "type": "string",
86
+ "description": "SHA-256 content hash"
87
+ },
88
+ "producer": {
89
+ "type": "string",
90
+ "pattern": "^wagon:[a-z\\-]+$",
91
+ "description": "Producing wagon"
92
+ },
93
+ "consumers": {
94
+ "type": "array",
95
+ "items": {
96
+ "type": "string",
97
+ "pattern": "^(wagon|external):[a-z\\-]+$"
98
+ },
99
+ "description": "Consuming wagons or external services"
100
+ },
101
+ "dependencies": {
102
+ "type": "array",
103
+ "items": {
104
+ "type": "string",
105
+ "pattern": "^contract:([a-z][a-z0-9\\-]*:)+[a-z][a-z0-9\\-]*$"
106
+ },
107
+ "description": "Other contracts this depends on"
108
+ },
109
+ "api": {
110
+ "type": "object",
111
+ "required": [
112
+ "operations"
113
+ ],
114
+ "properties": {
115
+ "version": {
116
+ "type": "string",
117
+ "pattern": "^v\\d+$",
118
+ "description": "API version (e.g., v1, v2)"
119
+ },
120
+ "operations": {
121
+ "type": "array",
122
+ "minItems": 1,
123
+ "items": {
124
+ "type": "object",
125
+ "required": [
126
+ "method",
127
+ "path",
128
+ "responses"
129
+ ],
130
+ "properties": {
131
+ "method": {
132
+ "type": "string",
133
+ "enum": [
134
+ "GET",
135
+ "POST",
136
+ "PUT",
137
+ "DELETE",
138
+ "PATCH"
139
+ ]
140
+ },
141
+ "path": {
142
+ "type": "string",
143
+ "pattern": "^/",
144
+ "description": "REST endpoint path"
145
+ },
146
+ "description": {
147
+ "type": "string",
148
+ "description": "Operation description"
149
+ },
150
+ "requestBody": {
151
+ "type": "object",
152
+ "properties": {
153
+ "schema": {
154
+ "type": "string",
155
+ "description": "JSON Schema reference"
156
+ },
157
+ "required": {
158
+ "type": "boolean",
159
+ "default": true
160
+ },
161
+ "contentType": {
162
+ "type": "string",
163
+ "default": "application/json"
164
+ }
165
+ }
166
+ },
167
+ "responses": {
168
+ "type": "object",
169
+ "patternProperties": {
170
+ "^[1-5][0-9]{2}$": {
171
+ "type": "object",
172
+ "required": [
173
+ "description"
174
+ ],
175
+ "properties": {
176
+ "description": {
177
+ "type": "string"
178
+ },
179
+ "schema": {
180
+ "type": "string",
181
+ "description": "Response schema reference"
182
+ },
183
+ "headers": {
184
+ "type": "array",
185
+ "items": {
186
+ "type": "object",
187
+ "required": [
188
+ "name"
189
+ ],
190
+ "properties": {
191
+ "name": {
192
+ "type": "string"
193
+ },
194
+ "type": {
195
+ "type": "string"
196
+ },
197
+ "description": {
198
+ "type": "string"
199
+ }
200
+ }
201
+ }
202
+ }
203
+ }
204
+ }
205
+ },
206
+ "additionalProperties": false
207
+ },
208
+ "headers": {
209
+ "type": "array",
210
+ "items": {
211
+ "type": "object",
212
+ "required": [
213
+ "name"
214
+ ],
215
+ "properties": {
216
+ "name": {
217
+ "type": "string"
218
+ },
219
+ "value": {
220
+ "type": "string"
221
+ },
222
+ "description": {
223
+ "type": "string"
224
+ },
225
+ "required": {
226
+ "type": "boolean",
227
+ "default": false
228
+ }
229
+ }
230
+ }
231
+ },
232
+ "security": {
233
+ "type": "array",
234
+ "items": {
235
+ "type": "object",
236
+ "required": [
237
+ "type"
238
+ ],
239
+ "properties": {
240
+ "type": {
241
+ "type": "string",
242
+ "enum": [
243
+ "oauth2",
244
+ "jwt",
245
+ "apiKey",
246
+ "basic"
247
+ ]
248
+ },
249
+ "scheme": {
250
+ "type": "string",
251
+ "description": "Auth scheme (e.g., bearer)"
252
+ },
253
+ "scopes": {
254
+ "type": "array",
255
+ "items": {
256
+ "type": "string"
257
+ },
258
+ "description": "OAuth2 scopes"
259
+ },
260
+ "name": {
261
+ "type": "string",
262
+ "description": "API key name"
263
+ },
264
+ "in": {
265
+ "type": "string",
266
+ "enum": [
267
+ "header",
268
+ "query",
269
+ "cookie"
270
+ ],
271
+ "description": "API key location"
272
+ }
273
+ }
274
+ }
275
+ },
276
+ "parameters": {
277
+ "type": "array",
278
+ "items": {
279
+ "type": "object",
280
+ "required": [
281
+ "name",
282
+ "in"
283
+ ],
284
+ "properties": {
285
+ "name": {
286
+ "type": "string"
287
+ },
288
+ "in": {
289
+ "type": "string",
290
+ "enum": [
291
+ "query",
292
+ "path",
293
+ "header"
294
+ ]
295
+ },
296
+ "type": {
297
+ "type": "string"
298
+ },
299
+ "description": {
300
+ "type": "string"
301
+ },
302
+ "required": {
303
+ "type": "boolean",
304
+ "default": false
305
+ },
306
+ "default": {},
307
+ "enum": {
308
+ "type": "array"
309
+ }
310
+ }
311
+ }
312
+ },
313
+ "idempotent": {
314
+ "type": "boolean",
315
+ "description": "Whether operation is retry-safe"
316
+ }
317
+ }
318
+ }
319
+ }
320
+ }
321
+ },
322
+ "traceability": {
323
+ "type": "object",
324
+ "required": [
325
+ "wagon_ref",
326
+ "feature_refs"
327
+ ],
328
+ "properties": {
329
+ "wagon_ref": {
330
+ "type": "string",
331
+ "pattern": "^plan/[a-z_\\-]+/_[a-z_\\-]+\\.yaml$",
332
+ "description": "Path to wagon manifest that produces this contract"
333
+ },
334
+ "feature_refs": {
335
+ "type": "array",
336
+ "minItems": 1,
337
+ "items": {
338
+ "type": "string",
339
+ "pattern": "^feature:[a-z\\-]+:[a-z\\-]+$"
340
+ },
341
+ "description": "Feature URNs that produce this contract (at least one required)"
342
+ },
343
+ "acceptance_refs": {
344
+ "type": "array",
345
+ "items": {
346
+ "type": "string",
347
+ "pattern": "^acc:[a-z][a-z0-9_-]*:([DLPCEMYRK][0-9]{3}-(UNIT|HTTP|EVENT|WS|E2E|A11Y|VIS|METRIC|JOB|DB|SEC|LOAD|SCRIPT|WIDGET|GOLDEN|BLOC|INTEGRATION|RLS|EDGE|REALTIME|STORAGE)-[0-9]{3}(?:-[a-z0-9-]+)?|[A-Z][0-9]{3})$"
348
+ },
349
+ "description": "Acceptance URNs that validate this contract (optional)"
350
+ }
351
+ }
352
+ },
353
+ "testing": {
354
+ "type": "object",
355
+ "properties": {
356
+ "directory": {
357
+ "type": "string",
358
+ "pattern": "^contracts/[a-z_]+/[a-z_]+/tests/$",
359
+ "description": "Optional legacy path to co-located tests"
360
+ },
361
+ "schema_tests": {
362
+ "type": "array",
363
+ "items": {
364
+ "type": "string"
365
+ },
366
+ "description": "Optional test file names for documentation"
367
+ }
368
+ }
369
+ },
370
+ "telemetry_refs": {
371
+ "type": "array",
372
+ "items": {
373
+ "type": "string",
374
+ "pattern": "^telemetry:(event|metric|trace|log):([a-z][a-z0-9_-]*:)+[a-z][a-z0-9_-]*$"
375
+ }
376
+ },
377
+ "governance": {
378
+ "type": "object",
379
+ "required": ["status"],
380
+ "properties": {
381
+ "status": {
382
+ "type": "string",
383
+ "enum": [
384
+ "draft",
385
+ "active",
386
+ "deprecated",
387
+ "retired"
388
+ ],
389
+ "description": "Contract lifecycle status. draft=0.x.x (iterating), active=1.x.x+ (stable), deprecated=sunset warning, retired=no longer used"
390
+ },
391
+ "stability": {
392
+ "type": "string",
393
+ "enum": [
394
+ "experimental",
395
+ "stable",
396
+ "frozen"
397
+ ],
398
+ "description": "API stability level. experimental=may change, stable=backward compat maintained, frozen=no more changes"
399
+ }
400
+ }
401
+ },
402
+ "persistence": {
403
+ "type": "object",
404
+ "description": "Database persistence configuration (only for persistent entities)",
405
+ "properties": {
406
+ "strategy": {
407
+ "type": "string",
408
+ "enum": ["none", "jsonb", "relational"],
409
+ "description": "Persistence strategy: none (ephemeral), jsonb (document store), relational (normalized tables)"
410
+ },
411
+ "table": {
412
+ "type": "string",
413
+ "pattern": "^[a-z][a-z0-9_]*$",
414
+ "description": "Database table name (required if strategy != none)"
415
+ },
416
+ "migration": {
417
+ "type": "string",
418
+ "pattern": "^supabase/migrations/[0-9]{14}_[a-z0-9_]+\\.sql$",
419
+ "description": "Path to migration file that created this table"
420
+ },
421
+ "indexes": {
422
+ "type": "array",
423
+ "items": {
424
+ "type": "object",
425
+ "required": ["name", "fields"],
426
+ "properties": {
427
+ "name": {
428
+ "type": "string",
429
+ "description": "Index name"
430
+ },
431
+ "type": {
432
+ "type": "string",
433
+ "enum": ["btree", "gin", "gist", "hash"],
434
+ "default": "btree"
435
+ },
436
+ "fields": {
437
+ "type": "array",
438
+ "items": {"type": "string"},
439
+ "description": "Indexed fields (for JSONB: use -> notation like 'data->>id')"
440
+ }
441
+ }
442
+ },
443
+ "description": "Database indexes for this table"
444
+ }
445
+ },
446
+ "required": ["strategy"]
447
+ },
448
+ "extensions": {
449
+ "type": "object",
450
+ "description": "Domain-specific extensions"
451
+ }
452
+ },
453
+ "additionalProperties": false
454
+ },
455
+ "properties": {
456
+ "type": "object",
457
+ "description": "Contract-specific properties (for fixed-schema contracts)"
458
+ },
459
+ "patternProperties": {
460
+ "type": "object",
461
+ "description": "Pattern-based properties (for catalog/token contracts)"
462
+ },
463
+ "required": {
464
+ "type": "array",
465
+ "items": {
466
+ "type": "string"
467
+ },
468
+ "description": "Required property names"
469
+ },
470
+ "$defs": {
471
+ "type": "object",
472
+ "description": "Reusable schema definitions"
473
+ },
474
+ "examples": {
475
+ "type": "array",
476
+ "description": "Example instances"
477
+ },
478
+ "additionalProperties": {
479
+ "type": "boolean",
480
+ "description": "Whether additional properties are allowed"
481
+ }
482
+ },
483
+ "additionalProperties": true,
484
+ "examples": [
485
+ {
486
+ "$schema": "http://json-schema.org/draft-07/schema#",
487
+ "$id": "mechanic:timebank:exhausted",
488
+ "title": "DecisionChoice",
489
+ "description": "Player decision choice",
490
+ "version": "1.0.0",
491
+ "type": "object",
492
+ "properties": {
493
+ "playerId": {
494
+ "type": "string"
495
+ },
496
+ "choice": {
497
+ "type": "string"
498
+ }
499
+ },
500
+ "x-artifact-metadata": {
501
+ "domain": "decision",
502
+ "resource": "choice",
503
+ "version": "1.0.0",
504
+ "api": {
505
+ "version": "v1",
506
+ "operations": [
507
+ {
508
+ "method": "POST",
509
+ "path": "/decisions",
510
+ "description": "Create a new decision choice",
511
+ "requestBody": {
512
+ "schema": "$ref: #/definitions/DecisionChoice",
513
+ "required": true
514
+ },
515
+ "responses": {
516
+ "201": {
517
+ "description": "Choice created successfully",
518
+ "schema": "$ref: #/definitions/DecisionChoice"
519
+ },
520
+ "400": {
521
+ "description": "Invalid input",
522
+ "schema": "$ref: #/definitions/ErrorResponse"
523
+ }
524
+ },
525
+ "headers": [
526
+ {
527
+ "name": "Content-Type",
528
+ "value": "application/json",
529
+ "required": true
530
+ },
531
+ {
532
+ "name": "Authorization",
533
+ "description": "Bearer token",
534
+ "required": true
535
+ }
536
+ ],
537
+ "security": [
538
+ {
539
+ "type": "jwt",
540
+ "scheme": "bearer"
541
+ }
542
+ ],
543
+ "idempotent": false
544
+ },
545
+ {
546
+ "method": "GET",
547
+ "path": "/decisions/{id}",
548
+ "description": "Retrieve a decision choice",
549
+ "responses": {
550
+ "200": {
551
+ "description": "Choice found",
552
+ "schema": "$ref: #/definitions/DecisionChoice"
553
+ },
554
+ "404": {
555
+ "description": "Choice not found",
556
+ "schema": "$ref: #/definitions/ErrorResponse"
557
+ }
558
+ },
559
+ "parameters": [
560
+ {
561
+ "name": "id",
562
+ "in": "path",
563
+ "type": "string",
564
+ "required": true
565
+ }
566
+ ],
567
+ "idempotent": true
568
+ }
569
+ ]
570
+ },
571
+ "producer": "wagon:resolve-dilemmas",
572
+ "consumers": [
573
+ "wagon:pace-dilemmas"
574
+ ],
575
+ "dependencies": [],
576
+ "traceability": {
577
+ "wagon_ref": "plan/resolve_dilemmas/_resolve_dilemmas.yaml",
578
+ "feature_refs": [
579
+ "feature:resolve-dilemmas:choose-option"
580
+ ]
581
+ },
582
+ "testing": {
583
+ "directory": "contracts/decision/tests/",
584
+ "schema_tests": [
585
+ "choice_schema_test.json"
586
+ ]
587
+ }
588
+ }
589
+ }
590
+ ]
591
+ }
@@ -0,0 +1,95 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "{theme}:{resource}[.{facet}]",
4
+ "title": "{PascalCaseTitle}",
5
+ "description": "{Concise description of contract purpose}",
6
+ "version": "1.0.0",
7
+ "type": "object",
8
+
9
+ "required": ["version"],
10
+ "additionalProperties": false,
11
+
12
+ "properties": {
13
+ "version": {
14
+ "type": "string",
15
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
16
+ "description": "Contract version (semver)"
17
+ }
18
+ },
19
+
20
+ "$defs": {
21
+ },
22
+
23
+ "examples": [
24
+ {
25
+ }
26
+ ],
27
+
28
+ "x-artifact-metadata": {
29
+ "domain": "{domain}",
30
+ "resource": "{resource}",
31
+ "version": "1.0.0",
32
+ "hash": "<sha256-content-hash>",
33
+
34
+ "producer": "wagon:{wagon-name}",
35
+ "consumers": [
36
+ "wagon:{consumer-wagon}",
37
+ "external:{external-service}"
38
+ ],
39
+
40
+ "dependencies": [
41
+ "contract:{domain}:{resource}.{facet}"
42
+ ],
43
+
44
+ "api": {
45
+ "method": "GET|POST|PUT|DELETE",
46
+ "path": "/{domain}s/{id}/{resource}",
47
+ "auth": "required|optional|none"
48
+ },
49
+
50
+ "traceability": {
51
+ "wagon_ref": "plan/{wagon}/_<wagon>.yaml",
52
+ "feature_refs": [
53
+ "feature:{wagon}:{feature-slug}"
54
+ ],
55
+ "acceptance_refs": [
56
+ "acc:{wagon}:{epic-id}.{AC-ID}"
57
+ ]
58
+ },
59
+
60
+ "testing": {
61
+ "directory": "contracts/{domain}/tests/",
62
+ "schema_tests": [
63
+ "{schema_name}_schema_test.json",
64
+ "{schema_name}_validation_test.ts"
65
+ ]
66
+ },
67
+
68
+ "telemetry_refs": [
69
+ "telemetry:event:{domain}:{resource}:{signal}",
70
+ "telemetry:metric:{domain}:latency:{measure}"
71
+ ],
72
+
73
+ "governance": {
74
+ "status": "draft|active|deprecated",
75
+ "stability": "experimental|stable|frozen"
76
+ },
77
+
78
+ "persistence": {
79
+ "strategy": "jsonb",
80
+ "table": "{theme}_{domain}_{aspect}",
81
+ "migration": "supabase/migrations/{timestamp}_{table_name}.sql",
82
+ "indexes": [
83
+ {
84
+ "name": "idx_{table}_data",
85
+ "type": "gin",
86
+ "fields": ["data"]
87
+ }
88
+ ],
89
+ "_comment": "Only for persistent entities. Options: 'none' (events/DTOs), 'jsonb' (recommended for document storage), 'relational' (normalized tables). Remove this entire field if not persisted."
90
+ },
91
+
92
+ "extensions": {
93
+ }
94
+ }
95
+ }