import type TS from "typescript"; import type { ExtractedTool } from "../formats.js"; export { bindingIdentity, dedupKey, extractedRisk, routeToolFullName, unclassifiedToolFullName, } from "../binding-identity.js"; export interface ResolvedSource { file: string; source: string; } export interface ImportReference { specifier: string; imported: string; } /** Cleared at the start of every sync so a same-process re-run (watch mode) sees tsconfig edits. */ export declare function clearAliasCache(): void; export declare function walk(root: string, keep: (relativePath: string) => boolean, maxFiles?: number): Promise; /** Write a sync artifact only when its bytes changed (keeps mtimes stable). */ export declare function writeIfChanged(file: string, bytes: string): Promise; export declare function isInside(root: string, candidate: string): boolean; /** Every realpathed directory host source may live under: the project root, * plus the extra source roots a host configured (`remix.sources`). */ export declare function insideBounds(bounds: readonly string[], candidate: string): boolean; export interface ParsedModule { ts: typeof TS; sf: TS.SourceFile; } /** Parse one module's source for statement-level analysis (no type checking, * no host code execution). TSX is the default script kind — extraction mostly * reads component and route modules — with plain TS for `.ts`/`.mts`/`.cts` * files so generic arrows are not mis-lexed as JSX. */ export declare function parseModuleSource(source: string, fileName?: string): ParsedModule | null; /** Depth-first visit of every node under `root` (root excluded). */ export declare function visitNodes(ts: typeof TS, root: TS.Node, visit: (node: TS.Node) => void): void; /** True when a specifier names a PACKAGE rather than the host's own source: * nothing relative to resolve and no tsconfig path alias that maps it. Source * capture stops at that boundary — a node_modules module is never the host's * code — and stays silent about it, so only genuinely broken host imports warn. */ export declare function isPackageSpecifier(importer: string, specifier: string, root: string): Promise; export declare function resolveImportSource(importer: string, specifier: string, root: string, importedName?: string, /** Realpathed directories outside `root` that also hold host source. */ extraRoots?: readonly string[]): Promise; export interface ExportOriginInput { /** The module doing the importing — where `specifier` is resolved from. */ importer: string; specifier: string; /** The export name to follow (as `specifier`'s module names it). */ exported: string; root: string; extraRoots?: readonly string[]; } /** * The module specifier one export ultimately comes FROM, following re-export * hops that stay inside host source: `export { X } from "…"`, `export * from * "…"`, and `import { X } from "…"; export { X }`. The answer is the first * specifier whose module is NOT host source — the package that owns the name — * or null when the chain ends inside the host (the module declares the value * itself), breaks, or loops. * * This is what lets a `` behind a host's own re-export shim * (`@host/vendo-kit`) still be PROVEN to be Vendo's: sync reads the shim's * exports instead of pattern-matching its name. */ export declare function exportOrigin(input: ExportOriginInput): Promise; export declare function importReferenceFor(source: string, localExpression: string): Promise; export declare function allocateToolName(preferred: string, fallbackSuffix: string, used: Set): string; export declare function withUniqueNames(tools: T[]): T[]; /** A build-time extraction entry plus the root-relative posix path of the * source file it was extracted from, when the extractor has it in hand. * Internal to sync: the path never reaches `.vendo/tools.json` — it becomes * the tool's `srcHash` (content hash) in the v3 write. */ export type SourcedExtractedTool = ExtractedTool & { srcPath?: string; }; /** tRPC risk labeling (04 §1, fail-closed): a `mutation` is a DECLARED * mutation, so it is at least `write` and can never be `read`. A `query` is * not a declared read — tRPC does not stop one from writing — so it stays * `ungraded` until something authorized grades it. */ export declare function trpcRisk(type: "query" | "mutation"): ExtractedTool["risk"]; export declare function trpcToolFullName(procedure: string): string; export declare function serverActionToolFullName(name: string): string;