From ceb5ec3ce183b88ea241b59051027421f8026190 Mon Sep 17 00:00:00 2001 From: jonathanpopham Date: Thu, 9 Apr 2026 18:04:13 -0400 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20rootCmd=20args=20parsed=20as=20direc?= =?UTF-8?q?tory=20path=20=E2=80=94=20breaks=20watch=20cache=20loading?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rootCmd accepted MaximumNArgs(1) and used args[0] as the working directory. Since watch is the default behavior on rootCmd (not a subcommand), running `supermodel` with any trailing token would use that token as the directory. This caused the daemon to create and read from a wrong directory (e.g. ./watch/.supermodel/shards.json instead of ./.supermodel/shards.json). Fix: switch to NoArgs and add an explicit --dir flag. This matches the pattern used by all other subcommands that accept a directory. Fixes #108 --- cmd/root.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 60093ca..e05f738 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -40,7 +40,7 @@ enters daemon mode. Listens for file-change notifications from the Press Ctrl+C to stop and remove graph files. See https://supermodeltools.com for documentation.`, - Args: cobra.MaximumNArgs(1), + Args: cobra.NoArgs, SilenceUsage: true, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { // Walk up to the root command name to get the subcommand. @@ -68,10 +68,7 @@ See https://supermodeltools.com for documentation.`, if err := cfg.RequireAPIKey(); err != nil { return err } - dir := "." - if len(args) > 0 { - dir = args[0] - } + dir := watchDir opts := shards.WatchOptions{ CacheFile: watchCacheFile, Debounce: watchDebounce, @@ -84,6 +81,7 @@ See https://supermodeltools.com for documentation.`, } var ( + watchDir string watchCacheFile string watchDebounce time.Duration watchNotifyPort int @@ -92,6 +90,7 @@ var ( ) func init() { + rootCmd.Flags().StringVar(&watchDir, "dir", ".", "project directory") rootCmd.Flags().StringVar(&watchCacheFile, "cache-file", "", "override cache file path") rootCmd.Flags().DurationVar(&watchDebounce, "debounce", 2*time.Second, "debounce duration before processing changes") rootCmd.Flags().IntVar(&watchNotifyPort, "notify-port", 7734, "UDP port for hook notifications") From b8b642a8b4c1e830a8d7508f0a241f0f393e89ac Mon Sep 17 00:00:00 2001 From: jonathanpopham Date: Thu, 9 Apr 2026 18:08:46 -0400 Subject: [PATCH 2/2] fix: remove stale [path] from Use string per CodeRabbit --- cmd/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/root.go b/cmd/root.go index e05f738..0414980 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -31,7 +31,7 @@ var noConfigCommands = map[string]bool{ } var rootCmd = &cobra.Command{ - Use: "supermodel [path]", + Use: "supermodel", Short: "Give your AI coding agent a map of your codebase", Long: `Runs a full generate on startup (using cached graph if available), then enters daemon mode. Listens for file-change notifications from the