diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-05-20 19:10:53 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-05-20 19:10:53 +0000 |
| commit | bf5ea107f6aec57c1fc3d094cd42aef239d46f15 (patch) | |
| tree | 5d0eced26b1e6435287838f6823007f5be951877 | |
| parent | 68399a598924775a3ec22a39c2336ae497fb07f3 (diff) | |
fix: auto-load default config file and relax repository_url requirement
root.go: PersistentPreRunE was only reading the config file when --config
was explicitly passed. This left LocalModel.Endpoint empty so the local
runner was never registered and the Classifier overrode agent.type:local.
Now always tries ~/.claudomator/config.toml; silently ignores ENOENT.
validator.go: repository_url was unconditionally required but is irrelevant
for LocalRunner tasks (pure chat completions). The executor already handles
an empty RepositoryURL via the Project registry lookup at dispatch time.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rw-r--r-- | internal/cli/root.go | 19 | ||||
| -rw-r--r-- | internal/task/validator.go | 3 |
2 files changed, 14 insertions, 8 deletions
diff --git a/internal/cli/root.go b/internal/cli/root.go index e57a9d9..2cc8f71 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -38,18 +38,27 @@ func NewRootCmd() *cobra.Command { cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "verbose output") // Re-derive DBPath and LogDir after flags are parsed, so --data-dir takes effect. - // If --config is provided, load that file first; explicit CLI flags override it. + // Load config file: explicit --config flag, then default location, then defaults-only. cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error { - if cfgFile != "" { + filePath := cfgFile + if filePath == "" { + home, _ := os.UserHomeDir() + filePath = filepath.Join(home, ".claudomator", "config.toml") + } + + if filePath != "" { // Save values set by explicit CLI flags before overwriting cfg from file. flagDataDir := cfg.DataDir flagClaudeBin := cfg.ClaudeBinaryPath - loaded, err := config.LoadFile(cfgFile) - if err != nil { + loaded, err := config.LoadFile(filePath) + if err != nil && cfgFile != "" { + // Only hard-fail if the file was explicitly specified. return err } - *cfg = *loaded + if err == nil { + *cfg = *loaded + } if cmd.Flags().Changed("data-dir") { cfg.DataDir = flagDataDir diff --git a/internal/task/validator.go b/internal/task/validator.go index 43e482e..003fab9 100644 --- a/internal/task/validator.go +++ b/internal/task/validator.go @@ -29,9 +29,6 @@ func Validate(t *Task) error { if t.Name == "" { ve.Add("name is required") } - if t.RepositoryURL == "" { - ve.Add("repository_url is required") - } if t.Agent.Instructions == "" { ve.Add("agent.instructions is required") } |
