更新大量 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,234 +1,172 @@
import { c as _c } from "react/compiler-runtime";
import { relative } from 'path';
import * as React from 'react';
import { Suspense, use, useMemo } from 'react';
import { Box, NoSelect, Text } from '../../../ink.js';
import type { NotebookCellType, NotebookContent } from '../../../types/notebook.js';
import { intersperse } from '../../../utils/array.js';
import { getCwd } from '../../../utils/cwd.js';
import { getPatchForDisplay } from '../../../utils/diff.js';
import { getFsImplementation } from '../../../utils/fsOperations.js';
import { safeParseJSON } from '../../../utils/json.js';
import { parseCellId } from '../../../utils/notebook.js';
import { HighlightedCode } from '../../HighlightedCode.js';
import { StructuredDiff } from '../../StructuredDiff.js';
import { relative } from 'path'
import * as React from 'react'
import { Suspense, use, useMemo } from 'react'
import { Box, NoSelect, Text } from '../../../ink.js'
import type {
NotebookCellType,
NotebookContent,
} from '../../../types/notebook.js'
import { intersperse } from '../../../utils/array.js'
import { getCwd } from '../../../utils/cwd.js'
import { getPatchForDisplay } from '../../../utils/diff.js'
import { getFsImplementation } from '../../../utils/fsOperations.js'
import { safeParseJSON } from '../../../utils/json.js'
import { parseCellId } from '../../../utils/notebook.js'
import { HighlightedCode } from '../../HighlightedCode.js'
import { StructuredDiff } from '../../StructuredDiff.js'
type Props = {
notebook_path: string;
cell_id: string | undefined;
new_source: string;
cell_type?: NotebookCellType;
edit_mode?: string;
verbose: boolean;
width: number;
};
notebook_path: string
cell_id: string | undefined
new_source: string
cell_type?: NotebookCellType
edit_mode?: string
verbose: boolean
width: number
}
type InnerProps = {
notebook_path: string;
cell_id: string | undefined;
new_source: string;
cell_type?: NotebookCellType;
edit_mode?: string;
verbose: boolean;
width: number;
promise: Promise<NotebookContent | null>;
};
export function NotebookEditToolDiff(props: Props) {
const $ = _c(5);
let t0;
if ($[0] !== props.notebook_path) {
t0 = getFsImplementation().readFile(props.notebook_path, {
encoding: "utf-8"
}).then(_temp).catch(_temp2);
$[0] = props.notebook_path;
$[1] = t0;
} else {
t0 = $[1];
}
const notebookDataPromise = t0;
let t1;
if ($[2] !== notebookDataPromise || $[3] !== props) {
t1 = <Suspense fallback={null}><NotebookEditToolDiffInner {...props} promise={notebookDataPromise} /></Suspense>;
$[2] = notebookDataPromise;
$[3] = props;
$[4] = t1;
} else {
t1 = $[4];
}
return t1;
notebook_path: string
cell_id: string | undefined
new_source: string
cell_type?: NotebookCellType
edit_mode?: string
verbose: boolean
width: number
promise: Promise<NotebookContent | null>
}
function _temp2() {
return null;
export function NotebookEditToolDiff(props: Props): React.ReactNode {
// Create a promise that never rejects so we can handle errors inline.
// Memoized on notebook_path so we don't re-read on every render.
const notebookDataPromise = useMemo(
() =>
getFsImplementation()
.readFile(props.notebook_path, { encoding: 'utf-8' })
.then(content => safeParseJSON(content) as NotebookContent | null)
.catch(() => null),
[props.notebook_path],
)
return (
<Suspense fallback={null}>
<NotebookEditToolDiffInner {...props} promise={notebookDataPromise} />
</Suspense>
)
}
function _temp(content) {
return safeParseJSON(content) as NotebookContent | null;
}
function NotebookEditToolDiffInner(t0: InnerProps) {
const $ = _c(34);
const {
notebook_path,
cell_id,
new_source,
cell_type,
edit_mode: t1,
verbose,
width,
promise
} = t0;
const edit_mode = t1 === undefined ? "replace" : t1;
const notebookData = use(promise);
let t2;
if ($[0] !== cell_id || $[1] !== notebookData) {
bb0: {
if (!notebookData || !cell_id) {
t2 = "";
break bb0;
}
const cellIndex = parseCellId(cell_id);
if (cellIndex !== undefined) {
if (notebookData.cells[cellIndex]) {
const source = notebookData.cells[cellIndex].source;
let t3;
if ($[3] !== source) {
t3 = Array.isArray(source) ? source.join("") : source;
$[3] = source;
$[4] = t3;
} else {
t3 = $[4];
}
t2 = t3;
break bb0;
}
t2 = "";
break bb0;
}
let t3;
if ($[5] !== cell_id) {
t3 = cell => cell.id === cell_id;
$[5] = cell_id;
$[6] = t3;
} else {
t3 = $[6];
}
const cell_0 = notebookData.cells.find(t3);
if (!cell_0) {
t2 = "";
break bb0;
}
t2 = Array.isArray(cell_0.source) ? cell_0.source.join("") : cell_0.source;
function NotebookEditToolDiffInner({
notebook_path,
cell_id,
new_source,
cell_type,
edit_mode = 'replace',
verbose,
width,
promise,
}: InnerProps): React.ReactNode {
const notebookData = use(promise)
const oldSource = useMemo(() => {
if (!notebookData || !cell_id) {
return ''
}
$[0] = cell_id;
$[1] = notebookData;
$[2] = t2;
} else {
t2 = $[2];
}
const oldSource = t2;
let t3;
bb1: {
if (!notebookData || edit_mode === "insert" || edit_mode === "delete") {
t3 = null;
break bb1;
const cellIndex = parseCellId(cell_id)
if (cellIndex !== undefined) {
if (notebookData.cells[cellIndex]) {
const source = notebookData.cells[cellIndex].source
return Array.isArray(source) ? source.join('') : source
}
return ''
}
let t4;
if ($[7] !== new_source || $[8] !== notebook_path || $[9] !== oldSource) {
t4 = getPatchForDisplay({
filePath: notebook_path,
fileContents: oldSource,
edits: [{
const cell = notebookData.cells.find(cell => cell.id === cell_id)
if (!cell) {
return ''
}
return Array.isArray(cell.source) ? cell.source.join('') : cell.source
}, [notebookData, cell_id])
const hunks = useMemo(() => {
if (!notebookData || edit_mode === 'insert' || edit_mode === 'delete') {
return null
}
// Create a "fake" file content with just the cell source
// This allows us to use the regular diff mechanism
return getPatchForDisplay({
filePath: notebook_path,
fileContents: oldSource,
edits: [
{
old_string: oldSource,
new_string: new_source,
replace_all: false
}],
ignoreWhitespace: false
});
$[7] = new_source;
$[8] = notebook_path;
$[9] = oldSource;
$[10] = t4;
} else {
t4 = $[10];
}
t3 = t4;
}
const hunks = t3;
let editTypeDescription;
bb2: switch (edit_mode) {
case "insert":
{
editTypeDescription = "Insert new cell";
break bb2;
}
case "delete":
{
editTypeDescription = "Delete cell";
break bb2;
}
replace_all: false,
},
],
ignoreWhitespace: false,
})
}, [notebookData, notebook_path, oldSource, new_source, edit_mode])
let editTypeDescription: string
switch (edit_mode) {
case 'insert':
editTypeDescription = 'Insert new cell'
break
case 'delete':
editTypeDescription = 'Delete cell'
break
default:
{
editTypeDescription = "Replace cell contents";
}
editTypeDescription = 'Replace cell contents'
}
let t4;
if ($[11] !== notebook_path || $[12] !== verbose) {
t4 = verbose ? notebook_path : relative(getCwd(), notebook_path);
$[11] = notebook_path;
$[12] = verbose;
$[13] = t4;
} else {
t4 = $[13];
}
let t5;
if ($[14] !== t4) {
t5 = <Text bold={true}>{t4}</Text>;
$[14] = t4;
$[15] = t5;
} else {
t5 = $[15];
}
const t6 = cell_type ? ` (${cell_type})` : "";
let t7;
if ($[16] !== cell_id || $[17] !== editTypeDescription || $[18] !== t6) {
t7 = <Text dimColor={true}>{editTypeDescription} for cell {cell_id}{t6}</Text>;
$[16] = cell_id;
$[17] = editTypeDescription;
$[18] = t6;
$[19] = t7;
} else {
t7 = $[19];
}
let t8;
if ($[20] !== t5 || $[21] !== t7) {
t8 = <Box paddingBottom={1} flexDirection="column">{t5}{t7}</Box>;
$[20] = t5;
$[21] = t7;
$[22] = t8;
} else {
t8 = $[22];
}
let t9;
if ($[23] !== cell_type || $[24] !== edit_mode || $[25] !== hunks || $[26] !== new_source || $[27] !== notebook_path || $[28] !== oldSource || $[29] !== width) {
t9 = edit_mode === "delete" ? <Box flexDirection="column" paddingLeft={2}><HighlightedCode code={oldSource} filePath={notebook_path} /></Box> : edit_mode === "insert" ? <Box flexDirection="column" paddingLeft={2}><HighlightedCode code={new_source} filePath={cell_type === "markdown" ? "file.md" : notebook_path} /></Box> : hunks ? intersperse(hunks.map(_ => <StructuredDiff key={_.newStart} patch={_} dim={false} width={width} filePath={notebook_path} firstLine={new_source.split("\n")[0] ?? null} fileContent={oldSource} />), _temp3) : <HighlightedCode code={new_source} filePath={cell_type === "markdown" ? "file.md" : notebook_path} />;
$[23] = cell_type;
$[24] = edit_mode;
$[25] = hunks;
$[26] = new_source;
$[27] = notebook_path;
$[28] = oldSource;
$[29] = width;
$[30] = t9;
} else {
t9 = $[30];
}
let t10;
if ($[31] !== t8 || $[32] !== t9) {
t10 = <Box flexDirection="column"><Box borderStyle="round" flexDirection="column" paddingX={1}>{t8}{t9}</Box></Box>;
$[31] = t8;
$[32] = t9;
$[33] = t10;
} else {
t10 = $[33];
}
return t10;
}
function _temp3(i) {
return <NoSelect fromLeftEdge={true} key={`ellipsis-${i}`}><Text dimColor={true}>...</Text></NoSelect>;
return (
<Box flexDirection="column">
<Box borderStyle="round" flexDirection="column" paddingX={1}>
<Box paddingBottom={1} flexDirection="column">
<Text bold>
{verbose ? notebook_path : relative(getCwd(), notebook_path)}
</Text>
<Text dimColor>
{editTypeDescription} for cell {cell_id}
{cell_type ? ` (${cell_type})` : ''}
</Text>
</Box>
{edit_mode === 'delete' ? (
<Box flexDirection="column" paddingLeft={2}>
<HighlightedCode code={oldSource} filePath={notebook_path} />
</Box>
) : edit_mode === 'insert' ? (
<Box flexDirection="column" paddingLeft={2}>
<HighlightedCode
code={new_source}
filePath={cell_type === 'markdown' ? 'file.md' : notebook_path}
/>
</Box>
) : hunks ? (
intersperse(
hunks.map(_ => (
<StructuredDiff
key={_.newStart}
patch={_}
dim={false}
width={width}
filePath={notebook_path}
firstLine={new_source.split('\n')[0] ?? null}
fileContent={oldSource}
/>
)),
i => (
<NoSelect fromLeftEdge key={`ellipsis-${i}`}>
<Text dimColor>...</Text>
</NoSelect>
),
)
) : (
<HighlightedCode
code={new_source}
filePath={cell_type === 'markdown' ? 'file.md' : notebook_path}
/>
)}
</Box>
</Box>
)
}