cli

package
v0.39.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

README

CLI Module

CLI adapter layer for the DeltaScope application.

Files

File Responsibility
cli.go Bridges process execution into the testable CLI executor
root.go Builds the Cobra root command, shared CLI option state, and stable error/exit-code mapping
audit.go Implements the audit subcommand, SQL input loading, interactive stdin hinting, MySQL-style connection flag parsing, password/password-env/password-file resolution, password prompting, quiet/normal rendering, and fail-threshold logic
audit_metadata.go Bridges CLI metadata-aware options into the shared metadata-preparation flow and MySQL-compatible client opener
rules.go Implements rules list, rules show, and rules search on top of the shipped rule catalog, including ASCII table rendering for list/search output
config.go Implements the config command group, including lint and show-default validation/inspection flows
config_init.go Implements config init and emits a deterministic default YAML template
capabilities.go Implements the capabilities summary command and shared rendering helpers for human/agent discovery of shipped dialects, modes, inputs, outputs, and public surfaces (cli, http, mcp, go-api)
capability_surface.go Defines the pure-Go build capability surface and root CLI wording
capability_surface_pg.go Defines the PostgreSQL-tagged build capability surface and root CLI wording
version.go Implements the version subcommand with ASCII logo plus build-version and supported-dialect output
cli_test.go Verifies input modes, connection/password UX, exit-code behavior, capability/version wording surfaces, audit context output, and explanation rendering in Markdown/JSON results
audit_metadata_test.go Verifies metadata-aware CLI wiring for dialect detection, schema inference, and create-table partial behavior

Exports

  • Run()
  • Execute(ctx, args, stdin, stdout, stderr) int

Dependencies

  • Upstream: cmd/deltascope
  • Downstream: bufio, database/sql, internal/application/audit, internal/application/auditmeta, internal/domain/policy, internal/domain/report, internal/domain/spec, internal/infrastructure/config/viper, internal/infrastructure/metadata/mysql, internal/infrastructure/output/json, internal/infrastructure/output/markdown, internal/interfaces/metadata, github.com/spf13/cobra, golang.org/x/term

Notes

  • deltascope --version prints the build version plus compiled dialect surface.
  • deltascope version prints the ASCII logo plus the build version and compiled dialect surface.

Update Rule

  • If members/interfaces/dependencies change, update this file in same change.

Documentation

Overview

Package cli exposes the command-line adapter for DeltaScope. input: audit command flags, SQL text from flags/files/stdin, password source/prompt dependencies, and application audit services output: rendered audit results, connection-option validation, password resolution, and exit-code mapping for CLI audit invocations pos: CLI audit command implementation above the application service and output renderers note: if this file changes, update this header and module README.md.

Package cli exposes the command-line adapter for DeltaScope. input: metadata-aware audit connection options, SQL text, and metadata provider clients output: resolved dialect/schema context and provider wiring for metadata-aware CLI audits pos: CLI metadata-aware audit preparation between command flags and application requests note: if this file changes, update this header and module README.md.

Package cli exposes the command-line adapter for DeltaScope. input: capability command invocations plus shipped product-surface metadata output: stable human-readable summaries of supported dialects, modes, inputs, outputs, and shipped surfaces across CLI, HTTP, MCP, and Go API entrypoints pos: CLI capability discovery command above the current shipped product surface note: if this file changes, update this header and module README.md.

Package cli exposes the command-line adapter for DeltaScope. input: process control from cmd/deltascope and Cobra command execution requests output: executable CLI behavior and stable process exit codes for local audits pos: interface adapter between process entrypoint and application services note: if this file changes, update this header and module README.md.

Package cli exposes the command-line adapter for DeltaScope. input: config command invocations, YAML files, and built-in default policy metadata output: config lint results plus stable default-config rendering for CLI users and automation pos: CLI config command group for policy inspection and validation note: if this file changes, update this header and module README.md.

Package cli exposes the command-line adapter for DeltaScope. input: config init command invocations and the built-in default policy model output: a usable YAML policy template for local users and automation pos: CLI config generation command for bootstrapping DeltaScope policy files note: if this file changes, update this header and module README.md.

Package cli exposes the command-line adapter for DeltaScope. input: Cobra command construction inputs, process-like stdin/stdout/stderr dependencies, and shared CLI option state output: root command wiring for audit, rules, config, capabilities, and version subcommands pos: CLI command assembly and shared option definitions note: if this file changes, update this header and module README.md.

Package cli exposes the command-line adapter for DeltaScope. input: rule catalog queries, CLI filters, and stdout/stderr command surfaces output: shipped-rule list, detail, and search rendering for CLI discovery workflows pos: CLI rule catalog command group above the explanation-oriented domain catalog note: if this file changes, update this header and module README.md.

Package cli exposes the command-line adapter for DeltaScope. input: version command invocations and the build-time version variable output: a stable printable version string for users and scripts pos: CLI metadata command implementation note: if this file changes, update this header and module README.md.

Index

Constants

This section is empty.

Variables

Version is the build version printed by the version command.

Functions

func Execute

func Execute(ctx context.Context, args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) int

Execute runs the CLI using the supplied process-like dependencies.

func Run

func Run()

Run executes the CLI against the current process environment and exits.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL