@capgo/cli
Version:
A CLI to upload to capgo servers
31 lines (30 loc) • 1.78 kB
TypeScript
/**
* 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 prefers the first root holding a
* Capacitor config, then the first root. Returns undefined when no usable root exists.
*/
export declare function pickProjectDirFromRoots(roots: McpRoot[], currentDir?: string): string | undefined;
/** Resolve a user/agent-supplied project path (absolute, `~`, or relative to the current dir). */
export declare function resolveProjectDirInput(input: string, currentDir?: string): string;
/** Switch the server's working directory. Returns true when it actually changed. */
export declare function switchProjectDir(dir: string): boolean;
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;