@@ -165,85 +165,30 @@ export namespace Config {
165165 }
166166 }
167167
168- // Per-directory install locks to serialize concurrent installs
169- const installLocks = new Map < string , Promise < void > > ( )
170-
171- // Marker file schema for tracking installed dependencies
172- const DepsInstalledMarker = z . object ( {
173- version : z . string ( ) ,
174- timestamp : z . number ( ) ,
175- } )
176-
177168 async function installDependencies ( dir : string ) {
178- // Wait for any ongoing install in this directory to complete
179- const existingLock = installLocks . get ( dir )
180- if ( existingLock ) {
181- await existingLock
182- return
183- }
169+ if ( Installation . isLocal ( ) ) return
184170
185- // Create a new lock for this directory
186- let resolveLock : ( ) => void
187- const lockPromise = new Promise < void > ( ( resolve ) => {
188- resolveLock = resolve
189- } )
190- installLocks . set ( dir , lockPromise )
191-
192- try {
193- const markerPath = path . join ( dir , ".deps-installed.json" )
194- const targetVersion = Installation . isLocal ( ) ? "latest" : Installation . BASE_VERSION
195-
196- // Check if dependencies are already installed with correct version
197- try {
198- const markerContent = await Bun . file ( markerPath ) . text ( )
199- const marker = DepsInstalledMarker . parse ( JSON . parse ( markerContent ) )
200- if ( marker . version === targetVersion ) {
201- log . debug ( "dependencies already installed" , { dir, version : marker . version } )
202- return
203- }
204- } catch {
205- // Marker doesn't exist or is invalid, proceed with install
206- }
171+ const pkg = path . join ( dir , "package.json" )
207172
208- const pkg = path . join ( dir , "package.json" )
209-
210- if ( ! ( await Bun . file ( pkg ) . exists ( ) ) ) {
211- await Bun . write ( pkg , "{}" )
212- }
173+ if ( ! ( await Bun . file ( pkg ) . exists ( ) ) ) {
174+ await Bun . write ( pkg , "{}" )
175+ }
213176
214- const gitignore = path . join ( dir , ".gitignore" )
215- const hasGitIgnore = await Bun . file ( gitignore ) . exists ( )
216- if ( ! hasGitIgnore ) {
217- await Bun . write (
218- gitignore ,
219- [ "node_modules" , "package.json" , "bun.lock" , ".gitignore" , ".deps-installed.json" ] . join ( "\n" ) ,
220- )
221- }
177+ const gitignore = path . join ( dir , ".gitignore" )
178+ const hasGitIgnore = await Bun . file ( gitignore ) . exists ( )
179+ if ( ! hasGitIgnore ) await Bun . write ( gitignore , [ "node_modules" , "package.json" , "bun.lock" , ".gitignore" ] . join ( "\n" ) )
222180
223- // Use BASE_VERSION for @opencode -ai/plugin since it's published by upstream without our -N suffix
224- await BunProc . run ( [ "add" , "@opencode-ai/plugin@" + targetVersion , "--exact" ] , {
181+ // Use BASE_VERSION for @opencode -ai/plugin since it's published by upstream without our -N suffix
182+ await BunProc . run (
183+ [ "add" , "@opencode-ai/plugin@" + Installation . BASE_VERSION , "--exact" ] ,
184+ {
225185 cwd : dir ,
226- } )
227-
228- // Install any additional dependencies defined in the package.json
229- // This allows local plugins and custom tools to use external packages
230- await BunProc . run ( [ "install" ] , { cwd : dir } ) . catch ( ( ) => { } )
186+ } ,
187+ ) . catch ( ( ) => { } )
231188
232- // Write marker file after successful install
233- await Bun . write (
234- markerPath ,
235- JSON . stringify ( {
236- version : targetVersion ,
237- timestamp : Date . now ( ) ,
238- } ) ,
239- )
240- log . info ( "dependencies installed" , { dir, version : targetVersion } )
241- } catch ( err ) {
242- log . error ( "failed to install dependencies" , { dir, error : err } )
243- } finally {
244- installLocks . delete ( dir )
245- resolveLock ! ( )
246- }
189+ // Install any additional dependencies defined in the package.json
190+ // This allows local plugins and custom tools to use external packages
191+ await BunProc . run ( [ "install" ] , { cwd : dir } ) . catch ( ( ) => { } )
247192 }
248193
249194 const COMMAND_GLOB = new Bun . Glob ( "{command,commands}/**/*.md" )
0 commit comments