@hanzlaa/rcode 3.4.7 → 3.4.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzlaa/rcode",
3
- "version": "3.4.7",
3
+ "version": "3.4.8",
4
4
  "description": "rcode — the memory bank for AI-driven SaaS teams. Persistent project context, distinctive engineering personas, and phase-based workflows. Built by Rihal. Works in Claude Code, Cursor, Gemini, VS Code, and Antigravity.",
5
5
  "main": "cli/index.js",
6
6
  "bin": {
@@ -0,0 +1,104 @@
1
+ # Auto-Init Guard
2
+
3
+ Run this check at the very start of any workflow that needs project state.
4
+
5
+ ## Step: Detect project initialization
6
+
7
+ ```bash
8
+ test -f .rihal/config.yaml && echo "rihal-ready" || echo "rihal-not-initialized"
9
+ ```
10
+
11
+ **If `rihal-ready`:** continue with the workflow normally.
12
+
13
+ **If `rihal-not-initialized`:** the user has never set up Rihal for this project. Do NOT fail or continue blindly. Run the project init flow inline before proceeding:
14
+
15
+ ---
16
+
17
+ ### Inline init flow (when config.yaml is missing)
18
+
19
+ Tell the user:
20
+
21
+ ```
22
+ Rihal isn't configured for this project yet. Let me set it up — takes 30 seconds.
23
+ ```
24
+
25
+ **1. Bootstrap local tooling** — copy bin and workflows from the global install:
26
+
27
+ ```bash
28
+ GLOBAL_RIHAL="$HOME/.rihal"
29
+ if [ -d "$GLOBAL_RIHAL/bin" ]; then
30
+ mkdir -p .rihal/bin .rihal/workflows .rihal/references
31
+ cp "$GLOBAL_RIHAL/bin/rihal-tools.cjs" .rihal/bin/ 2>/dev/null || true
32
+ # workflows and references are read from ~/.rihal at runtime via @.rihal/ resolution
33
+ fi
34
+ ```
35
+
36
+ **2. Ask the 5 config questions** using AskUserQuestion:
37
+
38
+ | # | Question | Options | Default |
39
+ |---|----------|---------|---------|
40
+ | 1 | Your name (what Rihal calls you) | free text | `$USER` |
41
+ | 2 | Language for agent responses | English / Arabic / Urdu / Roman Urdu | English |
42
+ | 3 | Mode (how Rihal handles decision gates) | `guided` / `yolo` | guided |
43
+ | 4 | Model profile (cost vs quality) | `quality` / `balanced` / `budget` | balanced |
44
+ | 5 | Commit planning artifacts to git? | yes / no | yes |
45
+
46
+ **3. Write `.rihal/config.yaml` directly** (no rihal-tools needed — plain Bash):
47
+
48
+ ```bash
49
+ mkdir -p .rihal
50
+ cat > .rihal/config.yaml << 'YAML'
51
+ # Rihal project config — edit any time
52
+ user_name: "{name}"
53
+ project_name: "{basename_of_cwd}"
54
+ communication_language: "{lang}"
55
+ mode: "{mode}"
56
+ model_profile: "{profile}"
57
+ commit_planning: {commit_planning_bool}
58
+ rihal_source_path: ""
59
+ workflow:
60
+ research_by_default: false
61
+ plan_checker: true
62
+ post_execute_gates: true
63
+ ui_safety_gate: true
64
+ git:
65
+ branching_strategy: "none"
66
+ YAML
67
+ ```
68
+
69
+ **4. Seed `.rihal/state.json` and `.planning/` structure**:
70
+
71
+ ```bash
72
+ mkdir -p .planning/phases .planning/council-sessions .rihal/context
73
+
74
+ # state.json
75
+ cat > .rihal/state.json << 'JSON'
76
+ {"project":"{project_name}","phase":null,"sprint":null,"sessions":[],"initialized":"now"}
77
+ JSON
78
+
79
+ # context stubs
80
+ echo "# Active Context\n\n_Run /rihal-init for full setup._" > .rihal/context/active.md
81
+ echo "# Project Brief\n\n_Run /rihal-init for full setup._" > .rihal/context/project-brief.md
82
+ ```
83
+
84
+ **5. Tell the user:**
85
+
86
+ ```
87
+ ✓ Rihal configured for this project.
88
+
89
+ Config saved to .rihal/config.yaml — edit any time.
90
+ Run /rihal-init for a full project scan and context setup.
91
+
92
+ Continuing with your original request...
93
+ ```
94
+
95
+ **6. Continue** with the original workflow as if it had been initialized from the start.
96
+
97
+ ---
98
+
99
+ ## Notes
100
+
101
+ - This guard is **non-blocking** — it asks questions but does not stop the session; once config is written it resumes the original request automatically.
102
+ - If `AskUserQuestion` is unavailable (non-interactive mode), use all defaults and skip the questions.
103
+ - If the bootstrap `cp` fails (global rihal not found), print a warning and attempt to continue — some workflows work without local rihal-tools if they only need config.
104
+ - On **subsequent runs**, the guard exits immediately (config exists) with zero overhead.
@@ -28,6 +28,7 @@ Closure: `RIHAL ► COUNCIL COMPLETE ✓` + Next Up with decision options.
28
28
  </output_format>
29
29
 
30
30
  <required_reading>
31
+ @.rihal/references/auto-init-guard.md
31
32
  @.rihal/references/output-format.md
32
33
  @.rihal/references/council-protocol.md
33
34
  </required_reading>
@@ -3,6 +3,7 @@ Analyze freeform text from the user and route to the most appropriate Rihal comm
3
3
  </purpose>
4
4
 
5
5
  <required_reading>
6
+ @.rihal/references/auto-init-guard.md
6
7
  @.rihal/references/output-format.md
7
8
  @.rihal/references/verb-dictionary.md
8
9
  @.rihal/references/dispatch-banner.md
@@ -11,6 +12,11 @@ Read all files referenced by the invoking prompt's execution_context before star
11
12
 
12
13
  <process>
13
14
 
15
+ <step name="auto_init_check">
16
+ Run the auto-init guard from `@.rihal/references/auto-init-guard.md` before anything else.
17
+ If the project is not initialized, complete the inline init flow, then continue.
18
+ </step>
19
+
14
20
  <step name="parse_args">
15
21
  Extract `$ARGUMENTS`, detect `--auto` flag, and check config mode:
16
22
 
@@ -143,6 +143,7 @@ via filesystem and git state.
143
143
  </runtime_compatibility>
144
144
 
145
145
  <required_reading>
146
+ @.rihal/references/auto-init-guard.md
146
147
  @.rihal/references/output-format.md
147
148
  Read STATE.md before any operation to load project context.
148
149
 
@@ -1,9 +1,9 @@
1
1
  # Workflow: rihal-init
2
2
 
3
3
  <purpose>
4
- Begin the rihla. This is the first command a user runs after dropping Rihal files into a project. It detects project state, asks a handful of configuration questions, scans existing context (if any), writes `.rihal/RIHLA.md` as the journey baseline, and routes to the right next command.
4
+ Begin the rihla. This is the entry point for configuring Rihal in a project. Runs automatically on first use of any rihal command (via auto-init-guard in do.md), or explicitly via /rihal-init for a full setup with codebase scan.
5
5
 
6
- This replaces the older `/rihal-generate-project-context` workflow init is the single entry point for configuring Rihal in a project.
6
+ No manual "rcode install" needed per project — just use any /rihal-* command and this triggers automatically when config is missing.
7
7
  </purpose>
8
8
 
9
9
  ## Step 0 — Usage check
@@ -4,6 +4,7 @@ Initialize a new project through unified flow: questioning, research (optional),
4
4
  </purpose>
5
5
 
6
6
  <required_reading>
7
+ @.rihal/references/auto-init-guard.md
7
8
  @.rihal/references/output-format.md
8
9
 
9
10
  Read all files referenced by the invoking prompt's execution_context before starting.
@@ -41,6 +41,7 @@ End with Next Up routing to /rihal-execute.
41
41
  </output_format>
42
42
 
43
43
  <required_reading>
44
+ @.rihal/references/auto-init-guard.md
44
45
  @.rihal/references/output-format.md
45
46
  Read all files referenced by the invoking prompt's execution_context before starting.
46
47
 
@@ -7,6 +7,7 @@ Render a human-readable project status dashboard. All data comes from a single `
7
7
  </purpose>
8
8
 
9
9
  <required_reading>
10
+ @.rihal/references/auto-init-guard.md
10
11
  @.rihal/references/output-format.md
11
12
  </required_reading>
12
13