@hanzlaa/rcode 2.3.5 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,184 +1,46 @@
1
+ # Workflow: rihal:progress
2
+
1
3
  <purpose>
2
- Render project progress: what was accomplished, where you are, what's pending, what's next. All data comes from a single `rihal-tools progress init` call. This workflow is a pure renderer no direct markdown parsing, no state.json grep, no phase-directory walk.
4
+ **`/rihal:progress` is an alias of `/rihal:status --verbose`.**
3
5
 
4
- **SSOT:** `.rihal/state.json`, surfaced through `rihal-tools progress init`. `/rihal:progress` and `/rihal:status` call the same CLI and cannot disagree (issue #131 closed).
6
+ Historically this was a separate workflow with overlapping data and a heavier render. They both read the same source of truth (`rihal-tools progress init`), so we collapsed them: `/rihal:status` is the canonical renderer with built-in slim/verbose modes, and `/rihal:progress` is a thin alias that always runs in verbose mode.
5
7
 
6
- For a sprint-board view, use `/rihal:sprint-status`. For a concise dashboard, use `/rihal:status`. This workflow gives the full narrative view with recent-work excerpts and an intent-tree Next Up menu.
8
+ Use whichever name you prefer they produce the same output.
7
9
  </purpose>
8
10
 
9
11
  <required_reading>
10
- @.rihal/references/output-format.md
11
- Read all files referenced by the invoking prompt's execution_context before starting.
12
+ @.rihal/workflows/status.md
12
13
  </required_reading>
13
14
 
14
- <output_format>
15
- Banner from output-format.md:
16
-
17
- ```
18
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
19
- RIHAL ► PROGRESS
20
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
21
- ```
22
-
23
- Use ✓ complete / ◆ in_progress / ○ planned / 🅿 parking-lot throughout.
24
- End with a Next Up block rendered from the CLI's `routes[]` array.
25
- </output_format>
26
-
27
15
  <process>
28
16
 
29
- <step name="init_context">
30
-
31
- ## 1. Init context
32
-
33
- Fetch the full progress snapshot in a single call:
34
-
35
- ```bash
36
- SNAPSHOT=$(node .rihal/bin/rihal-tools.cjs progress init)
37
- ```
38
-
39
- Parse as JSON.
40
-
41
- If `SNAPSHOT.project` is null AND `SNAPSHOT.phases[]` is empty:
42
-
43
- ```
44
- No planning structure found.
45
-
46
- Run /rihal:new-project to start a new project.
47
- ```
48
-
49
- Exit.
17
+ ## Step 1 — Delegate to /rihal:status in verbose mode
50
18
 
51
- Read `DISCUSS_MODE` from config (separate cheap call):
52
-
53
- ```bash
54
- DISCUSS_MODE=$(node .rihal/bin/rihal-tools.cjs config 2>/dev/null | grep -oE '"discuss_mode"\s*:\s*"[^"]*"' | cut -d'"' -f4 || echo "discuss")
55
- ```
19
+ Execute the workflow defined in `.rihal/workflows/status.md` end-to-end, with one override:
56
20
 
57
- </step>
21
+ - Always render in **verbose mode** (full Steps 2–6 output: banner + phases + insights + decisions + blockers + Next Up route tree).
22
+ - Treat `$ARGUMENTS` exactly as `/rihal:status --verbose $ARGUMENTS` would.
58
23
 
59
- <step name="recent_work">
24
+ Do not parse ROADMAP.md, walk SUMMARY.md files, or grep state.json directly. If the underlying CLI reports a drift insight, surface it — do not silently compensate.
60
25
 
61
- ## 2. Recent work excerpts
26
+ ## Step 2 Footer note (one-time alias hint)
62
27
 
63
- For the last 2-3 phase directories with SUMMARY.md, pull the one-liner field surgically:
28
+ After the verbose status output, append a single grey line:
64
29
 
65
- ```bash
66
- # find the 3 most recent SUMMARY.md files
67
- (find .planning/phases -name "SUMMARY.md" -o -name "*-SUMMARY.md" 2>/dev/null) | xargs -r ls -t 2>/dev/null | head -3 | while read f; do
68
- node .rihal/bin/rihal-tools.cjs summary-extract "$f" --fields one_liner,status
69
- done
70
30
  ```
71
-
72
- Each call returns `{ ok: true, one_liner: "...", status: "..." }`. Collect into an in-memory list for rendering. This avoids loading full SUMMARY.md bodies — context-expensive and unnecessary.
73
-
74
- </step>
75
-
76
- <step name="insights">
77
-
78
- ## 3. Insights — surface what the CLI noticed
79
-
80
- `SNAPSHOT.insights[]` contains drift warnings, between-milestone detection, phase-dir undercount. Render above the progress bar so the user sees divergences immediately:
81
-
82
- ```
83
- ⚠ {insight.message} (severity: warn)
84
- ℹ {insight.message} (severity: info)
85
- ```
86
-
87
- Each insight that mentions a fix command should have it surfaced exactly as-is — e.g. "Run: node .rihal/bin/rihal-tools.cjs state sync --from-disk".
88
-
89
- </step>
90
-
91
- <step name="report">
92
-
93
- ## 4. Render the progress view
94
-
95
- ```
96
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
97
- RIHAL ► PROGRESS
98
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
99
-
100
- # {SNAPSHOT.project}
101
-
102
- {insights block — printed FIRST if present}
103
-
104
- **Progress:** {SNAPSHOT.bar}
105
- **Milestone:** {SNAPSHOT.milestone or "—"}
106
- **Discuss mode:** {DISCUSS_MODE}
107
-
108
- ## Recent Work
109
- - [Phase {N}]: {one_liner extracted in step 2}
110
- - [Phase {N}]: {one_liner}
111
-
112
- ## Current Position
113
- Phase [{SNAPSHOT.current_phase}] of [{SNAPSHOT.phase_count}]
114
- Plan progress: {completed_count}/{phase_count}
115
-
116
- ## Key Decisions
117
- - {SNAPSHOT.decisions[].summary} — [{phase}.{plan}], {date}
118
-
119
- ## Blockers
120
- - ⚠ {SNAPSHOT.blockers[].description} — [{phase}.{plan}]
121
-
122
- ## Pending Todos
123
- - {todo count} pending — /rihal:check-todos to review
124
- (Skip if count = 0)
125
-
126
- ## Active Debug Sessions
127
- - {count} active — /rihal:debug to continue
128
- (Skip if count = 0)
129
- ```
130
-
131
- Omit any section whose underlying array is empty — don't print "Key Decisions" with zero entries.
132
-
133
- </step>
134
-
135
- <step name="next_up">
136
-
137
- ## 5. Next Up — intent tree
138
-
139
- Render `SNAPSHOT.routes[]` as a grouped menu. Group by `letter` field (A / B / C). Multiple routes per letter print indented under that letter's heading:
140
-
141
- ```
142
- ▶ Next Up
143
-
144
- [A] Execute unfinished work
145
- → /rihal:execute-phase 999.5
146
- → /rihal:execute-phase 66
147
-
148
- [B] Plan researched-but-unplanned phases
149
- → /rihal:plan-phase 68
150
-
151
- [C] Close out current milestone
152
- → /rihal:audit-milestone
153
- → /rihal:complete-milestone
154
- ```
155
-
156
- The CLI derives routes from current disk state (researched-not-planned phases, phases with pending plans, all-complete detection for milestone closure). Do NOT second-guess by walking disk yourself.
157
-
158
- If `SNAPSHOT.routes[]` is empty or only has fallback entries, print:
159
-
160
- ```
161
- ▶ Nothing obvious on deck.
162
-
163
- [A] /rihal:progress — refresh
164
- [B] /rihal:council — start a conversation on what next
165
- [C] /rihal:new-milestone — if the current cycle is done
31
+ (/rihal:progress is an alias of /rihal:status --verbose — same data, same source.)
166
32
  ```
167
33
 
168
- </step>
34
+ Skip this footer if `$ARGUMENTS` already contains `--no-alias-hint`.
169
35
 
170
36
  </process>
171
37
 
172
38
  ## Success Criteria
173
39
 
174
- - [ ] `progress init` called once not repeatedly per section
175
- - [ ] No direct parsing of ROADMAP.md, epics.md, or SUMMARY.md in the workflow body
176
- - [ ] Recent work uses `summary-extract --fields one_liner` (surgical read)
177
- - [ ] Insights section rendered when non-empty
178
- - [ ] Next Up is a grouped route tree, not a single suggestion
40
+ - [ ] Calls the status workflow with verbose mode forced
41
+ - [ ] No independent CLI parsing single source of truth via `progress init`
42
+ - [ ] Optional alias hint footer printed unless suppressed
179
43
 
180
44
  ## On Error
181
45
 
182
- - **CLI missing:** "Rihal Code install missing or stale. Run: npx @hanzlaa/rcode install"
183
- - **CLI returns `ok: false`:** surface the CLI's error verbatim. Do not attempt to compensate — the CLI's failures are the source of truth on what's wrong.
184
- - **Network-dependent insights:** there should be none. Insights are computed from local state + disk only.
46
+ Defer to `.rihal/workflows/status.md` error handling. This workflow adds nothing on top.
@@ -85,30 +85,115 @@ If user says no, exit.
85
85
  mkdir -p .planning/codebase
86
86
  ```
87
87
 
88
- ## Step 4: Spawn mapper agent
88
+ ## Step 4: Announce dispatch (persona-driven)
89
89
 
90
- Spawn a single `rihal-codebase-mapper` agent with the selected focus area:
90
+ Use the canonical dispatch-banner spec at `.rihal/references/dispatch-banner.md`. Read it now if you have not already — it defines the BMAD-style first-person hand-off the user expects.
91
+
92
+ For this workflow, the dispatched agent is `rihal-codebase-mapper` → persona **Dalil (دليل) — Codebase Scout** 🧭.
93
+
94
+ Print the DISPATCH banner per the spec. Filled-in template for this workflow:
95
+
96
+ ```
97
+ ╭─────────────────────────────────────────────────────────╮
98
+ │ 🧭 Dalil (دليل) — Codebase Scout │
99
+ ╰─────────────────────────────────────────────────────────╯
100
+
101
+ السلام عليكم — I'm Dalil, your codebase scout.
102
+
103
+ I'll map this repo for you with focus: {focus}{ — topic: "{topic}" if topic else ""}.
104
+ Before I start I'll discover every source root (not just `src/`),
105
+ detect the language mix from manifests, and — if you gave me a
106
+ topic phrase — sweep for it across all roots before narrowing.
107
+
108
+ Scope:
109
+ • Focus: {focus}
110
+ • Topic phrase: {topic-keyword or "none — broad scan"}
111
+ • Read-only: I never edit code.
112
+
113
+ Output:
114
+ → .planning/codebase/{document_list}
115
+
116
+ Working now — I'll come back with a Scan Scope declaration
117
+ so you see exactly what I covered (and what I skipped).
118
+ ```
119
+
120
+ Always first-person. Always include the deliverable path. If a topic phrase isn't provided, drop the topic-related lines rather than printing "none".
121
+
122
+ ## Step 5: Spawn mapper agent
123
+
124
+ Spawn a single `rihal-codebase-mapper` agent. Pass the persona instructions in the prompt so the agent's own response opens in-character:
91
125
 
92
126
  ```
93
127
  Task(
94
- prompt="Scan this codebase with focus: {focus}. Write results to .planning/codebase/. Produce only: {document_list}",
128
+ prompt="You are spawned as **Dalil (دليل) — Codebase Scout**. Open your response with a one-line in-character continuity beat (e.g. 'Dalil here starting the scan.') and sign your closing summary with your persona name. Use first-person.
129
+
130
+ Scan this codebase with focus: {focus}.
131
+ Topic phrase (literal search target, may be empty): {topic-keyword}
132
+ Write results to .planning/codebase/. Produce only: {document_list}.
133
+
134
+ REQUIRED — every document must open with a 'Scan Scope' section per `.rihal/agents-rules/codebase-mapper/detailed-guide.md` that declares:
135
+ - Source roots discovered (top-level non-vendored directories)
136
+ - Source roots searched (grep/glob targets)
137
+ - Source roots NOT searched and why
138
+ - Languages detected (from package manifests)
139
+ - If a topic phrase was provided: a literal `grep -rl '<phrase>' <discovered-roots>` run across ALL source roots, with the file count and an excerpt of matches
140
+
141
+ This scope section is non-negotiable — the orchestrator will reject documents missing it.",
95
142
  subagent_type="rihal-codebase-mapper",
96
143
  model="{resolved_model}"
97
144
  )
98
145
  ```
99
146
 
100
- ## Step 5: Report
147
+ ## Step 6: Announce return (persona-driven)
148
+
149
+ When the agent returns, print the RETURNED banner per `.rihal/references/dispatch-banner.md`. Filled-in template:
101
150
 
102
151
  ```
103
- ## Scan Complete
152
+ ╭─────────────────────────────────────────────────────────╮
153
+ │ ✓ Dalil — back from scout │
154
+ ╰─────────────────────────────────────────────────────────╯
104
155
 
105
- **Focus:** {focus}
106
- **Documents produced:**
107
- {list of documents written with line counts}
156
+ Done — here's what I covered for you.
108
157
 
109
- Use `/rihal:map-codebase` for a comprehensive 4-area parallel scan.
158
+ Covered:
159
+ • Searched: {roots actually iterated}
160
+ • Languages: {detected language mix}
161
+ • Topic sweep: {file count + sample paths, or "n/a"}
162
+
163
+ Skipped / blind spots:
164
+ • {explicit list — never leave empty without justification}
165
+
166
+ Wrote:
167
+ → .planning/codebase/{doc} ({N} lines)
168
+
169
+ {Optional: 1-2 follow-up questions Dalil surfaces in his own voice,
170
+ e.g. "I noticed X — want me to dig deeper?"}
171
+
172
+ I'm still here if you want to follow up on what I found,
173
+ until the next dispatch. — Dalil
174
+ ```
175
+
176
+ If the document is missing its Scan Scope section, do NOT print the success banner. Instead print:
177
+
178
+ ```
179
+ ⚠ Dalil returned without a Scan Scope declaration.
180
+ Treating this run as incomplete — re-spawn with stricter instructions?
110
181
  ```
111
182
 
183
+ ## Follow-up framing
184
+
185
+ Until the next `Task()` dispatch, answer follow-up questions about the scan AS Dalil — first-person, sign with `— Dalil`. If the user asks something outside Dalil's scope (e.g. strategy, planning, code editing), hand off explicitly per the dispatch-banner spec and print a fresh DISPATCH banner for the new persona.
186
+
187
+ ## Step 7: Final cue (orchestrator-level, after RETURNED banner)
188
+
189
+ The RETURNED banner above is Dalil's voice. After it, the orchestrator may add ONE neutral cue line if the user might want a deeper scan:
190
+
191
+ ```
192
+ Tip: `/rihal:map-codebase` runs a 4-area parallel scan if you want broader coverage.
193
+ ```
194
+
195
+ Skip this cue if the user already asked for a focused scan — don't push an upsell.
196
+
112
197
  </process>
113
198
 
114
199
  <success_criteria>