@hanzlaa/rcode 3.2.1 → 3.3.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 (278) hide show
  1. package/CONTRIBUTING.md +9 -9
  2. package/README.md +50 -50
  3. package/cli/context.js +4 -4
  4. package/cli/doctor.js +1 -1
  5. package/cli/generate-command-skills.cjs +203 -0
  6. package/cli/install.js +29 -12
  7. package/cli/lib/memory-bank.cjs +5 -5
  8. package/cli/set-mode.js +2 -2
  9. package/cli/uninstall.js +5 -5
  10. package/dist/rcode.js +27 -16
  11. package/package.json +1 -1
  12. package/rihal/DOCS-AUDIT.md +1 -1
  13. package/rihal/agents/rihal-ahmed.md +1 -1
  14. package/rihal/agents/rihal-codebase-mapper.md +3 -3
  15. package/rihal/agents/rihal-debugger.md +2 -2
  16. package/rihal/agents/rihal-fatima.md +2 -2
  17. package/rihal/agents/rihal-haitham.md +2 -2
  18. package/rihal/agents/rihal-khalid.md +1 -1
  19. package/rihal/agents/rihal-layla.md +1 -1
  20. package/rihal/agents/rihal-nasser.md +1 -1
  21. package/rihal/agents/rihal-noor.md +1 -1
  22. package/rihal/agents/rihal-nyquist-auditor.md +1 -1
  23. package/rihal/agents/rihal-omar.md +1 -1
  24. package/rihal/agents/rihal-phase-researcher.md +3 -3
  25. package/rihal/agents/rihal-planner.md +1 -1
  26. package/rihal/agents/rihal-project-researcher.md +2 -2
  27. package/rihal/agents/rihal-research-synthesizer.md +3 -3
  28. package/rihal/agents/rihal-roadmapper.md +3 -3
  29. package/rihal/agents/rihal-sadiq.md +1 -1
  30. package/rihal/agents/rihal-sprint-checker.md +3 -3
  31. package/rihal/agents/rihal-verifier.md +2 -2
  32. package/rihal/agents/rihal-waleed.md +1 -1
  33. package/rihal/agents/rihal-yousef.md +2 -2
  34. package/rihal/agents/rihal-zahra.md +1 -1
  35. package/rihal/agents/rihal-zayd.md +1 -1
  36. package/rihal/agents/rules/phase-researcher/detailed-guide.md +1 -1
  37. package/rihal/agents/rules/roadmapper/detailed-guide.md +1 -1
  38. package/rihal/agents/rules/sprint-checker/dimensions.md +3 -3
  39. package/rihal/agents/rules/sprint-checker/process.md +2 -2
  40. package/rihal/agents/rules/verifier/gap-output.md +1 -1
  41. package/rihal/agents/rules/verifier/verification-report.md +1 -1
  42. package/rihal/bin/rihal-hooks.cjs +6 -6
  43. package/rihal/bin/rihal-tools.cjs +60 -23
  44. package/rihal/brain/README.md +2 -2
  45. package/rihal/brain/best-practices/no-autonomous-bypass.md +2 -2
  46. package/rihal/brain/best-practices/research-citation-rule.md +1 -1
  47. package/rihal/brain/best-practices/state-sync-rule.md +4 -4
  48. package/rihal/commands/add-phase.md +1 -1
  49. package/rihal/commands/add-tests.md +1 -1
  50. package/rihal/commands/add-todo.md +1 -1
  51. package/rihal/commands/analyze-dependencies.md +1 -1
  52. package/rihal/commands/audit-fix.md +1 -1
  53. package/rihal/commands/audit-milestone.md +1 -1
  54. package/rihal/commands/audit-uat.md +1 -1
  55. package/rihal/commands/audit.md +1 -1
  56. package/rihal/commands/autonomous.md +1 -1
  57. package/rihal/commands/brainstorm.md +1 -1
  58. package/rihal/commands/chain.md +1 -1
  59. package/rihal/commands/check-todos.md +1 -1
  60. package/rihal/commands/checkpoint-preview.md +1 -1
  61. package/rihal/commands/cleanup.md +2 -2
  62. package/rihal/commands/code-review-fix.md +1 -1
  63. package/rihal/commands/code-review.md +1 -1
  64. package/rihal/commands/complete-milestone.md +1 -1
  65. package/rihal/commands/config.md +2 -2
  66. package/rihal/commands/correct-course.md +1 -1
  67. package/rihal/commands/council.md +1 -1
  68. package/rihal/commands/create-epics-and-stories.md +1 -1
  69. package/rihal/commands/create-story.md +2 -2
  70. package/rihal/commands/dashboard.md +1 -1
  71. package/rihal/commands/debug.md +1 -1
  72. package/rihal/commands/decisions.md +1 -1
  73. package/rihal/commands/dev-story.md +1 -1
  74. package/rihal/commands/diff.md +1 -1
  75. package/rihal/commands/discuss-phase.md +1 -1
  76. package/rihal/commands/discuss.md +2 -2
  77. package/rihal/commands/do.md +2 -2
  78. package/rihal/commands/docs-update.md +1 -1
  79. package/rihal/commands/document-project.md +1 -1
  80. package/rihal/commands/enable-hooks.md +1 -1
  81. package/rihal/commands/execute-sprint.md +2 -2
  82. package/rihal/commands/execute.md +1 -1
  83. package/rihal/commands/explore.md +1 -1
  84. package/rihal/commands/export-to-github.md +1 -1
  85. package/rihal/commands/forensics.md +1 -1
  86. package/rihal/commands/from-template.md +1 -1
  87. package/rihal/commands/health.md +1 -1
  88. package/rihal/commands/help.md +1 -1
  89. package/rihal/commands/import.md +1 -1
  90. package/rihal/commands/inbox.md +1 -1
  91. package/rihal/commands/init.md +1 -1
  92. package/rihal/commands/insert-phase.md +1 -1
  93. package/rihal/commands/install.md +1 -1
  94. package/rihal/commands/list-plans.md +1 -1
  95. package/rihal/commands/list-workspaces.md +1 -1
  96. package/rihal/commands/map-codebase.md +1 -1
  97. package/rihal/commands/milestone-summary.md +1 -1
  98. package/rihal/commands/new-milestone.md +1 -1
  99. package/rihal/commands/new-project.md +1 -1
  100. package/rihal/commands/new-workspace.md +1 -1
  101. package/rihal/commands/next.md +1 -1
  102. package/rihal/commands/note.md +1 -1
  103. package/rihal/commands/notify-test.md +1 -1
  104. package/rihal/commands/pause-work.md +1 -1
  105. package/rihal/commands/plan-milestone-gaps.md +3 -3
  106. package/rihal/commands/plan.md +2 -2
  107. package/rihal/commands/plant-seed.md +1 -1
  108. package/rihal/commands/pr-branch.md +2 -2
  109. package/rihal/commands/prfaq.md +1 -1
  110. package/rihal/commands/profile-user.md +1 -1
  111. package/rihal/commands/progress.md +3 -3
  112. package/rihal/commands/quick.md +1 -1
  113. package/rihal/commands/remove-phase.md +1 -1
  114. package/rihal/commands/remove-workspace.md +1 -1
  115. package/rihal/commands/replay.md +1 -1
  116. package/rihal/commands/rerun.md +1 -1
  117. package/rihal/commands/research-phase.md +2 -2
  118. package/rihal/commands/resume-work.md +1 -1
  119. package/rihal/commands/review.md +1 -1
  120. package/rihal/commands/scan.md +1 -1
  121. package/rihal/commands/secure-phase.md +1 -1
  122. package/rihal/commands/session-report.md +1 -1
  123. package/rihal/commands/settings.md +1 -1
  124. package/rihal/commands/ship.md +2 -2
  125. package/rihal/commands/show.md +1 -1
  126. package/rihal/commands/sprint-planning.md +1 -1
  127. package/rihal/commands/sprint-status.md +1 -1
  128. package/rihal/commands/stats.md +1 -1
  129. package/rihal/commands/status.md +1 -1
  130. package/rihal/commands/ui-phase.md +1 -1
  131. package/rihal/commands/ui-review.md +1 -1
  132. package/rihal/commands/undo.md +1 -1
  133. package/rihal/commands/update.md +1 -1
  134. package/rihal/commands/validate-phase.md +1 -1
  135. package/rihal/commands/verify-phase.md +2 -2
  136. package/rihal/commands/verify-work.md +1 -1
  137. package/rihal/commands/why.md +1 -1
  138. package/rihal/commands/workstream.md +1 -1
  139. package/rihal/references/agent-shared-rules.md +1 -1
  140. package/rihal/references/command-redirect-format.md +7 -7
  141. package/rihal/references/context-budget.md +2 -2
  142. package/rihal/references/continuation-format.md +16 -16
  143. package/rihal/references/dispatch-banner.md +1 -1
  144. package/rihal/references/execution-protocol.md +2 -2
  145. package/rihal/references/gates.md +3 -3
  146. package/rihal/references/git-integration.md +1 -1
  147. package/rihal/references/output-format.md +4 -4
  148. package/rihal/references/output-realism.md +1 -1
  149. package/rihal/references/revision-loop.md +1 -1
  150. package/rihal/references/state-schema.md +15 -15
  151. package/rihal/references/ui-brand.md +1 -1
  152. package/rihal/references/verb-dictionary.md +15 -15
  153. package/rihal/references/workstream-flag.md +28 -28
  154. package/rihal/skills/_shared/no-autonomous-bypass.md +2 -2
  155. package/rihal/skills/_shared/research-citation-rule.md +1 -1
  156. package/rihal/skills/_shared/state-sync-rule.md +4 -4
  157. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +1 -1
  158. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/workflow.md +1 -1
  159. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +2 -2
  160. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-06-phase-stubs.md +2 -2
  161. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-07-backlog.md +2 -2
  162. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-09-state-sync.md +2 -2
  163. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +4 -4
  164. package/rihal/skills/actions/2-plan/rihal-create-milestone/workflow.md +5 -5
  165. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +1 -1
  166. package/rihal/skills/actions/2-plan/rihal-create-prd/workflow.md +1 -1
  167. package/rihal/skills/actions/2-plan/rihal-create-story/workflow.md +1 -1
  168. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +3 -3
  169. package/rihal/skills/actions/4-implementation/rihal-dev-story/workflow.md +1 -1
  170. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +1 -1
  171. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/checklist.md +1 -1
  172. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/workflow.md +1 -1
  173. package/rihal/skills/actions/4-implementation/rihal-sprint-status/workflow.md +5 -5
  174. package/rihal/skills/agents/dalil-scout/SKILL.md +7 -7
  175. package/rihal/skills/core/rihal-brainstorming/SKILL.md +1 -1
  176. package/rihal/skills/core/rihal-init/SKILL.md +1 -1
  177. package/rihal/skills/core/rihal-party-mode/SKILL.md +1 -1
  178. package/rihal/templates/milestone.md +1 -1
  179. package/rihal/templates/projects/api-backend/PROJECT.md +1 -1
  180. package/rihal/templates/projects/mobile-app/PROJECT.md +1 -1
  181. package/rihal/templates/projects/saas-b2b/PROJECT.md +1 -1
  182. package/rihal/workflows/add-phase.md +10 -10
  183. package/rihal/workflows/add-tests.md +9 -9
  184. package/rihal/workflows/add-todo.md +5 -5
  185. package/rihal/workflows/analyze-dependencies.md +7 -7
  186. package/rihal/workflows/audit-fix.md +4 -4
  187. package/rihal/workflows/audit-milestone.md +8 -8
  188. package/rihal/workflows/audit-uat.md +2 -2
  189. package/rihal/workflows/audit.md +28 -28
  190. package/rihal/workflows/autonomous.md +128 -44
  191. package/rihal/workflows/brainstorm.md +7 -7
  192. package/rihal/workflows/chain.md +16 -16
  193. package/rihal/workflows/check-implementation-readiness.md +4 -4
  194. package/rihal/workflows/check-todos.md +8 -8
  195. package/rihal/workflows/checkpoint-preview.md +1 -1
  196. package/rihal/workflows/code-review-fix.md +10 -10
  197. package/rihal/workflows/code-review.md +10 -10
  198. package/rihal/workflows/complete-milestone.md +5 -5
  199. package/rihal/workflows/correct-course.md +7 -7
  200. package/rihal/workflows/council.md +15 -15
  201. package/rihal/workflows/create-epics-and-stories.md +9 -9
  202. package/rihal/workflows/create-story.md +11 -11
  203. package/rihal/workflows/dashboard.md +8 -8
  204. package/rihal/workflows/debug.md +6 -6
  205. package/rihal/workflows/decisions.md +5 -5
  206. package/rihal/workflows/dev-story.md +12 -12
  207. package/rihal/workflows/diagnose-issues.md +2 -2
  208. package/rihal/workflows/diff.md +3 -3
  209. package/rihal/workflows/discuss-phase-power.md +7 -7
  210. package/rihal/workflows/discuss-phase.md +14 -14
  211. package/rihal/workflows/discuss.md +9 -9
  212. package/rihal/workflows/do.md +79 -79
  213. package/rihal/workflows/docs-update.md +6 -6
  214. package/rihal/workflows/document-project.md +5 -5
  215. package/rihal/workflows/enable-hooks.md +5 -5
  216. package/rihal/workflows/execute-sprint.md +3 -3
  217. package/rihal/workflows/execute.md +28 -28
  218. package/rihal/workflows/explore.md +5 -5
  219. package/rihal/workflows/export-to-github.md +5 -5
  220. package/rihal/workflows/forensics.md +8 -8
  221. package/rihal/workflows/from-template.md +8 -8
  222. package/rihal/workflows/health.md +11 -11
  223. package/rihal/workflows/help.md +117 -117
  224. package/rihal/workflows/import.md +4 -4
  225. package/rihal/workflows/inbox.md +8 -8
  226. package/rihal/workflows/init.md +23 -23
  227. package/rihal/workflows/insert-phase.md +9 -9
  228. package/rihal/workflows/install.md +3 -3
  229. package/rihal/workflows/karpathy-audit.md +11 -11
  230. package/rihal/workflows/list-plans.md +8 -8
  231. package/rihal/workflows/list-workspaces.md +7 -7
  232. package/rihal/workflows/map-codebase.md +5 -5
  233. package/rihal/workflows/milestone-summary.md +7 -7
  234. package/rihal/workflows/new-milestone.md +11 -11
  235. package/rihal/workflows/new-project-research.md +1 -1
  236. package/rihal/workflows/new-project-roadmap.md +8 -8
  237. package/rihal/workflows/new-project.md +32 -32
  238. package/rihal/workflows/new-workspace.md +7 -7
  239. package/rihal/workflows/next.md +13 -13
  240. package/rihal/workflows/note.md +7 -7
  241. package/rihal/workflows/notify-test.md +6 -6
  242. package/rihal/workflows/pause-work.md +6 -6
  243. package/rihal/workflows/plan-milestone-gaps.md +7 -7
  244. package/rihal/workflows/plan.md +28 -28
  245. package/rihal/workflows/plant-seed.md +3 -3
  246. package/rihal/workflows/pr-branch.md +1 -1
  247. package/rihal/workflows/prfaq.md +1 -1
  248. package/rihal/workflows/profile-user.md +5 -5
  249. package/rihal/workflows/progress.md +6 -6
  250. package/rihal/workflows/quick.md +12 -12
  251. package/rihal/workflows/remove-phase.md +6 -6
  252. package/rihal/workflows/remove-workspace.md +8 -8
  253. package/rihal/workflows/replay.md +8 -8
  254. package/rihal/workflows/rerun.md +5 -5
  255. package/rihal/workflows/research-phase.md +2 -2
  256. package/rihal/workflows/resume-work.md +10 -10
  257. package/rihal/workflows/review-adversarial.md +4 -4
  258. package/rihal/workflows/review-edge-case-hunter.md +5 -5
  259. package/rihal/workflows/review.md +11 -11
  260. package/rihal/workflows/scan.md +9 -9
  261. package/rihal/workflows/secure-phase.md +8 -8
  262. package/rihal/workflows/session-report.md +6 -6
  263. package/rihal/workflows/settings.md +15 -15
  264. package/rihal/workflows/ship.md +11 -11
  265. package/rihal/workflows/show.md +2 -2
  266. package/rihal/workflows/sprint-planning.md +13 -13
  267. package/rihal/workflows/sprint-status.md +10 -10
  268. package/rihal/workflows/stats.md +6 -6
  269. package/rihal/workflows/status.md +15 -7
  270. package/rihal/workflows/ui-phase.md +8 -8
  271. package/rihal/workflows/ui-review.md +5 -5
  272. package/rihal/workflows/undo.md +17 -17
  273. package/rihal/workflows/update.md +12 -12
  274. package/rihal/workflows/validate-phase.md +5 -5
  275. package/rihal/workflows/verify-work.md +18 -18
  276. package/rihal/workflows/why.md +9 -9
  277. package/rihal/workflows/workstream.md +11 -11
  278. package/server/lib/html/client.js +45 -45
package/CONTRIBUTING.md CHANGED
@@ -30,7 +30,7 @@ A command file is tiny. It registers a slash command in Claude Code's UI and poi
30
30
 
31
31
  ```markdown
32
32
  ---
33
- name: rihal:prfaq
33
+ name: rihal-prfaq
34
34
  description: Working Backwards PRFAQ challenge
35
35
  allowed-tools: [Read, Write, Agent, AskUserQuestion, WebSearch]
36
36
  ---
@@ -40,14 +40,14 @@ allowed-tools: [Read, Write, Agent, AskUserQuestion, WebSearch]
40
40
 
41
41
  That `@-include` line tells Claude to load the target file's contents as context. Without a command file, a skill is unreachable via `/` — it can only be triggered by describing the task in natural language.
42
42
 
43
- **Rule:** Every capability intended to be user-typed as `/rihal:something` needs a matching `rihal/commands/something.md`.
43
+ **Rule:** Every capability intended to be user-typed as `/rihal-something` needs a matching `rihal/commands/something.md`.
44
44
 
45
45
  ### Workflows — orchestration logic
46
46
 
47
47
  Workflows are prose instructions — markdown files Claude reads as a script to follow. They handle control flow: read state, ask a question, dispatch to a sub-workflow, report results. Most slash commands point to a workflow:
48
48
 
49
49
  ```
50
- /rihal:audit → commands/audit.md → @workflows/audit.md
50
+ /rihal-audit → commands/audit.md → @workflows/audit.md
51
51
  ```
52
52
 
53
53
  Workflows are the right tool when the task is a sequence of steps that Claude drives (check state → ask user → run something → report). They should not contain deep domain knowledge — that belongs in skills.
@@ -74,7 +74,7 @@ rihal/skills/actions/1-analysis/rihal-prfaq/
74
74
  Skills are the right tool when the task has multiple stages, needs sub-agent parallelism, or carries domain-specific coaching logic (e.g., how to run a PRFAQ gauntlet, how to do a Karpathy code review).
75
75
 
76
76
  Skills have **two activation paths**:
77
- 1. **Via command** — `/rihal:prfaq` loads the SKILL.md directly
77
+ 1. **Via command** — `/rihal-prfaq` loads the SKILL.md directly
78
78
  2. **Phrase-activated** — when a user describes the task, Claude picks up the skill from its `description` field in the YAML frontmatter
79
79
 
80
80
  ### Agents — focused specialists
@@ -85,12 +85,12 @@ There are two kinds:
85
85
 
86
86
  **Sub-agents** live inside skill folders (`rihal/skills/agents/*/SKILL.md`). They're invoked by their parent skill, not by the user directly. Example: the PRFAQ skill spawns `artifact-analyzer` and `web-researcher` in parallel during Stage 1.
87
87
 
88
- **Council agents** live in `rihal/agents/*.md`. They're the named characters (Waleed, Hanzla, Fatima, Sadiq…) that `/rihal:council` assembles into a panel. These are installed to `.claude/agents/` and can be spawned from any workflow.
88
+ **Council agents** live in `rihal/agents/*.md`. They're the named characters (Waleed, Hanzla, Fatima, Sadiq…) that `/rihal-council` assembles into a panel. These are installed to `.claude/agents/` and can be spawned from any workflow.
89
89
 
90
90
  ### How they chain for a real request
91
91
 
92
92
  ```
93
- User types: /rihal:council "Should we use Redis?"
93
+ User types: /rihal-council "Should we use Redis?"
94
94
 
95
95
  commands/council.md ← slash command entry
96
96
  │ @-includes
@@ -108,7 +108,7 @@ User types: /rihal:council "Should we use Redis?"
108
108
  A more complex chain involving a skill:
109
109
 
110
110
  ```
111
- User types: /rihal:prfaq
111
+ User types: /rihal-prfaq
112
112
 
113
113
  commands/prfaq.md
114
114
  │ @-includes
@@ -128,10 +128,10 @@ User types: /rihal:prfaq
128
128
 
129
129
  | I want to… | Edit this |
130
130
  |-----------|-----------|
131
- | Add a new `/rihal:something` slash command | Create `rihal/commands/something.md` pointing to a workflow or skill |
131
+ | Add a new `/rihal-something` slash command | Create `rihal/commands/something.md` pointing to a workflow or skill |
132
132
  | Change the steps in an existing command | Edit the workflow it points to |
133
133
  | Improve how a persona thinks (Hanzla, Waleed, etc.) | Edit `rihal/skills/agents/<name>/SKILL.md` or `rihal/agents/<name>.md` |
134
- | Add a new agent to `/rihal:council` | Edit `rihal/agents/team.yaml` + add agent file |
134
+ | Add a new agent to `/rihal-council` | Edit `rihal/agents/team.yaml` + add agent file |
135
135
  | Improve a complex multi-stage task (PRFAQ, code review, etc.) | Edit the skill's stage reference files |
136
136
  | Add a new skill triggered by natural language | Create `rihal/skills/actions/<category>/<name>/SKILL.md` — no command file needed if slash is not required |
137
137
  | Fix a broken `@-include` reference | Check that the target file exists at `.rihal/<path>` after install |
package/README.md CHANGED
@@ -44,7 +44,7 @@ Rihal Code packages a lot. To keep things approachable, everything is organized
44
44
 
45
45
  **Brand new?** Do the [Golden Path](docs/TIERS.md#-starter--the-golden-path): scaffold → PRD → stories → sprint → dev → review → status. Seven skills, one project, end-to-end.
46
46
 
47
- > **v2.0 — Rihal Brain.** v1 was a generic AI-engineering methodology. v2 keeps all of that and adds the Rihal context layer on top: standards, guides, and institutional knowledge pulled fresh from Rihal's own repos on install and on `/rihal:update`. See [`CHANGELOG.md`](CHANGELOG.md) and the [v2.0 milestone](https://github.com/hanzlahabib/rihal-code/milestone/4).
47
+ > **v2.0 — Rihal Brain.** v1 was a generic AI-engineering methodology. v2 keeps all of that and adds the Rihal context layer on top: standards, guides, and institutional knowledge pulled fresh from Rihal's own repos on install and on `/rihal-update`. See [`CHANGELOG.md`](CHANGELOG.md) and the [v2.0 milestone](https://github.com/hanzlahabib/rihal-code/milestone/4).
48
48
 
49
49
  ---
50
50
 
@@ -56,7 +56,7 @@ Most AI tools give you one assistant pretending to be everything. **Rihal Code g
56
56
  - **95 slash commands** covering research, planning, execution, verification, and recovery
57
57
  - **80 skills** including Memory Bank primitives, 11 engineering-rigor skills (TDD, harden, perf, debug, trim, etc.), and 8 real-pain skills (auth-audit, mvp-graduate, deploy-unify, etc.)
58
58
  - **Persistent project memory** at `.rihal/memory/` — checked into git, visible in the Diwan dashboard, lossless distillates for fast LLM hydration
59
- - **3 execution modes**: parallel debate (`/rihal:council`), sequential pipelines (`/rihal:chain`), and quick-sync (`/rihal:discuss`)
59
+ - **3 execution modes**: parallel debate (`/rihal-council`), sequential pipelines (`/rihal-chain`), and quick-sync (`/rihal-discuss`)
60
60
  - **File-based state** in `.rihal/` that every workflow reads and updates
61
61
  - **Intent guards** on every workflow — catch wrong commands early with copy-paste redirects
62
62
  - **Karpathy-inspired coding guidelines** wired into every code-writing agent
@@ -90,14 +90,14 @@ One unified installer. Pure file shipping, no runtime dependencies. Installs int
90
90
  - `rihal/brain/` — Rihal standards pulled from upstream (PR / commit / architecture docs)
91
91
  - `.planning/` — where your artifacts land (council sessions, plans, chains, summaries)
92
92
 
93
- Restart Claude Code (or your IDE), type `/`, and every `rihal:*` command appears.
93
+ Restart Claude Code (or your IDE), type `/`, and every `rihal-*` command appears.
94
94
 
95
- Update anytime with `npx @hanzlaa/rcode update` (or `/rihal:update` inside a Claude session).
95
+ Update anytime with `npx @hanzlaa/rcode update` (or `/rihal-update` inside a Claude session).
96
96
 
97
97
  ### Then begin the rihla
98
98
 
99
99
  ```
100
- /rihal:init
100
+ /rihal-init
101
101
  ```
102
102
 
103
103
  Detects your project state (fresh / existing-with-no-rihal / returning), asks a few configuration questions, and routes you to the right first action.
@@ -123,14 +123,14 @@ npx @hanzlaa/rcode install --ide gemini
123
123
  ## 90-second tour
124
124
 
125
125
  ```
126
- /rihal:do → interactive router
127
- /rihal:council should I rewrite auth? → 5 agents debate in parallel, 2 rounds
128
- /rihal:discuss waleed what stack for saas? → single expert, fast
129
- /rihal:chain research-plan dubai affiliate → Mariam → Hussain-PM → Planner pipeline
130
- /rihal:plan --research build a rental app → researcher grounds, plan-checker verifies
131
- /rihal:execute .planning/plans/01/PLAN.md → atomic commits + post-gates
132
- /rihal:status → phases, decisions, blockers, sessions
133
- /rihal:code-review HEAD~5..HEAD --karpathy → audit changes vs 4 coding principles
126
+ /rihal-do → interactive router
127
+ /rihal-council should I rewrite auth? → 5 agents debate in parallel, 2 rounds
128
+ /rihal-discuss waleed what stack for saas? → single expert, fast
129
+ /rihal-chain research-plan dubai affiliate → Mariam → Hussain-PM → Planner pipeline
130
+ /rihal-plan --research build a rental app → researcher grounds, plan-checker verifies
131
+ /rihal-execute .planning/plans/01/PLAN.md → atomic commits + post-gates
132
+ /rihal-status → phases, decisions, blockers, sessions
133
+ /rihal-code-review HEAD~5..HEAD --karpathy → audit changes vs 4 coding principles
134
134
  ```
135
135
 
136
136
  ---
@@ -160,7 +160,7 @@ npx @hanzlaa/rcode install --ide gemini
160
160
  phases/01-name/PLAN.md — plans organized by phase number (01, 02, 02.1, etc.)
161
161
  council-sessions/ — debate artifacts
162
162
  chains/ — pipeline outputs (RESEARCH.md → SCOPE.md → PLAN.md)
163
- notes/ — quick notes from /rihal:note
163
+ notes/ — quick notes from /rihal-note
164
164
  HANDOFF.json — pause-work checkpoint
165
165
  .continue-here.md — human-readable handoff summary
166
166
  ```
@@ -193,38 +193,38 @@ npx @hanzlaa/rcode install --ide gemini
193
193
 
194
194
  ## Three modes, three mental models
195
195
 
196
- ### 🏛️ `/rihal:council` — Parallel debate
196
+ ### 🏛️ `/rihal-council` — Parallel debate
197
197
 
198
198
  3-5 agents answer simultaneously in Round 1, then Round 2 lets each agent challenge the others' Round 1 responses. Result: one session artifact with all voices + orchestrator note flagging the sharpest disagreement.
199
199
 
200
200
  **Best for:** strategic decisions where you want disagreement, not consensus.
201
201
 
202
202
  ```
203
- /rihal:council should we migrate from monolith to microservices?
203
+ /rihal-council should we migrate from monolith to microservices?
204
204
  ```
205
205
 
206
- ### 🔗 `/rihal:chain` — Sequential pipeline
206
+ ### 🔗 `/rihal-chain` — Sequential pipeline
207
207
 
208
208
  Each agent runs after the previous one finishes, reading that agent's artifact as input. Result: a typed artifact per stage (RESEARCH.md → SCOPE.md → PLAN.md) in `.planning/chains/`.
209
209
 
210
210
  **Best for:** when you know roughly what you want and each specialist needs to do their part in order.
211
211
 
212
212
  ```
213
- /rihal:chain research-plan dubai affiliate site for mobile accessories
214
- /rihal:chain feasibility migrate postgres to neon serverless
215
- /rihal:chain gtm-to-build saas bookkeeping in oman
213
+ /rihal-chain research-plan dubai affiliate site for mobile accessories
214
+ /rihal-chain feasibility migrate postgres to neon serverless
215
+ /rihal-chain gtm-to-build saas bookkeeping in oman
216
216
  ```
217
217
 
218
- Presets: `research-plan` · `feasibility` · `gtm-to-build` · `full-discovery`. Or custom: `/rihal:chain mariam,waleed,fatima "your topic"`.
218
+ Presets: `research-plan` · `feasibility` · `gtm-to-build` · `full-discovery`. Or custom: `/rihal-chain mariam,waleed,fatima "your topic"`.
219
219
 
220
- ### 💬 `/rihal:discuss` — Single agent, quick-sync
220
+ ### 💬 `/rihal-discuss` — Single agent, quick-sync
221
221
 
222
222
  One agent, one round, conversational tone, no mandatory artifact. Feels like texting one colleague.
223
223
 
224
224
  ```
225
- /rihal:discuss waleed can we use postgres jsonb for this?
226
- /rihal:discuss fatima is this release ready?
227
- /rihal:discuss what's the kill criterion for this project?
225
+ /rihal-discuss waleed can we use postgres jsonb for this?
226
+ /rihal-discuss fatima is this release ready?
227
+ /rihal-discuss what's the kill criterion for this project?
228
228
  ```
229
229
 
230
230
  If no agent named, the panel scorer picks the top match.
@@ -238,10 +238,10 @@ If no agent named, the panel scorer picks the top match.
238
238
  Run the wrong command and you get a single-line copy-paste redirect — not a useless output.
239
239
 
240
240
  ```
241
- /rihal:plan should we use postgres or mongo?
241
+ /rihal-plan should we use postgres or mongo?
242
242
  ⚠ That's a decision question, not a planning input.
243
243
  Copy-paste this to ask the council instead:
244
- /rihal:council should we use postgres or mongo?
244
+ /rihal-council should we use postgres or mongo?
245
245
  ```
246
246
 
247
247
  Every workflow has a Step 0.5 intent detector.
@@ -251,19 +251,19 @@ Every workflow has a Step 0.5 intent detector.
251
251
  The classifier recognizes `dubai`, `affiliate`, `bnanai`, `karobar`, `site banana`, `دبئی`, `مارکیٹ`, `کاروبار` and many more. Mariam leads for GCC/MENA market questions.
252
252
 
253
253
  ```
254
- /rihal:council yar affiliate site bnanai hai dubai ma for quick bucks
254
+ /rihal-council yar affiliate site bnanai hai dubai ma for quick bucks
255
255
  → panel: [mariam, hussain-pm, sadiq]
256
256
  ```
257
257
 
258
258
  ### PRFAQ — validate before you build
259
259
 
260
- Amazon's "Working Backwards" method: write the finished-product press release *before* writing a line of code. If you can't write a compelling press release, the product isn't ready. `/rihal:prfaq` runs a 5-stage coaching gauntlet — Ignition → Press Release → Customer FAQ → Internal FAQ → Verdict — and outputs a battle-hardened concept document plus a PRD distillate ready for `/rihal:create-prd`.
260
+ Amazon's "Working Backwards" method: write the finished-product press release *before* writing a line of code. If you can't write a compelling press release, the product isn't ready. `/rihal-prfaq` runs a 5-stage coaching gauntlet — Ignition → Press Release → Customer FAQ → Internal FAQ → Verdict — and outputs a battle-hardened concept document plus a PRD distillate ready for `/rihal-create-prd`.
261
261
 
262
262
  **When to use it:** Any time a PM or engineer wants to validate whether an idea is worth building before committing sprint capacity. The skill challenges vague thinking, enforces customer-first framing, and gives a build/refine/kill verdict.
263
263
 
264
264
  ```
265
- /rihal:prfaq → interactive gauntlet
266
- /rihal:prfaq --headless --customer "..." --problem "..." --solution "..." → autonomous first draft
265
+ /rihal-prfaq → interactive gauntlet
266
+ /rihal-prfaq --headless --customer "..." --problem "..." --solution "..." → autonomous first draft
267
267
  ```
268
268
 
269
269
  ### Karpathy coding guidelines
@@ -275,23 +275,23 @@ Amazon's "Working Backwards" method: write the finished-product press release *b
275
275
  3. **Surgical changes** — touch only what's needed, match existing style
276
276
  4. **Goal-driven execution** — define verifiable success criteria
277
277
 
278
- `/rihal:code-review --karpathy` runs these 4 principles as a post-hoc audit against any diff or phase. Use it after implementation to catch bloated, over-engineered, or scope-creeping changes before they land in a PR.
278
+ `/rihal-code-review --karpathy` runs these 4 principles as a post-hoc audit against any diff or phase. Use it after implementation to catch bloated, over-engineered, or scope-creeping changes before they land in a PR.
279
279
 
280
280
  ```
281
- /rihal:code-review HEAD~5..HEAD --karpathy
282
- /rihal:code-review 03 --files=src/auth/ --karpathy
281
+ /rihal-code-review HEAD~5..HEAD --karpathy
282
+ /rihal-code-review 03 --files=src/auth/ --karpathy
283
283
  ```
284
284
 
285
285
  ### Plan verification + post-execute gates
286
286
 
287
- `/rihal:plan` runs `rihal-plan-checker` after the planner writes PLAN.md. On failure, loops back to planner with feedback (max 2 retries).
287
+ `/rihal-plan` runs `rihal-plan-checker` after the planner writes PLAN.md. On failure, loops back to planner with feedback (max 2 retries).
288
288
 
289
- `/rihal:execute` runs `rihal-integration-checker` (cross-phase E2E) and `rihal-nyquist-auditor` (test coverage) after completion. Both append to SUMMARY.md.
289
+ `/rihal-execute` runs `rihal-integration-checker` (cross-phase E2E) and `rihal-nyquist-auditor` (test coverage) after completion. Both append to SUMMARY.md.
290
290
 
291
291
  ### Model profiles
292
292
 
293
293
  ```bash
294
- /rihal:settings # interactive config
294
+ /rihal-settings # interactive config
295
295
  ```
296
296
 
297
297
  - **quality** — opus/sonnet-4.6 for reasoning agents
@@ -302,8 +302,8 @@ Amazon's "Working Backwards" method: write the finished-product press release *b
302
302
  ### Session handoff
303
303
 
304
304
  ```
305
- /rihal:pause-work → writes .rihal/HANDOFF.json + .continue-here.md
306
- /rihal:resume-work → reads HANDOFF, surfaces blocking constraints
305
+ /rihal-pause-work → writes .rihal/HANDOFF.json + .continue-here.md
306
+ /rihal-resume-work → reads HANDOFF, surfaces blocking constraints
307
307
  ```
308
308
 
309
309
  ---
@@ -315,16 +315,16 @@ Recent additions in this session:
315
315
  - **69 slash commands** across 3 modes and 3 modules (up from 64)
316
316
  - **Numeric ID system** — milestones (M1, M2), phases (01, 02, 02.1), plans (01.01, 02.03), tasks (01.01.01) with decimal insertion for urgent inserts
317
317
  - **Intent guards** (`Step 0.5`) — every workflow detects mismatched intent and redirects instead of failing
318
- - **Plan-checker loop** — `/rihal:plan` now verifies file existence and symbol definitions; loops back to planner on validation failure
319
- - **Post-execute gates** — `/rihal:execute` runs integration-checker (E2E) and nyquist-auditor (coverage) as hard gates
318
+ - **Plan-checker loop** — `/rihal-plan` now verifies file existence and symbol definitions; loops back to planner on validation failure
319
+ - **Post-execute gates** — `/rihal-execute` runs integration-checker (E2E) and nyquist-auditor (coverage) as hard gates
320
320
  - **Multilingual classifier** — Roman Urdu, Arabic, English with cultural signal routing (Mariam leads GCC/MENA)
321
321
  - **Karpathy guidelines enforcement** — 4 coding principles baked into every code-writing agent
322
322
  - **Global agents** — customize agents in `~/.rihal/agents/` without forking the repo
323
323
  - **Multi-IDE installer** — support for Claude Code, Cursor, Gemini CLI
324
324
  - **Hooks system** — opt-in pre-edit, pre-workflow, post-commit enforcement
325
- - **Session pause/resume** — `/rihal:pause-work` + `/rihal:resume-work` with HANDOFF.json
326
- - **Workspace isolation** — `/rihal:new-workspace` for parallel tracks
327
- - **Decimal phase insertion** — `/rihal:insert-phase` for urgent mid-cycle work
325
+ - **Session pause/resume** — `/rihal-pause-work` + `/rihal-resume-work` with HANDOFF.json
326
+ - **Workspace isolation** — `/rihal-new-workspace` for parallel tracks
327
+ - **Decimal phase insertion** — `/rihal-insert-phase` for urgent mid-cycle work
328
328
 
329
329
  ---
330
330
 
@@ -370,7 +370,7 @@ Recent additions in this session:
370
370
 
371
371
  ## Configuration
372
372
 
373
- `.rihal/config.yaml` — edit directly or run `/rihal:settings`:
373
+ `.rihal/config.yaml` — edit directly or run `/rihal-settings`:
374
374
 
375
375
  ```yaml
376
376
  user_name: "Hanzla"
@@ -402,7 +402,7 @@ View formatted:
402
402
  ```bash
403
403
  node .rihal/bin/rihal-tools.cjs state read
404
404
  # or
405
- /rihal:status
405
+ /rihal-status
406
406
  ```
407
407
 
408
408
  ---
@@ -410,7 +410,7 @@ node .rihal/bin/rihal-tools.cjs state read
410
410
  ## Hooks (opt-in)
411
411
 
412
412
  ```bash
413
- /rihal:enable-hooks
413
+ /rihal-enable-hooks
414
414
  ```
415
415
 
416
416
  Installs 3 opt-in hooks into `.claude/settings.json`:
@@ -424,9 +424,9 @@ Installs 3 opt-in hooks into `.claude/settings.json`:
424
424
 
425
425
  | Module | Contents |
426
426
  |--------|----------|
427
- | **core** | 5 council agents, `/rihal:council`, `/rihal:discuss`, `/rihal:status`, `/rihal:do`, `/rihal:help`, state management |
428
- | **execution** | Executor, planner, verifier + checker agents, `/rihal:execute`, `/rihal:plan`, `/rihal:quick`, `/rihal:debug`, `/rihal:audit-fix`, `/rihal:undo` |
429
- | **discovery** | Codebase-mapper, project-researcher, roadmapper, `/rihal:new-project`, `/rihal:map-codebase`, `/rihal:scan`, `/rihal:explore`, `/rihal:code-review`, `/rihal:docs-update` |
427
+ | **core** | 5 council agents, `/rihal-council`, `/rihal-discuss`, `/rihal-status`, `/rihal-do`, `/rihal-help`, state management |
428
+ | **execution** | Executor, planner, verifier + checker agents, `/rihal-execute`, `/rihal-plan`, `/rihal-quick`, `/rihal-debug`, `/rihal-audit-fix`, `/rihal-undo` |
429
+ | **discovery** | Codebase-mapper, project-researcher, roadmapper, `/rihal-new-project`, `/rihal-map-codebase`, `/rihal-scan`, `/rihal-explore`, `/rihal-code-review`, `/rihal-docs-update` |
430
430
 
431
431
  Full install = all 3 modules = 201 files.
432
432
 
package/cli/context.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * prints a warning when stale
14
14
  *
15
15
  * The refresh does NOT rewrite active.md or project-brief.md — that's
16
- * /rihal:init's job (the scan requires an LLM). --refresh just stores the
16
+ * /rihal-init's job (the scan requires an LLM). --refresh just stores the
17
17
  * current fingerprint so the next check sees things as fresh.
18
18
  */
19
19
 
@@ -117,7 +117,7 @@ function printReport(cwd) {
117
117
  console.log();
118
118
 
119
119
  if (report.status !== 'fresh') {
120
- console.log(` ➡ Refresh with: /rihal:init (in your editor)`);
120
+ console.log(` ➡ Refresh with: /rihal-init (in your editor)`);
121
121
  console.log();
122
122
  }
123
123
  }
@@ -125,7 +125,7 @@ function printReport(cwd) {
125
125
  /**
126
126
  * --refresh: recompute and save the fingerprint to .rihal/state.json.
127
127
  * Only use this when you know the memory bank was actually refreshed
128
- * (e.g. by /rihal:init running end-to-end). Does NOT rewrite context files.
128
+ * (e.g. by /rihal-init running end-to-end). Does NOT rewrite context files.
129
129
  */
130
130
  function doRefresh(cwd) {
131
131
  ensureRihalDir(cwd);
@@ -161,7 +161,7 @@ if command -v rcode >/dev/null 2>&1; then
161
161
  output=$(rcode context --check 2>&1)
162
162
  if [ $? -ne 0 ]; then
163
163
  echo ""
164
- echo "⚠ Rihal memory bank is stale — run /rihal:init in your editor to refresh."
164
+ echo "⚠ Rihal memory bank is stale — run /rihal-init in your editor to refresh."
165
165
  echo " $(echo "$output" | grep '•' | head -1 | sed 's/^ *//')"
166
166
  fi
167
167
  fi
package/cli/doctor.js CHANGED
@@ -190,7 +190,7 @@ function runPreflight(cwd, packageRoot) {
190
190
  checks.push({
191
191
  label: 'Memory bank',
192
192
  status: 'warn',
193
- message: 'never initialized (run /rihal:init to populate)',
193
+ message: 'never initialized (run /rihal-init to populate)',
194
194
  });
195
195
  } else {
196
196
  checks.push({
@@ -0,0 +1,203 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Install-time generator: skill stubs that mirror slash commands.
4
+ *
5
+ * WHY: VS Code's Claude Code extension lists `.claude/skills/` in its
6
+ * sidebar, but slash commands at `.claude/commands/rihal/` are only
7
+ * reachable via the `/` autocomplete. Users coming from GSD (which ships
8
+ * a skill per command) expect to see lifecycle commands like `rihal-do`
9
+ * in the sidebar.
10
+ *
11
+ * This script creates ONE skill stub per slash command at install time,
12
+ * unless a real skill with the same name already exists at the source.
13
+ * The stubs live at the install destination only (`.claude/skills/`) —
14
+ * they are NEVER committed to the rcode source tree. That keeps the
15
+ * source codebase free of duplication while letting the sidebar feel
16
+ * full.
17
+ *
18
+ * Each generated stub is marked with `generated: true` and
19
+ * `generated-by: rcode-install` in frontmatter so it can be detected
20
+ * and refreshed on subsequent installs without confusing real skills.
21
+ *
22
+ * Run: node scripts/generate-command-skills.cjs <package-root> <target-skills-dir>
23
+ * (called from cli/install.js)
24
+ */
25
+
26
+ const fs = require('fs');
27
+ const path = require('path');
28
+
29
+ /**
30
+ * Curated list of commands that get skill stubs. Not every command
31
+ * deserves a sidebar entry — only the user-facing entry points and
32
+ * lifecycle verbs. Internal sub-commands stay slash-only.
33
+ */
34
+ const SIDEBAR_COMMANDS = new Set([
35
+ 'do', 'status', 'progress', 'next', 'plan', 'execute',
36
+ 'council', 'discuss', 'ship', 'audit', 'autonomous',
37
+ 'session-report', 'forensics', 'health', 'debug',
38
+ 'verify-phase', 'verify-work', 'review', 'code-review',
39
+ 'new-project', 'new-milestone', 'milestone-summary',
40
+ 'note', 'add-todo', 'check-todos', 'pause-work', 'resume-work',
41
+ ]);
42
+
43
+ function parseFrontmatter(text) {
44
+ if (!text.startsWith('---\n')) return {};
45
+ const end = text.indexOf('\n---\n', 4);
46
+ if (end === -1) return {};
47
+ const block = text.slice(4, end);
48
+ const fm = {};
49
+ for (const raw of block.split('\n')) {
50
+ const m = raw.match(/^([a-zA-Z_-]+):\s*(.+)$/);
51
+ if (m) fm[m[1].trim()] = m[2].trim().replace(/^["']|["']$/g, '');
52
+ }
53
+ return fm;
54
+ }
55
+
56
+ function discoverRealSkills(packageRoot) {
57
+ const out = new Set();
58
+ const buckets = ['core', 'agents'];
59
+ for (const bucket of buckets) {
60
+ const dir = path.join(packageRoot, 'rihal', 'skills', bucket);
61
+ if (!fs.existsSync(dir)) continue;
62
+ for (const entry of fs.readdirSync(dir)) {
63
+ if (entry.startsWith('rihal-')) out.add(entry);
64
+ }
65
+ }
66
+ // actions are nested by phase
67
+ const actionsDir = path.join(packageRoot, 'rihal', 'skills', 'actions');
68
+ if (fs.existsSync(actionsDir)) {
69
+ for (const phase of fs.readdirSync(actionsDir)) {
70
+ const phaseDir = path.join(actionsDir, phase);
71
+ if (!fs.statSync(phaseDir).isDirectory()) continue;
72
+ for (const entry of fs.readdirSync(phaseDir)) {
73
+ if (entry.startsWith('rihal-')) out.add(entry);
74
+ }
75
+ }
76
+ }
77
+ return out;
78
+ }
79
+
80
+ function generateStub(cmdName, commandFm, version) {
81
+ const desc = commandFm.description || `Slash command shortcut for /rihal-${cmdName}.`;
82
+ const triggers = [
83
+ `rihal ${cmdName}`,
84
+ `rihal-${cmdName}`,
85
+ `/rihal-${cmdName}`,
86
+ ];
87
+
88
+ return `---
89
+ name: rihal-${cmdName}
90
+ description: >
91
+ ${desc.replace(/\n/g, ' ')}
92
+ Sidebar entry — invokes the same workflow as /rihal-${cmdName}.
93
+ triggers:
94
+ ${triggers.map((t) => ` - "${t}"`).join('\n')}
95
+ user-invocable: true
96
+ generated: true
97
+ generated-by: rcode-install-v${version}
98
+ source: rihal/commands/${cmdName}.md
99
+ ---
100
+
101
+ <!--
102
+ AUTO-GENERATED at install time by scripts/generate-command-skills.cjs.
103
+ Do NOT edit this file directly — your changes will be overwritten on the next
104
+ install or update. To customise, create a sibling \`.local.md\` file (which
105
+ is preserved across installs) or modify the source command at
106
+ rihal/commands/${cmdName}.md.
107
+
108
+ This stub exists so the slash command /rihal-${cmdName} appears in VS Code's
109
+ Claude Code sidebar (which lists skills only, not slash commands). The
110
+ behaviour is identical to /rihal-${cmdName} — both invoke the workflow at
111
+ .rihal/workflows/${cmdName}.md.
112
+ -->
113
+
114
+ ## Overview
115
+
116
+ Sidebar entry for the \`/rihal-${cmdName}\` slash command. Phrase-activated alternative invocation route.
117
+
118
+ ## Workflow
119
+
120
+ Read and execute \`@.rihal/workflows/${cmdName}.md\` end-to-end. The behaviour is the same as invoking \`/rihal-${cmdName}\` directly.
121
+
122
+ ## Output Format
123
+
124
+ Identical to \`/rihal-${cmdName}\`. See the workflow file for the canonical output spec.
125
+
126
+ ## Examples
127
+
128
+ **Happy path** — say "rihal ${cmdName}" or "/rihal-${cmdName}" → workflow runs identically either way.
129
+
130
+ **Negative — looking for the canonical command file** — see \`rihal/commands/${cmdName}.md\` (the source of truth) and \`rihal/workflows/${cmdName}.md\` (the orchestration logic).
131
+
132
+ ## Memory Bank Hooks
133
+
134
+ - **Reads:** whatever \`.rihal/workflows/${cmdName}.md\` reads
135
+ - **Writes:** whatever the workflow writes
136
+ - This stub itself is read-only — it just dispatches to the workflow.
137
+ `;
138
+ }
139
+
140
+ function main(packageRoot, targetSkillsDir, version) {
141
+ if (!fs.existsSync(targetSkillsDir)) {
142
+ fs.mkdirSync(targetSkillsDir, { recursive: true });
143
+ }
144
+
145
+ const realSkills = discoverRealSkills(packageRoot);
146
+ const commandsDir = path.join(packageRoot, 'rihal', 'commands');
147
+ if (!fs.existsSync(commandsDir)) {
148
+ console.warn(`[generate-command-skills] commands dir not found: ${commandsDir}`);
149
+ return { generated: 0, skipped: 0 };
150
+ }
151
+
152
+ let generated = 0;
153
+ let skipped = 0;
154
+
155
+ for (const file of fs.readdirSync(commandsDir)) {
156
+ if (!file.endsWith('.md')) continue;
157
+ if (file.startsWith('_')) continue; // internal aliases / metadata
158
+ const cmdName = file.replace(/\.md$/, '');
159
+ if (!SIDEBAR_COMMANDS.has(cmdName)) { skipped++; continue; }
160
+
161
+ const skillName = `rihal-${cmdName}`;
162
+ if (realSkills.has(skillName)) {
163
+ // A real skill with this name exists in the source tree — don't shadow it
164
+ skipped++;
165
+ continue;
166
+ }
167
+
168
+ const cmdPath = path.join(commandsDir, file);
169
+ const cmdText = fs.readFileSync(cmdPath, 'utf8');
170
+ const cmdFm = parseFrontmatter(cmdText);
171
+
172
+ const stubDir = path.join(targetSkillsDir, skillName);
173
+ const stubFile = path.join(stubDir, 'SKILL.md');
174
+
175
+ // Idempotency: only overwrite if the file is missing OR is a previously
176
+ // generated stub (has the marker). Never clobber a user's hand-edited file.
177
+ if (fs.existsSync(stubFile)) {
178
+ const existing = fs.readFileSync(stubFile, 'utf8');
179
+ if (!/^generated:\s*true/m.test(existing)) {
180
+ skipped++;
181
+ continue;
182
+ }
183
+ }
184
+
185
+ fs.mkdirSync(stubDir, { recursive: true });
186
+ fs.writeFileSync(stubFile, generateStub(cmdName, cmdFm, version), 'utf8');
187
+ generated++;
188
+ }
189
+
190
+ return { generated, skipped };
191
+ }
192
+
193
+ if (require.main === module) {
194
+ const [packageRoot, targetSkillsDir, version = '0.0.0'] = process.argv.slice(2);
195
+ if (!packageRoot || !targetSkillsDir) {
196
+ console.error('Usage: generate-command-skills.cjs <package-root> <target-skills-dir> [version]');
197
+ process.exit(2);
198
+ }
199
+ const { generated, skipped } = main(packageRoot, targetSkillsDir, version);
200
+ console.log(`✓ ${generated} sidebar skill stub${generated === 1 ? '' : 's'} generated, ${skipped} skipped (already real skills or out of curated set)`);
201
+ }
202
+
203
+ module.exports = { main, SIDEBAR_COMMANDS };