@hanzlaa/rcode 2.2.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 (72) hide show
  1. package/CONTRIBUTING.md +138 -0
  2. package/README.md +76 -17
  3. package/cli/install.js +312 -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 +11 -31
  24. package/rihal/commands/audit.md +8 -0
  25. package/rihal/commands/checkpoint-preview.md +13 -0
  26. package/rihal/commands/config.md +4 -4
  27. package/rihal/commands/prfaq.md +15 -0
  28. package/rihal/commands/settings.md +2 -2
  29. package/rihal/references/agent-contracts.md +12 -0
  30. package/rihal/references/karpathy-guidelines-full.md +79 -0
  31. package/rihal/references/karpathy-guidelines.md +8 -76
  32. package/rihal/references/model-profile-resolution.md +8 -0
  33. package/rihal/references/phase-argument-parsing.md +11 -0
  34. package/rihal/references/revision-loop.md +11 -0
  35. package/rihal/references/universal-anti-patterns.md +15 -0
  36. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +10 -0
  37. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +3 -1
  38. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +3 -1
  39. package/rihal/skills/actions/2-plan/rihal-create-milestone/steps/step-10-complete.md +1 -1
  40. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +13 -0
  41. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +4 -2
  42. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +10 -0
  43. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +3 -1
  44. package/rihal/skills/agents/hussain-pm/SKILL.md +8 -0
  45. package/rihal/skills/agents/hussain-sm/SKILL.md +8 -0
  46. package/rihal/templates/UAT.md +29 -0
  47. package/rihal/templates/milestone.md +2 -0
  48. package/rihal/templates/sprint.md +11 -28
  49. package/rihal/templates/summary.md +30 -0
  50. package/rihal/templates/verification-report.md +28 -0
  51. package/rihal/workflows/audit-milestone.md +34 -2
  52. package/rihal/workflows/audit.md +172 -0
  53. package/rihal/workflows/autonomous.md +67 -0
  54. package/rihal/workflows/checkpoint-preview.md +7 -0
  55. package/rihal/workflows/council.md +3 -1
  56. package/rihal/workflows/debug.md +8 -1
  57. package/rihal/workflows/diagnose-issues.md +34 -0
  58. package/rihal/workflows/do.md +47 -3
  59. package/rihal/workflows/execute-sprint.md +11 -4
  60. package/rihal/workflows/execute.md +9 -3
  61. package/rihal/workflows/karpathy-audit.md +7 -14
  62. package/rihal/workflows/pause-work.md +7 -1
  63. package/rihal/workflows/prfaq.md +7 -0
  64. package/rihal/workflows/profile-user.md +2 -2
  65. package/rihal/workflows/settings.md +116 -118
  66. package/rihal/workflows/sprint-planning.md +39 -8
  67. package/rihal/workflows/status.md +5 -0
  68. package/rihal/workflows/ui-phase.md +3 -3
  69. package/rihal/workflows/update.md +80 -22
  70. package/rihal/workflows/validate-phase.md +7 -1
  71. package/rihal/agents/rihal-ui-designer.md +0 -6
  72. package/rihal/workflows/config.md +0 -105
@@ -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.
@@ -1,105 +0,0 @@
1
- # Workflow: rihal:config
2
-
3
- <purpose>
4
- View or interactively edit Rihal project configuration (language, mode, model profile, branching strategy).
5
- </purpose>
6
-
7
- ## Step 0 — Usage check
8
-
9
- If `$ARGUMENTS` is empty or contains only `--help` or `-h`:
10
-
11
- ```
12
- /rihal:config [show | set <key> <value>]
13
- ```
14
-
15
- **Examples:**
16
- ```
17
- /rihal:config show
18
- /rihal:config set communication_language Arabic
19
- /rihal:config set mode yolo
20
- ```
21
-
22
- If no arguments provided, enter interactive mode (Step 2).
23
-
24
- ## Step 1 — Parse input
25
-
26
- - If first argument is `show` (or no args): proceed to Step 1.5 (display current config)
27
- - If first argument is `set`: proceed to Step 2 (update value)
28
- - Otherwise: treat as interactive mode
29
-
30
- ## Step 1.5 — Display current config
31
-
32
- Read `.rihal/config.yaml` and print in formatted table:
33
-
34
- ```
35
- Current Rihal Configuration:
36
- user_name : {value}
37
- project_name : {value}
38
- communication_language : {value}
39
- mode : {value}
40
- model_profile : {value}
41
- branching_strategy : {value}
42
- ```
43
-
44
- STOP — do not proceed further.
45
-
46
- ## Step 2 — Interactive or set mode
47
-
48
- ### If `set <key> <value>`:
49
-
50
- Validate key is one of: `communication_language`, `mode`, `model_profile`, `branching_strategy`.
51
-
52
- If invalid, print error and STOP:
53
- ```
54
- Unknown config key: {key}
55
- Allowed keys: communication_language, mode, model_profile, branching_strategy
56
- ```
57
-
58
- Call:
59
- ```bash
60
- node .rihal/bin/rihal-tools.cjs config set --key {key} --value {value}
61
- ```
62
-
63
- Print success:
64
- ```
65
- ✓ Updated: {key} = {value}
66
- ```
67
-
68
- STOP.
69
-
70
- ### If no arguments (interactive mode):
71
-
72
- Use AskUserQuestion for each setting:
73
-
74
- 1. Ask: "Communication language?" (show current value)
75
- - Options: English, Arabic, Spanish, French, Chinese, etc.
76
- 2. Ask: "Mode?" (guided or yolo?)
77
- - guided = confirm at gates
78
- - yolo = autonomous execution
79
- 3. Ask: "Model profile?" (balanced, fast, or thorough?)
80
- 4. Ask: "Branching strategy?" (none, auto-branch, feature-branch, trunk-based?)
81
-
82
- After each selection, call the config set command from Step 2.
83
-
84
- Print summary:
85
- ```
86
- ✓ Configuration updated:
87
- communication_language : {value}
88
- mode : {value}
89
- model_profile : {value}
90
- branching_strategy : {value}
91
- ```
92
-
93
- STOP.
94
-
95
- ## Success Criteria
96
-
97
- - [ ] Current config displayed or updated successfully
98
- - [ ] No validation errors
99
- - [ ] .rihal/config.yaml reflects changes
100
-
101
- ## On Error
102
-
103
- - **Invalid key:** print allowed keys and stop.
104
- - **.rihal/config.yaml missing:** print "No config found. Run /rihal:init first."
105
- - **rihal-tools.cjs missing:** tell user to run `rihal-code install-v2`.