mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-16 05:34:44 +00:00
feat: sync
This commit is contained in:
71
packages/tf-sync/README.md
Normal file
71
packages/tf-sync/README.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# tf-sync
|
||||
|
||||
ToothFairyAI workspace sync layer for tfcode.
|
||||
|
||||
## Purpose
|
||||
|
||||
This Python module syncs tools from a ToothFairyAI workspace to tfcode:
|
||||
|
||||
- **MCP Servers** - Tools with `isMCPServer=true`
|
||||
- **Agent Skills** - Tools with `isAgentSkill=true`
|
||||
- **Database Scripts** - Tools with `isDatabaseScript=true`
|
||||
- **API Functions** - Tools with `requestType` set
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install tf-sync
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
from tf_sync import (
|
||||
load_config,
|
||||
validate_credentials,
|
||||
sync_tools,
|
||||
sync_mcp_servers,
|
||||
ToolType,
|
||||
)
|
||||
|
||||
# Load configuration from environment (TF_WORKSPACE_ID, TF_API_KEY, TF_REGION)
|
||||
config = load_config()
|
||||
|
||||
# Validate credentials
|
||||
result = validate_credentials(config)
|
||||
if result.success:
|
||||
print(f"Connected to workspace: {result.workspace_name}")
|
||||
|
||||
# Sync all tools (API Functions)
|
||||
result = sync_tools(config)
|
||||
for tool in result.tools:
|
||||
print(f"- {tool.name} ({tool.tool_type.value})")
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Set these environment variables:
|
||||
|
||||
- `TF_WORKSPACE_ID` - Your ToothFairyAI workspace UUID
|
||||
- `TF_API_KEY` - Your ToothFairyAI API key
|
||||
- `TF_REGION` - Region: `dev`, `au` (default), `eu`, or `us`
|
||||
|
||||
## Region URLs
|
||||
|
||||
| Region | Base 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 |
|
||||
|
||||
## Dependencies
|
||||
|
||||
- `toothfairyai` - Official ToothFairyAI Python SDK
|
||||
- `pydantic` - Data validation
|
||||
- `httpx` - HTTP client
|
||||
- `rich` - Console output
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Reference in New Issue
Block a user