@hanzlaa/rcode 4.1.0 → 4.1.2

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 (53) hide show
  1. package/AGENTS.md +1 -1
  2. package/CONTRIBUTING.md +3 -0
  3. package/README.md +3 -0
  4. package/cli/agent.js +3 -1
  5. package/cli/index.js +45 -0
  6. package/cli/install.js +59 -3
  7. package/cli/workflow.js +99 -0
  8. package/dist/rcode.js +215 -187
  9. package/package.json +1 -1
  10. package/rcode/bin/lib/config.cjs +3 -2
  11. package/rcode/bin/rcode-tools.cjs +23 -9
  12. package/rcode/commands/scaffold-project.md +2 -2
  13. package/rcode/skills/actions/2-plan/rcode-create-epics-and-stories/steps/step-04-final-validation.md +1 -1
  14. package/rcode/skills/actions/2-plan/rcode-create-milestone/steps/README.md +2 -2
  15. package/rcode/skills/actions/2-plan/rcode-create-milestone/steps/step-09-state-sync.md +1 -1
  16. package/rcode/skills/actions/3-solutioning/rcode-create-architecture/steps/step-01-init.md +1 -1
  17. package/rcode/skills/actions/3-solutioning/rcode-create-architecture/workflow.md +13 -1
  18. package/rcode/skills/actions/4-implementation/rcode-code-review/steps/step-02-review.md +1 -1
  19. package/rcode/skills/actions/4-implementation/rcode-git-flow/SKILL.md +1 -1
  20. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/SKILL.md +5 -1
  21. package/rcode/skills/actions/4-implementation/rcode-retrospective/workflow.md +61 -246
  22. package/rcode/skills/actions/4-implementation/rcode-scaffold-project/SKILL.md +39 -12
  23. package/rcode/skills/actions/4-implementation/rcode-scaffold-project/steps/step-01-target.md +18 -3
  24. package/rcode/skills/actions/4-implementation/rcode-scaffold-project/steps/step-02-safety.md +27 -3
  25. package/rcode/skills/actions/4-implementation/rcode-scaffold-project/steps/step-03-brownfield.md +57 -0
  26. package/rcode/skills/actions/4-implementation/rcode-scaffold-project/steps/step-03-clone.md +4 -1
  27. package/rcode/skills/actions/4-implementation/rcode-scaffold-project/steps/step-04-post-setup.md +15 -1
  28. package/rcode/skills/actions/4-implementation/rcode-trim/SKILL.md +1 -1
  29. package/rcode/workflows/audit-milestone.md +1 -1
  30. package/rcode/workflows/audit.md +3 -0
  31. package/rcode/workflows/brainstorm.md +1 -1
  32. package/rcode/workflows/council.md +8 -1
  33. package/rcode/workflows/create-architecture.md +5 -1
  34. package/rcode/workflows/create-prd.md +5 -1
  35. package/rcode/workflows/dashboard.md +5 -2
  36. package/rcode/workflows/discuss-phase.md +4 -16
  37. package/rcode/workflows/execute-milestone.md +1 -1
  38. package/rcode/workflows/execute-regression-gates.md +3 -0
  39. package/rcode/workflows/execute-sprint.md +30 -2
  40. package/rcode/workflows/execute-waves.md +6 -0
  41. package/rcode/workflows/execute.md +13 -3
  42. package/rcode/workflows/new-milestone.md +2 -2
  43. package/rcode/workflows/new-project.md +4 -0
  44. package/rcode/workflows/plan-research-validation.md +1 -1
  45. package/rcode/workflows/plan-spawn-planner.md +2 -2
  46. package/rcode/workflows/plan.md +34 -15
  47. package/rcode/workflows/retrospective.md +5 -1
  48. package/rcode/workflows/review.md +2 -0
  49. package/rcode/workflows/scaffold-project.md +5 -1
  50. package/rcode/workflows/session-report.md +1 -1
  51. package/rcode/workflows/ship.md +39 -0
  52. package/rcode/workflows/sprint-planning.md +36 -5
  53. package/rcode/workflows/status.md +3 -3
@@ -64,6 +64,20 @@ Valid rcode subagent types (use exact names — do not fall back to 'general-pur
64
64
 
65
65
  <process>
66
66
 
67
+ ## 0. Project-Status Preflight
68
+
69
+ ```bash
70
+ PROJECT_STATUS=$(node .rcode/bin/rcode-tools.cjs project-status 2>/dev/null || echo uninitialized)
71
+ ```
72
+
73
+ If `PROJECT_STATUS` is `uninstalled`, `uninitialized`, or `stub`:
74
+
75
+ ```
76
+ Project not initialized. Run /rcode-init first (or /rcode-new-project for a greenfield project), then return here.
77
+ ```
78
+
79
+ Stop. Do not proceed until `project-status` returns `real`.
80
+
67
81
  ## 1. Initialize
68
82
 
69
83
  Load all context in one call (paths only to minimize orchestrator context):
@@ -117,7 +131,7 @@ fi
117
131
 
118
132
  When `GAPS_MODE=true`, the workflow switches to **gap-closure planning**: read the phase's VERIFICATION.md, extract verification gaps classified `gap_found` or `partial`, and produce a single new numbered plan file (`NNN-NN-SPRINT.md`) that closes them. Research, CONTEXT.md gating, and VALIDATION.md creation are skipped — gaps are grounded in already-shipped code, not new design work.
119
133
 
120
- **Detect from-stub mode (closes #736):**
134
+ **Detect from-stub mode:**
121
135
  ```bash
122
136
  if [[ "$ARGUMENTS" =~ (^|[[:space:]])--from-stub($|[[:space:]]) ]]; then
123
137
  FROM_STUB_MODE=true
@@ -154,7 +168,7 @@ mkdir -p ".planning/phases/${padded_phase}-${phase_slug}"
154
168
 
155
169
  **Existing artifacts from init:** `has_research`, `has_plans`, `plan_count`.
156
170
 
157
- **TASKS.md ingestion (#385 chain).** If the phase directory contains a `TASKS.md` file (typically auto-extracted by `/rcode-add-phase` from a bulk `/rcode-quick` or `/rcode-do` route), read it now:
171
+ **TASKS.md ingestion.** If the phase directory contains a `TASKS.md` file (typically auto-extracted by `/rcode-add-phase` from a bulk `/rcode-quick` or `/rcode-do` route), read it now:
158
172
 
159
173
  ```bash
160
174
  TASKS_FILE=".planning/phases/${padded_phase}-${phase_slug}/TASKS.md"
@@ -187,6 +201,12 @@ Exit workflow.
187
201
  ## 3. Validate Phase
188
202
 
189
203
  ```bash
204
+ # Stub-ROADMAP guard — emit a warning if ROADMAP.md has no real phase headings.
205
+ ROADMAP_PHASE_COUNT=$(grep -c "^## Phase " "${ROADMAP_PATH}" 2>/dev/null || echo 0)
206
+ if [ "${ROADMAP_PHASE_COUNT}" -eq 0 ]; then
207
+ echo "⚠ WARN: ROADMAP.md appears to be a stub — add real ## Phase headings before running plan."
208
+ exit 1
209
+ fi
190
210
  PHASE_INFO=$(node ".rcode/bin/rcode-tools.cjs" roadmap get-phase "${PHASE}")
191
211
  ```
192
212
 
@@ -326,7 +346,7 @@ Otherwise use AskUserQuestion:
326
346
  If "Continue without context": Proceed to step 5.
327
347
  If "Run discuss-phase first":
328
348
  **IMPORTANT:** Do NOT invoke discuss-phase as a nested Skill/Task call — AskUserQuestion
329
- does not work correctly in nested subcontexts (#1009). Instead, display the command
349
+ does not work correctly in nested subcontexts. Instead, display the command
330
350
  and exit so the user runs it as a top-level command:
331
351
  ```
332
352
  Run this command first, then re-run /rcode-plan {X} ${RCODE_WS}:
@@ -362,7 +382,7 @@ Always offer exactly three numbered options:
362
382
 
363
383
  Wait for the user's choice before proceeding. Do not auto-select.
364
384
 
365
- **If user picks option 1 (Add more plans) — issue #650:**
385
+ **If user picks option 1 (Add more plans):**
366
386
 
367
387
  This is **NOT** a license to hand-write a new SPRINT.md inline. Continue down the
368
388
  normal pipeline exactly as if no plans existed yet:
@@ -376,8 +396,7 @@ normal pipeline exactly as if no plans existed yet:
376
396
  first-time plan. The "PLANNED ✓" banner is gated on a passing CHECK.md.
377
397
 
378
398
  A run that emits a SPRINT.md without a corresponding planner Task() invocation
379
- in the same turn is a malfunction — see issue #650. Stop and report instead of
380
- shipping a hand-rolled plan.
399
+ in the same turn is a malfunction. Stop and report instead of shipping a hand-rolled plan.
381
400
 
382
401
  **If user picks option 3 (Replan from scratch):**
383
402
 
@@ -390,7 +409,7 @@ still mandatory.
390
409
 
391
410
  Display a sprint summary table (sprint id → one-line goal).
392
411
 
393
- Then run a **best-effort codebase overlap check** before showing the execute prompt — Closes #596.
412
+ Then run a **best-effort codebase overlap check** before showing the execute prompt.
394
413
 
395
414
  **This check is always informational. It never blocks, never errors, never fails the workflow.** If any step below cannot complete for any reason, skip it silently and proceed straight to the execute prompt.
396
415
 
@@ -534,7 +553,7 @@ It never silently passes a plan where two sprints create the same file.
534
553
  - **`## CHECKPOINT REACHED`:** Present to user, get response, spawn continuation (step 12)
535
554
  - **`## PLANNING INCONCLUSIVE`:** Show attempts, offer: Add context / Retry / Manual
536
555
 
537
- **Sprint count guard (token cost protection — closes #584):**
556
+ **Sprint count guard (token cost protection):**
538
557
 
539
558
  After planner returns `## PLANNING COMPLETE`, immediately count sprint files:
540
559
 
@@ -670,7 +689,7 @@ If thinking_partner disabled: skip this block entirely.
670
689
 
671
690
  ## 12. Revision Loop (Max 3 Iterations, 1 in autonomous/yolo mode)
672
691
 
673
- **Mode-based iteration cap (token cost protection — closes #585):**
692
+ **Mode-based iteration cap (token cost protection):**
674
693
 
675
694
  ```bash
676
695
  MAX_ITERATIONS=$($TOOL config-get workflow.max_checker_iterations 2>/dev/null || echo "")
@@ -686,7 +705,7 @@ Track `stall_reentry_count` (starts at 0; incremented each time "Adjust approach
686
705
 
687
706
  **If iteration_count < MAX_ITERATIONS:**
688
707
 
689
- **Sprint-checker malfunction guard (BLOCKER-class — added in v3.1.0 after #440):**
708
+ **Sprint-checker malfunction guard (BLOCKER-class):**
690
709
 
691
710
  Before parsing issues, verify the checker actually invoked tools. The checker MUST exhibit at least one of these evidence markers in its return:
692
711
 
@@ -695,11 +714,11 @@ Before parsing issues, verify the checker actually invoked tools. The checker MU
695
714
  - At least one `path:` field in any block (e.g. `path: src/components/Foo.tsx:42`)
696
715
  - A summary line of the form `Verified N of M files` or `Checked N symbols`
697
716
 
698
- If NONE of these evidence markers are present, the checker malfunctioned (returned narrative without invoking tools — see #440). BLOCK execution:
717
+ If NONE of these evidence markers are present, the checker malfunctioned (returned narrative without invoking tools). BLOCK execution:
699
718
 
700
719
  ```
701
720
  Display: "Sprint-checker returned without evidence of tool use — likely
702
- malfunctioned (cf. issue #440). Refusing to advance the plan
721
+ malfunctioned (returned narrative without tool use). Refusing to advance the plan
703
722
  on unverified output. Re-run /rcode-plan or inspect the agent."
704
723
  Halt the workflow with a non-zero exit signal.
705
724
  ```
@@ -771,7 +790,7 @@ Display: `Max iterations reached. {N} issues remain:` + issue list
771
790
 
772
791
  Offer: 1) Force proceed, 2) Provide guidance and retry, 3) Abandon
773
792
 
774
- ## 12.5. Wave Parallelism File-Overlap Check (added in v3.1.0 after #442)
793
+ ## 12.5. Wave Parallelism File-Overlap Check
775
794
 
776
795
  Before declaring plans ready, validate the wave-parallelism rule the planner declares: **same wave + overlapping `files_modified` = sequential, not parallel**. If two plans share `depends_on` (same wave) and both list the same file in `files_modified`, the planner should have marked the later one `sequential: true`. Catch the cases where it didn't.
777
796
 
@@ -814,7 +833,7 @@ The CLI helper returns a JSON report:
814
833
 
815
834
  **If `conflicts` is empty:** Display `Wave parallelism: ✓ no file-overlap conflicts.` and proceed.
816
835
 
817
- This closes the gap from #442 — the rule was stated in `rcode-planner.md` but not enforced. Now it's enforced automatically.
836
+ This closes the wave-overlap gap — the rule was stated in `rcode-planner.md` but not enforced. Now it's enforced automatically.
818
837
 
819
838
  ## 13. Requirements Coverage Gate
820
839
 
@@ -948,7 +967,7 @@ Route to `<offer_next>` (existing behavior).
948
967
  </process>
949
968
 
950
969
  <banner_emission_gate>
951
- Issue #655 — the success banner is gated on real verification, not vibes.
970
+ The success banner is gated on real verification, not vibes.
952
971
  Before emitting `PLANNED ✓`, confirm one of these is true:
953
972
 
954
973
  1. A passing CHECK.md exists at `${PHASE_DIR}/*-CHECK.md` from rcode-sprint-checker
@@ -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:
@@ -82,6 +82,8 @@ Error: rcode-tools init failed. Verify .rcode/ is installed and state.json is va
82
82
 
83
83
  Read from init: `phase_dir`, `phase_number`, `padded_phase`.
84
84
 
85
+ If `phase_dir` is null or empty, STOP and tell the user: "Phase directory not found on disk. Create the phase directory under `.planning/phases/` first (e.g. `mkdir -p .planning/phases/1-name`), then re-run."
86
+
85
87
  Then read:
86
88
  1. `.planning/PROJECT.md` (first 80 lines — project context)
87
89
  2. Phase section from `.planning/ROADMAP.md`
@@ -1,7 +1,11 @@
1
1
  # Workflow: rcode-scaffold-project
2
2
 
3
3
  <purpose>
4
- Scaffold a new project from the official rcode template repo. Delegates to the rcode-scaffold-project skill.
4
+ Scaffold a new project from the official rcode template repo, or initialize rcode
5
+ in an existing project (brownfield mode). Delegates to the rcode-scaffold-project skill.
6
+
7
+ Use `--here` (or say "scaffold here") to add rcode to an existing directory without
8
+ cloning the template. Existing files are never modified in brownfield mode.
5
9
  </purpose>
6
10
 
7
11
  ## Execution
@@ -79,7 +79,7 @@ Extract counts:
79
79
 
80
80
  ### Step 5a — Prefer measured totals from cost.jsonl
81
81
 
82
- If the `cost-track` hook (#745) is enabled, it appends one usage record per
82
+ If the `cost-track` hook is enabled, it appends one usage record per
83
83
  response to `.rcode/telemetry/cost.jsonl`. Check for it first:
84
84
 
85
85
  ```bash
@@ -34,6 +34,45 @@ the plan → execute → verify → **ship** loop.
34
34
  ```
35
35
  </purpose>
36
36
 
37
+ <prerequisites>
38
+
39
+ **Required before running `/rcode-ship`:**
40
+
41
+ 1. **Git remote configured** — `git remote -v` must list at least one remote (typically `origin`). Without a remote, the push and PR steps will fail.
42
+ 2. **`gh` CLI authenticated** — `gh auth status` must succeed. Without this, PR creation will fail.
43
+ 3. **Clean working tree** — no uncommitted changes (`git status --short` returns nothing).
44
+ 4. **On a feature branch** — not on `main` or `develop` directly.
45
+ 5. **Verification passed** — `/rcode-verify-phase <phase>` must have run and produced a VERIFICATION.md with `status: passed`.
46
+
47
+ </prerequisites>
48
+
49
+ <warning>
50
+
51
+ **If your workspace has no git remote or `gh` is not authenticated, the push and PR steps will fail.**
52
+
53
+ Check before running:
54
+ ```bash
55
+ git remote -v # must list at least one remote
56
+ gh auth status # must exit 0
57
+ ```
58
+
59
+ **Manual fallbacks if these are missing:**
60
+
61
+ - **No remote:** Add one with `git remote add origin <repo-url>`, then re-run `/rcode-ship`. Or push manually:
62
+ ```bash
63
+ git push origin <branch>
64
+ ```
65
+ Then open a PR via the GitHub web UI at `https://github.com/<owner>/<repo>/compare/<branch>`.
66
+
67
+ - **`gh` not authenticated:** Run `gh auth login` to authenticate, then re-run `/rcode-ship`. Or create the PR directly at:
68
+ ```
69
+ https://github.com/<owner>/<repo>/compare/<branch>
70
+ ```
71
+
72
+ - **Git worktree context:** If `.git` is a file (not a directory), you are in a worktree. Remotes are shared with the main repo — run `git remote -v` from the main repo root to verify. If the main repo has `origin`, the worktree inherits it automatically.
73
+
74
+ </warning>
75
+
37
76
  <required_reading>
38
77
  Read all files referenced by the invoking prompt's execution_context before starting.
39
78
  </required_reading>
@@ -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
@@ -72,6 +73,33 @@ If `$ARGUMENTS` contains `--help` or `-h`:
72
73
 
73
74
  STOP — do not proceed.
74
75
 
76
+ ## Preflight — Project-status check
77
+
78
+ ```bash
79
+ PROJECT_STATUS=$(node .rcode/bin/rcode-tools.cjs project-status 2>/dev/null || echo uninitialized)
80
+ ```
81
+
82
+ If `PROJECT_STATUS` is `uninstalled`, `uninitialized`, or `stub`:
83
+
84
+ ```
85
+ Project not initialized. Run /rcode-init first (or /rcode-new-project for a greenfield project), then return here.
86
+ ```
87
+
88
+ Stop. Do not proceed until `project-status` returns `real`.
89
+
90
+ ## Preflight — Dependency check
91
+
92
+ If a `package.json` exists in the project root but `node_modules/` is absent or empty, emit a WARNING before planning begins:
93
+
94
+ ```
95
+ ⚠ WARNING: package.json found but node_modules/ is missing or empty.
96
+ Run: pnpm install (or npm install if pnpm is not available)
97
+ Sprint planning can continue, but the resulting sprint tasks will fail at execution time
98
+ unless dependencies are installed first.
99
+ ```
100
+
101
+ Do NOT auto-run the install. Emit the message and let the user decide.
102
+
75
103
  ## Step 1 — Load context
76
104
 
77
105
  ```bash
@@ -99,8 +127,9 @@ Exit.
99
127
  - Commit max 80% of average (buffer for interrupts + unknowns)
100
128
 
101
129
  **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
130
+ - If `--velocity <N>` flag was supplied, use that value directly and skip the prompt.
131
+ - If `mode == "yolo"` (config) and no `--velocity` flag, default to 10 points and proceed.
132
+ - Otherwise ask user: "This is your first sprint. How many story points can you commit to? (Typical: 8-13 for solo dev + AI)"
104
133
 
105
134
  Store as `velocity_target`.
106
135
 
@@ -127,7 +156,9 @@ Present story table to user:
127
156
  **Capacity check:** Total committed points <= velocity_target.
128
157
  If over: "We're at {N} points vs {target} capacity. Move story #{X} to next sprint?"
129
158
 
130
- Wait for user confirmation before proceeding.
159
+ **Automation escape:** if `mode == "yolo"` or `--auto` flag was passed, skip the
160
+ confirmation; automatically move lowest-priority over-capacity stories to backlog
161
+ and proceed. Otherwise wait for user confirmation before proceeding.
131
162
 
132
163
  ## Step 4 — Create sprint
133
164
 
@@ -1,7 +1,7 @@
1
1
  # Workflow: rcode-status
2
2
 
3
3
  <purpose>
4
- Render a human-readable project status dashboard. All data comes from a single `rcode-tools progress init` call — this workflow does NOT parse ROADMAP.md, walk SUMMARY.md files, or grep state.json itself. Rendering only. See `rcode-tools.cjs` `cmdProgress` for the source-of-truth logic (issue #159 M2.5).
4
+ Render a human-readable project status dashboard. All data comes from a single `rcode-tools progress init` call — this workflow does NOT parse ROADMAP.md, walk SUMMARY.md files, or grep state.json itself. Rendering only. See `rcode-tools.cjs` `cmdProgress` for the source-of-truth logic.
5
5
 
6
6
  **SSOT:** `.rcode/state.json`. `/rcode-status` and `/rcode-progress` both call the same CLI so they cannot disagree. If the CLI reports a drift insight, surface it — do not silently compensate.
7
7
  </purpose>
@@ -53,7 +53,7 @@ Then stop.
53
53
  If `SNAPSHOT.weighted_progress > 0` but `SNAPSHOT.completed_count === 0`, display
54
54
  the weighted bar as the primary progress indicator to avoid a misleading `0/N (0%)`.
55
55
 
56
- ### Milestone health (issue #718)
56
+ ### Milestone health
57
57
 
58
58
  After the main dashboard, call `rcode-tools milestone-health` and surface
59
59
  a gauge when the milestone is full:
@@ -108,7 +108,7 @@ Phases:
108
108
 
109
109
  If a phase number starts with `999.`, render with a `🅿` marker and the label `(parking lot)`.
110
110
 
111
- ## Step 4 — Insights (NEW — issue #159)
111
+ ## Step 4 — Insights
112
112
 
113
113
  If `SNAPSHOT.insights[]` is non-empty, print above the Next Up section:
114
114