File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " opencode-supertask" ,
3- "version" : " 0.1.17 " ,
3+ "version" : " 0.1.18 " ,
44 "description" : " AI Agent 任务调度系统 — OpenCode 插件 + CLI + Gateway 常驻进程" ,
55 "type" : " module" ,
66 "main" : " dist/plugin/supertask.js" ,
Original file line number Diff line number Diff line change @@ -419,14 +419,33 @@ program
419419
420420program
421421 . command ( 'upgrade' )
422- . description ( 'Restart Gateway with current plugin version ' )
422+ . description ( 'Update npm package and restart Gateway ' )
423423 . action ( async ( ) => {
424+ const { execSync } = await import ( 'child_process' ) ;
425+ const { homedir } = await import ( 'os' ) ;
426+ const { join } = await import ( 'path' ) ;
427+ const configDir = join ( homedir ( ) , '.config/opencode' ) ;
428+
429+ console . log ( 'Updating opencode-supertask...' ) ;
430+ try {
431+ execSync ( 'npm install opencode-supertask@latest' , {
432+ cwd : configDir ,
433+ stdio : 'inherit' ,
434+ timeout : 60000 ,
435+ } ) ;
436+ } catch ( err ) {
437+ console . error ( 'npm install failed:' , err instanceof Error ? err . message : String ( err ) ) ;
438+ console . error ( 'Try manually: cd ~/.config/opencode && npm install opencode-supertask@latest' ) ;
439+ process . exit ( 1 ) ;
440+ }
441+
424442 try {
425443 const { upgrade : pm2Upgrade } = await import ( '../daemon/pm2' ) ;
426444 const result = pm2Upgrade ( ) ;
427- console . log ( JSON . stringify ( { before : result . before , after : result . after , restarted : result . restarted } ) ) ;
445+ console . log ( `\nSuperTask upgraded: ${ result . before ?? 'unknown' } → ${ result . after } ` ) ;
446+ console . log ( 'Gateway restarted. Please restart opencode to load the new plugin.' ) ;
428447 } catch ( err ) {
429- console . error ( err instanceof Error ? err . message : String ( err ) ) ;
448+ console . error ( 'Gateway restart failed:' , err instanceof Error ? err . message : String ( err ) ) ;
430449 process . exit ( 1 ) ;
431450 }
432451 } ) ;
You can’t perform that action at this time.
0 commit comments