mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[PR #250] [MERGED] feat(cli): complete template and snapshot names dynamically #291
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#291
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/AgentENV/pull/250
Author: @NickNYU
Created: 9/6/2026
Status: ✅ Merged
Merged: 9/19/2026
Merged by: @LSX-s-Software
Base:
main← Head:feat/cli-template-snapshot-completion📝 Commits (6)
d0b65aeDocument the safe first slice of dynamic CLI completionc4c462ffeat(cli): complete template and snapshot names dynamicallyd894b9afix(cli): filter completion candidates by prefix before cappinga9465a7chore(docs): drop the aenv completion design speca159a7ffix(cli): return partial snapshot pages and share build-status handlinge42dc2cfix(cli): stop snapshot pagination when a continuation token repeats📊 Changes
6 files changed (+1026 additions, -34 deletions)
View changed files
📝
crates/aenv/src/client/snapshots.rs(+237 -11)📝
crates/aenv/src/client/templates.rs(+17 -0)📝
crates/aenv/src/commands/completion.rs(+734 -12)📝
crates/aenv/src/commands/start.rs(+1 -0)📝
crates/aenv/src/commands/template.rs(+15 -6)📝
docs/src/getting-started/aenv-cli/shell-completion.md(+22 -5)📄 Description
Follow-up to #163, which added dynamic sandbox-ID completion. This PR covers the remaining dynamic-completion slice of #37: template and snapshot names.
What it does
aenv start,aenv template watch, andaenv template deletenow complete live resources from the existing list APIs — no new server API:Names and aliases are offered ahead of IDs, since names are what users type and IDs are only a fallback for resources that have none. Candidate descriptions distinguish the kind and carry the underlying ID plus build status where available:
Design notes
How
--coldis detected. A candidate provider gets no context about the rest of the command line, but the completion callback runs asCOMPLETE=<shell> aenv -- <words...>, so the words the user has typed are in our own argv.contains_cold_flagscans it and returns early — before credentials or the network are touched, so a cold start costs no API call at all.--coldis a boolean flag, so it can never be another argument's value here;--cold=trueis matched too.Candidate hygiene. Names and IDs are sorted within their groups so the order is stable across completion requests. Values are de-duplicated, since a template can list the same string as both a name and an alias, and two templates can share an alias. Each resource kind contributes at most 100 candidates — the budget is per kind so that a deployment with many templates cannot crowd snapshots out of
aenv start's candidates.Failure behavior is unchanged from #163: 500 ms connect / 1 s request timeouts, and silently no candidates when credentials, the server, or the network are unavailable. For
aenv start, the template and snapshot lookups are independent — either one failing only costs that kind's candidates.Two drive-by fixes
snapshot list --sandbox-idhad no sandbox completion, although #37 lists it under the sandbox states table. It now completes running and paused sandboxes, likeconnectanddelete.template <id> (<state>), making the documented behavior real — sandbox IDs are UUIDs, so the description is the only thing distinguishing two candidates in the shell.Docs
docs/src/getting-started/aenv-cli.mdgains the template/snapshot completion examples and the--coldexception, and its sandbox-state table now includessnapshot list --sandbox-id.Validation
cargo fmt -p aenv -- --check,cargo clippy -p aenv --all-targets -- -D warnings— both clean--colddetection, and provider wiring asserted through theCommandtree rather than generated script text_CLAP_COMPLETE_INDEX,_CLAP_IFS): with no credentials, completion is silent and exits 0, and static flag completion still worksUnrelated pre-existing failure on macOS:
commands::download::tests::preflight_merges_directories_and_requires_force_for_filesfails withsymbolic links are not supported: /var. It fails identically on a clean tree with these changes stashed, and this PR does not touchdownload.rs.What remains on #37
Auto-installation of completion loaders (
make install-aenv,scripts/install-cli.sh,scripts/install.sh, plus removal frommake uninstall-aenv) — @rbalachandar's #115.Open question
The 100-candidate-per-kind cap is my choice; #37 only says candidates should be limited and de-duplicated. Happy to change the number, or drop the cap, if you'd prefer.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.