mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35: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,121 +1,107 @@
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import * as React from 'react';
|
||||
import { handlePlanModeTransition } from '../../bootstrap/state.js';
|
||||
import type { LocalJSXCommandContext } from '../../commands.js';
|
||||
import { Box, Text } from '../../ink.js';
|
||||
import type { LocalJSXCommandOnDone } from '../../types/command.js';
|
||||
import { getExternalEditor } from '../../utils/editor.js';
|
||||
import { toIDEDisplayName } from '../../utils/ide.js';
|
||||
import { applyPermissionUpdate } from '../../utils/permissions/PermissionUpdate.js';
|
||||
import { prepareContextForPlanMode } from '../../utils/permissions/permissionSetup.js';
|
||||
import { getPlan, getPlanFilePath } from '../../utils/plans.js';
|
||||
import { editFileInEditor } from '../../utils/promptEditor.js';
|
||||
import { renderToString } from '../../utils/staticRender.js';
|
||||
function PlanDisplay(t0) {
|
||||
const $ = _c(11);
|
||||
const {
|
||||
planContent,
|
||||
planPath,
|
||||
editorName
|
||||
} = t0;
|
||||
let t1;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t1 = <Text bold={true}>Current Plan</Text>;
|
||||
$[0] = t1;
|
||||
} else {
|
||||
t1 = $[0];
|
||||
}
|
||||
let t2;
|
||||
if ($[1] !== planPath) {
|
||||
t2 = <Text dimColor={true}>{planPath}</Text>;
|
||||
$[1] = planPath;
|
||||
$[2] = t2;
|
||||
} else {
|
||||
t2 = $[2];
|
||||
}
|
||||
let t3;
|
||||
if ($[3] !== planContent) {
|
||||
t3 = <Box marginTop={1}><Text>{planContent}</Text></Box>;
|
||||
$[3] = planContent;
|
||||
$[4] = t3;
|
||||
} else {
|
||||
t3 = $[4];
|
||||
}
|
||||
let t4;
|
||||
if ($[5] !== editorName) {
|
||||
t4 = editorName && <Box marginTop={1}><Text dimColor={true}>"/plan open"</Text><Text dimColor={true}> to edit this plan in </Text><Text bold={true} dimColor={true}>{editorName}</Text></Box>;
|
||||
$[5] = editorName;
|
||||
$[6] = t4;
|
||||
} else {
|
||||
t4 = $[6];
|
||||
}
|
||||
let t5;
|
||||
if ($[7] !== t2 || $[8] !== t3 || $[9] !== t4) {
|
||||
t5 = <Box flexDirection="column">{t1}{t2}{t3}{t4}</Box>;
|
||||
$[7] = t2;
|
||||
$[8] = t3;
|
||||
$[9] = t4;
|
||||
$[10] = t5;
|
||||
} else {
|
||||
t5 = $[10];
|
||||
}
|
||||
return t5;
|
||||
import * as React from 'react'
|
||||
import { handlePlanModeTransition } from '../../bootstrap/state.js'
|
||||
import type { LocalJSXCommandContext } from '../../commands.js'
|
||||
import { Box, Text } from '../../ink.js'
|
||||
import type { LocalJSXCommandOnDone } from '../../types/command.js'
|
||||
import { getExternalEditor } from '../../utils/editor.js'
|
||||
import { toIDEDisplayName } from '../../utils/ide.js'
|
||||
import { applyPermissionUpdate } from '../../utils/permissions/PermissionUpdate.js'
|
||||
import { prepareContextForPlanMode } from '../../utils/permissions/permissionSetup.js'
|
||||
import { getPlan, getPlanFilePath } from '../../utils/plans.js'
|
||||
import { editFileInEditor } from '../../utils/promptEditor.js'
|
||||
import { renderToString } from '../../utils/staticRender.js'
|
||||
|
||||
function PlanDisplay({
|
||||
planContent,
|
||||
planPath,
|
||||
editorName,
|
||||
}: {
|
||||
planContent: string
|
||||
planPath: string
|
||||
editorName: string | undefined
|
||||
}): React.ReactNode {
|
||||
return (
|
||||
<Box flexDirection="column">
|
||||
<Text bold>Current Plan</Text>
|
||||
<Text dimColor>{planPath}</Text>
|
||||
<Box marginTop={1}>
|
||||
<Text>{planContent}</Text>
|
||||
</Box>
|
||||
{editorName && (
|
||||
<Box marginTop={1}>
|
||||
<Text dimColor>"/plan open"</Text>
|
||||
<Text dimColor> to edit this plan in </Text>
|
||||
<Text bold dimColor>
|
||||
{editorName}
|
||||
</Text>
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
export async function call(onDone: LocalJSXCommandOnDone, context: LocalJSXCommandContext, args: string): Promise<React.ReactNode> {
|
||||
const {
|
||||
getAppState,
|
||||
setAppState
|
||||
} = context;
|
||||
const appState = getAppState();
|
||||
const currentMode = appState.toolPermissionContext.mode;
|
||||
|
||||
export async function call(
|
||||
onDone: LocalJSXCommandOnDone,
|
||||
context: LocalJSXCommandContext,
|
||||
args: string,
|
||||
): Promise<React.ReactNode> {
|
||||
const { getAppState, setAppState } = context
|
||||
const appState = getAppState()
|
||||
const currentMode = appState.toolPermissionContext.mode
|
||||
|
||||
// If not in plan mode, enable it
|
||||
if (currentMode !== 'plan') {
|
||||
handlePlanModeTransition(currentMode, 'plan');
|
||||
handlePlanModeTransition(currentMode, 'plan')
|
||||
setAppState(prev => ({
|
||||
...prev,
|
||||
toolPermissionContext: applyPermissionUpdate(prepareContextForPlanMode(prev.toolPermissionContext), {
|
||||
type: 'setMode',
|
||||
mode: 'plan',
|
||||
destination: 'session'
|
||||
})
|
||||
}));
|
||||
const description = args.trim();
|
||||
toolPermissionContext: applyPermissionUpdate(
|
||||
prepareContextForPlanMode(prev.toolPermissionContext),
|
||||
{ type: 'setMode', mode: 'plan', destination: 'session' },
|
||||
),
|
||||
}))
|
||||
const description = args.trim()
|
||||
if (description && description !== 'open') {
|
||||
onDone('Enabled plan mode', {
|
||||
shouldQuery: true
|
||||
});
|
||||
onDone('Enabled plan mode', { shouldQuery: true })
|
||||
} else {
|
||||
onDone('Enabled plan mode');
|
||||
onDone('Enabled plan mode')
|
||||
}
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
|
||||
// Already in plan mode - show the current plan
|
||||
const planContent = getPlan();
|
||||
const planPath = getPlanFilePath();
|
||||
const planContent = getPlan()
|
||||
const planPath = getPlanFilePath()
|
||||
|
||||
if (!planContent) {
|
||||
onDone('Already in plan mode. No plan written yet.');
|
||||
return null;
|
||||
onDone('Already in plan mode. No plan written yet.')
|
||||
return null
|
||||
}
|
||||
|
||||
// If user typed "/plan open", open in editor
|
||||
const argList = args.trim().split(/\s+/);
|
||||
const argList = args.trim().split(/\s+/)
|
||||
if (argList[0] === 'open') {
|
||||
const result = await editFileInEditor(planPath);
|
||||
const result = await editFileInEditor(planPath)
|
||||
if (result.error) {
|
||||
onDone(`Failed to open plan in editor: ${result.error}`);
|
||||
onDone(`Failed to open plan in editor: ${result.error}`)
|
||||
} else {
|
||||
onDone(`Opened plan in editor: ${planPath}`);
|
||||
onDone(`Opened plan in editor: ${planPath}`)
|
||||
}
|
||||
return null;
|
||||
return null
|
||||
}
|
||||
const editor = getExternalEditor();
|
||||
const editorName = editor ? toIDEDisplayName(editor) : undefined;
|
||||
const display = <PlanDisplay planContent={planContent} planPath={planPath} editorName={editorName} />;
|
||||
|
||||
const editor = getExternalEditor()
|
||||
const editorName = editor ? toIDEDisplayName(editor) : undefined
|
||||
|
||||
const display = (
|
||||
<PlanDisplay
|
||||
planContent={planContent}
|
||||
planPath={planPath}
|
||||
editorName={editorName}
|
||||
/>
|
||||
)
|
||||
|
||||
// Render to string and pass to onDone like local commands do
|
||||
const output = await renderToString(display);
|
||||
onDone(output);
|
||||
return null;
|
||||
const output = await renderToString(display)
|
||||
onDone(output)
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user