How linuxfoundation/lfx-cli works
LFX CLI turns terminal commands into authenticated platform operations. The main workflow is login through Auth0, persist credentials and environment state, resolve an access token, then call either a raw API endpoint or a typed Query Service endpoint and print the response. Separate command modules also expose authentication status, logout, environment/backend discovery, and response filtering. The sampled files show command registration and key calls; some service-runner and token-resolution internals are not fully excerpted, so uncertain links are omitted.
Main entry points: main.go CLI command router · auth.go Auth commands · api.go Raw API command · query.go Query service commands
Components 14
CLI entry
- CLI command router
cmd/lfx/main.go - Safe terminal output
internal/commands/terminal.go - Command reference output
internal/commands/docs.go
Authentication
- Auth commands
internal/commands/auth.go - Environment selection
internal/commands/environment.go
Platform requests
- Raw API command
internal/commands/api.go - Query service commands
internal/commands/query.go - Goa endpoint runner
internal/commands/goa.go
Credential storage
- Credential store
internal/credstore/credstore.go
Other components
- Developer
- Auth0
- OS credential backends
- LFX platform APIs
- Query Service
Connections 14
- Developer → CLI command router: runs commands
README.md - CLI command router → Auth commands: registers
cmd/lfx/main.go - CLI command router → Raw API command: registers
cmd/lfx/main.go - CLI command router → Query service commands: registers
cmd/lfx/main.go - CLI command router → Command reference output: registers
cmd/lfx/main.go - Auth commands → Auth0: authenticates with
README.md - Auth commands → Credential store: loads and saves
internal/commands/auth.go - Auth commands → Environment selection: selects environment
README.md - Credential store → OS credential backends: uses credential backends
internal/credstore/credstore.go - Raw API command → LFX platform APIs: sends authenticated requests
README.md - Raw API command → Safe terminal output: writes responses
internal/commands/api.go - Query service commands → Goa endpoint runner: configures endpoints
- Goa endpoint runner → Query Service: dispatches requests
- Query service commands → LFX platform APIs: uses logged-in environment
README.md