Skip to main content

Crate gonzalo_cli

Crate gonzalo_cli 

Source
Expand description

Command implementations for the gonzalo admin CLI.

Structs§

Debouncer
Coalesces a burst of filesystem change notifications so a rapid series of edits triggers a single re-index rather than one per event. The clock is injected (now), so the logic is deterministic and unit-testable without real sleeps — the seam the watcher loop drives with Instant::now().
GcSummary
Summary returned by gc.
Horizon
A collection horizon as the operator typed it, plus its parsed value, so command output can echo the horizon it used (spec §3.10, §8.2).
IgnoredCounts
How many paths a walk declined to index.
IndexFilter
Decides which repo-relative paths are eligible for indexing.
IndexOptions
The optional knobs of an indexing run (#331).
IndexSummary
Summary returned by index.
MigrateSummary
Summary returned by migrate.
SourceFiles
What a full walk found: the parseable files, plus what was excluded on purpose and what gonzalo has no grammar for.
SyncSummary
Summary returned by sync_stores.
TicketSyncReport
Per-connection ingest result.
UnindexedCounts
Files seen during a walk but not parsed, because their extension names no language gonzalo knows.
WatchConfig
Timing knobs for watch.

Enums§

DeleteOutcome
Outcome of delete.
ParseMode
How an index run will parse.
WorkerSource
Where a parse worker was found.

Constants§

CLI_AUTHOR
The identity the CLI stamps on records it writes. Matches migrate above (which uses this constant) and the ticket sync --author default. The CLI opens only FsStore, which honours a named deleter; over a daemon, spec §3.6 applies instead and a non-admin token is stamped as itself.
EXIT_CONFLICT
Exit code for a write conflict (delete with a stale --expected, or reset leaving any record live). Distinct from 1 (error, via anyhow) and 2 (usage error, via clap), so automation can tell “retry” from “broken” (spec §3.10).

Functions§

collect
Purge tombstones at least horizon old via [gonzalo_core::collect]. namespace == None collects across the whole store.
delete
Delete one record by writing a tombstone attributed to CLI_AUTHOR (spec §3.1–§3.2). Deleting an absent or already-deleted key is Deleted.
gc
Sweep unreferenced blobs from the store at root (gonzalo#292).
get
Fetch a single record, or None if it does not exist.
index
Index the source files under src into the (repo, view) code-graph view: parse each file into a content-addressed slice, then reconcile the view’s manifest to the tree (ADR 0012). Re-running updates the view.
index_with
index, with control over which paths enter the view.
index_with_gc
index_with_options for the common case: default filter, resolved parse worker, and the sweep governed by gc_after / min_age.
index_with_options
index the (repo, view) view, then — when opts.gc_after — sweep unreferenced blobs. The opt-in post-index trigger of gonzalo#104: the sweep runs only after a successful index and always goes through gc, which marks against every record in the store (never a per-view subset), so a slice the just-indexed view dropped but another view still references is preserved.
index_with_worker
index_with, with the parse worker pinned rather than resolved.
list
Return all record keys in the store, optionally filtered by namespace / collection.
migrate
Recursively import every file under src as a record in the fs store at root. Idempotent: if the key already exists, skip it.
named_skips
Skipped paths for the index summary, bounded, with a count of what was left out so a tree full of crashes does not become a wall of text.
open_store
Open the fs store at root with an explicit ancestor cap (spec §3.9). A cap of 0 is rejected here, before any record is touched.
parse_duration
Parse a duration of one positive whole number followed by exactly one unit: d, h, m or s (e.g. 30d, 12h). Hand-rolled on purpose. The workspace has no humantime, and a horizon never needs compound or fractional forms.
parse_horizon
clap value parser for --older-than.
parse_revision
clap value parser for --expected: a revision as JSON, exactly as gonzalo get prints it, e.g. {"counter":1,"hash":"…"}.
purge
Physically remove the tombstone at namespace/collection/id, discarding the restore window it holds.
reset
Tombstone every live record in namespace (optionally one collection) via gonzalo_core::reset_as, attributing each tombstone to CLI_AUTHOR.
reset_exit_code
The process exit code for a finished reset: 0 with no conflicts, EXIT_CONFLICT otherwise (re-run to finish, spec §3.10).
resolve_parse_worker
Locate the gonzalo-parse-worker binary for crash-isolated parsing: the GONZALO_PARSE_WORKER override, else a sibling of the current executable, else PATH. Falls back to in-process parsing when none of those has one — reporting where it looked (#212).
status
Count of records grouped by "namespace/collection".
sync_exit_code
The process exit code for a finished sync: 0 when it converged with no conflicts, EXIT_CONFLICT when it reports conflicts to resolve or gave up before converging. Both are recoverable outcomes a script retries or acts on, matching delete, reset and collect (#290).
sync_stores
Sync two filesystem stores via [gonzalo_core::sync], at the default ancestor cap.
sync_stores_with_cap
sync_stores with an explicit ancestor cap for both stores (spec §3.9).
ticket_move
Move a board card to the column for category. Selects the connection named connection, or the sole connection if there is exactly one.
ticket_sync
Load the ticket config, build each connection’s source, and ingest its tickets into the fs store at root.
undelete
Restore the record at namespace/collection/id from its tombstone.
watch
Watch src and keep the (repo, view) code-graph view in sync until Ctrl-C. Runs one index up front, then re-indexes on a debounced burst of filesystem changes and on a periodic full-reconcile tick. Long-running: returns Ok(()) on graceful shutdown.