更新大量 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,240 +1,192 @@
import { c as _c } from "react/compiler-runtime";
import figures from 'figures';
import * as React from 'react';
import { Suspense, use } from 'react';
import { getSessionId } from '../../bootstrap/state.js';
import type { LocalJSXCommandContext } from '../../commands.js';
import { useIsInsideModal } from '../../context/modalContext.js';
import { Box, Text, useTheme } from '../../ink.js';
import { type AppState, useAppState } from '../../state/AppState.js';
import { getCwd } from '../../utils/cwd.js';
import { getCurrentSessionTitle } from '../../utils/sessionStorage.js';
import { buildAccountProperties, buildAPIProviderProperties, buildIDEProperties, buildInstallationDiagnostics, buildInstallationHealthDiagnostics, buildMcpProperties, buildMemoryDiagnostics, buildSandboxProperties, buildSettingSourcesProperties, type Diagnostic, getModelDisplayLabel, type Property } from '../../utils/status.js';
import type { ThemeName } from '../../utils/theme.js';
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js';
import figures from 'figures'
import * as React from 'react'
import { Suspense, use } from 'react'
import { getSessionId } from '../../bootstrap/state.js'
import type { LocalJSXCommandContext } from '../../commands.js'
import { useIsInsideModal } from '../../context/modalContext.js'
import { Box, Text, useTheme } from '../../ink.js'
import { type AppState, useAppState } from '../../state/AppState.js'
import { getCwd } from '../../utils/cwd.js'
import { getCurrentSessionTitle } from '../../utils/sessionStorage.js'
import {
buildAccountProperties,
buildAPIProviderProperties,
buildIDEProperties,
buildInstallationDiagnostics,
buildInstallationHealthDiagnostics,
buildMcpProperties,
buildMemoryDiagnostics,
buildSandboxProperties,
buildSettingSourcesProperties,
type Diagnostic,
getModelDisplayLabel,
type Property,
} from '../../utils/status.js'
import type { ThemeName } from '../../utils/theme.js'
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js'
type Props = {
context: LocalJSXCommandContext;
diagnosticsPromise: Promise<Diagnostic[]>;
};
function buildPrimarySection(): Property[] {
const sessionId = getSessionId();
const customTitle = getCurrentSessionTitle(sessionId);
const nameValue = customTitle ?? <Text dimColor>/rename to add a name</Text>;
return [{
label: 'Version',
value: MACRO.VERSION
}, {
label: 'Session name',
value: nameValue
}, {
label: 'Session ID',
value: sessionId
}, {
label: 'cwd',
value: getCwd()
}, ...buildAccountProperties(), ...buildAPIProviderProperties()];
context: LocalJSXCommandContext
diagnosticsPromise: Promise<Diagnostic[]>
}
function buildPrimarySection(): Property[] {
const sessionId = getSessionId()
const customTitle = getCurrentSessionTitle(sessionId)
const nameValue = customTitle ?? <Text dimColor>/rename to add a name</Text>
return [
{ label: 'Version', value: MACRO.VERSION },
{ label: 'Session name', value: nameValue },
{ label: 'Session ID', value: sessionId },
{ label: 'cwd', value: getCwd() },
...buildAccountProperties(),
...buildAPIProviderProperties(),
]
}
function buildSecondarySection({
mainLoopModel,
mcp,
theme,
context
context,
}: {
mainLoopModel: AppState['mainLoopModel'];
mcp: AppState['mcp'];
theme: ThemeName;
context: LocalJSXCommandContext;
mainLoopModel: AppState['mainLoopModel']
mcp: AppState['mcp']
theme: ThemeName
context: LocalJSXCommandContext
}): Property[] {
const modelLabel = getModelDisplayLabel(mainLoopModel);
return [{
label: 'Model',
value: modelLabel
}, ...buildIDEProperties(mcp.clients, context.options.ideInstallationStatus, theme), ...buildMcpProperties(mcp.clients, theme), ...buildSandboxProperties(), ...buildSettingSourcesProperties()];
}
export async function buildDiagnostics(): Promise<Diagnostic[]> {
return [...(await buildInstallationDiagnostics()), ...(await buildInstallationHealthDiagnostics()), ...(await buildMemoryDiagnostics())];
}
function PropertyValue(t0) {
const $ = _c(8);
const {
value
} = t0;
if (Array.isArray(value)) {
let t1;
if ($[0] !== value) {
let t2;
if ($[2] !== value.length) {
t2 = (item, i) => <Text key={i}>{item}{i < value.length - 1 ? "," : ""}</Text>;
$[2] = value.length;
$[3] = t2;
} else {
t2 = $[3];
}
t1 = value.map(t2);
$[0] = value;
$[1] = t1;
} else {
t1 = $[1];
}
let t2;
if ($[4] !== t1) {
t2 = <Box flexWrap="wrap" columnGap={1} flexShrink={99}>{t1}</Box>;
$[4] = t1;
$[5] = t2;
} else {
t2 = $[5];
}
return t2;
}
if (typeof value === "string") {
let t1;
if ($[6] !== value) {
t1 = <Text>{value}</Text>;
$[6] = value;
$[7] = t1;
} else {
t1 = $[7];
}
return t1;
}
return value;
}
export function Status(t0) {
const $ = _c(20);
const {
context,
diagnosticsPromise
} = t0;
const mainLoopModel = useAppState(_temp);
const mcp = useAppState(_temp2);
const [theme] = useTheme();
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t1 = buildPrimarySection();
$[0] = t1;
} else {
t1 = $[0];
}
let t2;
if ($[1] !== context || $[2] !== mainLoopModel || $[3] !== mcp || $[4] !== theme) {
t2 = buildSecondarySection({
mainLoopModel,
mcp,
const modelLabel = getModelDisplayLabel(mainLoopModel)
return [
{ label: 'Model', value: modelLabel },
...buildIDEProperties(
mcp.clients,
context.options.ideInstallationStatus,
theme,
context
});
$[1] = context;
$[2] = mainLoopModel;
$[3] = mcp;
$[4] = theme;
$[5] = t2;
} else {
t2 = $[5];
}
let t3;
if ($[6] !== t2) {
t3 = [t1, t2];
$[6] = t2;
$[7] = t3;
} else {
t3 = $[7];
}
const sections = t3;
const grow = useIsInsideModal() ? 1 : undefined;
let t4;
if ($[8] !== sections) {
t4 = sections.map(_temp4);
$[8] = sections;
$[9] = t4;
} else {
t4 = $[9];
}
let t5;
if ($[10] !== diagnosticsPromise) {
t5 = <Suspense fallback={null}><Diagnostics promise={diagnosticsPromise} /></Suspense>;
$[10] = diagnosticsPromise;
$[11] = t5;
} else {
t5 = $[11];
}
let t6;
if ($[12] !== grow || $[13] !== t4 || $[14] !== t5) {
t6 = <Box flexDirection="column" gap={1} flexGrow={grow}>{t4}{t5}</Box>;
$[12] = grow;
$[13] = t4;
$[14] = t5;
$[15] = t6;
} else {
t6 = $[15];
}
let t7;
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
t7 = <Text dimColor={true}><ConfigurableShortcutHint action="confirm:no" context="Settings" fallback="Esc" description="cancel" /></Text>;
$[16] = t7;
} else {
t7 = $[16];
}
let t8;
if ($[17] !== grow || $[18] !== t6) {
t8 = <Box flexDirection="column" flexGrow={grow}>{t6}{t7}</Box>;
$[17] = grow;
$[18] = t6;
$[19] = t8;
} else {
t8 = $[19];
}
return t8;
),
...buildMcpProperties(mcp.clients, theme),
...buildSandboxProperties(),
...buildSettingSourcesProperties(),
]
}
function _temp4(properties, i) {
return properties.length > 0 && <Box key={i} flexDirection="column">{properties.map(_temp3)}</Box>;
export async function buildDiagnostics(): Promise<Diagnostic[]> {
return [
...(await buildInstallationDiagnostics()),
...(await buildInstallationHealthDiagnostics()),
...(await buildMemoryDiagnostics()),
]
}
function _temp3(t0, j) {
const {
label,
value
} = t0;
return <Box key={j} flexDirection="row" gap={1} flexShrink={0}>{label !== undefined && <Text bold={true}>{label}:</Text>}<PropertyValue value={value} /></Box>;
}
function _temp2(s_0) {
return s_0.mcp;
}
function _temp(s) {
return s.mainLoopModel;
}
function Diagnostics(t0) {
const $ = _c(5);
const {
promise
} = t0;
const diagnostics = use(promise) as any[];
if (diagnostics.length === 0) {
return null;
function PropertyValue({
value,
}: {
value: Property['value']
}): React.ReactNode {
if (Array.isArray(value)) {
return (
<Box flexWrap="wrap" columnGap={1} flexShrink={99}>
{value.map((item, i) => {
return (
<Text key={i}>
{item}
{i < value.length - 1 ? ',' : ''}
</Text>
)
})}
</Box>
)
}
let t1;
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
t1 = <Text bold={true}>System Diagnostics</Text>;
$[0] = t1;
} else {
t1 = $[0];
if (typeof value === 'string') {
return <Text>{value}</Text>
}
let t2;
if ($[1] !== diagnostics) {
t2 = diagnostics.map(_temp5);
$[1] = diagnostics;
$[2] = t2;
} else {
t2 = $[2];
}
let t3;
if ($[3] !== t2) {
t3 = <Box flexDirection="column" paddingBottom={1}>{t1}{t2}</Box>;
$[3] = t2;
$[4] = t3;
} else {
t3 = $[4];
}
return t3;
return value
}
function _temp5(diagnostic, i) {
return <Box key={i} flexDirection="row" gap={1} paddingX={1}><Text color="error">{figures.warning}</Text>{typeof diagnostic === "string" ? <Text wrap="wrap">{diagnostic}</Text> : diagnostic}</Box>;
export function Status({
context,
diagnosticsPromise,
}: Props): React.ReactNode {
const mainLoopModel = useAppState(s => s.mainLoopModel)
const mcp = useAppState(s => s.mcp)
const [theme] = useTheme()
// Sections are synchronous — compute in render so they're never empty.
// diagnosticsPromise is created once in Settings.tsx so it resolves once
// per pane invocation instead of re-fetching on every tab switch (Tab
// unmounts children when not selected, which was causing the flash).
const sections = React.useMemo(
() => [
buildPrimarySection(),
buildSecondarySection({ mainLoopModel, mcp, theme, context }),
],
[mainLoopModel, mcp, theme, context],
)
// flexGrow so the "Esc to cancel" footer pins to the bottom of the
// Modal's inner ScrollBox when content is short. The ScrollBox content
// wrapper has flexGrow:1 (fills at least the viewport), so this stretches
// to match. Without it, short Status content floats at the top and the
// footer sits mid-modal with 2-3 trailing blank rows below. Outside a
// Modal (non-fullscreen), leave layout alone — no ScrollBox to fill.
const grow = useIsInsideModal() ? 1 : undefined
return (
<Box flexDirection="column" flexGrow={grow}>
<Box flexDirection="column" gap={1} flexGrow={grow}>
{sections.map(
(properties, i) =>
properties.length > 0 && (
<Box key={i} flexDirection="column">
{properties.map(({ label, value }, j) => (
<Box key={j} flexDirection="row" gap={1} flexShrink={0}>
{label !== undefined && <Text bold>{label}:</Text>}
<PropertyValue value={value} />
</Box>
))}
</Box>
),
)}
<Suspense fallback={null}>
<Diagnostics promise={diagnosticsPromise} />
</Suspense>
</Box>
<Text dimColor>
<ConfigurableShortcutHint
action="confirm:no"
context="Settings"
fallback="Esc"
description="cancel"
/>
</Text>
</Box>
)
}
function Diagnostics({
promise,
}: {
promise: Promise<Diagnostic[]>
}): React.ReactNode {
const diagnostics = use(promise)
if (diagnostics.length === 0) return null
return (
<Box flexDirection="column" paddingBottom={1}>
<Text bold>System Diagnostics</Text>
{diagnostics.map((diagnostic, i) => (
<Box key={i} flexDirection="row" gap={1} paddingX={1}>
<Text color="error">{figures.warning}</Text>
{typeof diagnostic === 'string' ? (
<Text wrap="wrap">{diagnostic}</Text>
) : (
diagnostic
)}
</Box>
))}
</Box>
)
}