更新大量 tsx 原始文件; 已经迁移 login panel; 部分 (#121)

* style(B1-1): 格式化 ink/buddy/cli/context/screens/tasks/services/keybindings/state (43 files)

纯格式化:移除分号、React Compiler import、import 多行展开。
修复了 Box.tsx 和 ScrollBox.tsx 中无效的 global.d.ts import。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style(B1-2): 格式化 commands (79 files)

纯格式化:移除分号、React Compiler import、import 多行展开。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style(B1-3): 格式化 components/messages,permissions,mcp,sandbox,shell (104 files)

纯格式化:移除分号、React Compiler import、import 多行展开。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style(B1-4): 格式化 components/PromptInput,FeedbackSurvey,tasks,agents,skills,design-system,wizard (73 files)

纯格式化:移除分号、React Compiler import、import 多行展开。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style(B1-5): 格式化 components其余 + hooks + tools (232 files)

纯格式化:移除分号、React Compiler import、import 多行展开。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style(B1-6): 格式化 main/entrypoints/utils/moreright (21 files)

纯格式化:移除分号、React Compiler import、import 多行展开。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: 更新 README,新增 Run.ps1/TODO.md,删除 V6.md

- README.md: 大幅重写,更详细版本历史和配置示例
- Run.ps1: 新增 Windows 启动脚本
- TODO.md: 新增包完成清单
- V6.md: 删除(架构重构规划已不适用)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: 修复以前的问题

* fix: 修复 login 面板的问题

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-04-04 23:24:27 +08:00
committed by GitHub
parent 02694918b5
commit 5b1a52b8e0
559 changed files with 103807 additions and 101817 deletions

View File

@@ -1,192 +1,151 @@
import { c as _c } from "react/compiler-runtime";
import React, { useEffect, useState } from 'react';
import type { CommandResultDisplay } from '../commands.js';
import React, { useEffect, useState } from 'react'
import type { CommandResultDisplay } from '../commands.js'
// eslint-disable-next-line custom-rules/prefer-use-keybindings -- raw input for "any key" dismiss and y/n prompt
import { Box, Text, useInput } from '../ink.js';
import { openBrowser } from '../utils/browser.js';
import { getDesktopInstallStatus, openCurrentSessionInDesktop } from '../utils/desktopDeepLink.js';
import { errorMessage } from '../utils/errors.js';
import { gracefulShutdown } from '../utils/gracefulShutdown.js';
import { flushSessionStorage } from '../utils/sessionStorage.js';
import { LoadingState } from './design-system/LoadingState.js';
const DESKTOP_DOCS_URL = 'https://clau.de/desktop';
import { Box, Text, useInput } from '../ink.js'
import { openBrowser } from '../utils/browser.js'
import {
getDesktopInstallStatus,
openCurrentSessionInDesktop,
} from '../utils/desktopDeepLink.js'
import { errorMessage } from '../utils/errors.js'
import { gracefulShutdown } from '../utils/gracefulShutdown.js'
import { flushSessionStorage } from '../utils/sessionStorage.js'
import { LoadingState } from './design-system/LoadingState.js'
const DESKTOP_DOCS_URL = 'https://clau.de/desktop'
export function getDownloadUrl(): string {
switch (process.platform) {
case 'win32':
return 'https://claude.ai/api/desktop/win32/x64/exe/latest/redirect';
return 'https://claude.ai/api/desktop/win32/x64/exe/latest/redirect'
default:
return 'https://claude.ai/api/desktop/darwin/universal/dmg/latest/redirect';
return 'https://claude.ai/api/desktop/darwin/universal/dmg/latest/redirect'
}
}
type DesktopHandoffState = 'checking' | 'prompt-download' | 'flushing' | 'opening' | 'success' | 'error';
type DesktopHandoffState =
| 'checking'
| 'prompt-download'
| 'flushing'
| 'opening'
| 'success'
| 'error'
type Props = {
onDone: (result?: string, options?: {
display?: CommandResultDisplay;
}) => void;
};
export function DesktopHandoff(t0) {
const $ = _c(20);
const {
onDone
} = t0;
const [state, setState] = useState("checking");
const [error, setError] = useState(null);
const [downloadMessage, setDownloadMessage] = useState("");
let t1;
if ($[0] !== error || $[1] !== onDone || $[2] !== state) {
t1 = input => {
if (state === "error") {
onDone(error ?? "Unknown error", {
display: "system"
});
return;
}
if (state === "prompt-download") {
if (input === "y" || input === "Y") {
openBrowser(getDownloadUrl()).catch(_temp);
onDone(`Starting download. Re-run /desktop once you\u2019ve installed the app.\nLearn more at ${DESKTOP_DOCS_URL}`, {
display: "system"
});
} else {
if (input === "n" || input === "N") {
onDone(`The desktop app is required for /desktop. Learn more at ${DESKTOP_DOCS_URL}`, {
display: "system"
});
}
}
}
};
$[0] = error;
$[1] = onDone;
$[2] = state;
$[3] = t1;
} else {
t1 = $[3];
}
useInput(t1);
let t2;
let t3;
if ($[4] !== onDone) {
t2 = () => {
const performHandoff = async function performHandoff() {
setState("checking");
const installStatus = await getDesktopInstallStatus();
if (installStatus.status === "not-installed") {
setDownloadMessage("Claude Desktop is not installed.");
setState("prompt-download");
return;
}
if (installStatus.status === "version-too-old") {
setDownloadMessage(`Claude Desktop needs to be updated (found v${installStatus.version}, need v1.1.2396+).`);
setState("prompt-download");
return;
}
setState("flushing");
await flushSessionStorage();
setState("opening");
const result = await openCurrentSessionInDesktop();
if (!result.success) {
setError(result.error ?? "Failed to open Claude Desktop");
setState("error");
return;
}
setState("success");
setTimeout(_temp2, 500, onDone);
};
performHandoff().catch(err => {
setError(errorMessage(err));
setState("error");
});
};
t3 = [onDone];
$[4] = onDone;
$[5] = t2;
$[6] = t3;
} else {
t2 = $[5];
t3 = $[6];
}
useEffect(t2, t3);
if (state === "error") {
let t4;
if ($[7] !== error) {
t4 = <Text color="error">Error: {error}</Text>;
$[7] = error;
$[8] = t4;
} else {
t4 = $[8];
}
let t5;
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
t5 = <Text dimColor={true}>Press any key to continue</Text>;
$[9] = t5;
} else {
t5 = $[9];
}
let t6;
if ($[10] !== t4) {
t6 = <Box flexDirection="column" paddingX={2}>{t4}{t5}</Box>;
$[10] = t4;
$[11] = t6;
} else {
t6 = $[11];
}
return t6;
}
if (state === "prompt-download") {
let t4;
if ($[12] !== downloadMessage) {
t4 = <Text>{downloadMessage}</Text>;
$[12] = downloadMessage;
$[13] = t4;
} else {
t4 = $[13];
}
let t5;
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
t5 = <Text>Download now? (y/n)</Text>;
$[14] = t5;
} else {
t5 = $[14];
}
let t6;
if ($[15] !== t4) {
t6 = <Box flexDirection="column" paddingX={2}>{t4}{t5}</Box>;
$[15] = t4;
$[16] = t6;
} else {
t6 = $[16];
}
return t6;
}
let t4;
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
t4 = {
checking: "Checking for Claude Desktop\u2026",
flushing: "Saving session\u2026",
opening: "Opening Claude Desktop\u2026",
success: "Opening in Claude Desktop\u2026"
};
$[17] = t4;
} else {
t4 = $[17];
}
const messages = t4;
const t5 = messages[state];
let t6;
if ($[18] !== t5) {
t6 = <LoadingState message={t5} />;
$[18] = t5;
$[19] = t6;
} else {
t6 = $[19];
}
return t6;
onDone: (
result?: string,
options?: { display?: CommandResultDisplay },
) => void
}
async function _temp2(onDone_0) {
onDone_0("Session transferred to Claude Desktop", {
display: "system"
});
await gracefulShutdown(0, "other");
export function DesktopHandoff({ onDone }: Props): React.ReactNode {
const [state, setState] = useState<DesktopHandoffState>('checking')
const [error, setError] = useState<string | null>(null)
const [downloadMessage, setDownloadMessage] = useState<string>('')
// Handle keyboard input for error and prompt-download states
useInput(input => {
if (state === 'error') {
onDone(error ?? 'Unknown error', { display: 'system' })
return
}
if (state === 'prompt-download') {
if (input === 'y' || input === 'Y') {
openBrowser(getDownloadUrl()).catch(() => {})
onDone(
`Starting download. Re-run /desktop once you\u2019ve installed the app.\nLearn more at ${DESKTOP_DOCS_URL}`,
{ display: 'system' },
)
} else if (input === 'n' || input === 'N') {
onDone(
`The desktop app is required for /desktop. Learn more at ${DESKTOP_DOCS_URL}`,
{ display: 'system' },
)
}
}
})
useEffect(() => {
async function performHandoff(): Promise<void> {
// Check Desktop install status
setState('checking')
const installStatus = await getDesktopInstallStatus()
if (installStatus.status === 'not-installed') {
setDownloadMessage('Claude Desktop is not installed.')
setState('prompt-download')
return
}
if (installStatus.status === 'version-too-old') {
setDownloadMessage(
`Claude Desktop needs to be updated (found v${installStatus.version}, need v1.1.2396+).`,
)
setState('prompt-download')
return
}
// Flush session storage to ensure transcript is fully written
setState('flushing')
await flushSessionStorage()
// Open the deep link (uses claude-dev:// in dev mode)
setState('opening')
const result = await openCurrentSessionInDesktop()
if (!result.success) {
setError(result.error ?? 'Failed to open Claude Desktop')
setState('error')
return
}
// Success - exit the CLI
setState('success')
// Give the user a moment to see the success message
setTimeout(
async (onDone: Props['onDone']) => {
onDone('Session transferred to Claude Desktop', { display: 'system' })
await gracefulShutdown(0, 'other')
},
500,
onDone,
)
}
performHandoff().catch(err => {
setError(errorMessage(err))
setState('error')
})
}, [onDone])
if (state === 'error') {
return (
<Box flexDirection="column" paddingX={2}>
<Text color="error">Error: {error}</Text>
<Text dimColor>Press any key to continue</Text>
</Box>
)
}
if (state === 'prompt-download') {
return (
<Box flexDirection="column" paddingX={2}>
<Text>{downloadMessage}</Text>
<Text>Download now? (y/n)</Text>
</Box>
)
}
const messages: Record<
Exclude<DesktopHandoffState, 'error' | 'prompt-download'>,
string
> = {
checking: 'Checking for Claude Desktop…',
flushing: 'Saving session…',
opening: 'Opening Claude Desktop…',
success: 'Opening in Claude Desktop…',
}
return <LoadingState message={messages[state]} />
}
function _temp() {}