README
ยถ
๐งญ devcfg โ Linux/macOS Environment Configuration TUI
devcfg is a CLI TUI written in Go that lets you configure a Linux/macOS machine after an SSH connection, without any built-in SSH logic.
Workflow:
- Connect manually via SSH
- Download and run
devcfg - Follow the interactive TUI workflow
- Configure your environment (tools, git, dockerโฆ)
- Everything runs locally on the remote machine
๐ Quick Start
Recommended: One-line Install Script
The installation script automatically downloads a pre-built binary if available, or builds from source if not. It installs the binary to ~/.local/bin and updates your PATH:
curl -fsSL https://raw.githubusercontent.com/I3-rett/devcfg/main/install.sh | bash
The script will:
- Download or build the
devcfgbinary - Install it to
~/.local/bin(creating the directory if needed) - Add
~/.local/binto your PATH in your shell configuration file (.bashrc,.zshrc, etc.) - Provide instructions for making
devcfgimmediately available
After installation, either:
- Open a new terminal, or
- Run
source ~/.bashrc(or~/.zshrcfor zsh)
Then you can run devcfg from anywhere.
Option 1: Download Pre-built Binary (if available)
# Linux (amd64)
curl -fsSL https://github.com/I3-rett/devcfg/releases/latest/download/devcfg-linux-amd64 -o devcfg \
&& chmod +x devcfg && ./devcfg
# macOS (Apple Silicon)
curl -fsSL https://github.com/I3-rett/devcfg/releases/latest/download/devcfg-darwin-arm64 -o devcfg \
&& chmod +x devcfg && ./devcfg
Note: If you get a "Not Found" error, releases may not be published yet. Use the install script or Option 2 below.
Option 2: Build from Source
Requirements: Go 1.24+
git clone https://github.com/I3-rett/devcfg.git
cd devcfg
go build -o devcfg .
./devcfg
๐ฎ TUI Navigation
| Key | Action |
|---|---|
โ / k |
Move cursor up |
โ / j |
Move cursor down |
SPACE |
Toggle selection (checkbox / radio) |
ENTER on item |
Toggle selection |
ENTER on Continue |
Validate step and proceed |
Tab / Shift+Tab |
Navigate form fields (Git step) |
q / Ctrl+C |
Quit |
๐ช Workflow Steps
Step 1 โ Tools Installation
Interactive checklist of tools to install. Uses the system package manager (brew/apt) or a fallback script.
Available tools: git, neovim, docker, nodejs, python3, curl, tmux, htop, ripgrep, fzf, zsh, starship, bat
Step 1/3 โ Tools Installation
[ ] git Version control system
[โ] neovim Hyperextensible text editor
โถ [ ] docker Container platform
[ ] nodejs JavaScript runtime
...
โญโโโโโโโโโโโโโโโฎ
โ Continue โ
โฐโโโโโโโโโโโโโโโฏ
Step 2 โ Git Configuration
Form to set git config --global identity.
user.nameuser.email- GPG signing toggle (
commit.gpgsign)
Step 3 โ Docker Setup
Automatic checks:
- Docker installation detected
- Docker daemon status (via
systemctl is-active docker) - User membership in the
dockergroup (offerssudo usermod -aG docker $USER)
๐๏ธ Architecture
devcfg/
โโโ main.go Entry point
โโโ internal/
โ โโโ system/detect.go OS + package manager detection
โ โโโ registry/
โ โ โโโ registry.go Tool registry (go:embed)
โ โ โโโ tools.json Tool definitions (13 tools)
โ โโโ resolver/resolver.go brew / apt / fallback selection
โ โโโ executor/executor.go Command runner (stdout+stderr capture)
โ โโโ tui/
โ โโโ app.go Root Bubble Tea model (step orchestrator)
โ โโโ tuistyles/styles.go Lipgloss theme (purple/teal)
โ โโโ steps/
โ โโโ tools.go Step 1 โ Tools checklist
โ โโโ git.go Step 2 โ Git config form
โ โโโ docker.go Step 3 โ Docker checks
โโโ .github/workflows/release.yml CI/CD: build + publish release
Layer Responsibilities
| Layer | Package | Role |
|---|---|---|
| System | internal/system |
Detect OS (macos, ubuntu, debian, linux) and package manager (brew, apt, none) via runtime.GOOS and /etc/os-release |
| Registry | internal/registry |
Load tool definitions from embedded tools.json; expose List() and Find(name) |
| Resolver | internal/resolver |
Select install command: brew โ apt โ fallback script |
| Executor | internal/executor |
Run arbitrary commands with os/exec, capture combined stdout+stderr |
| TUI | internal/tui |
Multi-step Bubble Tea workflow with lipgloss styling |
โ๏ธ Tool Model (tools.json)
{
"name": "neovim",
"description": "Hyperextensible text editor",
"brew": "neovim",
"apt": "neovim",
"fallback": ""
}
Each tool carries its own package name per package manager. No OS coupling in the tool definition itself.
๐ง Resolver Priority
brew available + brew package defined โ brew install <pkg>
apt available + apt package defined โ sudo apt-get install -y <pkg>
fallback script defined โ sh -c "<script>"
otherwise โ error: no install method
๐ฆ Build from Source
git clone https://github.com/I3-rett/devcfg.git
cd devcfg
go build -o devcfg .
./devcfg
Requirements: Go 1.24+
Dependencies:
github.com/charmbracelet/bubbleteaโ TUI frameworkgithub.com/charmbracelet/lipglossโ terminal stylinggithub.com/charmbracelet/bubblesโ text inputs
๐งช Testing
Guidelines
Tests in this project follow standard Go conventions and are co-located with the packages they cover (*_test.go in the same directory).
Principles
- Table-driven tests โ use
[]struct{ name, input, want }slices and iterate witht.Run(tc.name, ...)to keep cases readable and easy to extend. - No external test framework โ only the standard
testingpackage. Helpers fromtesting/iotestoros/execstubs where relevant. - Isolation โ unit tests must not make real network calls or perform persistent filesystem mutations. Use
t.TempDir()for temporary files, keep filesystem writes confined there, and restore env variables witht.Setenv(). - One assertion per sub-test โ keep each
t.Runfocused; avoid asserting unrelated things together. - Error paths covered โ every function that returns an
errormust have at least one test case that triggers the error branch. - Deterministic โ tests must not rely on timing, random values, or test-execution order.
Coverage targets
| Package | Priority | Notes |
|---|---|---|
internal/system |
High | Mock filesystem for /etc/os-release; mock PATH for binary detection |
internal/registry |
High | Validate List() length + fields; Find() hit and miss |
internal/resolver |
High | All package-manager ร tool combinations; fallback; error case |
internal/executor |
Medium | Real subprocess (echo); empty args; failing command |
internal/tui |
Low | Pure View/Init smoke tests; no interactive input required |
Running tests
# All packages
go test ./...
# With race detector (recommended in CI)
go test -race ./...
# With coverage report
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out
๐ ๏ธ Dev Setup (Contributing)
Prerequisites
- Go 1.24+
git
Quickstart
# 1. Fork then clone the repo
git clone https://github.com/<your-fork>/devcfg.git
cd devcfg
# 2. Download dependencies
go mod download
# 3. Build the binary
go build -o devcfg .
# 4. Run locally
./devcfg
Run without building
go run .
Project layout
devcfg/
โโโ main.go Entry point
โโโ go.mod / go.sum Module definition and lock file
โโโ internal/
โโโ system/detect.go OS + package manager detection
โโโ registry/
โ โโโ registry.go Tool registry (go:embed)
โ โโโ tools.json Tool definitions
โโโ resolver/resolver.go brew / apt / fallback selection
โโโ executor/executor.go Command runner
โโโ tui/
โโโ app.go Root Bubble Tea model (step orchestrator)
โโโ tuistyles/styles.go Lipgloss theme
โโโ steps/
โโโ tools.go Step 1 โ Tools checklist
โโโ git.go Step 2 โ Git config form
โโโ docker.go Step 3 โ Docker checks
Making changes
- Add a new tool โ edit
internal/registry/tools.json(rebuild required to embed the updated file). - Add a new TUI step โ create a new file under
internal/tui/steps/, implement thetea.Modelinterface, and wire it up ininternal/tui/app.go. - Change styling โ update the Lipgloss theme in
internal/tui/tuistyles/styles.go.
Submitting a PR
- Create a feature branch:
git checkout -b feat/my-change - Make and commit your changes
- Open a pull request against
main
๐ฆ CI/CD
GitHub Actions workflow (.github/workflows/release.yml) triggers on v* tag pushes and:
- Builds
devcfg-linux-amd64(cross-compiled on ubuntu-latest) - Builds
devcfg-darwin-arm64(cross-compiled on ubuntu-latest) - Creates a GitHub Release with both binaries
๐ Distribution
Pre-built binaries are available in GitHub Releases once a version tag is pushed.
# Linux (amd64)
curl -fsSL https://github.com/I3-rett/devcfg/releases/latest/download/devcfg-linux-amd64 -o devcfg \
&& chmod +x devcfg && ./devcfg
# macOS (Apple Silicon)
curl -fsSL https://github.com/I3-rett/devcfg/releases/latest/download/devcfg-darwin-arm64 -o devcfg \
&& chmod +x devcfg && ./devcfg
Note: If no releases have been published yet, build from source following the instructions in the Quick Start section.
๐งฉ Philosophy
- SSH-external โ no internal SSH logic; runs where you are
- Local execution only โ all commands run on the target machine
- Structured workflow โ not just a package installer
- Keyboard-first UX โ inspired by
tsshstyle - Deterministic + minimal โ explicit steps, clear feedback
- Extensible via registry โ the bundled tool registry is defined in
tools.json; changes require rebuilding the binary
Documentation
ยถ
There is no documentation for this package.