Skip to main content

run

Function run 

Source
pub fn run(
    pack_root: &Path,
    opts: &SyncOptions,
    cancel: &CancellationToken,
) -> Result<SyncReport, SyncError>
Expand description

Run a full sync over the pack tree rooted at pack_root.

Resolution rules:

  • If pack_root is a directory the walker looks for <pack_root>/.grex/pack.yaml.
  • If pack_root ends in .yaml / .yml it is loaded verbatim.
  • Workspace defaults to the pack root directory itself when opts.workspace is None. Children resolve as flat siblings of the parent pack root (since v1.1.0).

§Errors

Returns the first error that halts the pipeline — see SyncError for the taxonomy.

cancel is the cooperative cancellation handle threaded through the pipeline by feat-m7-1 stage 2. Stage 2 only wires the parameter; the is_cancelled() polls land in stages 3-4 (scheduler + pack-lock acquire). CLI callers pass a never-cancelled sentinel (CancellationToken::new()); the MCP server passes a token tied to the request lifetime.