mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-24 17:15:50 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,44 +1,36 @@
|
||||
import { feature } from 'bun:bundle'
|
||||
import { spawnSync } from 'child_process'
|
||||
import sample from 'lodash-es/sample.js'
|
||||
import * as React from 'react'
|
||||
import { ExitFlow } from '../../components/ExitFlow.js'
|
||||
import type { LocalJSXCommandOnDone } from '../../types/command.js'
|
||||
import { isBgSession } from '../../utils/concurrentSessions.js'
|
||||
import { gracefulShutdown } from '../../utils/gracefulShutdown.js'
|
||||
import { getCurrentWorktreeSession } from '../../utils/worktree.js'
|
||||
import { feature } from 'bun:bundle';
|
||||
import { spawnSync } from 'child_process';
|
||||
import sample from 'lodash-es/sample.js';
|
||||
import * as React from 'react';
|
||||
import { ExitFlow } from '../../components/ExitFlow.js';
|
||||
import type { LocalJSXCommandOnDone } from '../../types/command.js';
|
||||
import { isBgSession } from '../../utils/concurrentSessions.js';
|
||||
import { gracefulShutdown } from '../../utils/gracefulShutdown.js';
|
||||
import { getCurrentWorktreeSession } from '../../utils/worktree.js';
|
||||
|
||||
const GOODBYE_MESSAGES = ['Goodbye!', 'See ya!', 'Bye!', 'Catch you later!']
|
||||
const GOODBYE_MESSAGES = ['Goodbye!', 'See ya!', 'Bye!', 'Catch you later!'];
|
||||
|
||||
function getRandomGoodbyeMessage(): string {
|
||||
return sample(GOODBYE_MESSAGES) ?? 'Goodbye!'
|
||||
return sample(GOODBYE_MESSAGES) ?? 'Goodbye!';
|
||||
}
|
||||
|
||||
export async function call(
|
||||
onDone: LocalJSXCommandOnDone,
|
||||
): Promise<React.ReactNode> {
|
||||
export async function call(onDone: LocalJSXCommandOnDone): Promise<React.ReactNode> {
|
||||
// Inside a `claude --bg` tmux session: detach instead of kill. The REPL
|
||||
// keeps running; `claude attach` can reconnect. Covers /exit, /quit,
|
||||
// ctrl+c, ctrl+d — all funnel through here via REPL's handleExit.
|
||||
if (feature('BG_SESSIONS') && isBgSession()) {
|
||||
onDone()
|
||||
spawnSync('tmux', ['detach-client'], { stdio: 'ignore' })
|
||||
return null
|
||||
onDone();
|
||||
spawnSync('tmux', ['detach-client'], { stdio: 'ignore' });
|
||||
return null;
|
||||
}
|
||||
|
||||
const showWorktree = getCurrentWorktreeSession() !== null
|
||||
const showWorktree = getCurrentWorktreeSession() !== null;
|
||||
|
||||
if (showWorktree) {
|
||||
return (
|
||||
<ExitFlow
|
||||
showWorktree={showWorktree}
|
||||
onDone={onDone}
|
||||
onCancel={() => onDone()}
|
||||
/>
|
||||
)
|
||||
return <ExitFlow showWorktree={showWorktree} onDone={onDone} onCancel={() => onDone()} />;
|
||||
}
|
||||
|
||||
onDone(getRandomGoodbyeMessage())
|
||||
await gracefulShutdown(0, 'prompt_input_exit')
|
||||
return null
|
||||
onDone(getRandomGoodbyeMessage());
|
||||
await gracefulShutdown(0, 'prompt_input_exit');
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user