@kite-copilot/cli
v1.0.2
Published
Kite CLI - Analyze frontend codebases and map API calls
Downloads
316
Maintainers
Readme
@kite/cli
Command-line tool for analyzing frontend codebases to discover API mappings. The CLI uses Claude AI to analyze your frontend code, identify routes, API calls, and generate mappings that connect your frontend to the Kite backend.
Prerequisites
Claude CLI
The Kite CLI requires Claude CLI to be installed for code analysis:
npm install -g @anthropic-ai/claude-cliVerify installation:
claude --versionNode.js
Requires Node.js 18.0.0 or higher.
Installation
From npm (when published)
npm install -g @kite/cliFrom source
cd agent/cli-npm
npm install
npm run buildThen run with:
node dist/index.js <command>Or create a global link:
npm link
kite <command>Commands
kite login
Authenticate with the Kite backend.
kite login [--backend-url <url>]Options:
| Option | Description |
|--------|-------------|
| --backend-url <url> | Kite backend URL (default: https://api.kite.com) |
Environment Variables:
| Variable | Description |
|----------|-------------|
| KITE_BACKEND_URL | Override default backend URL |
Example:
# Login to production
kite login
# Login to local development server
kite login --backend-url http://localhost:5002When prompted, enter your API token from the Kite dashboard.
kite logout
Clear stored credentials.
kite logoutkite status
Show current login status.
kite statuskite map
Analyze a frontend codebase to discover API mappings.
kite map <path> [options]Arguments:
| Argument | Description |
|----------|-------------|
| <path> | Path to the frontend codebase directory |
Options:
| Option | Description |
|--------|-------------|
| -o, --output <file> | Output JSON file path (default: kite-mappings.json) |
| -u, --upload | Upload mappings to Kite backend after analysis |
| -q, --quiet | Suppress terminal visualization output |
| -v, --verbose | Show verbose debug output |
| --timeout <seconds> | Analysis timeout in seconds (default: 300) |
| --no-output-file | Don't generate output JSON file |
Examples:
# Analyze and save to default file
kite map ./my-frontend-app
# Analyze with custom output file
kite map ./my-frontend-app -o custom-mappings.json
# Analyze and upload to backend
kite map ./my-frontend-app --upload
# Quiet mode - just generate the file
kite map ./my-frontend-app --quiet
# Verbose mode for debugging
kite map ./my-frontend-app --verbose
# Increase timeout for large codebases
kite map ./my-frontend-app --timeout 600Configuration
Credentials are stored in ~/.kite/config.json:
{
"token": "your-api-token",
"org_id": "organization-uuid",
"api_config_id": "config-uuid",
"email": "[email protected]",
"org_name": "Your Organization",
"backend_url": "https://api.kite.com"
}Output Format
The kite map command generates a JSON file with the following structure:
{
"version": "1.0",
"generated_at": "2024-01-15T10:30:00Z",
"codebase_path": "/path/to/frontend",
"routes": [
{
"route_name": "customers",
"file_path": "pages/customers.tsx",
"component_name": "CustomersPage"
}
],
"api_calls": [
{
"endpoint": "/api/customers",
"method": "GET",
"component_file": "pages/customers.tsx",
"action_form_type": null
}
],
"mappings": [
{
"tool_name": "customers",
"api_endpoint": "/api/customers",
"navigation_page": "customers",
"action_form_type": "addCustomer",
"frontend_component": "CustomersPage",
"frontend_file_path": "pages/customers.tsx"
}
]
}Workflow
First-time Setup
- Install the CLI and Claude CLI
- Get your API token from the Kite dashboard
- Login:
kite login - Verify:
kite status
Analyzing a Codebase
- Navigate to your project or provide the path
- Run:
kite map ./your-frontend --upload - Review the generated mappings
- Mappings are now available in the Kite backend
Local Development
For local development without Supabase:
# 1. Seed local test data
python agent/app/scripts/seed_local_dev.py
# 2. Start the backend
cd agent && python server.py
# 3. Login to local backend
kite login --backend-url http://localhost:5002
# 4. Map your codebase
kite map ./your-frontend --uploadTroubleshooting
Claude CLI not found
Error: Claude CLI not foundSolution: Install Claude CLI:
npm install -g @anthropic-ai/claude-cliAnalysis timeout
Error: Analysis timed out after 300 secondsSolution: Increase the timeout:
kite map ./large-codebase --timeout 600Authentication failed
Error: Invalid tokenSolution: Re-run login:
kite logout
kite loginNot logged in
Error: Not logged in. Run 'kite login' first.Solution: Login before uploading:
kite login
kite map ./frontend --uploadPath is not a frontend project
Error: Directory doesn't appear to be a frontend projectSolution: Ensure your path contains one of:
package.jsontsconfig.jsonsrc/directoryapp/directorycomponents/directorypages/directory
Development
Building
npm run buildDevelopment mode
npm run devRunning from source
node dist/index.js map ./test-frontendLicense
MIT
