/** * cli-commands.ts — Command implementations for the kosha CLI. * * Each exported `cmd*` function corresponds to a top-level CLI sub-command. * Formatting utilities are imported from `./cli-format.js` to keep * presentation logic separate from command orchestration. * * This module also serves as the barrel re-export for commands that were * split into dedicated files (`cli-cmd-model.ts`, `cli-cmd-query.ts`, * `cli-help.ts`) to keep each file under 450 LOC. * * @module cli-commands */ import type { ProviderInfo } from "./types.js"; import type { ModelRegistry } from "./registry.js"; import type { Column } from "./cli-format.js"; /** * Standard column layout reused by both `cmdList` and `cmdSearch`. * Extracted to avoid duplicating the same six-column definition. */ export declare const MODEL_TABLE_COLUMNS: Column[]; /** * Return a human-readable label for a provider's credential source. * Providers that need no remote auth (e.g. local Ollama) show `"none (local)"`. * * @param provider The provider info object. * @returns A short label suitable for table display. */ export declare function formatCredentialSource(provider: ProviderInfo): string; /** * Ensure the registry has at least one provider loaded. * * The registry's `discover()` transparently hydrates from the on-disk cache * at `~/.kosha/cache` when that cache is still within TTL, and only hits * provider APIs on a cold start or a stale cache. I look at the resulting * `discoveredAt` timestamp to tell the user which path actually ran — the * old "No cached data. Running discovery..." message was misleading because * it fired on every invocation regardless of whether the cache was used. * * Honesty here matters: users need to trust that `kosha list` is fast * because the cache exists, and that `kosha update` is the way to refresh. * * @param registry The shared model registry instance. */ export declare function ensureDiscovered(registry: ModelRegistry): Promise; /** * Build a model-table row from a model card (shared by list/search). * @param m A model card object. * @returns An array of formatted cell strings. */ export declare function modelRow(m: { provider: string; id: string; mode: string; contextWindow: number; pricing?: { inputPerMillion: number; outputPerMillion: number; }; }): string[]; /** * Discover all configured providers and print a summary. * With `--json` the entire registry snapshot is emitted as JSON. * * @param registry The model registry to discover into. * @param flags CLI flags (supports `--json`). */ export declare function cmdDiscover(registry: ModelRegistry, flags: Record): Promise; /** * Fetch the latest provider/model details by forcing live discovery. * * Unlike regular list/search commands, this bypasses cache and always * performs a fresh discovery pass (plus LiteLLM enrichment). * * @param registry The model registry to discover into. * @param flags CLI flags (supports `--provider`, `--json`). */ export declare function cmdLatest(registry: ModelRegistry, flags: Record): Promise; /** * Re-run LiteLLM enrichment on cached models without re-discovering providers. * * This is the lightweight alternative to `kosha refresh` when you only need * updated pricing data — no provider API calls, just a single fetch from the * litellm community catalogue plus a cache + manifest update. * * @param registry The model registry with cached data. * @param flags CLI flags (supports `--json`). */ export declare function cmdEnrich(registry: ModelRegistry, flags: Record): Promise; /** * List all known models in a formatted table. * Supports filtering by `--provider`, `--origin`, `--mode`, and `--capability`. * * @param registry The model registry to query. * @param flags CLI flags (supports `--provider`, `--origin`, `--mode`, `--capability`, `--pricing`, `--json`). */ export declare function cmdList(registry: ModelRegistry, flags: Record): Promise; /** * Search for models whose id, name, or aliases contain the query string. * Case-insensitive substring matching. Optionally pre-filtered by `--origin`. * * @param registry The model registry to search. * @param query The search term (substring). * @param flags CLI flags (supports `--origin`, `--pricing`, `--json`). */ export declare function cmdSearch(registry: ModelRegistry, query: string, flags: Record): Promise; /** * List all known providers with their authentication status and model counts. * * @param registry The model registry to query. * @param flags CLI flags (supports `--json`). */ export declare function cmdProviders(registry: ModelRegistry, flags: Record): Promise; /** * Force a full re-discovery of all providers, bypassing the cache. * * @param registry The model registry to refresh. * @param flags CLI flags (supports `--json`). */ export declare function cmdRefresh(registry: ModelRegistry, flags: Record): Promise; /** * Start the HTTP API server on the given port. * The server module is loaded via dynamic import to avoid pulling in Hono * for purely CLI-based usage. * * @param flags CLI flags: `--port ` (default `3000`) and * `--host
` (default `127.0.0.1`, or `KOSHA_HOST`). * Use `--host 0.0.0.0` to expose the server on the network — * set `KOSHA_PROXY_TOKEN` first, the proxy spends your keys. */ export declare function cmdServe(flags: Record): Promise; export { cmdModel, cmdResolve, cmdRoutes } from "./cli-cmd-model.js"; export { cmdRoles, cmdCheapest, cmdCapabilities, cmdCapable } from "./cli-cmd-query.js"; export { showHelp, showVersion, showSplash } from "./cli-help.js"; //# sourceMappingURL=cli-commands.d.ts.map