@surlymochan/evalid 0.0.0-stage → 0.4.1

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 (192) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/LICENSE +21 -0
  3. package/README.md +315 -2
  4. package/RELEASE_NOTES.md +124 -0
  5. package/atoms/registry.json +758 -0
  6. package/bin/xflow.js +7261 -0
  7. package/docs/adoption/README.md +128 -0
  8. package/docs/adoption/openflow-release-hardening.md +61 -0
  9. package/docs/benchmark-openflow-vs-gstack-superpowers-openspec-2026-05-25.md +81 -0
  10. package/docs/compatibility.md +52 -0
  11. package/docs/competitive-benchmark.md +108 -0
  12. package/docs/corps-operator-guide.md +75 -0
  13. package/docs/demo-proof.md +126 -0
  14. package/docs/examples-gallery.md +115 -0
  15. package/docs/fixtures/tracker-item.json +7 -0
  16. package/docs/goal-vs-codex.md +129 -0
  17. package/docs/gstack-comparison.md +88 -0
  18. package/docs/install-upgrade.md +133 -0
  19. package/docs/integrations.md +49 -0
  20. package/docs/launch-demo.md +123 -0
  21. package/docs/launch-dossier.md +180 -0
  22. package/docs/methodology.md +149 -0
  23. package/docs/npm-publish-handoff.md +96 -0
  24. package/docs/openspec-migration.md +106 -0
  25. package/docs/public-benchmark.md +68 -0
  26. package/docs/public-release.md +145 -0
  27. package/docs/quality-assessment.md +139 -0
  28. package/docs/quickstart.md +156 -0
  29. package/docs/reviewer-guide.md +43 -0
  30. package/docs/spec-kit-benchmark.md +73 -0
  31. package/docs/super-assistant-comparison.md +106 -0
  32. package/docs/superpowers-comparison.md +82 -0
  33. package/docs/team-adoption.md +123 -0
  34. package/docs/tooling-matrix.md +91 -0
  35. package/docs/walkthrough.md +76 -0
  36. package/docs/workflow-manual.md +1130 -0
  37. package/package.json +83 -4
  38. package/prompts/pencil-draft.md +46 -0
  39. package/prompts/pencil-refine.md +46 -0
  40. package/prompts/phase-artifact.md +24 -0
  41. package/prompts/phase-execution.md +32 -0
  42. package/schemas/competitor-reconstruction-contract.schema.json +91 -0
  43. package/schemas/llm-design-review-aggregate.schema.json +83 -0
  44. package/schemas/visual-benchmark.schema.json +978 -0
  45. package/schemas/workflow.schema.json +100 -0
  46. package/scripts/run-tests.mjs +23 -0
  47. package/scripts/takein_digest.py +139 -0
  48. package/specs/README.md +118 -0
  49. package/specs/architecture.md +36 -0
  50. package/specs/product.md +33 -0
  51. package/specs/workflow.md +349 -0
  52. package/src/agent_team/atoms/codex-app-bridge.js +8 -0
  53. package/src/agent_team/atoms/design/competitor-reconstruction-review.js +44 -0
  54. package/src/agent_team/atoms/design/contract-freeze.js +8 -0
  55. package/src/agent_team/atoms/design/generation-contract.js +442 -0
  56. package/src/agent_team/atoms/design/reconstruction-pack.js +246 -0
  57. package/src/agent_team/atoms/design/reference-surface-lock.js +49 -0
  58. package/src/agent_team/atoms/patch-challenge.js +19 -0
  59. package/src/agent_team/atoms/pencil/accept.js +9 -0
  60. package/src/agent_team/atoms/pencil/draft.js +365 -0
  61. package/src/agent_team/atoms/pencil/refine.js +229 -0
  62. package/src/agent_team/atoms/phase-run-dispatch.js +8 -0
  63. package/src/agent_team/atoms/team-run.js +380 -0
  64. package/src/agent_team/atoms/visual/aesthetic-review.js +231 -0
  65. package/src/agent_team/atoms/visual/benchmark-repair-plan.js +291 -0
  66. package/src/agent_team/atoms/visual/benchmark.js +1652 -0
  67. package/src/agent_team/atoms/visual/design-selection.js +23 -0
  68. package/src/agent_team/atoms/visual/direction-synthesis.js +124 -0
  69. package/src/agent_team/atoms/visual/dom-rect-export.js +129 -0
  70. package/src/agent_team/atoms/visual/image-diff.js +186 -0
  71. package/src/agent_team/atoms/visual/layout-competition.js +8 -0
  72. package/src/agent_team/atoms/visual/page-evidence-capture.js +806 -0
  73. package/src/agent_team/atoms/visual/playwright-runtime.js +8 -0
  74. package/src/agent_team/atoms/visual/review-aggregate.js +87 -0
  75. package/src/agent_team/atoms/visual/review.js +77 -0
  76. package/src/agent_team/atoms/visual/visual-report.js +197 -0
  77. package/src/agent_team/atoms/visual/visual-token-export.js +417 -0
  78. package/src/agent_team/common.js +311 -0
  79. package/src/core/atoms/agent-invoke.js +684 -0
  80. package/src/core/atoms/event/ingest.js +30 -0
  81. package/src/core/atoms/experience/digest.js +55 -0
  82. package/src/core/atoms/gate/artifact-verify.js +83 -0
  83. package/src/core/atoms/gate/competitor-contract-validate.js +119 -0
  84. package/src/core/atoms/gate/evidence-collect.js +64 -0
  85. package/src/core/atoms/gate/payload-from-phase-run.js +78 -0
  86. package/src/core/atoms/gate/visual-benchmark-validate.js +183 -0
  87. package/src/core/atoms/gate/workbench.js +79 -0
  88. package/src/core/atoms/intake/classify.js +15 -0
  89. package/src/core/atoms/intake/design-skill-select.js +16 -0
  90. package/src/core/atoms/intake/preview-or-refine.js +19 -0
  91. package/src/core/atoms/intake/recommend.js +20 -0
  92. package/src/core/atoms/intake/research-same-category.js +19 -0
  93. package/src/core/atoms/intervention/create.js +30 -0
  94. package/src/core/atoms/memory/manage.js +27 -0
  95. package/src/core/atoms/memory/mount.js +13 -0
  96. package/src/core/atoms/mission/create.js +19 -0
  97. package/src/core/atoms/mission/list.js +14 -0
  98. package/src/core/atoms/mission/show.js +26 -0
  99. package/src/core/atoms/notify/checkpoint.js +46 -0
  100. package/src/core/atoms/phase-run/complete.js +42 -0
  101. package/src/core/atoms/phase-run/fail.js +40 -0
  102. package/src/core/atoms/phase-run/persist.js +39 -0
  103. package/src/core/atoms/phase-run/start.js +30 -0
  104. package/src/core/atoms/plugin/run.js +76 -0
  105. package/src/core/atoms/policy/gate.js +90 -0
  106. package/src/core/atoms/policy/resolve.js +11 -0
  107. package/src/core/atoms/storage/sync.js +57 -0
  108. package/src/core/atoms/workflow/advance.js +25 -0
  109. package/src/core/atoms/workflow/guard.js +127 -0
  110. package/src/core/atoms/workflow/state-load.js +37 -0
  111. package/src/core/bindings.js +37 -0
  112. package/src/core/change-artifacts.js +134 -0
  113. package/src/core/competitive-score.js +265 -0
  114. package/src/core/concurrency-policy.js +35 -0
  115. package/src/core/execution-log.js +108 -0
  116. package/src/core/intake-recommendation.js +134 -0
  117. package/src/core/memory-state.js +62 -0
  118. package/src/core/mission-state.js +780 -0
  119. package/src/core/pending-gates.js +66 -0
  120. package/src/core/phase-cost.js +116 -0
  121. package/src/core/phase-run-read.js +27 -0
  122. package/src/core/policy-overlay.js +180 -0
  123. package/src/core/state-store.js +201 -0
  124. package/src/core/workflow-executor.js +1014 -0
  125. package/src/core/workflow-integrity.js +111 -0
  126. package/src/core/workflow-loader.js +163 -0
  127. package/src/core/workflow-rerun.js +84 -0
  128. package/src/core/workflow-state.js +119 -0
  129. package/src/server.js +1307 -0
  130. package/workflows/corps.yaml +481 -0
  131. package/workflows/yolo.yaml +241 -0
  132. package/xflow/README.md +76 -0
  133. package/xflow/aha/SKILL.md +82 -0
  134. package/xflow/aha/scripts/append_aha.py +50 -0
  135. package/xflow/archive/scripts/archive_change.py +338 -0
  136. package/xflow/archive/templates/merge-design.md +54 -0
  137. package/xflow/archive/templates/merge-workflow.md +26 -0
  138. package/xflow/atoms/__init__.py +6 -0
  139. package/xflow/atoms/a1_issue_create_or_patch.py +70 -0
  140. package/xflow/atoms/a2_branch_create_and_link.py +42 -0
  141. package/xflow/atoms/a3_repo_doctor.py +11 -0
  142. package/xflow/atoms/a4_project_set_status.py +11 -0
  143. package/xflow/atoms/a5_archive_commit_push_close.py +11 -0
  144. package/xflow/atoms/a6_pr_create.py +72 -0
  145. package/xflow/atoms/b1_change_scaffold.py +11 -0
  146. package/xflow/atoms/b2_status_read.py +16 -0
  147. package/xflow/atoms/b2b_status_write.py +20 -0
  148. package/xflow/atoms/b3_status_transition.py +27 -0
  149. package/xflow/atoms/b4_handoff_scaffold_or_refresh.py +11 -0
  150. package/xflow/atoms/b5_aha_append.py +11 -0
  151. package/xflow/atoms/b6_takein_digest.py +11 -0
  152. package/xflow/atoms/b6b_lookback_digest.py +11 -0
  153. package/xflow/atoms/b7_change_mission_bind.py +43 -0
  154. package/xflow/atoms/c1_mem.py +54 -0
  155. package/xflow/atoms/e6_gate_local_precheck.py +23 -0
  156. package/xflow/atoms/h1_design_lite_gate.py +74 -0
  157. package/xflow/atoms/i6a_tdd_run.py +107 -0
  158. package/xflow/atoms/i6b_tdd_proof_validate.py +184 -0
  159. package/xflow/atoms/i6c_tdd_quality_review.py +372 -0
  160. package/xflow/atoms/j1_tests_run.py +129 -0
  161. package/xflow/atoms/j4a_spec_consistency_structural.py +105 -0
  162. package/xflow/atoms/j4b_spec_delta_review.py +316 -0
  163. package/xflow/atoms/j4c_openspec_migration_map.py +121 -0
  164. package/xflow/atoms/j4d_spec_clarify_gate.py +373 -0
  165. package/xflow/atoms/j6_cr_review.py +443 -0
  166. package/xflow/atoms/k1_artifacts_complete_check.py +39 -0
  167. package/xflow/atoms/k2_merge_snippets_apply.py +11 -0
  168. package/xflow/atoms/k3_handoff_refresh.py +14 -0
  169. package/xflow/atoms/k4_mem_lesson_persist.py +65 -0
  170. package/xflow/atoms/k5_archive_publish.py +21 -0
  171. package/xflow/atoms/k6_aha_merge.py +42 -0
  172. package/xflow/atoms/tdd_lib.py +956 -0
  173. package/xflow/corps/SKILL.md +109 -0
  174. package/xflow/exec/scripts/set_issue_in_progress.py +159 -0
  175. package/xflow/goal/SKILL.md +150 -0
  176. package/xflow/handoff/SKILL.md +95 -0
  177. package/xflow/handoff/scripts/scaffold_handoff.py +304 -0
  178. package/xflow/lookback/SKILL.md +66 -0
  179. package/xflow/lookback/scripts/lookback_digest.py +46 -0
  180. package/xflow/openissue/scripts/open_issue_flow.py +438 -0
  181. package/xflow/plan/SKILL.md +47 -0
  182. package/xflow/ralph/SKILL.md +123 -0
  183. package/xflow/scripts/check_installed_xflow_skill_sync.sh +44 -0
  184. package/xflow/scripts/common.py +483 -0
  185. package/xflow/scripts/doctor.py +278 -0
  186. package/xflow/scripts/sync_installed_xflow_skill.sh +134 -0
  187. package/xflow/takein/SKILL.md +81 -0
  188. package/xflow/takein/scripts/takein_digest.py +88 -0
  189. package/xflow/yolo/SKILL.md +75 -0
  190. package/xflow/yolo/scripts/scaffold_specs_change.py +673 -0
  191. package/xflow/yolo/scripts/yolo_gate.py +312 -0
  192. package/xflow/yolo/templates/DESIGN.md +179 -0
@@ -0,0 +1,673 @@
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import json
4
+ from datetime import datetime, timezone
5
+ from pathlib import Path
6
+
7
+
8
+ PRODUCT_TEMPLATE = """# Product Spec
9
+
10
+ ## Purpose
11
+
12
+ - What the product exists to do.
13
+
14
+ ## Core User Journeys
15
+
16
+ - Primary journey:
17
+
18
+ ## Scope Boundaries
19
+
20
+ - In scope:
21
+ - Out of scope:
22
+
23
+ ## Accepted Behavior
24
+
25
+ - Durable product requirements land here after archive.
26
+ """
27
+
28
+
29
+ README_TEMPLATE = """# Specs
30
+
31
+ This directory is the single Superflow-owned root directory at the project root.
32
+
33
+ It has two layers:
34
+
35
+ - `specs/*.md` for durable project source-of-truth specs
36
+ - `specs/changes/<change-id>/` for per-change working artifacts
37
+
38
+ ## Layout
39
+
40
+ ```text
41
+ specs/
42
+ |-- README.md
43
+ |-- product.md
44
+ |-- architecture.md
45
+ |-- workflow.md
46
+ |-- ux.md # optional (or use DESIGN.md)
47
+ |-- DESIGN.md # optional design system
48
+ `-- changes/
49
+ `-- <change-id>/
50
+ |-- proposal.md
51
+ |-- plan.md
52
+ |-- findings.md # optional research notes for long or uncertain changes
53
+ |-- progress.md # optional rolling status for long-running changes
54
+ |-- status.json
55
+ |-- design.md # if frontend/UI change
56
+ |-- merge-product.md # optional
57
+ |-- merge-architecture.md
58
+ |-- merge-workflow.md # workflow / capability delta
59
+ |-- merge-ux.md
60
+ `-- merge-design.md # if design change
61
+ ```
62
+
63
+ ## Root specs vs change specs
64
+
65
+ Use root specs for durable truth:
66
+
67
+ - `product.md`
68
+ - product goals
69
+ - accepted behavior
70
+ - scope boundaries
71
+ - `architecture.md`
72
+ - system shape
73
+ - module boundaries
74
+ - technical invariants
75
+ - `workflow.md`
76
+ - delivery rules
77
+ - QA / review / release rules
78
+ - `ux.md` / `DESIGN.md`
79
+ - visual tone
80
+ - color system
81
+ - typography
82
+ - layout rules
83
+ - component patterns
84
+
85
+ Use `specs/changes/<change-id>/` for change-scoped work:
86
+
87
+ - proposal
88
+ - plan
89
+ - findings / progress for long-running or research-heavy work
90
+ - design reasoning (if UI)
91
+ - machine-readable state
92
+ - explicit archive merge snippets
93
+
94
+ `xflow:plan` only writes `plan.md`. It does not create `tasks.md`.
95
+
96
+ ## DESIGN.md
97
+
98
+ `DESIGN.md` is the canonical design system file.
99
+
100
+ It follows the format from Google Stitch / awesome-design-md.
101
+
102
+ Use it OR `specs/ux.md` — never both with overlapping content.
103
+
104
+ When a change involves UI:
105
+
106
+ 1. Check if `DESIGN.md` exists
107
+ 2. If not, create one from template
108
+ 3. Run design-check in yolo workflow
109
+ 4. Archive design decisions to Design Decisions Log
110
+
111
+ ## Archive rule
112
+
113
+ Do not treat `proposal.md`, `plan.md`, or `design.md` as automatic sources for root spec updates.
114
+
115
+ When a change produces durable truth, write the exact durable facts into explicit merge files:
116
+
117
+ - `merge-product.md`
118
+ - `merge-architecture.md`
119
+ - `merge-workflow.md` (workflow / capability delta)
120
+ - `merge-ux.md`
121
+ - `merge-design.md`
122
+
123
+ Archive should prefer these explicit merge files over trying to summarize large documents.
124
+
125
+ This is intentional:
126
+
127
+ - it reduces accidental deletion of older truth
128
+ - it reduces under-summary or over-summary of the current change
129
+ - it keeps the durable root specs stable and auditable
130
+
131
+ ## Status rule
132
+
133
+ `status.json` is the machine-readable state for the active change.
134
+
135
+ Use it to track:
136
+
137
+ - change type (backend | frontend | full-stack | infrastructure | docs)
138
+ - current stage
139
+ - verification state
140
+ - design alignment (if frontend)
141
+ - archival readiness
142
+ - next action
143
+
144
+ Do not use it as a replacement for the human-readable plan or proposal.
145
+ """
146
+
147
+
148
+ ARCHITECTURE_TEMPLATE = """# Architecture Spec
149
+
150
+ ## System Shape
151
+
152
+ - Major modules and boundaries.
153
+
154
+ ## Data Flow
155
+
156
+ - Main request / event / state flow.
157
+
158
+ ## Technical Constraints
159
+
160
+ - Durable invariants and constraints.
161
+
162
+ ## Notes
163
+
164
+ - Long-lived architecture decisions land here after archive.
165
+ """
166
+
167
+
168
+ WORKFLOW_TEMPLATE = """# Workflow Spec
169
+
170
+ ## Primary Flow
171
+
172
+ ```text
173
+ User Input
174
+ |
175
+ v
176
+ change-init
177
+ |
178
+ v
179
+ consistency-check
180
+ |
181
+ v
182
+ design-check (if frontend)
183
+ |
184
+ v
185
+ brainstorm (multiple-choice clarification)
186
+ |
187
+ v
188
+ proposal-freeze
189
+ |
190
+ v
191
+ plan (short confirmation)
192
+ |
193
+ v
194
+ tdd
195
+ |
196
+ v
197
+ execute
198
+ |
199
+ v
200
+ verify (adversarial + visual if UI)
201
+ |
202
+ v
203
+ archive
204
+ |
205
+ v
206
+ merge durable facts into root specs
207
+ ```
208
+
209
+ ## Rules
210
+
211
+ - Brainstorm uses multiple-choice clarification by default.
212
+ - Design-check runs for frontend/full-stack changes.
213
+ - Plan stays short enough to read fully before confirmation.
214
+ - TDD is the default execution method.
215
+ - Verify is separate from execute.
216
+ - Archive merges durable truth into root specs.
217
+ """
218
+
219
+
220
+ UX_TEMPLATE = """# UX Spec
221
+
222
+ > Note: This file is deprecated. Use DESIGN.md instead.
223
+ > DESIGN.md follows the Google Stitch / awesome-design-md format.
224
+ > If this file exists, migrate content to DESIGN.md and remove this file.
225
+
226
+ ## Legacy Content
227
+
228
+ Migrate the following to DESIGN.md:
229
+ - Visual tone → DESIGN.md Visual Tone
230
+ - Color system → DESIGN.md Color System
231
+ - Typography → DESIGN.md Typography
232
+ - Layout rules → DESIGN.md Layout & Spacing
233
+ - Component patterns → DESIGN.md Component Patterns
234
+ - Design decisions → DESIGN.md Design Decisions Log
235
+ """
236
+
237
+
238
+ DESIGN_TEMPLATE = """# Design System
239
+
240
+ > This file follows the DESIGN.md format from Google Stitch / awesome-design-md.
241
+ > AI agents read this to generate consistent UI.
242
+
243
+ ## Brand & Purpose
244
+
245
+ - Product: [what the product is]
246
+ - Audience: [who uses it]
247
+ - Core value: [one-line positioning]
248
+
249
+ ## Visual Tone
250
+
251
+ - Primary tone: [minimal | maximalist | brutalist | editorial | organic | luxury | playful | industrial | retro-futuristic | dark-mode-first]
252
+ - Secondary tone: [optional refinement]
253
+ - Reference brand: [optional, e.g., "similar to Linear"]
254
+
255
+ ## Color System
256
+
257
+ | Token | Value | Usage |
258
+ |-------|-------|-------|
259
+ | Background | | Primary page background |
260
+ | Surface | | Cards, panels, elevated surfaces |
261
+ | Primary | | Main brand color, key actions |
262
+ | Accent | | Highlights, links, focus states |
263
+ | Text | | Primary text content |
264
+ | Text Muted | | Secondary text, placeholders |
265
+ | Border | | Dividers, input borders |
266
+ | Success | | Positive states |
267
+ | Error | | Errors, destructive actions |
268
+ | Warning | | Caution states |
269
+
270
+ Define as CSS variables:
271
+
272
+ ```css
273
+ :root {
274
+ --color-background: ;
275
+ --color-surface: ;
276
+ --color-primary: ;
277
+ --color-accent: ;
278
+ --color-text: ;
279
+ --color-text-muted: ;
280
+ --color-border: ;
281
+ }
282
+ ```
283
+
284
+ ## Typography
285
+
286
+ | Role | Font | Weight | Size |
287
+ |------|------|--------|------|
288
+ | Display | | | |
289
+ | Heading | | | |
290
+ | Body | | | |
291
+ | Mono | | | |
292
+
293
+ ## Layout & Spacing
294
+
295
+ - Density: [dense | balanced | sparse]
296
+ - Max width: [e.g., 1200px]
297
+ - Spacing base: [4px | 8px]
298
+
299
+ ## Motion
300
+
301
+ - Animation level: [none | subtle | moderate | rich]
302
+ - Transition timing: [fast | normal | slow]
303
+
304
+ ## Visual Details
305
+
306
+ - Border radius: [sharp | soft | round]
307
+ - Shadow level: [none | subtle | moderate | strong]
308
+ - Icon style: [outline | solid | minimal]
309
+
310
+ ## Component Patterns
311
+
312
+ ### Buttons
313
+ - Primary:
314
+ - Secondary:
315
+ - Ghost:
316
+
317
+ ### Cards
318
+ - Border:
319
+ - Padding:
320
+ - Radius:
321
+
322
+ ### Inputs
323
+ - Border:
324
+ - Focus:
325
+
326
+ ### Navigation
327
+ - Style: [sidebar | topbar | tabs]
328
+
329
+ ## Best For
330
+
331
+ - Ideal use cases:
332
+ - Avoid:
333
+
334
+ ## Design Decisions Log
335
+
336
+ - [YYYY-MM-DD] [change-id]: [decision] — [reasoning]
337
+
338
+ ---
339
+
340
+ ## Quick Tone Reference
341
+
342
+ | Tone | Best For | Key Brands |
343
+ |------|----------|------------|
344
+ | Minimal Clean | Tools, dashboards | Linear, Vercel |
345
+ | Editorial Warm | Content, docs | Notion, Medium |
346
+ | Dark Cinematic | Media, AI tools | ElevenLabs, Cursor |
347
+ | Developer-First | Terminal, CLI | Ollama, Warp |
348
+ | Friendly Playful | Consumer apps | Lovable, Zapier |
349
+ | Enterprise Clean | B2B, infra | HashiCorp, MongoDB |
350
+ """
351
+
352
+
353
+ PROPOSAL_TEMPLATE = """# Proposal
354
+
355
+ ## Objective
356
+
357
+ -
358
+
359
+ ## Chosen Path
360
+
361
+ -
362
+
363
+ ## Rejected Paths
364
+
365
+ -
366
+
367
+ ## In Scope
368
+
369
+ -
370
+
371
+ ## Out of Scope
372
+
373
+ -
374
+
375
+ ## Acceptance Intent
376
+
377
+ -
378
+
379
+ ## Design Direction (if frontend)
380
+
381
+ - Visual tone:
382
+ - Key differentiator:
383
+ - Reference brand (if any):
384
+ """
385
+
386
+
387
+ DESIGN_CHANGE_TEMPLATE = """# Design Direction
388
+
389
+ > This file captures design decisions for this change.
390
+ > Merge key decisions into DESIGN.md Design Decisions Log during archive.
391
+
392
+ ## Visual Tone
393
+
394
+ - Chosen tone: [minimal | maximalist | brutalist | editorial | organic | luxury | playful | industrial | retro-futuristic | dark-mode-first]
395
+ - Reasoning:
396
+
397
+ ## Key Design Decisions
398
+
399
+ 1. [decision]: [reasoning]
400
+ 2. [decision]: [reasoning]
401
+
402
+ ## Colors (if changed)
403
+
404
+ - [color name]: [value] — [usage]
405
+
406
+ ## Typography (if changed)
407
+
408
+ - [font change]: [reasoning]
409
+
410
+ ## Components (if new)
411
+
412
+ - [component]: [style decision]
413
+
414
+ ## Reference
415
+
416
+ - Similar to: [brand reference if any]
417
+
418
+ ## Verification Checklist
419
+
420
+ - [ ] Matches DESIGN.md specifications
421
+ - [ ] Visual comparison done
422
+ - [ ] Design decisions documented for archive
423
+ """
424
+
425
+
426
+ PLAN_TEMPLATE = """# Plan
427
+
428
+ ## Target Outcome
429
+
430
+ -
431
+
432
+ ## Chosen Path
433
+
434
+ -
435
+
436
+ ## In Scope
437
+
438
+ -
439
+
440
+ ## Out of Scope
441
+
442
+ -
443
+
444
+ ## Task Slices
445
+
446
+ 1.
447
+ 2.
448
+ 3.
449
+
450
+ ## Verification Commands
451
+
452
+ ```bash
453
+ # Fill in the smallest proof commands
454
+ ```
455
+
456
+ ## Design Alignment (if frontend)
457
+
458
+ - Visual tone:
459
+ - Key specifications to verify:
460
+
461
+ ## Main Risk
462
+
463
+ -
464
+ """
465
+
466
+
467
+ FINDINGS_TEMPLATE = """# Findings
468
+
469
+ ## Questions Investigated
470
+
471
+ 1.
472
+ 2.
473
+ 3.
474
+
475
+ ## Evidence
476
+
477
+ - [ ] Evidence item
478
+
479
+ ## Interim Conclusions
480
+
481
+ -
482
+
483
+ ## Open Questions
484
+
485
+ -
486
+ """
487
+
488
+
489
+ PROGRESS_TEMPLATE = """# Progress
490
+
491
+ ## Current Focus
492
+
493
+ -
494
+
495
+ ## Completed
496
+
497
+ - [ ]
498
+
499
+ ## In Flight
500
+
501
+ - [ ]
502
+
503
+ ## Blockers
504
+
505
+ -
506
+ """
507
+
508
+
509
+ MERGE_WORKFLOW_TEMPLATE_PATH = Path(__file__).resolve().parents[2] / "archive" / "templates" / "merge-workflow.md"
510
+
511
+
512
+ def load_merge_workflow_template() -> str:
513
+ if MERGE_WORKFLOW_TEMPLATE_PATH.exists():
514
+ return MERGE_WORKFLOW_TEMPLATE_PATH.read_text(encoding="utf-8")
515
+ return """# Workflow Delta
516
+
517
+ ## Capability Delta
518
+
519
+ -
520
+
521
+ ## Behavior Changes
522
+
523
+ -
524
+
525
+ ## Constraints and Invariants
526
+
527
+ -
528
+
529
+ ## Migration Notes
530
+
531
+ -
532
+ """
533
+
534
+
535
+ TASKS_TEMPLATE = """# Tasks
536
+
537
+ - [ ] Slice 1
538
+ - [ ] Slice 2
539
+ - [ ] Slice 3
540
+ """
541
+
542
+
543
+ STATUS_TEMPLATE = {
544
+ "change_id": "",
545
+ "title": "",
546
+ "change_type": "backend",
547
+ "status": "draft",
548
+ "current_stage": "change-init",
549
+ "verification_status": "not_run",
550
+ "archival_status": "not_ready",
551
+ "design_aligned": "na",
552
+ "next_action": "Clarify the change through multiple-choice brainstorm.",
553
+ "updated_at": "",
554
+ }
555
+
556
+
557
+ def parse_args() -> argparse.Namespace:
558
+ parser = argparse.ArgumentParser(
559
+ description="Initialize root specs/ and scaffold a Superflow change workspace.",
560
+ )
561
+ parser.add_argument(
562
+ "--project-root",
563
+ default=".",
564
+ help="Project root where specs/ should be created.",
565
+ )
566
+ parser.add_argument(
567
+ "--change-id",
568
+ required=True,
569
+ help="Short stable change identifier, e.g. add-dark-mode.",
570
+ )
571
+ parser.add_argument(
572
+ "--title",
573
+ default=None,
574
+ help="Human-readable change title. Defaults to the change id.",
575
+ )
576
+ parser.add_argument(
577
+ "--change-type",
578
+ choices=["backend", "frontend", "full-stack", "infrastructure", "docs"],
579
+ default="backend",
580
+ help="Type of change. frontend/full-stack triggers design workflow.",
581
+ )
582
+ parser.add_argument(
583
+ "--with-ux",
584
+ action="store_true",
585
+ help="Also create specs/ux.md if it does not exist.",
586
+ )
587
+ parser.add_argument(
588
+ "--with-design",
589
+ action="store_true",
590
+ help="Also create DESIGN.md template if it does not exist.",
591
+ )
592
+ parser.add_argument(
593
+ "--with-findings",
594
+ action="store_true",
595
+ help="Also create findings.md for research-heavy or uncertain changes.",
596
+ )
597
+ parser.add_argument(
598
+ "--with-progress",
599
+ action="store_true",
600
+ help="Also create progress.md for long-running changes.",
601
+ )
602
+ parser.add_argument(
603
+ "--with-workflow-merge",
604
+ action="store_true",
605
+ help="Also create merge-workflow.md for workflow/capability deltas.",
606
+ )
607
+ return parser.parse_args()
608
+
609
+
610
+ def ensure_text(path: Path, content: str) -> None:
611
+ if not path.exists():
612
+ path.write_text(content, encoding="utf-8")
613
+
614
+
615
+ def main() -> int:
616
+ args = parse_args()
617
+ project_root = Path(args.project_root).expanduser().resolve()
618
+ specs_root = project_root / "specs"
619
+ changes_root = specs_root / "changes"
620
+ change_root = changes_root / args.change_id
621
+
622
+ specs_root.mkdir(parents=True, exist_ok=True)
623
+ changes_root.mkdir(parents=True, exist_ok=True)
624
+ change_root.mkdir(parents=True, exist_ok=True)
625
+
626
+ ensure_text(specs_root / "product.md", PRODUCT_TEMPLATE)
627
+ ensure_text(specs_root / "README.md", README_TEMPLATE)
628
+ ensure_text(specs_root / "architecture.md", ARCHITECTURE_TEMPLATE)
629
+ ensure_text(specs_root / "workflow.md", WORKFLOW_TEMPLATE)
630
+
631
+ if args.with_ux:
632
+ ensure_text(specs_root / "ux.md", UX_TEMPLATE)
633
+
634
+ if args.with_design:
635
+ ensure_text(project_root / "DESIGN.md", DESIGN_TEMPLATE)
636
+
637
+ ensure_text(change_root / "proposal.md", PROPOSAL_TEMPLATE)
638
+ ensure_text(change_root / "plan.md", PLAN_TEMPLATE)
639
+ if args.with_findings or args.change_type in ("frontend", "full-stack"):
640
+ ensure_text(change_root / "findings.md", FINDINGS_TEMPLATE)
641
+ if args.with_progress or args.change_type in ("frontend", "full-stack"):
642
+ ensure_text(change_root / "progress.md", PROGRESS_TEMPLATE)
643
+ ensure_text(change_root / "tasks.md", TASKS_TEMPLATE)
644
+ if args.with_workflow_merge or args.change_type in ("frontend", "full-stack"):
645
+ ensure_text(change_root / "merge-workflow.md", load_merge_workflow_template())
646
+
647
+ # Create design.md for frontend/full-stack changes
648
+ is_frontend = args.change_type in ("frontend", "full-stack")
649
+ if is_frontend:
650
+ ensure_text(change_root / "design.md", DESIGN_CHANGE_TEMPLATE)
651
+
652
+ status = dict(STATUS_TEMPLATE)
653
+ status["change_id"] = args.change_id
654
+ status["title"] = args.title or args.change_id
655
+ status["change_type"] = args.change_type
656
+ status["design_aligned"] = "na" if not is_frontend else "pending"
657
+ status["updated_at"] = datetime.now(timezone.utc).replace(microsecond=0).isoformat().replace("+00:00", "Z")
658
+
659
+ status_path = change_root / "status.json"
660
+ if not status_path.exists():
661
+ status_path.write_text(json.dumps(status, indent=2) + "\n", encoding="utf-8")
662
+
663
+ print(f"specs_root: {specs_root}")
664
+ print(f"change_root: {change_root}")
665
+ if is_frontend:
666
+ print(f"design.md created for frontend change")
667
+ if args.with_design:
668
+ print(f"DESIGN.md template created at project root")
669
+ return 0
670
+
671
+
672
+ if __name__ == "__main__":
673
+ raise SystemExit(main())