A command-line interface tool for interacting with internal APIs. Built with Zig for type safety and performance.
# Clone the repository
git clone git@github.com:youorg/vlcli.git
cd vlcli
# Run the install script
./install.shThe install script will:
- Validate your environment configuration
- Build the project with optimizations
- Create appropriate symlinks
- Guide you through any necessary PATH configurations
- Clone the repository
git clone git@github.com:youorg/vlcli.git
cd vlcli- Set up environment variables (either in shell or .env file)
# Local environment
export LOCAL_BASE_URL=http://localhost:3000
export LOCAL_AUTH_HEADER_NAME=X-Auth-Token
export LOCAL_AUTH_HEADER_VALUE=local_dev_key_here
# Production environment
export PROD_BASE_URL=https://app.getvoiceline.com
export PROD_AUTH_HEADER_NAME=Voiceline-Search-Auth
export PROD_AUTH_HEADER_VALUE=your_prod_key_here- Build the project
zig build -Doptimize=ReleaseSafe- Create a global symlink (choose one):
# Option 1: Add to /usr/local/bin (requires sudo)
sudo ln -s "$(pwd)/zig-out/bin/vlcli" /usr/local/bin/vlcli
# Option 2: Add to ~/bin (user-specific)
mkdir -p ~/bin
ln -s "$(pwd)/zig-out/bin/vlcli" ~/bin/vlcli
# Add to your .bashrc or .zshrc:
export PATH="$HOME/bin:$PATH"You can configure the environment variables either through:
- A
.envfile (recommended for development) - Shell environment variables (recommended for production)
Example .env file:
# Local environment
LOCAL_BASE_URL=http://localhost:3000
LOCAL_AUTH_HEADER_NAME=X-Auth-Token
LOCAL_AUTH_HEADER_VALUE=local_dev_key_here
# Production environment
PROD_BASE_URL=https://app.getvoiceline.com
PROD_AUTH_HEADER_NAME=Voiceline-Search-Auth
PROD_AUTH_HEADER_VALUE=your_prod_key_here# Local environment (default)
vlcli surgery 44715
# Production environment
vlcli -p surgery 44715
# Multiple parameters
vlcli related_contacts 123 456 customer# Command with optional filter
vlcli search_patient 44715 active
# Same command without optional parameter
vlcli search_patient 44715# Show general help
vlcli -h
# Available commands and their parameters will be shown:
Available commands:
surgery <id>
related_contacts <wsp_id> <externalId> <tagType>
search_patient <id> [filter]vlcli/
├── src/
│ ├── main.zig # Main CLI logic
│ ├── env_config.zig # Environment configuration
│ └── endpoint_config.zig # Endpoint definitions
├── .env # Environment variables (gitignored)
├── .env.example # Template for environment variables
├── install.sh # Installation script
└── README.md # This file
# Debug build
zig build
# Release build
zig build -Doptimize=ReleaseSafe
# Run tests
zig build testThe CLI now supports runtime environment switching:
- Environment configurations are baked into the binary at build time
- Switch between environments using the
-pflag - No need to rebuild for different environments
- Environment variables must be present at build time
- Keep
.envfile secure and gitignored - Use environment variables for sensitive data
- Store production auth tokens securely
- Consider implementing rate limiting for production endpoints
- Avoid committing any files containing sensitive information
- The binary contains both environments' configurations, keep it secure
The CLI provides clear error messages:
# Missing required parameter
$ vlcli related_contacts 123
Error: Command 'related_contacts' requires 3 parameters, but got 1
Usage: vlcli related_contacts <wsp_id> <externalId> <tagType>
# Invalid environment configuration
Error: Missing required environment variable: PROD_AUTH_HEADER_NAME
# Unknown command
Error: Unknown command 'unknown'
Available commands:
surgery <id>
related_contacts <wsp_id> <externalId> <tagType>
...