@turri-dev/cli 0.1.3 → 0.1.4-next.172be6f
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.
- package/README.md +22 -1
- package/dist/ask.js +34 -15
- package/dist/cli-options.js +12 -6
- package/dist/config-edit.js +1 -0
- package/dist/config.js +5 -2
- package/dist/extension.js +45 -14
- package/dist/genome.js +1 -1
- package/dist/init-config.js +5 -0
- package/dist/loop-cli.js +13 -1
- package/dist/loop-tools.js +31 -12
- package/dist/pi.js +48 -19
- package/dist/question-dialog.js +1 -0
- package/dist/regenerate/activity.js +12 -0
- package/dist/regenerate/list-arguments.js +121 -0
- package/dist/regenerate/loop.js +115 -14
- package/dist/regenerate/regenerate.js +4 -2
- package/dist/regenerate/self-check.js +13 -6
- package/dist/regenerate/test-scripts.js +54 -10
- package/dist/regenerate/unit-review.js +1 -1
- package/dist/regenerate-cli.js +11 -5
- package/dist/release-tools.js +1 -1
- package/dist/review/live.js +2 -1
- package/dist/run-report.js +34 -1
- package/dist/spec-tools.js +2 -1
- package/docs/config.md +3 -2
- package/docs/headless.md +30 -3
- package/docs/installation.md +3 -0
- package/docs/regenerating.md +43 -8
- package/docs/skills-and-gates.md +3 -1
- package/docs/using.md +20 -9
- package/genome/skills/refactor-module/SKILL.md +24 -2
- package/package.json +1 -1
|
@@ -21,6 +21,8 @@ allowed-tools: [read, write, edit, bash, ls, grep, find]
|
|
|
21
21
|
|
|
22
22
|
The refactoring is purely structural. The **combined behavior** of the resulting modules must be **identical** to the original module. No functional spec is added, removed, or weakened. The split is semantic — grouping related specs together — not behavioral.
|
|
23
23
|
|
|
24
|
+
The spec is structural; the code is not. Once modules are split and specs move between them, the code already built no longer matches the module layout: specs move into modules the code was never built on, and no change to that code brings them in. **After a refactor, the whole requires chain is regenerated from scratch** — the existing code and conformance tests are taken out (their lineage keeps them) and every module is built again from the base of the chain upward. Say so up front: it is part of what the user agrees to (Phase 2e), and it is the last step of the skill (Phase 5).
|
|
25
|
+
|
|
24
26
|
## Input
|
|
25
27
|
|
|
26
28
|
The `.plain` file to refactor, plus guidance from the user on the desired grouping (or ask the user to confirm your proposed grouping).
|
|
@@ -90,8 +92,9 @@ Summarize for the user:
|
|
|
90
92
|
- Any new import module being created
|
|
91
93
|
- Which concepts are exported from each module
|
|
92
94
|
- Confirmation that all original specs are accounted for (none lost)
|
|
95
|
+
- That the whole chain will be **regenerated from scratch** once the split is done: the code and conformance tests built so far are taken out (kept in the lineage) and everything is built again from the base module up — this takes as long and costs as much as building the original module did
|
|
93
96
|
|
|
94
|
-
Get explicit user confirmation before proceeding.
|
|
97
|
+
Get explicit user confirmation before proceeding — of the split and of regenerating from scratch.
|
|
95
98
|
|
|
96
99
|
## Phase 3 — Execute the Split
|
|
97
100
|
|
|
@@ -162,6 +165,19 @@ For each new module:
|
|
|
162
165
|
|
|
163
166
|
Read each new `.plain` file in full and present the final structure to the user for approval. If the user requests changes, apply them and re-verify.
|
|
164
167
|
|
|
168
|
+
Validate each new module with `turri validate <module>.plain` (or the `validate` tool) before going on: a module that does not parse cannot be regenerated.
|
|
169
|
+
|
|
170
|
+
## Phase 5 — Regenerate the Chain from Scratch
|
|
171
|
+
|
|
172
|
+
The split moves specs between modules, so the code built from the original module cannot be patched into the new layout: the chain is regenerated from scratch. Do not try to keep or reuse the existing code, and do not regenerate only what looks changed — modules have moved, and a codebase built without a module it now requires has to be started over anyway.
|
|
173
|
+
|
|
174
|
+
1. **Remind the user** what regenerating from scratch does — the code and conformance tests built so far are taken out, committed so the lineage keeps them, and the whole chain is built again from the base up — and that they already agreed to it in Phase 2e. Proceed only on that agreement.
|
|
175
|
+
2. **Regenerate the tip of the chain from scratch, with its whole chain** — the last module, the one everything else is required by. From scratch for the tip alone is not enough: the modules below keep their code, and the tip starts from a copy of it, laid out for the old modules. With the whole chain, every module's code is taken out, the base's included, and the chain is built again from the bottom:
|
|
176
|
+
- in the chat: the `regenerate` tool on the tip's `.plain` file with `from_scratch: "chain"`, or `/regenerate <tip> from scratch, the whole chain`;
|
|
177
|
+
- on the command line: `turri regenerate <tip>.plain --from-scratch-chain`.
|
|
178
|
+
3. **Modules that require the chain** (updated in 3d) are regenerated after it, from scratch too (`from_scratch: "module"`): the modules they require are not the ones their code was built on. When the tip's whole chain is regenerated, a module built on top of it is a chain of its own — regenerating it from scratch with its whole chain instead covers the tip's chain too, in one go.
|
|
179
|
+
4. **The original module's codebase** (`plain_modules/<original-module>/`), when the original module was deleted or renamed, is no longer built from anything. Tell the user it is there; it is theirs to delete. Do not delete it unasked.
|
|
180
|
+
|
|
165
181
|
## Common Pitfalls
|
|
166
182
|
|
|
167
183
|
### Splitting too aggressively
|
|
@@ -179,9 +195,12 @@ This is a refactoring, not a rewrite. Spec text must be copied verbatim. If a sp
|
|
|
179
195
|
### Losing acceptance tests
|
|
180
196
|
Acceptance tests are nested under their parent functional spec. When moving a spec to a new module, its acceptance tests must move with it.
|
|
181
197
|
|
|
198
|
+
### Regenerating only what changed
|
|
199
|
+
After a split the existing code was built for a module layout that no longer exists. Regenerating incrementally either stops at a codebase that has to be started over or builds on code laid out for the old modules. Regenerate the whole chain from scratch.
|
|
200
|
+
|
|
182
201
|
## Validation Checklist
|
|
183
202
|
|
|
184
|
-
- [ ] User confirmed the split plan before execution
|
|
203
|
+
- [ ] User confirmed the split plan before execution, including regenerating the whole chain from scratch
|
|
185
204
|
- [ ] All original functional specs are present in exactly one new module — none lost
|
|
186
205
|
- [ ] Spec text is identical to the original — no rewording
|
|
187
206
|
- [ ] Acceptance tests moved with their parent specs
|
|
@@ -194,3 +213,6 @@ Acceptance tests are nested under their parent functional spec. When moving a sp
|
|
|
194
213
|
- [ ] Original module removed or updated
|
|
195
214
|
- [ ] Downstream modules (if any) updated to require the chain tip, plus any earlier chain modules whose exported concepts they reference
|
|
196
215
|
- [ ] User approved the final result
|
|
216
|
+
- [ ] Every new module validates
|
|
217
|
+
- [ ] The tip of the chain regenerated from scratch with its whole chain, then any module that requires it
|
|
218
|
+
- [ ] User told about the original module's leftover codebase, if there is one
|