CLI Reference#
Complete reference for all APX commands and options.
Command Categories#
APX commands are organized into logical categories:
apx init- Initialize projectsapx fetch- Download toolchainapx gen- Generate code with canonical importsapx sync- Update go.work overlaysapx link- Link Python overlays for local devapx unlink- Remove overlays for released APIs
apx search- Discover APIsapx show- View API detailsapx add- Add dependencies
apx release- Release pipeline (prepare, submit, finalize)apx semver suggest- Suggest version bump
apx lint- Schema validationapx breaking- Breaking changesapx policy- Policy enforcement
apx config- Configuration managementapx fetch- Download toolchainapx inspect/apx explain- Identity analysisapx external- External API management
--json- Machine-readable output--quiet/--no-color- Output control--config- Custom config file
Quick Reference#
Most Common Commands#
# Initialize new project (interactive)
apx init
# Add dependency
apx add proto/payments/ledger/v1@v1.2.3
# Validate schemas
apx lint && apx breaking --against=HEAD^
# Get version suggestion
apx semver suggest --against=HEAD^
# Generate code with canonical import paths
apx gen go # generates stubs with canonical imports
apx sync # updates go.work overlays
# Switch from overlay to released module
apx unlink proto/payments/ledger/v1
go get github.com/myorg/apis/proto/payments/ledger@v1.2.3
# Release pipeline (prepare -> submit -> finalize)
apx release prepare proto/payments/ledger/v1 --version v1.0.0
apx release submit
apx release finalize # run by canonical CI
# Release history and inspection
apx release history proto/payments/ledger/v1
apx release inspect
# Lifecycle promotion
apx release promote proto/payments/ledger/v1 --to stable --version v1.0.0
Application code using canonical imports:
// service.go - your application
package service
import (
// Pattern: github.com/<org>/apis/proto/<domain>/<api>/v1
ledgerv1 "github.com/myorg/apis/proto/payments/ledger/v1"
usersv1 "github.com/myorg/apis/proto/users/profile/v1"
productsv2 "github.com/myorg/apis/proto/inventory/products/v2"
)
type Service struct {
ledgerClient ledgerv1.LedgerServiceClient
usersClient usersv1.ProfileServiceClient
productsClient productsv2.ProductServiceClient
}
Path Mapping Reference#
APX API Path → Go Import Path
APX API Path |
Go Module Path |
Go Import Path |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
APX API Path → Python Package
APX API Path |
Python Dist Name |
Python Import Path |
|---|---|---|
|
|
|
|
|
|
|
|
|
APX API Path → Java / Maven
APX API Path |
Maven GroupId |
Maven ArtifactId |
Java Package |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
TypeScript — Planned. npm scope and package name derivation will follow the same deterministic pattern.
Local Overlay Paths
APX API Path |
Local Generated Path |
Overlay in go.work |
|---|---|---|
|
|
|
|
|
|
Discovery & Search#
# Search for APIs (single keyword or phrase)
apx search payments
# View full details for a specific API
apx show proto/payments/ledger/v1
# Add dependency
apx add proto/payments/ledger/v1@v1.2.3
Version Management#
# Get version suggestion (requires --against)
apx semver suggest --against=HEAD^
Exit Codes#
APX uses consistent exit codes:
0: Success
1: General error (command failed, validation error)
6: Validation failure (lint or breaking-change check failed)
Environment Variables#
APX_CONFIG#
Override default configuration file location:
export APX_CONFIG=/path/to/custom/apx.yaml
apx lint # uses custom config
APX_VERBOSE#
Enable verbose output for all commands:
export APX_VERBOSE=true
apx lint # now shows verbose diagnostics
Planned
APX_USE_CONTAINER and APX_CACHE_DIR environment variables are planned for a future release.
Configuration File#
APX uses apx.yaml for configuration (generated by apx init):
version: 1 # required
org: myorg # required
repo: my-apis # required
module_roots: # optional — schema root paths
- proto
- openapi
language_targets:
go:
enabled: true
policy:
forbidden_proto_options:
- "^gorm\\."
release:
tag_format: "{subdir}/v{version}"
ci_only: true
tools:
buf:
version: v1.45.0
execution:
mode: "local"
container_image: ""
Shell Completion#
Enable shell completion for better CLI experience:
Bash#
# Add to ~/.bashrc
source <(apx completion bash)
# Or install system-wide
apx completion bash | sudo tee /etc/bash_completion.d/apx
Zsh#
# Add to ~/.zshrc
source <(apx completion zsh)
# Or for oh-my-zsh
apx completion zsh > "${fpath[1]}/_apx"
Fish#
apx completion fish | source
# Or install permanently
apx completion fish > ~/.config/fish/completions/apx.fish
Next Steps#
Learn core commands for project setup
Master dependency commands for API management
Master release commands for the release pipeline
Use validation commands for quality assurance
Explore utility commands for daily workflows