{"id":42848064,"url":"https://github.com/user-cube/kontext","last_synced_at":"2026-02-25T00:05:35.437Z","repository":{"id":292372649,"uuid":"980626261","full_name":"user-cube/kontext","owner":"user-cube","description":"A simple CLI tool for managing Kubernetes contexts with ease.","archived":false,"fork":false,"pushed_at":"2026-02-19T22:44:55.000Z","size":630,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-20T01:28:26.535Z","etag":null,"topics":["kubernetes","kubernetes-admin"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/user-cube.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-09T12:47:06.000Z","updated_at":"2026-02-19T22:44:57.000Z","dependencies_parsed_at":"2025-05-09T16:20:59.566Z","dependency_job_id":"329ef95e-8ee5-45c8-894e-e045ff982cea","html_url":"https://github.com/user-cube/kontext","commit_stats":null,"previous_names":["user-cube/kontext"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/user-cube/kontext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/user-cube%2Fkontext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/user-cube%2Fkontext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/user-cube%2Fkontext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/user-cube%2Fkontext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/user-cube","download_url":"https://codeload.github.com/user-cube/kontext/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/user-cube%2Fkontext/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29806145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T22:43:48.403Z","status":"ssl_error","status_checked_at":"2026-02-24T22:43:18.536Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kubernetes","kubernetes-admin"],"created_at":"2026-01-30T12:00:00.104Z","updated_at":"2026-02-25T00:05:35.422Z","avatar_url":"https://github.com/user-cube.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kontext\n\nA simple CLI tool for managing Kubernetes contexts with ease.\n\n![demo](./demo/kontext-demo.gif)\n\n## Overview\n\nKontext helps you manage your Kubernetes contexts efficiently with a simple command-line interface. It allows you to:\n\n- List all available Kubernetes contexts\n- Show your current active context\n- Switch between contexts with tab completion\n- Interactively select contexts from a menu\n- View and change namespaces within contexts\n\n## Installation\n\n### Homebrew\n\n```bash\nbrew tap user-cube/tap\nbrew install kontext\n```\n\n### Go\n\n```bash\ngo install github.com/user-cube/kontext@latest\n```\n\n## Usage\n\n### List all available contexts\n\n```bash\nkontext list\n```\n\nThis will display all contexts from your kubeconfig with the current context highlighted.\n\n### Show current context\n\n```bash\nkontext current\n```\n\n### Switch to a different context\n\n```bash\nkontext switch \u003ccontext-name\u003e\n```\nWith tab completion for context names!\n\n### Interactive context selection\n\nSimply run:\n```bash\nkontext switch\n```\nWithout any arguments to get an interactive selection menu of all available contexts.\n\nYou can also run just:\n```bash\nkontext\n```\nTo access the same interactive context selection.\n\n### Namespace Management\n\nView or change the current namespace:\n```bash\nkontext namespace\n```\nor use the shorter alias:\n```bash\nkontext ns\n```\n\nShow the current namespace without the selector:\n```bash\nkontext ns --show\n# or with short flag\nkontext ns -s\n```\n\nSwitch to a specific namespace without using the interactive selector:\n```bash\nkontext ns my-namespace\n```\n\n### Switch Context and Namespace Together\n\nSwitch context and then set namespace in one command:\n```bash\n# Interactive context selection, then namespace selection\nkontext switch -n\n# or with the root command\nkontext -n\n\n# Select specific context, then namespace selection\nkontext switch my-context -n\n# or with the root command\nkontext my-context -n\n\n# Select specific context and directly set namespace\nkontext switch my-context -n my-namespace\n# or with the root command\nkontext my-context -n my-namespace\n```\n\n## Features\n\n- **Smart Context Sorting**: Current context is prioritized in selection lists\n- **Smart Namespace Sorting**: Current namespace is prioritized in selection lists\n- **Non-Existent Namespace Handling**: Warns when non-existent namespaces are specified\n- **Detailed Information**: Clear success/error messages with color-coded output\n- **Tab Completion**: Supports bash/zsh completions for context and namespace names\n- **Intuitive UI**: Interactive selectors with highlighted current selections\n- **Offline Mode Support**: Fallback behavior when clusters are unavailable\n\n## Examples\n\nHere are some common workflows:\n\n### Viewing Available Resources\n\n```bash\n# List all contexts\nkontext list\n\n# Show current context\nkontext current\n\n# Show current namespace\nkontext ns -s\n```\n\n### Changing Contexts\n\n```bash\n# Switch to a context interactively\nkontext switch\n# or simply\nkontext\n\n# Switch to specific context\nkontext switch my-dev-cluster\n\n# Switch to production context (with tab completion)\nkontext switch prod\u003cTAB\u003e\n```\n\n### Working with Namespaces\n\n```bash\n# View current namespace\nkontext ns -s\n\n# Change namespace interactively\nkontext ns\n\n# Change directly to a specific namespace\nkontext ns kube-system\n\n# Multi-step workflow\nkontext switch my-dev-cluster  # Switch context first\nkontext ns my-app              # Then switch namespace\n\n# Combined workflow\nkontext switch my-prod-cluster -n  # Switch context and then select namespace\n```\n\n### Efficient Context Switching\n\nFor the most common case (switching contexts):\n```bash\n# Just type the main command for interactive selection\nkontext\n\n# Use the -n flag to also select namespace after switching context\nkontext -n\n\n# Directly switch to a context\nkontext my-context\n\n# Directly switch to a context and then select namespace\nkontext my-context -n\n```\n\n### Delete a Context\n\nDelete a Kubernetes context from your kubeconfig:\n\n```bash\n# Delete a context interactively\nkontext delete\n\n# Delete a specific context by name\nkontext delete my-context\nkontext rm my-context\n```\n\nYou will be asked for confirmation before the context is removed.\n\n## Shell Completion\n\nTo enable shell completion:\n\n### Bash\n\n```bash\necho 'source \u003c(kontext completion bash)' \u003e\u003e ~/.bashrc\n```\n\n### Zsh\n\n```bash\necho 'source \u003c(kontext completion zsh)' \u003e\u003e ~/.zshrc\n```\n\n### Fish\n\n```bash\nkontext completion fish \u003e ~/.config/fish/completions/kontext.fish\n```\n\n## Project Structure\n\nThe project is organized into the following packages:\n\n- **cmd/** - Command implementations using Cobra\n  - `current.go` - Show current context\n  - `list.go` - List available contexts\n  - `namespace.go` - Namespace management\n  - `root.go` - Root command setup\n  - `switch.go` - Context switching\n  - `delete.go` - Delete contexts\n  - `version.go` - Version info\n\n- **pkg/** - Reusable packages\n  - **kubeconfig/** - Kubernetes configuration handling\n    - `kubeconfig.go` - Functions for working with kubeconfig files\n  - **ui/** - User interface components\n    - `ui.go` - Shared UI formatting and interactive components\n\nThis clean separation ensures:\n- UI code is centralized in the `ui` package\n- Kubernetes logic is contained in the `kubeconfig` package\n- Command files only handle CLI argument parsing and orchestration\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuser-cube%2Fkontext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuser-cube%2Fkontext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuser-cube%2Fkontext/lists"}