MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / SetupWizard

Function SetupWizard

ai-code-studio/src/components/SetupWizard.tsx:75–644  ·  view source on GitHub ↗
({
  open,
  config,
  setConfig,
  setupChecklist,
  connectionReport,
  isTestingConnection,
  onSaveConfig,
  onTestConnection,
  onClose,
  onComplete,
}: SetupWizardProps)

Source from the content-addressed store, hash-verified

73}
74
75export function SetupWizard({
76 open,
77 config,
78 setConfig,
79 setupChecklist,
80 connectionReport,
81 isTestingConnection,
82 onSaveConfig,
83 onTestConnection,
84 onClose,
85 onComplete,
86}: SetupWizardProps) {
87 const [step, setStep] = useState<WizardStep>('welcome');
88
89 const stepIndex = wizardSteps.indexOf(step);
90 const allReady = setupChecklist.every(item => item.ready);
91 const canFinish = allReady && Boolean(connectionReport?.ok);
92 const providerReady = Boolean(config.upstreamBaseUrl && config.upstreamModel);
93 const workspaceReady = Boolean(config.workspaceDir && config.clawProjectDir);
94 const runtimeReady =
95 config.runner === 'binary' ? Boolean(config.clawBinaryPath) : Boolean(config.clawProjectDir);
96
97 const completedSteps = useMemo(
98 () => ({
99 welcome: false,
100 provider: providerReady,
101 workspace: workspaceReady,
102 runtime: runtimeReady,
103 verify: canFinish,
104 }),
105 [providerReady, workspaceReady, runtimeReady, canFinish],
106 );
107
108 if (!open) {
109 return null;
110 }
111
112 async function pickDirectory(target: 'workspaceDir' | 'clawProjectDir') {
113 const nextPath = await window.clawDesktop?.pickDirectory?.();
114 if (nextPath) {
115 setConfig(current => ({
116 ...current,
117 [target]: nextPath,
118 }));
119 }
120 }
121
122 async function pickBinaryPath() {
123 const nextPath = await window.clawDesktop?.pickFile?.([
124 { name: 'Executable', extensions: ['exe', 'bin', 'cmd'] },
125 { name: 'All Files', extensions: ['*'] },
126 ]);
127 if (nextPath) {
128 setConfig(current => ({
129 ...current,
130 clawBinaryPath: nextPath,
131 }));
132 }

Callers

nothing calls this directly

Calls 7

checklistToneFunction · 0.90
formatTimestampFunction · 0.90
connectionToneFunction · 0.90
labelForConnectionStatusFunction · 0.90
moveFunction · 0.85
pickDirectoryFunction · 0.70
pickBinaryPathFunction · 0.70

Tested by

no test coverage detected