ctx

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2026 License: MIT

README

ctx

Context switcher for DevOps

CI Go Reference GitHub release


ctx is a CLI tool that simplifies working across multiple cloud environments, projects, and infrastructure platforms. Switch between AWS profiles, Kubernetes clusters, VPN connections, and SSH tunnels with a single command.

$ ctx list
NAME           ENVIRONMENT  CLOUD  ORCHESTRATION
acme-dev       development  aws    kubernetes
acme-staging   staging      aws    kubernetes
acme-prod      production   aws    kubernetes

$ ctx use acme-prod
✓ AWS profile: acme-prod (us-east-1)
✓ Kubernetes: prod-cluster/default
✓ VPN connected: wireguard (wg0)
✓ Tunnels: postgres, redis

[ctx: acme-prod] $

Features

Category Features
Cloud Providers AWS, GCP, Azure profile switching with auto-login support
Orchestration Kubernetes, Nomad, Consul context management
Networking SSH tunnels with auto-reconnect, per-tunnel management
VPN OpenVPN, WireGuard, Tailscale, custom commands
Secrets Bitwarden, 1Password, Vault, AWS Secrets Manager, AWS SSM, GCP Secret Manager
Identity Per-context Git user configuration
Registries Docker and NPM registry configuration
Browser Chrome/Firefox profile per context for SSO workflows
Shell Per-shell contexts, colored prompts, environment isolation
Inheritance Base/abstract contexts with multi-level inheritance

Quick Install

curl -fsSL https://github.com/vlebo/ctx/releases/latest/download/install.sh | sh

Add to your ~/.zshrc or ~/.bashrc:

eval "$(ctx shell-hook zsh)"   # for Zsh
eval "$(ctx shell-hook bash)"  # for Bash

Quick Start

# Initialize ctx
ctx init

# Create a context file at ~/.config/ctx/contexts/myproject-dev.yaml
cat > ~/.config/ctx/contexts/myproject-dev.yaml << 'EOF'
name: myproject-dev
description: "MyProject Development Environment"
environment: development

aws:
  profile: myproject-dev
  region: us-west-2

kubernetes:
  context: arn:aws:eks:us-west-2:123456789:cluster/dev
  namespace: default
EOF

# Switch to the context
ctx use myproject-dev

# Verify
ctx                          # Show current context status
aws sts get-caller-identity  # Using your AWS profile
kubectl get pods             # Connected to your cluster

Documentation

Full documentation is available at vlebo.github.io/ctx

Platform Support

Platform Status
Linux Full support
macOS Full support
Windows WSL required

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE for details.

Directories

Path Synopsis
cmd
ctx command
Package main is the entry point for the ctx CLI tool.
Package main is the entry point for the ctx CLI tool.
internal
cli
Package cli implements the command-line interface for ctx.
Package cli implements the command-line interface for ctx.
config
Package config handles configuration loading and management for the ctx CLI.
Package config handles configuration loading and management for the ctx CLI.
shell
Package shell provides shell integration for ctx.
Package shell provides shell integration for ctx.
ssh
Package ssh provides SSH connection and tunnel management.
Package ssh provides SSH connection and tunnel management.
pkg
types
Package types contains shared type definitions for the ctx CLI tool.
Package types contains shared type definitions for the ctx CLI tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL