This document provides instructions for AI coding agents working on the rtrvr-cli codebase.
This is a pnpm monorepo with three packages:
packages/
core/ @rtrvr-ai/core — API client, types, HTTP transport
sdk/ @rtrvr-ai/sdk — High-level SDK wrapper
cli/ @rtrvr-ai/cli — CLI binary (rtrvr command)
Dependency chain: cli → sdk → core
pnpm install
pnpm build- All packages use ESM (
"type": "module") - Build with
tsup(ESM + DTS output) - TypeScript strict mode enabled
- No external HTTP library — uses native Node
fetch
- TypeScript strict mode with
noUncheckedIndexedAccess - ESM imports with explicit
.jsextensions in compiled output - Use
snake_casefor API-facing tool names and parameters - Use
camelCasefor internal TypeScript code - Keep dependencies minimal — only
commanderandgray-matteras production deps for CLI
pnpm build && pnpm testTests use Node's built-in test runner (node --test). Test files are in test/*.test.mjs within each package.
packages/core/src/client.ts— Main API client with cloud/extension routing logicpackages/core/src/types.ts— All type definitionspackages/core/src/http.ts— HTTP transport with retry logicpackages/cli/src/index.ts— CLI entry point and command registrationpackages/cli/src/utils/oauth.ts— OAuth bootstrap flowpackages/cli/src/utils/secrets.ts— Keychain/secret-service integrationpackages/cli/src/utils/mcp.ts— MCP profile generationpackages/cli/src/utils/skills.ts— Skill template managementpackages/sdk/src/index.ts— SDK factory and wrapper interface
- The
USER_FUNCTiON_TIMEOUTtypo (lowercasei) in the codebase is pre-existing and intentional — do not "fix" it - API tool names are canonical
snake_case:act_on_tab,extract_from_tab,crawl_and_extract_from_tab - Auth tokens use prefixes:
rtrvr_for API keys,mcp_at_for OAuth tokens - Never commit actual API keys or tokens