@hanzlaa/rcode 4.0.0 → 4.1.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 (47) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +2 -2
  3. package/cli/doctor.js +17 -0
  4. package/cli/github-sync.js +3 -2
  5. package/cli/index.js +16 -0
  6. package/cli/install.js +1 -0
  7. package/cli/lib/manifest.cjs +13 -0
  8. package/cli/set-mode.js +10 -0
  9. package/cli/set-profile.js +10 -0
  10. package/cli/uninstall.js +100 -39
  11. package/cli/workflow.js +97 -0
  12. package/dist/rcode.js +249 -229
  13. package/package.json +1 -1
  14. package/rcode/bin/lib/config.cjs +3 -2
  15. package/rcode/bin/rcode-tools.cjs +8 -3
  16. package/rcode/skills/SKILLS_INDEX.md +4 -3
  17. package/rcode/skills/actions/1-analysis/rcode-document-project/SKILL.md +6 -0
  18. package/rcode/skills/actions/3-solutioning/rcode-check-implementation-readiness/SKILL.md +6 -0
  19. package/rcode/skills/actions/3-solutioning/rcode-create-architecture/steps/step-01-init.md +1 -1
  20. package/rcode/skills/actions/3-solutioning/rcode-create-architecture/workflow.md +13 -1
  21. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/SKILL.md +166 -0
  22. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/references.md +136 -0
  23. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/backlog-building.md +113 -0
  24. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/composition-with-herdr.md +85 -0
  25. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/integration-branch.md +191 -0
  26. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/merge-strategy.md +113 -0
  27. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/orchestrator-rhythm.md +119 -0
  28. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/wave-design.md +100 -0
  29. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/BACKLOG-template.md +34 -0
  30. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/STATE-template.md +40 -0
  31. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/heartbeat.sh +29 -0
  32. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/wave-prompt.md +69 -0
  33. package/rcode/skills/actions/4-implementation/rcode-retrospective/workflow.md +61 -246
  34. package/rcode/templates/sprint.md +16 -0
  35. package/rcode/workflows/audit.md +3 -0
  36. package/rcode/workflows/brainstorm.md +1 -1
  37. package/rcode/workflows/council.md +8 -1
  38. package/rcode/workflows/create-architecture.md +5 -1
  39. package/rcode/workflows/create-prd.md +5 -1
  40. package/rcode/workflows/dashboard.md +5 -2
  41. package/rcode/workflows/discuss-phase.md +3 -15
  42. package/rcode/workflows/execute-sprint.md +3 -1
  43. package/rcode/workflows/plan-spawn-planner.md +96 -0
  44. package/rcode/workflows/plan.md +67 -0
  45. package/rcode/workflows/retrospective.md +5 -1
  46. package/rcode/workflows/sprint-planning.md +9 -5
  47. package/server/dashboard.js +2 -2
@@ -111,6 +111,31 @@ Output consumed by /rcode-execute. Plans need:
111
111
  - Tasks in XML format with read_first, files, acceptance_criteria, verify (with `<automated>` child), and done fields (MANDATORY on every task)
112
112
  - Verification criteria
113
113
  - must_haves for goal-backward verification
114
+ - **`## Files Touched`** section (see below) — required on every SPRINT.md
115
+
116
+ ### Required: ## Files Touched Section
117
+
118
+ Every SPRINT.md must end with a `## Files Touched` section that the planner populates:
119
+
120
+ ```markdown
121
+ ## Files Touched
122
+
123
+ **Creates:**
124
+ - `exact/path/to/new/file.ts` — [one-line responsibility]
125
+
126
+ **Modifies:**
127
+ - `exact/path/to/existing.ts` — [what changes]
128
+
129
+ **Tests:**
130
+ - `tests/exact/path/test.ts` — [tests for]
131
+
132
+ **Aggregator files (append-only):**
133
+ - `packages/shared/src/index.ts` — adds export for Foo, Bar
134
+ ```
135
+
136
+ This section is read by the wave-overlap checker and by human reviewers to quickly audit
137
+ cross-sprint file ownership before merging. If a file appears in `## Files Touched` for two
138
+ plans in the same wave, the later plan must declare `sequential: true`.
114
139
  </downstream_consumer>
115
140
 
116
141
  <deep_work_rules>
@@ -133,6 +158,72 @@ Rules:
133
158
  - This map is what informs task decomposition — each task should produce self-contained changes
134
159
  - In existing codebases: follow established patterns; only restructure files if a file is genuinely unwieldy and the split is included as its own task
135
160
 
161
+ ## File-Ownership & Conflict-Avoidance (MANDATORY)
162
+
163
+ **Evidence from overnight parallel builds (calorie-calculator-ai, 2026-05-26):**
164
+ - Sprints 1-2 and 3-1 both created `diary.py` with divergent content — 3-1's mock-history
165
+ endpoints were silently lost at merge.
166
+ - Sprints 3-3 and 3-4 both created `HistoryScreen.tsx` — collision required manual triage.
167
+ - Sprints 1-4 and 1-5 both created `CalorieRing`, `MealSlotCard`, and related components.
168
+ - `packages/shared/src/index.ts` was modified by 4 independent sprints — every merge required
169
+ conflict resolution.
170
+ - Wave-4 executors stubbed missing deps locally while master had an unmerged upstream; the
171
+ stubs collided with canonical implementations at merge.
172
+
173
+ ### Cross-Sprint File Manifest (produce before task decomposition)
174
+
175
+ After the File Structure Map, build a cross-sprint ownership table:
176
+
177
+ ```
178
+ CROSS-SPRINT FILE MANIFEST:
179
+ Sprint 1: creates [path/a.ts, path/b.ts] modifies [path/c.ts]
180
+ Sprint 2: creates [path/d.ts] modifies [path/c.ts] ← OVERLAP on path/c.ts
181
+ Sprint 3: creates [path/b.ts] modifies [] ← COLLISION — b.ts in sprint 1 too
182
+ ...
183
+ OWNERSHIP ASSIGNMENTS:
184
+ path/c.ts — sprint 1 writes canonical, sprint 2 must be sequential_after: 1
185
+ path/b.ts — DEFECT: only one sprint may create a file; merge or sequence
186
+ ```
187
+
188
+ **Rules:**
189
+ - Only ONE sprint may _create_ a given file. Two sprints creating the same file is a plan defect — either merge the tasks into one sprint or sequence them and have the later sprint extend (not recreate).
190
+ - If two sprints in the same wave both _modify_ the same file, the later sprint MUST have `sequential: true` and `sequential_after: <earlier_sprint_id>` in its frontmatter.
191
+ - Frontmatter `files_modified:` must list ALL files from `<files>` blocks — this is the source-of-truth for the executor's intra-wave overlap checker.
192
+
193
+ ### Aggregator-File Rule
194
+
195
+ These files are known aggregators — multiple sprints always want to add to them:
196
+
197
+ | Pattern | Examples |
198
+ |---------|---------|
199
+ | Barrel exports | `**/index.ts`, `**/index.tsx` |
200
+ | State store | `**/store/index.ts`, `**/store/index.js` |
201
+ | Types barrel | `**/types/index.ts`, `**/types.ts` |
202
+ | Python entrypoints | `main.py`, `app.py`, `router/__init__.py`, `**/__init__.py` |
203
+ | Package manifest | `package.json` (scripts / deps blocks) |
204
+
205
+ **Hard rule:** For aggregator files, the `<action>` block MUST say:
206
+
207
+ > "Append to existing exports — do NOT overwrite or replace the full file. Use `Edit`
208
+ > (old_string / new_string) with a targeted insertion. Preserve all existing content."
209
+
210
+ Never use `Write` on an aggregator file in a plan that other sprints also touch.
211
+
212
+ ### Verify-Command Accuracy
213
+
214
+ In every `<verify><automated>` block, prefer `pnpm run <script>` over raw tool invocations
215
+ to avoid the mismatch where the planner writes `tsc --noEmit` but the project calls it `type-check`:
216
+
217
+ | Raw invocation (avoid) | pnpm script form (prefer) |
218
+ |------------------------|--------------------------|
219
+ | `tsc --noEmit` | `pnpm run type-check` or `pnpm run typecheck` |
220
+ | `eslint .` | `pnpm run lint` |
221
+ | `jest` / `vitest` | `pnpm run test` |
222
+ | `python -m pytest` | check `pyproject.toml` for script alias |
223
+
224
+ Check `package.json` scripts before writing a verify command. If `package.json` is not yet
225
+ read, add it to `<read_first>` for any task that writes a verify command.
226
+
136
227
  ## No-Placeholders Rule (HARD BLOCKER)
137
228
 
138
229
  Every step must contain the actual content the executor needs. These are **plan failures** — never write them:
@@ -217,9 +308,14 @@ Every task MUST include these fields — they are NOT optional:
217
308
 
218
309
  <quality_gate>
219
310
  - [ ] File structure map written before first task (files_to_create / files_to_modify / files_for_tests)
311
+ - [ ] Cross-sprint file manifest built — no file in 2+ same-wave sprints without `sequential: true`
312
+ - [ ] No file created by more than one sprint (creation collision = plan defect)
313
+ - [ ] Aggregator files (index.ts, __init__.py, main.py, package.json, etc.) use append-only `Edit`, not `Write`
314
+ - [ ] Verify commands use `pnpm run <script>` not raw tool invocations (tsc, eslint, jest)
220
315
  - [ ] No placeholder patterns: no TBD/TODO/implement-later, no "similar to Task N", no code steps without code
221
316
  - [ ] SPRINT.md files created in phase directory
222
317
  - [ ] Each plan has valid frontmatter including `files_modified:` array aggregating all `<files>` paths across tasks (consumed by execute.md intra-wave overlap checker)
318
+ - [ ] Each plan's `## Files Touched` section populated with create/modify/test lists
223
319
  - [ ] Tasks are specific and actionable
224
320
  - [ ] Every task has `<read_first>` with at least the file being modified
225
321
  - [ ] Every task has `<files>` listing exact files this task will modify or create
@@ -460,6 +460,73 @@ Proceed to Step 8 only if user selects 2 or 3.
460
460
 
461
461
  @.rcode/workflows/plan-spawn-planner.md
462
462
 
463
+ ## 8.5. File-Ownership & Conflict-Avoidance
464
+
465
+ After the planner returns SPRINT.md files, run these checks before advancing to step 9.
466
+ These rules were added after overnight parallel builds exposed silent merge-time data loss
467
+ (calorie-calculator-ai, 2026-05-26). The wave-overlap CLI check in step 12.5 catches
468
+ same-wave/same-file issues mechanically; this step catches plan-level ownership gaps earlier.
469
+
470
+ **Step 1 — Build the cross-sprint file manifest.**
471
+
472
+ Read each SPRINT.md produced this run and collect its `files_modified:` frontmatter list.
473
+ Produce a de-duplicated map: `file → [sprint_ids that touch it]`.
474
+
475
+ ```bash
476
+ # Quick grep of frontmatter to build the manifest
477
+ grep -A 50 "^files_modified:" "${PHASE_DIR}"/*-SPRINT.md 2>/dev/null
478
+ ```
479
+
480
+ **Step 2 — Flag collisions.**
481
+
482
+ For each file that appears in 2+ sprint lists:
483
+
484
+ | Type | Rule |
485
+ |------|------|
486
+ | Two sprints **create** the same file | Plan defect — merge tasks or sequence; only one sprint may create a file |
487
+ | Two same-wave sprints **modify** the same file | Later sprint MUST have `sequential: true` + `sequential_after:` in frontmatter |
488
+ | An aggregator file touched by multiple sprints | Each sprint's `<action>` must use append-only `Edit`, not `Write` |
489
+
490
+ Aggregator patterns (known high-collision targets):
491
+ - `**/index.ts`, `**/index.tsx` (barrel exports)
492
+ - `**/store/index.ts`, `**/store/index.js`
493
+ - `**/types/index.ts`, `**/types.ts`
494
+ - `main.py`, `app.py`, `router/__init__.py`, `**/__init__.py`
495
+ - `package.json` (scripts / deps blocks)
496
+
497
+ **Step 3 — Verify-command accuracy.**
498
+
499
+ Scan every `<verify><automated>` block for raw tool invocations (`tsc --noEmit`, `eslint .`,
500
+ `jest`, `vitest`). If found, check `package.json` scripts and replace with the `pnpm run <script>`
501
+ equivalent. Mismatch example from overnight build: plan wrote `tsc --noEmit` but the project's
502
+ script was named `type-check`.
503
+
504
+ **Step 4 — Report and gate.**
505
+
506
+ If any creation collision found → **BLOCK plan acceptance**. Edit the colliding sprint to remove
507
+ the duplicate creation task (have the second sprint import/extend from the first sprint's output).
508
+
509
+ If any modify-collision found in the same wave → edit the later sprint's frontmatter immediately:
510
+ ```yaml
511
+ sequential: true
512
+ sequential_after: <earlier_sprint_id>
513
+ conflicting_files: [<shared_files...>]
514
+ ```
515
+
516
+ Display a summary:
517
+ ```
518
+ File-Ownership Check:
519
+ ✓ N files with single owner
520
+ ⚠ M aggregator files — append-only instructions verified
521
+ ✗ K creation collisions (blocked — fixed inline)
522
+ ~ J sequential flags added
523
+ ```
524
+
525
+ If no issues: `File-Ownership Check: ✓ no collisions.`
526
+
527
+ **This check is informational for warnings and blocking for creation collisions.**
528
+ It never silently passes a plan where two sprints create the same file.
529
+
463
530
  ## 9. Handle Planner Return
464
531
 
465
532
  - **`## PLANNING COMPLETE`:** Display plan count. If `--skip-verify` or `plan_checker_enabled` is false (from init): skip to step 13. Otherwise: step 10.
@@ -9,7 +9,11 @@ Run an epic retrospective and produce owned action items. Delegates to the rcode
9
9
  Locate and follow the installed skill:
10
10
 
11
11
  ```bash
12
- find .rcode/skills/actions -path "*rcode-retrospective/workflow.md" 2>/dev/null | head -1
12
+ if [ -f .rcode/skills/rcode-retrospective/workflow.md ]; then
13
+ printf '%s\n' ".rcode/skills/rcode-retrospective/workflow.md"
14
+ else
15
+ find .rcode/skills/actions -path "*rcode-retrospective/workflow.md" 2>/dev/null | head -1
16
+ fi
13
17
  ```
14
18
 
15
19
  Read and follow the workflow at that path. If the path is empty:
@@ -14,8 +14,9 @@ back to the in-line implementation.
14
14
 
15
15
  <delegate_to_skill>
16
16
  Required skill: `rcode-sprint-planning`
17
- Path: `.claude/skills/rcode-sprint-planning/SKILL.md`
18
- Workflow ref: `.claude/skills/rcode-sprint-planning/workflow.md`
17
+ Path: `.rcode/skills/rcode-sprint-planning/SKILL.md`
18
+ Workflow ref: `.rcode/skills/rcode-sprint-planning/workflow.md`
19
+ Fallback path: `.claude/skills/rcode-sprint-planning/SKILL.md`
19
20
 
20
21
  Behaviour:
21
22
  1. Load the skill's `SKILL.md` and `workflow.md`. Apply every Critical
@@ -99,8 +100,9 @@ Exit.
99
100
  - Commit max 80% of average (buffer for interrupts + unknowns)
100
101
 
101
102
  **If no velocity history (first sprint):**
102
- - Ask user: "This is your first sprint. How many story points can you commit to? (Typical: 8-13 for solo dev + AI)"
103
- - Or use `--velocity` flag
103
+ - If `--velocity <N>` flag was supplied, use that value directly and skip the prompt.
104
+ - If `mode == "yolo"` (config) and no `--velocity` flag, default to 10 points and proceed.
105
+ - Otherwise ask user: "This is your first sprint. How many story points can you commit to? (Typical: 8-13 for solo dev + AI)"
104
106
 
105
107
  Store as `velocity_target`.
106
108
 
@@ -127,7 +129,9 @@ Present story table to user:
127
129
  **Capacity check:** Total committed points <= velocity_target.
128
130
  If over: "We're at {N} points vs {target} capacity. Move story #{X} to next sprint?"
129
131
 
130
- Wait for user confirmation before proceeding.
132
+ **Automation escape:** if `mode == "yolo"` or `--auto` flag was passed, skip the
133
+ confirmation; automatically move lowest-priority over-capacity stories to backlog
134
+ and proceed. Otherwise wait for user confirmation before proceeding.
131
135
 
132
136
  ## Step 4 — Create sprint
133
137
 
@@ -17,7 +17,7 @@
17
17
  * server/lib/html/client.js - Client-side JS (routing, rendering, etc.)
18
18
  *
19
19
  * Run: node server/dashboard.js
20
- * Stop: kill $(lsof -t -i:7717)
20
+ * Stop: kill $(ss -ltnp 'sport = :7717' | awk 'NR>1{match($6,/pid=([0-9]+)/,m); print m[1]}')
21
21
  */
22
22
 
23
23
  const http = require('http');
@@ -145,7 +145,7 @@ server.listen(PORT, '127.0.0.1', () => {
145
145
  console.log(` Scanning: ${RCODE_DIR}`);
146
146
  console.log(` Refresh: 30s soft poll`);
147
147
  console.log(` Keys: R=refresh 1-9=views F=filter`);
148
- console.log(` Stop: kill $(lsof -t -i:${PORT})`);
148
+ console.log(` Stop: kill $(ss -ltnp 'sport = :${PORT}' | awk 'NR>1{match($6,/pid=([0-9]+)/,m); print m[1]}')`);
149
149
  console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
150
150
  });
151
151