cli
gest.| Name | Summary |
|---|---|
commands |
Subcommand implementations for the gest CLI. |
limit |
Shared --limit flag for list commands. |
meta_args |
Shared --metadata / --metadata-json flag parsing for create/update commands. |
prompt |
Shared interactive prompts for CLI subcommands. |
tag_arg |
Shared parser and normalizer for --tag/tags CLI arguments. |
web_notify |
Fire-and-forget IPC helper that pings a running web server to trigger a reload. |
Re-exports version_line.
struct App
pub struct AppRoot CLI definition parsed by clap.
Metadata (description, author, version) is pulled from Cargo.toml at
compile time so there is a single source of truth.
| Field | Type | Description |
|---|---|---|
command |
Option<Command> | The subcommand to execute. |
no_color |
bool | Disable ANSI color output. |
no_pager |
bool | Disable paging of long command output. |
print_version |
bool | Print the version and platform on one line. gest version also checks for updates. |
verbosity_level |
u8 | Increase log verbosity (-v = info, -vv = debug, -vvv = trace). |
Implements Debug, Parser, CommandFactory, FromArgMatches, Args.
App::no_pager
pub fn no_pager(&self) -> &boolDisable paging of long command output.
| Parameter | Type | Description |
|---|---|---|
| returns | &bool |
App::print_version
pub fn print_version(&self) -> &boolPrint the version and platform on one line. gest version also checks for updates.
| Parameter | Type | Description |
|---|---|---|
| returns | &bool |
App::verbosity_level
pub fn verbosity_level(&self) -> &u8Increase log verbosity (-v = info, -vv = debug, -vvv = trace).
| Parameter | Type | Description |
|---|---|---|
| returns | &u8 |
App::initializes_local_project
pub fn initializes_local_project(&self) -> boolWhether startup should create .gest/ before opening the store.
| Parameter | Type | Description |
|---|---|---|
| returns | bool | true only for gest init --local. |
App::call
pub async fn call(&self, context: &AppContext) -> Result<(), Error>Dispatch to the selected subcommand.
--version prints the one-line version, and no subcommand prints the long help. A subcommand
that needs a project fails outside one. When the subcommand records a new transaction, a
running web server is told to reload.
| Parameter | Type | Description |
|---|---|---|
context |
&AppContext | the application context: settings, store and current project |
| returns | Result<(), Error> | The result of the subcommand, or Error::UninitializedProject when it needs a project and there is none, or a store error from reading the transaction watermark. |
enum Error
pub enum ErrorTop-level error type for the CLI layer.
Variants are added as new subsystems (config, storage, etc.) are wired in.
| Variant | Description |
|---|---|
Argument(String) |
An invalid command-line argument. |
Config(crate::config::Error) |
A configuration loading or validation error. |
Editor(String) |
An editor launch or editor-process failure. Reserved for true editor-invocation failures (spawn, non-zero exit, no $EDITOR, etc.). Domain state-transition errors that were historically routed through this variant should use Error::InvalidState instead. |
InvalidState(String) |
A domain state-transition error: the target is not in a state that accepts the requested transition (e.g. “iteration is not active”, “phase has non-terminal tasks”, “refusing to save empty body”). |
Io(std::io::Error) |
An I/O error (e.g. writing to the filesystem). |
MetaKeyNotFound(String) |
A metadata key was not found on the entity. |
NoTasksAvailable |
No tasks are available to claim (iteration next on an empty-but-valid iteration). |
NotFound(String) |
A domain entity was not found (lookup returned None where the caller expected a row). |
Serialize(serde_json::Error) |
A serialization error (e.g. snapshotting entity state for transactions). |
Store(crate::store::Error) |
An error originating in the store layer. |
TomlSerialize(toml::ser::Error) |
A TOML serialization error. |
UninitializedProject |
The current directory has not been initialized as a gest project. |
Implements Debug, Error, Display, From<Error>.
Error::exit_code
pub fn exit_code(&self) -> ExitCodeThe process exit code associated with this error, per the sysexits.h mapping documented in ADR “Exit Code Contract for the gest CLI”.
The Store variant is unwrapped: the inner store::Error is inspected
so semantically distinct store failures (missing entity vs ambiguous
prefix vs filesystem I/O) surface as the matching sysexits code rather
than collapsing to a generic EX_IOERR.
| Code | Name | Variants |
|---|---|---|
| 64 | EX_USAGE | Argument, Store(InvalidPrefix) |
| 65 | EX_DATAERR | Serialize, TomlSerialize, Store(Serialization | Yaml) |
| 66 | EX_NOINPUT | NotFound, MetaKeyNotFound, Store(NotFound | Ambiguous) |
| 69 | EX_UNAVAILABLE | InvalidState, Store(NothingToUndo) |
| 70 | EX_SOFTWARE | Editor |
| 74 | EX_IOERR | Io, Store(Database | InvalidValue | Io) |
| 75 | EX_TEMPFAIL | NoTasksAvailable |
| 78 | EX_CONFIG | Config, UninitializedProject, Store(Config) |
| Parameter | Type | Description |
|---|---|---|
| returns | ExitCode | The code from the table, as an ExitCode. |
Error::exit_code_u8
pub fn exit_code_u8(&self) -> u8The raw sysexits code as a u8. Exposed alongside Self::exit_code
so tests and callers can compare codes directly without round-tripping
through ExitCode (which does not implement PartialEq).
| Parameter | Type | Description |
|---|---|---|
| returns | u8 | The code from the table in Self::exit_code, from 64 to 78. |
enum Command
enum CommandEnum of all available subcommands.
| Variant | Description |
|---|---|
Artifact(commands::artifact::Command) |
Manage artifacts. |
Config(commands::config::Command) |
View or modify configuration. |
Generate(commands::generate::Command) |
Generate shell completions and man pages. |
Init(commands::init::Command) |
Initialize gest for the current directory. |
Iteration(commands::iteration::Command) |
Manage iterations. |
Migrate(commands::migrate::Command) |
Import v0.4.x flat-file data into the current project store. |
Project(commands::project::Command) |
Show or manage the current project. |
Purge(commands::purge::Command) |
Purge terminal, archived, and orphaned data from the store. |
Search(commands::search::Command) |
Search across all entity types. |
SelfUpdate(commands::self_update::Command) |
Download and install the latest release from GitHub. |
Serve(commands::serve::Command) |
Start the web dashboard server. |
Tag(commands::tag::Command) |
List all tags. |
Task(commands::task::Command) |
Manage tasks. |
Undo(commands::undo::Command) |
Undo the last command. |
Version(commands::version::Command) |
Print the current version, platform info, and check for available updates. |
Implements Debug, FromArgMatches, Subcommand.
Command::call
async fn call(&self, context: &AppContext) -> Result<(), Error>Dispatch to the matched subcommand’s handler.
| Parameter | Type | Description |
|---|---|---|
context |
&AppContext | the application context: settings, store and current project |
| returns | Result<(), Error> | The result of the subcommand that ran. |
Command::requires_project
fn requires_project(&self) -> boolWhether this subcommand requires an initialized project.
fn notify_web_reload_if_possible
async fn notify_web_reload_if_possible(context: &AppContext)Notify a running web server (if any) that a mutation occurred so it can refresh browser tabs via SSE. All errors are silently swallowed: server absence is the common case and CLI commands must never pay user-visible latency for this.
| Parameter | Type | Description |
|---|---|---|
context |
&AppContext | the application context, which gives the .gest directory and the data directory |
fn latest_transaction_id
async fn latest_transaction_id(
context: &AppContext,
) -> Result<Option<crate::store::model::primitives::Id>, Error>Capture the most recent non-undone transaction id for the current project, if any.
Used as a watermark for change detection: comparing this value before and after a
command runs reveals whether the command resulted in a committed mutation,
regardless of which subcommand was invoked. Read-only commands never call
transaction::begin, so the watermark stays unchanged for them.
| Parameter | Type | Description |
|---|---|---|
context |
&AppContext | the application context, which gives the store and the current project |
| returns | Result<Option<crate::store::model::primitives::Id>, Error> | The ID of the latest undoable transaction, or None outside a project or before any transaction. |
fn long_about
fn long_about() -> StringBuild the --help long description: banner, one-liner, docs link, and extended blurb.
| Parameter | Type | Description |
|---|---|---|
| returns | String | The text, styled with the global theme. |