vcs-cli-support
Shared plumbing for the CLI-wrapper crates in
vcs-toolkit-rs — the bits
vcs-git / vcs-jj / vcs-github all need that touch
processkit::Error, so they live here
rather than in the std-only vcs-diff:
reject_flag_like(program, what, value)— the injection guard for bare positional argv slots: a leading--or empty value is refused before anything spawns, so a caller string can't smuggle a flag into argv.FETCH_ATTEMPTS/FETCH_BACKOFF— the transient-retry policy forfetch.is_merge_conflict/is_nothing_to_commit/is_transient_fetch_error/is_lock_contention— classify a returnedprocesskit::Errorso callers branch on intent ("conflict, resolve it"; "nothing to commit, no-op"; "transient, retry"; "another process holds the lock, retry") instead of matching on error internals.ManagedClient+RetryPolicy— theCliClientwrapper the wrappers hold. Adds opt-in lock-contention retry (exponential, jittered backoff; safe even on mutations since lock failures are pre-execution) and opt-in credential injection.credentialsmodule — supply a secret per operation instead of relying on ambient CLI auth: theCredentialProviderasync trait,Credential/Secret(redacted inDebug/Display), adaptersStaticCredential/EnvToken/provider_fn, andgit_credential_helper(feeds a git HTTPS token via an inline helper, keeping it out ofargv). Off by default → ambient auth, unchanged.
use Arc;
use ;
// A provider reading a token from $CI_TOKEN at request time:
let provider: = new;
// Hand it to a backend, e.g. `GitHub::new().with_credentials(provider)`.
The wrapper crates re-export the classifiers (e.g. vcs_git::is_merge_conflict)
and the credential types (e.g. vcs_github::CredentialProvider), and call
reject_flag_like with their own binary name, so you rarely name this crate
directly.
Part of vcs-toolkit-rs; used by
vcs-git, vcs-jj, vcs-github, and vcs-core.
License
MIT