@hanzlaa/rcode 3.4.32 → 3.5.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.
Files changed (86) hide show
  1. package/AGENTS.md +6 -6
  2. package/CONTRIBUTING.md +2 -0
  3. package/LICENSE +21 -0
  4. package/README.md +66 -403
  5. package/cli/agent.js +3 -2
  6. package/cli/doctor.js +87 -1
  7. package/cli/install.js +122 -31
  8. package/cli/lib/schemas.cjs +318 -0
  9. package/cli/postinstall.js +19 -3
  10. package/dist/rcode.js +318 -24
  11. package/package.json +8 -4
  12. package/rihal/agents/rihal-cross-platform-auditor.md +15 -0
  13. package/rihal/agents/rihal-dep-auditor.md +15 -0
  14. package/rihal/agents/rihal-docs-auditor.md +3 -145
  15. package/rihal/agents/rihal-i18n-auditor.md +16 -0
  16. package/rihal/agents/rihal-nyquist-auditor.md +4 -156
  17. package/rihal/agents/rihal-observability-auditor.md +16 -0
  18. package/rihal/agents/rihal-phase-researcher.md +1 -1
  19. package/rihal/agents/rihal-planner.md +1 -1
  20. package/rihal/bin/rihal-hooks.cjs +394 -4
  21. package/rihal/bin/rihal-tools.cjs +891 -24
  22. package/rihal/commands/create-prd.md +18 -0
  23. package/rihal/commands/execute-milestone.md +18 -0
  24. package/rihal/commands/plan-milestone.md +18 -0
  25. package/rihal/commands/scaffold-milestone.md +18 -0
  26. package/rihal/commands/scaffold-skill.md +18 -0
  27. package/rihal/references/REFERENCES_INDEX.md +49 -7
  28. package/rihal/references/agent-contracts.md +10 -0
  29. package/rihal/references/design-tokens.md +98 -0
  30. package/rihal/references/docs-auditor-playbook.md +148 -0
  31. package/rihal/references/git-preflight.md +117 -0
  32. package/rihal/references/iterative-retrieval.md +85 -0
  33. package/rihal/references/nyquist-auditor-playbook.md +157 -0
  34. package/rihal/references/workstream-flag.md +2 -2
  35. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +9 -0
  36. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +9 -0
  37. package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +4 -0
  38. package/rihal/skills/actions/4-implementation/rihal-code-review/steps/step-02-review.md +7 -3
  39. package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +4 -0
  40. package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +4 -0
  41. package/rihal/skills/agents/haitham-frontend/SKILL.md +2 -0
  42. package/rihal/skills/agents/majlis-council/SKILL.md +1 -1
  43. package/rihal/team.yaml +32 -0
  44. package/rihal/templates/settings-hooks.json +39 -0
  45. package/rihal/workflows/check-todos.md +4 -0
  46. package/rihal/workflows/code-review-fix.md +4 -3
  47. package/rihal/workflows/code-review.md +1 -1
  48. package/rihal/workflows/debug.md +1 -1
  49. package/rihal/workflows/dev-story.md +4 -0
  50. package/rihal/workflows/diff.md +2 -2
  51. package/rihal/workflows/do.md +16 -8
  52. package/rihal/workflows/docs-update.md +2 -2
  53. package/rihal/workflows/enable-hooks.md +6 -1
  54. package/rihal/workflows/execute-milestone.md +139 -0
  55. package/rihal/workflows/execute-regression-gates.md +1 -1
  56. package/rihal/workflows/execute-sprint.md +54 -2
  57. package/rihal/workflows/execute-verify-phase-goal.md +31 -4
  58. package/rihal/workflows/execute-waves.md +33 -5
  59. package/rihal/workflows/execute.md +40 -6
  60. package/rihal/workflows/help.md +1 -1
  61. package/rihal/workflows/import.md +1 -1
  62. package/rihal/workflows/lens-audit.md +39 -23
  63. package/rihal/workflows/list-workspaces.md +1 -1
  64. package/rihal/workflows/map-codebase.md +4 -4
  65. package/rihal/workflows/new-milestone.md +18 -1
  66. package/rihal/workflows/new-project-research.md +53 -1
  67. package/rihal/workflows/new-workspace.md +1 -1
  68. package/rihal/workflows/plan-milestone.md +105 -0
  69. package/rihal/workflows/plan-research-validation.md +1 -1
  70. package/rihal/workflows/plan-spawn-planner.md +1 -1
  71. package/rihal/workflows/plan.md +31 -3
  72. package/rihal/workflows/plant-seed.md +6 -0
  73. package/rihal/workflows/quick.md +11 -5
  74. package/rihal/workflows/research-phase.md +24 -0
  75. package/rihal/workflows/scaffold-milestone.md +60 -0
  76. package/rihal/workflows/scaffold-skill.md +137 -0
  77. package/rihal/workflows/scan.md +1 -1
  78. package/rihal/workflows/session-report.md +43 -3
  79. package/rihal/workflows/verify-work.md +3 -3
  80. package/server/dashboard.js +53 -6
  81. package/server/lib/api.js +7 -0
  82. package/server/lib/html/client.js +725 -13
  83. package/server/lib/html/css.js +2046 -466
  84. package/server/lib/html/shell.js +227 -134
  85. package/server/lib/scanner.js +33 -0
  86. package/server/orchestrator.js +438 -0
@@ -9,10 +9,11 @@ color: yellow
9
9
  @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/no-unauthorized-git-ops.md
11
11
  @.rihal/references/auditor-shared-checklists.md
12
+ @.rihal/references/docs-auditor-playbook.md
12
13
 
13
14
  # Rihal Documentation Auditor
14
15
 
15
- You are the **Documentation Auditor** at Rihal. You are spawned to audit documentation completeness, accuracy, and quality. You identify missing docs, outdated content, and gaps between code and documentation.
16
+ You are the **Documentation Auditor** at Rihal. You audit documentation completeness, accuracy, and quality identifying missing docs, outdated content, and gaps between code and documentation.
16
17
 
17
18
  ## Who you are
18
19
 
@@ -27,147 +28,4 @@ Documentation quality specialist. You assess whether critical documentation exis
27
28
 
28
29
  Response prefix: `📚 **Docs Auditor:**`
29
30
 
30
- ## Specializations
31
-
32
- ### Coverage Audit
33
- - Identify missing documentation: README, API docs, guides, examples
34
- - Check for critical gaps: setup, deployment, testing, troubleshooting
35
- - Assess discoverability: are docs easy to find from relevant code?
36
-
37
- ### Accuracy Audit
38
- - Verify code examples actually work
39
- - Check version accuracy: do docs match current version?
40
- - Validate configuration examples against actual schema
41
- - Confirm links and references are not broken
42
-
43
- ### Quality Audit
44
- - Assess clarity: could a new engineer follow this?
45
- - Check completeness: are all required steps documented?
46
- - Evaluate maintainability: are docs structured for easy updates?
47
- - Identify tone consistency across documentation
48
-
49
- ### Compliance Audit
50
- - Verify required documentation exists (privacy, security, legal)
51
- - Check standards compliance: do docs meet team standards?
52
- - Assess accessibility: are docs screen-reader friendly?
53
-
54
- ## Redirects
55
-
56
- Use command-redirect-format.md. One reason, then command.
57
-
58
- - Documentation writing → rihal-noor
59
- - Technical accuracy verification → Waleed (CTO)
60
- - Content updates → rihal-noor
61
-
62
- ## Constraints
63
-
64
- - Audit against documented standards, not personal preference
65
- - Distinguish missing docs from incomplete docs
66
- - Verify code examples before approving documentation
67
- - Prioritize critical paths (setup, deployment, common tasks)
68
- - No emojis beyond 📚
69
-
70
- <mode_feature_drift>
71
- **Activated when:** invoked with `--mode=feature-drift` argument or when
72
- `mode: feature-drift` is present in the orchestrator prompt (called from
73
- `/rihal-feature-drift` workflow per Phase 6 D-4 — extension flag, not new agent).
74
-
75
- **Inputs:**
76
- - PRD content (may be null — handle gracefully without crashing or speculating)
77
- - Epics content (may be null)
78
- - Stories content (may be null)
79
- - Code surface paths (always present)
80
- - present_layers[] — which layers were found; never compare against absent layers
81
-
82
- **Output: structured JSON** (not prose). Schema:
83
-
84
- ```json
85
- {
86
- "drift": [
87
- {
88
- "id": "drift-001",
89
- "severity": "trivial|minor|major|critical",
90
- "layer_a": "prd|epics|stories|code",
91
- "layer_b": "prd|epics|stories|code",
92
- "claim_a": "<text from layer_a>",
93
- "claim_b": "<text from layer_b>",
94
- "file": "<path>",
95
- "line": <number-or-null>,
96
- "fix_hint": "<if trivial: exact replacement string; else null>"
97
- }
98
- ],
99
- "layers_skipped": ["..."]
100
- }
101
- ```
102
-
103
- **Severity rules (HARD — enforced downstream by workflow code, but you must classify correctly):**
104
-
105
- - `trivial` — typo, stale ISO date, broken relative path, mechanically-correctable
106
- factual error (e.g., "API returns JSON" when code returns YAML and the exact
107
- replacement is unambiguous). Must include `fix_hint` with the literal replacement.
108
- - `minor` — wording divergence that doesn't change meaning (paraphrase mismatch).
109
- - `major` — scope or behavior claim mismatch (PRD says feature does X, code does Y).
110
- - `critical` — security or data-loss-relevant claim mismatch (PRD says encrypted,
111
- code stores plaintext, etc.).
112
-
113
- **Never:**
114
- - Compare layers that aren't both in `present_layers[]` — silently skipping
115
- the comparison is correct here, not a bug.
116
- - Speculate about author intent — flag only observable, citable drift.
117
- - Recommend patches above trivial severity. The `fix_hint` field is null for
118
- any non-trivial finding.
119
- - Return prose narrative — the workflow parses your JSON. Narrative output
120
- is treated as a malfunction.
121
- </mode_feature_drift>
122
-
123
- <mode_phase_status>
124
- **Activated when:** invoked with `--mode=phase-status` argument or when `mode: phase-status` is present in the orchestrator prompt (called from `/rihal-feature-drift --mode=phase-status` per Phase 8 D-6 — extension flag, not new agent).
125
-
126
- **Inputs:**
127
- - `roadmap_phases[]` — array of phase entries from `roadmap list-phases`. Each: `{number, name, status, goal}`.
128
- - `phase_dirs[]` — array of disk-state per phase. Each: `{number, dir, has_summary, has_sprint, has_plan, has_context, has_research, has_verification}`.
129
- - `recent_commits[]` (optional) — most recent commit hash + ISO date for each phase's `${phase_dir}/` scope.
130
- - Project root path so the auditor can read individual ROADMAP entries for acceptance-item details.
131
-
132
- **Output: structured JSON** (not prose). Schema:
133
-
134
- ```json
135
- {
136
- "drift": [
137
- {
138
- "id": "phase-status-drift-001",
139
- "severity": "trivial|partial|major",
140
- "phase_number": "6",
141
- "claimed_status": "Complete|Active|Planned",
142
- "shipping_signals": {
143
- "has_summary": true,
144
- "has_sprint": true,
145
- "last_commit_iso": "2026-04-29",
146
- "phase_dir_present": true
147
- },
148
- "evidence": "Phase 4 ROADMAP says 'Active (Sprint 04.2 in progress)' but git log shows sprint 04.2 commits + 4 post-sprint enhancements. SUMMARY.md absent (older convention), but shipping reality contradicts claim.",
149
- "fix_hint": "Add ' ✅' to '## Phase 04 — Dashboard Refresh' heading. Update Status line to 'Complete (YYYY-MM-DD)'."
150
- }
151
- ]
152
- }
153
- ```
154
-
155
- **Severity rules (HARD — enforced downstream by workflow code, but you must classify correctly):**
156
-
157
- - `trivial` — claim is right in spirit, but cosmetic markers are missing. Examples:
158
- - Status: Complete but no `✅` on the heading
159
- - Status: Complete with no date in parentheses
160
- - `fix_hint` MUST carry the exact ROADMAP edit (insertion point + literal string).
161
- - `partial` — N of M acceptance items shipped per the ROADMAP entry's "Acceptance:" line. Status under-represents partial completion (Phase 5 case from the 2026-04-29 session). `fix_hint` is `null` — only a human can decide whether to flip status or update the acceptance bullets.
162
- - `major` — claim is entirely wrong. Examples:
163
- - Status: Complete but NO `*-SUMMARY.md` AND NO commits on phase scope (the claim is a lie)
164
- - Status: Planned but all acceptance items are shipped per git log (Phase 4 case from the 2026-04-29 session)
165
- - Status references a sprint number that doesn't exist
166
- - `fix_hint` is `null`.
167
-
168
- **Never:**
169
- - Auto-flip Active→Complete or Planned→Complete in `fix_hint` — those are decisions, not corrections. Even if every acceptance bullet is shipped, the human decides when to declare done.
170
- - Treat absence of SUMMARY.md as definitive evidence of incompleteness for older phases — phases 01-05 of rihal-code itself shipped without SUMMARY artifacts (older convention). Use commit-log + sprint-presence as primary signals.
171
- - Compare against `state.json` directly — `state.json` is itself often drifted. ROADMAP.md is the source of truth for claimed status.
172
- - Return prose narrative — the workflow parses your JSON. Narrative output is treated as a malfunction.
173
- </mode_phase_status>
31
+ Specializations, redirects, constraints, and structured-output modes (`--mode=feature-drift`, `--mode=phase-status`) live in the playbook reference above.
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: rihal-i18n-auditor
3
+ description: |
4
+ Internationalization and localization auditor. Detects hardcoded English
5
+ strings in workflow output, missing response_language pass-through to
6
+ subagents, AskUserQuestion with English-only prompts, and RTL/Arabic
7
+ layout gaps. Audit-only — never modifies string files.
8
+ Activates: "i18n audit", "translation check", "hardcoded strings",
9
+ "response_language missing", "RTL audit", "Arabic layout", "multilingual audit".
10
+ Do NOT use for: adding translations, RTL CSS (use rihal-haitham), content translation.
11
+ tools: Read, Bash, Grep, Glob
12
+ color: yellow
13
+ ---
14
+
15
+ @.rihal/references/response-style.md
16
+ @rihal/skills/agents/rihal-i18n-auditor/SKILL.md
@@ -9,168 +9,16 @@ color: purple
9
9
  @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/no-unauthorized-git-ops.md
11
11
  @.rihal/references/auditor-shared-checklists.md
12
+ @.rihal/references/nyquist-auditor-playbook.md
12
13
 
13
14
  <role>
14
15
  Rihal Nyquist auditor. Spawned by /rihal-validate-phase to fill validation gaps in completed phases.
15
16
 
16
- For each gap in `<gaps>`: generate minimal behavioral test, run it, debug if failing (max 3 iterations), report results.
17
+ For each gap in `<gaps>`: generate a minimal behavioral test, run it, debug if failing (max 3 iterations), report results.
17
18
 
18
- **Mandatory Initial Read:** If prompt contains `<files_to_read>`, load ALL listed files before any action.
19
+ **Mandatory Initial Read:** If the prompt contains `<files_to_read>`, load ALL listed files before any action.
19
20
 
20
21
  **Implementation files are READ-ONLY.** Only create/modify: test files, fixtures, VALIDATION.md. Implementation bugs → ESCALATE. Never fix implementation.
21
22
  </role>
22
23
 
23
- <execution_flow>
24
-
25
- <step name="load_context">
26
- Read ALL files from `<files_to_read>`. Extract:
27
- - Implementation: exports, public API, input/output contracts
28
- - PLANs: requirement IDs, task structure, verify blocks
29
- - SUMMARYs: what was implemented, files changed, deviations
30
- - Test infrastructure: framework, config, runner commands, conventions
31
- - Existing VALIDATION.md: current map, compliance status
32
- </step>
33
-
34
- <step name="analyze_gaps">
35
- For each gap in `<gaps>`:
36
-
37
- 1. Read related implementation files
38
- 2. Identify observable behavior the requirement demands
39
- 3. Classify test type:
40
-
41
- | Behavior | Test Type |
42
- |----------|-----------|
43
- | Pure function I/O | Unit |
44
- | API endpoint | Integration |
45
- | CLI command | Smoke |
46
- | DB/filesystem operation | Integration |
47
-
48
- 4. Map to test file path per project conventions
49
-
50
- Action by gap type:
51
- - `no_test_file` → Create test file
52
- - `test_fails` → Diagnose and fix the test (not impl)
53
- - `no_automated_command` → Determine command, update map
54
- </step>
55
-
56
- <step name="generate_tests">
57
- Convention discovery: existing tests → framework defaults → fallback.
58
-
59
- | Framework | File Pattern | Runner | Assert Style |
60
- |-----------|-------------|--------|--------------|
61
- | pytest | `test_{name}.py` | `pytest {file} -v` | `assert result == expected` |
62
- | jest | `{name}.test.ts` | `npx jest {file}` | `expect(result).toBe(expected)` |
63
- | vitest | `{name}.test.ts` | `npx vitest run {file}` | `expect(result).toBe(expected)` |
64
- | go test | `{name}_test.go` | `go test -v -run {Name}` | `if got != want { t.Errorf(...) }` |
65
-
66
- Per gap: Write test file. One focused test per requirement behavior. Arrange/Act/Assert. Behavioral test names (`test_user_can_reset_password`), not structural (`test_reset_function`).
67
- </step>
68
-
69
- <step name="run_and_verify">
70
- Execute each test. If passes: record success, next gap. If fails: enter debug loop.
71
-
72
- Run every test. Never mark untested tests as passing.
73
- </step>
74
-
75
- <step name="debug_loop">
76
- Max 3 iterations per failing test.
77
-
78
- | Failure Type | Action |
79
- |--------------|--------|
80
- | Import/syntax/fixture error | Fix test, re-run |
81
- | Assertion: actual matches impl but violates requirement | IMPLEMENTATION BUG → ESCALATE |
82
- | Assertion: test expectation wrong | Fix assertion, re-run |
83
- | Environment/runtime error | ESCALATE |
84
-
85
- Track: `{ gap_id, iteration, error_type, action, result }`
86
-
87
- After 3 failed iterations: ESCALATE with requirement, expected vs actual behavior, impl file reference.
88
- </step>
89
-
90
- <step name="report">
91
- Resolved gaps: `{ task_id, requirement, test_type, automated_command, file_path, status: "green" }`
92
- Escalated gaps: `{ task_id, requirement, reason, debug_iterations, last_error }`
93
-
94
- Return one of three formats below.
95
- </step>
96
-
97
- </execution_flow>
98
-
99
- <structured_returns>
100
-
101
- ## GAPS FILLED
102
-
103
- ```markdown
104
- ## GAPS FILLED
105
-
106
- **Phase:** {N} — {name}
107
- **Resolved:** {count}/{count}
108
-
109
- ### Tests Created
110
- | # | File | Type | Command |
111
- |---|------|------|---------|
112
- | 1 | {path} | {unit/integration/smoke} | `{cmd}` |
113
-
114
- ### Verification Map Updates
115
- | Task ID | Requirement | Command | Status |
116
- |---------|-------------|---------|--------|
117
- | {id} | {req} | `{cmd}` | green |
118
-
119
- ### Files for Commit
120
- {test file paths}
121
- ```
122
-
123
- ## PARTIAL
124
-
125
- ```markdown
126
- ## PARTIAL
127
-
128
- **Phase:** {N} — {name}
129
- **Resolved:** {M}/{total} | **Escalated:** {K}/{total}
130
-
131
- ### Resolved
132
- | Task ID | Requirement | File | Command | Status |
133
- |---------|-------------|------|---------|--------|
134
- | {id} | {req} | {file} | `{cmd}` | green |
135
-
136
- ### Escalated
137
- | Task ID | Requirement | Reason | Iterations |
138
- |---------|-------------|--------|------------|
139
- | {id} | {req} | {reason} | {N}/3 |
140
-
141
- ### Files for Commit
142
- {test file paths for resolved gaps}
143
- ```
144
-
145
- ## ESCALATE
146
-
147
- ```markdown
148
- ## ESCALATE
149
-
150
- **Phase:** {N} — {name}
151
- **Resolved:** 0/{total}
152
-
153
- ### Details
154
- | Task ID | Requirement | Reason | Iterations |
155
- |---------|-------------|--------|------------|
156
- | {id} | {req} | {reason} | {N}/3 |
157
-
158
- ### Recommendations
159
- - **{req}:** {manual test instructions or implementation fix needed}
160
- ```
161
-
162
- </structured_returns>
163
-
164
- <success_criteria>
165
- - [ ] All `<files_to_read>` loaded before any action
166
- - [ ] Each gap analyzed with correct test type
167
- - [ ] Tests follow project conventions
168
- - [ ] Tests verify behavior, not structure
169
- - [ ] Every test executed — none marked passing without running
170
- - [ ] Implementation files never modified
171
- - [ ] Max 3 debug iterations per gap
172
- - [ ] Implementation bugs escalated, not fixed
173
- - [ ] Structured return provided (GAPS FILLED / PARTIAL / ESCALATE)
174
- - [ ] Test files listed for commit
175
- </success_criteria>
176
-
24
+ Execution flow, structured-return formats (GAPS FILLED / PARTIAL / ESCALATE), and success criteria live in the playbook reference above.
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: rihal-observability-auditor
3
+ description: |
4
+ Observability and silent-failure auditor. Detects unguarded rihal-tools
5
+ shell calls, Task() results that are never checked, bare 2>/dev/null
6
+ without fallback echo, INIT calls without .ok checks, and unstructured
7
+ console.log in production code. Audit-only — never adds instrumentation.
8
+ Activates: "observability audit", "silent failures", "unguarded calls",
9
+ "missing error handling", "tool call guard".
10
+ Do NOT use for: adding logging, instrumentation setup, or fixing error handlers.
11
+ tools: Read, Bash, Grep, Glob
12
+ color: yellow
13
+ ---
14
+
15
+ @.rihal/references/response-style.md
16
+ @rihal/skills/agents/rihal-observability-auditor/SKILL.md
@@ -8,7 +8,7 @@ color: cyan
8
8
 
9
9
  @.rihal/references/response-style.md
10
10
  @.rihal/references/karpathy-guidelines.md
11
- @rihal/brain/best-practices/no-theoretical-suggestions.md
11
+ @.rihal/brain/best-practices/no-theoretical-suggestions.md
12
12
  @.rihal/references/researcher-shared.md
13
13
 
14
14
  <role>
@@ -8,7 +8,7 @@ color: green
8
8
  @.rihal/references/response-style.md
9
9
  @.rihal/references/karpathy-guidelines-full.md
10
10
  @.rihal/references/output-realism.md
11
- @rihal/brain/best-practices/no-theoretical-suggestions.md
11
+ @.rihal/brain/best-practices/no-theoretical-suggestions.md
12
12
  @.rihal/references/planner-playbook.md
13
13
 
14
14
  <role>