package cli import ( "fmt" "github.com/spf13/cobra" "github.com/m3tam3re/agent-lib/internal/client" ) func newSyncCmd() *cobra.Command { var configPath string cmd := &cobra.Command{ Use: "sync", Short: "Pull the work repository and deploy its content to OpenCode", Long: "Pulls the fleet-configured work repository (config from --config, " + "AGENT_LIB_CONFIG, or the admin-protected platform default) and deploys " + "skills, commands and agents into the OpenCode runtime paths. " + "Idempotent: re-running changes nothing when content and disk match.", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { if _, err := client.Sync(client.SyncOptions{ConfigPath: configPath}, cmd.OutOrStdout()); err != nil { return fmt.Errorf("sync: %w", err) } return nil }, } cmd.Flags().StringVar(&configPath, "config", "", "client config path (default: "+client.ConfigEnv+" env or platform default)") return cmd }