@timbrix/cli
_____ _ _ _
|_ _(_)_ __ ___ | |__ _ __(_)_ __
| | | | '_ ` _ \| '_ \| '__| \ \/ /
| | | | | | | | | |_) | | | |> <
|_| |_|_| |_| |_|_.__/|_| |_/_/\_\
Official CLI tool for the Timbrix API.
Installation
npm install -g @timbrix/cli
pnpm add -g @timbrix/cli
Quick Start
timbrix login
timbrix organizations list
timbrix webhooks create --org <organization-id>
timbrix logout
Authentication
Login
timbrix login
timbrix login --email user@example.com
Credentials are saved to ~/.timbrix/config.json
Logout
timbrix logout
Commands
Organizations
timbrix organizations list
timbrix organizations get <slug>
timbrix organizations create
timbrix organizations create --name "Acme Corp" --slug acme-corp
timbrix organizations delete <slug>
timbrix organizations delete <slug> --force
Webhooks
timbrix webhooks list --org <organization-id>
timbrix webhooks get <webhook-id> --org <organization-id>
timbrix webhooks create --org <organization-id>
timbrix webhooks create --org <organization-id> --url https://example.com/webhook
timbrix webhooks delete <webhook-id> --org <organization-id>
timbrix webhooks delete <webhook-id> --org <organization-id> --force
Products
timbrix products list --org <organization-id>
timbrix products get <product-id> --org <organization-id>
timbrix products create --org <organization-id>
timbrix products create --org <organization-id> --description Ukelele --product-key 60131324 --price 345.60
timbrix products update <product-id> --org <organization-id>
timbrix products import --org <organization-id> --file ./products.csv
timbrix products delete <product-id> --org <organization-id>
Invoices (CFDI 4.0)
timbrix invoices create --org <organization-id> --api-key <api-key> --file invoice.json
timbrix invoices create --org <organization-id> --api-key <api-key> --file invoice.json --output invoice.xml
timbrix invoices list --org <organization-id>
timbrix invoices list --org <organization-id> --page 2 --limit 50
timbrix invoices get <invoice-uuid>
timbrix invoices download <invoice-uuid> --format xml
timbrix invoices download <invoice-uuid> --format pdf --output invoice.pdf
SAT Catalogs
timbrix sat claves-prod-serv --query ukelele
timbrix sat claves-prod-serv -q "servicios de consultoria" --limit 10
timbrix sat claves-unidad --query pieza
timbrix sat claves-unidad -q kilogramo --limit 10
timbrix sat regimenes list
timbrix sat regimenes list --tipo-persona moral
timbrix sat usos-cfdi list
timbrix sat usos-cfdi list --regimen 601
API Keys
timbrix api-keys list --org <organization-id>
timbrix api-keys get <api-key-id> --org <organization-id>
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
timbrix api-keys delete <api-key-id> --org <organization-id>
timbrix api-keys delete <api-key-id> --org <organization-id> --force
Global Commands
timbrix --help
timbrix <command> --help
timbrix --version
timbrix update
Examples
Complete Workflow
timbrix login
timbrix organizations create --name "My Company" --slug my-company
timbrix organizations get my-company
timbrix webhooks create --org <org-id> --url https://api.mycompany.com/webhooks
timbrix api-keys create --org <org-id> --name "Production API Key"
timbrix organizations list
timbrix webhooks list --org <org-id>
timbrix api-keys list --org <org-id>
Using in CI/CD
export TIMBRIX_TOKEN="your-token"
echo "password" | timbrix login --email ci@example.com
timbrix api-keys create --org $ORG_ID --name "CI/CD Key"
Configuration
Configuration is stored in ~/.timbrix/config.json:
{
"bearerToken": "eyJhbGc...",
"email": "user@example.com",
"baseUrl": "http://localhost:3001"
}
To use a different API URL:
timbrix login --base-url https://api.timbrix.com
Theme 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 --help
Update Notifications
The CLI automatically checks for updates once per week and notifies you when a new version is available.
Update manually:
timbrix update
Disable notifications:
NO_UPDATE_NOTIFIER=1 timbrix login
Features
🎨 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
│ ├── products/ # Products/services + CSV import
│ └── sat/ # SAT catalog search (claves, régimenes, usos CFDI)
├── 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 class
Development
pnpm install
pnpm build
pnpm dev
pnpm link --global
pnpm check-types
pnpm lint
Troubleshooting
Authentication Error
Error: Not authenticated. Please run 'timbrix login' first.
Solution: Run timbrix login to authenticate.
API Connection Error
Failed to fetch organizations: connect ECONNREFUSED
Solution: Check that your API is running and the base URL is correct.
Invalid Token
Authentication failed: 401 Unauthorized
Solution: Your token may have expired. Run timbrix logout then timbrix login again.
License
MIT