更新大量 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,189 +1,127 @@
import { c as _c } from "react/compiler-runtime";
import * as React from 'react';
import { memo, useEffect, useMemo, useRef, useState } from 'react';
import { useSettings } from '../hooks/useSettings.js';
import { Ansi, Box, type DOMElement, measureElement, NoSelect, Text, useTheme } from '../ink.js';
import { isFullscreenEnvEnabled } from '../utils/fullscreen.js';
import sliceAnsi from '../utils/sliceAnsi.js';
import { countCharInString } from '../utils/stringUtils.js';
import { HighlightedCodeFallback } from './HighlightedCode/Fallback.js';
import { expectColorFile } from './StructuredDiff/colorDiff.js';
import * as React from 'react'
import { memo, useEffect, useMemo, useRef, useState } from 'react'
import { useSettings } from '../hooks/useSettings.js'
import {
Ansi,
Box,
type DOMElement,
measureElement,
NoSelect,
Text,
useTheme,
} from '../ink.js'
import { isFullscreenEnvEnabled } from '../utils/fullscreen.js'
import sliceAnsi from '../utils/sliceAnsi.js'
import { countCharInString } from '../utils/stringUtils.js'
import { HighlightedCodeFallback } from './HighlightedCode/Fallback.js'
import { expectColorFile } from './StructuredDiff/colorDiff.js'
type Props = {
code: string;
filePath: string;
width?: number;
dim?: boolean;
};
const DEFAULT_WIDTH = 80;
export const HighlightedCode = memo(function HighlightedCode(t0: Props) {
const $ = _c(21);
const {
code,
filePath,
width,
dim: t1
} = t0;
const dim = t1 === undefined ? false : t1;
const ref = useRef(null);
const [measuredWidth, setMeasuredWidth] = useState(width || DEFAULT_WIDTH);
const [theme] = useTheme();
const settings = useSettings();
const syntaxHighlightingDisabled = settings.syntaxHighlightingDisabled ?? false;
let t2;
bb0: {
if (syntaxHighlightingDisabled) {
t2 = null;
break bb0;
}
let t3;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t3 = expectColorFile();
$[0] = t3;
} else {
t3 = $[0];
}
const ColorFile = t3;
if (!ColorFile) {
t2 = null;
break bb0;
}
let t4;
if ($[1] !== code || $[2] !== filePath) {
t4 = new ColorFile(code, filePath);
$[1] = code;
$[2] = filePath;
$[3] = t4;
} else {
t4 = $[3];
}
t2 = t4;
}
const colorFile = t2;
let t3;
let t4;
if ($[4] !== width) {
t3 = () => {
if (!width && ref.current) {
const {
width: elementWidth
} = measureElement(ref.current);
if (elementWidth > 0) {
setMeasuredWidth(elementWidth - 2);
}
}
};
t4 = [width];
$[4] = width;
$[5] = t3;
$[6] = t4;
} else {
t3 = $[5];
t4 = $[6];
}
useEffect(t3, t4);
let t5;
bb1: {
if (colorFile === null) {
t5 = null;
break bb1;
}
let t6;
if ($[7] !== colorFile || $[8] !== dim || $[9] !== measuredWidth || $[10] !== theme) {
t6 = colorFile.render(theme, measuredWidth, dim);
$[7] = colorFile;
$[8] = dim;
$[9] = measuredWidth;
$[10] = theme;
$[11] = t6;
} else {
t6 = $[11];
}
t5 = t6;
}
const lines = t5;
let t6;
bb2: {
if (!isFullscreenEnvEnabled()) {
t6 = 0;
break bb2;
}
const lineCount = countCharInString(code, "\n") + 1;
let t7;
if ($[12] !== lineCount) {
t7 = lineCount.toString();
$[12] = lineCount;
$[13] = t7;
} else {
t7 = $[13];
}
t6 = t7.length + 2;
}
const gutterWidth = t6;
let t7;
if ($[14] !== code || $[15] !== dim || $[16] !== filePath || $[17] !== gutterWidth || $[18] !== lines || $[19] !== syntaxHighlightingDisabled) {
t7 = <Box ref={ref}>{lines ? <Box flexDirection="column">{lines.map((line, i) => gutterWidth > 0 ? <CodeLine key={i} line={line} gutterWidth={gutterWidth} /> : <Text key={i}><Ansi>{line}</Ansi></Text>)}</Box> : <HighlightedCodeFallback code={code} filePath={filePath} dim={dim} skipColoring={syntaxHighlightingDisabled} />}</Box>;
$[14] = code;
$[15] = dim;
$[16] = filePath;
$[17] = gutterWidth;
$[18] = lines;
$[19] = syntaxHighlightingDisabled;
$[20] = t7;
} else {
t7 = $[20];
}
return t7;
});
function CodeLine(t0) {
const $ = _c(13);
const {
line,
gutterWidth
} = t0;
let t1;
if ($[0] !== gutterWidth || $[1] !== line) {
t1 = sliceAnsi(line, 0, gutterWidth);
$[0] = gutterWidth;
$[1] = line;
$[2] = t1;
} else {
t1 = $[2];
}
const gutter = t1;
let t2;
if ($[3] !== gutterWidth || $[4] !== line) {
t2 = sliceAnsi(line, gutterWidth);
$[3] = gutterWidth;
$[4] = line;
$[5] = t2;
} else {
t2 = $[5];
}
const content = t2;
let t3;
if ($[6] !== gutter) {
t3 = <NoSelect fromLeftEdge={true}><Text><Ansi>{gutter}</Ansi></Text></NoSelect>;
$[6] = gutter;
$[7] = t3;
} else {
t3 = $[7];
}
let t4;
if ($[8] !== content) {
t4 = <Text><Ansi>{content}</Ansi></Text>;
$[8] = content;
$[9] = t4;
} else {
t4 = $[9];
}
let t5;
if ($[10] !== t3 || $[11] !== t4) {
t5 = <Box flexDirection="row">{t3}{t4}</Box>;
$[10] = t3;
$[11] = t4;
$[12] = t5;
} else {
t5 = $[12];
}
return t5;
code: string
filePath: string
width?: number
dim?: boolean
}
const DEFAULT_WIDTH = 80
export const HighlightedCode = memo(function HighlightedCode({
code,
filePath,
width,
dim = false,
}: Props): React.ReactElement {
const ref = useRef<DOMElement>(null)
const [measuredWidth, setMeasuredWidth] = useState(width || DEFAULT_WIDTH)
const [theme] = useTheme()
const settings = useSettings()
const syntaxHighlightingDisabled =
settings.syntaxHighlightingDisabled ?? false
const colorFile = useMemo(() => {
if (syntaxHighlightingDisabled) {
return null
}
const ColorFile = expectColorFile()
if (!ColorFile) {
return null
}
return new ColorFile(code, filePath)
}, [code, filePath, syntaxHighlightingDisabled])
useEffect(() => {
if (!width && ref.current) {
const { width: elementWidth } = measureElement(ref.current)
if (elementWidth > 0) {
setMeasuredWidth(elementWidth - 2)
}
}
}, [width])
const lines = useMemo(() => {
if (colorFile === null) {
return null
}
return colorFile.render(theme, measuredWidth, dim)
}, [colorFile, theme, measuredWidth, dim])
// Gutter width matches ColorFile's layout in lib.rs: space + right-aligned
// line number (max_digits = lineCount.toString().length) + space. No marker
// column like the diff path. Wrap in <NoSelect> so fullscreen selection
// yields clean code without line numbers. Only split in fullscreen mode
// (~4× DOM nodes + sliceAnsi cost); non-fullscreen uses terminal-native
// selection where noSelect is meaningless.
const gutterWidth = useMemo(() => {
if (!isFullscreenEnvEnabled()) return 0
const lineCount = countCharInString(code, '\n') + 1
return lineCount.toString().length + 2
}, [code])
return (
<Box ref={ref}>
{lines ? (
<Box flexDirection="column">
{lines.map((line, i) =>
gutterWidth > 0 ? (
<CodeLine key={i} line={line} gutterWidth={gutterWidth} />
) : (
<Text key={i}>
<Ansi>{line}</Ansi>
</Text>
),
)}
</Box>
) : (
<HighlightedCodeFallback
code={code}
filePath={filePath}
dim={dim}
skipColoring={syntaxHighlightingDisabled}
/>
)}
</Box>
)
})
function CodeLine({
line,
gutterWidth,
}: {
line: string
gutterWidth: number
}): React.ReactNode {
const gutter = sliceAnsi(line, 0, gutterWidth)
const content = sliceAnsi(line, gutterWidth)
return (
<Box flexDirection="row">
<NoSelect fromLeftEdge>
<Text>
<Ansi>{gutter}</Ansi>
</Text>
</NoSelect>
<Text>
<Ansi>{content}</Ansi>
</Text>
</Box>
)
}