mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15: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,64 +1,48 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import React, { type ReactNode } from 'react';
|
||||
import type { Theme } from '../../utils/theme.js';
|
||||
import { Dialog } from '../design-system/Dialog.js';
|
||||
import { useWizard } from './useWizard.js';
|
||||
import { WizardNavigationFooter } from './WizardNavigationFooter.js';
|
||||
import React, { type ReactNode } from 'react'
|
||||
import type { Theme } from '../../utils/theme.js'
|
||||
import { Dialog } from '../design-system/Dialog.js'
|
||||
import { useWizard } from './useWizard.js'
|
||||
import { WizardNavigationFooter } from './WizardNavigationFooter.js'
|
||||
|
||||
type Props = {
|
||||
title?: string;
|
||||
color?: keyof Theme;
|
||||
children: ReactNode;
|
||||
subtitle?: string;
|
||||
footerText?: ReactNode;
|
||||
};
|
||||
export function WizardDialogLayout(t0) {
|
||||
const $ = _c(11);
|
||||
const {
|
||||
title: titleOverride,
|
||||
color: t1,
|
||||
children,
|
||||
subtitle,
|
||||
footerText
|
||||
} = t0;
|
||||
const color = t1 === undefined ? "suggestion" : t1;
|
||||
title?: string
|
||||
color?: keyof Theme
|
||||
children: ReactNode
|
||||
subtitle?: string
|
||||
footerText?: ReactNode
|
||||
}
|
||||
|
||||
export function WizardDialogLayout({
|
||||
title: titleOverride,
|
||||
color = 'suggestion',
|
||||
children,
|
||||
subtitle,
|
||||
footerText,
|
||||
}: Props): ReactNode {
|
||||
const {
|
||||
currentStepIndex,
|
||||
totalSteps,
|
||||
title: providerTitle,
|
||||
showStepCounter,
|
||||
goBack
|
||||
} = useWizard();
|
||||
const title = titleOverride || providerTitle || "Wizard";
|
||||
const stepSuffix = showStepCounter !== false ? ` (${currentStepIndex + 1}/${totalSteps})` : "";
|
||||
const t2 = `${title}${stepSuffix}`;
|
||||
let t3;
|
||||
if ($[0] !== children || $[1] !== color || $[2] !== goBack || $[3] !== subtitle || $[4] !== t2) {
|
||||
t3 = <Dialog title={t2} subtitle={subtitle} onCancel={goBack} color={color} hideInputGuide={true} isCancelActive={false}>{children}</Dialog>;
|
||||
$[0] = children;
|
||||
$[1] = color;
|
||||
$[2] = goBack;
|
||||
$[3] = subtitle;
|
||||
$[4] = t2;
|
||||
$[5] = t3;
|
||||
} else {
|
||||
t3 = $[5];
|
||||
}
|
||||
let t4;
|
||||
if ($[6] !== footerText) {
|
||||
t4 = <WizardNavigationFooter instructions={footerText} />;
|
||||
$[6] = footerText;
|
||||
$[7] = t4;
|
||||
} else {
|
||||
t4 = $[7];
|
||||
}
|
||||
let t5;
|
||||
if ($[8] !== t3 || $[9] !== t4) {
|
||||
t5 = <>{t3}{t4}</>;
|
||||
$[8] = t3;
|
||||
$[9] = t4;
|
||||
$[10] = t5;
|
||||
} else {
|
||||
t5 = $[10];
|
||||
}
|
||||
return t5;
|
||||
goBack,
|
||||
} = useWizard()
|
||||
const title = titleOverride || providerTitle || 'Wizard'
|
||||
const stepSuffix =
|
||||
showStepCounter !== false ? ` (${currentStepIndex + 1}/${totalSteps})` : ''
|
||||
|
||||
return (
|
||||
<>
|
||||
<Dialog
|
||||
title={`${title}${stepSuffix}`}
|
||||
subtitle={subtitle}
|
||||
onCancel={goBack}
|
||||
color={color}
|
||||
hideInputGuide
|
||||
isCancelActive={false}
|
||||
>
|
||||
{children}
|
||||
</Dialog>
|
||||
<WizardNavigationFooter instructions={footerText} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,23 +1,37 @@
|
||||
import React, { type ReactNode } from 'react';
|
||||
import { useExitOnCtrlCDWithKeybindings } from '../../hooks/useExitOnCtrlCDWithKeybindings.js';
|
||||
import { Box, Text } from '../../ink.js';
|
||||
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js';
|
||||
import { Byline } from '../design-system/Byline.js';
|
||||
import { KeyboardShortcutHint } from '../design-system/KeyboardShortcutHint.js';
|
||||
import React, { type ReactNode } from 'react'
|
||||
import { useExitOnCtrlCDWithKeybindings } from '../../hooks/useExitOnCtrlCDWithKeybindings.js'
|
||||
import { Box, Text } from '../../ink.js'
|
||||
import { ConfigurableShortcutHint } from '../ConfigurableShortcutHint.js'
|
||||
import { Byline } from '../design-system/Byline.js'
|
||||
import { KeyboardShortcutHint } from '../design-system/KeyboardShortcutHint.js'
|
||||
|
||||
type Props = {
|
||||
instructions?: ReactNode;
|
||||
};
|
||||
instructions?: ReactNode
|
||||
}
|
||||
|
||||
export function WizardNavigationFooter({
|
||||
instructions = <Byline>
|
||||
instructions = (
|
||||
<Byline>
|
||||
<KeyboardShortcutHint shortcut="↑↓" action="navigate" />
|
||||
<KeyboardShortcutHint shortcut="Enter" action="select" />
|
||||
<ConfigurableShortcutHint action="confirm:no" context="Confirmation" fallback="Esc" description="go back" />
|
||||
<ConfigurableShortcutHint
|
||||
action="confirm:no"
|
||||
context="Confirmation"
|
||||
fallback="Esc"
|
||||
description="go back"
|
||||
/>
|
||||
</Byline>
|
||||
),
|
||||
}: Props): ReactNode {
|
||||
const exitState = useExitOnCtrlCDWithKeybindings();
|
||||
return <Box marginLeft={3} marginTop={1}>
|
||||
const exitState = useExitOnCtrlCDWithKeybindings()
|
||||
|
||||
return (
|
||||
<Box marginLeft={3} marginTop={1}>
|
||||
<Text dimColor>
|
||||
{exitState.pending ? `Press ${exitState.keyName} again to exit` : instructions}
|
||||
{exitState.pending
|
||||
? `Press ${exitState.keyName} again to exit`
|
||||
: instructions}
|
||||
</Text>
|
||||
</Box>;
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,156 +1,96 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import React, { createContext, type ReactNode, useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useExitOnCtrlCDWithKeybindings } from '../../hooks/useExitOnCtrlCDWithKeybindings.js';
|
||||
import type { WizardContextValue, WizardProviderProps } from './types.js';
|
||||
import React, {
|
||||
createContext,
|
||||
type ReactNode,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useMemo,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { useExitOnCtrlCDWithKeybindings } from '../../hooks/useExitOnCtrlCDWithKeybindings.js'
|
||||
import type { WizardContextValue, WizardProviderProps } from './types.js'
|
||||
|
||||
// Use any here for the context since it will be cast properly when used
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const WizardContext = createContext<WizardContextValue<any> | null>(null);
|
||||
export function WizardProvider(t0) {
|
||||
const $ = _c(38);
|
||||
const {
|
||||
steps,
|
||||
initialData: t1,
|
||||
onComplete,
|
||||
onCancel,
|
||||
children,
|
||||
title,
|
||||
showStepCounter: t2
|
||||
} = t0;
|
||||
let t3;
|
||||
if ($[0] !== t1) {
|
||||
t3 = t1 === undefined ? {} as T : t1;
|
||||
$[0] = t1;
|
||||
$[1] = t3;
|
||||
} else {
|
||||
t3 = $[1];
|
||||
}
|
||||
const initialData = t3;
|
||||
const showStepCounter = t2 === undefined ? true : t2;
|
||||
const [currentStepIndex, setCurrentStepIndex] = useState(0);
|
||||
const [wizardData, setWizardData] = useState(initialData);
|
||||
const [isCompleted, setIsCompleted] = useState(false);
|
||||
let t4;
|
||||
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t4 = [];
|
||||
$[2] = t4;
|
||||
} else {
|
||||
t4 = $[2];
|
||||
}
|
||||
const [navigationHistory, setNavigationHistory] = useState(t4);
|
||||
useExitOnCtrlCDWithKeybindings();
|
||||
let t5;
|
||||
let t6;
|
||||
if ($[3] !== isCompleted || $[4] !== onComplete || $[5] !== wizardData) {
|
||||
t5 = () => {
|
||||
if (isCompleted) {
|
||||
setNavigationHistory([]);
|
||||
onComplete(wizardData);
|
||||
}
|
||||
};
|
||||
t6 = [isCompleted, wizardData, onComplete];
|
||||
$[3] = isCompleted;
|
||||
$[4] = onComplete;
|
||||
$[5] = wizardData;
|
||||
$[6] = t5;
|
||||
$[7] = t6;
|
||||
} else {
|
||||
t5 = $[6];
|
||||
t6 = $[7];
|
||||
}
|
||||
useEffect(t5, t6);
|
||||
let t7;
|
||||
if ($[8] !== currentStepIndex || $[9] !== navigationHistory || $[10] !== steps.length) {
|
||||
t7 = () => {
|
||||
if (currentStepIndex < steps.length - 1) {
|
||||
if (navigationHistory.length > 0) {
|
||||
setNavigationHistory(prev => [...prev, currentStepIndex]);
|
||||
}
|
||||
setCurrentStepIndex(_temp);
|
||||
} else {
|
||||
setIsCompleted(true);
|
||||
}
|
||||
};
|
||||
$[8] = currentStepIndex;
|
||||
$[9] = navigationHistory;
|
||||
$[10] = steps.length;
|
||||
$[11] = t7;
|
||||
} else {
|
||||
t7 = $[11];
|
||||
}
|
||||
const goNext = t7;
|
||||
let t8;
|
||||
if ($[12] !== currentStepIndex || $[13] !== navigationHistory || $[14] !== onCancel) {
|
||||
t8 = () => {
|
||||
export const WizardContext = createContext<WizardContextValue<any> | null>(null)
|
||||
|
||||
export function WizardProvider<T extends Record<string, unknown>>({
|
||||
steps,
|
||||
initialData = {} as T,
|
||||
onComplete,
|
||||
onCancel,
|
||||
children,
|
||||
title,
|
||||
showStepCounter = true,
|
||||
}: WizardProviderProps<T>): ReactNode {
|
||||
const [currentStepIndex, setCurrentStepIndex] = useState(0)
|
||||
const [wizardData, setWizardData] = useState<T>(initialData)
|
||||
const [isCompleted, setIsCompleted] = useState(false)
|
||||
const [navigationHistory, setNavigationHistory] = useState<number[]>([])
|
||||
|
||||
useExitOnCtrlCDWithKeybindings()
|
||||
|
||||
// Handle completion in useEffect to avoid updating parent during render
|
||||
useEffect(() => {
|
||||
if (isCompleted) {
|
||||
setNavigationHistory([])
|
||||
void onComplete(wizardData)
|
||||
}
|
||||
}, [isCompleted, wizardData, onComplete])
|
||||
|
||||
const goNext = useCallback(() => {
|
||||
if (currentStepIndex < steps.length - 1) {
|
||||
// If we have history (non-linear flow), add current step to it
|
||||
if (navigationHistory.length > 0) {
|
||||
const previousStep = navigationHistory[navigationHistory.length - 1];
|
||||
if (previousStep !== undefined) {
|
||||
setNavigationHistory(_temp2);
|
||||
setCurrentStepIndex(previousStep);
|
||||
}
|
||||
} else {
|
||||
if (currentStepIndex > 0) {
|
||||
setCurrentStepIndex(_temp3);
|
||||
} else {
|
||||
if (onCancel) {
|
||||
onCancel();
|
||||
}
|
||||
}
|
||||
setNavigationHistory(prev => [...prev, currentStepIndex])
|
||||
}
|
||||
};
|
||||
$[12] = currentStepIndex;
|
||||
$[13] = navigationHistory;
|
||||
$[14] = onCancel;
|
||||
$[15] = t8;
|
||||
} else {
|
||||
t8 = $[15];
|
||||
}
|
||||
const goBack = t8;
|
||||
let t9;
|
||||
if ($[16] !== currentStepIndex || $[17] !== steps.length) {
|
||||
t9 = index => {
|
||||
|
||||
setCurrentStepIndex(prev => prev + 1)
|
||||
} else {
|
||||
// Mark as completed, which will trigger useEffect
|
||||
setIsCompleted(true)
|
||||
}
|
||||
}, [currentStepIndex, steps.length, navigationHistory])
|
||||
|
||||
const goBack = useCallback(() => {
|
||||
// Check if we have navigation history to use
|
||||
if (navigationHistory.length > 0) {
|
||||
const previousStep = navigationHistory[navigationHistory.length - 1]
|
||||
if (previousStep !== undefined) {
|
||||
setNavigationHistory(prev => prev.slice(0, -1))
|
||||
setCurrentStepIndex(previousStep)
|
||||
}
|
||||
} else if (currentStepIndex > 0) {
|
||||
// Fallback to simple decrement if no history
|
||||
setCurrentStepIndex(prev => prev - 1)
|
||||
} else if (onCancel) {
|
||||
onCancel()
|
||||
}
|
||||
}, [currentStepIndex, navigationHistory, onCancel])
|
||||
|
||||
const goToStep = useCallback(
|
||||
(index: number) => {
|
||||
if (index >= 0 && index < steps.length) {
|
||||
setNavigationHistory(prev_3 => [...prev_3, currentStepIndex]);
|
||||
setCurrentStepIndex(index);
|
||||
// Push current step to history before jumping
|
||||
setNavigationHistory(prev => [...prev, currentStepIndex])
|
||||
setCurrentStepIndex(index)
|
||||
}
|
||||
};
|
||||
$[16] = currentStepIndex;
|
||||
$[17] = steps.length;
|
||||
$[18] = t9;
|
||||
} else {
|
||||
t9 = $[18];
|
||||
}
|
||||
const goToStep = t9;
|
||||
let t10;
|
||||
if ($[19] !== onCancel) {
|
||||
t10 = () => {
|
||||
setNavigationHistory([]);
|
||||
if (onCancel) {
|
||||
onCancel();
|
||||
}
|
||||
};
|
||||
$[19] = onCancel;
|
||||
$[20] = t10;
|
||||
} else {
|
||||
t10 = $[20];
|
||||
}
|
||||
const cancel = t10;
|
||||
let t11;
|
||||
if ($[21] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t11 = updates => {
|
||||
setWizardData(prev_4 => ({
|
||||
...prev_4,
|
||||
...updates
|
||||
}));
|
||||
};
|
||||
$[21] = t11;
|
||||
} else {
|
||||
t11 = $[21];
|
||||
}
|
||||
const updateWizardData = t11;
|
||||
let t12;
|
||||
if ($[22] !== cancel || $[23] !== currentStepIndex || $[24] !== goBack || $[25] !== goNext || $[26] !== goToStep || $[27] !== showStepCounter || $[28] !== steps.length || $[29] !== title || $[30] !== wizardData) {
|
||||
t12 = {
|
||||
},
|
||||
[currentStepIndex, steps.length],
|
||||
)
|
||||
|
||||
const cancel = useCallback(() => {
|
||||
setNavigationHistory([])
|
||||
if (onCancel) {
|
||||
onCancel()
|
||||
}
|
||||
}, [onCancel])
|
||||
|
||||
const updateWizardData = useCallback((updates: Partial<T>) => {
|
||||
setWizardData(prev => ({ ...prev, ...updates }))
|
||||
}, [])
|
||||
|
||||
const contextValue = useMemo<WizardContextValue<T>>(
|
||||
() => ({
|
||||
currentStepIndex,
|
||||
totalSteps: steps.length,
|
||||
wizardData,
|
||||
@@ -161,52 +101,31 @@ export function WizardProvider(t0) {
|
||||
goToStep,
|
||||
cancel,
|
||||
title,
|
||||
showStepCounter
|
||||
};
|
||||
$[22] = cancel;
|
||||
$[23] = currentStepIndex;
|
||||
$[24] = goBack;
|
||||
$[25] = goNext;
|
||||
$[26] = goToStep;
|
||||
$[27] = showStepCounter;
|
||||
$[28] = steps.length;
|
||||
$[29] = title;
|
||||
$[30] = wizardData;
|
||||
$[31] = t12;
|
||||
} else {
|
||||
t12 = $[31];
|
||||
}
|
||||
const contextValue = t12;
|
||||
const CurrentStepComponent = steps[currentStepIndex];
|
||||
showStepCounter,
|
||||
}),
|
||||
[
|
||||
currentStepIndex,
|
||||
steps.length,
|
||||
wizardData,
|
||||
updateWizardData,
|
||||
goNext,
|
||||
goBack,
|
||||
goToStep,
|
||||
cancel,
|
||||
title,
|
||||
showStepCounter,
|
||||
],
|
||||
)
|
||||
|
||||
const CurrentStepComponent = steps[currentStepIndex]
|
||||
|
||||
if (!CurrentStepComponent || isCompleted) {
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
let t13;
|
||||
if ($[32] !== CurrentStepComponent || $[33] !== children) {
|
||||
t13 = children || <CurrentStepComponent />;
|
||||
$[32] = CurrentStepComponent;
|
||||
$[33] = children;
|
||||
$[34] = t13;
|
||||
} else {
|
||||
t13 = $[34];
|
||||
}
|
||||
let t14;
|
||||
if ($[35] !== contextValue || $[36] !== t13) {
|
||||
t14 = <WizardContext.Provider value={contextValue}>{t13}</WizardContext.Provider>;
|
||||
$[35] = contextValue;
|
||||
$[36] = t13;
|
||||
$[37] = t14;
|
||||
} else {
|
||||
t14 = $[37];
|
||||
}
|
||||
return t14;
|
||||
}
|
||||
function _temp3(prev_2) {
|
||||
return prev_2 - 1;
|
||||
}
|
||||
function _temp2(prev_1) {
|
||||
return prev_1.slice(0, -1);
|
||||
}
|
||||
function _temp(prev_0) {
|
||||
return prev_0 + 1;
|
||||
|
||||
return (
|
||||
<WizardContext.Provider value={contextValue}>
|
||||
{children || <CurrentStepComponent />}
|
||||
</WizardContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user