{"id":46380068,"url":"https://github.com/eminwux/sbsh","last_synced_at":"2026-06-05T23:01:09.684Z","repository":{"id":318743096,"uuid":"1043293493","full_name":"eminwux/sbsh","owner":"eminwux","description":"🚂 sbsh brings Terminal-as-Code to your workflow, making terminal environments reproducible, persistent, and safe to share across your team.","archived":false,"fork":false,"pushed_at":"2026-04-27T02:19:18.000Z","size":7436,"stargazers_count":42,"open_issues_count":48,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-27T02:26:12.395Z","etag":null,"topics":["devops","devops-team","devops-tools","reproducible-environments","shell-profiles","sre-team","terminal","terminal-manager"],"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/eminwux.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":"ROADMAP.md","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-08-23T14:50:43.000Z","updated_at":"2026-04-27T01:43:30.000Z","dependencies_parsed_at":"2025-10-29T23:16:56.902Z","dependency_job_id":"57df3e3c-2c09-437d-8f7c-5808da8bfb75","html_url":"https://github.com/eminwux/sbsh","commit_stats":null,"previous_names":["eminwux/sbsh"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/eminwux/sbsh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminwux%2Fsbsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminwux%2Fsbsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminwux%2Fsbsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminwux%2Fsbsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eminwux","download_url":"https://codeload.github.com/eminwux/sbsh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminwux%2Fsbsh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32590466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"last_error":"SSL_read: 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":["devops","devops-team","devops-tools","reproducible-environments","shell-profiles","sre-team","terminal","terminal-manager"],"created_at":"2026-03-05T06:02:22.846Z","updated_at":"2026-05-04T01:05:20.962Z","avatar_url":"https://github.com/eminwux.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚂 sbsh: Terminal-as-Code for reproducible, persistent and shareable shell environments\n\n![status: active](https://img.shields.io/badge/status-active-blue)\n![state: beta](https://img.shields.io/badge/state-beta-orange)\n![license: apache2](https://img.shields.io/badge/license-Apache%202.0-green)\n[![Test](https://github.com/eminwux/sbsh/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/eminwux/sbsh/actions/workflows/test.yaml)\n\nsbsh brings _Terminal-as-Code_ to your workflow: define terminal environments declaratively with YAML manifests that can be version-controlled, shared, and reused across your team. Each profile specifies environment variables, lifecycle hooks, startup commands, and visual prompts, ensuring consistent setups across local machines, jump hosts, and CI/CD pipelines. Terminals survive network drops, client restarts, and accidental disconnects, remaining discoverable and shareable for collaboration.\n\n**Demo - Launch a Terraform production workspace: profile automatically configures environment, workspace, and shows red warning prompt**\n\n![Demo - Launch a Terraform production workspace: profile automatically configures environment, workspace, and shows red warning prompt](docs/assets/demo-terraform.gif)\n\n## Quick Start\n\nGet sbsh up and running in minutes.\n\n### Install\n\n```bash\n# Set your platform (defaults shown)\nexport OS=linux        # Options: linux, darwin, freebsd\nexport ARCH=amd64      # Options: amd64, arm64\n\n# Install sbsh\ncurl -L -o sbsh https://github.com/eminwux/sbsh/releases/download/v0.6.0/sbsh-${OS}-${ARCH} \u0026\u0026 \\\nchmod +x sbsh \u0026\u0026 \\\nsudo install -m 0755 sbsh /usr/local/bin/sbsh \u0026\u0026 \\\nsudo ln -f /usr/local/bin/sbsh /usr/local/bin/sb\n```\n\n### Autocomplete\n\n```bash\ncat \u003e\u003e ~/.bashrc \u003c\u003cEOF\nsource \u003c(sbsh autocomplete bash)\nsource \u003c(sb autocomplete bash)\nEOF\n```\n\n## Documentation\n\nComplete documentation is available at [https://sbsh.io](https://sbsh.io), including guides, tutorials, API reference, and examples.\n\n## Why sbsh\n\n_Terminal-as-Code_ brings the discipline of Infrastructure-as-Code to interactive environments:\n\n- Reproducible setups: Profiles ensure identical environments across team members and CI/CD\n- Durable terminals: Survive crashes and network interruptions\n- Team collaboration: Share terminals with teammates for pair programming and collaborative debugging\n- Environment safety: Color-coded prompts and standardized configurations prevent mistakes\n- Automation ready: Programmatic API and structured logs enable integration with existing tooling\n\n## Usage Examples\n\nCommon workflows for working with terminals and profiles.\n\n### Start a Terminal\n\n```bash\n$ sbsh\nTo detach, press ^] twice\n[sbsh-35af93de] user@host:~/projects$\n```\n\n### Detach (Terminal Keeps Running)\n\nPress `Ctrl-]` twice or run `sb detach`:\n\n```bash\n[sbsh-35af93de] user@host:~/projects$ # Press Ctrl-] twice\nDetached\n$  # Back to your shell, but terminal is still running\n```\n\n### List Active Terminals\n\n```bash\n$ sb get terminals\nID        NAME           PROFILE  CMD                           STATUS\nbbb4b457  quick_samwise  default  /bin/bash --norc --noprofile  Ready\n```\n\n### Reattach to a Terminal\n\n```bash\n$ sb attach quick_samwise\n[sbsh-bbb4b457] user@host:~/projects$ # Back where you left off!\n```\n\n### Use a Profile\n\n```bash\n# Start with a profile\n$ sbsh -p k8s-default\n# Automatically configures kubectl context, shows cluster status\n\n# Or use Docker\n$ sbsh -p docker-container\nsbsh root@container-id:~$\n```\n\n### List Available Profiles\n\n```bash\n$ sb get profiles\nNAME              TARGET  ENVVARS  CMD\nk8s-default       local   4 vars   /bin/bash\nterraform-prd     local   2 vars   /bin/bash\ndocker-container  local   0 vars   /usr/bin/docker run ...\nssh-pk            local   0 vars   /usr/bin/ssh -t pk\n```\n\n→ See [docs/profiles/README.md](docs/profiles/README.md) to learn how to create your own profiles.\n\n## Understanding sbsh Commands\n\nThree commands, one binary: sbsh uses hard links (busybox-style) to provide different behaviors.\n\n| Command         | Purpose              | Launches              | Attached      |\n| --------------- | -------------------- | --------------------- | ------------- |\n| `sbsh`          | Interactive terminal | Client + Terminal     | Yes           |\n| `sbsh terminal` | Background terminal  | Terminal only         | No (detached) |\n| `sb`            | Management tool      | Nothing (client only) | N/A           |\n\nAll three are the same binary; behavior is determined by the executable name at runtime.\n\n### `sbsh` - Interactive Client + Terminal\n\nLaunches a client attached to a terminal. Designed for interactive use and can be set as your login shell:\n\n```bash\n$ sbsh\n[sbsh-35af93de] user@host:~/projects$\n```\n\nPress `Ctrl-]` twice to detach. The terminal keeps running.\n\n### `sbsh terminal` - Terminal Only\n\nLaunches a terminal in the background with no attached client:\n\n```bash\n$ sbsh terminal --name my-terminal\n# Attach later with: sb attach my-terminal\n```\n\nPerfect for background tasks and automation.\n\n### `sb` - Management Tool\n\nPure client tool for managing existing clients and terminals:\n\n```bash\n$ sb get terminals    # List all terminals\n$ sb get clients      # List all clients\n$ sb attach \u003cname\u003e    # Attach to a terminal\n$ sb detach           # Detach from a client\n$ sb get profiles     # List available profiles\n```\n\nWorks from any machine that can access the socket files.\n\n## Profiles: Declarative Environment Manifests\n\nYAML manifests define terminal environments declaratively, the essence of _Terminal-as-Code_. Profiles specify environment variables, lifecycle hooks (`onInit`, `postAttach`), startup commands, and visual prompts. Version-controlled and shared across teams, preventing mistakes like applying Terraform to the wrong workspace or using the wrong Kubernetes cluster.\n\n### Profiles by Example\n\n**Terraform production workspace:**\n\n```yaml\napiVersion: sbsh/v1beta1\nkind: TerminalProfile\nmetadata:\n  name: terraform-prd\nspec:\n  shell:\n    env:\n      TF_VAR_environment: \"prd\"\n    prompt: '\"\\[\\e[1;31m\\]sbsh(terraform-prd) \\[\\e[1;32m\\]\\u@\\h\\[\\e[0m\\]:\\w\\$ \"'\n  stages:\n    onInit:\n      - script: terraform workspace use prd\n      - script: terraform init\n```\n\n**Kubernetes development terminal:**\n\n```yaml\napiVersion: sbsh/v1beta1\nkind: TerminalProfile\nmetadata:\n  name: k8s-default\nspec:\n  shell:\n    env:\n      KUBE_CONTEXT: default\n      KUBE_NAMESPACE: default\n  stages:\n    onInit:\n      - script: kubectl config use-context $KUBE_CONTEXT\n    postAttach:\n      - script: kubectl get pods\n```\n\n→ See [docs/profiles/README.md](docs/profiles/README.md) for detailed examples and reference.\n\n→ See [docs/features.md](docs/features.md) for a complete overview of features and capabilities.\n\n## How It Works\n\nTerminals run independently from clients, defined by profiles and running persistently.\n\n1. Profile defines environment: YAML manifest specifies env vars, commands, hooks, and prompts\n2. Terminal runs independently: Shell environment continues even if client exits\n3. All I/O captured and logged: Complete audit trail stored for every environment\n4. Metadata stored for discovery: Terminal information enables true session discovery\n5. Shareable and attachable: Multiple people can attach to the same environment\n6. Reattach anytime, from anywhere: Discover and connect to environments by name or ID\n\n## A Tool for Developers \u0026 Operations Teams\n\nFor teams who need consistent, shareable shell environments. Infrastructure engineers, software developers, DevOps teams, SREs, and automation engineers.\n\n- Infrastructure Engineers: Managing Kubernetes clusters, Terraform workspaces, and cloud resources\n- Software Developers: Python, Go, Node.js, Rust development with team-shared configurations\n- DevOps Teams: Collaborative debugging, shared infrastructure terminals, standardized CI/CD\n- SREs \u0026 System Administrators: Persistent server management, incident response workflows\n- Automation Engineers: API-driven terminal management, scripted operations, tool integration\n\n## CI/CD Integration\n\nProfiles work identically in local development and CI/CD pipelines. Define your environment once, use it everywhere.\n\nKey benefits: reproducibility (same profile locally and in CI), debugging (persistent terminals for failed runs), version control (profiles in repo), structured logs (complete I/O capture), and team consistency (eliminate setup drift).\n\n→ See [docs/cicd.md](docs/cicd.md) for detailed examples and best practices for GitHub Actions, GitLab CI/CD, and Jenkinsfile.\n\n## Container Usage\n\nOfficial Docker images for running persistent terminals in containerized environments. Quick deployment in Docker, Kubernetes, or any container orchestration platform.\n\n```bash\ndocker pull docker.io/eminwux/sbsh:v0.6.0-linux-amd64\ndocker run -it --rm \\\n  -v ~/.sbsh:/root/.sbsh \\\n  docker.io/eminwux/sbsh:v0.6.0-linux-amd64 \\\n  sbsh\n```\n\nImages are available for both `linux-amd64` and `linux-arm64` architectures.\n\n→ See [docs/container.md](docs/container.md) for detailed documentation on container usage, volume management, Docker Compose examples, and Kubernetes integration.\n\n## How sbsh Differs from screen and tmux\n\nsbsh is designed for environment management and team collaboration. Key differences: declarative YAML profiles (not dotfiles), built-in discovery and multi-attach, lifecycle hooks, and terminals that survive client crashes.\n\nUnlike tmux or screen, sbsh has no central server or daemon process. Each terminal runs as an independent process with its own lightweight client, so failures are isolated and do not affect other terminals.\n\n→ See [docs/comparison.md](docs/comparison.md) for detailed comparison.\n\n## Why sbsh Exists\n\nShell environments are still treated as ephemeral and manually configured. Once a shell closes or a connection drops, the environment and all its configuration dies with it. sbsh changes that by making shell environments first-class resources: defined by profiles and durable. Each terminal continues running even if the client exits or restarts.\n\n## Philosophy\n\nsbsh follows the traditional Unix philosophy: build simple tools that do one thing well and compose naturally with others. It treats supervision not as orchestration or complexity, but as clarity, giving interactive work the same discipline that background services have enjoyed for decades. sbsh applies the same principles of Infrastructure-as-Code to interactive environments, turning terminals into reproducible, declarative, and shareable units of work.\n\nAs Ken Thompson once said, \"One of my most productive days was throwing away 1,000 lines of code.\" sbsh embraces that mindset by keeping its design small, transparent, and essential: a single program that brings reproducibility, shareability, and persistence to shell environments.\n\n## Status and Roadmap\n\nsbsh is under active development, with a focus on correctness, portability, and clear abstractions before adding integrations.\n\n→ See [ROADMAP.md](./ROADMAP.md) for work in progress, planned features, and the project roadmap.\n\n## Contribute\n\nsbsh is an open project that welcomes thoughtful contributions. The goal is to build a simple, reliable foundation for reproducible, shareable shell environments, not a large framework. Discussions, code reviews, and design proposals are encouraged, especially around clarity, portability, and correctness.\n\n## License\n\nApache License 2.0\n\n© 2025 Emiliano Spinella (eminwux)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feminwux%2Fsbsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feminwux%2Fsbsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feminwux%2Fsbsh/lists"}