@hanzlaa/rcode 4.10.6 → 4.12.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 (61) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +1 -1
  3. package/CONTRIBUTING.md +5 -0
  4. package/cli/install.js +160 -0
  5. package/dist/rcode.js +254 -234
  6. package/package.json +1 -1
  7. package/rcode/agents/rcode-planner.md +1 -0
  8. package/rcode/agents/rcode-project-researcher.md +2 -1
  9. package/rcode/agents/rcode-roadmapper.md +1 -0
  10. package/rcode/agents/rcode-sprint-checker.md +1 -0
  11. package/rcode/agents/rcode-ux-designer.md +2 -0
  12. package/rcode/agents/rcode-verifier.md +2 -2
  13. package/rcode/agents/rules/planner/common-patterns.md +2 -1
  14. package/rcode/agents/rules/planner/goal-backward-thinking.md +33 -0
  15. package/rcode/agents/rules/planner/sprint-verification.md +1 -0
  16. package/rcode/agents/rules/planner/task-templates.md +20 -1
  17. package/rcode/agents/rules/project-researcher/detailed-guide.md +10 -0
  18. package/rcode/agents/rules/sprint-checker/dimensions.md +129 -0
  19. package/rcode/agents/rules/sprint-checker/process.md +12 -0
  20. package/rcode/agents/rules/verifier/behavioral-spot-checks.md +5 -1
  21. package/rcode/agents/rules/verifier/gap-output.md +5 -0
  22. package/rcode/agents/rules/verifier/reachability-check.md +69 -0
  23. package/rcode/bin/rcode-tools.cjs +91 -8
  24. package/rcode/commands/ui-phase.md +1 -1
  25. package/rcode/references/design-library/LICENSE +21 -0
  26. package/rcode/references/design-library/README.md +37 -0
  27. package/rcode/references/design-library/charts.csv +26 -0
  28. package/rcode/references/design-library/colors.csv +97 -0
  29. package/rcode/references/design-library/icons.csv +101 -0
  30. package/rcode/references/design-library/styles.csv +68 -0
  31. package/rcode/references/design-library/typography.csv +58 -0
  32. package/rcode/references/design-library/ui-reasoning.csv +101 -0
  33. package/rcode/references/design-library/ux-guidelines.csv +100 -0
  34. package/rcode/references/design-library/web-interface.csv +31 -0
  35. package/rcode/references/domain-probes.md +8 -0
  36. package/rcode/references/project-types.yaml +29 -0
  37. package/rcode/references/questioning.md +3 -0
  38. package/rcode/references/roadmapper-playbook.md +90 -0
  39. package/rcode/references/source-of-truth-grounding.md +80 -0
  40. package/rcode/references/sprint-checker-playbook.md +14 -0
  41. package/rcode/references/verifier-playbook.md +20 -7
  42. package/rcode/skills/actions/2-plan/rcode-create-epics-and-stories/workflow.md +1 -1
  43. package/rcode/skills/actions/2-plan/rcode-create-prd/workflow.md +9 -1
  44. package/rcode/workflows/autonomous.md +78 -16
  45. package/rcode/workflows/complete-milestone.md +1 -1
  46. package/rcode/workflows/council.md +51 -6
  47. package/rcode/workflows/discuss-phase.md +10 -2
  48. package/rcode/workflows/execute-sprint.md +35 -7
  49. package/rcode/workflows/execute-waves.md +2 -2
  50. package/rcode/workflows/execute.md +21 -6
  51. package/rcode/workflows/help.md +1 -1
  52. package/rcode/workflows/new-milestone.md +5 -1
  53. package/rcode/workflows/new-project-research.md +22 -0
  54. package/rcode/workflows/new-project-roadmap.md +19 -0
  55. package/rcode/workflows/plan-research-validation.md +1 -1
  56. package/rcode/workflows/plan.md +49 -3
  57. package/rcode/workflows/ship.md +22 -0
  58. package/rcode/workflows/ui-phase.md +187 -23
  59. package/rcode/workflows/ui-review.md +9 -1
  60. package/rcode/workflows/verify-work.md +1 -1
  61. package/server/lib/scanner.js +25 -4
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`, 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`, `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`, 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`, `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,11 @@ 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
+ - `verifier` — `rcode-verifier` agent, verification playbook/rules, VERIFICATION.md flow
370
+ - `discuss-phase` — `/rcode-discuss-phase` workflow and its gray-area/standing checks
371
+ - `ui-phase` — `/rcode-ui-phase` workflow, UI-SPEC.md/WIREFRAMES.md generation, design-library
372
+ - `state-sync` — `state sync --from-disk`, phase-status reconciliation, ROADMAP↔state.json drift
373
+ - `autonomous` — `/rcode-autonomous` workflow, the greenfield prerequisite gate
369
374
  - `<phase-id>` — numeric phase scope when committing inside a phase (e.g. `docs(15)`, `feat(8.3)`)
370
375
  - `<sprint-id>` — numeric sprint scope inside a phase (e.g. `feat(15.1)`)
371
376
 
package/cli/install.js CHANGED
@@ -1064,6 +1064,147 @@ function ensureRcodeGitignore(target, options = {}) {
1064
1064
  }
1065
1065
  }
1066
1066
 
1067
+ /**
1068
+ * Splice a BEGIN/END-delimited block into a text file, creating the file if
1069
+ * missing, replacing the block in place if a prior version exists, or
1070
+ * appending if the file exists without the block yet. Shared by any
1071
+ * "own one marked section of a user-owned file" writer (gitignore, rule
1072
+ * files, etc.) so the splice logic (and its edge cases — missing END,
1073
+ * trailing newlines) lives in one place.
1074
+ *
1075
+ * Returns: { action: 'created' | 'appended' | 'updated' | 'already-present' | 'skipped-error', error? }
1076
+ */
1077
+ function spliceMarkedBlockIntoFile(filePath, begin, end, block) {
1078
+ try {
1079
+ if (!fs.existsSync(filePath)) {
1080
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
1081
+ writeFileAtomic(filePath, block);
1082
+ return { action: 'created' };
1083
+ }
1084
+ const existing = fs.readFileSync(filePath, 'utf8');
1085
+
1086
+ function splice(text, newBlock) {
1087
+ const start = text.indexOf(begin);
1088
+ if (start < 0) return null;
1089
+ const endIdx = text.indexOf(end, start);
1090
+ if (endIdx < 0) {
1091
+ let sliceStart = start;
1092
+ if (sliceStart > 0 && text[sliceStart - 1] === '\n') sliceStart -= 1;
1093
+ return text.slice(0, sliceStart) + newBlock;
1094
+ }
1095
+ let sliceStart = start;
1096
+ if (sliceStart > 0 && text[sliceStart - 1] === '\n') sliceStart -= 1;
1097
+ let sliceEnd = endIdx + end.length;
1098
+ if (text[sliceEnd] === '\n') sliceEnd += 1;
1099
+ return text.slice(0, sliceStart) + newBlock + text.slice(sliceEnd);
1100
+ }
1101
+
1102
+ if (existing.includes(begin)) {
1103
+ const rewritten = splice(existing, block);
1104
+ if (rewritten !== null && rewritten !== existing) {
1105
+ writeFileAtomic(filePath, rewritten);
1106
+ return { action: 'updated' };
1107
+ }
1108
+ return { action: 'already-present' };
1109
+ }
1110
+ const sep = existing.endsWith('\n') ? '\n' : '\n\n';
1111
+ writeFileAtomic(filePath, existing + sep + block);
1112
+ return { action: 'appended' };
1113
+ } catch (err) {
1114
+ return { action: 'skipped-error', error: err.message };
1115
+ }
1116
+ }
1117
+
1118
+ /**
1119
+ * Ensure every installed IDE's rule file carries a short, rcode-owned block
1120
+ * pointing agents at `/rcode-do` as the preferred entry point for non-trivial
1121
+ * work. This is NOT a full CLAUDE.md/AGENTS.md rewrite — it only owns its own
1122
+ * marked section (or, for cursor/windsurf, a dedicated rcode-* rule file) so
1123
+ * a project's existing rule content is never touched or reordered.
1124
+ *
1125
+ * - claude / vscode → root CLAUDE.md (splice, file created if missing)
1126
+ * - codex → root AGENTS.md (splice, file created if missing)
1127
+ * - cursor → .cursor/rules/rcode-prefer-do.mdc (dedicated, always rewritten)
1128
+ * - windsurf → .windsurf/rules/rcode-prefer-do.mdc (dedicated, always rewritten)
1129
+ * - gemini / antigravity / grok → skipped (no single canonical project rule file yet)
1130
+ *
1131
+ * Returns: { [ide]: { action, error? } } per IDE actually written.
1132
+ */
1133
+ function ensureRcodePreferredCommandRule(target, ides) {
1134
+ const results = {};
1135
+ const idSet = new Set(ides || []);
1136
+
1137
+ const md = (heading) => [
1138
+ `## ${heading}`,
1139
+ '',
1140
+ 'This project has [rcode](https://www.npmjs.com/package/@hanzlaa/rcode) installed —',
1141
+ 'persistent project memory, specialist agents, and structured workflows under `.rcode/`.',
1142
+ '',
1143
+ 'For any non-trivial task (new feature, bug fix that needs investigation, multi-file',
1144
+ 'change, planning) prefer routing through **`/rcode-do <task description>`** — rcode\'s',
1145
+ 'command picker — instead of working ad hoc. It picks the right rcode command (plan,',
1146
+ 'execute, review, debug, etc.) for the task and keeps `.rcode/state.json` and the',
1147
+ 'Memory Bank in sync. Skip it only for trivial single-line/single-file edits that',
1148
+ 'don\'t need planning or memory.',
1149
+ ].join('\n');
1150
+
1151
+ if (idSet.has('claude') || idSet.has('vscode')) {
1152
+ const BEGIN = '<!-- ===== rcode-managed rule block (npx @hanzlaa/rcode install) ===== -->';
1153
+ const END = '<!-- ===== end rcode-managed rule block ===== -->';
1154
+ const block = `${BEGIN}\n\n${md('Working with rcode')}\n\n${END}\n`;
1155
+ results.claude = spliceMarkedBlockIntoFile(path.join(target, 'CLAUDE.md'), BEGIN, END, block);
1156
+ }
1157
+
1158
+ if (idSet.has('codex')) {
1159
+ const BEGIN = '<!-- ===== rcode-managed rule block (npx @hanzlaa/rcode install) ===== -->';
1160
+ const END = '<!-- ===== end rcode-managed rule block ===== -->';
1161
+ const block = `${BEGIN}\n\n${md('Working with rcode')}\n\n${END}\n`;
1162
+ results.codex = spliceMarkedBlockIntoFile(path.join(target, 'AGENTS.md'), BEGIN, END, block);
1163
+ }
1164
+
1165
+ if (idSet.has('cursor')) {
1166
+ const content = [
1167
+ '---',
1168
+ 'description: Prefer rcode\'s /rcode-do command for non-trivial work',
1169
+ 'alwaysApply: true',
1170
+ '---',
1171
+ '',
1172
+ md('Working with rcode'),
1173
+ '',
1174
+ ].join('\n');
1175
+ try {
1176
+ const p = path.join(target, '.cursor', 'rules', 'rcode-prefer-do.mdc');
1177
+ fs.mkdirSync(path.dirname(p), { recursive: true });
1178
+ writeFileAtomic(p, content);
1179
+ results.cursor = { action: 'written' };
1180
+ } catch (err) {
1181
+ results.cursor = { action: 'skipped-error', error: err.message };
1182
+ }
1183
+ }
1184
+
1185
+ if (idSet.has('windsurf')) {
1186
+ const content = [
1187
+ '---',
1188
+ 'description: Prefer rcode\'s /rcode-do command for non-trivial work',
1189
+ 'trigger: always_on',
1190
+ '---',
1191
+ '',
1192
+ md('Working with rcode'),
1193
+ '',
1194
+ ].join('\n');
1195
+ try {
1196
+ const p = path.join(target, '.windsurf', 'rules', 'rcode-prefer-do.mdc');
1197
+ fs.mkdirSync(path.dirname(p), { recursive: true });
1198
+ writeFileAtomic(p, content);
1199
+ results.windsurf = { action: 'written' };
1200
+ } catch (err) {
1201
+ results.windsurf = { action: 'skipped-error', error: err.message };
1202
+ }
1203
+ }
1204
+
1205
+ return results;
1206
+ }
1207
+
1067
1208
  /**
1068
1209
  * Ensure .git/hooks/pre-commit includes the rcode-managed block that auto-syncs
1069
1210
  * state.json when .planning/ or .rcode/brain/sources.yaml files change.
@@ -2873,6 +3014,10 @@ async function installInner(opts) {
2873
3014
  // prompt-router, etc). Default-on; resolved above via resolveEnableHooks().
2874
3015
  const settingsHooksReport = ensureRcodeSettingsHooks(opts.target, { enableHooks: opts.enableHooks });
2875
3016
 
3017
+ // Point each installed IDE's rule file at /rcode-do as the preferred entry point
3018
+ // for non-trivial work — an rcode-owned marked block/file, not a full rewrite.
3019
+ const preferredCommandReports = ensureRcodePreferredCommandRule(opts.target, opts.ides);
3020
+
2876
3021
  // Pull rcode brain content (v2.0 — issue #158).
2877
3022
  // Runs rcode-tools brain pull as a detached background process. Placeholder
2878
3023
  // URLs are skipped gracefully so this does not fail a fresh install.
@@ -2946,6 +3091,21 @@ async function installInner(opts) {
2946
3091
  }[settingsHooksReport.action] || 'guardrail hooks unchanged';
2947
3092
  console.log(' ' + dim(settingsHooksMsg));
2948
3093
  }
3094
+ if (preferredCommandReports && Object.keys(preferredCommandReports).length > 0) {
3095
+ const RULE_FILE = { claude: 'CLAUDE.md', codex: 'AGENTS.md', cursor: '.cursor/rules/rcode-prefer-do.mdc', windsurf: '.windsurf/rules/rcode-prefer-do.mdc' };
3096
+ for (const [ide, report] of Object.entries(preferredCommandReports)) {
3097
+ const file = RULE_FILE[ide] || ide;
3098
+ const msg = {
3099
+ 'created': `${file}: /rcode-do rule added`,
3100
+ 'appended': `${file}: /rcode-do rule appended`,
3101
+ 'updated': `${file}: /rcode-do rule refreshed`,
3102
+ 'already-present': `${file}: /rcode-do rule already present`,
3103
+ 'written': `${file}: /rcode-do rule written`,
3104
+ 'skipped-error': `${file}: /rcode-do rule skipped (${report.error})`,
3105
+ }[report.action] || `${file}: /rcode-do rule unchanged`;
3106
+ console.log(' ' + dim(msg));
3107
+ }
3108
+ }
2949
3109
  if (skipped > 0) console.log(' ' + dim(`${skipped} files skipped (unchanged)`));
2950
3110
 
2951
3111
  // Diff display for preserved files (#251)