@aditya-borkar/utils
v0.6.3
Published
Utilities for daily developer work.
Readme
Developer productivity utilities for your terminal
Features
┌─────────────────┬─────────────────────────────────────────┐ │ 🗄️ Databases │ CockroachDB, Postgres, Redis via Docker │ │ 🌐 Tunnels │ Cloudflare Tunnel management │ │ 🔐 Secrets │ Infisical-based secret management │ │ 📁 Repos │ Scan, create git repositories │ │ ⚙️ Config │ Manage your CLI configuration │ │ 📦 SDK │ Exportable SDK for Infisical │ └─────────────────┴─────────────────────────────────────────┘
Installation
# Via JSR
bunx jsr add @aditya-borkar/utils
# Via npm
npm install -g @aditya-borkar/utilsUsage
lab # Show help (or 'utils' if installed locally)Database Management 🗄️
lab db start cockroach # Start CockroachDB container
lab db stop postgres # Stop Postgres container
lab db list # List all databases
lab db create postgres mydb # Create new Postgres database
lab db delete redis test # Delete databaseSupported Databases:
cockroach— CockroachDB (ports: 26257, 8080)postgres— PostgreSQL (ports: 5432)redis— Redis (ports: 6379)
Cloudflare Tunnel Management 🌐
lab tunnel list # List all tunnel routes
lab tunnel create # Create a new route (interactive)
lab tunnel delete # Delete routes (interactive)Tunnel commands automatically manage DNS records via Cloudflare API. See Cloudflare Setup below for configuration.
Secret Management 🔐
lab secrets list # List all secrets
lab secrets set KEY=VALUE # Set secret values
lab secrets show KEY # Show a secret value
lab secrets remove KEY # Remove a secret
lab secrets clear # Clear all secretsSecrets are managed via an Infisical Docker container.
Repository Management 📁
lab repo # Scan current dir for git repos
lab repo ~/code # Scan specific folder
lab repo create myapp # Create new repositoryThe scanner shows:
- Git status (🟢 clean, 🟡 dirty, 🔴 no remote)
- Remote sync status (ahead/behind)
- Repository size
- Staleness indicator (repos not updated in 7+ days)
Configuration ⚙️
lab config show # Display current configuration
lab config open # Open config in default editorConfiguration location: ~/.config/aditya-borkar.utils/config.json
Cloudflare Tunnel Setup
To use tunnel management, you need to configure Cloudflare credentials:
1. Create a Tunnel
- Go to Cloudflare Zero Trust Dashboard
- Navigate to Access > Tunnels
- Click "Create a tunnel"
- Choose your tunnel name (e.g.,
ablab-tunnel) - Copy the Tunnel ID from the installation command
2. Get API Token
- Go to Cloudflare API Tokens
- Click "Create Token"
- Use the "Edit Cloudflare Tunnels" template or create a custom token with:
- Account > Cloudflare Tunnel > Edit
- Zone > DNS > Edit
- Copy the API token
3. Get Account ID
Found in the right sidebar of your Cloudflare dashboard, or in the URL when viewing your account.
4. Configure in lab
lab config openAdd to your config:
{
"cloudflare": {
"api_token": "your_api_token_here",
"account_id": "your_account_id_here",
"tunnel_id": "your_tunnel_id_here"
}
}5. Use Tunnel Commands
lab tunnel create # Prompts for hostname (e.g., app.example.com)
# and service (e.g., http://localhost:3000)
lab tunnel delete # Interactive selection of routes to delete
lab tunnel list # Shows all configured routesWhat happens:
createadds a route and creates a CNAME DNS record automaticallydeleteremoves routes and their associated DNS recordslistshows all hostname → service mappings
SDK
The package exports an SDK for Infisical integration:
import { loadEnv } from "@aditya-borkar/utils/sdk"
// Load secrets from Infisical into process.env
await loadEnv()Requires .env with:
ABLAB_PROJECT_ID— Your Infisical project IDABLAB_ENV— Environment name (e.g., "dev", "prod")
Tech Stack
- Runtime: Bun
- Language: TypeScript (strict mode)
- CLI: Commander.js
- Validation: Zod
- Containers: Docker (dockerode)
- Cloudflare: cloudflare npm package
- Secrets: Infisical SDK
Development
bun install # Install dependencies
bun run dev # Run CLI in development
bun run lint # Lint with Biome (auto-fix)
bun run type-check # TypeScript type checkingProject Structure
src/
├── index.ts # CLI entry point (shebang)
├── commands/ # Command implementations
│ ├── db.*.ts # Database commands
│ ├── repo.*.ts # Repository management
│ ├── secrets.*.ts # Secret management
│ ├── tunnel.*.ts # Tunnel management
│ ├── config.*.ts # Configuration commands
│ └── start.ts # Start all services
├── logic/ # Business logic
│ └── cloudflare.ts # Cloudflare API integration
├── lib/ # Core utilities
│ ├── console.ts # Styled console output
│ ├── config.ts # Configuration system
│ ├── docker.ts # Docker container management
│ ├── logger.ts # Logging utilities
│ └── state.ts # Runtime state
├── services/ # Docker service definitions
│ ├── cockroach.ts # CockroachDB service
│ ├── postgres.ts # Postgres service
│ ├── redis.ts # Redis service
│ └── infisical.ts # Infisical service
└── sdk/ # Exportable SDK
└── index.ts # Infisical env loaderLicense
MIT © Aditya Borkar
