@hanzlaa/rcode 3.3.2 → 3.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.
Files changed (111) hide show
  1. package/README.md +23 -38
  2. package/cli/index.js +0 -0
  3. package/cli/install.js +37 -29
  4. package/cli/update.js +17 -20
  5. package/dist/rcode.js +52 -48
  6. package/package.json +10 -10
  7. package/rihal/agents/rihal-assumptions-analyzer.md +1 -1
  8. package/rihal/agents/rihal-fatima.md +1 -0
  9. package/rihal/agents/rihal-integration-checker.md +1 -0
  10. package/rihal/agents/rihal-khalid.md +1 -0
  11. package/rihal/agents/rihal-noor.md +1 -0
  12. package/rihal/agents/rihal-project-researcher.md +1 -0
  13. package/rihal/agents/rihal-research-synthesizer.md +1 -0
  14. package/rihal/agents/rihal-waleed.md +1 -0
  15. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/SKILL.md +2 -0
  16. package/rihal/skills/actions/1-analysis/research/rihal-market-research/SKILL.md +2 -0
  17. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/SKILL.md +2 -0
  18. package/rihal/skills/actions/1-analysis/rihal-document-project/SKILL.md +2 -0
  19. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +2 -0
  20. package/rihal/skills/actions/1-analysis/rihal-product-brief/SKILL.md +2 -0
  21. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +2 -0
  22. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +2 -0
  23. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +2 -0
  24. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +2 -0
  25. package/rihal/skills/actions/2-plan/rihal-create-ux-design/SKILL.md +2 -0
  26. package/rihal/skills/actions/2-plan/rihal-edit-prd/SKILL.md +2 -0
  27. package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +2 -0
  28. package/rihal/skills/actions/2-plan/rihal-validate-prd/SKILL.md +2 -0
  29. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/SKILL.md +2 -0
  30. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/SKILL.md +2 -0
  31. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/SKILL.md +2 -0
  32. package/rihal/skills/actions/4-implementation/rihal-browser-verify/SKILL.md +2 -0
  33. package/rihal/skills/actions/4-implementation/rihal-ci/SKILL.md +2 -0
  34. package/rihal/skills/actions/4-implementation/rihal-code-review/SKILL.md +2 -0
  35. package/rihal/skills/actions/4-implementation/rihal-correct-course/SKILL.md +2 -0
  36. package/rihal/skills/actions/4-implementation/rihal-debug/SKILL.md +2 -0
  37. package/rihal/skills/actions/4-implementation/rihal-dev-story/SKILL.md +2 -0
  38. package/rihal/skills/actions/4-implementation/rihal-git-flow/SKILL.md +2 -0
  39. package/rihal/skills/actions/4-implementation/rihal-harden/SKILL.md +2 -0
  40. package/rihal/skills/actions/4-implementation/rihal-incremental/SKILL.md +2 -0
  41. package/rihal/skills/actions/4-implementation/rihal-migrate/SKILL.md +2 -0
  42. package/rihal/skills/actions/4-implementation/rihal-perf/SKILL.md +2 -0
  43. package/rihal/skills/actions/4-implementation/rihal-prove-it/SKILL.md +2 -0
  44. package/rihal/skills/actions/4-implementation/rihal-qa-generate-e2e-tests/SKILL.md +2 -0
  45. package/rihal/skills/actions/4-implementation/rihal-retrospective/SKILL.md +2 -0
  46. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/SKILL.md +2 -0
  47. package/rihal/skills/actions/4-implementation/rihal-source-truth/SKILL.md +2 -0
  48. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +2 -0
  49. package/rihal/skills/actions/4-implementation/rihal-sprint-status/SKILL.md +2 -0
  50. package/rihal/skills/actions/4-implementation/rihal-trim/SKILL.md +2 -0
  51. package/rihal/skills/agents/ahmed-hassani-director/SKILL.md +2 -0
  52. package/rihal/skills/agents/dalil-scout/SKILL.md +2 -0
  53. package/rihal/skills/agents/fatima-qa/SKILL.md +2 -0
  54. package/rihal/skills/agents/haitham-frontend/SKILL.md +2 -0
  55. package/rihal/skills/agents/hanzla-engineer/SKILL.md +2 -0
  56. package/rihal/skills/agents/hussain-pm/SKILL.md +2 -0
  57. package/rihal/skills/agents/hussain-sm/SKILL.md +2 -0
  58. package/rihal/skills/agents/layla-designer/SKILL.md +2 -0
  59. package/rihal/skills/agents/majlis-council/SKILL.md +2 -0
  60. package/rihal/skills/agents/mariam-marketing/SKILL.md +2 -0
  61. package/rihal/skills/agents/nasser-eng-manager/SKILL.md +2 -0
  62. package/rihal/skills/agents/noor-writer/SKILL.md +2 -0
  63. package/rihal/skills/agents/raees-orchestrator/SKILL.md +2 -0
  64. package/rihal/skills/agents/sadiq-analyst/SKILL.md +2 -0
  65. package/rihal/skills/agents/waleed-architect/SKILL.md +2 -0
  66. package/rihal/skills/agents/yousef-backend/SKILL.md +2 -0
  67. package/rihal/skills/agents/zahra-branding/SKILL.md +2 -0
  68. package/rihal/skills/agents/zayd-ml/SKILL.md +2 -0
  69. package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +2 -0
  70. package/rihal/skills/core/rihal-auth-audit/SKILL.md +2 -0
  71. package/rihal/skills/core/rihal-brainstorming/SKILL.md +2 -0
  72. package/rihal/skills/core/rihal-client-gate/SKILL.md +2 -0
  73. package/rihal/skills/core/rihal-clone-website/SKILL.md +2 -0
  74. package/rihal/skills/core/rihal-deploy-unify/SKILL.md +2 -0
  75. package/rihal/skills/core/rihal-distillator/SKILL.md +2 -0
  76. package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +2 -0
  77. package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +2 -0
  78. package/rihal/skills/core/rihal-help/SKILL.md +2 -0
  79. package/rihal/skills/core/rihal-incident-record/SKILL.md +2 -0
  80. package/rihal/skills/core/rihal-index-docs/SKILL.md +2 -0
  81. package/rihal/skills/core/rihal-init/SKILL.md +2 -0
  82. package/rihal/skills/core/rihal-memory-audit/SKILL.md +2 -0
  83. package/rihal/skills/core/rihal-memory-distill/SKILL.md +2 -0
  84. package/rihal/skills/core/rihal-memory-init/SKILL.md +2 -0
  85. package/rihal/skills/core/rihal-memory-update/SKILL.md +2 -0
  86. package/rihal/skills/core/rihal-mvp-graduate/SKILL.md +2 -0
  87. package/rihal/skills/core/rihal-ocr-consistency/SKILL.md +2 -0
  88. package/rihal/skills/core/rihal-party-mode/SKILL.md +2 -0
  89. package/rihal/skills/core/rihal-rebrand/SKILL.md +2 -0
  90. package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +2 -0
  91. package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +2 -0
  92. package/rihal/skills/core/rihal-shard-doc/SKILL.md +2 -0
  93. package/rihal/skills/core/rihal-theme-system/SKILL.md +2 -0
  94. package/rihal/workflows/add-tests.md +1 -0
  95. package/rihal/workflows/audit-fix.md +2 -0
  96. package/rihal/workflows/autonomous.md +1 -0
  97. package/rihal/workflows/code-review-fix.md +2 -1
  98. package/rihal/workflows/debug.md +1 -0
  99. package/rihal/workflows/dev-story.md +1 -0
  100. package/rihal/workflows/execute-sprint.md +1 -0
  101. package/rihal/workflows/execute.md +1 -0
  102. package/rihal/workflows/init.md +82 -0
  103. package/rihal/workflows/plan.md +1 -0
  104. package/rihal/workflows/ship.md +2 -0
  105. package/rihal/workflows/sprint-planning.md +1 -0
  106. package/rihal/workflows/validate-phase.md +1 -0
  107. package/rihal/workflows/verify-phase.md +1 -0
  108. package/server/lib/api.js +49 -0
  109. package/server/lib/html/client.js +100 -10
  110. package/server/lib/html/css.js +64 -1
  111. package/server/lib/html/shell.js +11 -5
@@ -28,6 +28,8 @@ triggers:
28
28
  argument-hint: "<url>"
29
29
  user-invocable: true
30
30
  ---
31
+ @.rihal/references/karpathy-guidelines.md
32
+
31
33
 
32
34
  ## Overview
33
35
 
@@ -12,6 +12,8 @@ triggers:
12
12
  - "deployment audit"
13
13
  user-invocable: true
14
14
  ---
15
+ @.rihal/references/karpathy-guidelines.md
16
+
15
17
 
16
18
  ## Overview
17
19
 
@@ -9,6 +9,8 @@ triggers:
9
9
  - "compress these docs"
10
10
  user-invocable: true
11
11
  ---
12
+ @.rihal/references/karpathy-guidelines.md
13
+
12
14
 
13
15
  ## Overview
14
16
 
@@ -4,6 +4,8 @@ description: 'Clinical copy-editor that reviews text for communication issues. U
4
4
  triggers:
5
5
  - "editorial review prose"
6
6
  ---
7
+ @.rihal/references/karpathy-guidelines.md
8
+
7
9
 
8
10
  # Editorial Review - Prose
9
11
 
@@ -9,6 +9,8 @@ triggers:
9
9
  - "cut this doc down"
10
10
  user-invocable: true
11
11
  ---
12
+ @.rihal/references/karpathy-guidelines.md
13
+
12
14
 
13
15
  ## Overview
14
16
 
@@ -4,6 +4,8 @@ description: 'Analyzes current state and user query to answer Rihal questions or
4
4
  triggers:
5
5
  - "help"
6
6
  ---
7
+ @.rihal/references/karpathy-guidelines.md
8
+
7
9
 
8
10
  # Rihal Help
9
11
 
@@ -12,6 +12,8 @@ triggers:
12
12
  - "incident summary"
13
13
  user-invocable: true
14
14
  ---
15
+ @.rihal/references/karpathy-guidelines.md
16
+
15
17
 
16
18
  ## Overview
17
19
 
@@ -4,6 +4,8 @@ description: 'Generates or updates an index.md to reference all docs in the fold
4
4
  triggers:
5
5
  - "index docs"
6
6
  ---
7
+ @.rihal/references/karpathy-guidelines.md
8
+
7
9
 
8
10
  # Index Docs
9
11
 
@@ -6,6 +6,8 @@ argument-hint: "[--module=module_code] [--vars=var1:default1,var2] [--skill-path
6
6
  triggers:
7
7
  - "init"
8
8
  ---
9
+ @.rihal/references/karpathy-guidelines.md
10
+
9
11
 
10
12
  ## Overview
11
13
 
@@ -17,6 +17,8 @@ triggers:
17
17
  - "/rcode:memory-audit"
18
18
  user-invocable: true
19
19
  ---
20
+ @.rihal/references/karpathy-guidelines.md
21
+
20
22
 
21
23
  ## Overview
22
24
 
@@ -19,6 +19,8 @@ triggers:
19
19
  - "/rcode:memory-distill"
20
20
  user-invocable: true
21
21
  ---
22
+ @.rihal/references/karpathy-guidelines.md
23
+
22
24
 
23
25
  ## Overview
24
26
 
@@ -20,6 +20,8 @@ triggers:
20
20
  - "/rcode:memory-init"
21
21
  user-invocable: true
22
22
  ---
23
+ @.rihal/references/karpathy-guidelines.md
24
+
23
25
 
24
26
  ## Overview
25
27
 
@@ -20,6 +20,8 @@ triggers:
20
20
  - "/rcode:memory-update"
21
21
  user-invocable: true
22
22
  ---
23
+ @.rihal/references/karpathy-guidelines.md
24
+
23
25
 
24
26
  ## Overview
25
27
 
@@ -12,6 +12,8 @@ triggers:
12
12
  - "ready for production"
13
13
  user-invocable: true
14
14
  ---
15
+ @.rihal/references/karpathy-guidelines.md
16
+
15
17
 
16
18
  ## Overview
17
19
 
@@ -12,6 +12,8 @@ triggers:
12
12
  - "ocr accuracy regression"
13
13
  user-invocable: true
14
14
  ---
15
+ @.rihal/references/karpathy-guidelines.md
16
+
15
17
 
16
18
  ## Overview
17
19
 
@@ -73,6 +73,8 @@ Each party mode turn follows this pattern:
73
73
  {Response, may reference previous agent's point}
74
74
 
75
75
  ---
76
+ @.rihal/references/karpathy-guidelines.md
77
+
76
78
  💬 What would you like to discuss next? (say "exit" to end party mode)
77
79
  ```
78
80
 
@@ -12,6 +12,8 @@ triggers:
12
12
  - "company name change"
13
13
  user-invocable: true
14
14
  ---
15
+ @.rihal/references/karpathy-guidelines.md
16
+
15
17
 
16
18
  ## Overview
17
19
 
@@ -4,6 +4,8 @@ description: 'Perform a Cynical Review and produce a findings report. Use when t
4
4
  triggers:
5
5
  - "review adversarial general"
6
6
  ---
7
+ @.rihal/references/karpathy-guidelines.md
8
+
7
9
 
8
10
  # Adversarial Review (General)
9
11
 
@@ -4,6 +4,8 @@ description: 'Walk every branching path and boundary condition in content, repor
4
4
  triggers:
5
5
  - "review edge case hunter"
6
6
  ---
7
+ @.rihal/references/karpathy-guidelines.md
8
+
7
9
 
8
10
  # Edge Case Hunter Review
9
11
 
@@ -4,6 +4,8 @@ description: 'Splits large markdown documents into smaller, organized files base
4
4
  triggers:
5
5
  - "shard doc"
6
6
  ---
7
+ @.rihal/references/karpathy-guidelines.md
8
+
7
9
 
8
10
  # Shard Document
9
11
 
@@ -12,6 +12,8 @@ triggers:
12
12
  - "css variable audit"
13
13
  user-invocable: true
14
14
  ---
15
+ @.rihal/references/karpathy-guidelines.md
16
+
15
17
 
16
18
  ## Overview
17
19
 
@@ -6,6 +6,7 @@ Users currently hand-craft `/rihal-quick` prompts for test generation after each
6
6
 
7
7
  <required_reading>
8
8
  Read all files referenced by the invoking prompt's execution_context before starting.
9
+ @.rihal/references/karpathy-guidelines.md
9
10
  </required_reading>
10
11
 
11
12
  <process>
@@ -4,6 +4,8 @@ auto-fixable vs manual-only, spawns executor agents for fixable issues, runs tes
4
4
  after each fix, and commits atomically with finding IDs for traceability.
5
5
  </purpose>
6
6
 
7
+ @.rihal/references/karpathy-guidelines.md
8
+
7
9
  <available_agent_types>
8
10
  - rihal-executor — executes a specific, scoped code change
9
11
  </available_agent_types>
@@ -42,6 +42,7 @@ interpos audit (issue #221) — DO NOT regress.
42
42
  @.rihal/references/output-realism.md
43
43
  @rihal/brain/best-practices/no-autonomous-bypass.md
44
44
  @rihal/brain/best-practices/state-sync-rule.md
45
+ @.rihal/references/karpathy-guidelines.md
45
46
 
46
47
  Read all files referenced by the invoking prompt's execution_context before starting.
47
48
 
@@ -4,6 +4,7 @@ Auto-fix issues from REVIEW.md. Validates phase, checks config gate, verifies RE
4
4
 
5
5
  <required_reading>
6
6
  Read all files referenced by the invoking prompt's execution_context before starting.
7
+ @.rihal/references/karpathy-guidelines.md
7
8
  </required_reading>
8
9
 
9
10
  <available_agent_types>
@@ -280,7 +281,7 @@ if [ "$AUTO_MODE" = "true" ]; then
280
281
  if [ ${#REVIEW_FILES_ARRAY[@]} -gt 0 ]; then
281
282
  FILES_CONFIG="files:"
282
283
  for f in "${REVIEW_FILES_ARRAY[@]}"; do
283
- FILES_CONFIG="${FILES_CONFIG}
284
+ FILES_CONFIG="${FILES_CONFIG}"
284
285
  - ${f}"
285
286
  done
286
287
  fi
@@ -6,6 +6,7 @@ After identifying issues, spawn one debug agent per issue. Each agent investigat
6
6
  Orchestrator stays lean: parse issues, spawn agents, collect results, synthesize findings.
7
7
  </purpose>
8
8
 
9
+ @.rihal/references/karpathy-guidelines.md
9
10
 
10
11
  ## Step 0 — Usage check
11
12
 
@@ -138,6 +138,7 @@ fi
138
138
  @.rihal/references/checklist-story-draft.md
139
139
  @.rihal/references/checklist-story-dod.md
140
140
  @.rihal/references/commit-conventions.md
141
+ @.rihal/references/karpathy-guidelines.md
141
142
  ```
142
143
 
143
144
  `STORY_CONTENT`, `STORY_ID`, `STORY_TITLE`, `PERSONA`, `EFFORT` are already set from Step 0.
@@ -7,6 +7,7 @@ Read STATE.md before any operation to load project context.
7
7
  Read config.json for planning behavior settings.
8
8
 
9
9
  @.rihal/references/git-integration.md
10
+ @.rihal/references/karpathy-guidelines.md
10
11
  </required_reading>
11
12
 
12
13
  <available_agent_types>
@@ -148,6 +148,7 @@ Read STATE.md before any operation to load project context.
148
148
  @.rihal/references/agent-contracts.md
149
149
  @.rihal/references/context-budget.md
150
150
  @.rihal/references/gates.md
151
+ @.rihal/references/karpathy-guidelines.md
151
152
  </required_reading>
152
153
 
153
154
  <available_agent_types>
@@ -194,6 +194,86 @@ This file is a journey baseline — intentionally shallow. For deep analysis run
194
194
 
195
195
  If no code detected, write a minimal RIHLA.md with just the header and a "fresh project — no code yet" note.
196
196
 
197
+ ## Step 4b — Populate context files
198
+
199
+ After writing RIHLA.md, populate the two context files that every Rihal skill reads at runtime. These files are the project's "memory bank" — without them, agents work blind.
200
+
201
+ **`.rihal/context/active.md`** — Current task context and working state. Write it using the RIHLA.md scan data from Step 4:
202
+
203
+ ```markdown
204
+ # Active Context
205
+
206
+ **Last updated:** {ISO date}
207
+ **Updated by:** /rihal-init
208
+
209
+ ## Current State
210
+
211
+ - **Project:** {project_name}
212
+ - **Primary stack:** {detected language + framework}
213
+ - **Branch:** {git branch or "n/a"}
214
+ - **Recent focus:** {summary from last 5 commit messages, or "fresh project"}
215
+
216
+ ## Active Work
217
+
218
+ {If returning with --reset: summarize what was in progress from git log}
219
+ {If existing-new-rihal: "Rihal just configured — no active work tracked yet."}
220
+ {If fresh: "New project — no code yet."}
221
+
222
+ ## Key Decisions
223
+
224
+ - Rihal configured with mode: {mode from Step 2}
225
+ - Branching strategy: {strategy from Step 2}
226
+ - Model profile: {profile from Step 2}
227
+
228
+ ## Open Questions
229
+
230
+ _None yet. Use `/rihal-explore` or `/rihal-council` to surface questions._
231
+ ```
232
+
233
+ **`.rihal/context/project-brief.md`** — High-level project description. Write it using the RIHLA.md scan data:
234
+
235
+ ```markdown
236
+ # Project Brief
237
+
238
+ **Project:** {project_name}
239
+ **Created:** {ISO date}
240
+
241
+ ## Overview
242
+
243
+ {If code exists: 3-5 sentence summary derived from README + package manifest — what the project does, who it's for, and the primary tech stack}
244
+ {If fresh: "Project not yet started. Run `/rihal-new-project` to design it."}
245
+
246
+ ## Technical Stack
247
+
248
+ - **Language:** {detected primary language}
249
+ - **Framework:** {detected framework or "none detected"}
250
+ - **Package manager:** {npm/pnpm/pip/cargo/etc or "none detected"}
251
+
252
+ ## Project Goals
253
+
254
+ _To be refined. Run `/rihal-create-prd` for full requirements discovery._
255
+ ```
256
+
257
+ Ensure the directory exists before writing:
258
+
259
+ ```bash
260
+ mkdir -p .rihal/context
261
+ ```
262
+
263
+ **Important:** If `--reset` is passed and the files already have user-written content beyond the template stub, preserve a backup before overwriting:
264
+
265
+ ```bash
266
+ if [ -s .rihal/context/active.md ] && ! grep -q "Run \`/rihal" .rihal/context/active.md; then
267
+ cp .rihal/context/active.md .rihal/context/active.md.bak
268
+ fi
269
+ ```
270
+
271
+ After writing both files, refresh the memory bank fingerprint so staleness checks see the project as fresh:
272
+
273
+ ```bash
274
+ node .rihal/bin/rihal-tools.cjs context refresh 2>/dev/null || true
275
+ ```
276
+
197
277
  ## Step 5 — Suggest the next step
198
278
 
199
279
  Print a contextual recommendation, **one line of copy-paste per suggestion** (per `.rihal/references/command-redirect-format.md`):
@@ -246,6 +326,8 @@ Silent if state tools fail.
246
326
  - [ ] `.rihal/config.yaml` written with user's answers
247
327
  - [ ] `.rihal/state.json` exists (created or preserved)
248
328
  - [ ] `.rihal/RIHLA.md` written (unless `--skip-scan` or no code)
329
+ - [ ] `.rihal/context/active.md` populated with project state (not the placeholder stub)
330
+ - [ ] `.rihal/context/project-brief.md` populated with project overview (not the placeholder stub)
249
331
  - [ ] State detected correctly (fresh / existing-new-rihal / returning)
250
332
  - [ ] Contextual next-step suggestion printed as single-line copy-paste
251
333
 
@@ -49,6 +49,7 @@ Read all files referenced by the invoking prompt's execution_context before star
49
49
  @.rihal/references/gate-prompts.md
50
50
  @.rihal/references/agent-contracts.md
51
51
  @.rihal/references/gates.md
52
+ @.rihal/references/karpathy-guidelines.md
52
53
  </required_reading>
53
54
 
54
55
  <available_agent_types>
@@ -17,6 +17,8 @@ the plan → execute → verify → **ship** loop.
17
17
  - You are on a feature branch (not main/develop directly)
18
18
  - `gh` CLI is authenticated (`gh auth status`)
19
19
 
20
+ @.rihal/references/karpathy-guidelines.md
21
+
20
22
  **This command is NOT for:**
21
23
  - Publishing npm packages → use `npm publish`
22
24
  - Creating git release tags → use `git tag -a vX.Y.Z && git push --tags`
@@ -39,6 +39,7 @@ they bypass the capacity gate.
39
39
  @.rihal/references/output-format.md
40
40
  @rihal/brain/best-practices/no-autonomous-bypass.md
41
41
  @rihal/brain/best-practices/state-sync-rule.md
42
+ @.rihal/references/karpathy-guidelines.md
42
43
  </required_reading>
43
44
 
44
45
  <output_format>
@@ -4,6 +4,7 @@ Audit Nyquist validation gaps for a completed phase. Generate missing tests. Upd
4
4
 
5
5
  <required_reading>
6
6
  @.rihal/references/ui-brand.md
7
+ @.rihal/references/karpathy-guidelines.md
7
8
  </required_reading>
8
9
 
9
10
  <available_agent_types>
@@ -21,6 +21,7 @@ Then verify each level against the actual codebase.
21
21
  <required_reading>
22
22
  @.rihal/references/verification-patterns.md
23
23
  @.rihal/templates/verification-report.md
24
+ @.rihal/references/karpathy-guidelines.md
24
25
  </required_reading>
25
26
 
26
27
  <process>
package/server/lib/api.js CHANGED
@@ -25,6 +25,55 @@ function handleApiFiles(req, res, projectRoot) {
25
25
 
26
26
  for (const dir of ARTIFACT_DIRS) {
27
27
  const full = path.join(PLANNING_DIR, dir);
28
+
29
+ // For 'phases', create sub-groups per phase directory
30
+ if (dir === 'phases') {
31
+ let phaseDirs;
32
+ try { phaseDirs = fs.readdirSync(full, { withFileTypes: true }); } catch { continue; }
33
+ const subGroups = [];
34
+ for (const pd of phaseDirs) {
35
+ if (!pd.isDirectory() || pd.name.startsWith('.')) continue;
36
+ const phaseDir = path.join(full, pd.name);
37
+ const phaseLabel = pd.name.replace(/^\d+-/, '').replace(/-/g, ' ')
38
+ .replace(/\b\w/g, c => c.toUpperCase());
39
+ const phaseFiles = [];
40
+ function walkPhase(d, prefix, depth) {
41
+ if (depth > 3) return;
42
+ let entries;
43
+ try { entries = fs.readdirSync(d, { withFileTypes: true }); } catch { return; }
44
+ for (const e of entries) {
45
+ if (e.name.startsWith('.')) continue;
46
+ const rel = prefix + '/' + e.name;
47
+ if (e.isDirectory()) walkPhase(path.join(d, e.name), rel, depth + 1);
48
+ else if (e.isFile() && e.name.endsWith('.md')) {
49
+ const base = e.name.replace('.md', '');
50
+ const sprintMatch = base.match(/^\d{2}-(\d{2})-([A-Z]+)$/);
51
+ const dateMatch = base.match(/^\d{4}-\d{2}-\d{2}-(.+)$/);
52
+ let fileLabel;
53
+ if (sprintMatch) {
54
+ fileLabel = sprintMatch[2].charAt(0) + sprintMatch[2].slice(1).toLowerCase() + ' ' + parseInt(sprintMatch[1], 10);
55
+ } else if (dateMatch) {
56
+ fileLabel = dateMatch[1].replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
57
+ } else if (base === base.toUpperCase() && /^[A-Z_-]+$/.test(base)) {
58
+ fileLabel = base.charAt(0) + base.slice(1).toLowerCase();
59
+ } else {
60
+ fileLabel = base.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
61
+ }
62
+ phaseFiles.push({ label: fileLabel, path: '.planning/phases/' + pd.name + rel });
63
+ }
64
+ }
65
+ }
66
+ walkPhase(phaseDir, '', 0);
67
+ if (phaseFiles.length) {
68
+ subGroups.push({ subGroup: phaseLabel, files: phaseFiles });
69
+ }
70
+ }
71
+ if (subGroups.length) {
72
+ groups.push({ group: 'Phases', subGroups });
73
+ }
74
+ continue;
75
+ }
76
+
28
77
  const files = [];
29
78
  function walkArtifacts(d, prefix, depth) {
30
79
  if (depth > 3) return;