yadflow 1.0.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 (77) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/LICENSE +21 -0
  3. package/README.md +559 -0
  4. package/bin/sdlc.mjs +135 -0
  5. package/cli/commit.mjs +81 -0
  6. package/cli/epic-state.mjs +220 -0
  7. package/cli/gate.mjs +456 -0
  8. package/cli/lib.mjs +142 -0
  9. package/cli/manifest.mjs +119 -0
  10. package/cli/openpr.mjs +65 -0
  11. package/cli/plan.mjs +127 -0
  12. package/cli/platform.mjs +151 -0
  13. package/cli/reconcile.mjs +83 -0
  14. package/cli/repo.mjs +61 -0
  15. package/cli/setup.mjs +208 -0
  16. package/package.json +51 -0
  17. package/skills/sdlc/config.yaml +156 -0
  18. package/skills/sdlc/install.sh +51 -0
  19. package/skills/sdlc/module-help.csv +17 -0
  20. package/skills/sdlc-author-analysis/SKILL.md +136 -0
  21. package/skills/sdlc-author-architecture/SKILL.md +180 -0
  22. package/skills/sdlc-author-architecture/references/contract-format.md +72 -0
  23. package/skills/sdlc-author-epic/SKILL.md +154 -0
  24. package/skills/sdlc-author-epic/references/state-schema.md +187 -0
  25. package/skills/sdlc-author-stories/SKILL.md +109 -0
  26. package/skills/sdlc-author-stories/references/story-schema.md +46 -0
  27. package/skills/sdlc-author-ui/SKILL.md +113 -0
  28. package/skills/sdlc-backfill/SKILL.md +91 -0
  29. package/skills/sdlc-backfill/references/backfill.md +66 -0
  30. package/skills/sdlc-backfill/templates/checks/backfill-check.sh +42 -0
  31. package/skills/sdlc-checks/SKILL.md +138 -0
  32. package/skills/sdlc-checks/references/check-gates.md +168 -0
  33. package/skills/sdlc-checks/templates/checks/build-test-lint.sh +14 -0
  34. package/skills/sdlc-checks/templates/checks/contract-check.sh +62 -0
  35. package/skills/sdlc-checks/templates/checks/spec-link.sh +38 -0
  36. package/skills/sdlc-checks/templates/checks/verified-commits.sh +120 -0
  37. package/skills/sdlc-checks/templates/github/sdlc-checks.yml +45 -0
  38. package/skills/sdlc-checks/templates/github/sdlc-verified-commits.yml +22 -0
  39. package/skills/sdlc-checks/templates/gitlab/.gitlab-ci.yml +40 -0
  40. package/skills/sdlc-checks/templates/gitlab/gitlab-ci.include-root.yml +7 -0
  41. package/skills/sdlc-checks/templates/gitlab/sdlc-checks.gitlab-ci.yml +47 -0
  42. package/skills/sdlc-checks/templates/gitlab/sdlc-verified-commits.gitlab-ci.yml +21 -0
  43. package/skills/sdlc-connect-repos/SKILL.md +159 -0
  44. package/skills/sdlc-connect-repos/references/code-context.md +92 -0
  45. package/skills/sdlc-connect-repos/references/hub-config.md +77 -0
  46. package/skills/sdlc-connect-repos/references/repos-registry.md +62 -0
  47. package/skills/sdlc-hub-bridge/SKILL.md +119 -0
  48. package/skills/sdlc-hub-bridge/references/bridge.md +136 -0
  49. package/skills/sdlc-hub-bridge/references/login-roster.md +42 -0
  50. package/skills/sdlc-hub-bridge/templates/checks/hub-route.sh +50 -0
  51. package/skills/sdlc-hub-bridge/templates/github/sdlc-gate-sync.yml +63 -0
  52. package/skills/sdlc-hub-bridge/templates/gitlab/gitlab-ci.include-root.yml +7 -0
  53. package/skills/sdlc-hub-bridge/templates/gitlab/sdlc-gate-sync.gitlab-ci.yml +64 -0
  54. package/skills/sdlc-implement/SKILL.md +143 -0
  55. package/skills/sdlc-implement/references/implement-conventions.md +103 -0
  56. package/skills/sdlc-implement/templates/.gitmessage +17 -0
  57. package/skills/sdlc-pr-template/SKILL.md +86 -0
  58. package/skills/sdlc-pr-template/references/risk-routing.md +54 -0
  59. package/skills/sdlc-pr-template/templates/checks/risk-route.sh +44 -0
  60. package/skills/sdlc-pr-template/templates/github/pull_request_template.md +30 -0
  61. package/skills/sdlc-pr-template/templates/gitlab/merge_request_templates/Default.md +32 -0
  62. package/skills/sdlc-pr-template/templates/hub/github/pull_request_template.md +36 -0
  63. package/skills/sdlc-pr-template/templates/hub/gitlab/merge_request_templates/Default.md +37 -0
  64. package/skills/sdlc-review-comments/SKILL.md +63 -0
  65. package/skills/sdlc-review-comments/references/comment-conventions.md +55 -0
  66. package/skills/sdlc-review-comments/templates/github/REVIEW_COMMENTS.md +49 -0
  67. package/skills/sdlc-review-comments/templates/gitlab/REVIEW_COMMENTS.md +49 -0
  68. package/skills/sdlc-review-gate/SKILL.md +196 -0
  69. package/skills/sdlc-review-gate/references/gating.md +79 -0
  70. package/skills/sdlc-run/SKILL.md +109 -0
  71. package/skills/sdlc-run/references/run-loop.md +121 -0
  72. package/skills/sdlc-ship/SKILL.md +86 -0
  73. package/skills/sdlc-ship/references/ship-and-record.md +67 -0
  74. package/skills/sdlc-ship/templates/.coderabbit.yaml +19 -0
  75. package/skills/sdlc-spec/SKILL.md +119 -0
  76. package/skills/sdlc-spec/references/spec-handoff.md +101 -0
  77. package/skills/sdlc-status/SKILL.md +92 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,50 @@
1
+ # [1.1.0](https://github.com/abdelrahmannasr/sdlc-workflow/compare/v1.0.3...v1.1.0) (2026-06-09)
2
+
3
+
4
+ ### Features
5
+
6
+ * PR-driven review gate + build-helper CLI commands ([#30](https://github.com/abdelrahmannasr/sdlc-workflow/issues/30)) ([cc43319](https://github.com/abdelrahmannasr/sdlc-workflow/commit/cc4331903b2052b9835b0a6e3f21e148c809914c))
7
+
8
+ ## [1.0.3](https://github.com/abdelrahmannasr/sdlc-workflow/compare/v1.0.2...v1.0.3) (2026-06-08)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * install the missing analysis skill, and document the CLI + all 17 skills ([#29](https://github.com/abdelrahmannasr/sdlc-workflow/issues/29)) ([b968cbe](https://github.com/abdelrahmannasr/sdlc-workflow/commit/b968cbe0be0259746a332a10c5b79ffaf08a87be))
14
+
15
+ ## [1.0.2](https://github.com/abdelrahmannasr/sdlc-workflow/compare/v1.0.1...v1.0.2) (2026-06-08)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * drop @semantic-release/git so release works under branch protection ([#28](https://github.com/abdelrahmannasr/sdlc-workflow/issues/28)) ([4911773](https://github.com/abdelrahmannasr/sdlc-workflow/commit/491177359e6d2af291375884be3f86b3ac359f97))
21
+ * normalize package.json repository url ([#27](https://github.com/abdelrahmannasr/sdlc-workflow/issues/27)) ([1e8d93d](https://github.com/abdelrahmannasr/sdlc-workflow/commit/1e8d93d3c9cd5b89d3fa37f53cbfbe7f04126edb))
22
+
23
+ ## [1.0.1](https://github.com/abdelrahmannasr/sdlc-workflow/compare/v1.0.0...v1.0.1) (2026-06-08)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * read CLI version from package.json, not a hardcoded constant ([#26](https://github.com/abdelrahmannasr/sdlc-workflow/issues/26)) ([79a1e28](https://github.com/abdelrahmannasr/sdlc-workflow/commit/79a1e28d50d54e8b275d5f137ba456c7f4fcf76a))
29
+
30
+ # 1.0.0 (2026-06-08)
31
+
32
+
33
+ ### Features
34
+
35
+ * add optional analysis front step and per-step authoring branches ([#19](https://github.com/abdelrahmannasr/sdlc-workflow/issues/19)) ([5821506](https://github.com/abdelrahmannasr/sdlc-workflow/commit/5821506db6a51ae4dfa6fc30c89670d037c109b1))
36
+ * add PR/MR templates, commit/check conventions, and a PR/MR review bridge ([#18](https://github.com/abdelrahmannasr/sdlc-workflow/issues/18)) ([e2d4747](https://github.com/abdelrahmannasr/sdlc-workflow/commit/e2d4747752bfb6dd58a16862f719596504e8ebcb))
37
+ * add sdlc gated-SDLC BMAD module with team review gate ([12367bc](https://github.com/abdelrahmannasr/sdlc-workflow/commit/12367bc0a67d5f8b252f9fd40f4c973dba85bf55))
38
+ * add sdlc setup/update/check CLI ([884b506](https://github.com/abdelrahmannasr/sdlc-workflow/commit/884b506e9bef8d47017ccb8e0e89f61eaecb6bf9))
39
+ * add sdlc setup/update/check CLI ([#21](https://github.com/abdelrahmannasr/sdlc-workflow/issues/21)) ([7d83224](https://github.com/abdelrahmannasr/sdlc-workflow/commit/7d8322478757047c2c34e244deb149d6c5ada852))
40
+ * add sdlc-backfill — Phase 3 Step G (existing-code specs) + README build half ([add5db7](https://github.com/abdelrahmannasr/sdlc-workflow/commit/add5db77d158bfa83b9eb8c8370ab888db429ca1))
41
+ * add sdlc-checks — Phase 3 Step C check gates ([f603ee5](https://github.com/abdelrahmannasr/sdlc-workflow/commit/f603ee5f2089ba5b698381303484404aff39322c))
42
+ * add sdlc-implement — Phase 3 Step B dev/implement step ([6605540](https://github.com/abdelrahmannasr/sdlc-workflow/commit/6605540fa196de075b12088922f8394c2c67fced)), closes [#1](https://github.com/abdelrahmannasr/sdlc-workflow/issues/1)
43
+ * add sdlc-pr-template — Phase 3 Step D PR/MR templates + risk routing ([f3c16cc](https://github.com/abdelrahmannasr/sdlc-workflow/commit/f3c16ccfca1cd9bc48e6fd2e10fa35bd20c65599)), closes [hi#risk](https://github.com/hi/issues/risk)
44
+ * add sdlc-run — Phase 4a (make the automation dial real, trust log, earn checks) ([d2c1a09](https://github.com/abdelrahmannasr/sdlc-workflow/commit/d2c1a09974ebbcac0be4cb6693c658c7a5fff775))
45
+ * add sdlc-ship — Phase 3 Step E AI review, engineer review, ship ([2f4fa42](https://github.com/abdelrahmannasr/sdlc-workflow/commit/2f4fa4258bbe9e04b554f2384fec3515603e6304))
46
+ * add sdlc-spec — Phase 3 Step A Spec Kit handoff ([69d1ef7](https://github.com/abdelrahmannasr/sdlc-workflow/commit/69d1ef7072912577b285b970ebff906252d0cd3c))
47
+ * complete gated-SDLC front half (Phase 2) ([76a2678](https://github.com/abdelrahmannasr/sdlc-workflow/commit/76a26781d79f322eb2a02313a4a74d6a3316192f))
48
+ * connect code repos to the hub and make the front phases code-aware ([#17](https://github.com/abdelrahmannasr/sdlc-workflow/issues/17)) ([0d4e033](https://github.com/abdelrahmannasr/sdlc-workflow/commit/0d4e03347ae7a48abf45016b7d0c21909ea28408))
49
+ * Phase 4b Step D — earn the implement→check hand-off + spec/tasks trust hooks ([e0ef03e](https://github.com/abdelrahmannasr/sdlc-workflow/commit/e0ef03e8772184c7db2d2fb52ce8c053ab5b7823))
50
+ * Phase 5 instrumentation — nudge-cost + fleet roll-up in sdlc-status ([68e417a](https://github.com/abdelrahmannasr/sdlc-workflow/commit/68e417a8340f04205ef856e83925ce1357c7bdbe))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AbdelRahman Nasr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,559 @@
1
+ # Yadflow — the gated, team, multi-repo SDLC on top of BMAD
2
+
3
+ [![npm version](https://img.shields.io/npm/v/yadflow?logo=npm)](https://www.npmjs.com/package/yadflow)
4
+ [![CI](https://github.com/abdelrahmannasr/sdlc-workflow/actions/workflows/ci.yml/badge.svg)](https://github.com/abdelrahmannasr/sdlc-workflow/actions/workflows/ci.yml)
5
+ [![provenance](https://img.shields.io/badge/npm-provenance-blue?logo=npm)](https://docs.npmjs.com/generating-provenance-statements)
6
+
7
+ **Yadflow** (*yahd-flow* — from **يد**, Arabic for "hand") is the AI-driven SDLC where a human hand
8
+ moves every gate. *AI builds. The hand decides.* On npm as `yadflow`; the GitHub repo keeps its
9
+ historical `sdlc-workflow` name.
10
+
11
+ A custom BMAD module that turns BMAD from a solo tool into a **team, gated, file-driven SDLC
12
+ engine**. Every step does its work, writes its output to a file, and **waits at a gate**. Who
13
+ advances the gate (human now; machine later) is a per-step setting. All state lives in files —
14
+ nothing hidden, no database.
15
+
16
+ This repo is the **first deliverable** (see `docs/claude-code-build-plan.md` §10): verified research,
17
+ a scaffolded module that installs cleanly, and a working **team review gate** you run by hand.
18
+
19
+ ## The workflow at a glance
20
+
21
+ The whole lifecycle, from an empty project to shipped code. Setup is one-time; the **front half**
22
+ is human-gated and runs once per epic in the product hub; the **build half** runs once per story
23
+ per code repo; **automation** is opt-in and earned. `sdlc-status` reads it all; `sdlc-hub-bridge`
24
+ mirrors front-half reviews to real PR/MRs.
25
+
26
+ ```mermaid
27
+ flowchart TD
28
+ classDef gated fill:#fdebd0,stroke:#ca6f1e,color:#000
29
+ classDef earns fill:#d6eaf8,stroke:#2471a3,color:#000
30
+ classDef locked fill:#eaecee,stroke:#566573,color:#000,stroke-dasharray:5 3
31
+ classDef artifact fill:#fcf3cf,stroke:#b7950b,color:#000
32
+ classDef sentinel fill:#d5f5e3,stroke:#1e8449,color:#000
33
+
34
+ subgraph SETUP["0 · One-time setup (per project)"]
35
+ direction TB
36
+ inst["install.sh<br/>copy sdlc-* skills into IDE dirs"]
37
+ wire["wire each repo:<br/>sdlc-checks · sdlc-pr-template · sdlc-review-comments"]
38
+ conn["sdlc-connect-repos<br/>repos.json + cached code-map"]
39
+ phub["optional: hub on a platform<br/>detect-hub · roster"]
40
+ inst --> wire --> conn --> phub
41
+ end
42
+
43
+ subgraph FRONT["A · Front half — product hub · human-gated · once per epic"]
44
+ direction TB
45
+ an["sdlc-author-analysis<br/>optional → analysis.md"]:::artifact
46
+ ep["sdlc-author-epic<br/>epic.md · assigns EP-&lt;slug&gt;"]:::artifact
47
+ ar["sdlc-author-architecture<br/>architecture.md + locked contract.md"]:::artifact
48
+ ui["sdlc-author-ui<br/>ui-design.md + DESIGN.md"]:::artifact
49
+ st["sdlc-author-stories<br/>repo-tagged stories/EP-&lt;slug&gt;-S0N.md"]:::artifact
50
+ gAn{{"gate · analysis"}}:::gated
51
+ gEp{{"gate · epic<br/>base: owner + reviewer"}}:::gated
52
+ gAr{{"gate · architecture<br/>escalated: + repo domain owners"}}:::gated
53
+ gUi{{"gate · UI · base"}}:::gated
54
+ gSt{{"gate · stories<br/>per-repo domain owners"}}:::gated
55
+ rfb(["currentStep: ready-for-build"]):::sentinel
56
+ an --> gAn --> ep --> gEp --> ar --> gAr --> ui --> gUi --> st --> gSt --> rfb
57
+ end
58
+
59
+ subgraph BUILD["B · Build half — per story, per code repo"]
60
+ direction TB
61
+ sp["sdlc-spec<br/>Spec Kit ceremony → specs/&lt;story&gt;/"]
62
+ im["sdlc-implement<br/>1 task = 1 branch = 1 commit"]:::earns
63
+ ck["sdlc-checks<br/>spec-link · contract-check · build/test/lint"]:::earns
64
+ prm["open PR/MR + sdlc-pr-template route"]
65
+ shp["sdlc-ship<br/>AI review (advisory)"]
66
+ eng{{"engineer review<br/>human · never automated"}}:::locked
67
+ merged(["merge → build-log.json"]):::sentinel
68
+ sp --> im --> ck --> prm --> shp --> eng --> merged
69
+ end
70
+
71
+ subgraph AUTO["C · Automation — earned & reversible"]
72
+ direction TB
73
+ run["sdlc-run<br/>reads automation dial + trust-log.json"]:::earns
74
+ kill["kill switch → everything human_approve"]
75
+ run --- kill
76
+ end
77
+
78
+ phub --> an
79
+ rfb --> sp
80
+ run -. drives earned back steps .-> im
81
+ bridge["sdlc-hub-bridge<br/>review PR/MR ↔ file ledger"]:::gated
82
+ bridge -. syncs approvals .-> gEp
83
+ status["sdlc-status<br/>read-only view over all of it"]
84
+ status -. observes .-> FRONT
85
+ status -. observes .-> BUILD
86
+ ```
87
+
88
+ **Legend.** <span>🟨</span> **artifact** = an author step writes a file and stops; <span>🟧</span>
89
+ **gate** = a human review that must pass (`open → comment → approve → advance`); <span>🟦</span>
90
+ **earns automation** = a back step that can be set to `machine_advance` once it proves itself;
91
+ <span>⬜ dashed</span> **locked** = the engineer review and every front state, **permanently
92
+ human**. Detailed walkthroughs for each phase follow below.
93
+
94
+ ## What's here
95
+
96
+ | Path | What it is |
97
+ |------|-----------|
98
+ | `RESEARCH-NOTES.md` | Verified Phase 0 facts about BMAD, Spec Kit, Repomix, Impeccable + deviations. |
99
+ | `skills/sdlc/` | Module source of truth (`config.yaml`, `module-help.csv`, `install.sh`). Survives BMAD updates. |
100
+ | `bin/`, `cli/` | The `sdlc` setup/update CLI (published to npm as `yadflow`). |
101
+ | `skills/sdlc-author-analysis/` | Optional front state 1: pressure-test the idea with the analyst into `analysis.md` (skippable). |
102
+ | `skills/sdlc-author-epic/` | Front state 1: author an epic with AI assist, assign its `EP-<slug>` ID, seed state. |
103
+ | `skills/sdlc-author-architecture/` | Front state 3: author `architecture.md` + the locked `contract.md`; hash-lock the contract surface. |
104
+ | `skills/sdlc-author-ui/` | Front state 5: author `ui-design.md` + `DESIGN.md` (Impeccable slash-commands, or graceful fallback). |
105
+ | `skills/sdlc-author-stories/` | Front state 7: break the epic into repo-tagged stories with stable `EP-<slug>-S0N` IDs. |
106
+ | `skills/sdlc-connect-repos/` | Connect code repos to the hub (GitHub/GitLab, local-user auth); cache a Repomix pack + **code-map** per repo so the front phases are code-aware. |
107
+ | `skills/sdlc-review-gate/` | The reusable **team review + approve gate** (used for all four reviews). |
108
+ | `skills/sdlc-spec/` | Build Step A: run the Spec Kit ceremony once per story per repo → `specs/<story-id>/`. |
109
+ | `skills/sdlc-implement/` | Build Step B: implement ONE atomic task as a small diff on its own branch. |
110
+ | `skills/sdlc-checks/` | Build Step C: wire + run the CI gates (spec-link, contract-check, build/test/lint, verified-commits). |
111
+ | `skills/sdlc-pr-template/` | Build Step D: install the platform PR/MR template + risk routing (code repos **and** the hub). |
112
+ | `skills/sdlc-review-comments/` | Install platform-matched PR/MR review-comment scaffolds (code repos and the hub). |
113
+ | `skills/sdlc-hub-bridge/` | The templated PR/MR **review bridge**: open a review PR/MR on the hub and sync platform approvals/comments into the file ledger. |
114
+ | `skills/sdlc-ship/` | Build Step E: AI review (advisory) → engineer review → ship + record in the build log. |
115
+ | `skills/sdlc-backfill/` | Generate a human-verified spec for already-built code (Repomix), gated per touched feature. |
116
+ | `skills/sdlc-run/` | Phase 4 orchestrator: drive a story's back half on the `automation` dial; kill switch. |
117
+ | `skills/sdlc-status/` | Read-only view: front chain, build-half dials, trust record, fleet roll-up. |
118
+ | `epics/EP-istifta-inquiries/` | A worked demo epic run **end to end** (front half + build half + automation). |
119
+ | `demo-repos/` | Throwaway code repos for the build half (separate git repos; regenerable — see `demo-repos/README.md`). |
120
+ | `docs/` | The phased build plans (`phase-2`…`phase-5`) and the original workflow design. |
121
+ | [`CONTRIBUTING.md`](CONTRIBUTING.md) | Commit & PR/MR title convention (Conventional Commits, lowercase after the type). |
122
+
123
+ ## The `sdlc` CLI (install, update, reconcile)
124
+
125
+ The module ships a zero-dependency CLI, published to npm as
126
+ [`yadflow`](https://www.npmjs.com/package/yadflow). Run it
127
+ with `npx` from your **product hub** repo — no clone needed.
128
+
129
+ | Command | What it does |
130
+ |---------|--------------|
131
+ | `npx yadflow setup` | Guided first-run wizard (the steps below). |
132
+ | `npx yadflow check` | Read-only report: what is **missing** / **outdated** (drifted) / **stale** (code-context) vs the bundled manifest. |
133
+ | `npx yadflow check --fix` | Reconcile: fill what is missing **and** update what changed — touches nothing already correct. |
134
+ | `npx yadflow update` | Apply drift only (alias for `check --fix --scope=changed`). |
135
+ | `sdlc gate open <epic> <artifact>` | Open the front-half **review PR/MR** for an artifact and mark the step `in_review`. |
136
+ | `sdlc gate sync <epic> [artifact]` | Pull the PR/MR's reviews + comment threads into the file ledger; **auto-advance** the step when approvals are satisfied, all threads are resolved, and the PR is merged. |
137
+ | `sdlc gate comments <epic> [artifact]` | Fetch the unresolved review comments to address (then reply on the PR; reviewers resolve their threads). |
138
+ | `sdlc gate status <epic>` | Show each review step and its recorded approvals. |
139
+ | `sdlc gate ci [--branch <head>] [--pr <n>]` | The CI entry the hub workflow calls on review/merge events: derive the epic/artifact from the `review/EP-*` branch, run the same sync, and commit **only the ledger** to the hub default branch (sweep every open review PR when no `--branch`). |
140
+ | `sdlc commit --type <t> -m <subject>` | Commit by the SDLC convention — Conventional subject, `Task`/`Contract-Change`/`Co-Authored-By` trailers, atomic-file guard. |
141
+ | `sdlc open-pr [--repo <name>]` | Open a code-repo **task** PR/MR from the repo's platform template (build half). |
142
+ | `sdlc repo list` / `sdlc repo refresh [name]` | List connected repos as **fresh / stale**, and re-pack a stale one — staleness is now an explicit human decision, never an automatic skill side-effect. |
143
+ | `npx yadflow --version` | Print the installed CLI version. |
144
+
145
+ Flags: `--dir <path>` targets a project other than the cwd; `--force` re-copies unchanged files (or
146
+ bypasses the commit atomic guard). Commit flags: `--type`, `-m/--message`, `--task`, `--ai
147
+ <claude\|copilot\|cursor\|coderabbit\|none>`, `--contract-change`, `--dry-run`. `open-pr` flags:
148
+ `--repo`, `--risk <low\|medium\|high>`, `--contract-change`.
149
+
150
+ ### The PR-driven review gate
151
+
152
+ The front-half gate now rides the **PR/MR you open per step** (`sdlc gate open`). Reviewers approve and
153
+ comment on the platform; `sdlc gate sync` maps that state into the file ledger (`approvals.json`,
154
+ `comments.json`, `reviews/*.md`) — which stays the source of truth — and the step **auto-advances on
155
+ merge** once three things hold: the reviewer rule is satisfied (owner + 1 reviewer, plus a domain-owner
156
+ per touched repo on escalated steps), every comment thread is resolved, and the review PR/MR is merged.
157
+ The merge click is the human approval act, so front steps still never `machine_advance`. Approvals are
158
+ **revoked when the reviewed artifact actually changes** (re-hash), giving reviewers a fresh pass. With no
159
+ hub platform / no `gh`/`glab`, the gate degrades to file-only with no error.
160
+
161
+ **Event-driven sync.** Wire the hub once (`sdlc check --fix` installs `.github/workflows/sdlc-gate-sync.yml`,
162
+ or the GitLab fragment + schedule) and every **approval, change request, and merge** on a review PR/MR
163
+ triggers `sdlc gate ci` in the hub's own CI: the ledger updates land directly on the hub's default branch
164
+ — no manual `sdlc gate sync` needed (it stays valid as the fallback). CI never approves and never merges;
165
+ the human keeps the merge click. GitLab caveat: approvals are only picked up by the ~15-min scheduled
166
+ sweep (GitLab fires no pipeline on approval) — details in `skills/sdlc-hub-bridge/references/bridge.md`.
167
+ Concurrency caveat: on GitHub the workflow's `concurrency` group serializes runs repo-wide and every
168
+ sync re-reads the full platform state, so racing reviewer events lose nothing. Outside that group —
169
+ a manual `sdlc gate sync` racing CI, or GitLab pipelines — two simultaneous syncs serialize their
170
+ *commits* via the rebase retry but each works from the state it read at start, so the rarer of two
171
+ simultaneous advancements can be lost; the next event or scheduled sweep re-syncs and converges.
172
+
173
+ ### What `setup` walks you through (7 steps)
174
+
175
+ 1. **Preflight** — confirm the hub is a git repo (offers `git init`); check `git`/`node`/`npx`.
176
+ 2. **Install the module** — copy all 17 `sdlc-*` skills into the IDE skill dirs you pick
177
+ (`.claude/`, `.agents/`, `.zencoder/`, `.opencode/`) and register `_bmad/sdlc/`.
178
+ 3. **Hub platform & roster** — detect GitHub/GitLab from the remote; record reviewers → `.sdlc/hub.json`.
179
+ 4. **Connect code repos** — register each repo into `.sdlc/repos.json` and cache a Repomix pack.
180
+ 5. **Wire each repo** — CI gates, PR/MR template, and review-comment scaffold.
181
+ 6. **AI review** — optionally write `.coderabbit.yaml`.
182
+ 7. **Done** — stamp `.sdlc/cli-version.json` and hand off the AI-only steps (code-maps; first epic).
183
+
184
+ The deterministic file work runs automatically; the AI-only steps are handed to the Claude Code skills
185
+ with a printed next-action. Re-run `… check --fix` any time the workflow updates — it never re-asks for
186
+ input you already gave.
187
+
188
+ **Releases:** automated via semantic-release on merge to `main` (Conventional Commits → npm, with
189
+ provenance). See [`RELEASING.md`](RELEASING.md).
190
+
191
+ **Maintainers / no-CLI fallback:** the underlying copy is still a single script —
192
+ `bash skills/sdlc/install.sh` — which the CLI's install step is a port of. The **source** stays in
193
+ `skills/`, which a `bmad-method` update does not touch, so after any BMAD update just re-run the CLI
194
+ (`… check --fix`) or the script.
195
+
196
+ > **Releases are automated.** A `feat:`/`fix:` commit merged to `main` triggers
197
+ > [semantic-release](https://semantic-release.gitbook.io/): it computes the version from the
198
+ > [Conventional Commits](CONTRIBUTING.md), publishes to npm with build provenance (tokenless OIDC),
199
+ > ships the `CHANGELOG.md` in the tarball, and cuts a GitHub release. No manual `npm publish`. See
200
+ > [`RELEASING.md`](RELEASING.md).
201
+
202
+ ## Agent skills (all 17)
203
+
204
+ The CLI **installs and wires** the module; the skills below are the **agents you invoke by name** in your
205
+ AI IDE (e.g. *“run `sdlc-author-epic`”*) to actually do the work. State lives in files you can also edit
206
+ directly. Each skill stops at a gate and never auto-advances unless a step has *earned* automation.
207
+
208
+ ### Setup & code-awareness
209
+
210
+ - **`sdlc-connect-repos`** — Connects code repos to the product hub so the front/"brain" phases are
211
+ code-aware. Registers N code repos (GitHub or GitLab, local-user auth, no stored tokens) into
212
+ `.sdlc/repos.json`, then caches an AI-readable picture of each — a compressed Repomix pack and a
213
+ lightweight code-map (existing endpoints/events/data-models/modules), secret-scanned. Idempotent and
214
+ refreshable; staleness tracked by HEAD sha.
215
+
216
+ ### Front half — author the "thinking" (once per epic, human-gated)
217
+
218
+ - **`sdlc-author-analysis`** — *Optional* front state 1. With the analyst, pressure-test a feature idea
219
+ and write the discovery brief into `analysis.md`. Assigns the `EP-<slug>` ID and seeds `.sdlc/` state
220
+ (the 10-step chain that puts analysis before epic). If skipped, the epic step does this shaping inline.
221
+ - **`sdlc-author-epic`** — The epic front state. Shape the idea with the analyst (or read `analysis.md`
222
+ when it already ran), then write the epic with the pm into `epic.md`. The entry point when analysis is
223
+ skipped: assigns the `EP-<slug>` ID and seeds `.sdlc/` state.
224
+ - **`sdlc-author-architecture`** — Front state 3. With the architect, author `architecture.md` and the
225
+ locked `contract.md` (the shared cross-repo surface), then hash-lock the contract surface into
226
+ `.sdlc/contract-lock.json`. Reads `epic.md`; escalates on the contract risk tag.
227
+ - **`sdlc-author-ui`** — Front state 5. With the ux-designer, author `ui-design.md` and `DESIGN.md`,
228
+ driving Impeccable as harness slash-commands (document/extract/craft) when installed, or authoring
229
+ directly when not. Reads epic + architecture.
230
+ - **`sdlc-author-stories`** — Front state 7. With the pm, break the approved epic into user stories, each
231
+ tagged with the repos that must implement it. Assigns zero-padded `EP-<slug>-S0N` IDs, one file per
232
+ story under `stories/`. Reads epic + architecture + contract + UI.
233
+
234
+ ### The review gate (cross-cutting — used by every review)
235
+
236
+ - **`sdlc-review-gate`** — The reusable team review + approve gate. Shares an authored artifact, records
237
+ reviewer comments and approvals as files, enforces the **owner + 1 reviewer** rule (escalating to
238
+ domain owners on contract/auth/payments), and advances the epic state **only** when approval is
239
+ recorded.
240
+ - **`sdlc-hub-bridge`** — The templated PR/MR bridge for the front-half gate. When the hub has a platform
241
+ (`.sdlc/hub.json`), it opens a review PR/MR per artifact, sets the required reviewers/labels, and
242
+ provides the read-only `gh`/`glab` recipes that sync platform comments + approvals back into the file
243
+ ledger. The file ledger stays the source of truth; degrades to a file-only gate with no platform.
244
+ - **`sdlc-review-comments`** — Installs platform-matched PR/MR review-comment scaffolds so reviewers
245
+ leave structured, attributable feedback that maps cleanly into the file ledger.
246
+
247
+ ### Build half — turn stories into shipped code (once per story, per repo)
248
+
249
+ - **`sdlc-spec`** — Step A. For one ready-for-build story and one of its repos, run the Spec Kit ceremony
250
+ once (specify → clarify → plan → analyze → checklist → tasks) → `specs/<story-id>/`. Drives `/speckit.*`
251
+ when installed; references the locked contract — never re-invents the surface.
252
+ - **`sdlc-implement`** — Step B. With the dev lens, implement **one** atomic task as a small diff
253
+ (≤3 files) on its own branch. The diff stays inside the files the task declared (flag and STOP if it
254
+ would grow). Commit ends with the task ID; `Contract-Change: yes` only if it touches the locked
255
+ contract surface.
256
+ - **`sdlc-checks`** — Step C, the production-safety gates. Wire and run three CI gates: **spec-link**
257
+ (every change links a real story/spec), **contract-check** (a contract-surface diff without a
258
+ re-locked contract FAILS), and **build/test/lint**. CI-agnostic bash for GitHub Actions and GitLab CI.
259
+ - **`sdlc-pr-template`** — Step D. Detect the repo's platform and commit the matching PR/MR template with
260
+ an Impact & Risk block; high risk (or a contract/auth/payments surface) routes the review to domain
261
+ owners. Includes `risk-route.sh`.
262
+ - **`sdlc-ship`** — Step E. AI review (CodeRabbit, advisory) → engineer review (the human gate, owner +
263
+ 1 reviewer with the same escalation) → on merge, record the ship in the epic build-log and update the
264
+ story state so the epic → story → task → PR chain stays traceable.
265
+ - **`sdlc-backfill`** — Step G. Generate specs for already-built features in an existing repo so new work
266
+ doesn't break them: pack one feature at a time with Repomix, write a DRAFT spec, require human approval
267
+ before it counts. A change is blocked only until the features it touches have approved specs.
268
+
269
+ ### Automation & status
270
+
271
+ - **`sdlc-run`** — The Phase 4 orchestrator. Drives a story's back-half loop (spec → tasks → implement →
272
+ checks) on each step's automation dial, recording every run in the trust log. A clean `checks` pass
273
+ auto-advances to engineer-review; any failure, scope overrun, or contract-surface touch HALTS for a
274
+ human. Also sets a step's dial (gated by trust evidence) and flips the system-wide kill switch.
275
+ - **`sdlc-status`** — Read-only view of an epic: the current step, each step's dials (assistance/
276
+ automation) and status, which approvals are still required, per-story back-half trust records, the
277
+ kill-switch state, and a fleet roll-up across epics.
278
+
279
+ ## The two dials (per step, build plan §2)
280
+
281
+ - **assistance:** `none` | `review` | `heavy` — how much AI helps.
282
+ - **automation:** `human_approve` | `machine_advance` — who advances the step.
283
+
284
+ Defaults: every step starts `human_approve`. The four **front** authoring steps (epic, architecture,
285
+ UI, stories) and their reviews are **locked** — they may not be set to `machine_advance` in this
286
+ version. A front state advances only on a **human act** — recording an approval and `advance`, or
287
+ merging the approved, fully-resolved review PR — never on a machine.
288
+
289
+ As of **Phase 4a** the `automation` dial is no longer inert: the orchestrator `sdlc-run` reads it and,
290
+ for the safe **back** steps, advances on its own when a step is set to `machine_advance` (and has
291
+ *earned* it — see "Run the back half on the dial" below). The engineer review and all four front
292
+ states stay `human_approve` forever.
293
+
294
+ ## Using the workflow end to end (all the steps, in order)
295
+
296
+ This is the full path from nothing to shipped code. Each numbered step names the skill to invoke; the
297
+ detailed sections below expand every phase. Invoke a skill by name in your agent/IDE (e.g. *“run
298
+ `sdlc-author-epic`”*); state lives in files you can also edit directly.
299
+
300
+ ### 0 — One-time setup
301
+
302
+ > **Shortcut:** `npx yadflow setup` walks through steps 1, 4, 5 and 6 below
303
+ > interactively (module install, hub detect + roster, connect repos, wire each repo). Run
304
+ > `… check --fix` any time afterwards to reconcile. The manual steps below are the long-hand
305
+ > equivalent and still work.
306
+
307
+ 1. **Install the module:** `bash skills/sdlc/install.sh` (re-run after any BMAD update).
308
+ 2. **Have your code repo(s).** They are **separate git repos** (one `.git` each). For the demo they
309
+ live under `demo-repos/<repo>/` — regenerate from `demo-repos/README.md`.
310
+ 3. **Optional tools** (the workflow degrades gracefully and records it if any are absent): **Spec Kit**
311
+ (`/speckit.*`), **Impeccable** (`/impeccable …`), **Repomix** (`npx repomix`, used by
312
+ `sdlc-connect-repos` and `sdlc-backfill`), **CodeRabbit** (advisory AI review).
313
+ 4. **Wire each code repo once:** `sdlc-checks repo:<repo> action: wire` (installs the CI gates —
314
+ *merges* with any existing CI, never clobbers), `sdlc-pr-template repo:<repo> action: wire` (PR/MR
315
+ template + risk routing), `sdlc-review-comments repo:<repo> action: wire` (review-comment scaffold).
316
+ 5. **Connect each code repo to the hub** (so the front phases see what's already built):
317
+ `sdlc-connect-repos action: connect repo:<repo> path:<path-or-git_url> domain_owner:<who>`. It
318
+ registers the repo in `.sdlc/repos.json` and caches a Repomix pack + a lightweight **code-map**
319
+ (existing endpoints/events/data-models/modules, secret-scanned). Clones/fetches as the **local user**
320
+ (SSH or credential helper; GitHub or GitLab; no stored tokens). Re-run for any new repo. Freshness is a
321
+ **human decision**: `sdlc repo list` shows fresh/stale, `sdlc repo refresh [name]` re-packs a moved repo
322
+ (skills flag staleness and point here — they never silently re-pack). Greenfield → skip it.
323
+ 6. **(Optional) Put the hub on a platform** so the front-half review runs through real PRs:
324
+ `sdlc-connect-repos action: detect-hub`, then `action: roster` once per reviewer (login → SDLC
325
+ name + role), and `sdlc-pr-template repo:hub action: wire` / `sdlc-review-comments repo:hub action:
326
+ wire` / `sdlc-checks repo:hub action: wire`. With no hub platform the front gate just runs file-only.
327
+ 7. **Conventions:** commits and PR/MR titles follow Conventional Commits (lowercase after the type), the
328
+ human author owns each commit with an optional per-commit `Co-Authored-By` AI trailer — see
329
+ [`CONTRIBUTING.md`](CONTRIBUTING.md).
330
+
331
+ ### A — Front half (human-authored, once per epic)
332
+ Each author step writes its artifact, sets itself `done`, moves `currentStep` to its review, and
333
+ **stops at the gate**. Run every gate with **`sdlc-review-gate`** — or, when the hub is on a platform,
334
+ drive it deterministically with the **`sdlc gate`** CLI (`open → sync → … → merge`): the review rides
335
+ the per-step PR/MR and the step **auto-advances on merge** once approvals are satisfied and all comment
336
+ threads are resolved. Details: **“Run the full front half by hand”** below.
337
+
338
+ 6. `sdlc-author-epic` → `epic.md` (assigns `EP-<slug>`, seeds state) → review (base rule).
339
+ 7. `sdlc-author-architecture` → `architecture.md` + locked `contract.md` → review (**escalated**: contract).
340
+ 8. `sdlc-author-ui` → `ui-design.md` + `DESIGN.md` → review (base rule).
341
+ 9. `sdlc-author-stories` → repo-tagged `stories/EP-<slug>-S0N.md` → review (**per-repo**).
342
+ → `state.json` reaches `currentStep: ready-for-build`.
343
+
344
+ ### B — Build half (per story, per repo)
345
+ From a `ready-for-build` story, for **each** repo the story is tagged with. Details: **“Run the full
346
+ build half by hand”** below.
347
+
348
+ 10. `sdlc-spec story:<id> repo:<repo>` → writes `specs/<story-id>/` (spec/plan/tasks + `link.md`).
349
+ 11. `sdlc-implement story:<id> repo:<repo> task:<T0N>` → one atomic task = one branch = one commit
350
+ (repeat per task). Commit by convention with **`sdlc commit --type <t> -m <subject> [--ai <tool>]`**
351
+ (Task/Contract-Change/Co-Authored-By trailers, atomic-file guard).
352
+ 12. `sdlc-checks repo:<repo> action: run` → spec-link, contract-check, build/test/lint, and
353
+ verified-commits (platform-Verified signature + roster-allowlisted author) must pass.
354
+ 13. Open the PR/MR from the wired template with **`sdlc open-pr --repo <repo> [--risk <level>]`**;
355
+ `sdlc-pr-template repo:<repo> action: route` prints the required reviewers from the Impact & Risk block.
356
+ 14. `sdlc-ship` → `ai-review` (advisory) → `approve` (the human engineer gate) → `ship` (merge, record
357
+ in `build-log.json`, update story status to `in-build`/`shipped`).
358
+ - **Multi-repo:** repeat 10–14 in each repo, all from the **one** locked contract.
359
+ - **Existing code:** `sdlc-backfill` first, to produce a human-verified spec for a built feature.
360
+
361
+ ### C — Automation (optional, earned over time)
362
+ 15. After a back step accumulates trust evidence, earn it:
363
+ `sdlc-run action: set-dial step:<step> to: machine_advance` (refused if evidence is short or for a
364
+ front state / the engineer review).
365
+ 16. Drive a story's back half on the dials: `sdlc-run story:<id> repo:<repo>` — it auto-advances
366
+ earned steps and stops for a human otherwise, always halting at the engineer review.
367
+ 17. **Kill switch any time:** `sdlc-run action: kill` (everything → manual) / `action: unkill`.
368
+ Details: **“Run the back half on the dial”** below.
369
+
370
+ ### Any time
371
+ - **`sdlc-status [EP-<slug>]`** — read-only: the front chain, each build step's dial + status, the
372
+ trust record, and (across epics) the fleet roll-up. Start here to see what's blocking.
373
+
374
+ ## Run the full front half by hand
375
+
376
+ The front half walks **epic → review → architecture+contract → review → UI design → review → stories
377
+ → review → `ready-for-build`**. It is all files under `epics/EP-<slug>/`. The skills below guide you,
378
+ but you can also edit the files directly — that's the point.
379
+
380
+ Each authoring step is the same shape: an author skill produces an artifact, sets its step `done`,
381
+ moves `currentStep` to the matching review, and **stops at the gate**. Then **`sdlc-review-gate`**
382
+ (one gate, reused for all four reviews) takes `open → comment → approve → advance`. When the hub is on a
383
+ platform, the **`sdlc gate`** CLI runs that gate over a real PR/MR — `open` raises the review PR, `sync`
384
+ pulls approvals + comment threads into the ledger, and the step **auto-advances when the approved,
385
+ fully-resolved PR is merged** (the merge is the human approval act).
386
+
387
+ **Code-aware (when repos are connected).** If you ran `sdlc-connect-repos` in setup, each author step
388
+ first loads the connected repos' **code-maps** (from `.sdlc/code-context/<repo>/`) so it considers what
389
+ already exists: the epic references existing behaviour, **the architecture cross-checks the contract
390
+ surface against existing endpoints/events/entities before hash-locking it**, the UI reuses existing
391
+ components, and stories anchor to real modules. Each artifact stamps what it read in its `code-context:`
392
+ frontmatter; a repo that has moved since connect triggers a staleness warning — the step **flags it and
393
+ stops**, pointing you at `sdlc repo refresh <repo>` (refreshing is a human decision, never an automatic
394
+ side-effect). With no repos connected the steps proceed exactly as before (greenfield-safe).
395
+
396
+ ### Author steps
397
+ 1. **`sdlc-author-epic`** (state 1) → `epic.md`; assigns the stable `EP-<slug>` ID; seeds
398
+ `.sdlc/state.json` (all `human_approve`, front steps locked) + empty `.sdlc/approvals.json`.
399
+ 2. **`sdlc-author-architecture`** (state 3) → `architecture.md` + the locked `contract.md`; writes the
400
+ contract-surface SHA-256 to `.sdlc/contract-lock.json`.
401
+ 3. **`sdlc-author-ui`** (state 5) → `ui-design.md` + `DESIGN.md` (drives Impeccable
402
+ `document|extract|craft` slash-commands when installed; otherwise authors directly).
403
+ 4. **`sdlc-author-stories`** (state 7) → one file per story `stories/EP-<slug>-S0N.md`, each tagged
404
+ with the `repos` it implements.
405
+
406
+ ### The one gate (every review)
407
+
408
+ Every review is the same loop — author writes, reviewers comment (which never advances), approvals
409
+ accumulate, and the step moves forward only when the rule is met. **File-only** ends in an explicit
410
+ `advance`; **PR-driven** (hub on a platform) ends when the approved, fully-resolved review PR is
411
+ **merged**:
412
+
413
+ ```mermaid
414
+ flowchart LR
415
+ a["author writes<br/>artifact"] --> o["open<br/>raise review PR/MR"]
416
+ o --> c["comment<br/>reviewers leave notes"]
417
+ c -->|owner addresses,<br/>edits in place| c
418
+ c --> ap["approve<br/>+ resolve threads"]
419
+ ap --> adv{"rule met,<br/>threads resolved,<br/>merged?"}
420
+ adv -->|no — names who's missing| o
421
+ adv -->|yes| nxt(["next step"])
422
+ ```
423
+
424
+ **File-only** — invoke **`sdlc-review-gate`** with `open` (present the artifact; reviewers comment in
425
+ `reviews/<artifact>--<date>--comments.md`), `approve` (name + role → `.sdlc/approvals.json`), and
426
+ `advance` (moves **only if** the rule is satisfied, else it names the missing approval).
427
+
428
+ **PR-driven** — when the hub is on a platform, the **`sdlc gate`** CLI runs the same gate over a PR/MR:
429
+ - `sdlc gate open <epic> <artifact>` — raise the review PR/MR; mark the step `in_review`.
430
+ - `sdlc gate sync <epic> [artifact]` — pull approvals + comment threads into the **same** ledger (your
431
+ own `gh`/`glab`, no stored tokens) and **auto-advance on merge** once the rule is met and every thread
432
+ is resolved. Approvals are **revoked when the reviewed artifact changes** (re-hash), so reviewers get
433
+ a fresh pass. Unresolved comments hold the step `in_review`.
434
+ - `sdlc gate comments <epic>` fetches the open threads to address; `sdlc gate status <epic>` shows
435
+ approvals (counting only the non-stale ones). The file ledger stays the source of truth; with no
436
+ platform / no CLI it degrades to file-only.
437
+
438
+ **The gate rule, by review:**
439
+ - **Base** (epic, UI): `owner + 1 reviewer`.
440
+ - **Escalated** (architecture+contract — `risk_tags: ["contract"]`): base **plus a domain owner for
441
+ every repo in `epic.repos`**. The contract-surface hash must still match `.sdlc/contract-lock.json`
442
+ (a changed surface invalidates approvals).
443
+ - **Per-repo** (stories): base **plus a domain owner (the repo's engineer) for every repo that appears
444
+ in any story's `repos`**.
445
+
446
+ ### Check status anytime
447
+ Invoke **`sdlc-status`** (read-only) to see the full 8-step chain, every step's dials/status, the
448
+ contract lock, story repo tags, and which approvals the active gate still needs.
449
+
450
+ ## Worked example (already in this repo)
451
+
452
+ `epics/EP-istifta-inquiries/` shows the **whole front half** walked end to end:
453
+ - `epic.md` authored + approved (epic gate, base rule) — 2026-06-04.
454
+ - `architecture.md` + `contract.md` authored; contract surface hash-locked in
455
+ `.sdlc/contract-lock.json`. Architecture gate **escalated** (contract): owner *alice* + reviewer
456
+ *bob* + domain owners *carol* (backend) and *dave* (mobile).
457
+ - `ui-design.md` + `DESIGN.md` authored (Impeccable not installed → graceful fallback). UI gate base
458
+ rule (alice + bob).
459
+ - Five repo-tagged stories `stories/EP-istifta-inquiries-S01..S05.md`. Stories gate **per-repo**: base
460
+ rule + a domain owner for each touched repo (carol/backend, dave/mobile).
461
+ - `state.json` now reads `currentStep: ready-for-build`, every front step `done` — the Phase 3
462
+ handoff point.
463
+
464
+ Inspect it:
465
+ ```bash
466
+ cat epics/EP-istifta-inquiries/.sdlc/state.json
467
+ cat epics/EP-istifta-inquiries/.sdlc/approvals.json
468
+ cat epics/EP-istifta-inquiries/.sdlc/contract-lock.json
469
+ ls epics/EP-istifta-inquiries/reviews/
470
+ ls epics/EP-istifta-inquiries/stories/
471
+ # re-verify the contract surface still matches its lock:
472
+ awk '/CONTRACT-SURFACE:BEGIN/{f=1;next} /CONTRACT-SURFACE:END/{f=0} f' \
473
+ epics/EP-istifta-inquiries/contract.md | shasum -a 256
474
+ ```
475
+
476
+ ## Run the full build half by hand (Phase 3)
477
+
478
+ From a `ready-for-build` story, the **build half** turns one atomic task into shipped code through
479
+ gates that protect production. Per-repo specs live in each code repo; the contract stays singular in
480
+ the product repo. Code repos are **separate git repos** under `demo-repos/<repo>/` (gitignored;
481
+ `demo-repos/README.md` explains regeneration). **Nothing auto-advances** — every gate is human-owned.
482
+
483
+ 1. **Spec** — `sdlc-spec` runs the heavy Spec Kit ceremony **once per story per repo**
484
+ (`specify`→`clarify`→`plan`→`analyze`→`checklist`→`tasks`), writing `specs/<story-id>/` and a
485
+ `link.md` back to the story (drives `/speckit.*` when installed, else degrades). It **quotes** the
486
+ locked contract; it never widens it.
487
+ 2. **Implement** — `sdlc-implement` (the `dev` step): one atomic task = one branch
488
+ (`feat/<story>-<task>-…`) = one PR. The diff stays inside the files the task declared. Commit with
489
+ **`sdlc commit`** — it builds the conventional subject, derives the `Task:` trailer from the branch
490
+ (add `--contract-change` only if the locked surface is touched), appends an optional `--ai` co-author,
491
+ and refuses a non-atomic stage. Open the PR with **`sdlc open-pr --repo <repo>`** (template prefilled).
492
+ 3. **Check gates** — `sdlc-checks` wires three CI gates (GitHub + GitLab) that must pass before merge:
493
+ **spec-link** (links a real story/spec), **contract-check** (a contract-surface change without
494
+ `Contract-Change` + a re-locked contract FAILS, routing back to the architecture gate),
495
+ **build/test/lint**. They fail closed on a bad base ref.
496
+ 4. **PR/MR template + risk routing** — `sdlc-pr-template` drops the platform-matched template with an
497
+ Impact & Risk block; `high` risk (or a contract/auth/payments surface) routes the review to domain
498
+ owners (`risk-route.sh`), the same escalation as the gate.
499
+ 5. **AI review → engineer review → ship** — `sdlc-ship`: CodeRabbit is an advisory first pass (never
500
+ the authority); a human engineer approves (owner + 1 reviewer, escalating to domain owners); on
501
+ merge the ship is recorded in `.sdlc/build-log.json` and the story state becomes `in-build` →
502
+ `shipped`. The epic → story → task → PR → mergeCommit chain is traceable both ways.
503
+
504
+ **Multi-repo:** a story tagged `repos: [backend, mobile]` runs the above in each repo independently from
505
+ the **one** locked contract; the contract-check blocks a surface bypass in either repo.
506
+
507
+ **Backfill existing code:** `sdlc-backfill` packs one feature with **Repomix** (`npx repomix`, secret-scan
508
+ by default), drafts an *unverified* spec ("describe what exists, do not invent"), a human approves it,
509
+ and `backfill-check.sh` blocks a change to that feature until its spec is approved — gated per touched
510
+ feature, never the whole repo.
511
+
512
+ The build half is walked end to end on the worked epic: story **S01** shipped (`status: shipped`,
513
+ three tasks in `build-log.json`), **S03** built across backend + mobile, and a `health` feature
514
+ backfilled. The code repos are regenerable from `demo-repos/README.md`.
515
+
516
+ ## Run the back half on the dial (Phase 4 — automation, earned)
517
+
518
+ Phase 4 is **automation, earned with evidence and reversible in one move**. Phase 4a made the
519
+ `automation` dial real and earned the safest step (the check-gate advance); Phase 4b added the
520
+ `implement → check` hand-off and the `spec`/`tasks` trust hooks. The engine is `sdlc-run`; the
521
+ evidence lives in two new files per epic under `.sdlc/`: `build-state/<story-id>.json` (the back steps
522
+ with their dials, per repo) and `trust-log.json` (every run's verdict). See
523
+ `docs/phase-4-build-plan.md` and `docs/phase-4b-build-plan.md`.
524
+
525
+ - **Drive a story's back half:** `sdlc-run {story} {repo}` walks `spec → tasks → implement → checks`,
526
+ reading each step's dial. On `machine_advance` it advances on its own; on `human_approve` it stops
527
+ for a human; on any FAIL, scope overrun, or contract-surface touch it **halts and pulls in a human**.
528
+ It always stops at the engineer review (`sdlc-ship`), which is never automated.
529
+ - **Read the trust log:** `sdlc-status {epic}` shows each back step's dial, status, and trust record —
530
+ runs, % `approved-unchanged`, and whether that clears the threshold (`automation.trust_threshold` in
531
+ `config.yaml`, default ≥5 runs and ≥80% unchanged). The engineer review records each run's verdict
532
+ (a diff merged as-authored is `approved-unchanged`; one edited first is `approved-with-edits`; a
533
+ failed one is `rejected`).
534
+ - **Earn automation for a step:** once a step's trust record clears the threshold,
535
+ `sdlc-run action: set-dial step: checks to: machine_advance` flips it. The setter **refuses** if the
536
+ evidence is short, or for any front state / the engineer review. Reverting
537
+ (`to: human_approve`) is always allowed — automation is reversible in one move.
538
+ - **Kill switch:** `sdlc-run action: kill` forces every step back to `human_approve` system-wide
539
+ instantly (no code change, no per-step edits); `sdlc-run action: unkill` restores earned automation.
540
+
541
+ **Earned so far:** `checks` (Step B, Phase 4a) and `implement` (Step D, Phase 4b — the
542
+ `implement → check` hand-off; the scope/contract halts and the engineer review still gate the merge).
543
+ `tasks` (Step C) and `spec` have their dials + trust hooks but stay `human_approve` until their own
544
+ runs clear the threshold — there is no historical signal to seed them from, so they are earned only on
545
+ genuine runs (never fabricated). See `docs/phase-4b-build-plan.md`.
546
+
547
+ ## What's intentionally NOT built yet
548
+
549
+ **Phase 4b Step C** (the remaining automation): `tasks` generation advance — gated until real
550
+ `tasks`/`spec` trust evidence accrues. The hook that records that evidence is built; the dial flips
551
+ only once the threshold is genuinely met. The scope guard and contract-surface halt always override
552
+ the dial, and **front states and the engineer review stay `human_approve`, permanently.**
553
+
554
+ **Phase 5 (conditional):** the optional service layer (watch repos, run earned-automation steps
555
+ unattended, read-only dashboards), built only when the CLI genuinely can't keep up, with git remaining
556
+ the source of truth. It is **trigger-gated** — `docs/phase-5-build-plan.md` is the build plan: its
557
+ three parts (read-index, unattended runner, dashboard) each ship only when *their* bottleneck is
558
+ measured, with the hard rules they inherit and the instrumentation (already shipped in `sdlc-status`)
559
+ that makes the decision data-driven. See also `docs/claude-code-build-plan.md` §8.