mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +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,169 +1,102 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import { basename, relative } from 'path';
|
||||
import React from 'react';
|
||||
import { Box, Text } from '../ink.js';
|
||||
import { getCwd } from '../utils/cwd.js';
|
||||
import { isSupportedVSCodeTerminal } from '../utils/ide.js';
|
||||
import { Select } from './CustomSelect/index.js';
|
||||
import { Pane } from './design-system/Pane.js';
|
||||
import type { PermissionOption, PermissionOptionWithLabel } from './permissions/FilePermissionDialog/permissionOptions.js';
|
||||
import { basename, relative } from 'path'
|
||||
import React from 'react'
|
||||
import { Box, Text } from '../ink.js'
|
||||
import { getCwd } from '../utils/cwd.js'
|
||||
import { isSupportedVSCodeTerminal } from '../utils/ide.js'
|
||||
import { Select } from './CustomSelect/index.js'
|
||||
import { Pane } from './design-system/Pane.js'
|
||||
import type {
|
||||
PermissionOption,
|
||||
PermissionOptionWithLabel,
|
||||
} from './permissions/FilePermissionDialog/permissionOptions.js'
|
||||
|
||||
type Props<A> = {
|
||||
filePath: string;
|
||||
input: A;
|
||||
onChange: (option: PermissionOption, args: A, feedback?: string) => void;
|
||||
options: PermissionOptionWithLabel[];
|
||||
ideName: string;
|
||||
symlinkTarget?: string | null;
|
||||
rejectFeedback: string;
|
||||
acceptFeedback: string;
|
||||
setFocusedOption: (value: string) => void;
|
||||
onInputModeToggle: (value: string) => void;
|
||||
focusedOption: string;
|
||||
yesInputMode: boolean;
|
||||
noInputMode: boolean;
|
||||
};
|
||||
export function ShowInIDEPrompt(t0) {
|
||||
const $ = _c(36);
|
||||
const {
|
||||
onChange,
|
||||
options,
|
||||
input,
|
||||
filePath,
|
||||
ideName,
|
||||
symlinkTarget,
|
||||
rejectFeedback,
|
||||
acceptFeedback,
|
||||
setFocusedOption,
|
||||
onInputModeToggle,
|
||||
focusedOption,
|
||||
yesInputMode,
|
||||
noInputMode
|
||||
} = t0;
|
||||
let t1;
|
||||
if ($[0] !== ideName) {
|
||||
t1 = <Text bold={true} color="permission">Opened changes in {ideName} ⧉</Text>;
|
||||
$[0] = ideName;
|
||||
$[1] = t1;
|
||||
} else {
|
||||
t1 = $[1];
|
||||
}
|
||||
let t2;
|
||||
if ($[2] !== symlinkTarget) {
|
||||
t2 = symlinkTarget && <Text color="warning">{relative(getCwd(), symlinkTarget).startsWith("..") ? `This will modify ${symlinkTarget} (outside working directory) via a symlink` : `Symlink target: ${symlinkTarget}`}</Text>;
|
||||
$[2] = symlinkTarget;
|
||||
$[3] = t2;
|
||||
} else {
|
||||
t2 = $[3];
|
||||
}
|
||||
let t3;
|
||||
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t3 = isSupportedVSCodeTerminal() && <Text dimColor={true}>Save file to continue…</Text>;
|
||||
$[4] = t3;
|
||||
} else {
|
||||
t3 = $[4];
|
||||
}
|
||||
let t4;
|
||||
if ($[5] !== filePath) {
|
||||
t4 = basename(filePath);
|
||||
$[5] = filePath;
|
||||
$[6] = t4;
|
||||
} else {
|
||||
t4 = $[6];
|
||||
}
|
||||
let t5;
|
||||
if ($[7] !== t4) {
|
||||
t5 = <Text>Do you want to make this edit to{" "}<Text bold={true}>{t4}</Text>?</Text>;
|
||||
$[7] = t4;
|
||||
$[8] = t5;
|
||||
} else {
|
||||
t5 = $[8];
|
||||
}
|
||||
let t6;
|
||||
if ($[9] !== acceptFeedback || $[10] !== input || $[11] !== onChange || $[12] !== options || $[13] !== rejectFeedback) {
|
||||
t6 = value => {
|
||||
const selected = options.find(opt => opt.value === value);
|
||||
if (selected) {
|
||||
if (selected.option.type === "reject") {
|
||||
const trimmedFeedback = rejectFeedback.trim();
|
||||
onChange(selected.option, input, trimmedFeedback || undefined);
|
||||
return;
|
||||
}
|
||||
if (selected.option.type === "accept-once") {
|
||||
const trimmedFeedback_0 = acceptFeedback.trim();
|
||||
onChange(selected.option, input, trimmedFeedback_0 || undefined);
|
||||
return;
|
||||
}
|
||||
onChange(selected.option, input);
|
||||
}
|
||||
};
|
||||
$[9] = acceptFeedback;
|
||||
$[10] = input;
|
||||
$[11] = onChange;
|
||||
$[12] = options;
|
||||
$[13] = rejectFeedback;
|
||||
$[14] = t6;
|
||||
} else {
|
||||
t6 = $[14];
|
||||
}
|
||||
let t7;
|
||||
if ($[15] !== input || $[16] !== onChange) {
|
||||
t7 = () => onChange({
|
||||
type: "reject"
|
||||
}, input);
|
||||
$[15] = input;
|
||||
$[16] = onChange;
|
||||
$[17] = t7;
|
||||
} else {
|
||||
t7 = $[17];
|
||||
}
|
||||
let t8;
|
||||
if ($[18] !== setFocusedOption) {
|
||||
t8 = value_0 => setFocusedOption(value_0);
|
||||
$[18] = setFocusedOption;
|
||||
$[19] = t8;
|
||||
} else {
|
||||
t8 = $[19];
|
||||
}
|
||||
let t9;
|
||||
if ($[20] !== onInputModeToggle || $[21] !== options || $[22] !== t6 || $[23] !== t7 || $[24] !== t8) {
|
||||
t9 = <Select options={options} inlineDescriptions={true} onChange={t6} onCancel={t7} onFocus={t8} onInputModeToggle={onInputModeToggle} />;
|
||||
$[20] = onInputModeToggle;
|
||||
$[21] = options;
|
||||
$[22] = t6;
|
||||
$[23] = t7;
|
||||
$[24] = t8;
|
||||
$[25] = t9;
|
||||
} else {
|
||||
t9 = $[25];
|
||||
}
|
||||
let t10;
|
||||
if ($[26] !== t5 || $[27] !== t9) {
|
||||
t10 = <Box flexDirection="column">{t5}{t9}</Box>;
|
||||
$[26] = t5;
|
||||
$[27] = t9;
|
||||
$[28] = t10;
|
||||
} else {
|
||||
t10 = $[28];
|
||||
}
|
||||
const t11 = (focusedOption === "yes" && !yesInputMode || focusedOption === "no" && !noInputMode) && " \xB7 Tab to amend";
|
||||
let t12;
|
||||
if ($[29] !== t11) {
|
||||
t12 = <Box marginTop={1}><Text dimColor={true}>Esc to cancel{t11}</Text></Box>;
|
||||
$[29] = t11;
|
||||
$[30] = t12;
|
||||
} else {
|
||||
t12 = $[30];
|
||||
}
|
||||
let t13;
|
||||
if ($[31] !== t1 || $[32] !== t10 || $[33] !== t12 || $[34] !== t2) {
|
||||
t13 = <Pane color="permission"><Box flexDirection="column" gap={1}>{t1}{t2}{t3}{t10}{t12}</Box></Pane>;
|
||||
$[31] = t1;
|
||||
$[32] = t10;
|
||||
$[33] = t12;
|
||||
$[34] = t2;
|
||||
$[35] = t13;
|
||||
} else {
|
||||
t13 = $[35];
|
||||
}
|
||||
return t13;
|
||||
filePath: string
|
||||
input: A
|
||||
onChange: (option: PermissionOption, args: A, feedback?: string) => void
|
||||
options: PermissionOptionWithLabel[]
|
||||
ideName: string
|
||||
symlinkTarget?: string | null
|
||||
rejectFeedback: string
|
||||
acceptFeedback: string
|
||||
setFocusedOption: (value: string) => void
|
||||
onInputModeToggle: (value: string) => void
|
||||
focusedOption: string
|
||||
yesInputMode: boolean
|
||||
noInputMode: boolean
|
||||
}
|
||||
|
||||
export function ShowInIDEPrompt<A>({
|
||||
onChange,
|
||||
options,
|
||||
input,
|
||||
filePath,
|
||||
ideName,
|
||||
symlinkTarget,
|
||||
rejectFeedback,
|
||||
acceptFeedback,
|
||||
setFocusedOption,
|
||||
onInputModeToggle,
|
||||
focusedOption,
|
||||
yesInputMode,
|
||||
noInputMode,
|
||||
}: Props<A>): React.ReactNode {
|
||||
return (
|
||||
<Pane color="permission">
|
||||
<Box flexDirection="column" gap={1}>
|
||||
<Text bold color="permission">
|
||||
Opened changes in {ideName} ⧉
|
||||
</Text>
|
||||
{symlinkTarget && (
|
||||
<Text color="warning">
|
||||
{relative(getCwd(), symlinkTarget).startsWith('..')
|
||||
? `This will modify ${symlinkTarget} (outside working directory) via a symlink`
|
||||
: `Symlink target: ${symlinkTarget}`}
|
||||
</Text>
|
||||
)}
|
||||
{isSupportedVSCodeTerminal() && (
|
||||
<Text dimColor>Save file to continue…</Text>
|
||||
)}
|
||||
<Box flexDirection="column">
|
||||
<Text>
|
||||
Do you want to make this edit to{' '}
|
||||
<Text bold>{basename(filePath)}</Text>?
|
||||
</Text>
|
||||
<Select
|
||||
options={options}
|
||||
inlineDescriptions
|
||||
onChange={value => {
|
||||
const selected = options.find(opt => opt.value === value)
|
||||
if (selected) {
|
||||
// For reject option
|
||||
if (selected.option.type === 'reject') {
|
||||
const trimmedFeedback = rejectFeedback.trim()
|
||||
onChange(selected.option, input, trimmedFeedback || undefined)
|
||||
return
|
||||
}
|
||||
// For accept-once option, pass accept feedback if present
|
||||
if (selected.option.type === 'accept-once') {
|
||||
const trimmedFeedback = acceptFeedback.trim()
|
||||
onChange(selected.option, input, trimmedFeedback || undefined)
|
||||
return
|
||||
}
|
||||
onChange(selected.option, input)
|
||||
}
|
||||
}}
|
||||
onCancel={() => onChange({ type: 'reject' }, input)}
|
||||
onFocus={value => setFocusedOption(value)}
|
||||
onInputModeToggle={onInputModeToggle}
|
||||
/>
|
||||
</Box>
|
||||
<Box marginTop={1}>
|
||||
<Text dimColor>
|
||||
Esc to cancel
|
||||
{((focusedOption === 'yes' && !yesInputMode) ||
|
||||
(focusedOption === 'no' && !noInputMode)) &&
|
||||
' · Tab to amend'}
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
</Pane>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user