Documentation
¶
Index ¶
- Constants
- Variables
- func CI(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Delete(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Demo(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Describe(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Diff(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Docs(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Drop(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Insert(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Install() *cobra.Command
- func List(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Materialize(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func NewSkillsConfig(currentVersion string) (skillsync.Config, error)
- func NewUninstallCommand() *cobra.Command
- func NewValidationFailedError(err error) error
- func Pull(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Rebase(getWd func() (string, error), ...) *cobra.Command
- func Resolve(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func ResolveDBPathArgs(dirPath string, homeDir func() (string, error), getWd func() (string, error)) (string, error)
- func Select(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func SelfUpdate(ver string) *cobra.Command
- func Setup() *cobra.Command
- func Skills(currentVersion string) *cobra.Command
- func Uninstall() *cobra.Command
- func Update(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- func Upgrade(ver string) *cobra.Command
- func Validate(homeDir func() (string, error), getWd func() (string, error), ...) *cobra.Command
- type GitHubDBFactory
- type GitHubFileReaderFactory
- type TreeWriterFactory
- type ViewBuilderFactory
Constants ¶
const SelfUpdateAvailableExitCode = 10
SelfUpdateAvailableExitCode is the `self-update --check` exit code for "an update is available" (or the running version is undetermined). It is distinct from 0 (up to date) and from the CLI's generic error exit 1 — unchanged from the old internal self-update package this replaces. Exported so main.go's process-exit-code mapping can recognize ErrSelfUpdateAvailable.
const ValidationFailedExitCode = 2
ValidationFailedExitCode is returned when the validate command completed and found that the repository does not satisfy its InGitDB definition.
Variables ¶
var ErrSelfUpdateAvailable = errors.New("update available")
ErrSelfUpdateAvailable identifies a `self-update --check` outcome that found a newer release, or an undetermined running version, separately from other self-update and CLI failures, so the process boundary can select SelfUpdateAvailableExitCode (cli-install#req:host-owned-exit-codes).
var ErrValidationFailed = errors.New("repository validation failed")
ErrValidationFailed identifies repository validation findings separately from command configuration, I/O, startup, and other runtime failures.
Functions ¶
func CI ¶ added in v0.37.4
func CI( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), viewBuilder materializer.ViewBuilder, logf func(...any), ) *cobra.Command
CI returns the ci command. Currently it executes materialize; future versions may add CI-specific optimisations such as validating and materializing only the collections affected by a pull-request diff.
func Delete ¶
func Delete( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), newDB func(string, *ingitdb.Definition) (dal.DB, error), logf func(...any), ) *cobra.Command
Delete returns the `ingitdb delete` command. Two modes inherited from sqlflags: single-record (--id) and set (--from + --where|--all). --min-affected guards set-mode invocations with all-or-nothing destructive atomicity: when the matched count is below the threshold, NO record is deleted.
This command replaces the legacy `delete record`, `delete records`, `delete collection`, and `delete view` subcommands. Per cli-sql-verbs Idea: when a new verb's name collides with an old top-level command, the legacy parent is removed in the same release.
func Demo ¶ added in v0.66.0
func Demo( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), newDB func(string, *ingitdb.Definition) (dal.DB, error), ) *cobra.Command
Demo returns the `demo` command group. Without a subcommand it prints its help, listing `install`.
func Describe ¶ added in v0.65.0
func Describe( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), ) *cobra.Command
Describe returns the `ingitdb describe` command. Two kinds are supported: `describe collection <name>` (alias `table`) and `describe view <name>` (with `--in=<collection>` to disambiguate). `desc` is registered as a top-level alias for `describe`.
func Diff ¶ added in v0.65.0
func Diff( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), logf func(...any), exitCode func(int), ) *cobra.Command
Diff returns the diff command. exitCode is the process-exit seam (os.Exit in production, captured in tests): the command exits 1 when changes are found, 0 otherwise.
func Docs ¶ added in v0.26.0
func Docs( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), logf func(...any), ) *cobra.Command
Docs returns the docs command.
func Drop ¶ added in v0.64.0
func Drop( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), newDB func(string, *ingitdb.Definition) (dal.DB, error), logf func(...any), ) *cobra.Command
Drop returns the `ingitdb drop` command. Two kinds are supported: `drop collection <name>` and `drop view <name>`. The flags --if-exists (idempotent on missing target) and --cascade (no-op in the current data model; reserved for future cross-object dependency graphs) are inherited by both subcommands.
func Insert ¶ added in v0.61.0
func Insert( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), newDB func(string, *ingitdb.Definition) (dal.DB, error), logf func(...any), stdin io.Reader, isStdinTTY func() bool, openEditor func(string) error, ) *cobra.Command
Insert returns the `ingitdb insert` command.
Required: --into=<collection>. Exactly one data source: --data, stdin (when not a TTY), --edit (opens $EDITOR), or --empty (key-only record). Record key comes from --key or a top-level $id field in the data; supplying both with different values is rejected.
func Install ¶ added in v0.67.0
Install returns the "install" command, built from github.com/strongo/cli-helpers/cliinstall/cobracmd against ingitdb's own catalog id (cli-install#req:host-identity-from-catalog). `ingitdb install` lists the fleet CLIs relevant to ingitdb (datatug, ovdb, synchestra, specscore) with their live status, and `ingitdb install <name>...` installs them the same way ingitdb itself was installed. cobracmd.New panics if "ingitdb" is absent from the compiled catalog — a programming error TestInstall_Registration and TestSelfUpdate_PanicsWhenCatalogEntryMissing's sibling below both catch, never a runtime state a user sees.
func List ¶
func List( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), ) *cobra.Command
List returns the list command.
func Materialize ¶
func Materialize( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), viewBuilder materializer.ViewBuilder, logf func(...any), ) *cobra.Command
Materialize returns the materialize command.
func NewSkillsConfig ¶ added in v0.68.0
NewSkillsConfig builds the skillsync.Config for embedded inGitDB skills.
func NewUninstallCommand ¶ added in v0.68.0
NewUninstallCommand returns the "uninstall" command built from cliinstall/cobracmd.
func NewValidationFailedError ¶ added in v0.65.13
NewValidationFailedError preserves a human-readable finding while making it possible for the process boundary to select ValidationFailedExitCode.
func Pull ¶
func Pull( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), viewBuilder materializer.ViewBuilder, logf func(...any), isTerminal func() bool, runConflictsTUI func(context.Context, []string) error, ) *cobra.Command
Pull returns the pull command. It runs `git pull` with the chosen strategy, delegates conflict resolution to the shared working-tree engine, rebuilds materialized views, and prints a summary of the record changes the pull brought in.
func Resolve ¶
func Resolve( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), logf func(...any), isTerminal func() bool, runConflictsTUI func(ctx context.Context, files []string) error, ) *cobra.Command
Resolve returns the resolve command. It is the working-tree conflict engine: it auto-resolves merge conflicts in generated files (collection README.md) by regenerating them from source records and staging them, independent of which git operation produced the conflict. Source-data conflicts that need a human decision are handed to runConflictsTUI (interactive) on a terminal, or reported as text otherwise.
func ResolveDBPathArgs ¶ added in v0.52.0
func ResolveDBPathArgs( dirPath string, homeDir func() (string, error), getWd func() (string, error), ) (string, error)
ResolveDBPathArgs resolves a database directory path from an explicit dirPath string (e.g. from a --path flag already read by the caller), falling back to getWd when dirPath is empty. Home-directory expansion ("~") is applied via homeDir.
func Select ¶ added in v0.60.0
func Select( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), newDB func(string, *ingitdb.Definition) (dal.DB, error), logf func(...any), ) *cobra.Command
Select returns the `ingitdb select` command. It queries records from a single collection in either single-record mode (--id) or set mode (--from with optional --where/--order-by/--fields/--limit/--min-affected). Output format defaults to yaml in single-record mode and csv in set mode.
func SelfUpdate ¶ added in v0.65.0
SelfUpdate returns the "self-update" command, built from github.com/strongo/cli-helpers/selfupdate/cobracmd against ingitdbSelfUpdateConfig's identity.
Note: there is deliberately no "update" alias — `ingitdb update` is the SQL UPDATE verb command.
func Uninstall ¶ added in v0.68.0
Uninstall returns the "uninstall" command built from cliinstall/cobracmd.
func Update ¶ added in v0.9.0
func Update( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), newDB func(string, *ingitdb.Definition) (dal.DB, error), logf func(...any), ) *cobra.Command
Update returns the `ingitdb update` command. Two modes inherited from sqlflags: single-record (--id) and set (--from + --where|--all). Patch operations: --set (repeatable assignment) and --unset (comma-separated field list). Shallow patch at the top level. --min-affected guards set-mode invocations with all-or-nothing semantics.
func Upgrade ¶ added in v0.67.0
Upgrade returns the "upgrade" command, built from github.com/strongo/cli-helpers/cliinstall/cobracmd against ingitdb's own catalog id. HostConfig comes from the exact same ingitdbSelfUpdateConfig helper SelfUpdate uses, so `ingitdb self-update` and `ingitdb upgrade ingitdb` reach the exact same library call (cli-install#req:self-update-equals-upgrade-self). No "update" alias: `ingitdb update` is, and stays, the SQL UPDATE verb command (cli-install#req:update-alias-policy: "ingitdb MUST NOT gain one, because its `update` command edits records").
func Validate ¶
func Validate( homeDir func() (string, error), getWd func() (string, error), readDefinition func(string, ...ingitdb.ReadOption) (*ingitdb.Definition, error), dataVal datavalidator.DataValidator, incVal datavalidator.IncrementalValidator, logf func(...any), ) *cobra.Command
Validate returns the validate command.
Types ¶
type GitHubDBFactory ¶ added in v0.14.0
type GitHubDBFactory interface {
NewGitHubDBWithDef(cfg dalgo2ghingitdb.Config, def *ingitdb.Definition) (dal.DB, error)
}
GitHubDBFactory creates a GitHub-backed DAL database.
type GitHubFileReaderFactory ¶ added in v0.14.0
type GitHubFileReaderFactory interface {
NewGitHubFileReader(cfg dalgo2ghingitdb.Config) (dalgo2ghingitdb.FileReader, error)
}
GitHubFileReaderFactory creates a GitHub file reader.
type TreeWriterFactory ¶ added in v0.65.0
type TreeWriterFactory interface {
NewTreeWriter(cfg dalgo2ghingitdb.Config) (treeWriter, error)
}
TreeWriterFactory creates a treeWriter for atomic multi-file commits.
type ViewBuilderFactory ¶ added in v0.14.0
type ViewBuilderFactory interface {
ViewBuilderForCollection(colDef *ingitdb.CollectionDef) (materializer.ViewBuilder, error)
}
ViewBuilderFactory creates a view builder for a collection.
Source Files
¶
- ci.go
- cobra_helpers.go
- conflict_resolver.go
- delete.go
- demo.go
- demo_install.go
- demo_output.go
- demo_schema.go
- describe.go
- describe_format.go
- describe_output.go
- diff.go
- docs.go
- docs_update.go
- drop.go
- drop_remote.go
- drop_schema.go
- editor.go
- flags.go
- github_helpers.go
- insert.go
- insert_batch.go
- insert_context.go
- install.go
- list.go
- materialize.go
- materialize_selection.go
- pull.go
- query_output.go
- rebase.go
- record_context.go
- record_merge_resolver.go
- record_projection.go
- recordset_read.go
- remote_helpers.go
- resolve.go
- seams.go
- select.go
- select_output.go
- select_where.go
- self_update.go
- setup.go
- skills.go
- subcollection_path.go
- uninstall.go
- update_new.go
- upgrade.go
- validate.go
- validation_failure.go
- view_builder_helper.go