Skip to main content

Module src

Module src 

Source
Expand description

ask src <spec> — print the absolute path to a cached library source tree, fetching on cache miss unless --no-fetch. Rust port of commands/src.ts.

run_src returns the exact stdout string on success and an error on failure; the thin CLI wrapper prints it and maps any error to a non-zero exit. This keeps the resolution logic unit-testable without process exits or real I/O.

Structs§

RunSrcOptions
Options for run_src.
SrcModel
ask src <spec> --json output — the stable machine-readable handoff that downstream tools (e.g. csp) consume. checkout_dir is the version-pinned, content-stable store path they index. Mirrors SrcModelSchema.

Functions§

run_src
Resolve spec via the shared checkout helper and return the text to print: the checkout path (default) or a JSON SrcModel (json). On a NoCacheError or any resolver failure this returns an error whose message the CLI writes to stderr before exiting non-zero — matching the TS behaviour where both cases route through error() + exit(1).
run_src_with
run_src with injectable checkout deps (tests pass an offline fetcher / overridden ASK home).