feat(minimal): tab complete session ID/names - #966
Conversation
📝 WalkthroughWalkthroughThe CLI now supports dynamic session completion through daemon-backed candidate retrieval, shell registration shims, a hidden candidate-printing command, and completion wiring for session-related arguments. ChangesDynamic session completion
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Shell
participant min
participant Daemon
Shell->>min: request dynamic session completion
min->>Daemon: ListSessions RPC with timeout
Daemon-->>min: session candidates
min-->>Shell: value and optional description
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/minimal/Cargo.toml`:
- Around line 29-36: Correct the explanatory comment above the clap_complete
dependency to accurately describe unstable-dynamic usage across completion.rs,
main.rs, and lib.rs, including ArgValueCompleter, CompletionCandidate,
CompleteEnv, and the env::Shells/write_registration APIs. Remove the claim that
usage is confined to two types in completion.rs, while preserving the
semver-stability warning.
In `@crates/minimal/src/completion.rs`:
- Around line 106-120: Move the is_daemon_running check from fetch_sessions into
the async operation wrapped by tokio::time::timeout(COMPLETION_TIMEOUT, rpc),
preserving the early None result when the daemon is not running. Ensure the
liveness check, connection, and RPC request all share the same completion
timeout budget.
In `@crates/minimal/src/main.rs`:
- Around line 43-52: Change the subscriber setup around Cli::parse so
CompleteSessionStr routes tracing output to stderr instead of skipping
subscriber installation. Preserve stdout parsing for other commands and ensure
the completion command’s daemon-connect and timeout tracing remains available
for debugging, following the existing git-remote-helper stderr-writer pattern.
In `@docs/reference/cli-min.md`:
- Line 194: Add a fenced code block language identifier, preferably text, to the
CLI example around the complete-session-str documentation in
docs/reference/cli-min.md, preserving the example content unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b7a90102-9c03-4c02-b8d8-ff6d25ee1be3
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
crates/minimal/Cargo.tomlcrates/minimal/src/completion.rscrates/minimal/src/lib.rscrates/minimal/src/main.rsdocs/reference/cli-min.md
72ec521 to
290d2f8
Compare
Summary by CodeRabbit
min completions <SHELL>to explain the registration shim and the dynamic, best-effort completion behavior.min complete-session-str).Note
Add tab completion for session IDs and names in the
minCLIattach,destroy,rename,session policy,ssh-forward) by querying live sessions via a bounded, non-autospawning RPC with a short timeout.complete-session-strsubcommand that printsvalue<TAB>descriptionlines for debugging and scripting.min completions <shell>to emit a dynamic-registration shim instead of a static completion table.min completions <shell>output changes from a static script to a dynamic shim — users must re-source or reinstall their completion setup.Macroscope summarized 290d2f8.