mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 08:15:53 +00:00
更新大量 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:
@@ -1,149 +1,105 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import figures from 'figures';
|
||||
import * as React from 'react';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
import { getOriginalCwd } from '../../../bootstrap/state.js';
|
||||
import type { CommandResultDisplay } from '../../../commands.js';
|
||||
import { Select } from '../../../components/CustomSelect/select.js';
|
||||
import { Box, Text } from '../../../ink.js';
|
||||
import type { ToolPermissionContext } from '../../../Tool.js';
|
||||
import { useTabHeaderFocus } from '../../design-system/Tabs.js';
|
||||
import figures from 'figures'
|
||||
import * as React from 'react'
|
||||
import { useCallback, useEffect } from 'react'
|
||||
import { getOriginalCwd } from '../../../bootstrap/state.js'
|
||||
import type { CommandResultDisplay } from '../../../commands.js'
|
||||
import { Select } from '../../../components/CustomSelect/select.js'
|
||||
import { Box, Text } from '../../../ink.js'
|
||||
import type { ToolPermissionContext } from '../../../Tool.js'
|
||||
import { useTabHeaderFocus } from '../../design-system/Tabs.js'
|
||||
|
||||
type Props = {
|
||||
onExit: (result?: string, options?: {
|
||||
display?: CommandResultDisplay;
|
||||
}) => void;
|
||||
toolPermissionContext: ToolPermissionContext;
|
||||
onRequestAddDirectory: () => void;
|
||||
onRequestRemoveDirectory: (path: string) => void;
|
||||
onHeaderFocusChange?: (focused: boolean) => void;
|
||||
};
|
||||
onExit: (
|
||||
result?: string,
|
||||
options?: { display?: CommandResultDisplay },
|
||||
) => void
|
||||
toolPermissionContext: ToolPermissionContext
|
||||
onRequestAddDirectory: () => void
|
||||
onRequestRemoveDirectory: (path: string) => void
|
||||
onHeaderFocusChange?: (focused: boolean) => void
|
||||
}
|
||||
|
||||
type DirectoryItem = {
|
||||
path: string;
|
||||
isCurrent: boolean;
|
||||
isDeletable: boolean;
|
||||
};
|
||||
export function WorkspaceTab(t0) {
|
||||
const $ = _c(23);
|
||||
const {
|
||||
onExit,
|
||||
toolPermissionContext,
|
||||
onRequestAddDirectory,
|
||||
onRequestRemoveDirectory,
|
||||
onHeaderFocusChange
|
||||
} = t0;
|
||||
const {
|
||||
headerFocused,
|
||||
focusHeader
|
||||
} = useTabHeaderFocus();
|
||||
let t1;
|
||||
let t2;
|
||||
if ($[0] !== headerFocused || $[1] !== onHeaderFocusChange) {
|
||||
t1 = () => {
|
||||
onHeaderFocusChange?.(headerFocused);
|
||||
};
|
||||
t2 = [headerFocused, onHeaderFocusChange];
|
||||
$[0] = headerFocused;
|
||||
$[1] = onHeaderFocusChange;
|
||||
$[2] = t1;
|
||||
$[3] = t2;
|
||||
} else {
|
||||
t1 = $[2];
|
||||
t2 = $[3];
|
||||
}
|
||||
useEffect(t1, t2);
|
||||
let t3;
|
||||
if ($[4] !== toolPermissionContext.additionalWorkingDirectories) {
|
||||
t3 = Array.from(toolPermissionContext.additionalWorkingDirectories.keys()).map(_temp);
|
||||
$[4] = toolPermissionContext.additionalWorkingDirectories;
|
||||
$[5] = t3;
|
||||
} else {
|
||||
t3 = $[5];
|
||||
}
|
||||
const additionalDirectories = t3;
|
||||
let t4;
|
||||
if ($[6] !== additionalDirectories || $[7] !== onRequestAddDirectory || $[8] !== onRequestRemoveDirectory) {
|
||||
t4 = selectedValue => {
|
||||
if (selectedValue === "add-directory") {
|
||||
onRequestAddDirectory();
|
||||
return;
|
||||
path: string
|
||||
isCurrent: boolean
|
||||
isDeletable: boolean
|
||||
}
|
||||
|
||||
export function WorkspaceTab({
|
||||
onExit,
|
||||
toolPermissionContext,
|
||||
onRequestAddDirectory,
|
||||
onRequestRemoveDirectory,
|
||||
onHeaderFocusChange,
|
||||
}: Props): React.ReactNode {
|
||||
const { headerFocused, focusHeader } = useTabHeaderFocus()
|
||||
useEffect(() => {
|
||||
onHeaderFocusChange?.(headerFocused)
|
||||
}, [headerFocused, onHeaderFocusChange])
|
||||
// Get only additional workspace directories (not the current working directory)
|
||||
const additionalDirectories = React.useMemo((): DirectoryItem[] => {
|
||||
return Array.from(
|
||||
toolPermissionContext.additionalWorkingDirectories.keys(),
|
||||
).map(path => ({
|
||||
path,
|
||||
isCurrent: false,
|
||||
isDeletable: true,
|
||||
}))
|
||||
}, [toolPermissionContext.additionalWorkingDirectories])
|
||||
|
||||
const handleDirectorySelect = useCallback(
|
||||
(selectedValue: string) => {
|
||||
if (selectedValue === 'add-directory') {
|
||||
onRequestAddDirectory()
|
||||
return
|
||||
}
|
||||
const directory = additionalDirectories.find(d => d.path === selectedValue);
|
||||
|
||||
const directory = additionalDirectories.find(
|
||||
d => d.path === selectedValue,
|
||||
)
|
||||
if (directory && directory.isDeletable) {
|
||||
onRequestRemoveDirectory(directory.path);
|
||||
onRequestRemoveDirectory(directory.path)
|
||||
}
|
||||
};
|
||||
$[6] = additionalDirectories;
|
||||
$[7] = onRequestAddDirectory;
|
||||
$[8] = onRequestRemoveDirectory;
|
||||
$[9] = t4;
|
||||
} else {
|
||||
t4 = $[9];
|
||||
}
|
||||
const handleDirectorySelect = t4;
|
||||
let t5;
|
||||
if ($[10] !== onExit) {
|
||||
t5 = () => onExit("Workspace dialog dismissed", {
|
||||
display: "system"
|
||||
});
|
||||
$[10] = onExit;
|
||||
$[11] = t5;
|
||||
} else {
|
||||
t5 = $[11];
|
||||
}
|
||||
const handleCancel = t5;
|
||||
let opts;
|
||||
if ($[12] !== additionalDirectories) {
|
||||
opts = additionalDirectories.map(_temp2);
|
||||
let t6;
|
||||
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t6 = {
|
||||
label: `Add directory${figures.ellipsis}`,
|
||||
value: "add-directory"
|
||||
};
|
||||
$[14] = t6;
|
||||
} else {
|
||||
t6 = $[14];
|
||||
}
|
||||
opts.push(t6);
|
||||
$[12] = additionalDirectories;
|
||||
$[13] = opts;
|
||||
} else {
|
||||
opts = $[13];
|
||||
}
|
||||
const options = opts;
|
||||
let t6;
|
||||
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t6 = <Box flexDirection="row" marginTop={1} marginLeft={2} gap={1}><Text>{`- ${getOriginalCwd()}`}</Text><Text dimColor={true}>(Original working directory)</Text></Box>;
|
||||
$[15] = t6;
|
||||
} else {
|
||||
t6 = $[15];
|
||||
}
|
||||
const t7 = Math.min(10, options.length);
|
||||
let t8;
|
||||
if ($[16] !== focusHeader || $[17] !== handleCancel || $[18] !== handleDirectorySelect || $[19] !== headerFocused || $[20] !== options || $[21] !== t7) {
|
||||
t8 = <Box flexDirection="column" marginBottom={1}>{t6}<Select options={options} onChange={handleDirectorySelect} onCancel={handleCancel} visibleOptionCount={t7} onUpFromFirstItem={focusHeader} isDisabled={headerFocused} /></Box>;
|
||||
$[16] = focusHeader;
|
||||
$[17] = handleCancel;
|
||||
$[18] = handleDirectorySelect;
|
||||
$[19] = headerFocused;
|
||||
$[20] = options;
|
||||
$[21] = t7;
|
||||
$[22] = t8;
|
||||
} else {
|
||||
t8 = $[22];
|
||||
}
|
||||
return t8;
|
||||
}
|
||||
function _temp2(dir) {
|
||||
return {
|
||||
label: dir.path,
|
||||
value: dir.path
|
||||
};
|
||||
}
|
||||
function _temp(path) {
|
||||
return {
|
||||
path,
|
||||
isCurrent: false,
|
||||
isDeletable: true
|
||||
};
|
||||
},
|
||||
[additionalDirectories, onRequestAddDirectory, onRequestRemoveDirectory],
|
||||
)
|
||||
|
||||
const handleCancel = useCallback(
|
||||
() => onExit('Workspace dialog dismissed', { display: 'system' }),
|
||||
[onExit],
|
||||
)
|
||||
|
||||
// Main list view options
|
||||
const options = React.useMemo(() => {
|
||||
const opts = additionalDirectories.map(dir => ({
|
||||
label: dir.path,
|
||||
value: dir.path,
|
||||
}))
|
||||
|
||||
opts.push({
|
||||
label: `Add directory${figures.ellipsis}`,
|
||||
value: 'add-directory',
|
||||
})
|
||||
|
||||
return opts
|
||||
}, [additionalDirectories])
|
||||
|
||||
// Main list view
|
||||
return (
|
||||
<Box flexDirection="column" marginBottom={1}>
|
||||
{/* Current working directory section */}
|
||||
<Box flexDirection="row" marginTop={1} marginLeft={2} gap={1}>
|
||||
<Text>{`- ${getOriginalCwd()}`}</Text>
|
||||
<Text dimColor>(Original working directory)</Text>
|
||||
</Box>
|
||||
<Select
|
||||
options={options}
|
||||
onChange={handleDirectorySelect}
|
||||
onCancel={handleCancel}
|
||||
visibleOptionCount={Math.min(10, options.length)}
|
||||
onUpFromFirstItem={focusHeader}
|
||||
isDisabled={headerFocused}
|
||||
/>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user