Files
claude-code/src/components/agents/new-agent-creation/CreateAgentWizard.tsx
claude-code-best fcbc882232 chore: 清理 src 下 113 项未使用导入和死代码
删除未使用的文件(BuiltinStatusLine.tsx、4 个重复的 .ts stub)、
移除约 55 个文件中未使用的 React 导入、
清理约 50 处未使用的导入/变量/参数。
净减少 ~296 行代码,precheck 4077 测试全部通过。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 20:05:15 +08:00

58 lines
2.2 KiB
TypeScript

import { type ReactNode } from 'react';
import { isAutoMemoryEnabled } from '../../../memdir/paths.js';
import type { Tools } from '../../../Tool.js';
import type { AgentDefinition } from '@claude-code-best/builtin-tools/tools/AgentTool/loadAgentsDir.js';
import { WizardProvider } from '../../wizard/index.js';
import type { WizardStepComponent } from '../../wizard/types.js';
import type { AgentWizardData } from './types.js';
import { ColorStep } from './wizard-steps/ColorStep.js';
import { ConfirmStepWrapper } from './wizard-steps/ConfirmStepWrapper.js';
import { DescriptionStep } from './wizard-steps/DescriptionStep.js';
import { GenerateStep } from './wizard-steps/GenerateStep.js';
import { LocationStep } from './wizard-steps/LocationStep.js';
import { MemoryStep } from './wizard-steps/MemoryStep.js';
import { MethodStep } from './wizard-steps/MethodStep.js';
import { ModelStep } from './wizard-steps/ModelStep.js';
import { PromptStep } from './wizard-steps/PromptStep.js';
import { ToolsStep } from './wizard-steps/ToolsStep.js';
import { TypeStep } from './wizard-steps/TypeStep.js';
type Props = {
tools: Tools;
existingAgents: AgentDefinition[];
onComplete: (message: string) => void;
onCancel: () => void;
};
export function CreateAgentWizard({ tools, existingAgents, onComplete, onCancel }: Props): ReactNode {
// Create step components with props
const steps: WizardStepComponent[] = [
LocationStep, // 0
MethodStep, // 1
GenerateStep, // 2
() => <TypeStep existingAgents={existingAgents} />, // 3
PromptStep, // 4
DescriptionStep, // 5
() => <ToolsStep tools={tools} />, // 6
ModelStep, // 7
ColorStep, // 8
// MemoryStep is conditionally included based on GrowthBook gate
...(isAutoMemoryEnabled() ? [MemoryStep] : []),
() => <ConfirmStepWrapper tools={tools} existingAgents={existingAgents} onComplete={onComplete} />,
];
return (
<WizardProvider<AgentWizardData>
steps={steps}
initialData={{}}
onComplete={() => {
// Wizard completion is handled by ConfirmStepWrapper
// which calls onComplete with the appropriate message
}}
onCancel={onCancel}
title="Create new agent"
showStepCounter={false}
/>
);
}