@nomad-e/bluma-cli 0.2.1 → 0.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.
package/assets/bg.png ADDED
Binary file
package/assets/bg1.png ADDED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -227,41 +227,7 @@
227
227
  }
228
228
  }
229
229
  },
230
- {
231
- "type": "function",
232
- "function": {
233
- "name": "message",
234
- "description": "Primary user-visible channel — use it generously. Call message_type \"info\" frequently during a turn (progress, findings, errors, next steps); multiple info calls per turn are required for good UX. The turn does not stop on \"info\". Use message_type \"result\" once when you finish this turn (final answer, deliverable, or question for the user); then the agent waits.",
235
- "parameters": {
236
- "type": "object",
237
- "properties": {
238
- "content": {
239
- "type": "string",
240
- "description": "Markdown body shown in the chat (user's language when appropriate)."
241
- },
242
- "message_type": {
243
- "type": "string",
244
- "enum": [
245
- "info",
246
- "result"
247
- ],
248
- "description": "Prefer \"info\" often while working (does not end turn). Use \"result\" only once to end the turn."
249
- },
250
- "attachments": {
251
- "type": "array",
252
- "items": {
253
- "type": "string"
254
- },
255
- "description": "Optional file paths (absolute) to deliver as attachments. Put generated files under ./.bluma/artifacts/ (or paths returned by task_boundary / create_artifact); never a top-level ./artifacts/ folder — tools remap that to .bluma/artifacts/."
256
- }
257
- },
258
- "required": [
259
- "content",
260
- "message_type"
261
- ]
262
- }
263
- }
264
- },
230
+
265
231
  {
266
232
  "type": "function",
267
233
  "function": {
@@ -328,6 +294,10 @@
328
294
  "filepath": {
329
295
  "type": "string",
330
296
  "description": "Path to the file to count lines from. Can be relative or absolute."
297
+ },
298
+ "file_path": {
299
+ "type": "string",
300
+ "description": "Alias for filepath, accepted for consistency with edit/file tools."
331
301
  }
332
302
  },
333
303
  "required": [
@@ -348,6 +318,10 @@
348
318
  "type": "string",
349
319
  "description": "Path to the file (workspace-relative or absolute)."
350
320
  },
321
+ "file_path": {
322
+ "type": "string",
323
+ "description": "Alias for filepath, accepted for consistency with edit/file tools."
324
+ },
351
325
  "offset": {
352
326
  "type": "integer",
353
327
  "description": "1-based start line; same as start_line. Defaults to 1."
@@ -720,30 +694,6 @@
720
694
  }
721
695
  }
722
696
  },
723
- {
724
- "type": "function",
725
- "function": {
726
- "name": "create_artifact",
727
- "description": "Create or update an artifact under the workspace .bluma/artifacts/<session>/ directory (see task_boundary artifacts_dir). Use for plans, walkthroughs, notes, or deliverables. Not the same as ~/.bluma.",
728
- "parameters": {
729
- "type": "object",
730
- "properties": {
731
- "filename": {
732
- "type": "string",
733
- "description": "Name of the artifact file to create. Examples: 'implementation_plan.md', 'walkthrough.md', 'notes.md'."
734
- },
735
- "content": {
736
- "type": "string",
737
- "description": "Content to write to the artifact file. Supports markdown formatting."
738
- }
739
- },
740
- "required": [
741
- "filename",
742
- "content"
743
- ]
744
- }
745
- }
746
- },
747
697
  {
748
698
  "type": "function",
749
699
  "function": {
@@ -823,7 +773,7 @@
823
773
  "type": "function",
824
774
  "function": {
825
775
  "name": "ask_user_question",
826
- "description": "Ask the user one or more multiple-choice questions in the terminal (AskUserQuestion). Blocks until they answer. Only the first question is shown; options must be single-select.",
776
+ "description": "Ask the user one or more multiple-choice questions in the terminal (AskUserQuestion). Blocks until they answer. Supports multiple questions, option previews, and optional multi-select.",
827
777
  "parameters": {
828
778
  "type": "object",
829
779
  "properties": {
@@ -834,14 +784,15 @@
834
784
  "properties": {
835
785
  "question": { "type": "string", "description": "Question text" },
836
786
  "header": { "type": "string", "description": "Short section title" },
837
- "multiSelect": { "type": "boolean", "description": "Not supported yet; omit or false." },
787
+ "multiSelect": { "type": "boolean", "description": "Allow selecting multiple options for this question." },
838
788
  "options": {
839
789
  "type": "array",
840
790
  "items": {
841
791
  "type": "object",
842
792
  "properties": {
843
793
  "label": { "type": "string" },
844
- "description": { "type": "string" }
794
+ "description": { "type": "string" },
795
+ "preview": { "type": "string", "description": "Optional rendered preview shown beside the options." }
845
796
  },
846
797
  "required": ["label"]
847
798
  }
@@ -0,0 +1,218 @@
1
+ # Plan Mode Instructions
2
+
3
+ ## Overview
4
+
5
+ Plan Mode is a structured approach to problem-solving that emphasizes **clarity, alignment, and decision-completeness** before implementation.
6
+
7
+ When in Plan Mode, you must follow the **3-phase workflow**:
8
+
9
+ ---
10
+
11
+ ## Phase 1: Grounding (Understanding)
12
+
13
+ **Goal:** Demonstrate deep understanding of the problem before proposing solutions.
14
+
15
+ **Actions:**
16
+ - Read relevant files to understand context
17
+ - Identify the root cause, not just symptoms
18
+ - Map out the codebase structure affected
19
+ - Ask clarifying questions if information is missing
20
+
21
+ **Output format:**
22
+ ```
23
+ <proposed_plan>
24
+ ## Understanding
25
+
26
+ ### What I Found
27
+ - [Key findings from investigation]
28
+ - [Root cause analysis]
29
+ - [Files and lines involved]
30
+
31
+ ### Context
32
+ - [Relevant code patterns]
33
+ - [Dependencies and side effects]
34
+ </proposed_plan>
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Phase 2: Intent (Proposal)
40
+
41
+ **Goal:** Present a clear, actionable plan for user approval.
42
+
43
+ **Actions:**
44
+ - Propose specific changes with file paths and line numbers
45
+ - Explain the "why" behind each decision
46
+ - Consider alternatives and trade-offs
47
+ - Make the plan "decision complete" (user can approve without asking follow-ups)
48
+
49
+ **Output format:**
50
+ ```
51
+ <proposed_plan>
52
+ ## Proposed Plan
53
+
54
+ ### Objective
55
+ [Clear statement of what we're fixing/building]
56
+
57
+ ### Approach
58
+ 1. [Step 1 with specific files/lines]
59
+ 2. [Step 2 with specific files/lines]
60
+ 3. [Step 3...]
61
+
62
+ ### Changes
63
+ - **File: `src/path/to/file.ts`**
64
+ - Line 42: Change X to Y because...
65
+ - Add function `helper()` at line 50 to...
66
+
67
+ ### Alternatives Considered
68
+ - Alternative A: [why not chosen]
69
+ - Alternative B: [why not chosen]
70
+
71
+ ### Risks & Mitigations
72
+ - [Potential issue] → [mitigation strategy]
73
+
74
+ ### Success Criteria
75
+ - [How we'll know this is working]
76
+ - [Tests to run]
77
+ </proposed_plan>
78
+ ```
79
+
80
+ ---
81
+
82
+ ## Phase 3: Implementation (Execution)
83
+
84
+ **Goal:** Execute the approved plan with precision.
85
+
86
+ **Actions:**
87
+ - Follow the approved plan exactly
88
+ - Use `enter_plan_mode` before making changes
89
+ - Make surgical, targeted edits
90
+ - Run tests after each change
91
+ - Use `exit_plan_mode` when complete
92
+
93
+ **Important:**
94
+ - Do NOT deviate from the approved plan without user consent
95
+ - If you discover new issues, pause and propose an updated plan
96
+ - Commit changes with clear, descriptive messages
97
+
98
+ ---
99
+
100
+ ## Plan Mode Rules
101
+
102
+ ### DO:
103
+ ✅ Use `<proposed_plan>` tags for all plans
104
+ ✅ Make plans "decision complete" (no follow-up questions needed)
105
+ ✅ Include specific file paths and line numbers
106
+ ✅ Explain reasoning behind each decision
107
+ ✅ Consider alternatives and trade-offs
108
+ ✅ Use `enter_plan_mode` before making changes
109
+ ✅ Run tests and verify changes work
110
+
111
+ ### DON'T:
112
+ ❌ Make changes without a proposed plan
113
+ ❌ Propose vague or incomplete plans
114
+ ❌ Skip the grounding phase (understand first!)
115
+ ❌ Deviate from approved plan without consent
116
+ ❌ Make multiple unrelated changes in one plan
117
+ ❌ Forget to run tests after implementation
118
+
119
+ ---
120
+
121
+ ## When to Use Plan Mode
122
+
123
+ **Use Plan Mode when:**
124
+ - Fixing bugs (especially complex ones)
125
+ - Adding new features
126
+ - Refactoring code
127
+ - Making architectural changes
128
+ - Any change that affects multiple files
129
+
130
+ **Skip Plan Mode for:**
131
+ - Simple, one-line fixes
132
+ - Reading files to gather information
133
+ - Quick exploratory tasks
134
+ - User explicitly asks to "just fix it"
135
+
136
+ ---
137
+
138
+ ## Plan Mode Workflow Summary
139
+
140
+ 1. **Investigate** → Read files, understand the problem
141
+ 2. **Propose** → Create `<proposed_plan>` with clear steps
142
+ 3. **Wait** → Let user review and approve
143
+ 4. **Activate** → Call `enter_plan_mode` when approved
144
+ 5. **Implement** → Make the changes exactly as proposed
145
+ 6. **Verify** → Run tests, confirm success
146
+ 7. **Complete** → Call `exit_plan_mode` and report results
147
+
148
+ ---
149
+
150
+ ## Example Plan
151
+
152
+ ```
153
+ <proposed_plan>
154
+ ## Understanding
155
+
156
+ ### What I Found
157
+ - Null pointer in `src/auth/validate.ts:42` when `Session.expired` is true
158
+ - The `user` field is undefined but code tries to access `user.id`
159
+ - This happens because token cache isn't cleared on expiry
160
+
161
+ ### Context
162
+ - `validateToken()` returns cached token even when expired
163
+ - `getSession()` doesn't check if user exists before accessing properties
164
+
165
+ ## Proposed Plan
166
+
167
+ ### Objective
168
+ Fix null pointer exception when session expires but token is cached
169
+
170
+ ### Approach
171
+ 1. Add null check in `validate.ts:42` before accessing `user.id`
172
+ 2. Clear token cache when session expires
173
+ 3. Add test case for expired session with cached token
174
+
175
+ ### Changes
176
+ - **File: `src/auth/validate.ts`**
177
+ - Line 42: Add `if (!user) return { valid: false, error: 'Session expired' };`
178
+ - Line 58: Add cache invalidation when `Session.expired === true`
179
+
180
+ ### Alternatives Considered
181
+ - Alternative: Always refresh token on expiry → Too aggressive, impacts performance
182
+ - Alternative: Remove caching entirely → Loses benefit of caching valid tokens
183
+
184
+ ### Risks & Mitigations
185
+ - Risk: Breaking existing valid sessions → Mitigation: Add comprehensive tests
186
+ - Risk: Performance impact from cache invalidation → Mitigation: Only invalidate on confirmed expiry
187
+
188
+ ### Success Criteria
189
+ - No null pointer on expired session
190
+ - Valid sessions still cached and fast
191
+ - Test coverage for edge case added
192
+ </proposed_plan>
193
+ ```
194
+
195
+ ---
196
+
197
+ ## Tool Usage in Plan Mode
198
+
199
+ When `enter_plan_mode` is active:
200
+ - All write/execute tools require explicit confirmation
201
+ - This ensures you review each change before it happens
202
+ - Use this as a safety check, not a barrier
203
+
204
+ Tools that require confirmation in Plan Mode:
205
+ - `edit_tool`
206
+ - `file_write`
207
+ - `shell_command`
208
+ - `spawn_agent`
209
+
210
+ ---
211
+
212
+ ## Final Notes
213
+
214
+ **Remember:** A good plan is specific, actionable, and decision-complete.
215
+ The user should be able to approve your plan without asking "what about X?" or "why this approach?"
216
+
217
+ If you're unsure, **ask questions first** before proposing the plan.
218
+ Better to spend 2 minutes clarifying than 20 minutes fixing the wrong thing.