更新大量 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,81 +1,71 @@
import { c as _c } from "react/compiler-runtime";
import * as React from 'react';
import { useMemo } from 'react';
import { type Command, formatDescriptionWithSource } from '../../commands.js';
import { Box, Text } from '../../ink.js';
import { truncate } from '../../utils/format.js';
import { Select } from '../CustomSelect/select.js';
import { useTabHeaderFocus } from '../design-system/Tabs.js';
import * as React from 'react'
import { useMemo } from 'react'
import { type Command, formatDescriptionWithSource } from '../../commands.js'
import { Box, Text } from '../../ink.js'
import { truncate } from '../../utils/format.js'
import { Select } from '../CustomSelect/select.js'
import { useTabHeaderFocus } from '../design-system/Tabs.js'
type Props = {
commands: Command[];
maxHeight: number;
columns: number;
title: string;
onCancel: () => void;
emptyMessage?: string;
};
export function Commands(t0) {
const $ = _c(14);
const {
commands,
maxHeight,
columns,
title,
onCancel,
emptyMessage
} = t0;
const {
headerFocused,
focusHeader
} = useTabHeaderFocus();
const maxWidth = Math.max(1, columns - 10);
const visibleCount = Math.max(1, Math.floor((maxHeight - 10) / 2));
let t1;
if ($[0] !== commands || $[1] !== maxWidth) {
const seen = new Set();
let t2;
if ($[3] !== maxWidth) {
t2 = cmd_0 => ({
label: `/${cmd_0.name}`,
value: cmd_0.name,
description: truncate(formatDescriptionWithSource(cmd_0), maxWidth, true)
});
$[3] = maxWidth;
$[4] = t2;
} else {
t2 = $[4];
}
t1 = commands.filter(cmd => {
if (seen.has(cmd.name)) {
return false;
}
seen.add(cmd.name);
return true;
}).sort(_temp).map(t2);
$[0] = commands;
$[1] = maxWidth;
$[2] = t1;
} else {
t1 = $[2];
}
const options = t1;
let t2;
if ($[5] !== commands.length || $[6] !== emptyMessage || $[7] !== focusHeader || $[8] !== headerFocused || $[9] !== onCancel || $[10] !== options || $[11] !== title || $[12] !== visibleCount) {
t2 = <Box flexDirection="column" paddingY={1}>{commands.length === 0 && emptyMessage ? <Text dimColor={true}>{emptyMessage}</Text> : <><Text>{title}</Text><Box marginTop={1}><Select options={options} visibleOptionCount={visibleCount} onCancel={onCancel} disableSelection={true} hideIndexes={true} layout="compact-vertical" onUpFromFirstItem={focusHeader} isDisabled={headerFocused} /></Box></>}</Box>;
$[5] = commands.length;
$[6] = emptyMessage;
$[7] = focusHeader;
$[8] = headerFocused;
$[9] = onCancel;
$[10] = options;
$[11] = title;
$[12] = visibleCount;
$[13] = t2;
} else {
t2 = $[13];
}
return t2;
commands: Command[]
maxHeight: number
columns: number
title: string
onCancel: () => void
emptyMessage?: string
}
function _temp(a, b) {
return a.name.localeCompare(b.name);
export function Commands({
commands,
maxHeight,
columns,
title,
onCancel,
emptyMessage,
}: Props): React.ReactNode {
const { headerFocused, focusHeader } = useTabHeaderFocus()
const maxWidth = Math.max(1, columns - 10)
const visibleCount = Math.max(1, Math.floor((maxHeight - 10) / 2))
const options = useMemo(() => {
// Custom commands can appear more than once (e.g. same name at user and
// project scope). Dedupe by name to avoid React key collisions in Select.
const seen = new Set<string>()
return commands
.filter(cmd => {
if (seen.has(cmd.name)) return false
seen.add(cmd.name)
return true
})
.sort((a, b) => a.name.localeCompare(b.name))
.map(cmd => ({
label: `/${cmd.name}`,
value: cmd.name,
description: truncate(formatDescriptionWithSource(cmd), maxWidth, true),
}))
}, [commands, maxWidth])
return (
<Box flexDirection="column" paddingY={1}>
{commands.length === 0 && emptyMessage ? (
<Text dimColor>{emptyMessage}</Text>
) : (
<>
<Text>{title}</Text>
<Box marginTop={1}>
<Select
options={options}
visibleOptionCount={visibleCount}
onCancel={onCancel}
disableSelection
hideIndexes
layout="compact-vertical"
onUpFromFirstItem={focusHeader}
isDisabled={headerFocused}
/>
</Box>
</>
)}
</Box>
)
}

View File

@@ -1,22 +1,22 @@
import { c as _c } from "react/compiler-runtime";
import * as React from 'react';
import { Box, Text } from '../../ink.js';
import { PromptInputHelpMenu } from '../PromptInput/PromptInputHelpMenu.js';
export function General() {
const $ = _c(2);
let t0;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t0 = <Box><Text>Claude understands your codebase, makes edits with your permission, and executes commands right from your terminal.</Text></Box>;
$[0] = t0;
} else {
t0 = $[0];
}
let t1;
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
t1 = <Box flexDirection="column" paddingY={1} gap={1}>{t0}<Box flexDirection="column"><Box><Text bold={true}>Shortcuts</Text></Box><PromptInputHelpMenu gap={2} fixedWidth={true} /></Box></Box>;
$[1] = t1;
} else {
t1 = $[1];
}
return t1;
import * as React from 'react'
import { Box, Text } from '../../ink.js'
import { PromptInputHelpMenu } from '../PromptInput/PromptInputHelpMenu.js'
export function General(): React.ReactNode {
return (
<Box flexDirection="column" paddingY={1} gap={1}>
<Box>
<Text>
Claude understands your codebase, makes edits with your permission,
and executes commands right from your terminal.
</Text>
</Box>
<Box flexDirection="column">
<Box>
<Text bold>Shortcuts</Text>
</Box>
<PromptInputHelpMenu gap={2} fixedWidth={true} />
</Box>
</Box>
)
}

View File

@@ -1,183 +1,138 @@
import { c as _c } from "react/compiler-runtime";
import * as React from 'react';
import { useExitOnCtrlCDWithKeybindings } from 'src/hooks/useExitOnCtrlCDWithKeybindings.js';
import { useShortcutDisplay } from 'src/keybindings/useShortcutDisplay.js';
import { builtInCommandNames, type Command, type CommandResultDisplay, INTERNAL_ONLY_COMMANDS } from '../../commands.js';
import { useIsInsideModal } from '../../context/modalContext.js';
import { useTerminalSize } from '../../hooks/useTerminalSize.js';
import { Box, Link, Text } from '../../ink.js';
import { useKeybinding } from '../../keybindings/useKeybinding.js';
import { Pane } from '../design-system/Pane.js';
import { Tab, Tabs } from '../design-system/Tabs.js';
import { Commands } from './Commands.js';
import { General } from './General.js';
import * as React from 'react'
import { useExitOnCtrlCDWithKeybindings } from 'src/hooks/useExitOnCtrlCDWithKeybindings.js'
import { useShortcutDisplay } from 'src/keybindings/useShortcutDisplay.js'
import {
builtInCommandNames,
type Command,
type CommandResultDisplay,
INTERNAL_ONLY_COMMANDS,
} from '../../commands.js'
import { useIsInsideModal } from '../../context/modalContext.js'
import { useTerminalSize } from '../../hooks/useTerminalSize.js'
import { Box, Link, Text } from '../../ink.js'
import { useKeybinding } from '../../keybindings/useKeybinding.js'
import { Pane } from '../design-system/Pane.js'
import { Tab, Tabs } from '../design-system/Tabs.js'
import { Commands } from './Commands.js'
import { General } from './General.js'
type Props = {
onClose: (result?: string, options?: {
display?: CommandResultDisplay;
}) => void;
commands: Command[];
};
export function HelpV2(t0) {
const $ = _c(44);
const {
onClose,
commands
} = t0;
const {
rows,
columns
} = useTerminalSize();
const maxHeight = Math.floor(rows / 2);
const insideModal = useIsInsideModal();
let t1;
if ($[0] !== onClose) {
t1 = () => onClose("Help dialog dismissed", {
display: "system"
});
$[0] = onClose;
$[1] = t1;
} else {
t1 = $[1];
}
const close = t1;
let t2;
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
t2 = {
context: "Help"
};
$[2] = t2;
} else {
t2 = $[2];
}
useKeybinding("help:dismiss", close, t2);
const exitState = useExitOnCtrlCDWithKeybindings(close);
const dismissShortcut = useShortcutDisplay("help:dismiss", "Help", "esc");
let antOnlyCommands;
let builtinCommands;
let t3;
if ($[3] !== commands) {
const builtinNames = builtInCommandNames();
builtinCommands = commands.filter(cmd => builtinNames.has(cmd.name) && !cmd.isHidden);
let t4;
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
t4 = [];
$[7] = t4;
} else {
t4 = $[7];
}
antOnlyCommands = t4;
t3 = commands.filter(cmd_2 => !builtinNames.has(cmd_2.name) && !cmd_2.isHidden);
$[3] = commands;
$[4] = antOnlyCommands;
$[5] = builtinCommands;
$[6] = t3;
} else {
antOnlyCommands = $[4];
builtinCommands = $[5];
t3 = $[6];
}
const customCommands = t3;
let t4;
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
t4 = <Tab key="general" title="general"><General /></Tab>;
$[8] = t4;
} else {
t4 = $[8];
}
let tabs;
if ($[9] !== antOnlyCommands || $[10] !== builtinCommands || $[11] !== close || $[12] !== columns || $[13] !== customCommands || $[14] !== maxHeight) {
tabs = [t4];
let t5;
if ($[16] !== builtinCommands || $[17] !== close || $[18] !== columns || $[19] !== maxHeight) {
t5 = <Tab key="commands" title="commands"><Commands commands={builtinCommands} maxHeight={maxHeight} columns={columns} title="Browse default commands:" onCancel={close} /></Tab>;
$[16] = builtinCommands;
$[17] = close;
$[18] = columns;
$[19] = maxHeight;
$[20] = t5;
} else {
t5 = $[20];
}
tabs.push(t5);
let t6;
if ($[21] !== close || $[22] !== columns || $[23] !== customCommands || $[24] !== maxHeight) {
t6 = <Tab key="custom" title="custom-commands"><Commands commands={customCommands} maxHeight={maxHeight} columns={columns} title="Browse custom commands:" emptyMessage="No custom commands found" onCancel={close} /></Tab>;
$[21] = close;
$[22] = columns;
$[23] = customCommands;
$[24] = maxHeight;
$[25] = t6;
} else {
t6 = $[25];
}
tabs.push(t6);
if (false && antOnlyCommands.length > 0) {
let t7;
if ($[26] !== antOnlyCommands || $[27] !== close || $[28] !== columns || $[29] !== maxHeight) {
t7 = <Tab key="ant-only" title="[ant-only]"><Commands commands={antOnlyCommands} maxHeight={maxHeight} columns={columns} title="Browse ant-only commands:" onCancel={close} /></Tab>;
$[26] = antOnlyCommands;
$[27] = close;
$[28] = columns;
$[29] = maxHeight;
$[30] = t7;
} else {
t7 = $[30];
}
tabs.push(t7);
}
$[9] = antOnlyCommands;
$[10] = builtinCommands;
$[11] = close;
$[12] = columns;
$[13] = customCommands;
$[14] = maxHeight;
$[15] = tabs;
} else {
tabs = $[15];
}
const t5 = insideModal ? undefined : maxHeight;
let t6;
if ($[31] !== tabs) {
t6 = <Tabs title={false ? "/help" : `Claude Code v${MACRO.VERSION}`} color="professionalBlue" defaultTab="general">{tabs}</Tabs>;
$[31] = tabs;
$[32] = t6;
} else {
t6 = $[32];
}
let t7;
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
t7 = <Box marginTop={1}><Text>For more help:{" "}<Link url="https://code.claude.com/docs/en/overview" /></Text></Box>;
$[33] = t7;
} else {
t7 = $[33];
}
let t8;
if ($[34] !== dismissShortcut || $[35] !== exitState.keyName || $[36] !== exitState.pending) {
t8 = <Box marginTop={1}><Text dimColor={true}>{exitState.pending ? <>Press {exitState.keyName} again to exit</> : <Text italic={true}>{dismissShortcut} to cancel</Text>}</Text></Box>;
$[34] = dismissShortcut;
$[35] = exitState.keyName;
$[36] = exitState.pending;
$[37] = t8;
} else {
t8 = $[37];
}
let t9;
if ($[38] !== t6 || $[39] !== t8) {
t9 = <Pane color="professionalBlue">{t6}{t7}{t8}</Pane>;
$[38] = t6;
$[39] = t8;
$[40] = t9;
} else {
t9 = $[40];
}
let t10;
if ($[41] !== t5 || $[42] !== t9) {
t10 = <Box flexDirection="column" height={t5}>{t9}</Box>;
$[41] = t5;
$[42] = t9;
$[43] = t10;
} else {
t10 = $[43];
}
return t10;
onClose: (
result?: string,
options?: { display?: CommandResultDisplay },
) => void
commands: Command[]
}
export function HelpV2({ onClose, commands }: Props): React.ReactNode {
const { rows, columns } = useTerminalSize()
const maxHeight = Math.floor(rows / 2)
// Inside the modal slot, FullscreenLayout already caps height and Pane/Tabs
// use flexShrink=0 (see #23592) — our own height= constraint would clip the
// footer since Tabs won't shrink to fit. Let the modal slot handle sizing.
const insideModal = useIsInsideModal()
const close = () => onClose('Help dialog dismissed', { display: 'system' })
useKeybinding('help:dismiss', close, { context: 'Help' })
const exitState = useExitOnCtrlCDWithKeybindings(close)
const dismissShortcut = useShortcutDisplay('help:dismiss', 'Help', 'esc')
const builtinNames = builtInCommandNames()
let builtinCommands = commands.filter(
cmd => builtinNames.has(cmd.name) && !cmd.isHidden,
)
let antOnlyCommands: Command[] = []
// We have to do this in an `if` to help treeshaking
if (process.env.USER_TYPE === 'ant') {
const internalOnlyNames = new Set(INTERNAL_ONLY_COMMANDS.map(_ => _.name))
builtinCommands = builtinCommands.filter(
cmd => !internalOnlyNames.has(cmd.name),
)
antOnlyCommands = commands.filter(
cmd => internalOnlyNames.has(cmd.name) && !cmd.isHidden,
)
}
const customCommands = commands.filter(
cmd => !builtinNames.has(cmd.name) && !cmd.isHidden,
)
const tabs = [
<Tab key="general" title="general">
<General />
</Tab>,
]
tabs.push(
<Tab key="commands" title="commands">
<Commands
commands={builtinCommands}
maxHeight={maxHeight}
columns={columns}
title="Browse default commands:"
onCancel={close}
/>
</Tab>,
)
tabs.push(
<Tab key="custom" title="custom-commands">
<Commands
commands={customCommands}
maxHeight={maxHeight}
columns={columns}
title="Browse custom commands:"
emptyMessage="No custom commands found"
onCancel={close}
/>
</Tab>,
)
if (process.env.USER_TYPE === 'ant' && antOnlyCommands.length > 0) {
tabs.push(
<Tab key="ant-only" title="[ant-only]">
<Commands
commands={antOnlyCommands}
maxHeight={maxHeight}
columns={columns}
title="Browse ant-only commands:"
onCancel={close}
/>
</Tab>,
)
}
return (
<Box flexDirection="column" height={insideModal ? undefined : maxHeight}>
<Pane color="professionalBlue">
<Tabs
title={
process.env.USER_TYPE === 'ant'
? '/help'
: `Claude Code v${MACRO.VERSION}`
}
color="professionalBlue"
defaultTab="general"
>
{tabs}
</Tabs>
<Box marginTop={1}>
<Text>
For more help:{' '}
<Link url="https://code.claude.com/docs/en/overview" />
</Text>
</Box>
<Box marginTop={1}>
<Text dimColor>
{exitState.pending ? (
<>Press {exitState.keyName} again to exit</>
) : (
<Text italic>{dismissShortcut} to cancel</Text>
)}
</Text>
</Box>
</Pane>
</Box>
)
}