diff --git a/app/renderer/sections/InstallFlow.tsx b/app/renderer/sections/InstallFlow.tsx index fc52303e..50c651f1 100644 --- a/app/renderer/sections/InstallFlow.tsx +++ b/app/renderer/sections/InstallFlow.tsx @@ -51,25 +51,30 @@ export function InstallFlowModal({ onClose, onSuccess }: InstallFlowProps) { try { const pluginSource = source === 'org' ? orgInput.trim() : folderPath! const result = await codeburn.pluginAdd(pluginSource) + // result is ActionResult: { ok: boolean, stdout, stderr, code } if (result.ok) { const match = result.stdout.match(/^([^@]+)@([^\s]+)/) if (match) { setInstallName(match[1]) setInstallVersion(match[2]) } + setInstalling(false) setStep(3) onSuccess?.() } else { + // CLI failed: display stderr verbatim const stderr = result.stderr || 'Plugin installation failed' if (stderr.includes('no-sync-config')) { - setInstallError(`${stderr} Visit Settings > Sync to configure automatic sync.`) + setInstallError(`${stderr}\n\nHint: Visit Settings > Sync to configure.`) } else { setInstallError(stderr) } + setInstalling(false) } } catch (err) { - setInstallError(err instanceof Error ? err.message : String(err)) - } finally { + // Bridge error (envelope rejected) + const message = err instanceof Error ? err.message : String(err) + setInstallError(message) setInstalling(false) } } @@ -154,41 +159,51 @@ export function InstallFlowModal({ onClose, onSuccess }: InstallFlowProps) { {step === 2 && ( <> -

Installing

-
-
-
-
-

Installing plugin from {source === 'org' ? orgInput : folderPath}...

-
- {installError && ( -
- Installation error: -

{installError}

+

{installError ? 'Installation failed' : 'Installing'}

+ {!installError && ( +
+
+
+
+

Installing plugin from {source === 'org' ? orgInput : folderPath}...

)} - {!installError && ( -
- - {!installing && ( + {installError && ( +
+
+
+                      {installError}
+                    
+
+
+ )} +
+ {!installError && !installing && ( + <> + - )} -
- )} - {installError && ( -
- - -
- )} + )} + {installError && ( + <> + + + + )} +
)} diff --git a/app/renderer/sections/Plugins.test.tsx b/app/renderer/sections/Plugins.test.tsx index bab436f3..4ad429a2 100644 --- a/app/renderer/sections/Plugins.test.tsx +++ b/app/renderer/sections/Plugins.test.tsx @@ -89,4 +89,42 @@ describe('PluginsSection', () => { expect(container.textContent).toContain('Total spend') expect(container.textContent).toContain('$123.45') }) + + it('shows install error state with CLI message verbatim', () => { + const container = document.createElement('div') + container.innerHTML = ` + + ` + expect(container.textContent).toContain('Installation failed') + expect(container.textContent).toContain('Failed to fetch plugin manifest: HTTP 404') + const buttons = Array.from(container.querySelectorAll('button')) + expect(buttons.some(b => b.textContent === 'Back')).toBe(true) + expect(buttons.some(b => b.textContent === 'Cancel')).toBe(true) + }) + + it('disables Cancel button while install is pending', () => { + const container = document.createElement('div') + container.innerHTML = ` + + ` + const cancelButton = Array.from(container.querySelectorAll('button')) + .find(b => b.textContent.includes('Cancel')) + expect(cancelButton?.disabled).toBe(true) + }) })