@hanzlaa/rcode 2.2.0 → 2.3.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 (143) hide show
  1. package/CLAUDE.md +15 -0
  2. package/CONTRIBUTING.md +138 -0
  3. package/README.md +74 -15
  4. package/cli/install.js +312 -80
  5. package/cli/postinstall.js +4 -4
  6. package/cli/uninstall.js +8 -0
  7. package/dist/rcode.js +19777 -0
  8. package/package.json +18 -5
  9. package/rihal/DOCS-AUDIT.md +14 -0
  10. package/rihal/agents/rihal-code-reviewer.md +1 -1
  11. package/rihal/agents/rihal-codebase-mapper.md +1 -1
  12. package/rihal/agents/rihal-docs-auditor.md +1 -1
  13. package/rihal/agents/rihal-edge-case-hunter.md +1 -1
  14. package/rihal/agents/rihal-executor.md +2 -1
  15. package/rihal/agents/rihal-hussain-pm.md +1 -0
  16. package/rihal/agents/rihal-nyquist-auditor.md +1 -1
  17. package/rihal/agents/rihal-phase-researcher.md +2 -2
  18. package/rihal/agents/rihal-planner.md +3 -2
  19. package/rihal/agents/rihal-roadmapper.md +1 -0
  20. package/rihal/agents/rihal-security-adversary.md +1 -1
  21. package/rihal/agents/rihal-security-auditor.md +1 -1
  22. package/rihal/agents/rihal-sprint-checker.md +1 -1
  23. package/rihal/agents/rihal-verifier.md +1 -1
  24. package/rihal/bin/lib/roadmap.cjs +2 -3
  25. package/rihal/bin/rihal-tools.cjs +11 -31
  26. package/rihal/brain/best-practices/no-theoretical-suggestions.md +56 -0
  27. package/rihal/commands/add-phase.md +2 -2
  28. package/rihal/commands/audit.md +8 -0
  29. package/rihal/commands/checkpoint-preview.md +13 -0
  30. package/rihal/commands/cleanup.md +2 -2
  31. package/rihal/commands/config.md +4 -4
  32. package/rihal/commands/pr-branch.md +2 -2
  33. package/rihal/commands/prfaq.md +15 -0
  34. package/rihal/commands/remove-phase.md +2 -2
  35. package/rihal/commands/research-phase.md +2 -2
  36. package/rihal/commands/settings.md +2 -2
  37. package/rihal/commands/ship.md +15 -3
  38. package/rihal/commands/validate-phase.md +1 -1
  39. package/rihal/commands/verify-phase.md +2 -2
  40. package/rihal/references/agent-contracts.md +12 -0
  41. package/rihal/references/karpathy-guidelines-full.md +79 -0
  42. package/rihal/references/karpathy-guidelines.md +8 -76
  43. package/rihal/references/model-profile-resolution.md +8 -0
  44. package/rihal/references/phase-argument-parsing.md +11 -0
  45. package/rihal/references/revision-loop.md +11 -0
  46. package/rihal/references/universal-anti-patterns.md +15 -0
  47. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/SKILL.md +11 -0
  48. package/rihal/skills/actions/1-analysis/research/rihal-market-research/SKILL.md +11 -0
  49. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/SKILL.md +13 -0
  50. package/rihal/skills/actions/1-analysis/rihal-document-project/SKILL.md +11 -0
  51. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +12 -0
  52. package/rihal/skills/actions/1-analysis/rihal-product-brief/SKILL.md +7 -0
  53. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +15 -1
  54. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +21 -1
  55. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +1 -1
  56. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +26 -0
  57. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +16 -2
  58. package/rihal/skills/actions/2-plan/rihal-create-ux-design/SKILL.md +12 -0
  59. package/rihal/skills/actions/2-plan/rihal-edit-prd/SKILL.md +11 -0
  60. package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +13 -0
  61. package/rihal/skills/actions/2-plan/rihal-validate-prd/SKILL.md +12 -0
  62. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/SKILL.md +12 -0
  63. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/SKILL.md +14 -0
  64. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/SKILL.md +12 -0
  65. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +16 -0
  66. package/rihal/skills/actions/4-implementation/rihal-code-review/SKILL.md +12 -0
  67. package/rihal/skills/actions/4-implementation/rihal-correct-course/SKILL.md +13 -0
  68. package/rihal/skills/actions/4-implementation/rihal-dev-story/SKILL.md +12 -0
  69. package/rihal/skills/actions/4-implementation/rihal-qa-generate-e2e-tests/SKILL.md +12 -0
  70. package/rihal/skills/actions/4-implementation/rihal-retrospective/SKILL.md +11 -0
  71. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/SKILL.md +10 -0
  72. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +14 -1
  73. package/rihal/skills/actions/4-implementation/rihal-sprint-status/SKILL.md +10 -0
  74. package/rihal/skills/agents/ahmed-hassani-director/SKILL.md +13 -1
  75. package/rihal/skills/agents/fatima-qa/SKILL.md +14 -1
  76. package/rihal/skills/agents/haitham-frontend/SKILL.md +15 -1
  77. package/rihal/skills/agents/hanzla-engineer/SKILL.md +14 -1
  78. package/rihal/skills/agents/hussain-pm/SKILL.md +22 -1
  79. package/rihal/skills/agents/hussain-sm/SKILL.md +22 -1
  80. package/rihal/skills/agents/layla-designer/SKILL.md +15 -1
  81. package/rihal/skills/agents/majlis-council/SKILL.md +14 -1
  82. package/rihal/skills/agents/mariam-marketing/SKILL.md +15 -1
  83. package/rihal/skills/agents/nasser-eng-manager/SKILL.md +14 -1
  84. package/rihal/skills/agents/noor-writer/SKILL.md +14 -1
  85. package/rihal/skills/agents/raees-orchestrator/SKILL.md +13 -1
  86. package/rihal/skills/agents/sadiq-analyst/SKILL.md +15 -1
  87. package/rihal/skills/agents/waleed-architect/SKILL.md +16 -1
  88. package/rihal/skills/agents/yousef-backend/SKILL.md +16 -1
  89. package/rihal/skills/agents/zahra-branding/SKILL.md +15 -1
  90. package/rihal/skills/agents/zayd-ml/SKILL.md +17 -1
  91. package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +12 -0
  92. package/rihal/skills/core/rihal-brainstorming/SKILL.md +16 -0
  93. package/rihal/skills/core/rihal-clone-website/SKILL.md +21 -0
  94. package/rihal/skills/core/rihal-distillator/SKILL.md +8 -0
  95. package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +12 -0
  96. package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +18 -0
  97. package/rihal/skills/core/rihal-help/SKILL.md +12 -0
  98. package/rihal/skills/core/rihal-index-docs/SKILL.md +18 -0
  99. package/rihal/skills/core/rihal-init/SKILL.md +8 -0
  100. package/rihal/skills/core/rihal-party-mode/SKILL.md +14 -0
  101. package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +12 -0
  102. package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +18 -0
  103. package/rihal/skills/core/rihal-shard-doc/SKILL.md +18 -0
  104. package/rihal/team.yaml +205 -0
  105. package/rihal/templates/UAT.md +29 -0
  106. package/rihal/templates/milestone.md +2 -0
  107. package/rihal/templates/sprint.md +11 -28
  108. package/rihal/templates/summary.md +30 -0
  109. package/rihal/templates/verification-report.md +28 -0
  110. package/rihal/workflows/audit-milestone.md +34 -2
  111. package/rihal/workflows/audit.md +172 -0
  112. package/rihal/workflows/autonomous.md +67 -0
  113. package/rihal/workflows/checkpoint-preview.md +7 -0
  114. package/rihal/workflows/council.md +3 -1
  115. package/rihal/workflows/debug.md +8 -1
  116. package/rihal/workflows/diagnose-issues.md +34 -0
  117. package/rihal/workflows/do.md +47 -3
  118. package/rihal/workflows/document-project.md +1 -1
  119. package/rihal/workflows/execute-sprint.md +11 -4
  120. package/rihal/workflows/execute.md +9 -3
  121. package/rihal/workflows/help.md +1 -1
  122. package/rihal/workflows/karpathy-audit.md +7 -14
  123. package/rihal/workflows/pause-work.md +7 -1
  124. package/rihal/workflows/prfaq.md +7 -0
  125. package/rihal/workflows/profile-user.md +2 -2
  126. package/rihal/workflows/settings.md +116 -117
  127. package/rihal/workflows/ship.md +31 -1
  128. package/rihal/workflows/sprint-planning.md +39 -8
  129. package/rihal/workflows/status.md +5 -0
  130. package/rihal/workflows/ui-phase.md +3 -3
  131. package/rihal/workflows/update.md +80 -22
  132. package/rihal/workflows/validate-phase.md +7 -1
  133. package/server/dashboard.js +34 -575
  134. package/server/lib/api.js +123 -0
  135. package/server/lib/html/client.js +969 -0
  136. package/server/lib/html/css.js +416 -0
  137. package/server/lib/html/shell.js +230 -0
  138. package/server/lib/scanner.js +142 -0
  139. package/rihal/agents/rihal-ui-designer.md +0 -6
  140. package/rihal/skills/core/rihal-advanced-elicitation/rihal-advanced-elicitation/SKILL.md +0 -148
  141. package/rihal/skills/core/rihal-advanced-elicitation/rihal-advanced-elicitation/methods.csv +0 -51
  142. package/rihal/skills/core/rihal-shard-doc/rihal-shard-doc/SKILL.md +0 -122
  143. package/rihal/workflows/config.md +0 -105
@@ -1,185 +1,184 @@
1
1
  # Workflow: rihal:settings
2
2
 
3
3
  <purpose>
4
- Interactive configuration wizard for Rihal project settings. Collects user preferences for model profile, research strategy, execution gates, and branching strategy, then writes them back to .rihal/config.yaml.
4
+ View and edit Rihal project settings stored in `.rihal/config.yaml`. Closes
5
+ #233 — replaces the previous broken implementation that wrote flat keys
6
+ nothing read and corrupted the nested `workflow:` / `git:` sections on every
7
+ save.
8
+
9
+ The single source of truth for config keys is the table in Step 1.5. All keys
10
+ documented there are consumed somewhere in the codebase — settings that the
11
+ wizard writes are settings that workflows actually honour.
5
12
  </purpose>
6
13
 
7
-
8
14
  ## Step 0 — Usage check
9
15
 
10
- If `$ARGUMENTS` is empty or contains only `--help` or `-h`:
16
+ If `$ARGUMENTS` contains `--help` or `-h`:
11
17
 
12
18
  ```
13
- /rihal:settings <argument-here>
19
+ /rihal:settings # show current + interactive edit
20
+ /rihal:settings show # show current only
21
+ /rihal:settings get <key> # read a single dotted key (e.g. workflow.discuss_mode)
22
+ /rihal:settings set <key> <value> # write a single dotted key
14
23
  ```
15
24
 
16
25
  **Examples:**
17
26
  ```
18
- /rihal:settings example 1
19
- /rihal:settings example 2
27
+ /rihal:settings show
28
+ /rihal:settings get workflow.research_by_default
29
+ /rihal:settings set workflow.research_by_default true
30
+ /rihal:settings set git.branching_strategy feature-branch
20
31
  ```
21
32
 
22
- STOPdo not proceed.
33
+ ## Step 1 Resolve mode
23
34
 
24
- <available_tools>
25
- - AskUserQuestion collect user input
26
- - Read read current config.yaml
27
- - Write write updated config.yaml
28
- - Bash validate git state if needed
29
- </available_tools>
35
+ Parse `$ARGUMENTS`:
36
+ - `show` (or empty) run Step 1.5 then Step 2 (interactive)
37
+ - `get <key>` Step 1.7 then STOP
38
+ - `set <key> <value>` Step 1.8 then STOP
39
+ - anything else print usage from Step 0 and STOP
30
40
 
31
- ## Step 1 — Initialize
41
+ ## Step 1.5Show current settings
32
42
 
33
- Load current settings from `.rihal/config.yaml`:
43
+ Read each known key via `rihal-tools.cjs config-get <dotted.key>` (the
44
+ nested-safe reader in `rihal/bin/lib/config.cjs`). **Do not** call the legacy
45
+ `config set` — it uses a flat YAML parser and corrupts nested sections.
34
46
 
35
47
  ```bash
36
- [ -f .rihal/config.yaml ] && cat .rihal/config.yaml || echo "# No config yet"
48
+ TOOL="node .rihal/bin/rihal-tools.cjs"
49
+ $TOOL config-get user_name || echo "(unset)"
50
+ $TOOL config-get communication_language || echo "(unset)"
51
+ $TOOL config-get mode || echo "(unset)"
52
+ $TOOL config-get model_profile || echo "(unset)"
53
+ $TOOL config-get workflow.research_by_default || echo "(unset)"
54
+ $TOOL config-get workflow.plan_checker || echo "(unset)"
55
+ $TOOL config-get workflow.post_execute_gates || echo "(unset)"
56
+ $TOOL config-get workflow.ui_safety_gate || echo "(unset)"
57
+ $TOOL config-get workflow.discuss_mode || echo "(unset)"
58
+ $TOOL config-get git.branching_strategy || echo "(unset)"
59
+ $TOOL config-get git.commit_docs || echo "(unset)"
60
+ $TOOL config-get output.verbose || echo "(unset)"
37
61
  ```
38
62
 
39
- Parse the config to extract current values:
40
- - `model_profile` (default: "balanced")
41
- - `enable_research_pre_step` (default: "false")
42
- - `enable_plan_checker_loop` (default: "true")
43
- - `enable_post_execute_verifier` (default: "false")
44
- - `branching_strategy` (default: "none")
45
-
46
- Store these as `current_*` variables for pre-fill use.
47
-
48
- ## Step 2 — Collect Settings
49
-
50
- Use AskUserQuestion to prompt the user for each setting. Pre-fill current values where applicable.
51
-
52
- ### Setting 1: Model Profile
63
+ Render as a table:
53
64
 
54
65
  ```
55
- Question:
56
- Which model profile would you like to use?
66
+ Current Rihal Settings (.rihal/config.yaml)
57
67
 
58
- Options:
59
- 1. quality (Opus for reasoning agents, Sonnet for executor, Haiku for utilities)
60
- 2. balanced (Sonnet across the board) [CURRENT]
61
- 3. budget (Haiku across the board)
62
- 4. inherit (Use parent session model, no override)
68
+ Identity
69
+ user_name : {value}
70
+ communication_language : {value}
63
71
 
64
- Your choice: [pre-filled with current_model_profile]
65
- ```
72
+ Execution
73
+ mode : {value} # guided | yolo
74
+ model_profile : {value} # quality | balanced | budget | inherit
66
75
 
67
- Valid responses: 1, 2, 3, 4, or exact names (quality, balanced, budget, inherit).
68
- Map numeric choices to profile names. Store as `new_model_profile`.
76
+ Workflow gates
77
+ workflow.research_by_default : {value} # true | false
78
+ workflow.plan_checker : {value} # true | false
79
+ workflow.post_execute_gates : {value} # true | false
80
+ workflow.ui_safety_gate : {value} # true | false
81
+ workflow.discuss_mode : {value} # adaptive | discuss | skip
69
82
 
70
- ### Setting 2: Enable Research Pre-step
83
+ Output
84
+ output.verbose : {value} # false (slim, default) | true (full detail)
71
85
 
86
+ Git
87
+ git.branching_strategy : {value} # none | feature-branch | worktree-isolation
88
+ git.commit_docs : {value} # true | false
72
89
  ```
73
- Question:
74
- Enable research pre-step in /rihal:plan by default?
75
90
 
76
- This runs a research phase before planning if enabled, providing additional context.
91
+ If invoked as `/rihal:settings show`, STOP here.
77
92
 
78
- Options:
79
- 1. Yes
80
- 2. No [CURRENT]
93
+ ## Step 1.7 — `get <key>`
81
94
 
82
- Your choice:
95
+ ```bash
96
+ node .rihal/bin/rihal-tools.cjs config-get "$KEY"
83
97
  ```
84
98
 
85
- Valid responses: 1/yes/y or 2/no/n. Store as `new_enable_research_pre_step` (true/false string).
86
-
87
- ### Setting 3: Enable Plan-Checker Loop
99
+ Print the result (empty output means unset). STOP.
88
100
 
89
- ```
90
- Question:
91
- Enable sprint-checker loop during /rihal:plan?
101
+ ## Step 1.8 — `set <key> <value>`
92
102
 
93
- This verifies and repairs plans before execution if enabled.
103
+ Validate the key against the table in Step 1.5 — reject unknown keys with
104
+ the table printed.
94
105
 
95
- Options:
96
- 1. Yes [CURRENT]
97
- 2. No
106
+ Validate the value:
107
+ - `mode` ∈ {guided, yolo}
108
+ - `model_profile` ∈ {quality, balanced, budget, inherit}
109
+ - `workflow.discuss_mode` ∈ {adaptive, discuss, skip}
110
+ - `git.branching_strategy` ∈ {none, feature-branch, worktree-isolation}
111
+ - `workflow.*` booleans ∈ {true, false}
112
+ - `output.verbose` ∈ {true, false}
98
113
 
99
- Your choice:
114
+ ```bash
115
+ node .rihal/bin/rihal-tools.cjs config-set "$KEY" "$VALUE"
100
116
  ```
101
117
 
102
- Valid responses: 1/yes/y or 2/no/n. Store as `new_enable_plan_checker_loop` (true/false string).
103
-
104
- ### Setting 4: Enable Post-Execute Verifier Gates
105
-
118
+ Print:
106
119
  ```
107
- Question:
108
- Enable post-execute verifier gates?
109
-
110
- This runs verification after each task execution to catch regressions and issues.
111
-
112
- Options:
113
- 1. Yes
114
- 2. No [CURRENT]
115
-
116
- Your choice:
120
+ ✓ {key} = {value}
117
121
  ```
118
122
 
119
- Valid responses: 1/yes/y or 2/no/n. Store as `new_enable_post_execute_verifier` (true/false string).
120
-
121
- ### Setting 5: Branching Strategy
123
+ STOP.
122
124
 
123
- ```
124
- Question:
125
- What branching strategy should workflows use?
125
+ ## Step 2 — Interactive edit
126
126
 
127
- Options:
128
- 1. none (No branching, work on current branch)
129
- 2. feature-branch (Create feature branches, leave checkout to user)
130
- 3. worktree-isolation (Use git worktrees for isolated work)
127
+ After Step 1.5 prints the table, use the **`AskUserQuestion` tool** to prompt:
131
128
 
132
- Your choice: [pre-filled with current_branching_strategy]
133
129
  ```
130
+ Which setting would you like to change?
134
131
 
135
- Valid responses: 1, 2, 3, or exact names (none, feature-branch, worktree-isolation).
136
- Map numeric choices to strategy names. Store as `new_branching_strategy`.
132
+ 1. mode (guided / yolo)
133
+ 2. model_profile (quality / balanced / budget / inherit)
134
+ 3. workflow.research_by_default (true / false)
135
+ 4. workflow.plan_checker (true / false)
136
+ 5. workflow.post_execute_gates (true / false)
137
+ 6. workflow.ui_safety_gate (true / false)
138
+ 7. workflow.discuss_mode (adaptive / discuss / skip)
139
+ 8. git.branching_strategy (none / feature-branch / worktree-isolation)
140
+ 9. git.commit_docs (true / false)
141
+ 10. communication_language
142
+ 11. output.verbose (true / false)
143
+ 0. Done — exit
144
+ ```
137
145
 
138
- ## Step 3 Write Config
146
+ When the user picks a number, use **`AskUserQuestion` tool** again to ask for
147
+ the new value, showing the allowed values for that key.
139
148
 
140
- After collecting all settings, write them back to `.rihal/config.yaml` using `rihal-tools.cjs config set`:
149
+ Then call:
141
150
 
142
151
  ```bash
143
- node .rihal/bin/rihal-tools.cjs config set --key model_profile --value "$new_model_profile"
144
- node .rihal/bin/rihal-tools.cjs config set --key enable_research_pre_step --value "$new_enable_research_pre_step"
145
- node .rihal/bin/rihal-tools.cjs config set --key enable_plan_checker_loop --value "$new_enable_plan_checker_loop"
146
- node .rihal/bin/rihal-tools.cjs config set --key enable_post_execute_verifier --value "$new_enable_post_execute_verifier"
147
- node .rihal/bin/rihal-tools.cjs config set --key branching_strategy --value "$new_branching_strategy"
152
+ node .rihal/bin/rihal-tools.cjs config-set "{dotted.key}" "{value}"
148
153
  ```
149
154
 
150
- ## Step 4 Confirm and Print
155
+ After each successful write, re-display the affected row so the user sees the
156
+ change took effect.
151
157
 
152
- Print a summary of the new settings:
158
+ Use **`AskUserQuestion`** again to loop ask which setting to change next —
159
+ until the user picks `0` or `done`.
153
160
 
154
- ```
155
- ✓ Settings updated successfully!
161
+ ## Step 3 — Closing summary
156
162
 
157
- Model Profile: $new_model_profile
158
- Research pre-step: $new_enable_research_pre_step
159
- Plan-checker loop: $new_enable_plan_checker_loop
160
- Post-execute verifier: $new_enable_post_execute_verifier
161
- Branching strategy: $new_branching_strategy
163
+ Print:
162
164
 
163
- Settings saved to: .rihal/config.yaml
164
165
  ```
166
+ ✓ Settings saved to .rihal/config.yaml
165
167
 
166
- Print a tip:
167
-
168
- ```
169
- Tip: Use /rihal:resume-work to reload config and continue work.
168
+ Tip: settings take effect on the next workflow run. Use /rihal:settings show
169
+ to verify, or /rihal:resume-work to reload context.
170
170
  ```
171
171
 
172
172
  ## Success Criteria
173
173
 
174
- - [ ] Task completed as requested
175
- - [ ] Output saved or reported
176
- - [ ] State updated if necessary
177
- - [ ] No errors encountered
174
+ - [ ] `/rihal:settings show` prints all 11 keys (no `(unset)` for keys with defaults)
175
+ - [ ] `/rihal:settings set workflow.discuss_mode discuss` round-trips: `config-get` returns `discuss`
176
+ - [ ] After any save, sibling keys in `workflow:` and `git:` blocks are preserved (no nesting corruption)
177
+ - [ ] Unknown keys are rejected with the allowed-keys table
178
178
 
179
179
  ## On Error
180
180
 
181
- If arguments are invalid, missing files, or subagent fails:
182
- - Validate inputs match expected format
183
- - Check that required files exist
184
- - Retry with clearer arguments or report the specific error to the user
185
-
181
+ - **`.rihal/config.yaml` missing:** print "No config found. Run /rihal:init first." and STOP.
182
+ - **Invalid key:** print the allowed keys from Step 1.5 and STOP.
183
+ - **Invalid value:** print the allowed values for that key and STOP.
184
+ - **`rihal-tools.cjs` missing:** print "Run: npx @hanzlaa/rcode install ." and STOP.
@@ -1,5 +1,35 @@
1
1
  <purpose>
2
- Create a pull request from completed phase/milestone work, generate a rich PR body from planning artifacts, optionally run code review, and prepare for merge. Closes the plan → execute → verify → ship loop.
2
+ Push a verified feature branch and open a pull request with an auto-generated
3
+ body drawn from planning artifacts (ROADMAP, VERIFICATION, SUMMARY). Closes
4
+ the plan → execute → verify → **ship** loop.
5
+
6
+ **What this command does:**
7
+ 1. Runs preflight: clean tree, on a feature branch, VERIFICATION.md passed, gh CLI authenticated
8
+ 2. Pushes the branch to origin
9
+ 3. Generates a rich PR body — phase goal, list of changes, requirements addressed, verification status
10
+ 4. Creates the PR via `gh pr create`
11
+ 5. Optionally requests a reviewer
12
+ 6. Updates STATE.md with shipping status
13
+
14
+ **Preconditions (all must be true before running):**
15
+ - `/rihal:execute <phase>` completed
16
+ - `/rihal:verify-phase <phase>` passed (VERIFICATION.md exists with `status: passed`)
17
+ - You are on a feature branch (not main/develop directly)
18
+ - `gh` CLI is authenticated (`gh auth status`)
19
+
20
+ **This command is NOT for:**
21
+ - Publishing npm packages → use `npm publish`
22
+ - Creating git release tags → use `git tag -a vX.Y.Z && git push --tags`
23
+ - Repos that commit directly to main (`git.branching_strategy: none`)
24
+ - The rihal-code framework repo itself (no phases exist there)
25
+
26
+ **Typical usage:**
27
+ ```
28
+ /rihal:plan 1 → plan the phase
29
+ /rihal:execute 1 → build it
30
+ /rihal:verify-phase 1 → prove it works
31
+ /rihal:ship 1 → PR it ← you are here
32
+ ```
3
33
  </purpose>
4
34
 
5
35
  <required_reading>
@@ -1,11 +1,46 @@
1
1
  # Workflow: rihal:sprint-planning
2
2
 
3
3
  <purpose>
4
- Plan the next sprint: compute capacity from velocity history, prioritize stories from phase scope, create SPRINT.md, register sprint + stories in state.json.
5
-
6
- Uses rihal-tools.cjs sprint/story state commands for tracking.
4
+ Plan the next sprint. Authoritative implementation lives in the
5
+ `rihal-sprint-planning` skill — this workflow delegates to it so every
6
+ safety rail (capacity gate per #127, halt-at-menu per #124, state-sync
7
+ per #198) fires identically whether the user invokes the slash command
8
+ or the phrase-activated skill.
9
+
10
+ The skill MUST be loaded before the in-line steps below run. If the skill
11
+ file is missing (broken install), report and stop — do not silently fall
12
+ back to the in-line implementation.
7
13
  </purpose>
8
14
 
15
+ <delegate_to_skill>
16
+ Required skill: `rihal-sprint-planning`
17
+ Path: `.claude/skills/rihal-sprint-planning/SKILL.md`
18
+ Workflow ref: `.claude/skills/rihal-sprint-planning/workflow.md`
19
+
20
+ Behaviour:
21
+ 1. Load the skill's `SKILL.md` and `workflow.md`. Apply every Critical
22
+ Rule from the workflow's `## CRITICAL RULES (NO EXCEPTIONS)` block,
23
+ including the capacity gate (step n="0") which MUST halt for
24
+ numeric capacity inputs before any story is committed.
25
+ 2. Run the skill's step files in order. The in-line steps below this
26
+ block are a fallback summary for legacy installs that lack the skill;
27
+ they are NOT the authoritative behaviour.
28
+ 3. After SPRINT.md is written, ALWAYS run:
29
+ `node .rihal/bin/rihal-tools.cjs state sync --from-disk`
30
+ so state.sprints[] reflects the new sprint.
31
+
32
+ If skill files are missing: print
33
+ "Sprint-planning skill not installed. Run: npx @hanzlaa/rcode install"
34
+ and exit non-zero. Do not proceed with the legacy in-line steps because
35
+ they bypass the capacity gate.
36
+ </delegate_to_skill>
37
+
38
+ <required_reading>
39
+ @.rihal/references/output-format.md
40
+ @rihal/brain/best-practices/no-autonomous-bypass.md
41
+ @rihal/brain/best-practices/state-sync-rule.md
42
+ </required_reading>
43
+
9
44
  <output_format>
10
45
  Open with banner:
11
46
  ```
@@ -13,15 +48,11 @@ Open with banner:
13
48
  RIHAL ► PLANNING SPRINT
14
49
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
15
50
  ```
16
- TaskCreate: "Load phase scope + velocity", "Curate stories with user", "Register sprint + stories in state", "Write SPRINT.md", "Start sprint".
51
+ TaskCreate: "Load phase scope + velocity", "Capacity gate (halt for numbers)", "Curate stories with user", "Register sprint + stories in state", "Write SPRINT.md", "Sync state", "Start sprint".
17
52
  Closure: `RIHAL ► SPRINT {NN.S} READY ✓ ({N} stories, {M} points)`
18
53
  Next Up: `/rihal:execute .planning/phases/{phase}/SPRINT.md`
19
54
  </output_format>
20
55
 
21
- <required_reading>
22
- @.rihal/references/output-format.md
23
- </required_reading>
24
-
25
56
  <process>
26
57
  ## Step 0 — Usage check
27
58
 
@@ -16,10 +16,15 @@ Render a human-readable project status dashboard. All data comes from a single `
16
16
 
17
17
  ```bash
18
18
  SNAPSHOT=$(node .rihal/bin/rihal-tools.cjs progress init)
19
+ VERBOSE=$(node .rihal/bin/rihal-tools.cjs config-get output.verbose 2>/dev/null || echo "false")
19
20
  ```
20
21
 
21
22
  Parse as JSON. If `SNAPSHOT.ok` is not true, print a one-line error and stop.
22
23
 
24
+ **Slim mode** (default when `VERBOSE != "true"`): Output Steps 2–3 only (banner + phases list). Skip decisions, blockers detail, and route menu — just print the top route as a single "Next: `/rihal:X`" line. Append `(run /rihal:status --verbose for full detail)`.
25
+
26
+ **Verbose mode** (`VERBOSE == "true"` or `$ARGUMENTS` contains `--verbose`): Full Steps 2–6 output.
27
+
23
28
  If `SNAPSHOT.project` is empty and `SNAPSHOT.phases` is empty, print:
24
29
 
25
30
  ```
@@ -22,7 +22,7 @@ If `$ARGUMENTS` is empty or contains only `--help` or `-h`:
22
22
  STOP — do not proceed.
23
23
 
24
24
  <available_agent_types>
25
- - `rihal-ui-designer` — UI specification generator
25
+ - `rihal-ux-designer` — UI specification generator
26
26
  </available_agent_types>
27
27
 
28
28
  ## Step 0 — Initialize
@@ -51,11 +51,11 @@ Load existing design system, extract:
51
51
 
52
52
  ## Step 2 — Spawn UI Designer
53
53
 
54
- Spawn `rihal-ui-designer` subagent:
54
+ Spawn `rihal-ux-designer` subagent:
55
55
 
56
56
  ```
57
57
  Task tool call:
58
- subagent_type: "rihal-ui-designer"
58
+ subagent_type: "rihal-ux-designer"
59
59
  description: "Generate UI-SPEC.md"
60
60
  prompt: |
61
61
  Generate a UI-SPEC.md file with the following structure:
@@ -1,39 +1,56 @@
1
1
  # Workflow: rihal:update
2
2
 
3
3
  <purpose>
4
- Detect package updates for rihal-code by comparing installed file hashes against source package hashes. Show changelog (added/changed/removed files), ask user confirmation, then run installer with --force --yes if approved.
4
+ Pull the latest rcode from npm and install it **non-destructively**
5
+ overwrite only files the user hasn't customized since their last install.
6
+ User-modified files are preserved and reported. Closes #232.
7
+
8
+ Default invocation:
9
+ ```
10
+ npx @hanzlaa/rcode@latest install . --non-destructive --yes
11
+ ```
12
+
13
+ The `--non-destructive` flag (set by default in this workflow) makes the
14
+ installer compare each file's current SHA256 to the SHA256 stored in
15
+ `.rihal/_config/files-manifest.csv` from the previous install:
16
+ - Hashes match → file is pristine → safe to overwrite with new version
17
+ - Hashes differ → user has edited it → SKIP and report
18
+
19
+ Per-project state is ALWAYS preserved (never touched by either mode):
20
+ - `.rihal/config.yaml`
21
+ - `.rihal/state.json` (and `.lock`)
22
+ - `.planning/` (PRD, ROADMAP, sprints, SUMMARY files)
23
+ - `.rihal/brain/` content (refreshed via `brain pull` separately)
5
24
  </purpose>
6
25
 
7
26
 
8
27
  ## Step 0 — Usage check
9
28
 
10
- If `$ARGUMENTS` is empty or contains only `--help` or `-h`:
29
+ If `$ARGUMENTS` contains `--help` or `-h`:
11
30
 
12
31
  ```
13
- /rihal:update <argument-here>
32
+ /rihal:update # pull latest, preserve user-modified files
33
+ /rihal:update v2.4.0 # pin to a specific version
34
+ /rihal:update --force-overwrite # discard local edits, overwrite all rcode files
14
35
  ```
15
36
 
16
37
  **Examples:**
17
38
  ```
18
- /rihal:update example 1
19
- /rihal:update example 2
39
+ /rihal:update
40
+ /rihal:update v2.4.0
41
+ /rihal:update --force-overwrite
20
42
  ```
21
43
 
22
- STOP — do not proceed.
23
-
24
44
  ## Step 1 — Locate installed package
25
45
 
26
- Find the rihal-code package using one of these strategies (in order):
27
- 1. Check `$(npm root -g)/rihal-code/cli/install-v2.js` (global install)
28
- 2. Check `./cli/install-v2.js` (local install)
29
- 3. If neither exists, print:
30
- ```
31
- rihal-code package not found. Install with:
32
- npm install -g rihal-code
33
- ```
34
- Exit.
46
+ Find the local rcode installer (used as the network-fallback path in
47
+ Step 7). Try in order:
48
+
49
+ 1. `$(npm root -g)/@hanzlaa/rcode/cli/install.js` (global install)
50
+ 2. `./cli/install.js` (local clone)
51
+ 3. If neither exists, skip Step 7's primary path uses `npx @hanzlaa/rcode@latest` and works without a local installer.
35
52
 
36
- Store the installer path in `$INSTALLER_PATH`.
53
+ Store the resolved path (or empty) in `$INSTALLER_PATH`.
37
54
 
38
55
  ## Step 2 — Read installed manifest
39
56
 
@@ -45,8 +62,8 @@ cat .rihal/_config/files-manifest.csv
45
62
 
46
63
  If the file doesn't exist:
47
64
  ```
48
- ℹ️ No rihal installation detected in this project.
49
- Run: node <installer-path> . --force --yes
65
+ ℹ️ No rcode installation detected in this project.
66
+ Run: npx @hanzlaa/rcode@latest install . --yes
50
67
  ```
51
68
  Exit.
52
69
 
@@ -121,20 +138,61 @@ Options:
121
138
  - If user chooses [1], proceed to Step 7
122
139
  - If user chooses [2], print "Update cancelled" and exit
123
140
 
124
- ## Step 7 — Apply update
141
+ ## Step 7 — Apply update (non-destructive by default per #232)
125
142
 
126
- Run the installer with `--force --yes`:
143
+ Pull from npm AND install non-destructively. User-modified files are
144
+ preserved automatically; the installer reports each one in the summary.
127
145
 
128
146
  ```bash
129
- node "$INSTALLER_PATH" . --force --yes
147
+ npx @hanzlaa/rcode@latest install . --non-destructive --yes
148
+ ```
149
+
150
+ **If the user explicitly wants destructive overwrite** (rare — only
151
+ when they intentionally want to discard their customizations):
152
+
153
+ ```bash
154
+ npx @hanzlaa/rcode@latest install . --force-overwrite --yes
155
+ ```
156
+
157
+ **Version pinning** — if the user passed `/rihal:update v2.4.0`, pass
158
+ the version through:
159
+
160
+ ```bash
161
+ npx @hanzlaa/rcode@2.4.0 install . --non-destructive --yes
162
+ ```
163
+
164
+ **Local fallback** — if the user's network can't reach npm, fall back
165
+ to the locally-cached installer (still non-destructive):
166
+
167
+ ```bash
168
+ node "$INSTALLER_PATH" . --non-destructive --yes
130
169
  ```
131
170
 
132
171
  If the command exits with non-zero status, print:
172
+
133
173
  ```
134
174
  ❌ Update failed. Check the output above.
175
+ Tip: try --force-overwrite if you intentionally want to overwrite
176
+ your customizations, or run with the local installer fallback.
135
177
  ```
178
+
136
179
  Exit with error code.
137
180
 
181
+ ## Step 7.5 — Surface preserved files
182
+
183
+ The installer's stdout will include a "user-modified preserved" report
184
+ when relevant. Capture it and re-print as a callout so users notice:
185
+
186
+ ```
187
+ ℹ Files preserved (your customizations were kept):
188
+ - .claude/skills/rihal-create-prd/workflow.md
189
+ - rihal/workflows/sprint-planning.md
190
+ - .rihal/references/output-format.md
191
+
192
+ These will not auto-update on future /rihal:update calls. To force
193
+ their update next time, run /rihal:update --force-overwrite.
194
+ ```
195
+
138
196
  ## Step 8 — Pull Rihal brain content (v2.0)
139
197
 
140
198
  After installer finishes, refresh the brain content from configured sources (issue #158). This is idempotent and safe to re-run.
@@ -83,7 +83,13 @@ No gaps → skip to Step 6, set `nyquist_compliant: true`.
83
83
 
84
84
  ## 4. Present Gap Plan
85
85
 
86
- Call AskUserQuestion with gap table and options:
86
+ ```bash
87
+ CONFIG_MODE=$(node .rihal/bin/rihal-tools.cjs config-get mode 2>/dev/null || echo "guided")
88
+ ```
89
+
90
+ **If `CONFIG_MODE == "yolo"`:** Auto-select option 1 ("Fix all gaps") and proceed to Step 5 without asking. Print: `▶ Auto-fixing all gaps (yolo mode).`
91
+
92
+ Otherwise call AskUserQuestion with gap table and options:
87
93
  1. "Fix all gaps" → Step 5
88
94
  2. "Skip — mark manual-only" → add to Manual-Only, Step 6
89
95
  3. "Cancel" → exit