UNPKG

@capgo/cli

Version:
35 lines (34 loc) • 1.99 kB
/** * The MCP server resolves the user's project from `process.cwd()` (capacitor config, * package.json, native folders, ./.capgo key...). A user-scoped MCP install is spawned * by the client from wherever the client lives (often `~` or `/`), not from the folder * the agent is working in. These helpers move the server into the agent's project: * automatically from the client's MCP `roots`, or explicitly via capgo_set_project_dir. */ export interface McpRoot { uri: string; name?: string; } /** Convert MCP roots to existing local directories. Non-`file://` roots are ignored. */ export declare function rootsToDirectories(roots: McpRoot[]): string[]; /** * Pick the project directory from the client's roots. Keeps `currentDir` when it is * already a Capacitor project inside one of the roots (e.g. a project-scoped install * launched from a sub-app of a monorepo); otherwise resolves a unique Capacitor app * across the roots and their workspaces, falling back to the first root without an app. * Returns undefined when no usable root exists. Multiple apps require explicit selection. */ export declare function pickProjectDirFromRoots(roots: McpRoot[], currentDir?: string): Promise<string | undefined>; /** Resolve a user/agent-supplied project path (absolute, `~`, or relative to the current dir). */ export declare function resolveProjectDirInput(input: string, currentDir?: string): Promise<string>; export declare function resolveProjectDirOptions(input: { projectDir?: string; cwd?: string; }, currentDir: string): Promise<string | undefined>; export declare function createProjectDirQueue(): <T>(run: () => Promise<T>) => Promise<T>; export declare function describeProjectDir(dir?: string): string; /** * Memoize a factory per working directory, so long-lived tool dependencies built from * `process.cwd()` follow capgo_set_project_dir / MCP roots instead of the spawn dir. */ export declare function memoizeByCwd<T>(factory: () => T): () => T;