MCPcopy Create free account
hub / github.com/alibaba/open-code-review / registerScanFlags

Function registerScanFlags

cmd/opencodereview/shared_flags.go:185–208  ·  view source on GitHub ↗

registerScanFlags registers all scan command flags on cmd, binding to opts.

(cmd *cobra.Command, opts *scanOptions)

Source from the content-addressed store, hash-verified

183
184// registerScanFlags registers all scan command flags on cmd, binding to opts.
185func registerScanFlags(cmd *cobra.Command, opts *scanOptions) {
186 addToolsFlag(cmd, &opts.toolConfigPath)
187 addRuleFlag(cmd, &opts.rulePath)
188 addRepoFlag(cmd, &opts.repoDir)
189 cmd.Flags().StringVar(&opts.paths, "path", "", "comma-separated repo-relative directories or files to scan (default: whole repo)")
190 addExcludeFlag(cmd, &opts.excludes)
191 addOutputFlags(cmd, &opts.outputFormat, &opts.audience)
192 cmd.Flags().IntVar(&opts.concurrency, "concurrency", 8, "max concurrent file scans")
193 cmd.Flags().IntVar(&opts.perFileTimeout, "timeout", 10, "concurrent task timeout in minutes")
194 cmd.Flags().IntVar(&opts.maxTools, "max-tools", 0, "max tool call rounds per file; only takes effect when greater than template default")
195 cmd.Flags().IntVar(&opts.maxGitProcs, "max-git-procs", 16, "max concurrent git subprocesses")
196 cmd.Flags().IntVar(&opts.maxTokens, "max-tokens", 0, "per-file prompt token ceiling (0 = configured or template default)")
197 cmd.Flags().IntVar(&opts.maxTokensBudget, "max-tokens-budget", 0, "cap total token usage; dispatch stops once exceeded (0 = unlimited)")
198 cmd.Flags().StringVarP(&opts.background, "background", "b", "", "optional requirement/business context for the scan")
199 cmd.Flags().BoolVarP(&opts.preview, "preview", "p", false, "preview which files will be scanned without running the LLM")
200 cmd.Flags().BoolVar(&opts.noPlan, "no-plan", false, "skip the per-file PLAN_TASK pre-pass")
201 cmd.Flags().BoolVar(&opts.noDedup, "no-dedup", false, "skip the per-batch DEDUP_TASK")
202 cmd.Flags().BoolVar(&opts.noSummary, "no-summary", false, "skip the post-run PROJECT_SUMMARY_TASK")
203 cmd.Flags().StringVar(&opts.batch, "batch", "", "override BATCH_STRATEGY: none | by-language | by-directory")
204 addProviderFlag(cmd, &opts.provider)
205 addModelFlag(cmd, &opts.model)
206 cmd.Flags().StringVar(&opts.resume, "resume", "", "resume from a previous scan session id")
207 cmd.RegisterFlagCompletionFunc("batch", completeEnum("none", "by-language", "by-directory"))
208}
209
210// registerDelegateFlags registers all delegate shared flags on cmd, binding to opts.
211func registerDelegateFlags(cmd *cobra.Command, opts *delegateOptions) {

Callers 2

parseScanFlagsFunction · 0.85
initFunction · 0.85

Calls 8

addToolsFlagFunction · 0.85
addRuleFlagFunction · 0.85
addRepoFlagFunction · 0.85
addExcludeFlagFunction · 0.85
addOutputFlagsFunction · 0.85
addProviderFlagFunction · 0.85
addModelFlagFunction · 0.85
completeEnumFunction · 0.85

Tested by 1

parseScanFlagsFunction · 0.68