diff --git a/pkg/cli/root.go b/pkg/cli/root.go index f69f369d83..6de4283905 100644 --- a/pkg/cli/root.go +++ b/pkg/cli/root.go @@ -11,6 +11,13 @@ import ( "github.com/replicate/cog/pkg/util/console" ) +func init() { + // Allow child commands to define their own PersistentPreRun hooks + // without shadowing the root command's. Cobra will invoke them in + // order from root → child. + cobra.EnableTraverseRunHooks = true +} + func NewRootCommand() (*cobra.Command, error) { rootCmd := cobra.Command{ Use: "cog", diff --git a/pkg/cli/weights.go b/pkg/cli/weights.go index 15565341c4..de9c1941a4 100644 --- a/pkg/cli/weights.go +++ b/pkg/cli/weights.go @@ -20,10 +20,18 @@ import ( func newWeightsCommand() *cobra.Command { cmd := &cobra.Command{ - Use: "weights", - Short: "Manage model weights", - Long: "Commands for managing model weight files.", + Use: "weights", + Short: "Manage model weights (experimental)", + Long: `Commands for managing model weight files. + +NOTE: cog weights is experimental. Behavior may change in future versions. +Do not rely on it in production workflows.`, Hidden: true, + PersistentPreRun: func(cmd *cobra.Command, args []string) { + console.Warnf("NOTE: cog weights is experimental. Behavior may change in future versions.") + console.Warnf("Do not rely on it in production workflows.") + console.Info("") + }, } cmd.AddCommand(newWeightsImportCommand())