Skip to main content

Cli

Struct Cli 

Source
pub struct Cli {
Show 24 fields pub max_concurrency: Option<usize>, pub wait_lock: Option<u64>, pub skip_memory_guard: bool, pub strict_env_clear: bool, pub dry_run_backend: bool, pub lang: Option<Language>, pub tz: Option<Tz>, pub verbose: u8, pub extraction_backend: Option<String>, pub embedding_dim: Option<u64>, pub llm_backend: LlmBackendChoice, pub llm_model: Option<String>, pub claude_binary: Option<PathBuf>, pub codex_binary: Option<PathBuf>, pub opencode_binary: Option<PathBuf>, pub llm_fallback: String, pub skip_embedding_on_failure: bool, pub llm_max_host_concurrency: Option<u32>, pub llm_slot_wait_secs: Option<u64>, pub llm_slot_no_wait: bool, pub embedding_backend: EmbeddingBackendChoice, pub embedding_model: Option<String>, pub openrouter_api_key: Option<String>, pub command: Option<Commands>,
}

Fields§

§max_concurrency: Option<usize>

Maximum number of simultaneous CLI invocations allowed (default: 4).

Caps the counting semaphore used for CLI concurrency slots. The value must stay within [1, 2×nCPUs]. Values above the ceiling are rejected with exit 2.

§wait_lock: Option<u64>

Wait up to SECONDS for a free concurrency slot before giving up (exit 75).

Useful in retrying agent pipelines: the process polls every 500 ms until a slot opens or the timeout expires. Default: 300s (5 minutes).

§skip_memory_guard: bool

Skip the available-memory check before loading the model.

Exclusive use in automated tests where real allocation does not occur.

§strict_env_clear: bool

v1.0.83 (ADR-0041): strict env-clear mode for compliance environments.

When enabled, the LLM subprocess receives ONLY PATH — no ANTHROPIC_AUTH_TOKEN, ANTHROPIC_BASE_URL, OPENAI_BASE_URL or other custom-provider credentials are forwarded. Defaults to the standard v1.0.83 whitelist that preserves custom-provider credentials (ADR-0041). Honors env var SQLITE_GRAPHRAG_STRICT_ENV_CLEAR=1 when set.

§dry_run_backend: bool

v1.0.84 (ADR-0042 / GAP-002): resolve and print the LLM backend that WOULD be invoked for embedding (binary path + model + flavour), then exit 0 without executing the subprocess. Useful for CI audit and sanity-check of --llm-backend before long sessions.

Honors env var SQLITE_GRAPHRAG_DRY_RUN_BACKEND=1 when set.

§lang: Option<Language>

Language for human-facing stderr messages. Accepts en or pt.

Without the flag, detection falls back to SQLITE_GRAPHRAG_LANG and then LC_ALL/LANG. JSON stdout stays deterministic and identical across languages; only human-facing strings are affected.

§tz: Option<Tz>

Time zone for *_iso fields in JSON output (for example America/Sao_Paulo).

Accepts any IANA time zone name. Without the flag, it falls back to SQLITE_GRAPHRAG_DISPLAY_TZ; if unset, UTC is used. Integer epoch fields are not affected.

§verbose: u8

Increase logging verbosity (-v=info, -vv=debug, -vvv=trace).

Overrides SQLITE_GRAPHRAG_LOG_LEVEL env var when present. Logs are emitted to stderr; JSON stdout is unaffected.

§extraction_backend: Option<String>

v1.0.75 (G21 solution): extraction backend selector. Accepts llm (default), embedding (legacy), none, or both (composite). The llm backend invokes claude code / codex CLI headless to extract entities and relationships; embedding is a permanent stub since v1.0.79 (legacy fastembed pipeline removed) that returns a clear migration error.

§embedding_dim: Option<u64>

v1.0.79 (G42/S1): embedding dimensionality override (default 64).

Precedence: this flag > SQLITE_GRAPHRAG_EMBEDDING_DIM env var > the dim recorded in the database schema_meta > 64. Existing databases keep their recorded dimensionality automatically; use this flag only to migrate a corpus to a new dimensionality (followed by enrich --operation re-embed). Range: [8, 4096].

§llm_backend: LlmBackendChoice

v1.0.82 (GAP-003) / v1.0.84 (ADR-0042): backend LLM para embedding. Aceita auto (detecta via PATH, codex-first), codex (força codex exec), claude (força claude -p; desde v1.0.84 NÃO cai em codex — emite AppError::Validation se claude ausente), opencode (força opencode run), ou none (skip-a embedding; útil para testes). Honra env var SQLITE_GRAPHRAG_LLM_BACKEND.

§llm_model: Option<String>

v1.0.82 (GAP-003): modelo a invocar no backend escolhido. Honra env var SQLITE_GRAPHRAG_LLM_MODEL. Default depende do backend (codex: gpt-5.5; claude: claude-sonnet-4-6).

§claude_binary: Option<PathBuf>

v1.0.82 (GAP-003): path para o binário claude (override de detecção via PATH). Honra env var SQLITE_GRAPHRAG_CLAUDE_BINARY.

§codex_binary: Option<PathBuf>

v1.0.89 (GAP-1): path para o binário codex (override de detecção via PATH). Honra env var SQLITE_GRAPHRAG_CODEX_BINARY.

§opencode_binary: Option<PathBuf>

v1.0.90 (GAP-OPENCODE-001): path para o binário opencode (override de detecção via PATH). Honra env var SQLITE_GRAPHRAG_OPENCODE_BINARY.

§llm_fallback: String

v1.0.82 (GAP-005): cadeia de backends LLM tentados em ordem quando o primário falha. Default codex,claude,none. Honra env var SQLITE_GRAPHRAG_LLM_FALLBACK.

§skip_embedding_on_failure: bool

v1.0.82 (GAP-005): persiste com embedding NULL quando todos os backends da cadeia falham. Memória fica em pending_embeddings para reprocessamento via embedding retry. Honra env var SQLITE_GRAPHRAG_SKIP_EMBEDDING_ON_FAILURE.

§llm_max_host_concurrency: Option<u32>

v1.0.82 (GAP-004): limite host-wide de subprocessos LLM simultâneos. Default derivado de ncpus. Honra env var SQLITE_GRAPHRAG_LLM_MAX_HOST_CONCURRENCY.

§llm_slot_wait_secs: Option<u64>

v1.0.82 (GAP-004): segundos para aguardar slot LLM livre antes de falhar com exit 75. Default 30s. Honra env var SQLITE_GRAPHRAG_LLM_SLOT_WAIT_SECS.

§llm_slot_no_wait: bool

v1.0.82 (GAP-004): se setado, falha imediatamente (exit 75) quando nenhum slot LLM está livre. Honra env var SQLITE_GRAPHRAG_LLM_SLOT_NO_WAIT.

§embedding_backend: EmbeddingBackendChoice

v1.0.93: embedding backend selector. auto tries OpenRouter API if key available, falls back to LLM subprocess. openrouter requires API key. llm forces subprocess. Honra env var SQLITE_GRAPHRAG_EMBEDDING_BACKEND.

§embedding_model: Option<String>

v1.0.93: embedding model for OpenRouter API. OBRIGATORIO quando --embedding-backend openrouter. Honra env var SQLITE_GRAPHRAG_EMBEDDING_MODEL.

§openrouter_api_key: Option<String>

v1.0.93: OpenRouter API key (prefer env var or config.toml over CLI flag to avoid shell history exposure). Honra env var OPENROUTER_API_KEY.

§command: Option<Commands>

Implementations§

Source§

impl Cli

Source

pub fn validate_flags(&self) -> Result<(), String>

Validates concurrency flags and returns a localised descriptive error if invalid.

Requires that crate::i18n::init() has already been called (happens before this function in the main flow). In English it emits EN messages; in Portuguese it emits PT.

Trait Implementations§

Source§

impl Args for Cli

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl CommandFactory for Cli

Source§

fn command<'b>() -> Command

Build a Command that can instantiate Self. Read more
Source§

fn command_for_update<'b>() -> Command

Build a Command that can update self. Read more
Source§

impl FromArgMatches for Cli

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Parser for Cli

Source§

fn parse() -> Self

Parse from std::env::args_os(), exit on error.
Source§

fn try_parse() -> Result<Self, Error>

Parse from std::env::args_os(), return Err on error.
Source§

fn parse_from<I, T>(itr: I) -> Self
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, exit on error.
Source§

fn try_parse_from<I, T>(itr: I) -> Result<Self, Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Parse from iterator, return Err on error.
Source§

fn update_from<I, T>(&mut self, itr: I)
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, exit on error. Read more
Source§

fn try_update_from<I, T>(&mut self, itr: I) -> Result<(), Error>
where I: IntoIterator<Item = T>, T: Into<OsString> + Clone,

Update from iterator, return Err on error.

Auto Trait Implementations§

§

impl Freeze for Cli

§

impl RefUnwindSafe for Cli

§

impl Send for Cli

§

impl Sync for Cli

§

impl Unpin for Cli

§

impl UnsafeUnpin for Cli

§

impl UnwindSafe for Cli

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more