| cmd | ||
| internal | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| README.md | ||
MyDev
Local dev-environment monitor. AWS auth state, docker containers, git repo status. Two modes: one-shot commands, or a live refreshing TUI dashboard.
Install
Requires Go 1.25+. Two ways:
A. Clone + build (simplest):
git clone git@git.abrell.se:victor/mydev.git
cd mydev
go build -o mydev .
sudo mv mydev /usr/local/bin/ # on PATH
B. go install from the repo (private host, so configure auth once):
go env -w GOPRIVATE=git.abrell.se # skip proxy/checksum DB
git config --global url."git@git.abrell.se:".insteadOf "https://git.abrell.se/" # use SSH
go install git.abrell.se/victor/mydev@latest # → ~/go/bin/mydev
Make sure ~/go/bin is on your PATH for option B
(export PATH="$HOME/go/bin:$PATH").
Updating
When new changes are pushed:
- Clone + build:
git pull && go build -o mydev . && sudo mv mydev /usr/local/bin/ - go install:
go install git.abrell.se/victor/mydev@latest
@latest resolves to the newest git tag (e.g. v1.2.0), or the latest commit
on main if there are no tags. To cut a release, tag and push:
git tag v1.0.0 && git push --tags
Then everyone gets it with go install …@latest (or pin a version with @v1.0.0).
Configure (required for status / dash)
Repo locations live in a config file — no default, no flag. First run:
mydev config init # writes a starter config
mydev config path # prints its location
Config lives at ~/.config/mydev/config.yaml (honors $XDG_CONFIG_HOME):
repos_roots: # scanned one level deep for git repos
- /Users/you/code
- /Users/you/work # multiple roots allowed
dev_dir: /Users/you/code/dev # commands/awsmfa, docker-compose.yml, bin/*.sh
legacy_dir: /Users/you/code/legacy # rundev.sh for prod-data tools
If the file is missing, commands that need it exit with an error telling you to
run config init. New settings get added as keys here later.
Use
# AWS MFA (via dev/commands/awsmfa — the real session, not `aws sts`)
mydev auth # status: account + expiry
mydev auth login # re-authenticate (MFA prompt)
# Dev docker-compose stack (dev/docker-compose.yml)
mydev dev start # auths first, then up -d --force-recreate
mydev dev stop | restart | remove
mydev dev status # are running containers current with the dev repo?
mydev dev status --fetch=false # skip the git fetch (no network)
# Prod data via legacy rundev.sh (mystore:devtool:*)
mydev data table <args>
mydev data snapshot <args>
mydev data userfiles <args>
# DB access requests (dev/bin/*.sh)
mydev db bast # request_bast_access.sh
mydev db grant <arg> # grant_request.sh
mydev db list [arg] # grant_list.sh
# Misc
mydev port 3306 # what's listening on a port (lsof)
mydev docker # container table
mydev status # one-shot overview (auth + docker + repos)
mydev dash [--interval 5] # live TUI dashboard
In the dashboard you can run actions without leaving it:
| key | action |
|---|---|
r |
refresh now |
a |
auth login (MFA prompt) |
s / x / R |
dev start / stop / restart |
: |
command palette — run any subcommand, with args |
q / ctrl+c |
quit |
Quick keys cover the common no-arg actions and show a y/n confirm first.
For anything that takes arguments, press : to open the command palette and
type a full command line, e.g. data table mytenant, db grant 1234,
port 3306 — Enter runs it, Esc cancels.
The palette browses the live command tree as you type: it lists the root
commands first, the subcommands once you pick a group (dev → start/stop/…),
and the usage hint for a leaf command (port → port <number>). Tab
completes the first match. The list is generated from cobra itself, so it always
matches the real commands — no separate help text to keep in sync.
Commands whose output is already on the dashboard are hidden and refused: the
top-level status and the bare auth status. auth login, docker, and
dev status stay (actions, or more detail than the panels show).
Commands run in one of two modes, chosen automatically:
- Interactive (
auth login,dev start/restart, alldata …fetches) — need stdin or produce long live logs/prompts. The dashboard suspends and hands over the full terminal, then resumes. - Captured (everything else:
status,db grant,db list,port, …) — the dashboard stays up showingrunning <cmd>… [c]ancel. While it runs, other launches are blocked (so you can't stack commands);ccancels it (kills the process and returns to the menu, no result shown). When it finishes normally, the output shows in a scrollable result pane.↑/↓scroll,esc/enterclose. Long lines wrap to the terminal width (so things like a generated password aren't cut off), and re-wrap when you resize.
Either way it re-invokes this same binary's subcommands, so behavior matches the CLI exactly. The terminal is cleared when the dashboard starts, before each interactive command, and on exit — so you never see stale output from a previous command (or after quitting).
The AWS panel turns red
(⚠ expiring) when the session has under 30 min left. The DOCKER header shows a
container-freshness badge (✓ all N current / ⚠ N/M stale) — computed locally
each refresh, no network. dev status adds a git-fetch check on top (is the dev
repo itself behind origin); the dashboard deliberately omits that to stay fast.
How it works
Shells out to the real aws, docker, git CLIs — no SDKs, no creds handling
of its own. All probe logic lives in internal/checks/ as plain functions; both
the one-shot commands and the TUI call the same functions, so behavior never drifts.
main.go entrypoint
cmd/ cobra subcommands (auth, dev, data, db, port, docker, status, dash, config)
internal/checks/ auth.go, docker.go, repos.go — read-only probes (capture output)
internal/config/ config.go — load/init the YAML config + path accessors
internal/run/ run.go — stream a command's stdio to the terminal (auth/compose/data)
Probes (internal/checks) capture output for display; actions that prompt or
stream (MFA, compose, data fetch) go through internal/run so they reach the
terminal directly. The dev start/restart commands auto re-auth first,
mirroring the old myd shell function.
Extend
Add a probe: write a func in internal/checks/, then either a new file in cmd/
for a one-shot subcommand, or wire it into dashModel in cmd/dash.go (add a
field, a fetchX command, a message type, and a panel).
Ideas: ECS/EKS context, VPN state, kubectl context, disk space, brew outdated.
License
MIT — see LICENSE.