Skip to content

Commit ae772c9

Browse files
committed
🎨 Palette: Add toast notification for missing CLI
1 parent f0574f0 commit ae772c9

3 files changed

Lines changed: 33 additions & 14 deletions

File tree

‎.Jules/palette.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
## 2026-04-26 - VS Code Interactive Status Bar Dismissal
22
**Learning:** Dismissing a persistent error state from the status bar via the bound command effectively clears the error state visually, but screen readers might not immediately catch the state change unless explicitly decoupled and re-announced or when the state simply clears via explicit action. In our case, clearing error via the output channel explicitly solves this.
33
**Action:** Always provide explicit user interactions to dismiss persistent error states.
4+
## 2026-04-30 - Surfacing Background Environment Errors
5+
**Learning:** When background operations (like execFile) fail due to missing dependencies (like ENOENT for a CLI tool), silently logging to an output channel and turning the status bar red is insufficient. Users might not realize the environment setup is incomplete.
6+
**Action:** Promote critical environment errors (like missing CLIs) to visible toast notifications (e.g., vscode.window.showErrorMessage) at least once so users have actionable steps (like 'pip install') to resolve the issue.

‎pr_body.txt‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
💡 What: Added explicit visual feedback in the Output Channel when the user dismisses a persistent error state via the status bar. Replaced direct assignment of `isError` with the dedicated `setError` state updater for improved state-handling semantics.
1+
## 🎨 Palette: Add toast notification for missing CLI
22

3-
🎯 Why: To improve the user experience by providing a reassuring confirmation in the logs that the error has been acknowledged and dismissed. Additionally, utilizing the correct state-handling method avoids relying on side-effect updates.
3+
### 💡 What
4+
Added a one-time toast notification (`vscode.window.showErrorMessage`) when background `execFile` calls fail because the `ledgermind-mcp` CLI is not found (`ENOENT`).
45

5-
📸 Before/After: Before, dismissing an error via clicking the status bar silently reset the flag and refreshed the UI. After, clicking the status bar logs a clear visual indication ('✓ Error state cleared by user') if an error state was active.
6+
### 🎯 Why
7+
Previously, if the `ledgermind-mcp` CLI wasn't installed, the extension would silently log an error to the output channel and turn the status bar red. Users would not know they needed to run `pip install ledgermind`. This change surfaces the missing dependency with an actionable error message.
68

7-
♿ Accessibility: Ensures that users and screen readers navigating through the interaction logs receive confirmation of error resolution.
9+
### 📸 Before/After
10+
**Before:** Status bar turns red, error hidden in output logs.
11+
**After:** Toast notification appears: "LedgerMind CLI not found. Please install it using 'pip install ledgermind'"
12+
13+
### ♿ Accessibility
14+
The toast notification provides immediate, screen-reader accessible feedback about why the background operation failed, removing the need to hunt through logs to discover a missing dependency.

‎src/ledgermind/vscode/src/extension.ts‎

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,20 @@ export function activate(context: vscode.ExtensionContext) {
7070
setError(false); // Clear error state when logs are opened
7171
}));
7272

73+
let hasShownMissingCliToast = false;
74+
const handleCliError = (err: any, contextStr: string) => {
75+
if (err.code === 'ENOENT') {
76+
outputChannel.appendLine(`LedgerMind ${contextStr} Error: ledgermind-mcp CLI not found.`);
77+
if (!hasShownMissingCliToast) {
78+
vscode.window.showErrorMessage("LedgerMind CLI not found. Please install it using 'pip install ledgermind'");
79+
hasShownMissingCliToast = true;
80+
}
81+
} else {
82+
outputChannel.appendLine(`LedgerMind ${contextStr} Error: ${err.message}`);
83+
}
84+
setError(true);
85+
};
86+
7387
// ==========================================
7488
// DUAL-HOOK MECHANISM (Cache + onDidReceiveChatResponse)
7589
// ==========================================
@@ -105,8 +119,7 @@ export function activate(context: vscode.ExtensionContext) {
105119
], (err) => {
106120
setBusy(false);
107121
if (err) {
108-
outputChannel.appendLine(`LedgerMind Record Error: ${err.message}`);
109-
setError(true);
122+
handleCliError(err, 'Record');
110123
} else {
111124
outputChannel.appendLine(`✓ Recorded previous interaction: "${interaction.prompt.substring(0, 50)}..."`);
112125
}
@@ -130,8 +143,7 @@ export function activate(context: vscode.ExtensionContext) {
130143
], (err, stdout) => {
131144
setBusy(false);
132145
if (err) {
133-
outputChannel.appendLine(`LedgerMind Context Sync Error: ${err.message}`);
134-
setError(true);
146+
handleCliError(err, 'Context Sync');
135147
} else if (stdout) {
136148
const content = `<!-- LEDGERMIND AUTONOMOUS CONTEXT - DO NOT EDIT -->
137149
<!-- Updated: ${new Date().toISOString()} -->
@@ -279,8 +291,7 @@ ${stdout}`;
279291
], (err) => {
280292
setBusy(false);
281293
if (err) {
282-
outputChannel.appendLine(`LedgerMind RooCode Record Error: ${err.message}`);
283-
setError(true);
294+
handleCliError(err, 'RooCode Record');
284295
} else {
285296
outputChannel.appendLine(`✓ Recorded RooCode/Cline interaction via file watcher`);
286297
}
@@ -332,8 +343,7 @@ ${stdout}`;
332343
], (err) => {
333344
setBusy(false);
334345
if (err) {
335-
outputChannel.appendLine(`LedgerMind Terminal Record Error: ${err.message}`);
336-
setError(true);
346+
handleCliError(err, 'Terminal Record');
337347
}
338348
});
339349
}
@@ -366,8 +376,7 @@ ${stdout}`;
366376
], (err) => {
367377
setBusy(false);
368378
if (err) {
369-
outputChannel.appendLine(`LedgerMind File Record Error: ${err.message}`);
370-
setError(true);
379+
handleCliError(err, 'File Record');
371380
}
372381
});
373382
})

0 commit comments

Comments
 (0)