tf_code/packages/tfcode/README.md
2026-03-24 14:01:32 +11:00

3.0 KiB

tfcode

ToothFairyAI's official AI coding agent - A terminal-based coding assistant with seamless integration to your ToothFairyAI workspace.

Features

  • 🤖 AI-Powered Coding - Intelligent code generation, refactoring, and debugging
  • 🔌 Tool Integration - Sync and use tools from your ToothFairyAI workspace
  • 💻 Terminal-Based - Fast, lightweight, runs in your terminal
  • 🔐 Secure - Credentials stay in ToothFairyAI, route via TF Proxy

Requirements

  • Python 3.10+ - Required for ToothFairyAI integration
  • Node.js 18+ - Required to run tfcode

Installation

npm install -g tfcode

The installer will:

  • Check Python is installed
  • Install the ToothFairyAI Python SDK automatically

Quick Start

# 1. Set your ToothFairyAI credentials
export TF_WORKSPACE_ID="your-workspace-id"
export TF_API_KEY="your-api-key"
export TF_REGION="au"

# 2. Validate your credentials
tfcode validate

# 3. Sync tools from your workspace
tfcode sync

# 4. Start coding!
tfcode

Commands

Command Description
tfcode Start the AI coding assistant
tfcode quickstart Show quick start guide
tfcode validate Test your credentials
tfcode sync Sync tools from workspace
tfcode tools list List synced tools
tfcode tools list --type mcp List MCP servers
tfcode tools credentials <name> --set Set API key for a tool

Regions

Region URL Use Case
dev api.toothfairylab.link Development/Testing
au api.toothfairyai.com Australia (Default)
eu api.eu.toothfairyai.com Europe
us api.us.toothfairyai.com United States

Configuration

Credentials can be set via environment variables:

export TF_WORKSPACE_ID="your-workspace-id"
export TF_API_KEY="your-api-key"
export TF_REGION="au"

Or in ~/.tfcode/tfcode.json:

{
  "toothfairy": {
    "workspace_id": "your-workspace-id",
    "api_key": "your-api-key",
    "region": "au"
  }
}

Getting Your Credentials

  1. Log in to ToothFairyAI
  2. Go to SettingsAPI Keys
  3. Copy your Workspace ID and API Key

Troubleshooting

"Python 3.10+ is required but not found"

Install Python:

"Failed to validate: Invalid API key"

  • Check your API key is correct
  • Generate a new key in ToothFairyAI Settings → API Keys

"Failed to validate: Connection test failed"

Try a different region:

export TF_REGION="eu"  # or us, au

Documentation

Credits

tfcode is based on opencode by anomalyco.

License

MIT