@@ -92,11 +92,14 @@ func runInstall(cmd *cobra.Command, args []string, hookMode bool) error {
9292 }
9393 } else if repoURL != "" && newETag != "" {
9494 // Save new ETag and lock file content
95+ log := logger .Get ()
9596 if err := cache .SaveETag (repoURL , newETag ); err != nil {
9697 out .printfErr ("Warning: failed to save ETag: %v\n " , err )
98+ log .Error ("failed to save ETag" , "repo_url" , repoURL , "error" , err )
9799 }
98100 if err := cache .SaveLockFile (repoURL , lockFileData ); err != nil {
99101 out .printfErr ("Warning: failed to cache lock file: %v\n " , err )
102+ log .Error ("failed to cache lock file" , "repo_url" , repoURL , "error" , err )
100103 }
101104 }
102105
@@ -232,10 +235,8 @@ func runInstall(cmd *cobra.Command, args []string, hookMode bool) error {
232235 // Save state even if nothing changed (updates timestamp)
233236 saveInstallationState (trackingBase , lockFile , sortedArtifacts , targetClientIDs , out )
234237
235- // Install Claude Code hooks even if no artifacts changed
236- if err := installClaudeCodeHooks (claudeDir , out ); err != nil {
237- out .printfErr ("\n Warning: failed to install hooks: %v\n " , err )
238- }
238+ // Install client-specific hooks (e.g., auto-update, usage tracking)
239+ installClientHooks (ctx , targetClients , out )
239240
240241 // Ensure skills support is configured for all clients (creates local rules files, etc.)
241242 // This is important even when no new artifacts are installed, as the local rules file
@@ -286,8 +287,10 @@ func runInstall(cmd *cobra.Command, args []string, hookMode bool) error {
286287
287288 if len (downloadErrors ) > 0 {
288289 out .printErr ("\n Download errors:" )
290+ log := logger .Get ()
289291 for _ , err := range downloadErrors {
290292 out .printfErr (" - %v\n " , err )
293+ log .Error ("artifact download failed" , "error" , err )
291294 }
292295 out .println ()
293296 }
@@ -330,15 +333,13 @@ func runInstall(cmd *cobra.Command, args []string, hookMode bool) error {
330333 out .printfErr ("✗ Failed to install %d artifacts:\n " , len (installResult .Failed ))
331334 for i , name := range installResult .Failed {
332335 out .printfErr (" - %s: %v\n " , name , installResult .Errors [i ])
336+ log .Error ("artifact installation failed" , "name" , name , "error" , installResult .Errors [i ])
333337 }
334338 return fmt .Errorf ("some artifacts failed to install" )
335339 }
336340
337- // Install Claude Code hooks
338- if err := installClaudeCodeHooks (claudeDir , out ); err != nil {
339- out .printfErr ("\n Warning: failed to install hooks: %v\n " , err )
340- // Don't fail the install command if hook installation fails
341- }
341+ // Install client-specific hooks (e.g., auto-update, usage tracking)
342+ installClientHooks (ctx , targetClients , out )
342343
343344 // If in hook mode and artifacts were installed, output JSON message
344345 if hookMode && len (installResult .Installed ) > 0 {
@@ -411,6 +412,8 @@ func loadPreviousInstallState(trackingBase string, out *outputHelper) *artifacts
411412 previousInstall , err := artifacts .LoadInstalledArtifacts (trackingBase )
412413 if err != nil {
413414 out .printfErr ("Warning: failed to load previous installation state: %v\n " , err )
415+ log := logger .Get ()
416+ log .Error ("failed to load previous installation state" , "tracking_base" , trackingBase , "error" , err )
414417 return & artifacts.InstalledArtifacts {
415418 Version : artifacts .TrackerFormatVersion ,
416419 Artifacts : []artifacts.InstalledArtifact {},
@@ -481,6 +484,7 @@ func cleanupRemovedArtifacts(ctx context.Context, previousInstall *artifacts.Ins
481484 resp , err := client .UninstallArtifacts (ctx , uninstallReq )
482485 if err != nil {
483486 out .printfErr ("Warning: cleanup failed for %s: %v\n " , client .DisplayName (), err )
487+ log .Error ("cleanup failed" , "client" , client .ID (), "error" , err )
484488 continue
485489 }
486490
@@ -490,6 +494,7 @@ func cleanupRemovedArtifacts(ctx context.Context, previousInstall *artifacts.Ins
490494 log .Info ("artifact removed" , "name" , result .ArtifactName , "client" , client .ID ())
491495 } else if result .Status == clients .StatusFailed {
492496 out .printfErr ("Warning: failed to remove %s from %s: %v\n " , result .ArtifactName , client .DisplayName (), result .Error )
497+ log .Error ("artifact removal failed" , "name" , result .ArtifactName , "client" , client .ID (), "error" , result .Error )
493498 }
494499 }
495500 }
@@ -587,11 +592,25 @@ func processInstallationResults(allResults map[string]clients.InstallResponse, o
587592 return installResult
588593}
589594
595+ // installClientHooks calls InstallHooks on all clients to install client-specific hooks
596+ func installClientHooks (ctx context.Context , targetClients []clients.Client , out * outputHelper ) {
597+ log := logger .Get ()
598+ for _ , client := range targetClients {
599+ if err := client .InstallHooks (ctx ); err != nil {
600+ out .printfErr ("Warning: failed to install hooks for %s: %v\n " , client .DisplayName (), err )
601+ log .Error ("failed to install client hooks" , "client" , client .ID (), "error" , err )
602+ // Don't fail the install command if hook installation fails
603+ }
604+ }
605+ }
606+
590607// ensureSkillsSupport calls EnsureSkillsSupport on all clients to set up local rules files, etc.
591608func ensureSkillsSupport (ctx context.Context , targetClients []clients.Client , scope * clients.InstallScope , out * outputHelper ) {
609+ log := logger .Get ()
592610 for _ , client := range targetClients {
593611 if err := client .EnsureSkillsSupport (ctx , scope ); err != nil {
594612 out .printfErr ("Warning: failed to ensure skills support for %s: %v\n " , client .DisplayName (), err )
613+ log .Error ("failed to ensure skills support" , "client" , client .ID (), "error" , err )
595614 }
596615 }
597616}
@@ -617,5 +636,7 @@ func saveInstallationState(trackingBase string, lockFile *lockfile.LockFile, sor
617636
618637 if err := artifacts .SaveInstalledArtifacts (trackingBase , newInstall ); err != nil {
619638 out .printfErr ("Warning: failed to save installation state: %v\n " , err )
639+ log := logger .Get ()
640+ log .Error ("failed to save installation state" , "tracking_base" , trackingBase , "error" , err )
620641 }
621642}
0 commit comments