| 162 | } |
| 163 | |
| 164 | func validateScanOptions(opts *scanOptions) error { |
| 165 | if err := validateAudience(opts.audience); err != nil { |
| 166 | return err |
| 167 | } |
| 168 | normalizedFormat, err := validateOutputFormat(opts.outputFormat) |
| 169 | if err != nil { |
| 170 | return err |
| 171 | } |
| 172 | opts.outputFormat = normalizedFormat |
| 173 | if opts.maxTools < 0 { |
| 174 | return fmt.Errorf("--max-tools must be a non-negative integer (0 means use template default)") |
| 175 | } |
| 176 | if opts.maxGitProcs < 0 { |
| 177 | return fmt.Errorf("--max-git-procs must be a non-negative integer (0 means use default 16)") |
| 178 | } |
| 179 | if opts.maxTokens < 0 { |
| 180 | return fmt.Errorf("--max-tokens must be a non-negative integer (0 means use configured or template default)") |
| 181 | } |
| 182 | if opts.preview && opts.resume != "" { |
| 183 | return fmt.Errorf("--preview and --resume cannot be used together") |
| 184 | } |
| 185 | if opts.maxTokensBudget < 0 { |
| 186 | return fmt.Errorf("--max-tokens-budget must be a non-negative integer (0 means unlimited)") |
| 187 | } |
| 188 | return nil |
| 189 | } |
| 190 | |
| 191 | func validateDelegateOptions(opts *delegateOptions) error { |
| 192 | if err := validateDiffMode(opts.from, opts.to, opts.commit); err != nil { |