Documentation
¶
Overview ¶
Package cmdutil provides shared helpers for CLI command implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyWritten = errors.New("error already written to output")
ErrAlreadyWritten signals that a JSON error envelope was already written.
Functions ¶
func LoadRegistry ¶
LoadRegistry loads only the type registry from a vault's .vaultmind/config.yaml without opening the index database. Use this when you need schema information (e.g., for live validation) but not the index itself.
Types ¶
type VaultDB ¶
type VaultDB struct {
DB *index.DB
Config *vault.Config
Reg *schema.Registry
// contains filtered or unexported fields
}
VaultDB bundles the commonly needed vault resources.
func OpenVaultDB ¶
OpenVaultDB loads config, opens the index DB, and creates the type registry.
func OpenVaultDBOrWriteErr ¶
OpenVaultDBOrWriteErr opens the vault DB. On failure with --json set, writes a JSON error envelope and returns ErrAlreadyWritten.
When no vault was named — no --vault, no VAULTMIND_VAULT — the path is whatever discovery fell back to, normally the working directory. Opening a non-vault directory in that case is wrong twice over: the command answers from a vault the user never chose (reporting "ok" and zero hits, which reads as "your vault has nothing on this" rather than "you have no vault"), and OpenVaultDB CREATES .vaultmind/index.db there on the way — quietly promoting that directory to a vault that every future walk-up will find. So a guessed path must prove it is already a vault before it is opened, while a named one keeps the permissive behaviour that lets any directory serve as a vault.
func (*VaultDB) GetIndexHash ¶
GetIndexHash returns the cached SHA-256 hash of the SQLite database file.