@timbrix/cli
v0.1.0
Published
CLI tool for Timbrix API
Downloads
61
Readme
@timbrix/cli
_____ _ _ _
|_ _(_)_ __ ___ | |__ _ __(_)_ __
| | | | '_ ` _ \| '_ \| '__| \ \/ /
| | | | | | | | | |_) | | | |> <
|_| |_|_| |_| |_|_.__/|_| |_/_/\_\Official CLI tool for the Timbrix API.
Installation
npm install -g @timbrix/cli
# or
pnpm add -g @timbrix/cliQuick Start
# Login to your Timbrix account
timbrix login
# List your organizations
timbrix organizations list
# Create a webhook
timbrix webhooks create --org <organization-id>
# Logout
timbrix logoutAuthentication
Login
timbrix login
# Or provide email directly
timbrix login --email [email protected]Credentials are saved to ~/.timbrix/config.json
Logout
timbrix logoutCommands
Organizations
# List all organizations
timbrix organizations list
# Get organization details
timbrix organizations get <slug>
# Create organization
timbrix organizations create
timbrix organizations create --name "Acme Corp" --slug acme-corp
# Delete organization (PERMANENT)
timbrix organizations delete <slug>
timbrix organizations delete <slug> --force # Skip confirmationWebhooks
# List webhooks
timbrix webhooks list --org <organization-id>
# Get webhook details
timbrix webhooks get <webhook-id> --org <organization-id>
# Create webhook
timbrix webhooks create --org <organization-id>
timbrix webhooks create --org <organization-id> --url https://example.com/webhook
# Delete webhook (PERMANENT)
timbrix webhooks delete <webhook-id> --org <organization-id>
timbrix webhooks delete <webhook-id> --org <organization-id> --forceAPI Keys
# List API keys
timbrix api-keys list --org <organization-id>
# Get API key details
timbrix api-keys get <api-key-id> --org <organization-id>
# Create API key
timbrix api-keys create --org <organization-id>
timbrix api-keys create --org <organization-id> --name "Production Key"
timbrix api-keys create --org <organization-id> --name "Staging Key" --expires 2025-12-31T23:59:59Z
# Revoke API key (PERMANENT)
timbrix api-keys delete <api-key-id> --org <organization-id>
timbrix api-keys delete <api-key-id> --org <organization-id> --forceGlobal Commands
# Show help for any command
timbrix --help
timbrix <command> --help
# Show CLI version
timbrix --version
# Update to latest version
timbrix updateExamples
Complete Workflow
# 1. Login
timbrix login
# 2. Create organization
timbrix organizations create --name "My Company" --slug my-company
# 3. Get organization ID
timbrix organizations get my-company
# Copy the ID from output
# 4. Create webhook
timbrix webhooks create --org <org-id> --url https://api.mycompany.com/webhooks
# 5. Create API key for external services
timbrix api-keys create --org <org-id> --name "Production API Key"
# 6. List all resources
timbrix organizations list
timbrix webhooks list --org <org-id>
timbrix api-keys list --org <org-id>Using in CI/CD
# Set credentials as environment variable in CI
export TIMBRIX_TOKEN="your-token"
# Or login programmatically (if your API supports it)
echo "password" | timbrix login --email [email protected]
# Create API key for deployment
timbrix api-keys create --org $ORG_ID --name "CI/CD Key"Configuration
Configuration is stored in ~/.timbrix/config.json:
{
"bearerToken": "eyJhbGc...",
"email": "[email protected]",
"baseUrl": "http://localhost:3001/api"
}To use a different API URL:
timbrix login --base-url https://api.timbrix.comTheme Customization
The CLI comes with a modern color theme. Users can customize it by creating a theme.json file in ~/.timbrix/:
{
"bin": "cyan",
"command": "greenBright",
"flag": "blueBright",
"flagRequired": "redBright"
}To disable the theme:
TIMBRIX_DISABLE_THEME=1 timbrix --helpUpdate Notifications
The CLI automatically checks for updates once per week and notifies you when a new version is available.
Update manually:
# Check and update to latest version
timbrix update
# The update command will:
# - Check for new versions
# - Detect your package manager (pnpm, yarn, or npm)
# - Update automatically to the latest versionDisable notifications:
NO_UPDATE_NOTIFIER=1 timbrix loginFeatures
🎨 Modern UI
- ASCII Logo: Beautiful Timbrix logo displayed on help and login commands
- Custom Theme: Vibrant color scheme with cyan, green, and blue highlights
- Syntax Highlighting: Color-coded JSON output for better readability
🔔 Update Notifications
The CLI automatically checks for new versions once per week and notifies you when an update is available. Checks are non-blocking and respect CI environments.
🛠️ Built with
- oclif: Modern CLI framework
- TypeScript: Type-safe development
- chalk: Terminal colors
- inquirer: Interactive prompts
- ora: Elegant spinners
- cli-table3: Beautiful tables
Architecture
src/
├── commands/ # CLI commands
│ ├── login.ts # Authentication
│ ├── logout.ts
│ ├── organizations/ # Organization management
│ ├── webhooks/ # Webhook management
│ └── api-keys/ # API key management
├── config/
│ └── auth.ts # Auth configuration manager
├── utils/
│ ├── logo.ts # ASCII logo
│ ├── table.ts # Table formatting
│ ├── client.ts # API client
│ └── update-notifier.ts
├── hooks/
│ └── init/
│ └── update-check.ts # Update check hook
└── help.ts # Custom help classDevelopment
# Install dependencies
pnpm install
# Build
pnpm build
# Run locally with hot-reload
pnpm dev
# Link for local testing
pnpm link --global
# Type check
pnpm check-types
# Lint
pnpm lintTroubleshooting
Authentication Error
Error: Not authenticated. Please run 'timbrix login' first.Solution: Run timbrix login to authenticate.
API Connection Error
Failed to fetch organizations: connect ECONNREFUSEDSolution: Check that your API is running and the base URL is correct.
Invalid Token
Authentication failed: 401 UnauthorizedSolution: Your token may have expired. Run timbrix logout then timbrix login again.
License
MIT
