@hanzlaa/rcode 2.1.0 → 2.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 (76) hide show
  1. package/CONTRIBUTING.md +138 -0
  2. package/README.md +83 -19
  3. package/cli/install.js +687 -80
  4. package/cli/uninstall.js +8 -0
  5. package/dist/rcode.js +19777 -0
  6. package/package.json +17 -4
  7. package/rihal/DOCS-AUDIT.md +14 -0
  8. package/rihal/agents/rihal-code-reviewer.md +1 -1
  9. package/rihal/agents/rihal-codebase-mapper.md +1 -1
  10. package/rihal/agents/rihal-docs-auditor.md +1 -1
  11. package/rihal/agents/rihal-edge-case-hunter.md +1 -1
  12. package/rihal/agents/rihal-executor.md +1 -1
  13. package/rihal/agents/rihal-hussain-pm.md +1 -0
  14. package/rihal/agents/rihal-nyquist-auditor.md +1 -1
  15. package/rihal/agents/rihal-phase-researcher.md +1 -2
  16. package/rihal/agents/rihal-planner.md +1 -1
  17. package/rihal/agents/rihal-roadmapper.md +1 -0
  18. package/rihal/agents/rihal-security-adversary.md +1 -1
  19. package/rihal/agents/rihal-security-auditor.md +1 -1
  20. package/rihal/agents/rihal-sprint-checker.md +1 -1
  21. package/rihal/agents/rihal-verifier.md +1 -1
  22. package/rihal/bin/lib/roadmap.cjs +2 -3
  23. package/rihal/bin/rihal-tools.cjs +153 -36
  24. package/rihal/brain/sources.yaml +7 -4
  25. package/rihal/commands/audit.md +8 -0
  26. package/rihal/commands/checkpoint-preview.md +13 -0
  27. package/rihal/commands/config.md +4 -4
  28. package/rihal/commands/prfaq.md +15 -0
  29. package/rihal/commands/settings.md +2 -2
  30. package/rihal/references/agent-contracts.md +12 -0
  31. package/rihal/references/karpathy-guidelines-full.md +79 -0
  32. package/rihal/references/karpathy-guidelines.md +8 -76
  33. package/rihal/references/model-profile-resolution.md +8 -0
  34. package/rihal/references/phase-argument-parsing.md +11 -0
  35. package/rihal/references/revision-loop.md +11 -0
  36. package/rihal/references/universal-anti-patterns.md +15 -0
  37. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +10 -0
  38. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +3 -1
  39. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +3 -1
  40. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +1 -1
  41. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +13 -0
  42. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +4 -2
  43. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +10 -0
  44. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +3 -1
  45. package/rihal/skills/agents/hussain-pm/SKILL.md +8 -0
  46. package/rihal/skills/agents/hussain-sm/SKILL.md +8 -0
  47. package/rihal/templates/UAT.md +29 -0
  48. package/rihal/templates/milestone.md +2 -0
  49. package/rihal/templates/sprint.md +11 -28
  50. package/rihal/templates/summary.md +30 -0
  51. package/rihal/templates/verification-report.md +28 -0
  52. package/rihal/workflows/audit-milestone.md +34 -2
  53. package/rihal/workflows/audit.md +172 -0
  54. package/rihal/workflows/autonomous.md +67 -0
  55. package/rihal/workflows/checkpoint-preview.md +7 -0
  56. package/rihal/workflows/council.md +3 -1
  57. package/rihal/workflows/dashboard.md +2 -2
  58. package/rihal/workflows/debug.md +8 -1
  59. package/rihal/workflows/diagnose-issues.md +34 -0
  60. package/rihal/workflows/do.md +47 -3
  61. package/rihal/workflows/execute-sprint.md +11 -4
  62. package/rihal/workflows/execute.md +9 -3
  63. package/rihal/workflows/install.md +2 -2
  64. package/rihal/workflows/karpathy-audit.md +7 -14
  65. package/rihal/workflows/pause-work.md +7 -1
  66. package/rihal/workflows/prfaq.md +7 -0
  67. package/rihal/workflows/profile-user.md +2 -2
  68. package/rihal/workflows/progress.md +1 -1
  69. package/rihal/workflows/settings.md +116 -118
  70. package/rihal/workflows/sprint-planning.md +39 -8
  71. package/rihal/workflows/status.md +6 -1
  72. package/rihal/workflows/ui-phase.md +3 -3
  73. package/rihal/workflows/update.md +80 -22
  74. package/rihal/workflows/validate-phase.md +7 -1
  75. package/rihal/agents/rihal-ui-designer.md +0 -6
  76. package/rihal/workflows/config.md +0 -105
@@ -1,185 +1,183 @@
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).
99
+ Print the result (empty output means unset). STOP.
86
100
 
87
- ### Setting 3: Enable Plan-Checker Loop
88
-
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).
123
+ STOP.
120
124
 
121
- ### Setting 5: Branching Strategy
125
+ ## Step 2 Interactive edit
126
+
127
+ After Step 1.5 prints the table, ask:
122
128
 
123
129
  ```
124
130
  Question:
125
- What branching strategy should workflows use?
131
+ Which setting would you like to change?
126
132
 
127
133
  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)
131
-
132
- Your choice: [pre-filled with current_branching_strategy]
133
- ```
134
-
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`.
137
-
138
- ## Step 3 Write Config
139
-
140
- After collecting all settings, write them back to `.rihal/config.yaml` using `rihal-tools.cjs config set`:
134
+ 1. mode (guided / yolo)
135
+ 2. model_profile
136
+ 3. workflow.research_by_default
137
+ 4. workflow.plan_checker
138
+ 5. workflow.post_execute_gates
139
+ 6. workflow.ui_safety_gate
140
+ 7. workflow.discuss_mode
141
+ 8. git.branching_strategy
142
+ 9. git.commit_docs
143
+ 10. communication_language
144
+ 11. output.verbose (slim output / full detail)
145
+ 0. Done — exit
146
+ ```
147
+
148
+ For each pick, present the constrained option set from Step 1.8, accept the
149
+ choice, 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 from Step 1.5 so the
156
+ user sees the change took effect.
151
157
 
152
- Print a summary of the new settings:
158
+ Loop until the user picks `0. Done`.
153
159
 
154
- ```
155
- ✓ Settings updated successfully!
160
+ ## Step 3 — Closing summary
156
161
 
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
162
+ Print:
162
163
 
163
- Settings saved to: .rihal/config.yaml
164
164
  ```
165
+ ✓ Settings saved to .rihal/config.yaml
165
166
 
166
- Print a tip:
167
-
168
- ```
169
- Tip: Use /rihal:resume-work to reload config and continue work.
167
+ Tip: settings take effect on the next workflow run. Use /rihal:settings show
168
+ to verify, or /rihal:resume-work to reload context.
170
169
  ```
171
170
 
172
171
  ## Success Criteria
173
172
 
174
- - [ ] Task completed as requested
175
- - [ ] Output saved or reported
176
- - [ ] State updated if necessary
177
- - [ ] No errors encountered
173
+ - [ ] `/rihal:settings show` prints all 11 keys (no `(unset)` for keys with defaults)
174
+ - [ ] `/rihal:settings set workflow.discuss_mode discuss` round-trips: `config-get` returns `discuss`
175
+ - [ ] After any save, sibling keys in `workflow:` and `git:` blocks are preserved (no nesting corruption)
176
+ - [ ] Unknown keys are rejected with the allowed-keys table
178
177
 
179
178
  ## On Error
180
179
 
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
-
180
+ - **`.rihal/config.yaml` missing:** print "No config found. Run /rihal:init first." and STOP.
181
+ - **Invalid key:** print the allowed keys from Step 1.5 and STOP.
182
+ - **Invalid value:** print the allowed values for that key and STOP.
183
+ - **`rihal-tools.cjs` missing:** print "Run: npx @hanzlaa/rcode install ." and STOP.
@@ -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/skills/_shared/no-autonomous-bypass.md
41
+ @.rihal/skills/_shared/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
  ```
@@ -111,6 +116,6 @@ Group routes by letter. If multiple routes share a letter, list them indented. I
111
116
 
112
117
  ## On Error
113
118
 
114
- - **CLI not found:** "Rihal Code install missing. Run: npx @hanzlahabib/rihal-code install"
119
+ - **CLI not found:** "Rihal Code install missing. Run: npx @hanzlaa/rcode install"
115
120
  - **state.json invalid JSON:** report the CLI's exact error string — the CLI already has a clean error shape.
116
121
  - **Unexpected shape:** fall back to the banner + "State present but unreadable. Try: node .rihal/bin/rihal-tools.cjs state read"
@@ -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
@@ -1,6 +0,0 @@
1
- ---
2
- name: rihal-ui-designer
3
- description: Alias for rihal-ux-designer. Use that agent type instead.
4
- ---
5
-
6
- This agent is an alias for `rihal-ux-designer`. Spawn `rihal-ux-designer` directly.