Documentation
¶
Overview ¶
Package cli implements the operator command set behind cmd/sigil: contract export, migration status, planning, apply and SQL export, deployment diagnostics and bounded expired-row cleanup. It is an operator tool, never a runtime component, and it never serves authentication traffic.
The package is embeddable so a host that compiles its own plugins can build an operator binary that sees them: construct a Tool with the host's plugin definitions and call Run from main. The API is experimental until the alpha release stabilizes it.
No command prints a connection string, a secret value or a driver error. Database failures are reported through the documented storage diagnostics and the PostgreSQL server log holds the details.
Index ¶
Constants ¶
const ( ExitOK = 0 // success; for status and check, the schema is current and nothing failed ExitFailure = 1 // the operation failed or a finding needs operator investigation ExitUsage = 2 // unknown command, flag or plugin ExitPending = 3 // nothing is broken, but migrations must be applied (status, check, cleanup) )
Process exit codes shared by every command.
const ( DatabaseEnv = "SIGIL_DATABASE_URL" // connection string when --database is absent SecretEnv = "SIGIL_SECRET" // default deployment secret checked by sigil check )
Environment variables the tool reads. Their values are never printed.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Plugin ¶
type Plugin struct {
Definition plugin.Definition
Prune func(ctx context.Context, store storage.Store, before time.Time, limit int) (int64, error)
}
Plugin is a compiled plugin the tool knows. Its Definition supplies the --plugin identifier, the contract and the schema declarations; it needs no bound runtime and its handlers are never invoked. Prune, when set, removes the plugin's expired rows during cleanup with the same bounds as the core pruner; it must never remove a row that could still authenticate.
type Tool ¶
type Tool struct {
Plugins []Plugin
Version string // build identifier printed by version; "dev" when empty
Getenv func(string) string // environment lookup; os.Getenv when nil
}
Tool is the operator command set over a fixed set of known plugins. The zero value knows no plugins and reads the process environment.