devcfg

command module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 3 Imported by: 0

README ยถ

๐Ÿงญ devcfg โ€” Linux/macOS Environment Configuration TUI

Release Tests Pipeline Go Version Go Report Card

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:

  1. Connect manually via SSH
  2. Download and run devcfg
  3. Follow the interactive TUI workflow
  4. Configure your environment (tools, git, dockerโ€ฆ)
  5. Everything runs locally on the remote machine

๐Ÿš€ Quick Start

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 devcfg binary
  • Install it to ~/.local/bin (creating the directory if needed)
  • Add ~/.local/bin to your PATH in your shell configuration file (.bashrc, .zshrc, etc.)
  • Provide instructions for making devcfg immediately available

After installation, either:

  1. Open a new terminal, or
  2. Run source ~/.bashrc (or ~/.zshrc for 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.name
  • user.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 docker group (offers sudo 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:


๐Ÿงช 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 with t.Run(tc.name, ...) to keep cases readable and easy to extend.
  • No external test framework โ€” only the standard testing package. Helpers from testing/iotest or os/exec stubs 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 with t.Setenv().
  • One assertion per sub-test โ€” keep each t.Run focused; avoid asserting unrelated things together.
  • Error paths covered โ€” every function that returns an error must 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
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 the tea.Model interface, and wire it up in internal/tui/app.go.
  • Change styling โ€” update the Lipgloss theme in internal/tui/tuistyles/styles.go.
Submitting a PR
  1. Create a feature branch: git checkout -b feat/my-change
  2. Make and commit your changes
  3. Open a pull request against main

๐Ÿ“ฆ CI/CD

GitHub Actions workflow (.github/workflows/release.yml) triggers on v* tag pushes and:

  1. Builds devcfg-linux-amd64 (cross-compiled on ubuntu-latest)
  2. Builds devcfg-darwin-arm64 (cross-compiled on ubuntu-latest)
  3. 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 tssh style
  • Deterministic + minimal โ€” explicit steps, clear feedback
  • Extensible via registry โ€” the bundled tool registry is defined in tools.json; changes require rebuilding the binary

Documentation ยถ

The Go Gopher

There is no documentation for this package.

Directories ยถ

Path Synopsis
internal
tui

Jump to

Keyboard shortcuts

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