MCPcopy Index your code
hub / github.com/codeaashu/claude-code / Install

Function Install

src/commands/install.tsx:89–276  ·  view source on GitHub ↗
({
  onDone,
  force,
  target
}: InstallProps)

Source from the content-addressed store, hash-verified

87 return <Box key={index} marginLeft={2}><Text dimColor={true}>• {message}</Text></Box>;
88}
89function Install({
90 onDone,
91 force,
92 target
93}: InstallProps): React.ReactNode {
94 const [state, setState] = useState<InstallState>({
95 type: 'checking'
96 });
97 useEffect(() => {
98 async function run() {
99 try {
100 logForDebugging(`Install: Starting installation process (force=${force}, target=${target})`);
101
102 // Install native build first
103 const channelOrVersion = target || getInitialSettings()?.autoUpdatesChannel || 'latest';
104 setState({
105 type: 'installing',
106 version: channelOrVersion
107 });
108
109 // Pass force flag to trigger reinstall even if up to date
110 logForDebugging(`Install: Calling installLatest(channelOrVersion=${channelOrVersion}, forceReinstall=${force})`);
111 const result = await installLatest(channelOrVersion, force);
112 logForDebugging(`Install: installLatest returned version=${result.latestVersion}, wasUpdated=${result.wasUpdated}, lockFailed=${result.lockFailed}`);
113
114 // Check specifically for lock failure
115 if (result.lockFailed) {
116 throw new Error('Could not install - another process is currently installing Claude. Please try again in a moment.');
117 }
118
119 // If we couldn't get the version, there might be an issue
120 if (!result.latestVersion) {
121 logForDebugging('Install: Failed to retrieve version information during install', {
122 level: 'error'
123 });
124 }
125 if (!result.wasUpdated) {
126 logForDebugging('Install: Already up to date');
127 }
128
129 // Set up launcher and shell integration
130 setState({
131 type: 'setting-up'
132 });
133 const setupMessages = await checkInstall(true);
134 logForDebugging(`Install: Setup launcher completed with ${setupMessages.length} messages`);
135 if (setupMessages.length > 0) {
136 setupMessages.forEach(msg => logForDebugging(`Install: Setup message: ${msg.message}`));
137 }
138
139 // Now that native installation succeeded, clean up old npm installations
140 logForDebugging('Install: Cleaning up npm installations after successful install');
141 const {
142 removed,
143 errors,
144 warnings
145 } = await cleanupNpmInstallations();
146 if (removed > 0) {

Callers

nothing calls this directly

Calls 2

runFunction · 0.70
getInstallationPathFunction · 0.70

Tested by

no test coverage detected