@devries-cameron20 / composio Mirror · read-only / commits / ae0e51697
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 22, 08:15 UTC

fix(cli): track spinner stopped state locally and close outro bracket

Two fixes from PR review: 1. useMakeSpinner release handler relied on Clack's `isCancelled` flag, which only reflects `cancel()` (SIGINT/SIGTERM), not `stop()` or `error()`. Replace with a local `isStopped` flag set by the SpinnerHandle wrapper so the release handler correctly skips cleanup when the callback already stopped the spinner. 2. When no upgrade is available, `ui.intro()` was called but `ui.outro()` was skipped, leaving Clack's visual bracket unclosed. Now always call `outro()` with an appropriate message.

jkomyno committed Feb 18, 2026 at 17:39 UTC ae0e516978d4ce916595e61f931c97b623f1db96
2 files changed +27 -12
ts/packages/cli/src/services/terminal-ui.ts
+24 -9
@@ -100,11 +100,26 @@ function decorate(fn: () => void): void {
100 if (isInteractive) fn();
101 }
102
103 -function createClackSpinnerHandle(s: p.SpinnerResult, defaultMessage: string): SpinnerHandle {
103 +function createClackSpinnerHandle(
104 + s: p.SpinnerResult,
105 + defaultMessage: string
106 +): { handle: SpinnerHandle; isStopped: () => boolean } {
107 + let stopped = false;
108 return {
105 - message: (msg: string) => Effect.sync(() => s.message(msg)),
106 - stop: (msg?: string) => Effect.sync(() => s.stop(msg ?? defaultMessage)),
107 - error: (msg?: string) => Effect.sync(() => s.error(msg ?? defaultMessage)),
109 + handle: {
110 + message: (msg: string) => Effect.sync(() => s.message(msg)),
111 + stop: (msg?: string) =>
112 + Effect.sync(() => {
113 + stopped = true;
114 + s.stop(msg ?? defaultMessage);
115 + }),
116 + error: (msg?: string) =>
117 + Effect.sync(() => {
118 + stopped = true;
119 + s.error(msg ?? defaultMessage);
120 + }),
121 + },
122 + isStopped: () => stopped,
123 };
124 }
125
@@ -174,14 +189,14 @@ const makeLive: TerminalUI = {
189 Effect.sync(() => {
190 const s = p.spinner({ output: process.stderr });
191 s.start(message);
177 - return { raw: s, handle: createClackSpinnerHandle(s, message) };
192 + const { handle, isStopped } = createClackSpinnerHandle(s, message);
193 + return { raw: s, handle, isStopped };
194 }),
195 ({ handle }) => use(handle),
180 - ({ raw }, exit) =>
196 + ({ raw, isStopped }, exit) =>
197 Effect.sync(() => {
182 - // Only clean up if the spinner is still active (user didn't call stop/error)
183 - // Clack spinners have an internal `isCancelled` state after stop/error/cancel
184 - if (Exit.isFailure(exit) && !raw.isCancelled) {
198 + // Only clean up if the spinner hasn't been stopped/errored by the callback
199 + if (Exit.isFailure(exit) && !isStopped()) {
200 raw.error(message);
201 }
202 })
ts/packages/cli/src/services/upgrade-binary.ts
+3 -3
@@ -368,9 +368,9 @@ export class UpgradeBinary extends Effect.Service<UpgradeBinary>()('services/Upg
368 })
369 );
370
371 - if (didUpgrade) {
372 - yield* ui.outro('Restart your terminal to use the new version.');
373 - }
371 + yield* ui.outro(
372 + didUpgrade ? 'Restart your terminal to use the new version.' : 'No upgrade needed.'
373 + );
374 });
375
376 return {