Skip to content

Commit c54969f

Browse files
skulidropekclaude
andcommitted
fix(shell): unify Effect types in runMenu TTY fallback
Replace Effect.suspend (union of incompatible branches) with Effect.flatMap on a boolean so TypeScript unifies the two branch types: Effect<void, InputReadError, never> | Effect<void, never, R> → Effect<void, InputReadError, R>. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7963a87 commit c54969f

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

packages/app/src/docker-git/menu.ts

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -292,28 +292,29 @@ const TuiApp = () => {
292292
// SOURCE: https://github.com/vadimdemedes/ink/#israwmodesupported
293293
// FORMAT THEOREM: ∀ env: isTTY(env) → renderTui ∧ ¬isTTY(env) → listProjectStatus
294294
// INVARIANT: render() is only called when stdin.isTTY ∧ setRawMode ∈ stdin
295-
export const runMenu = Effect.suspend(() => {
296-
if (!process.stdin.isTTY || typeof process.stdin.setRawMode !== "function") {
297-
return listProjectStatus
298-
}
299-
300-
return pipe(
301-
Effect.sync(() => {
302-
resumeTui()
303-
}),
304-
Effect.zipRight(
305-
Effect.tryPromise({
306-
try: () => render(React.createElement(TuiApp)).waitUntilExit(),
307-
catch: (error) => new InputReadError({ message: error instanceof Error ? error.message : String(error) })
308-
})
309-
),
310-
Effect.ensuring(
311-
Effect.sync(() => {
312-
leaveTui()
313-
})
314-
),
315-
Effect.asVoid
295+
export const runMenu = pipe(
296+
Effect.sync(() => process.stdin.isTTY && typeof process.stdin.setRawMode === "function"),
297+
Effect.flatMap((hasTty) =>
298+
hasTty
299+
? pipe(
300+
Effect.sync(() => {
301+
resumeTui()
302+
}),
303+
Effect.zipRight(
304+
Effect.tryPromise({
305+
try: () => render(React.createElement(TuiApp)).waitUntilExit(),
306+
catch: (error) => new InputReadError({ message: error instanceof Error ? error.message : String(error) })
307+
})
308+
),
309+
Effect.ensuring(
310+
Effect.sync(() => {
311+
leaveTui()
312+
})
313+
),
314+
Effect.asVoid
315+
)
316+
: Effect.ignore(listProjectStatus)
316317
)
317-
})
318+
)
318319

319320
export type MenuError = AppError | InputCancelledError

0 commit comments

Comments
 (0)