aw-spec-cli 0.1.3 → 0.1.5

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 (230) hide show
  1. package/README.md +291 -0
  2. package/assets/.agents/agent.json +28 -0
  3. package/assets/.agents/skills/aw-spec-orch/SKILL.md +56 -0
  4. package/assets/.agents/skills/aw-spec-orch-demo/SKILL.md +59 -0
  5. package/assets/.aw-spec/DESIGN-FORMAT.md +151 -0
  6. package/assets/.aw-spec/ORCH-DIALECT.md +156 -0
  7. package/assets/.aw-spec/RULE-PARTITION.md +126 -0
  8. package/assets/.aw-spec/extensions/agent-context/extension.yml +12 -9
  9. package/assets/.aw-spec/extensions.yml +12 -19
  10. package/assets/.aw-spec/integrations/aw-spec.manifest.json +1 -9
  11. package/assets/.aw-spec/interpreter/run-skill.py +1158 -0
  12. package/assets/.aw-spec/orchestrator/AGENT-PROFILE.md +94 -0
  13. package/assets/.aw-spec/orchestrator/README.md +300 -0
  14. package/assets/.aw-spec/orchestrator/adapters/claude_agent_sdk.py +74 -0
  15. package/assets/.aw-spec/orchestrator/adapters/google_antigravity.py +74 -0
  16. package/assets/.aw-spec/orchestrator/modules/delta-design.orch.yaml +105 -0
  17. package/assets/.aw-spec/orchestrator/modules/delta-spec.orch.yaml +79 -0
  18. package/assets/.aw-spec/orchestrator/modules/domain-select.orch.yaml +81 -0
  19. package/assets/.aw-spec/orchestrator/modules/tech-select.orch.yaml +75 -0
  20. package/assets/.aw-spec/orchestrator/orchestrator.py +1721 -0
  21. package/assets/.aw-spec/orchestrator/rev-templates/ai-rules.reference.md +40 -0
  22. package/assets/.aw-spec/orchestrator/rev-templates/comandrulemap.skeleton.md +59 -0
  23. package/assets/.aw-spec/orchestrator/rev-templates/commandtechrulemap.skeleton.md +97 -0
  24. package/assets/.aw-spec/orchestrator/rev-templates/domain-constitution.skeleton.md +61 -0
  25. package/assets/.aw-spec/orchestrator/rev-templates/domain-requirements.skeleton.md +48 -0
  26. package/assets/.aw-spec/orchestrator/rev-templates/domain-rule-file.skeleton.md +39 -0
  27. package/assets/.aw-spec/orchestrator/rev-templates/technical-constitution.skeleton.md +106 -0
  28. package/assets/.aw-spec/orchestrator/rev-templates/technical-rule-file.skeleton.md +54 -0
  29. package/assets/.aw-spec/orchestrator/workflows/_smoke.orch.yaml +160 -0
  30. package/assets/.aw-spec/orchestrator/workflows/aw-spec-add-component.orch.yaml +244 -0
  31. package/assets/.aw-spec/orchestrator/workflows/aw-spec-adopt.orch.yaml +775 -0
  32. package/assets/.aw-spec/orchestrator/workflows/aw-spec-analyze-delta-design.orch.yaml +248 -0
  33. package/assets/.aw-spec/orchestrator/workflows/aw-spec-analyze-design.orch.yaml +261 -0
  34. package/assets/.aw-spec/orchestrator/workflows/aw-spec-analyze-slice.orch.yaml +425 -0
  35. package/assets/.aw-spec/orchestrator/workflows/aw-spec-build.orch.yaml +188 -0
  36. package/assets/.aw-spec/orchestrator/workflows/aw-spec-characterize.orch.yaml +474 -0
  37. package/assets/.aw-spec/orchestrator/workflows/aw-spec-close-delta.orch.yaml +181 -0
  38. package/assets/.aw-spec/orchestrator/workflows/aw-spec-constitution.orch.yaml +284 -0
  39. package/assets/.aw-spec/orchestrator/workflows/aw-spec-demo.orch.yaml +103 -0
  40. package/assets/.aw-spec/orchestrator/workflows/aw-spec-dependency-tree.orch.yaml +69 -0
  41. package/assets/.aw-spec/orchestrator/workflows/aw-spec-deploy.orch.yaml +85 -0
  42. package/assets/.aw-spec/orchestrator/workflows/aw-spec-design.orch.yaml +382 -0
  43. package/assets/.aw-spec/orchestrator/workflows/aw-spec-finalize-delta.orch.yaml +382 -0
  44. package/assets/.aw-spec/orchestrator/workflows/aw-spec-foundation.orch.yaml +246 -0
  45. package/assets/.aw-spec/orchestrator/workflows/aw-spec-implement-delta.orch.yaml +231 -0
  46. package/assets/.aw-spec/orchestrator/workflows/aw-spec-implement.orch.yaml +258 -0
  47. package/assets/.aw-spec/orchestrator/workflows/aw-spec-inventory.orch.yaml +236 -0
  48. package/assets/.aw-spec/orchestrator/workflows/aw-spec-onboard.orch.yaml +949 -0
  49. package/assets/.aw-spec/orchestrator/workflows/aw-spec-parity.orch.yaml +293 -0
  50. package/assets/.aw-spec/orchestrator/workflows/aw-spec-run.orch.yaml +177 -0
  51. package/assets/.aw-spec/orchestrator/workflows/aw-spec-select-domain.orch.yaml +79 -0
  52. package/assets/.aw-spec/orchestrator/workflows/aw-spec-select-feature.orch.yaml +128 -0
  53. package/assets/.aw-spec/orchestrator/workflows/aw-spec-specify.orch.yaml +412 -0
  54. package/assets/.aw-spec/scripts/bash/aw-inventory.sh +14 -0
  55. package/assets/.aw-spec/scripts/bash/aw-parity.sh +13 -0
  56. package/assets/.aw-spec/scripts/bash/aw-rev-constitution.sh +13 -0
  57. package/assets/.aw-spec/scripts/bash/aw-spec-actions.sh +1899 -0
  58. package/assets/.aw-spec/scripts/bash/aw-xref.sh +15 -0
  59. package/assets/.aw-spec/scripts/bash/common.sh +11 -60
  60. package/assets/.aw-spec/scripts/powershell/aw-inventory.ps1 +14 -0
  61. package/assets/.aw-spec/scripts/powershell/aw-parity.ps1 +13 -0
  62. package/assets/.aw-spec/scripts/powershell/aw-rev-constitution.ps1 +13 -0
  63. package/assets/.aw-spec/scripts/powershell/aw-spec-actions.ps1 +1563 -0
  64. package/assets/.aw-spec/scripts/powershell/aw-xref.ps1 +15 -0
  65. package/assets/.aw-spec/scripts/python/aw-inventory.py +683 -0
  66. package/assets/.aw-spec/scripts/python/aw-parity.py +380 -0
  67. package/assets/.aw-spec/scripts/python/aw-rev-constitution.py +312 -0
  68. package/assets/.aw-spec/scripts/python/aw-xref.py +1330 -0
  69. package/assets/.aw-spec/scripts/python/validate_okf.py +349 -0
  70. package/assets/.aw-spec/templates/constitution-domain-template.md +75 -0
  71. package/assets/.aw-spec/templates/constitution-technical-template.md +70 -0
  72. package/assets/.aw-spec/templates/delta-design-template.md +69 -0
  73. package/assets/.aw-spec/templates/delta-spec-template.md +60 -0
  74. package/assets/.aw-spec/templates/design-template.md +383 -0
  75. package/assets/.aw-spec/templates/okf-concept-template.md +103 -0
  76. package/assets/.aw-spec/templates/parity-manifest-template.json +49 -0
  77. package/assets/.aw-spec/templates/source-map-template.md +85 -0
  78. package/assets/.aw-spec/templates/spec-template.md +192 -71
  79. package/assets/.claude/agent.json +27 -0
  80. package/assets/.claude/skills/aw-spec-orch/SKILL.md +55 -0
  81. package/assets/.claude/skills/aw-spec-orch-demo/SKILL.md +59 -0
  82. package/assets/.kilocode/agent.json +28 -0
  83. package/assets/.kilocode/workflows/aw-spec-orch-demo.md +59 -0
  84. package/assets/.kilocode/workflows/aw-spec-orch.md +55 -0
  85. package/assets/docs/architecture/clean-architecture.md +1 -1
  86. package/assets/docs/architecture/cqrs.md +1 -1
  87. package/assets/docs/architecture/eventing.md +1 -1
  88. package/assets/docs/architecture/folder-structure.md +1 -1
  89. package/assets/docs/architecture/modular-monolith.md +1 -1
  90. package/assets/docs/architecture/persistence.md +1 -1
  91. package/assets/docs/architecture/testing.md +1 -1
  92. package/assets/docs/architecture/vertical-slices.md +1 -1
  93. package/assets/docs/components/Email/README.md +1 -1
  94. package/assets/docs/components/Jobs/README.md +1 -1
  95. package/assets/docs/components/QrGenerator/README.md +1 -1
  96. package/assets/docs/components/README.md +1 -1
  97. package/assets/docs/domain/domain-driven-design.md +1 -1
  98. package/assets/docs/domainspecs/healthcare/api-versioning.domain.md +1 -1
  99. package/assets/docs/domainspecs/healthcare/auditing.domain.md +86 -18
  100. package/assets/docs/domainspecs/healthcare/authorization.domain.md +1 -1
  101. package/assets/docs/domainspecs/healthcare/clinical-terms.md +1 -1
  102. package/assets/docs/domainspecs/healthcare/coding-standards.domain.md +1 -1
  103. package/assets/docs/domainspecs/healthcare/comandrulemap.md +58 -124
  104. package/assets/docs/domainspecs/healthcare/commandtechrulemap.md +119 -0
  105. package/assets/docs/domainspecs/healthcare/consent.md +1 -1
  106. package/assets/docs/domainspecs/healthcare/cqrs.domain.md +1 -1
  107. package/assets/docs/domainspecs/healthcare/data-classification.domain.md +1 -1
  108. package/assets/docs/domainspecs/healthcare/dependency-policy.domain.md +1 -1
  109. package/assets/docs/domainspecs/healthcare/dicom.md +1 -1
  110. package/assets/docs/domainspecs/healthcare/domain-driven-design.domain.md +1 -1
  111. package/assets/docs/domainspecs/healthcare/eventing.domain.md +1 -1
  112. package/assets/docs/domainspecs/healthcare/fhir.md +1 -1
  113. package/assets/docs/domainspecs/healthcare/folder-structure.domain.md +1 -1
  114. package/assets/docs/domainspecs/healthcare/hipaa.md +1 -1
  115. package/assets/docs/domainspecs/healthcare/hl7.md +1 -1
  116. package/assets/docs/domainspecs/healthcare/integration-terms.md +1 -1
  117. package/assets/docs/domainspecs/healthcare/persistence.domain.md +1 -1
  118. package/assets/docs/domainspecs/healthcare/terminology.md +1 -1
  119. package/assets/docs/domainspecs/healthcare/testing.domain.md +1 -1
  120. package/assets/docs/domainspecs/healthcare/vertical-slices.domain.md +1 -1
  121. package/assets/docs/domainspecs/healthcare/zero-trust.domain.md +1 -1
  122. package/assets/docs/domainspecs/pharma/api-versioning.domain.md +1 -1
  123. package/assets/docs/domainspecs/pharma/atc.md +1 -1
  124. package/assets/docs/domainspecs/pharma/auditing.domain.md +80 -16
  125. package/assets/docs/domainspecs/pharma/authorization.domain.md +1 -1
  126. package/assets/docs/domainspecs/pharma/coding-standards.domain.md +1 -1
  127. package/assets/docs/domainspecs/pharma/comandrulemap.md +64 -142
  128. package/assets/docs/domainspecs/pharma/commandtechrulemap.md +119 -0
  129. package/assets/docs/domainspecs/pharma/cqrs.domain.md +1 -1
  130. package/assets/docs/domainspecs/pharma/data-classification.domain.md +1 -1
  131. package/assets/docs/domainspecs/pharma/data-provenance.md +1 -1
  132. package/assets/docs/domainspecs/pharma/dependency-policy.domain.md +1 -1
  133. package/assets/docs/domainspecs/pharma/domain-driven-design.domain.md +1 -1
  134. package/assets/docs/domainspecs/pharma/eventing.domain.md +1 -1
  135. package/assets/docs/domainspecs/pharma/fhir.md +1 -1
  136. package/assets/docs/domainspecs/pharma/folder-structure.domain.md +1 -1
  137. package/assets/docs/domainspecs/pharma/hl7.md +1 -1
  138. package/assets/docs/domainspecs/pharma/idmp.md +1 -1
  139. package/assets/docs/domainspecs/pharma/integration-terms.md +1 -1
  140. package/assets/docs/domainspecs/pharma/ndc.md +1 -1
  141. package/assets/docs/domainspecs/pharma/persistence.domain.md +1 -1
  142. package/assets/docs/domainspecs/pharma/pharma-terms.md +1 -1
  143. package/assets/docs/domainspecs/pharma/product-lifecycle.domain.md +1 -1
  144. package/assets/docs/domainspecs/pharma/regulatory-compliance.md +1 -1
  145. package/assets/docs/domainspecs/pharma/terminology.md +1 -1
  146. package/assets/docs/domainspecs/pharma/testing.domain.md +1 -1
  147. package/assets/docs/domainspecs/pharma/vertical-slices.domain.md +1 -1
  148. package/assets/docs/domainspecs/pharma/zero-trust.domain.md +1 -1
  149. package/assets/docs/governance/api-versioning.md +1 -1
  150. package/assets/docs/governance/coding-standards.md +1 -1
  151. package/assets/docs/governance/dependency-policy.md +1 -1
  152. package/assets/docs/requirement-spec.txt +13 -1
  153. package/assets/docs/security/auditing.md +54 -11
  154. package/assets/docs/security/authorization.md +1 -1
  155. package/assets/docs/security/data-classification.md +1 -1
  156. package/assets/docs/security/zero-trust.md +1 -1
  157. package/dist/commands/update.d.ts +3 -0
  158. package/dist/commands/update.d.ts.map +1 -0
  159. package/dist/commands/update.js +142 -0
  160. package/dist/commands/update.js.map +1 -0
  161. package/dist/utils/manifest.d.ts +31 -0
  162. package/dist/utils/manifest.d.ts.map +1 -0
  163. package/dist/utils/manifest.js +91 -0
  164. package/dist/utils/manifest.js.map +1 -0
  165. package/dist/utils/paths.js +2 -2
  166. package/dist/utils/paths.js.map +1 -1
  167. package/dist/utils/update-engine.d.ts +52 -0
  168. package/dist/utils/update-engine.d.ts.map +1 -0
  169. package/dist/utils/update-engine.js +203 -0
  170. package/dist/utils/update-engine.js.map +1 -0
  171. package/package.json +1 -1
  172. package/assets/.agents/skills/aw-spec-addcomponent/SKILL.md +0 -129
  173. package/assets/.agents/skills/aw-spec-agent-context-update/SKILL.md +0 -31
  174. package/assets/.agents/skills/aw-spec-analyze/SKILL.md +0 -296
  175. package/assets/.agents/skills/aw-spec-checklist/SKILL.md +0 -374
  176. package/assets/.agents/skills/aw-spec-clarify/SKILL.md +0 -320
  177. package/assets/.agents/skills/aw-spec-constitution/SKILL.md +0 -194
  178. package/assets/.agents/skills/aw-spec-fast-implement/SKILL.md +0 -268
  179. package/assets/.agents/skills/aw-spec-foundation/SKILL.md +0 -358
  180. package/assets/.agents/skills/aw-spec-implement/SKILL.md +0 -279
  181. package/assets/.agents/skills/aw-spec-minimal-implementation/SKILL.md +0 -209
  182. package/assets/.agents/skills/aw-spec-plan/SKILL.md +0 -221
  183. package/assets/.agents/skills/aw-spec-select-domain/SKILL.md +0 -73
  184. package/assets/.agents/skills/aw-spec-specify/SKILL.md +0 -382
  185. package/assets/.agents/skills/aw-spec-tasks/SKILL.md +0 -259
  186. package/assets/.agents/skills/aw-spec-taskstoissues/SKILL.md +0 -107
  187. package/assets/.aw-spec/integrations/claude.manifest.json +0 -17
  188. package/assets/.aw-spec/scripts/bash/check-prerequisites.sh +0 -189
  189. package/assets/.aw-spec/scripts/bash/create-new-feature.sh +0 -299
  190. package/assets/.aw-spec/scripts/bash/setup-plan.sh +0 -84
  191. package/assets/.aw-spec/scripts/bash/setup-tasks.sh +0 -91
  192. package/assets/.aw-spec/templates/checklist-template.md +0 -40
  193. package/assets/.aw-spec/templates/constitution-template.md +0 -57
  194. package/assets/.aw-spec/templates/plan-template.md +0 -113
  195. package/assets/.aw-spec/templates/tasks-template.md +0 -252
  196. package/assets/.aw-spec/workflows/aw-spec/workflow.yml +0 -77
  197. package/assets/.aw-spec/workflows/workflow-registry.json +0 -13
  198. package/assets/.claude/skills/aw-spec-addcomponent/SKILL.md +0 -129
  199. package/assets/.claude/skills/aw-spec-agent-context-update/SKILL.md +0 -31
  200. package/assets/.claude/skills/aw-spec-analyze/SKILL.md +0 -296
  201. package/assets/.claude/skills/aw-spec-checklist/SKILL.md +0 -374
  202. package/assets/.claude/skills/aw-spec-clarify/SKILL.md +0 -320
  203. package/assets/.claude/skills/aw-spec-constitution/SKILL.md +0 -194
  204. package/assets/.claude/skills/aw-spec-fast-implement/SKILL.md +0 -268
  205. package/assets/.claude/skills/aw-spec-foundation/SKILL.md +0 -358
  206. package/assets/.claude/skills/aw-spec-implement/SKILL.md +0 -279
  207. package/assets/.claude/skills/aw-spec-minimal-implementation/SKILL.md +0 -209
  208. package/assets/.claude/skills/aw-spec-plan/SKILL.md +0 -221
  209. package/assets/.claude/skills/aw-spec-select-domain/SKILL.md +0 -73
  210. package/assets/.claude/skills/aw-spec-specify/SKILL.md +0 -382
  211. package/assets/.claude/skills/aw-spec-tasks/SKILL.md +0 -259
  212. package/assets/.claude/skills/aw-spec-taskstoissues/SKILL.md +0 -107
  213. package/assets/.kilocode/rules/specify-rules.md +0 -4
  214. package/assets/.kilocode/workflows/aw-spec-addcomponent.md +0 -129
  215. package/assets/.kilocode/workflows/aw-spec-agent-context.update.md +0 -31
  216. package/assets/.kilocode/workflows/aw-spec-analyze.md +0 -296
  217. package/assets/.kilocode/workflows/aw-spec-checklist.md +0 -374
  218. package/assets/.kilocode/workflows/aw-spec-clarify.md +0 -320
  219. package/assets/.kilocode/workflows/aw-spec-constitution.md +0 -194
  220. package/assets/.kilocode/workflows/aw-spec-fast-implement.md +0 -263
  221. package/assets/.kilocode/workflows/aw-spec-foundation.md +0 -358
  222. package/assets/.kilocode/workflows/aw-spec-implement.md +0 -279
  223. package/assets/.kilocode/workflows/aw-spec-minimal-implementation.md +0 -204
  224. package/assets/.kilocode/workflows/aw-spec-plan.md +0 -221
  225. package/assets/.kilocode/workflows/aw-spec-select-domain.md +0 -73
  226. package/assets/.kilocode/workflows/aw-spec-specify.md +0 -382
  227. package/assets/.kilocode/workflows/aw-spec-tasks.md +0 -259
  228. package/assets/.kilocode/workflows/aw-spec-taskstoissues.md +0 -107
  229. package/assets/docs/command.txt +0 -295
  230. package/assets/docs/pharma-constitution.my-ref.md +0 -86
@@ -0,0 +1,248 @@
1
+ # =============================================================================
2
+ # aw-spec-analyze-delta-design (orchestrator) — the delta-spec↔delta-design GATE
3
+ #
4
+ # The CR analog of analyze-design, scoped to the OPEN change. The delta spec is the
5
+ # ANCHOR: confirm delta-design.md STRICTLY realises delta-spec.md (+ the domain gate
6
+ # overlays as a backstop), and that every MODIFIED element names a real element in
7
+ # the master design.md. On drift, REPORT the gaps and ASK whether to repair, then
8
+ # UPDATE delta-design.md to conform (the delta spec wins). This stage VALIDATES the
9
+ # delta only — it does NOT touch spec.md / design.md and does NOT close the change
10
+ # (finalize-delta merges the delta later; close-delta closes it at the very end).
11
+ #
12
+ # specify → design → ⟨review⟩ → analyze-delta-design ← you are here
13
+ # → implement-delta → build → finalize-delta → analyze-slice → close-delta
14
+ #
15
+ # Launch: /aw-spec-orch analyze-delta-design [strategy]
16
+ # Prereq: /aw-spec-orch specify (delta-spec) + design (delta-design) — an OPEN change with both delta docs.
17
+ # =============================================================================
18
+
19
+ name: aw-spec-analyze-delta-design
20
+ description: The delta-spec↔delta-design conformance gate for an open change — confirm delta-design.md realises delta-spec.md (delta spec is the anchor; domain overlays are a backstop; MODIFIED elements must exist in the master design) and, with approval, repair it. Does not modify the master docs or close the change.
21
+ version: 1.0.0
22
+ agent_agnostic: true
23
+ dialect: aw-spec.orchestrator/v1
24
+
25
+ scripts:
26
+ actions:
27
+ sh: .aw-spec/scripts/bash/aw-spec-actions.sh
28
+ ps1: .aw-spec/scripts/powershell/aw-spec-actions.ps1
29
+
30
+ vars:
31
+ analyze_ok: "false"
32
+ active_change: ""
33
+ has_change: "false"
34
+
35
+ workflow:
36
+
37
+ # 1. Resolve the current feature + its spec; require the spec (delta context base).
38
+ - id: feature_paths
39
+ action: execute_script
40
+ on_error: continue # never crash raw on 'no feature set' — the gate below explains it
41
+ script: { ref: actions }
42
+ subcommand: feature-paths
43
+ outputs:
44
+ - { name: feature_dir, from: "$.feature_dir" }
45
+ - { name: spec_file, from: "$.spec_file" }
46
+ - { name: spec_exists, from: "$.spec_exists" }
47
+
48
+ - id: require_feature
49
+ action: verify_context
50
+ require_non_empty: feature_dir
51
+ on_empty: stop
52
+ on_empty_message: "No active feature. Run /aw-spec-orch select-feature first (pick or create the aggregate, e.g. Order), then re-run analyze-delta-design."
53
+
54
+ - id: verify_spec
55
+ action: verify_context
56
+ require_true: spec_exists
57
+ on_false: stop
58
+ on_false_message: "No spec.md for the current feature. Run /aw-spec-orch specify (and design) first."
59
+
60
+ # 1b. Read the OPEN change (opened by cr). A CR gate needs a change to gate.
61
+ - id: read_change
62
+ action: execute_script
63
+ script: { ref: actions }
64
+ subcommand: version-read
65
+ args: ["--feature-dir", "{{feature_dir}}"]
66
+ outputs:
67
+ - { name: active_change, from: "$.active_change" }
68
+ - { name: has_change, from: "$.has_change" }
69
+
70
+ - id: require_change
71
+ action: verify_context
72
+ require_true: has_change
73
+ on_false: stop
74
+ on_false_message: "No open change on this feature. Run /aw-spec-orch specify <change> (opens the change + delta-spec) then /aw-spec-orch design (delta-design) first — analyze-delta-design gates an open change's delta docs."
75
+
76
+ # 2. Ensure the master design.md exists (idempotent) — the base the delta MODIFIED
77
+ # elements must refer to. Delta doc paths are derived from the open change id.
78
+ - id: design_scaffold
79
+ action: execute_script
80
+ script: { ref: actions }
81
+ subcommand: design-scaffold
82
+ args: ["--feature-dir", "{{feature_dir}}"]
83
+ outputs:
84
+ - { name: design_doc, from: "$.design_doc" }
85
+
86
+ # 2b. Load the domain GATE overlays (the comandrulemap `/aw-spec-gate` checklist) as
87
+ # the conformance checklist — VALIDATION input only, NEVER authoring. analyze sees
88
+ # them (include_standards: true); reconcile does NOT (the delta conforms to the
89
+ # delta SPEC, not to the overlays). Empty/no-op for a non-domain project.
90
+ - id: resolve_gate_overlays
91
+ action: execute_script
92
+ script: { ref: actions }
93
+ subcommand: resolve-domain
94
+ args: ["--command", "aw-spec-gate"]
95
+ outputs:
96
+ - { name: gate_overlays, from: "$.candidates" }
97
+ - id: load_gate_overlays
98
+ action: load_standards
99
+ files_from_variable: gate_overlays
100
+ optional: true
101
+
102
+ # 3. Pre-execution hooks.
103
+ - id: resolve_pre_hooks
104
+ action: execute_script
105
+ script: { ref: actions }
106
+ subcommand: resolve-hooks
107
+ args: ["--phase", "before_analyze_cr"]
108
+ outputs:
109
+ - { name: before_hooks, from: "$.hooks" }
110
+ - id: dispatch_pre_hooks
111
+ action: dispatch_hooks
112
+ hooks_from_variable: before_hooks
113
+
114
+ # 4. Conformance + REPAIR loop (the delta spec is the anchor): check → REPORT gaps +
115
+ # ASK → Repair on approval → re-check; "Report and Skip" writes the report + stops.
116
+ # Bounded (3×). Delta docs live under changes/<open change>/.
117
+ - id: analyze_loop
118
+ action: loop
119
+ while: "{{analyze_ok}} != true"
120
+ max_iterations: 3
121
+ steps:
122
+ - id: analyze
123
+ action: agent_query
124
+ context:
125
+ - "{{feature_dir}}/changes/{{active_change}}/delta-spec.md"
126
+ - "{{feature_dir}}/changes/{{active_change}}/delta-design.md"
127
+ - "{{spec_file}}"
128
+ - "{{design_doc}}"
129
+ include_standards: true # the gate overlays (checklist) are in the standards
130
+ schema: { ok: true, gaps: [ { severity: "high", spec_ref: "<delta FR/BR/CN/DC/IC/US or overlay or —>", where: "<delta-design section>", gap: "<how it drifts>" } ] }
131
+ mock: { ok: true, gaps: [] }
132
+ task: |
133
+ delta-spec.md is the ANCHOR for this change. Check that delta-design.md
134
+ (in context) STRICTLY realises the delta spec (in context) and list EVERY
135
+ drift as a gap:
136
+ (1) every ADDED / MODIFIED delta-spec item — FR / BR / CN- / DC- / IC- /
137
+ user story — has a home in the delta design (an ADDED or MODIFIED design
138
+ element that serves it). A delta-spec item with no delta-design element is
139
+ a HIGH gap;
140
+ (2) every MODIFIED delta-design element names a REAL element that exists in
141
+ the master design.md (also in context) — you cannot MODIFY what the master
142
+ does not define (that would be an ADD). A dangling MODIFIED reference is a
143
+ HIGH gap;
144
+ (3) the delta design introduces NOTHING beyond the delta spec — any design
145
+ element with no delta-spec basis is a drift (unless logged as a delta DA-n);
146
+ (4) shared elements have ONE owning definition (no duplicate path=/element);
147
+ the layers stay coherent (Application→Domain, API→Application, Infra→ports)
148
+ and technology-agnostic;
149
+ (5) OVERLAY BACKSTOP — the domain gate checklist is loaded in the standards.
150
+ For each constraint it states (retention, immutability, append-only audit,
151
+ data-exposure, interop obligation, etc.) that this CHANGE touches, confirm
152
+ the delta realises it via a delta CN-/DC-/IC-. If the change touches such a
153
+ constraint but it is in NEITHER the delta spec nor the delta design, it is a
154
+ HIGH gap — set spec_ref to the overlay name and PREFIX the gap text with
155
+ "LIFT-FAILURE:" (re-run /aw-spec-orch specify to lift it into the delta spec; do
156
+ NOT fabricate it in the delta design).
157
+ (If delta-design.md is still the empty template, treat the WHOLE delta spec
158
+ as gaps.) Set ok=true ONLY when delta-design.md fully realises the delta spec
159
+ AND no touched checklist constraint is unaccounted for.
160
+ outputs:
161
+ - { name: analyze_ok, from: "$.ok" }
162
+ - { name: analyze_gaps, from: "$.gaps" }
163
+ - id: conform_break
164
+ action: break
165
+ condition: "{{analyze_ok}} == true"
166
+ - id: ask_repair
167
+ action: ask
168
+ prompt: |
169
+ analyze-delta-design found delta-spec↔delta-design gaps (the delta spec is the anchor):
170
+ {{analyze_gaps}}
171
+ Repair delta-design.md to conform to the delta spec now, or report the gaps and stop?
172
+ options: ["Repair", "Report and Skip"]
173
+ answer_var: repair_choice
174
+ - id: write_report
175
+ condition: "{{repair_choice}} == Report and Skip"
176
+ action: agent_author
177
+ context: ["{{feature_dir}}/changes/{{active_change}}/delta-design.md"]
178
+ include_standards: false
179
+ output_target: { type: file, path: "{{feature_dir}}/changes/{{active_change}}/delta-design-analyze-report.md" }
180
+ task: |
181
+ Write a Delta Design Analyze Report to the output from these
182
+ delta-spec↔delta-design conformance gaps (the delta spec is the ANCHOR; the
183
+ user chose to skip repair):
184
+ {{analyze_gaps}}
185
+ Markdown format:
186
+ - "# Delta Design Analyze Report — {{active_change}}" plus today's date.
187
+ - A verdict line: "verdict: GAPS ✗ · <n> gap(s)".
188
+ - "## Gaps" as a table: | # | severity | delta-spec ref | delta-design location | gap |.
189
+ - "## How to resolve": the delta spec is the anchor — update delta-design.md
190
+ to realise it for each gap (out of band; a "LIFT-FAILURE:" gap means re-run
191
+ /aw-spec-orch specify to lift the constraint into the delta spec), then re-run
192
+ /aw-spec-orch analyze-delta-design to clear the report.
193
+ Return the complete report markdown only.
194
+ - id: skip_break
195
+ action: break
196
+ condition: "{{repair_choice}} == Report and Skip"
197
+ - id: reconcile
198
+ action: agent_author
199
+ context:
200
+ - "{{feature_dir}}/changes/{{active_change}}/delta-spec.md"
201
+ - "{{feature_dir}}/changes/{{active_change}}/delta-design.md"
202
+ - "{{design_doc}}"
203
+ include_standards: false # rewrite-in-place: the delta spec anchors — NOT the overlays
204
+ output_target: { type: file, path: "{{feature_dir}}/changes/{{active_change}}/delta-design.md" }
205
+ task: |
206
+ delta-spec.md is the ANCHOR — update delta-design.md (in context) to REALISE
207
+ it, closing these gaps (the delta spec WINS every time):
208
+ {{analyze_gaps}}
209
+ - Add a delta-design element for each uncovered ADDED/MODIFIED delta-spec
210
+ FR/BR/CN/DC/IC/US, in the correct layer section, serving that spec id.
211
+ - Ensure every MODIFIED element names a REAL element from the master
212
+ design.md (in context); if the master does not define it, make it an ADDED
213
+ element instead.
214
+ - REMOVE, or move to a delta DA-n note, any delta-design element with no
215
+ delta-spec basis — never keep design that exceeds the delta spec.
216
+ - A "LIFT-FAILURE:" gap you CANNOT close — the constraint is not in the delta
217
+ spec, and you must NOT invent a domain rule it omits. Leave it open and add
218
+ a note "lift-failure: <constraint> — re-run /aw-spec-orch specify to lift it into
219
+ the delta spec". (The gate will stop and direct the user to cr.)
220
+ - Keep the technology-agnostic form (signatures + pre/post/invariant, field
221
+ shapes — NO code). Preserve every already-conformant section VERBATIM. Do
222
+ NOT change the delta spec or the master design.md.
223
+ Return the COMPLETE updated delta-design.md content only.
224
+
225
+ - id: analyze_gate
226
+ action: verify_context
227
+ require_true: analyze_ok
228
+ on_false: stop
229
+ on_false_message: "delta-design.md does not realise the delta spec (gaps: {{analyze_gaps}}) — repair was skipped (see changes/{{active_change}}/delta-design-analyze-report.md), or it could not be reconciled in 3 passes. A 'LIFT-FAILURE:' gap means a domain constraint from the gate checklist was never lifted into the delta spec — re-run /aw-spec-orch specify to add it (CN-/DC-/IC-). Otherwise fix out of band, or re-run and choose Repair."
230
+
231
+ # 5. Post-execution hooks.
232
+ - id: resolve_post_hooks
233
+ action: execute_script
234
+ script: { ref: actions }
235
+ subcommand: resolve-hooks
236
+ args: ["--phase", "after_analyze_cr"]
237
+ outputs:
238
+ - { name: after_hooks, from: "$.hooks" }
239
+ - id: dispatch_post_hooks
240
+ action: dispatch_hooks
241
+ hooks_from_variable: after_hooks
242
+
243
+ outputs:
244
+ feature_dir: "{{feature_dir}}"
245
+ cr_id: "{{active_change}}"
246
+ conformant: "{{analyze_ok}}"
247
+ gaps: "{{analyze_gaps}}"
248
+ next: "/aw-spec-orch implement-delta → build → finalize-delta → analyze-slice → close-delta (the delta design realises the delta spec; the change stays OPEN through finalize-delta's merge and analyze-slice's verification, and only close-delta archives it and bumps the version)"
@@ -0,0 +1,261 @@
1
+ # =============================================================================
2
+ # aw-spec-analyze-design (orchestrator) — the spec↔design conformance GATE
3
+ #
4
+ # The single, discrete conformance gate on the forward path:
5
+ # specify → design → analyze-design → implement.
6
+ # spec.md is the ANCHOR. Confirm design.md STRICTLY follows the spec (+ the domain
7
+ # gate overlays as a backstop); on drift, REPORT the gaps and ASK whether to repair,
8
+ # then UPDATE design.md to conform (spec wins). Design AUTHORS; this stage VALIDATES.
9
+ #
10
+ # BOOTSTRAP-ONLY, and it NEVER opens, merges or closes a change. It gates a feature
11
+ # whose spec.md + design.md ARE the masters. With a change OPEN the delta docs are the
12
+ # authoritative in-flight edit and the master pair must not be rewritten under them, so
13
+ # the run STOPS and routes to /aw-spec-orch analyze-delta-design (the delta's own gate).
14
+ # The change is closed by close-delta, the SINGLE cr-archive caller, and only after
15
+ # finalize-delta has merged the delta into the masters. Also runnable on demand to
16
+ # re-anchor a hand-edited spec — again, only when no change is open.
17
+ #
18
+ # Launch: /aw-spec-orch analyze-design [strategy]
19
+ # Prereq: /aw-spec-orch design (a spec.md + design.md for the active feature).
20
+ # =============================================================================
21
+
22
+ name: aw-spec-analyze-design
23
+ description: The spec↔design conformance gate — confirm design.md conforms to spec.md (spec is the anchor; domain overlays are a backstop) and, with approval, repair it. Bootstrap-only — with a change open it stops and routes to analyze-delta-design; it never closes a change.
24
+ version: 2.1.0
25
+ agent_agnostic: true
26
+ dialect: aw-spec.orchestrator/v1
27
+
28
+ scripts:
29
+ actions:
30
+ sh: .aw-spec/scripts/bash/aw-spec-actions.sh
31
+ ps1: .aw-spec/scripts/powershell/aw-spec-actions.ps1
32
+
33
+ vars:
34
+ analyze_ok: "false"
35
+ active_change: ""
36
+ has_change: "false"
37
+ version: ""
38
+ no_open_change: "true" # NOT has_change ⇒ the masters are authoritative ⇒ this gate applies
39
+
40
+ workflow:
41
+
42
+ # 1. Resolve the current feature + its spec; require the spec (the anchor).
43
+ - id: feature_paths
44
+ action: execute_script
45
+ on_error: continue # never crash raw on 'no feature set' — the gate below explains it
46
+ script: { ref: actions }
47
+ subcommand: feature-paths
48
+ outputs:
49
+ - { name: feature_dir, from: "$.feature_dir" }
50
+ - { name: spec_file, from: "$.spec_file" }
51
+ - { name: spec_exists, from: "$.spec_exists" }
52
+
53
+ - id: require_feature
54
+ action: verify_context
55
+ require_non_empty: feature_dir
56
+ on_empty: stop
57
+ on_empty_message: "No active feature. Run /aw-spec-orch select-feature first (pick or create the aggregate, e.g. Order), then re-run analyze-design."
58
+
59
+ - id: verify_spec
60
+ action: verify_context
61
+ require_true: spec_exists
62
+ on_false: stop
63
+ on_false_message: "No spec.md for the current feature. Run /aw-spec-orch specify (and design) first."
64
+
65
+ # 1b. Read the open change (opened by specify, or by design on a design-only change).
66
+ # has_change drives the BOOTSTRAP-ONLY guard below — it closes nothing.
67
+ - id: read_change
68
+ action: execute_script
69
+ script: { ref: actions }
70
+ subcommand: version-read
71
+ args: ["--feature-dir", "{{feature_dir}}"]
72
+ outputs:
73
+ - { name: active_change, from: "$.active_change" }
74
+ - { name: has_change, from: "$.has_change" }
75
+ - { name: version, from: "$.version" }
76
+
77
+ # 1c. BOOTSTRAP-ONLY GUARD. A change open ⇒ delta-spec/delta-design are the
78
+ # authoritative in-flight edit and this stage is the WRONG gate: its repair loop
79
+ # rewrites the MASTER design.md, which would drift the masters out from under the
80
+ # delta before finalize-delta merges it. Stop BEFORE any scaffold/authoring so the
81
+ # wrong-stage run has zero side effects, and route to the delta's own gate.
82
+ - id: flag_change_open
83
+ condition: "{{has_change}} == true"
84
+ action: set
85
+ vars: { no_open_change: "false" }
86
+
87
+ - id: require_no_change
88
+ action: verify_context
89
+ require_true: no_open_change
90
+ on_false: stop
91
+ on_false_message: "Change {{active_change}} is OPEN on this feature — analyze-design is the BOOTSTRAP gate and must not rewrite the master design.md while a delta is in flight. Gate the delta instead: /aw-spec-orch analyze-delta-design → implement-delta → build → finalize-delta (merges the delta into spec.md + design.md) → analyze-slice → close-delta (archives the change + bumps the version). Re-run analyze-design once the change is closed, to re-anchor the masters."
92
+
93
+ # 2. Ensure design.md exists (idempotent scaffold — returns the existing path, or
94
+ # a fresh template the repair loop will author to conform to the spec).
95
+ - id: design_scaffold
96
+ action: execute_script
97
+ script: { ref: actions }
98
+ subcommand: design-scaffold
99
+ args: ["--feature-dir", "{{feature_dir}}"]
100
+ outputs:
101
+ - { name: design_doc, from: "$.design_doc" }
102
+
103
+ # 2b. Load the domain GATE overlays (the comandrulemap `/aw-spec-gate` checklist) as
104
+ # the conformance checklist — VALIDATION input only, NEVER authoring. The analyze
105
+ # step sees them (include_standards: true); reconcile does NOT (design conforms to
106
+ # the SPEC, not to the overlays). Empty/no-op for a non-domain project.
107
+ - id: resolve_gate_overlays
108
+ action: execute_script
109
+ script: { ref: actions }
110
+ subcommand: resolve-domain
111
+ args: ["--command", "aw-spec-gate"]
112
+ outputs:
113
+ - { name: gate_overlays, from: "$.candidates" }
114
+ - id: load_gate_overlays
115
+ action: load_standards
116
+ files_from_variable: gate_overlays
117
+ optional: true
118
+
119
+ # 3. Pre-execution hooks.
120
+ - id: resolve_pre_hooks
121
+ action: execute_script
122
+ script: { ref: actions }
123
+ subcommand: resolve-hooks
124
+ args: ["--phase", "before_analyze"]
125
+ outputs:
126
+ - { name: before_hooks, from: "$.hooks" }
127
+ - id: dispatch_pre_hooks
128
+ action: dispatch_hooks
129
+ hooks_from_variable: before_hooks
130
+
131
+ # 4. Conformance + REPAIR loop (spec is the anchor): check → REPORT gaps + ASK →
132
+ # Repair on approval → re-check; "Report and Skip" writes design-analyze-report.md
133
+ # and stops. Bounded (3×).
134
+ - id: analyze_loop
135
+ action: loop
136
+ while: "{{analyze_ok}} != true"
137
+ max_iterations: 3
138
+ steps:
139
+ - id: analyze
140
+ action: agent_query
141
+ context: ["{{spec_file}}", "{{design_doc}}"]
142
+ include_standards: true # the gate overlays (checklist) are in the standards
143
+ schema: { ok: true, gaps: [ { severity: "high", spec_ref: "<FR/BR/CN/DC/IC/US/SC or overlay or —>", where: "<design section>", gap: "<how it drifts>" } ] }
144
+ mock: { ok: true, gaps: [] }
145
+ task: |
146
+ spec.md is the ANCHOR. Check that design.md (in context) STRICTLY follows
147
+ the spec (in context) and list EVERY drift as a gap:
148
+ (1) every spec item — FR / Business Rule / Constraint (CN-) / Data
149
+ Classification (DC-) / Integration Contract (IC-) / user story / success
150
+ criterion — has a design home (§6 Traceability complete). A lifted CN-/DC-/IC-
151
+ with no design row is a HIGH gap;
152
+ (2) the DOMAIN model matches the spec EXACTLY — entities/value objects are
153
+ the spec's Key Entities (same names), invariants are the spec's Business
154
+ Rules, and the boundary is the spec's Aggregate Boundary;
155
+ (3) NO design element exceeds or contradicts the spec — anything without a
156
+ spec basis is a drift unless already logged as a §7 DA-n assumption;
157
+ (4) the layers are coherent (Application→Domain, API→Application, Infra
158
+ implements the declared ports) and it stays high-level + technology-agnostic.
159
+ (5) OVERLAY BACKSTOP — the domain gate checklist is loaded in the standards.
160
+ For each constraint it states (retention, immutability, append-only audit,
161
+ data-exposure, interop obligation, etc.), confirm design.md realises it via a
162
+ spec CN-/DC-/IC-. If a checklist constraint is present in NEITHER the spec nor
163
+ the design, it is a HIGH gap — set spec_ref to the overlay name and PREFIX the
164
+ gap text with "LIFT-FAILURE:" (it was never lifted into the spec; the fix is
165
+ /aw-spec-orch specify, not design — do not fabricate it in the design).
166
+ (If design.md is still the empty template, treat the WHOLE spec as gaps.)
167
+ Set ok=true ONLY when design.md fully conforms to the spec AND no checklist
168
+ constraint is unaccounted for.
169
+ outputs:
170
+ - { name: analyze_ok, from: "$.ok" }
171
+ - { name: analyze_gaps, from: "$.gaps" }
172
+ - id: conform_break
173
+ action: break
174
+ condition: "{{analyze_ok}} == true"
175
+ - id: ask_repair
176
+ action: ask
177
+ prompt: |
178
+ Analyze found spec↔design gaps (spec.md is the anchor):
179
+ {{analyze_gaps}}
180
+ Repair design.md to conform to the spec now, or report the gaps and stop?
181
+ options: ["Repair", "Report and Skip"]
182
+ answer_var: repair_choice
183
+ - id: write_report
184
+ condition: "{{repair_choice}} == Report and Skip"
185
+ action: agent_author
186
+ context: ["{{design_doc}}"]
187
+ include_standards: false
188
+ output_target: { type: file, path: "{{feature_dir}}/design-analyze-report.md" }
189
+ task: |
190
+ Write a Design Analyze Report to the output from these spec↔design
191
+ conformance gaps (spec.md is the ANCHOR; the user chose to skip repair):
192
+ {{analyze_gaps}}
193
+ Markdown format:
194
+ - "# Design Analyze Report — <aggregate>" plus today's date.
195
+ - A verdict line: "verdict: GAPS ✗ · <n> gap(s)".
196
+ - "## Gaps" as a table: | # | severity | spec ref | design location | gap |.
197
+ - "## How to resolve": the spec is the anchor — update design.md to follow
198
+ the spec for each gap (out of band), then re-run /aw-spec-orch analyze-design
199
+ to clear the report.
200
+ Return the complete report markdown only.
201
+ - id: skip_break
202
+ action: break
203
+ condition: "{{repair_choice}} == Report and Skip"
204
+ - id: reconcile
205
+ action: agent_author
206
+ context: ["{{spec_file}}", "{{design_doc}}"]
207
+ include_standards: false # rewrite-in-place: spec anchors — NOT the overlays
208
+ output_target: { type: file, path: "{{design_doc}}" }
209
+ task: |
210
+ spec.md is the ANCHOR — update design.md (in context) to CONFORM to it,
211
+ closing these gaps (the spec WINS every time):
212
+ {{analyze_gaps}}
213
+ - Add a design home for each uncovered spec FR/BR/CN/DC/IC/US/SC (a lifted
214
+ CN-/DC-/IC- lands in §1 invariant · §4 persistence/§4.2 adapter · §5 row).
215
+ - Realign the DOMAIN model to the spec: entity/value-object names = the
216
+ spec's Key Entities, invariants = the spec's Business Rules, boundary =
217
+ the spec's Aggregate Boundary.
218
+ - REMOVE, or move to a §7 DA-n assumption, any design element with no spec
219
+ basis — never keep design that exceeds or contradicts the spec. EXCEPTION:
220
+ do NOT remove a cross-cutting element that is (or may be) mandated by the
221
+ technical constitution — it cites a principle as its basis ("per Const.
222
+ §<n>"), or it is standing technical/infrastructure machinery rather than
223
+ invented domain logic. MOVE such an element to a §7 DA-n citing the mandating
224
+ principle; removing it could violate the constitution. Reserve REMOVE for
225
+ genuine over-reach — invented domain entities/rules/behaviour the spec omits.
226
+ - A "LIFT-FAILURE:" gap you CANNOT close — the constraint is not in the spec,
227
+ and you must NOT invent a domain rule the spec omits. Leave it open and add a
228
+ §7 DA-n note "lift-failure: <constraint> — re-run /aw-spec-orch specify to lift
229
+ it into CN-/DC-/IC-". (The gate will stop and direct the user to specify.)
230
+ - Keep §6 Traceability in sync. Preserve every already-conformant section
231
+ VERBATIM. Do NOT change the spec.
232
+ Return the COMPLETE updated design.md content only.
233
+
234
+ - id: analyze_gate
235
+ action: verify_context
236
+ require_true: analyze_ok
237
+ on_false: stop
238
+ on_false_message: "design.md does not conform to the spec (gaps: {{analyze_gaps}}) — repair was skipped (see design-analyze-report.md), or it could not be reconciled in 3 passes. A 'LIFT-FAILURE:' gap means a domain constraint from the gate checklist was never lifted into the spec — re-run /aw-spec-orch specify to add it (CN-/DC-/IC-). Otherwise fix out of band, or re-run and choose Repair; resolve an ambiguous spec via /aw-spec-orch specify."
239
+
240
+ # (No change-close here by design — this stage only ever runs with NO change open,
241
+ # and cr-archive belongs to close-delta, which runs after finalize-delta's merge.)
242
+
243
+ # 5. Post-execution hooks.
244
+ - id: resolve_post_hooks
245
+ action: execute_script
246
+ script: { ref: actions }
247
+ subcommand: resolve-hooks
248
+ args: ["--phase", "after_analyze"]
249
+ outputs:
250
+ - { name: after_hooks, from: "$.hooks" }
251
+ - id: dispatch_post_hooks
252
+ action: dispatch_hooks
253
+ hooks_from_variable: after_hooks
254
+
255
+ outputs:
256
+ feature_dir: "{{feature_dir}}"
257
+ design_doc: "{{design_doc}}"
258
+ conformant: "{{analyze_ok}}"
259
+ gaps: "{{analyze_gaps}}"
260
+ version: "{{version}}"
261
+ next: "/aw-spec-orch implement (design conforms to the spec; version unchanged — this gate closes nothing)"