更新大量 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,135 +1,162 @@
import { c as _c } from "react/compiler-runtime";
import React from 'react';
import { renderPlaceholder } from '../hooks/renderPlaceholder.js';
import { usePasteHandler } from '../hooks/usePasteHandler.js';
import { useDeclaredCursor } from '../ink/hooks/use-declared-cursor.js';
import { Ansi, Box, Text, useInput } from '../ink.js';
import type { BaseInputState, BaseTextInputProps } from '../types/textInputTypes.js';
import type { TextHighlight } from '../utils/textHighlighting.js';
import { HighlightedInput } from './PromptInput/ShimmeredInput.js';
import React from 'react'
import { renderPlaceholder } from '../hooks/renderPlaceholder.js'
import { usePasteHandler } from '../hooks/usePasteHandler.js'
import { useDeclaredCursor } from '../ink/hooks/use-declared-cursor.js'
import { Ansi, Box, Text, useInput } from '../ink.js'
import type {
BaseInputState,
BaseTextInputProps,
} from '../types/textInputTypes.js'
import type { TextHighlight } from '../utils/textHighlighting.js'
import { HighlightedInput } from './PromptInput/ShimmeredInput.js'
type BaseTextInputComponentProps = BaseTextInputProps & {
inputState: BaseInputState;
children?: React.ReactNode;
terminalFocus: boolean;
highlights?: TextHighlight[];
invert?: (text: string) => string;
hidePlaceholderText?: boolean;
};
inputState: BaseInputState
children?: React.ReactNode
terminalFocus: boolean
highlights?: TextHighlight[]
invert?: (text: string) => string
hidePlaceholderText?: boolean
}
/**
* A base component for text inputs that handles rendering and basic input
*/
export function BaseTextInput(t0) {
const $ = _c(14);
const {
inputState,
children,
terminalFocus,
invert,
hidePlaceholderText,
...props
} = t0;
const {
onInput,
renderedValue,
cursorLine,
cursorColumn
} = inputState;
const t1 = Boolean(props.focus && props.showCursor && terminalFocus);
let t2;
if ($[0] !== cursorColumn || $[1] !== cursorLine || $[2] !== t1) {
t2 = {
line: cursorLine,
column: cursorColumn,
active: t1
};
$[0] = cursorColumn;
$[1] = cursorLine;
$[2] = t1;
$[3] = t2;
} else {
t2 = $[3];
}
const cursorRef = useDeclaredCursor(t2);
const {
wrappedOnInput,
isPasting: t3
} = usePasteHandler({
export function BaseTextInput({
inputState,
children,
terminalFocus,
invert,
hidePlaceholderText,
...props
}: BaseTextInputComponentProps): React.ReactNode {
const { onInput, renderedValue, cursorLine, cursorColumn } = inputState
// Park the native terminal cursor at the input caret. Terminal emulators
// position IME preedit text at the physical cursor, and screen readers /
// screen magnifiers track it — so parking here makes CJK input appear
// inline and lets accessibility tools follow the input. The Box ref below
// is the yoga layout origin; (cursorLine, cursorColumn) is relative to it.
// Only active when the input is focused, showing its cursor, and the
// terminal itself has focus.
const cursorRef = useDeclaredCursor({
line: cursorLine,
column: cursorColumn,
active: Boolean(props.focus && props.showCursor && terminalFocus),
})
const { wrappedOnInput, isPasting } = usePasteHandler({
onPaste: props.onPaste,
onInput: (input, key) => {
// Prevent Enter key from triggering submission during paste
if (isPasting && key.return) {
return;
return
}
onInput(input, key);
onInput(input, key)
},
onImagePaste: props.onImagePaste
});
const isPasting = t3;
const {
onIsPastingChange
} = props;
onImagePaste: props.onImagePaste,
})
// Notify parent when paste state changes
const { onIsPastingChange } = props
React.useEffect(() => {
if (onIsPastingChange) {
onIsPastingChange(isPasting);
onIsPastingChange(isPasting)
}
}, [isPasting, onIsPastingChange]);
const {
showPlaceholder,
renderedPlaceholder
} = renderPlaceholder({
}, [isPasting, onIsPastingChange])
const { showPlaceholder, renderedPlaceholder } = renderPlaceholder({
placeholder: props.placeholder,
value: props.value,
showCursor: props.showCursor,
focus: props.focus,
terminalFocus,
invert,
hidePlaceholderText
});
useInput(wrappedOnInput, {
isActive: props.focus
});
const commandWithoutArgs = props.value && props.value.trim().indexOf(" ") === -1 || props.value && props.value.endsWith(" ");
const showArgumentHint = Boolean(props.argumentHint && props.value && commandWithoutArgs && props.value.startsWith("/"));
const cursorFiltered = props.showCursor && props.highlights ? props.highlights.filter(h => h.dimColor || props.cursorOffset < h.start || props.cursorOffset >= h.end) : props.highlights;
const {
viewportCharOffset,
viewportCharEnd
} = inputState;
const filteredHighlights = cursorFiltered && viewportCharOffset > 0 ? cursorFiltered.filter(h_0 => h_0.end > viewportCharOffset && h_0.start < viewportCharEnd).map(h_1 => ({
...h_1,
start: Math.max(0, h_1.start - viewportCharOffset),
end: h_1.end - viewportCharOffset
})) : cursorFiltered;
const hasHighlights = filteredHighlights && filteredHighlights.length > 0;
hidePlaceholderText,
})
useInput(wrappedOnInput, { isActive: props.focus })
// Show argument hint only when we have a value and the hint is provided
// Only show the argument hint when:
// 1. We have a hint to show
// 2. We have a command typed (value is not empty)
// 3. The command doesn't have arguments yet (no text after the space)
// 4. We're actually typing a command (the value starts with /)
const commandWithoutArgs =
(props.value && props.value.trim().indexOf(' ') === -1) ||
(props.value && props.value.endsWith(' '))
const showArgumentHint = Boolean(
props.argumentHint &&
props.value &&
commandWithoutArgs &&
props.value.startsWith('/'),
)
// Filter out highlights that contain the cursor position
const cursorFiltered =
props.showCursor && props.highlights
? props.highlights.filter(
h =>
h.dimColor ||
props.cursorOffset < h.start ||
props.cursorOffset >= h.end,
)
: props.highlights
// Adjust highlights for viewport windowing: highlight positions reference the
// full input text, but renderedValue only contains the windowed subset.
const { viewportCharOffset, viewportCharEnd } = inputState
const filteredHighlights =
cursorFiltered && viewportCharOffset > 0
? cursorFiltered
.filter(h => h.end > viewportCharOffset && h.start < viewportCharEnd)
.map(h => ({
...h,
start: Math.max(0, h.start - viewportCharOffset),
end: h.end - viewportCharOffset,
}))
: cursorFiltered
const hasHighlights = filteredHighlights && filteredHighlights.length > 0
if (hasHighlights) {
return <Box ref={cursorRef}><HighlightedInput text={renderedValue} highlights={filteredHighlights} />{showArgumentHint && <Text dimColor={true}>{props.value?.endsWith(" ") ? "" : " "}{props.argumentHint}</Text>}{children}</Box>;
return (
<Box ref={cursorRef}>
<HighlightedInput
text={renderedValue}
highlights={filteredHighlights}
/>
{showArgumentHint && (
<Text dimColor>
{props.value?.endsWith(' ') ? '' : ' '}
{props.argumentHint}
</Text>
)}
{children}
</Box>
)
}
const T0 = Box;
const T1 = Text;
const t4 = "truncate-end";
const t5 = showPlaceholder && props.placeholderElement ? props.placeholderElement : showPlaceholder && renderedPlaceholder ? <Ansi>{renderedPlaceholder}</Ansi> : <Ansi>{renderedValue}</Ansi>;
const t6 = showArgumentHint && <Text dimColor={true}>{props.value?.endsWith(" ") ? "" : " "}{props.argumentHint}</Text>;
let t7;
if ($[4] !== T1 || $[5] !== children || $[6] !== props || $[7] !== t5 || $[8] !== t6) {
t7 = <T1 wrap={t4} dimColor={props.dimColor}>{t5}{t6}{children}</T1>;
$[4] = T1;
$[5] = children;
$[6] = props;
$[7] = t5;
$[8] = t6;
$[9] = t7;
} else {
t7 = $[9];
}
let t8;
if ($[10] !== T0 || $[11] !== cursorRef || $[12] !== t7) {
t8 = <T0 ref={cursorRef}>{t7}</T0>;
$[10] = T0;
$[11] = cursorRef;
$[12] = t7;
$[13] = t8;
} else {
t8 = $[13];
}
return t8;
return (
<Box ref={cursorRef}>
<Text wrap="truncate-end" dimColor={props.dimColor}>
{showPlaceholder && props.placeholderElement ? (
props.placeholderElement
) : showPlaceholder && renderedPlaceholder ? (
<Ansi>{renderedPlaceholder}</Ansi>
) : (
<Ansi>{renderedValue}</Ansi>
)}
{showArgumentHint && (
<Text dimColor>
{props.value?.endsWith(' ') ? '' : ' '}
{props.argumentHint}
</Text>
)}
{children}
</Text>
</Box>
)
}