feat(cli): shell-init eval hook, prompt segment & completions (spec 30 phase 2) - #116
Merged
Conversation
…0 phase 2) The "execute, don't print" shell integration on top of the active-context model (phase 1). - `devstack shell-init zsh|bash|fish` emits: the install dir on PATH, a `devstack` wrapper that eval's `use`'s output (so `use` cd's + sets DEVSTACK_* in the LIVE shell), completion loading, and a `devstack_prompt` helper. The wrapper is named after the invoked binary, so aliases (rq) get an rq() wrapper. - `use --print --shell <shell>` emits POSIX or fish syntax; bare `use --print` routes its hint to stderr so stdout stays an eval-safe (empty) script. - `context --prompt` is a cheap prompt segment (config + DEVSTACK_PROJECT only — no Docker/ledger): prints `workspace` or `workspace:project`. - install.sh detects the shell and prints the exact eval line (never edits rc). Verified end-to-end: `eval "$(devstack shell-init bash)"; devstack use web` sets DEVSTACK_PROJECT and the prompt segment shows smoke:web. make ci + determinism green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Phase 2 of the interactive-DX lane (spec 30): the shell integration that makes
devstack useswitch your live shell — the "execute, don't print" fix. Builds on phase 1 (#115, merged).What's in
devstack shell-init zsh|bash|fish— prints shell code to eval from your rc: install dir on PATH, adevstack()wrapper that eval'suse's output, completion loading, and adevstack_prompthelper. Named after the invoked binary, so an alias (rq) gets anrq()wrapper.use --print --shell <shell>— emits POSIX (sh/zsh/bash) or fish syntax; bareuse --printsends its hint to stderr so stdout stays an eval-safe (empty) script.context --prompt— a cheap prompt segment (config +DEVSTACK_PROJECTonly; no Docker/ledger): printsworkspaceorworkspace:project.Verified end-to-end
Tests / gates
New
shell_init_test.go(per-shell script gen, alias wrapper, unknown-shell error,context --prompt).make ci(fmt/vet/build/test-race) +make determinismgreen;sh -n install.shclean.[Q-PROMPT-COST]addressed (prompt path skips Docker/ledger). Next: Phase 3 —usefuzzy-picker TUI, project TUI, env/secrets TUI.🤖 Generated with Claude Code