Documentation
¶
Overview ¶
Package quality provides the command to run code quality checks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var QualityCmd = &cobra.Command{ Use: "quality", Example: ` contextvibes product quality`, Args: cobra.NoArgs, SilenceUsage: true, SilenceErrors: true, RunE: func(cmd *cobra.Command, _ []string) error { presenter := ui.NewPresenter(cmd.OutOrStdout(), cmd.ErrOrStderr()) ctx := cmd.Context() presenter.Summary("Running Code Quality Pipeline") cwd, err := os.Getwd() if err != nil { return fmt.Errorf("failed to get working directory: %w", err) } projType, err := project.Detect(cwd) if err != nil { return fmt.Errorf("failed to detect project type: %w", err) } presenter.Info("Detected project type: %s", presenter.Highlight(string(projType))) presenter.Newline() runner := pipeline.NewRunner(presenter, globals.ExecClient) var checks []pipeline.Check switch projType { case project.Go: checks = []pipeline.Check{ &pipeline.GoModTidyCheck{}, &pipeline.GoVetCheck{}, &pipeline.GolangCILintCheck{}, &pipeline.GoVulnCheck{}, &pipeline.GitleaksCheck{}, &pipeline.DeadcodeCheck{}, } case project.Terraform, project.Pulumi, project.Python, project.Unknown: fallthrough default: presenter.Info("No specific quality checks configured for %s.", projType) return nil } results, err := runner.Run(ctx, checks) if err != nil || hasWarnings(results) { if genErr := generateContextFile(results); genErr != nil { presenter.Error("Failed to generate context file: %v", genErr) } else { presenter.Newline() presenter.Info("Generated AI Context: %s", contextFile) presenter.Advice("Pass this file to your AI to fix the issues.") } } else { if _, err := os.Stat(contextFile); err == nil { if removeErr := os.Remove(contextFile); removeErr == nil { presenter.Info("Removed stale AI Context file: %s (all checks passed)", contextFile) } } } if err != nil { presenter.Error("Pipeline failed.") return err } presenter.Success("All quality checks passed.") return nil }, }
QualityCmd represents the quality command.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.