@hanzlaa/rcode 4.12.1 → 4.13.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 (54) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +1 -1
  3. package/CONTRIBUTING.md +1 -0
  4. package/cli/doctor.js +40 -5
  5. package/cli/install.js +6 -1
  6. package/dist/rcode.js +87 -87
  7. package/package.json +1 -1
  8. package/rcode/agents/rcode-hussain-pm.md +37 -3
  9. package/rcode/agents/rcode-orchestrator.md +91 -0
  10. package/rcode/agents/rules/executor/correctness-hazard-scan.md +98 -0
  11. package/rcode/agents/rules/executor/execution-flow.md +8 -0
  12. package/rcode/agents/rules/executor/self-check.md +8 -0
  13. package/rcode/agents/rules/orchestrator/contract.md +76 -0
  14. package/rcode/agents/rules/sprint-checker/dimensions.md +38 -0
  15. package/rcode/agents/rules/verifier/reachability-check.md +45 -2
  16. package/rcode/bin/lib/progress.cjs +41 -13
  17. package/rcode/bin/lib/state-digest.cjs +88 -0
  18. package/rcode/bin/rcode-hooks.cjs +192 -23
  19. package/rcode/bin/rcode-tools.cjs +94 -4
  20. package/rcode/references/REFERENCES_INDEX.md +3 -1
  21. package/rcode/references/agent-shared-rules.md +87 -0
  22. package/rcode/references/code-reviewer-playbook.md +5 -0
  23. package/rcode/references/executor-playbook.md +2 -0
  24. package/rcode/references/github-comment-style.md +57 -0
  25. package/rcode/references/persona-executor-mode.md +61 -0
  26. package/rcode/references/response-style.md +21 -4
  27. package/rcode/references/verifier-playbook.md +14 -0
  28. package/rcode/skills/SKILLS_INDEX.md +1 -1
  29. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/references.md +7 -0
  30. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/rules/merge-strategy.md +19 -3
  31. package/rcode/skills/actions/4-implementation/rcode-herdr-orchestration/templates/wave-prompt.md +3 -1
  32. package/rcode/skills/agents/{raees-orchestrator → orchestrator}/SKILL.md +1 -1
  33. package/rcode/team.yaml +20 -1
  34. package/rcode/workflows/audit-worktrees.md +15 -1
  35. package/rcode/workflows/execute-verify-phase-goal.md +58 -2
  36. package/rcode/workflows/execute.md +37 -8
  37. package/rcode/workflows/plan-research-validation.md +8 -2
  38. package/rcode/workflows/plan-spawn-planner.md +32 -4
  39. package/rcode/workflows/plan.md +138 -10
  40. package/rcode/workflows/pr-branch.md +2 -0
  41. package/rcode/workflows/research-phase.md +12 -4
  42. package/rcode/workflows/ship.md +4 -0
  43. package/rcode/workflows/verify-phase.md +40 -0
  44. package/server/dashboard.js +57 -17
  45. package/server/lib/html/client/components/OrchPanel.js +6 -2
  46. package/server/lib/html/client/components/XtermPanel.js +7 -2
  47. package/server/lib/html/client/orchestrator.js +58 -21
  48. package/server/lib/html/client/views/MemoryView.js +59 -3
  49. package/server/lib/html/css.js +40 -0
  50. package/server/lib/html/shell.js +10 -4
  51. package/server/lib/scanner.js +150 -3
  52. package/server/lib/view-only.js +32 -0
  53. package/server/orchestrator.js +63 -4
  54. /package/rcode/skills/agents/{raees-orchestrator → orchestrator}/references.md +0 -0
package/AGENTS.md CHANGED
@@ -24,7 +24,7 @@ If a user says "just keep going" or "don't stop until done", that authorization
24
24
 
25
25
  - Follow [Conventional Commits](https://www.conventionalcommits.org/) format: `type(scope): subject`
26
26
  - Types allowed: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`, `perf`, `revert`
27
- - Scopes allowed: `agents`, `skills`, `workflows`, `templates`, `dashboard`, `docs`, `config`, `github`, `github-sync`, `commands`, `memory`, `brand`, `cli`, `ci`, `release`, `meta`, `tasks`, `migrations`, `refs`, `state`, `hooks`, `init`, `install`, `parity`, `triggers`, `dogfood`, `namespace`, `planning`, `insights`, `help`, `roadmap`, `session`, `audits`, `execute`, `executor`, `plan`, `planner`, `readme`, `rcode`, `review`, `sync`, `sprint`, `agent-exp`, `extensibility`, `lens-audit`, `tiers`, `build`, `council`, `doctor`, `postinstall`, `progress`, `security`, `tools`, `uninstall`, `update`, `test`, `changelog`, `scopes`, `phases`, `references`, `kanban`, `orchestrator`, `orchpanel`, `status`, `bin`, `brain`, `dogfeed`, `new-project`, `package`, `rcode-tools`, `rihal-tools`, `team`, `usp`, `v4`, `observability`, `audit`, `agent-rules`, `cursor`, `i18n`, `phase`, `scaffold`, `campaign`, `ship`, `getting-started`, `do-router`, `milestone-health`, `modules`, `project-types`, `roadmapper`, `token`, `benchmarks`, `eval`, `scan`, `verifier`, `discuss-phase`, `ui-phase`, `state-sync`, `autonomous`, plus numeric phase/sprint scopes (e.g. `docs(15)`, `feat(8.3)`)
27
+ - Scopes allowed: `agents`, `skills`, `workflows`, `templates`, `dashboard`, `docs`, `config`, `github`, `github-sync`, `commands`, `memory`, `brand`, `cli`, `ci`, `release`, `meta`, `tasks`, `migrations`, `refs`, `state`, `hooks`, `init`, `install`, `parity`, `triggers`, `dogfood`, `namespace`, `planning`, `insights`, `help`, `roadmap`, `session`, `audits`, `execute`, `executor`, `plan`, `planner`, `readme`, `rcode`, `review`, `sync`, `sprint`, `agent-exp`, `extensibility`, `lens-audit`, `tiers`, `build`, `council`, `doctor`, `postinstall`, `progress`, `security`, `tools`, `uninstall`, `update`, `test`, `changelog`, `scopes`, `phases`, `references`, `kanban`, `orchestrator`, `orchpanel`, `status`, `bin`, `brain`, `dogfeed`, `new-project`, `package`, `rcode-tools`, `rihal-tools`, `team`, `usp`, `v4`, `observability`, `audit`, `agent-rules`, `cursor`, `i18n`, `phase`, `scaffold`, `campaign`, `ship`, `getting-started`, `do-router`, `milestone-health`, `modules`, `project-types`, `roadmapper`, `token`, `benchmarks`, `eval`, `scan`, `map-codebase`, `verifier`, `discuss-phase`, `ui-phase`, `state-sync`, `autonomous`, plus numeric phase/sprint scopes (e.g. `docs(15)`, `feat(8.3)`)
28
28
  - Subject: lowercase first letter, imperative mood, no trailing period, under 72 chars
29
29
  - **NEVER add Claude/AI attribution to commit messages.** No "Generated with Claude Code", no "Co-Authored-By: Claude", no "🤖 Generated". The user does not want this.
30
30
  - **NEVER use `--no-verify`** to bypass hooks. If hooks fail, fix the underlying issue.
package/CLAUDE.md CHANGED
@@ -24,7 +24,7 @@ If a user says "just keep going" or "don't stop until done", that authorization
24
24
 
25
25
  - Follow [Conventional Commits](https://www.conventionalcommits.org/) format: `type(scope): subject`
26
26
  - Types allowed: `feat`, `fix`, `docs`, `style`, `refactor`, `test`, `chore`, `perf`, `revert`
27
- - Scopes allowed: `agents`, `skills`, `workflows`, `templates`, `dashboard`, `docs`, `config`, `github`, `github-sync`, `commands`, `memory`, `brand`, `cli`, `ci`, `release`, `meta`, `tasks`, `migrations`, `refs`, `state`, `hooks`, `install`, `parity`, `triggers`, `dogfood`, `namespace`, `planning`, `insights`, `help`, `roadmap`, `session`, `audits`, `execute`, `executor`, `plan`, `planner`, `readme`, `rcode`, `review`, `sync`, `sprint`, `agent-exp`, `extensibility`, `lens-audit`, `tiers`, `build`, `council`, `doctor`, `postinstall`, `progress`, `security`, `tools`, `uninstall`, `update`, `test`, `changelog`, `scopes`, `phases`, `references`, `kanban`, `orchestrator`, `orchpanel`, `status`, `bin`, `brain`, `dogfeed`, `new-project`, `package`, `rcode-tools`, `rihal-tools`, `team`, `usp`, `v4`, `observability`, `audit`, `init`, `agent-rules`, `cursor`, `i18n`, `phase`, `scaffold`, `campaign`, `ship`, `getting-started`, `do-router`, `milestone-health`, `modules`, `project-types`, `roadmapper`, `token`, `verifier`, `discuss-phase`, `ui-phase`, `state-sync`, `autonomous`, plus numeric phase/sprint scopes (e.g. `docs(15)`, `feat(8.3)`)
27
+ - Scopes allowed: `agents`, `skills`, `workflows`, `templates`, `dashboard`, `docs`, `config`, `github`, `github-sync`, `commands`, `memory`, `brand`, `cli`, `ci`, `release`, `meta`, `tasks`, `migrations`, `refs`, `state`, `hooks`, `install`, `parity`, `triggers`, `dogfood`, `namespace`, `planning`, `insights`, `help`, `roadmap`, `session`, `audits`, `execute`, `executor`, `plan`, `planner`, `readme`, `rcode`, `review`, `sync`, `sprint`, `agent-exp`, `extensibility`, `lens-audit`, `tiers`, `build`, `council`, `doctor`, `postinstall`, `progress`, `security`, `tools`, `uninstall`, `update`, `test`, `changelog`, `scopes`, `phases`, `references`, `kanban`, `orchestrator`, `orchpanel`, `status`, `bin`, `brain`, `dogfeed`, `new-project`, `package`, `rcode-tools`, `rihal-tools`, `team`, `usp`, `v4`, `observability`, `audit`, `init`, `agent-rules`, `cursor`, `i18n`, `phase`, `scaffold`, `campaign`, `ship`, `getting-started`, `do-router`, `milestone-health`, `modules`, `project-types`, `roadmapper`, `token`, `map-codebase`, `verifier`, `discuss-phase`, `ui-phase`, `state-sync`, `autonomous`, plus numeric phase/sprint scopes (e.g. `docs(15)`, `feat(8.3)`)
28
28
  - Subject: lowercase first letter, imperative mood, no trailing period, under 72 chars
29
29
  - **NEVER add Claude/AI attribution to commit messages.** No "Generated with Claude Code", no "Co-Authored-By: Claude", no "🤖 Generated". The user does not want this.
30
30
  - **NEVER use `--no-verify`** to bypass hooks. If hooks fail, fix the underlying issue.
package/CONTRIBUTING.md CHANGED
@@ -366,6 +366,7 @@ We use [Conventional Commits](https://www.conventionalcommits.org/) format. The
366
366
  - `benchmarks` — `benchmarks/` scripts and benchmark reports
367
367
  - `eval` — `test/eval/` behavioral drift baselines and eval harness
368
368
  - `scan` — `/rcode-scan` workflow and existing-codebase analysis
369
+ - `map-codebase` — `/rcode-map-codebase` workflow and `rcode-codebase-mapper` agent
369
370
  - `verifier` — `rcode-verifier` agent, verification playbook/rules, VERIFICATION.md flow
370
371
  - `discuss-phase` — `/rcode-discuss-phase` workflow and its gray-area/standing checks
371
372
  - `ui-phase` — `/rcode-ui-phase` workflow, UI-SPEC.md/WIREFRAMES.md generation, design-library
package/cli/doctor.js CHANGED
@@ -127,6 +127,36 @@ function findStuckExecutingPhases(state) {
127
127
  });
128
128
  }
129
129
 
130
+ /**
131
+ * The inverse of findStuckExecutingPhases: phases whose directory holds a
132
+ * VERIFICATION.md but whose state entry is not complete. Completion write-back
133
+ * failed (or never ran), so the project's real progress is higher than
134
+ * state.json reports. Under-reporting is as much a state defect as
135
+ * over-reporting — it is just the one nobody instruments.
136
+ */
137
+ function findUnrecordedVerifiedPhases(state, planningDir) {
138
+ const phasesDir = path.join(planningDir, 'phases');
139
+ if (!fs.existsSync(phasesDir)) return [];
140
+ const norm = (k) => String(k ?? '').trim().replace(/^0+(\d)/, '$1');
141
+ const verifiedOnDisk = new Set();
142
+ for (const entry of fs.readdirSync(phasesDir)) {
143
+ const full = path.join(phasesDir, entry);
144
+ let files;
145
+ try {
146
+ if (!fs.statSync(full).isDirectory()) continue;
147
+ files = fs.readdirSync(full);
148
+ } catch { continue; }
149
+ const m = entry.match(/^(\d+(?:\.\d+)?)/);
150
+ if (!m) continue;
151
+ if (files.some((f) => /VERIFICATION\.md$/i.test(f))) verifiedOnDisk.add(norm(m[1]));
152
+ }
153
+ const done = new Set(['complete', 'completed', 'done', 'verified']);
154
+ return (Array.isArray(state?.phases) ? state.phases : [])
155
+ .filter((p) => p && !done.has(String(p.status ?? '').toLowerCase()) && !p.completed)
156
+ .filter((p) => verifiedOnDisk.has(norm(p.number ?? p.id)))
157
+ .map((p) => String(p.number ?? p.id));
158
+ }
159
+
130
160
  // ---------- Preflight checks ----------
131
161
 
132
162
  /**
@@ -333,13 +363,18 @@ function runPreflight(cwd, packageRoot) {
333
363
  try {
334
364
  const state = JSON.parse(fs.readFileSync(statePath, 'utf8'));
335
365
  const stuck = findStuckExecutingPhases(state);
366
+ const unrecorded = findUnrecordedVerifiedPhases(state, path.join(cwd, '.planning'));
367
+ const problems = [];
368
+ if (stuck.length > 0) {
369
+ problems.push(`${stuck.length} phase(s) stuck 'executing' while a later phase is complete: ${stuck.map((p) => p.number).join(', ')}`);
370
+ }
371
+ if (unrecorded.length > 0) {
372
+ problems.push(`${unrecorded.length} phase(s) verified on disk but not complete in state.json: ${unrecorded.join(', ')} — completion write-back never ran. Fix: node .rcode/bin/rcode-tools.cjs state sync --from-disk`);
373
+ }
336
374
  checks.push({
337
375
  label: 'Phase state',
338
- status: stuck.length > 0 ? 'warn' : 'ok',
339
- message:
340
- stuck.length > 0
341
- ? `${stuck.length} phase(s) stuck 'executing' while a later phase is complete: ${stuck.map((p) => p.number).join(', ')}`
342
- : 'no stuck phases',
376
+ status: problems.length > 0 ? 'warn' : 'ok',
377
+ message: problems.length > 0 ? problems.join('; ') : 'no stuck or unrecorded phases',
343
378
  });
344
379
  } catch (e) {
345
380
  checks.push({
package/cli/install.js CHANGED
@@ -1232,7 +1232,12 @@ function ensureRcodePreCommitHook(target, options = {}) {
1232
1232
  '# Added by rcode install — safe to re-run (idempotent).',
1233
1233
  'if git diff --cached --name-only | grep -qE "^\\.planning/|^\\.rcode/brain/sources\\.yaml$"; then',
1234
1234
  ' if [ -x .rcode/bin/rcode-tools.cjs ]; then',
1235
- ' node .rcode/bin/rcode-tools.cjs state sync --from-disk > /dev/null 2>&1 || true',
1235
+ ' # Never silence this. A swallowed sync is how a project reaches 35',
1236
+ ' # executed sprints with executions:0 and nobody is told.',
1237
+ ' if ! _rcode_sync=$(node .rcode/bin/rcode-tools.cjs state sync --from-disk 2>&1); then',
1238
+ ' echo "rcode: state sync --from-disk failed (commit continues):" >&2',
1239
+ ' echo "$_rcode_sync" | tail -3 >&2',
1240
+ ' fi',
1236
1241
  ' git add .rcode/state.json 2>/dev/null || true',
1237
1242
  ' fi',
1238
1243
  'fi',