@jakkrichm/create-nexus-devflow 2.16.4 → 2.17.0

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 (92) hide show
  1. package/dist/bin/create-nexus-devflow.d.ts +1 -1
  2. package/dist/bin/create-nexus-devflow.js +41 -2
  3. package/dist/bin/create-nexus-devflow.js.map +1 -1
  4. package/dist/lib/project-status-engine.d.ts +11 -3
  5. package/dist/lib/project-status-engine.js +99 -17
  6. package/dist/lib/project-status-engine.js.map +1 -1
  7. package/dist/lib/review.d.ts +1 -0
  8. package/dist/lib/review.js +58 -3
  9. package/dist/lib/review.js.map +1 -1
  10. package/dist/lib/skill-registry-engine.js +1 -1
  11. package/dist/lib/skill-registry-engine.js.map +1 -1
  12. package/dist/lib/status.d.ts +3 -3
  13. package/dist/lib/status.js +2 -2
  14. package/dist/lib/status.js.map +1 -1
  15. package/dist/lib/tooling/commands/migrate-structure.d.ts +8 -0
  16. package/dist/lib/tooling/commands/migrate-structure.js +197 -0
  17. package/dist/lib/tooling/commands/migrate-structure.js.map +1 -0
  18. package/dist/lib/tooling/commands/summarize-run-status.js +3 -1
  19. package/dist/lib/tooling/commands/summarize-run-status.js.map +1 -1
  20. package/dist/lib/tooling/registry.js +2 -0
  21. package/dist/lib/tooling/registry.js.map +1 -1
  22. package/dist/lib/update.d.ts +29 -3
  23. package/dist/lib/update.js +76 -0
  24. package/dist/lib/update.js.map +1 -1
  25. package/dist/lib/workspace-paths.d.ts +15 -0
  26. package/dist/lib/workspace-paths.js +61 -0
  27. package/dist/lib/workspace-paths.js.map +1 -0
  28. package/dist/scripts/prepare-template.js +75 -15
  29. package/dist/scripts/prepare-template.js.map +1 -1
  30. package/package.json +1 -1
  31. package/template/.agents/skills/analyze/SKILL.md +21 -21
  32. package/template/.agents/skills/audit/SKILL.md +36 -18
  33. package/template/.agents/skills/audit/reference/independent-review.md +58 -2
  34. package/template/.agents/skills/brainstorm/SKILL.md +1 -1
  35. package/template/.agents/skills/complete/SKILL.md +23 -1
  36. package/template/.agents/skills/complete/reference/completion-recovery.md +248 -0
  37. package/template/.agents/skills/continuous/SKILL.md +156 -82
  38. package/template/.agents/skills/feature/SKILL.md +6 -0
  39. package/template/.agents/skills/feature/reference/build-history.md +79 -0
  40. package/template/.agents/skills/idea/SKILL.md +14 -14
  41. package/template/.agents/skills/rollback/SKILL.md +23 -10
  42. package/template/.claude/skills/analyze/SKILL.md +21 -21
  43. package/template/.claude/skills/audit/SKILL.md +33 -16
  44. package/template/.claude/skills/audit/reference/independent-review.md +58 -2
  45. package/template/.claude/skills/brainstorm/SKILL.md +1 -1
  46. package/template/.claude/skills/complete/SKILL.md +23 -1
  47. package/template/.claude/skills/complete/reference/completion-recovery.md +248 -0
  48. package/template/.claude/skills/continuous/SKILL.md +156 -82
  49. package/template/.claude/skills/feature/SKILL.md +6 -0
  50. package/template/.claude/skills/feature/reference/build-history.md +79 -0
  51. package/template/.claude/skills/idea/SKILL.md +14 -14
  52. package/template/.claude/skills/rollback/SKILL.md +23 -10
  53. package/template/AGENTS.md +11 -10
  54. package/template/devflow/{context → 00-context}/ai-interaction.md +1 -1
  55. package/template/devflow/{build-plan.md → 30-planning/build-plan.md} +24 -0
  56. package/template/devflow/40-tasks/.gitkeep +0 -0
  57. package/template/devflow/40-tasks/README.md +11 -0
  58. package/template/devflow/60-docs/migration-guide-decade-numbered.md +93 -0
  59. /package/template/devflow/{context → 00-context}/coding-standards.md +0 -0
  60. /package/template/devflow/{context → 00-context}/glossary.md +0 -0
  61. /package/template/devflow/{context → 00-context}/project-overview.md +0 -0
  62. /package/template/devflow/{ideas.md → 10-ideation/ideas.md} +0 -0
  63. /package/template/devflow/{reference → 10-ideation/reference}/build-plan-template.md +0 -0
  64. /package/template/devflow/{reference → 10-ideation/reference}/feature-spec-template.md +0 -0
  65. /package/template/devflow/{reference → 10-ideation/reference}/mockup.html +0 -0
  66. /package/template/devflow/{reference → 10-ideation/reference}/project-overview-template.md +0 -0
  67. /package/template/devflow/{reference → 10-ideation/reference}/project-plan-template.md +0 -0
  68. /package/template/devflow/{reference → 10-ideation/reference}/running-id-contract.md +0 -0
  69. /package/template/devflow/{decisions → 20-discovery/decisions}/.gitkeep +0 -0
  70. /package/template/devflow/{decisions → 20-discovery/decisions}/README.md +0 -0
  71. /package/template/devflow/{discoveries → 20-discovery/discoveries}/.gitkeep +0 -0
  72. /package/template/devflow/{project-plan.md → 30-planning/project-plan.md} +0 -0
  73. /package/template/devflow/{history → 50-history}/HISTORY.md +0 -0
  74. /package/template/devflow/{history → 50-history}/features/README.md +0 -0
  75. /package/template/devflow/{history → 50-history}/fixes/README.md +0 -0
  76. /package/template/devflow/{history → 50-history}/rollbacks/README.md +0 -0
  77. /package/template/devflow/{docs → 60-docs}/USAGE.md +0 -0
  78. /package/template/devflow/{docs → 60-docs}/diagrams/nexus-devflow-architecture.html +0 -0
  79. /package/template/devflow/{docs → 60-docs}/diagrams/nexus-devflow-architecture.json +0 -0
  80. /package/template/devflow/{docs → 60-docs}/diagrams/nexus-devflow-lifecycle.html +0 -0
  81. /package/template/devflow/{docs → 60-docs}/diagrams/nexus-devflow-lifecycle.json +0 -0
  82. /package/template/devflow/{docs → 60-docs}/examples/living-spec/adr.example.md +0 -0
  83. /package/template/devflow/{docs → 60-docs}/examples/living-spec/current-feature.example.md +0 -0
  84. /package/template/devflow/{docs → 60-docs}/examples/living-spec/discovery.example.md +0 -0
  85. /package/template/devflow/{docs → 60-docs}/examples/living-spec/ideas.example.md +0 -0
  86. /package/template/devflow/{docs → 60-docs}/governance-rules.md +0 -0
  87. /package/template/devflow/{docs → 60-docs}/manual-review-workflow-spec.md +0 -0
  88. /package/template/devflow/{docs → 60-docs}/markdown-metadata-contract.md +0 -0
  89. /package/template/devflow/{docs → 60-docs}/quickstart.md +0 -0
  90. /package/template/devflow/{docs → 60-docs}/release-process.md +0 -0
  91. /package/template/devflow/{docs → 60-docs}/skill-selection-policy.md +0 -0
  92. /package/template/devflow/{docs → 60-docs}/workflow-surface-map.md +0 -0
@@ -0,0 +1,248 @@
1
+ # Completion recovery
2
+
3
+ Use this contract before Complete requires a live spec, and before Status or
4
+ Continuous selects new work. Archive and Git evidence determine the phase.
5
+ `run.json`, modification times, archive titles, and commit subjects prove none of
6
+ these transitions. Recovery grants no commit, merge, push, or cleanup approval.
7
+
8
+ ## Prepare one recoverable archive
9
+
10
+ After Complete's final gates pass, but before any logging edits, record the full
11
+ work branch ref, `HEAD`, local default branch ref and its current commit. Require
12
+ that default commit to be an ancestor of the work branch. Resolve refs locally;
13
+ do not fetch. Capture the verified working tree in a temporary Git index:
14
+
15
+ ```bash
16
+ node --input-type=module -e '
17
+ import fs from "node:fs";
18
+ import os from "node:os";
19
+ import path from "node:path";
20
+ import { execFileSync } from "node:child_process";
21
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), "devflow-completion-"));
22
+ const env = { ...process.env, GIT_INDEX_FILE: path.join(dir, "index") };
23
+ try {
24
+ execFileSync("git", ["read-tree", "HEAD"], { env });
25
+ execFileSync("git", ["add", "-A", "--", "."], { env });
26
+ process.stdout.write(execFileSync("git", ["write-tree"], { env }));
27
+ } finally {
28
+ fs.rmSync(dir, { recursive: true, force: true });
29
+ }'
30
+ ```
31
+
32
+ Run from the project root only after excluding unrelated work and Git conflicts.
33
+ This writes local Git objects, not a commit or ref, and leaves the normal index
34
+ untouched. Never force-add ignored files. Dirty submodules or required ignored
35
+ inputs without separately recoverable exact bytes cannot support this proof.
36
+ The source tree is evidence, not approval or a substitute for any quality gate.
37
+
38
+ Before logging, record `absentOptional` as an array containing only
39
+ `devflow/context/{xxx-slug}/findings.md` and/or `devflow/context/{xxx-slug}/review.md` when each
40
+ exact path returns `ENOENT` from `lstat`, its parents are ordinary directories,
41
+ and neither HEAD nor sourceTree contains it. Otherwise omit that path. This
42
+ records original filesystem absence, never permission to discard evidence.
43
+ Ignored existing files and symlinks are not absent. Reject other paths, duplicates,
44
+ or contradictions; a missing field in an older annotation proves no absence.
45
+
46
+ Start the archive with the original verified spec bytes, unchanged. Measure
47
+ UTF-8 **bytes**, not characters or lines. Append two LF bytes and this single-line
48
+ JSON comment before any Findings, Independent review, or Manual try guide section:
49
+
50
+ ```text
51
+ <!-- devflow:completion {"schemaVersion":1,"specBytes":123,"specSha256":"<64 hex>","branch":"refs/heads/feature/name","head":"<full SHA>","baseRef":"refs/heads/main","baseCommit":"<full SHA>","sourceTree":"<full tree SHA>","absentOptional":[]} -->
52
+ ```
53
+
54
+ Use `Buffer.length` and SHA-256 over the exact file bytes. To recover, locate the
55
+ unique annotation boundary and remove only the two inserted line breaks before
56
+ it (LF or CRLF). Test that prefix as raw bytes and uniform LF/CRLF candidates
57
+ against both `specBytes` and `specSha256`; deduplicate identical candidates and
58
+ accept only one exact match. This reconstructs hash-proven original bytes across
59
+ ordinary Git EOL conversion. Mixed endings or custom filters without an exact
60
+ match stop recovery. Never trim content, split on a Markdown heading, or accept a
61
+ normalized digest instead of the original. Reject malformed/duplicate annotations.
62
+
63
+ Build the complete archive in a temporary file first, including all resolved
64
+ findings, the exact passing receipt when present, and any generated try guide.
65
+ Validate it against its inputs, then place it at the intended absent archive path
66
+ in `devflow/history/features/`, `fixes/`, or `rollbacks/`.
67
+ Never overwrite an existing archive: a matching one enters recovery; a conflicting
68
+ one stops for an exact path decision. Finish plan/overview bookkeeping, update
69
+ `devflow/history/HISTORY.md`, then clean up the run workspace `devflow/context/{xxx-slug}/`.
70
+ Do not append sections incrementally to an existing archive during recovery.
71
+
72
+ ## Screen candidates read-only
73
+
74
+ Before matching a reused feature branch, apply the historical-build exclusion
75
+ below. Do not treat a proved prior reversed build as pending completion of its
76
+ replacement. If that exclusion cannot be proved, retain the candidate and stop
77
+ for full proof rather than guessing from a different spec or archive name.
78
+
79
+ Inspect current branch, `git status --porcelain=v1`, live spec/review and plan
80
+ consistency, and relevant annotated archives. Check recorded local work refs with
81
+ `git show-ref --verify --quiet <branch>`. A matching work branch/archive, a retained
82
+ matching work ref after merge, or uncommitted completion changes/live evidence tied
83
+ to that item is a recovery candidate. An explicit request to resume completion
84
+ also requires full proof. Status reports candidates and routes them to Complete;
85
+ it does not create a temporary index or claim the phase has passed full proof.
86
+
87
+ For ordinary Status or a new Continuous invocation, a clean local default branch
88
+ with consistent live state, no matching local work ref, and no pending completion
89
+ evidence is settled history. An archive at its tip alone does not trigger recovery.
90
+ Do not require historical `head`/`sourceTree` objects for that orientation; clean
91
+ clones and Git pruning legitimately lose them. This is not a new claim about past
92
+ verification. A reset stub alone proves nothing: check the refs, cleanliness, and
93
+ live state too. Missing objects still block actual recovery and explicit resume.
94
+
95
+ ## Prove an actual recovery candidate
96
+
97
+ For feature archives on a reused branch, exclude a prior build only when all of
98
+ these read-only Git checks pass:
99
+
100
+ - `../../feature/reference/build-history.md` proves its unique unchanged archive
101
+ addition on the local default, and the introducing commit's sole parent equals
102
+ that archive annotation's `baseCommit` on the same `baseRef`.
103
+ - An exact completed, unchanged, reachable rollback record names that archive and
104
+ introducing commit; its commit is after the feature addition.
105
+ - The current work branch descends from a post-rollback local default: that
106
+ rollback commit is an ancestor of the merge base of the current work branch
107
+ and local default. Its old archive remains byte/mode-identical in both trees
108
+ and the working tree, with no pending archive edits or retained review explicitly
109
+ targeting that old build.
110
+
111
+ Different spec bytes, title, attempt, filename, or ancestry alone never exclude
112
+ an archive. Missing, changed, or contradictory proof stops; this exception does
113
+ not recover old missing inputs or waive current gates. It permits legacy branch
114
+ reuse only after the old lifecycle is demonstrably finished and reversed.
115
+
116
+ Require one annotated archive matching the recorded work branch, or the exact
117
+ archive/commit proof in the merged phase below. A real live spec must match its
118
+ recovered bytes; a cleaned-up workspace is also expected after merge. A different spec conflicts.
119
+ For features, use the recovered spec's frozen `**Build attempt:**` and that exact
120
+ archive path; never allocate a new attempt on resume. For a legacy feature spec
121
+ without the field, the path plus existing annotation fixes the destination only
122
+ after the prior-build proof in `../../feature/reference/build-history.md` at its
123
+ recorded `baseCommit` uniquely establishes its attempt. Exclude the current archive from those prior
124
+ builds. Do not edit the recovered bytes to insert metadata.
125
+
126
+ Require all recorded commits and `sourceTree` to exist (`git cat-file -e`).
127
+ Unreferenced source trees can be pruned by Git: missing objects stop recovery;
128
+ request the original objects or an identified backup, never recreate a guessed
129
+ baseline. An old archive without this annotation may be read as history, but
130
+ cannot automatically recover a missing live spec through this contract.
131
+
132
+ Use the temporary-index command above to inspect the present work tree without
133
+ altering the real index. Compare trees with `git diff --raw -z <source> <current>`
134
+ and inspect source blobs with `git show <sourceTree>:<path>`. Git trees use clean-
135
+ filtered bytes; compare evidence through `git hash-object --path=<path> --stdin`
136
+ when ordinary EOL conversion applies, while recovering the exact spec only by
137
+ its archive digest above. Unsupported custom filters stop recovery. Inspect staged
138
+ changes too; conflicting staged/working versions must be reconciled explicitly.
139
+ Do not infer identity from ancestry alone, a matching filename, or a latest date.
140
+
141
+ ## Validate only the expected completion changes
142
+
143
+ Reconstruct the original spec and evidence from the source tree and archive.
144
+ Every changed path, file mode, addition, and deletion must be accounted for.
145
+ Only these exact transformations can follow the captured source tree:
146
+
147
+ - Add this one archive, with the exact spec prefix and annotation, resolved
148
+ findings copied with only the documented ID prefix, the original passing
149
+ receipt bytes, and a try guide for this spec when required or already generated.
150
+ - Apply this work item's exact build-plan checkbox/parent changes, or its exact
151
+ rollback note. Update `devflow/history/HISTORY.md` with the release digest.
152
+ Change only the overview's existing source-hash value, using the documented hash contract.
153
+ A fix has no build-plan change.
154
+ - Remove only resolved ledger entries present in that archive. Preserve every
155
+ `open`, `fixed`, and `unverified` entry byte-for-byte, including its ID.
156
+ - Clean up the completed task run directory `devflow/context/{xxx-slug}/`.
157
+ - Delete only the exact consumed prototype files already authorized for this
158
+ work item and identified by its design reference. No general cleanup is allowed.
159
+
160
+ No other history, context, configuration, product, test, or ignore-rule changes
161
+ are completion bookkeeping. Read the full diffs, not just a filename allowlist.
162
+ Partial plan bookkeeping is recoverable only when each changed byte is one of
163
+ these transformations and all unfinished operations can be identified exactly.
164
+ Conflicting or partial archive/evidence content stops before any live reset.
165
+
166
+ For independent review, validate the archived receipt against its original
167
+ `Target commit`, original base/merge-base, exact recovered spec digest, reviewer
168
+ identity, execution/context pairing, required Check result, and receipt sections.
169
+ The annotation's `head` must equal that target, and its source tree may differ
170
+ from the target only in the original review/findings evidence permitted by Audit.
171
+ Never relabel the receipt as current at the later work commit or merge commit.
172
+ When the original receipt has `Spec snapshot`, preserve that field unchanged.
173
+ After live reset, the hash-proven original archive prefix may establish the same
174
+ spec identity: require its exact digest to equal the receipt's `Spec hash` and the
175
+ annotation's `specSha256`, and require the snapshot field's canonical path to
176
+ contain that original target and hash. This is archived-receipt validation, not
177
+ a current live receipt. Do not create a new snapshot or relabel the target.
178
+ Conflicting retained snapshot bytes or unsafe paths still stop recovery; an
179
+ absent local snapshot may use this exact archive proof after reset. This does
180
+ not replace source-tree/product proof or recover other ignored evidence.
181
+ The narrow completion changes above preserve the reviewed product; any other
182
+ change requires restored exact active inputs and renewed gates/checkpoint/review.
183
+ Never overwrite conflicting live evidence to obtain that restoration.
184
+
185
+ Ignored local-only files are absent from this tree proof. Validate them using
186
+ separately provable exact original bytes plus the archive and retained inputs,
187
+ or stop and name the missing evidence. A local archive can match a still-existing
188
+ work branch; its presence alone cannot bind an already-deleted branch to a squash
189
+ commit. Do not force-add ignored workflow files to make recovery pass.
190
+
191
+ ## Interrupted archival, before the work commit
192
+
193
+ Require the recorded work branch at the recorded `head`, the local default still
194
+ at `baseCommit`, a complete matching archive, and only the validated partial or
195
+ finished bookkeeping changes above. Reconcile archived and retained findings and
196
+ review before changing anything. Do not duplicate sections or erase unresolved
197
+ entries. If the archive is absent and live inputs are intact, use normal Complete;
198
+ if both the archive and needed live input are missing, stop for recovery evidence.
199
+
200
+ Read the recovered spec from a temporary file, preserving its exact bytes; do
201
+ not overwrite the live stub merely to orient a fresh session. Repeat current-
202
+ session Verify and required gates against that spec and the current product.
203
+ Reuse a passing archived review only through the original-target checks above.
204
+ If a gate needs active files restored, restore only proven matching originals
205
+ with no conflicting live data, run the gate, and re-enter normal Complete. If
206
+ verification or review changes evidence, stop and reconcile a new reviewed archive
207
+ candidate explicitly; never silently append to the existing archive.
208
+
209
+ Finish only the missing bookkeeping, with live workspace cleanup last. Show the concrete
210
+ remaining diff and proposed conventional work commit, obtain normal commit
211
+ approval, and continue at Complete Step 2. This archive does not authorize Git.
212
+
213
+ ## Work committed, awaiting merge
214
+
215
+ Require a clean recorded work branch at one unambiguous final work commit whose
216
+ sole parent is recorded `head`, with the default still at `baseCommit`. Compare the complete work
217
+ commit tree to `sourceTree` and require exactly the finished transformations above.
218
+ The tracked archive and final bookkeeping must be in that commit, not added later.
219
+ For ignored evidence require the separate proof described above. Extra commits or
220
+ post-commit drift stop for review, not another completion commit.
221
+
222
+ Rerun current-session Verify and validate all required gates using the recovered
223
+ spec and original receipt. Resume at Complete Step 3's merge approval. Never make
224
+ a second work commit, reset evidence again, or treat earlier approval as covering
225
+ new changes. Preserve the exact work commit SHA for merge verification.
226
+
227
+ ## Merge already completed
228
+
229
+ Require a clean local default branch tip whose sole parent is the recorded
230
+ `baseCommit`, and the complete finished tree and archive. If the work branch still
231
+ exists, require its exact final work commit and tree equality with that default
232
+ tip (`git diff --exit-code <workCommit>^{tree} <defaultTip>^{tree}`), including the
233
+ archive blob. A squash merge normally does not contain the work commit as an
234
+ ancestor. Tree equality alone without the matching base, archive, and completed
235
+ bookkeeping is insufficient.
236
+
237
+ If the work branch was deleted, require the tracked archive at the default tip,
238
+ its exact source-tree/spec/branch annotation, and exactly the finished changes
239
+ from sourceTree to that tip. An ignored archive without a provable commit binding
240
+ must stop for user identification and supporting evidence. If the default has
241
+ advanced or several commits/archives fit, stop and name the ambiguity instead of
242
+ weakening this proof or searching by title.
243
+
244
+ Do only pending cleanup already authorized for this work item; ask if cleanup
245
+ approval is missing. Never repeat archival, the work commit, or the squash merge,
246
+ and never create a cleanup commit on the default branch. If nothing remains,
247
+ report the verified local merge once and leave Git unchanged. Push still needs
248
+ its separate approval. A repeated resume follows this same no-op path.
@@ -6,6 +6,8 @@ argument-hint: "[{resume, max-features, or start-feature}]"
6
6
 
7
7
  # continuous - Complete the Build Plan One Local Feature at a Time
8
8
 
9
+ **Context reuse:** Reuse any required file already loaded in project instructions or the current session. Read it again only if absent, changed, or exact current bytes or line references are needed.
10
+
9
11
  **First action:** Before project inspection, preflight, or any other tool call,
10
12
  publish `running` to `devflow/.state/run.json` using the dashboard activity
11
13
  contract in `AGENTS.md`.
@@ -19,120 +21,192 @@ Where this sits in the workflow:
19
21
  Gates ➔ Merge)
20
22
  ```
21
23
 
22
- `/continuous` (หรือ `$continuous`) คือโหมดการทำงานแบบ Autonomous Multi-Feature Delivery Loop สำหรับจัดส่งฟีเจอร์ที่อยู่ใน `devflow/build-plan.md` ต่อเนื่องทีละฟีเจอร์ในเครื่อง Local โดยไม่ต้องหยุดรอ Manual Review Prompts ในแต่ละขั้นตอนย่อย แต่ยังคงรักษาความเข้มงวดของ **The 3-Pillars Model & Task-Isolated Living Spec (`devflow/context/{xxx-slug}/spec.md`)**, การทำ TDD, การตรวจ Quality Gates, การบันทึก Findings Ledger, และการ Squash-merge ลง Local Main Commit ทีละฟีเจอร์อย่างปลอดภัย 100%
23
-
24
- ### ขอบเขตสิทธิ์ที่ได้รับอนุญาตเฉพาะในเครื่อง Local:
25
- - สร้างและสลับ Feature Branch ในเครื่อง Local
26
- - บันทึก Checkpoint Commits ย่อยบน Branch
27
- - สร้าง required immutable independent-review checkpoints
28
- - บันทึก Feature Commit สุดท้าย
29
- - Squash-merge ฟีเจอร์ที่เสร็จสมบูรณ์ลง Default Branch ของ Local
30
- - ลบ Feature Branch เฉพาะใน Local หลังรวมโค้ดสำเร็จ
31
- - วนลูปเริ่มทำฟีเจอร์ที่ยังไม่ได้เช็ค (`- [ ]`) รายการถัดไปใน `build-plan.md`
32
-
33
- ### ข้อจำกัดความปลอดภัยเด็ดขาด (Strict Safety Boundaries):
34
- - **ห้าม** Push ขึ้น Remote Repository
35
- - **ห้าม** Deploy หรือเผยแพร่ (Publish) สู่ภายนอก
36
- - **ห้าม** ลบข้อมูลจริง, ทำลาย Database, หรือรัน Destructive Migration
37
- - **ห้าม** กด Accept Finding หรือเพิกเฉยต่อ Failing Quality Gate แทนมนุษย์
24
+ Continuous Mode (`/continuous` or `$continuous`) is an explicit opt-in loop for
25
+ completing planned features serially from `devflow/build-plan.md` in local isolation
26
+ without pausing at normal human review prompts. It preserves the same strict
27
+ **The 3-Pillars Model & Task-Isolated Living Spec (`devflow/context/{xxx-slug}/spec.md`)**,
28
+ disciplined TDD verification, quality gates, findings ledger, branch isolation, and
29
+ one clean local main commit per feature that a careful human workflow would produce.
30
+
31
+ ### Authorized Local Actions for this Run:
32
+ - Create and switch local feature branches (`feature/{xxx-slug}`)
33
+ - Create configured checkpoint commits on those branches
34
+ - Create required immutable independent-review checkpoints
35
+ - Create the final local feature commit
36
+ - Squash-merge a completed feature into the local default branch (`main`)
37
+ - Delete the merged local feature branch
38
+ - Repeat with the next unchecked build-plan item
39
+
40
+ ### Strict Safety Boundaries:
41
+ - **NEVER** push to remote repositories
42
+ - **NEVER** deploy or publish externally
43
+ - **NEVER** delete production data, destroy databases, or run irreversible migrations
44
+ - **NEVER** accept findings or waive failing quality gates on behalf of the user
45
+ - Always stop before those actions and hand off to the user
38
46
 
39
47
  ---
40
48
 
41
49
  ## Input & Target Selection
42
50
 
43
- - **ไม่ระบุ Argument (`/continuous`)**:
44
- 1. หากมีฟีเจอร์ค้างอยู่ใน `devflow/context/{xxx-slug}/` ให้ทำต่อจากขั้นตอนย่อยแรกที่ยังไม่ได้เช็ค (`- [ ]`)
45
- 2. หากไม่มี ให้เลือกฟีเจอร์แรกที่ยังไม่ได้เช็ค (`- [ ]`) ใน `devflow/build-plan.md`
46
- 3. วนลูปทำต่อเนื่องตามลำดับใน `build-plan.md` จนกว่าจะหมด หรือครบตามจำนวน `continuous.maxFeatures` ใน `devflow/config.json`
47
- - **ระบุ `resume` (`/continuous resume`)**: ทำงานต่อจากฟีเจอร์และขั้นตอนย่อยที่ค้างอยู่ทันที
48
- - **ระบุชื่อหรือหมายเลขฟีเจอร์ (`/continuous 13`)**: เริ่มต้นจากฟีเจอร์ที่ระบุ แล้ววนลูปต่อไปยังฟีเจอร์ถัดไป
51
+ Before selecting a new feature or requiring an active live spec, always inspect
52
+ pending completion using the installed Complete skill and
53
+ `../complete/reference/completion-recovery.md`. Use its read-only candidate screen
54
+ first: settled clean default-branch history needs no historical transient objects
55
+ for a new run. An actual completion candidate or an explicit request to resume
56
+ interrupted completion requires full recovery proof, using this run's scoped Git
57
+ authority and `qualityGates.continuous`. Do not repeat archival or a work commit/merge.
58
+ Missing, conflicting, or unprovable recovery evidence stops before next-feature work.
59
+ An active feature with no completion candidate resumes implementation normally; its
60
+ ordinary `resume` does not require an archive or completion proof.
61
+
62
+ With no argument after pending completion has been reconciled:
63
+
64
+ 1. Resume an active feature in `devflow/context/{xxx-slug}/spec.md`.
65
+ 2. Otherwise select the next unchecked leaf item (`- [ ]`) in `devflow/build-plan.md`.
66
+ 3. Continue in build-plan order until no unchecked leaf remains or
67
+ `continuous.maxFeatures` completed features have been counted.
68
+
69
+ `resume` explicitly resumes the active feature or its pending completion.
70
+ A feature number or name may set the starting item only when no different work item
71
+ is active. After that item, continue with the next unchecked leaf items in normal
72
+ build-plan order.
73
+
74
+ Continuous Mode handles planned features only. If the active work is a fix or rollback,
75
+ stop and point to its normal reviewed workflow. Never overwrite active work to make
76
+ the requested target fit.
49
77
 
50
78
  ---
51
79
 
52
- ## Step 1: Preflight Safety Check (ตรวจสอบความพร้อมก่อนเริ่ม)
80
+ ## Step 1: Preflight Safety Check
53
81
 
54
- อ่านบริบทตั้งต้น:
82
+ Read initial context:
55
83
  - `AGENTS.md`
56
- - `devflow/config.json` (หากไม่มี ให้ใช้ค่า Defaults อย่างปลอดภัย; หาก Invalid ให้หยุดและชี้ไปที่ `/doctor`)
57
- - `devflow/project-plan.md` และ `devflow/build-plan.md`
84
+ - `devflow/config.json` (if missing, use safe defaults; if invalid, stop and point to `/doctor`)
85
+ - `devflow/project-plan.md` and `devflow/build-plan.md`
58
86
  - `devflow/context/project-overview.md`
59
- - `devflow/context/{xxx-slug}/` (ถ้ามีงานค้างอยู่)
60
- - `devflow/context/coding-standards.md` และ `devflow/context/ai-interaction.md`
61
- - สถานะ Git (`git status`, `git branch`, recent log)
62
-
63
- ### กฎการเริ่มงาน (Start Conditions):
64
- 1. สถานะ Git Working Tree สะอาด (Clean) บน Default Branch หรือมีเฉพาะ Diff ของฟีเจอร์ปัจจุบัน
65
- 2. `devflow/build-plan.md` มีฟีเจอร์ที่ยังไม่ได้ทำเหลืออยู่
66
- 3. ไม่มี Finding ระดับ P0 หรือ P1 ค้างในสถานะ `open` หรือ `fixed`
67
- 4. บันทึก Commit SHA ตั้งต้นของ Default Branch ไว้สำหรับสรุปผลในรายงานสุดท้าย
87
+ - `devflow/context/{xxx-slug}/` (if work is already active)
88
+ - `devflow/context/coding-standards.md` and `devflow/context/ai-interaction.md`
89
+ - Git status (`git status`, `git branch`, default branch, and recent log)
90
+
91
+ ### Start Conditions:
92
+ 1. The project is a Git repository.
93
+ 2. The working tree is clean on the default branch, or all dirty work belongs to the
94
+ active feature on its matching configured feature branch, including proven pending
95
+ completion handled through the recovery contract.
96
+ 3. `devflow/build-plan.md` is a valid ordered checkbox plan with at least one remaining leaf.
97
+ 4. Overview is fresh. If stale but both plans are clear and consistent, refresh it
98
+ using `/overview` behavior and include that change with the first feature.
99
+ 5. Existing P0 or P1 findings are not `open` or `fixed`.
100
+ 6. Project commands and the exact `Verify` command, when declared, are usable.
101
+ 7. Record the starting default-branch commit SHA for the final integration summary.
102
+
103
+ The initial `devflow/.state/run.json` record required by `AGENTS.md` must already show
104
+ command `continuous` and status `running` before preflight begins. After preflight passes,
105
+ enrich it with boundary `local-only`, the current feature, and completed-feature progress
106
+ against the smaller of the remaining queue or configured limit. Update it when a feature
107
+ starts, after every passing build step, after each quality gate, and after each local main
108
+ commit. On a stop, set status `blocked` with `/continuous resume` when resuming is safe.
109
+ At the end of the queue or limit, set status `completed`.
68
110
 
69
111
  ---
70
112
 
71
- ## Step 2: Serial Feature Lifecycle (วงจรการส่งมอบทีละฟีเจอร์)
113
+ ## Step 2: Serial Feature Lifecycle
72
114
 
73
- ดำเนินงานวนลูปทีละ 1 ฟีเจอร์ตามลำดับ:
115
+ Execute the loop one feature at a time in strict order:
74
116
 
75
- ### 2.1 Select & Spec (เลือกและร่างสเปก)
76
- - หาก Resuming: ใช้ Spec เดิมใน `devflow/context/{xxx-slug}/spec.md`
77
- - หากเป็นฟีเจอร์ใหม่: ถอดความต้องการจาก `build-plan.md` และสร้าง Task Workspace ที่ `devflow/context/{xxx-slug}/` พร้อมเขียน `spec.md`, `stage.md`, `findings.md` และวิเคราะห์ Red-team ก่อนเริ่มโค้ด
117
+ ### 2.1 Select & Spec
118
+ - If resuming: Reuse the existing spec in `devflow/context/{xxx-slug}/spec.md`.
119
+ - If new feature: Extract requirements from `devflow/build-plan.md` and initialize the
120
+ task workspace at `devflow/context/{xxx-slug}/` with `spec.md`, `stage.md`, and `findings.md`.
121
+ Check `../feature/reference/build-history.md` for `--build-N` naming conventions if
122
+ rebuilding a previously rolled-back feature, ensuring existing archives in
123
+ `devflow/history/features/` are never overwritten. Self-review the spec before coding.
78
124
 
79
125
  ### 2.2 Create / Resume Feature Branch
80
- - สร้าง Branch ตาม Prefix ใน Config (เช่น `feature/061-slug`) จาก Default Branch
126
+ - Use the configured branch prefix (e.g., `feature/{xxx-slug}`) from the current local default branch.
127
+ - When resuming, require the existing branch and active spec to agree.
128
+ - If switching would strand unrelated work or the default branch changed unsafely, stop.
129
+ Never stash, reset, or discard work automatically.
81
130
 
82
131
  ### 2.3 Implement Small Steps with Strict TDD
83
- - ดำเนินการสร้างฟังก์ชันทีละ Task ตาม Checklist ใน Spec:
84
- 1. `[TDD-Red]`: เขียน Unit Test ก่อน
85
- 2. `[TDD-Green]`: เขียนโค้ดขั้นต่ำให้ Test ผ่าน
86
- 3. `[TDD-Refactor]`: ปรับแต่งโค้ดให้สะอาดและรัน Verification ผ่าน
87
- 4. ทำเครื่องหมาย `- [x]` ใน Spec และบันทึก Checkpoint Commit บน Branch (หาก `workflow.checkpointCommits: "enabled"`)
132
+ Execute the spec in order, one small diff at a time:
133
+ 1. `[TDD-Red]`: Write the failing unit test first.
134
+ 2. `[TDD-Green]`: Implement the minimal code to pass the test.
135
+ 3. `[TDD-Refactor]`: Clean up and ensure all verifications pass cleanly.
136
+ 4. Check off the step (`- [x]`) in `spec.md`.
137
+ 5. When `workflow.checkpointCommits` is `enabled`, create a conventional local
138
+ checkpoint commit containing that passing step and its checked spec state.
139
+ When `disabled`, keep the work uncommitted until feature completion.
88
140
 
89
141
  ### 2.4 Apply Continuous Quality Gates
90
- ตรวจสอบตามการตั้งค่า `qualityGates.continuous` ใน `devflow/config.json`:
91
- - **Audit**: `manual` (ข้ามอัตโนมัติ), `when-sensitive` (รันเมื่อแตะ Auth/Security/Database/Secrets), `always` (รันทุกฟีเจอร์)
92
- - **Independent Review**: อ่าน `qualityGates.continuous.independentReview`; `manual` คือ opt-in, `always` บังคับทุกฟีเจอร์, และ `when-sensitive` บังคับเมื่อฟีเจอร์แตะ authentication, authorization, secrets, payments, personal data, destructive operations, dependencies, deployment หรือ security boundary อื่น บันทึกคำตัดสินและหลักฐานต่อฟีเจอร์ใน spec
93
- - **Check**: `manual` (ข้ามอัตโนมัติ), `when-behavioral` (รันเมื่อมี Runtime Behavior เช่น UI/CLI/API), `always` (รันทุกฟีเจอร์)
94
- - **Try Guide**: `manual` (ข้ามอัตโนมัติ), `when-user-facing` (สร้าง Try Guide เมื่อเป็น UI/CLI), `always` (สร้างทุกฟีเจอร์)
95
-
96
- ทุก product/spec edit ทำให้ receipt เดิมหมดอายุ เมื่อ Independent Review gate
97
- ทำงาน ให้รัน Verify และสร้าง immutable checkpoint (ได้รับอนุญาตภายใต้ Continuous Mode authority แม้ checkpointCommits จะ disabled) จากนั้นปฏิบัติตาม `/audit independent current`
98
- หาก `review.independentExecution` เป็น `automatic` ให้ spawn และรอ isolated reviewer child พร้อมตรวจสอบ receipt ให้ผ่านก่อนดำเนินการต่อ
99
- หากเป็น `manual` หรือ runtime ไม่สามารถพิสูจน์ isolation, identity, model ได้ ให้ตั้งสถานะเป็น `ready` และหยุดด้วย manual handoff
100
- Continuous Mode จะไม่ทำการ audit งานของตัวเองโดยเด็ดขาด
101
-
102
- คำขอจะบันทึก `Requested execution` และ receipt จะบันทึก `Actual execution`
103
- การจับคู่ของ execution และ reviewer context จะต้องถูกต้องตามสัญญา review
104
- หากเป็น legacy request ที่ไม่มี `Requested execution` ให้ถือว่าเป็น legacy manual-only ห้ามเติมฟิลด์หรือรัน subagent กับมัน
105
-
106
- สำหรับฟีเจอร์ browser-facing ให้รัน `npm run test:browser` เมื่อมี
107
- `test:browser` script และเก็บ interactive evidence ผ่าน `browseros-neo` เมื่อ
108
- พร้อมใช้งาน หาก script หรือ MCP ไม่มี ให้บันทึก limitation และหยุดเมื่อ evidence
109
- นั้นเป็น gate ที่จำเป็น ห้ามติดตั้งหรืออ้างผลโดยปริยาย
142
+ Evaluate `qualityGates.continuous` in `devflow/config.json`:
143
+ - **Audit**: `manual` skips automatic audit; `when-sensitive` runs `/audit current`
144
+ for authentication, authorization, payments, secrets, personal or user data, migrations,
145
+ destructive operations, external side effects, security boundaries, or unusually broad changes;
146
+ `always` audits every feature.
147
+ - **Independent Review**: Read `qualityGates.continuous.independentReview`; `manual` skips
148
+ automatic review; `when-sensitive` requires an isolated reviewer for the same sensitive
149
+ categories as Audit; `always` requires an isolated reviewer for every feature. A passing
150
+ independent receipt satisfies the Audit gate for that feature.
151
+ - **Check**: `manual` skips automatic `/check`; `when-behavioral` runs it when a done-when
152
+ needs observed runtime behavior (UI, CLI, API, background job); `always` checks every feature.
153
+ - **Try Guide**: `manual` skips automatic generation; `when-user-facing` generates a guide
154
+ for UI, CLI, or user-facing workflows; `always` generates one for every feature.
155
+
156
+ Run required gates in order: check, review, then try guide. When independent review is
157
+ selected, ensure application code is in a clean immutable checkpoint. First rerun final
158
+ verification and selected Check gate and set spec status to `verified`. This review
159
+ checkpoint is covered by Continuous Mode authority even when step checkpoint commits are
160
+ disabled. Follow `/audit independent current`.
161
+
162
+ With `review.independentExecution: "automatic"`, spawn and wait for the isolated reviewer
163
+ subagent and validate its receipt before continuing. With `manual`, or when runtime cannot
164
+ prove isolation, identity, model, or completion, set activity to `ready` and stop with the
165
+ manual handoff. Continuous Mode never audits its own work.
166
+
167
+ The request records `Requested execution`; the receipt records `Actual execution`. Require
168
+ the execution and reviewer-context pairing defined by the review contract. A pending request
169
+ without `Requested execution` is legacy manual-only.
170
+
171
+ For browser-facing features, run `npm run test:browser` when `test:browser` script exists
172
+ and collect interactive evidence via `browseros-neo` when available.
110
173
 
111
174
  ### 2.5 Repair Findings
112
- - ซ่อมแซม Finding ระดับ P0/P1 ที่เกิดขึ้นจากฟีเจอร์นี้โดยอัตโนมัติ (ไม่เกิน `continuous.maxRepairAttempts` ครั้ง)
113
- - หากไม่สามารถซ่อมแซมได้ หรือมี P0/P1 ค้างอยู่ ให้หยุดการทำงานทันที
175
+ - Automatically repair confirmed P0 and P1 findings directly caused by the feature, up to
176
+ `continuous.maxRepairAttempts` times.
177
+ - After repair, rerun affected verification and re-audit the repaired area.
178
+ - Any unresolved P0 or P1 finding left `open` or `fixed` stops the loop before completion.
114
179
 
115
180
  ### 2.6 Complete Locally Like a Human
116
- - รัน Verification ขั้นสุดท้าย
117
- - ย้ายและ Archive เอกสารไปที่ `devflow/history/features/{xxx-slug}.md`
118
- - อัปเดตเช็คบ็อกซ์ใน `devflow/build-plan.md`
119
- - ลบโฟลเดอร์รัน `devflow/context/{xxx-slug}/`
120
- - Squash-merge Feature Branch เข้าสู่ Local Main และลบ Feature Branch ใน Local
121
- - นับจำนวนฟีเจอร์ที่สำเร็จเพิ่มขึ้น 1
181
+ Apply the `/complete` safety, logging, and archive behavior without asking commit and merge prompts:
182
+ 1. Run final documented verification.
183
+ 2. Confirm the current spec status is `verified`.
184
+ 3. Capture source tree / annotation proof per `../complete/reference/completion-recovery.md`
185
+ and embed `<!-- devflow:completion {...} -->` in the archive.
186
+ 4. Place the archive at `devflow/history/features/{xxx-slug}.md`.
187
+ 5. Update checkboxes in `devflow/build-plan.md` and append entry to `devflow/history/HISTORY.md`.
188
+ 6. Remove the active run directory `devflow/context/{xxx-slug}/`.
189
+ 7. Switch to the local default branch, squash-merge the feature branch, and create one
190
+ conventional commit containing product work, tests, and DevFlow history.
191
+ 8. Delete the merged local feature branch.
192
+ 9. Confirm the default branch is clean before selecting the next feature.
122
193
 
123
194
  ---
124
195
 
125
196
  ## Step 3: Optional Final Integration Audit
126
197
 
127
- เมื่อครบกำหนดจำนวนฟีเจอร์หรือหมด `build-plan.md` หาก `continuous.finalIntegrationAudit: true` ให้รันการตรวจสอบความเข้ากันได้แบบบูรณาการ (Cross-Feature Contracts & Seams) จากจุดเริ่มต้นถึง HEAD ปัจจุบัน
198
+ When the feature queue completes or `continuous.maxFeatures` is reached, if
199
+ `continuous.finalIntegrationAudit: true`, execute an integration compatibility check
200
+ (Cross-Feature Contracts & Seams) covering the span from the starting commit to current HEAD.
128
201
 
129
202
  ---
130
203
 
131
- ## Step 4: Stop & Report (สรุปรายงานผลลัพธ์)
204
+ ## Step 4: Stop & Report
132
205
 
133
- เมื่อการทำงานสิ้นสุด (ไม่ว่าจะสำเร็จครบถ้วน หรือหยุดเนื่องจากติดเงื่อนไขความปลอดภัย) ให้รายงานสรุปเป็นภาษาไทย:
134
- - Commit เริ่มต้น และ Commit สุดท้ายของ Default Branch
135
- - รายชื่อฟีเจอร์ที่จัดส่งสำเร็จในรอบนี้ พร้อม Commit Hash
136
- - ผลการรัน Quality Gates และการซ่อมแซม Findings (ถ้ามี)
137
- - ความคืบหน้าภาพรวมของ `build-plan.md` และฟีเจอร์ถัดไป
138
- - ย้ำเตือนชัดเจนว่า **ไม่มีการ Push ใดๆ ขึ้น Remote Repository**
206
+ When Continuous Mode finishes (either fully completed or stopped at a safety boundary),
207
+ present a concise summary report in Thai (per user communication rules):
208
+ - Starting and ending commit SHAs of the local default branch.
209
+ - List of features delivered in this run with their commit hashes.
210
+ - Summary of quality gates executed and findings resolved.
211
+ - Overall progress of `devflow/build-plan.md` and next upcoming feature.
212
+ - Clear reminder that **no remote push or deployment has occurred**.
@@ -126,6 +126,10 @@ build plan starts high-level.
126
126
 
127
127
  ## Step 3 - write the spec
128
128
 
129
+ Before review, allocate the selected feature ID's build attempt using
130
+ `reference/build-history.md`: first build 1, otherwise one greater than
131
+ the maximum proven prior attempt after all prior builds were reversed. For attempt N > 1, append `--build-N` to the slug and archive path (e.g. `086-export--build-2.md`).
132
+
129
133
  For the one (sub-)feature being built now, allocate sequential ID (`xxx-slug`) and create a dedicated workspace at `devflow/context/{xxx-slug}/`. Write the full living spec to
130
134
  `devflow/context/{xxx-slug}/spec.md`, following `reference/feature-spec-template.md`. Also initialize `stage.md` and `findings.md` in that folder. The first heading and build-plan identity must use this canonical form:
131
135
 
@@ -133,8 +137,10 @@ For the one (sub-)feature being built now, allocate sequential ID (`xxx-slug`) a
133
137
  # Feature: <title>
134
138
 
135
139
  **From build-plan:** feature <id>
140
+ **Build attempt:** <positive integer>
136
141
  ```
137
142
 
143
+
138
144
  Fill every section:
139
145
  - Goal, Problem Statement, and In/Out of scope
140
146
  - Acceptance Criteria (AC-1, AC-2, ...)