/** * Core logic for the `auden pull ` command: fetch a bundle's canonical * items via the shared `ContextClient` and materialize them to a local * directory as Markdown. This is the plain-terminal twin of the MCP * `pull_context` tool (`src/mcp/server.ts`) — same client, same * `writeItemsToDir` write path — so a human can drop scoped context into a repo * without wiring an agent. * * Kept free of citty/console so it unit-tests directly against a mocked client. */ import type { ContextClient, PullContextParams } from '../mcp/client.js'; import type { WriteItemsDeps } from '../mcp/write-items.js'; import type { ContextItem } from '@auden.to/protocol'; export type PullBundleParams = PullContextParams; export type PullBundleResult = { /** Every item the bundle returned, including items with null content (e.g. assets). */ items: readonly ContextItem[]; /** Paths written to disk (excludes null-content items, which are skipped). */ written: string[]; /** * Guide members whose projection path failed the safety guard — reported, * never written. Empty when projection was off (custom `--out`) or clean. */ skippedGuides: { name: string; reason: string; }[]; }; /** * When set, `guide` members are materialized at their projection path under * `root` (origin-derived discovery-root path, `.agents/` fallback — slice 1b) * instead of the bundle directory, where a guide is inert: `.auden/context/` * is not a rules-discovery root, so no agent would ever read it as guidance. */ export type GuideProjectionTarget = { root: string; /** * Paths already claimed by earlier pulls in the same command. Shared by the * multi-bundle loop so two bundles' guides can never silently share one * file — a per-call set would only catch collisions within a single bundle. */ usedStoredPaths?: Set; /** Injectable for tests; also used for the sidecar read. */ readFileFn?: (path: string, encoding: 'utf8') => Promise; }; /** * Turn a bundle slug into a safe single path segment for the default output * directory, falling back to `bundle` when the slug reduces to nothing. Shares * `sanitizePathSegment` with `safeItemFileName` so a crafted slug cannot escape * the target directory. */ export declare function safeBundleDirName(bundle: string): string; /** * Default output directory for `auden pull ` when `--out` is not given: * `/.auden/context//`. Keeps pulled context out of the way of the * repo's own tree while staying discoverable. */ export declare function defaultPullDir(bundle: string, cwd: string): string; /** * Pull `params.bundle`'s items and write each to `dir` as `.md`. * Returns the full item list (for a caller-facing summary) alongside the paths * actually written. `deps` injects the filesystem for tests. */ export declare function pullBundleToDir(client: ContextClient, params: PullBundleParams, dir: string, deps?: WriteItemsDeps, projectGuides?: GuideProjectionTarget): Promise; //# sourceMappingURL=pull.d.ts.map