mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-01 14:52:25 +00:00
feat: sync
This commit is contained in:
129
docs/testing-sync.md
Normal file
129
docs/testing-sync.md
Normal file
@@ -0,0 +1,129 @@
|
||||
# Step-by-Step Guide: Testing tfcode Sync
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Python 3.10+ with `toothfairyai` SDK installed
|
||||
2. Node.js/Bun for running tfcode
|
||||
|
||||
## Step 1: Set Environment Variables
|
||||
|
||||
```bash
|
||||
# In your terminal
|
||||
export TF_WORKSPACE_ID="6586b7e6-683e-4ee6-a6cf-24c19729b5ff"
|
||||
export TF_API_KEY="EWZooLROIS57EVW3BKGu7Pv6LNe4D6m4gkDjukx3"
|
||||
export TF_REGION="au"
|
||||
```
|
||||
|
||||
Or use the setup script:
|
||||
```bash
|
||||
source scripts/setup-tf-dev.sh
|
||||
```
|
||||
|
||||
## Step 2: Install Python Dependencies
|
||||
|
||||
```bash
|
||||
cd packages/tf-sync
|
||||
pip install -e .
|
||||
|
||||
# Or manually install the required packages:
|
||||
pip install toothfairyai pydantic httpx rich
|
||||
```
|
||||
|
||||
## Step 3: Build tfcode CLI
|
||||
|
||||
```bash
|
||||
cd packages/tfcode
|
||||
bun install
|
||||
bun run build
|
||||
```
|
||||
|
||||
## Step 4: Test Credential Validation
|
||||
|
||||
```bash
|
||||
# From repo root with environment set
|
||||
cd packages/tfcode
|
||||
bun run src/index.ts validate
|
||||
```
|
||||
|
||||
Expected output:
|
||||
```
|
||||
Validating ToothFairyAI credentials...
|
||||
✓ Credentials valid
|
||||
Workspace: <workspace_name>
|
||||
ID: 6586b7e6-683e-4ee6-a6cf-24c19729b5ff
|
||||
```
|
||||
|
||||
## Step 5: Sync Tools from Workspace
|
||||
|
||||
```bash
|
||||
bun run src/index.ts sync
|
||||
```
|
||||
|
||||
Expected output:
|
||||
```
|
||||
Syncing tools from ToothFairyAI workspace...
|
||||
✓ Synced X tools
|
||||
|
||||
By type:
|
||||
mcp_server: X
|
||||
agent_skill: X
|
||||
database_script: X
|
||||
api_function: X
|
||||
```
|
||||
|
||||
## Step 6: List Synced Tools
|
||||
|
||||
```bash
|
||||
# List all tools
|
||||
bun run src/index.ts tools list
|
||||
|
||||
# Filter by type
|
||||
bun run src/index.ts tools list --type mcp
|
||||
bun run src/index.ts tools list --type skill
|
||||
bun run src/index.ts tools list --type database
|
||||
bun run src/index.ts tools list --type function
|
||||
```
|
||||
|
||||
## Step 7: Debug a Tool
|
||||
|
||||
```bash
|
||||
bun run src/index.ts tools debug <tool-name>
|
||||
```
|
||||
|
||||
## Step 8: Set API Function Credentials (if needed)
|
||||
|
||||
For tools with `auth_via: user_provided`:
|
||||
|
||||
```bash
|
||||
bun run src/index.ts tools credentials <tool-name> --set
|
||||
# Enter API key when prompted
|
||||
|
||||
bun run src/index.ts tools credentials <tool-name> --show
|
||||
# Shows masked key
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Python SDK not found
|
||||
```
|
||||
Error: Failed to validate: Python sync failed: ModuleNotFoundError: No module named 'toothfairyai'
|
||||
```
|
||||
Solution: `pip install toothfairyai`
|
||||
|
||||
### Environment not set
|
||||
```
|
||||
Error: TF_WORKSPACE_ID not set
|
||||
```
|
||||
Solution: Export environment variables or source the setup script
|
||||
|
||||
### Invalid credentials
|
||||
```
|
||||
✗ Validation failed: Invalid API key
|
||||
```
|
||||
Solution: Check your TF_API_KEY is correct
|
||||
|
||||
### Workspace not found
|
||||
```
|
||||
✗ Validation failed: Workspace not found
|
||||
```
|
||||
Solution: Check your TF_WORKSPACE_ID is correct
|
||||
Reference in New Issue
Block a user