Skip to content

feat(cli): shell-init eval hook, prompt segment & completions (spec 30 phase 2) - #116

Merged
gustavobertoi merged 1 commit into
mainfrom
feat/shell-integration
Jul 2, 2026
Merged

feat(cli): shell-init eval hook, prompt segment & completions (spec 30 phase 2)#116
gustavobertoi merged 1 commit into
mainfrom
feat/shell-integration

Conversation

@gustavobertoi

Copy link
Copy Markdown
Contributor

Summary

Phase 2 of the interactive-DX lane (spec 30): the shell integration that makes devstack use switch 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, a devstack() wrapper that eval's use's output, completion loading, and a devstack_prompt helper. Named after the invoked binary, so an alias (rq) gets an rq() wrapper.
  • use --print --shell <shell> — emits POSIX (sh/zsh/bash) or fish syntax; bare use --print sends its hint to stderr so stdout stays an eval-safe (empty) script.
  • context --prompt — 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 your rc).

Verified end-to-end

$ eval "$(devstack shell-init bash)"
$ devstack use web        # wrapper eval's cd + export DEVSTACK_PROJECT=web
$ echo $DEVSTACK_PROJECT  # web  ← the live shell changed
$ devstack context --prompt   # smoke:web

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 determinism green; sh -n install.sh clean.

[Q-PROMPT-COST] addressed (prompt path skips Docker/ledger). Next: Phase 3 — use fuzzy-picker TUI, project TUI, env/secrets TUI.

🤖 Generated with Claude Code

…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>
@gustavobertoi
gustavobertoi merged commit 9405768 into main Jul 2, 2026
4 checks passed
@gustavobertoi
gustavobertoi deleted the feat/shell-integration branch July 2, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant