feat: add gx run — run scripts with a turbo-style TUI - #30
Merged
Conversation
Introduce the `gx run` backend under src/run/: - discover: resolve `<profile>/run/<script>/` directories, one service per file, with optional NN- ordering prefixes stripped from display names. - buffer: a bounded per-service ring buffer plus an ANSI stripper. - supervisor: spawn each service in its own process group (unix), stream merged stdout/stderr over one mpsc channel, reap via try_wait, and kill/restart with SIGTERM->SIGKILL escalation. - stream: the non-TTY runner that interleaves prefixed, colored output and exits non-zero if any service fails. Adds a unix-only libc dependency for killpg and a SIGINT flag handler.
A full-screen TUI with a service sidebar (status glyphs) on the left and the selected service's scrollback on the right. Keys switch service, focus the log pane, restart (r) / kill (x) a service, quit-and-stop-all (q), and scroll/follow the logs. Modeled on the existing review TUI's event loop, layout, and terminal handling.
Add the `Run { script, edit }` subcommand and its dispatch. The command
resolves the current workspace + main root, discovers the named script
under the personal profile, and opens the TUI on a terminal or streams
prefixed logs when piped. `gx run` with no args lists available scripts;
`--edit` scaffolds a script directory with a template service.
Adds a RunScripts dynamic-completion kind wired into the zsh/bash/fish
completion helpers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
gx run <script>: user-defined, per-repo run scripts that start multiple long-running services (dev server, API, db, …). On a terminal it opens a turbo-style TUI — service sidebar on the left, live logs on the right; piped/CI, it streams prefixed interleaved output.Run scripts
Run scripts are per-user (stored alongside the personal setup script, under
<config>/repos/<repo-key>/run/), not committed to the repo. A script is a directory of files, one file per service:NN[-_.]prefix sets order and is stripped from the name (01-api.sh→api); the extension is stripped too.sh <file>.cwd= the workspacegx runwas invoked from, and getGX_WORKSPACE_ROOT,GX_MAIN_ROOT,GX_RUN_SCRIPT,GX_SERVICE.Usage
gx run— list available scripts.gx run --edit <name>— scaffold a script directory + template service, open in$EDITOR.gx run <name>— start all services (TUI on a TTY, prefixed stream otherwise).TUI keys:
j/k/1-9select ·Tabfocus ·rrestart ·xkill ·q/Ctrl-Cstop-all ·g/Gtop/follow ·h/lhorizontal scroll ·?help.Design
Sync-only, matching the crate: reader threads push lines over one
mpscchannel drained in the render loop; exits are reaped by pollingtry_waitintick(). On unix each service runs in its own process group so a kill reaches a shell script's children (SIGTERM → SIGKILL escalation). New unix-onlylibcdep (killpg + a SIGINT flag handler); no tokio/nix/ctrlc.Commits:
gx runcommand, args, and shell completionsTesting
--edit, unknown-script error, and completion output.Note: the interactive TUI was reviewed and type-checked but not driven live in this environment (needs a real terminal) — worth an eyeball on the sidebar/restart/scroll before merge.