Add completion spec: Yandex Cloud CLI (yc) - #303
Conversation
Add a script-backed completion generator for the Yandex Cloud CLI (yc). Like kubectl and oc, yc is Cobra-based, so completions are produced by shelling out to the CLI's own `yc __completeNoDesc` command. This keeps subcommand completions in sync with the installed CLI version instead of hand-maintaining the command tree. - command-signatures/src/generators/yc.rs: the yc_builtin_completion generator (command builder + output parser) with unit tests. - command-signatures/json/yc.json: static spec wiring the generator to a top-level variadic arg plus the CLI's persistent global flags. - generators/mod.rs: register the generator. Co-Authored-By: Warp Agent <agent@warp.dev>
|
@warp-agent-staging[bot] I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds a yc command signature and a dynamic Yandex Cloud CLI completion generator that shells out to yc __completeNoDesc, plus registration and unit coverage for the generator.
Concerns
- The generator builds the shell command by joining unescaped parsed command tokens, which lets shell metacharacters in the current input execute when Warp asks for completions.
Security
- The inline finding should be fixed before merge by shell-escaping all user-derived tokens/environment assignments or by constructing the subprocess without shell interpolation.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| generation_command.push("\"\""); | ||
| } | ||
| CommandBuilder::pipe( | ||
| CommandBuilder::single_command(generation_command.join(" ")), |
There was a problem hiding this comment.
$(touch /tmp/yc-pwn) or foo;... can execute during Tab completion; shell-escape each token/env assignment or build the subprocess without shell interpolation before joining.
Switch the yc generator from __completeNoDesc to Cobra's __complete, which emits value<TAB>description per line. Each line is split on the first tab into Suggestion::with_description, falling back to a plain suggestion when the description is empty. The trailing :<directive> line and error output are still filtered. Co-Authored-By: Warp Agent <agent@warp.dev>
## Summary Bumps the `warp-command-signatures` git dependency in `warpdotdev/warp` from `4990fa1d` to `4094b657` (current `warpdotdev/command-signatures:main`), so the client picks up newly-merged completion specs. Merged completion PRs now included: - Add completion spec: Yandex Cloud CLI (`yc`) — warpdotdev/command-signatures#303 - Add git worktree name autocomplete suggestions — warpdotdev/command-signatures#302 This is the app-side half of APP-5201: the `yc` completion spec merged upstream in command-signatures#303, and this PR wires that spec into the app by advancing the embedded-signatures dependency. Only `Cargo.toml` (the `rev`) and `Cargo.lock` (the two git-source lines for `warp-command-signatures` / `warp-completion-metadata`) change. The bump was produced by following the command-signatures repo's own `update-command-spec-version` skill (update the `rev`, sync `Cargo.lock`). ## Verification Testing-exempt category: **dependency/version bump**. Per factory-verification, a data-only dependency bump adds no regression test (a test would only assert data presence, not detect a logic defect); the `yc` spec itself is validated by command-signatures#303's own CI, which passed before merge. App-side checks (run against the new rev, `CARGO_TARGET_DIR` redirected in the sandbox): - `cargo check --locked -p warp_completer` → success. `--locked` proves `Cargo.lock` is in sync with the new rev; the consuming crate compiles against the updated specs. - `cargo test --locked -p warp_completer -- signatures::` → 12 passed / 0 failed. These load and validate the embedded command signatures (including the new `yc` spec). - Full `cargo test --locked -p warp_completer` → 138 passed / 25 failed. All 25 failures are a pre-existing, environmental test-harness issue unrelated to this change — `Tried to check FeatureFlag::CloudEnvironments before feature flags were initialized` (`crates/warp_features/src/lib.rs`) — not caused by the dependency bump. No Rust source files change in this PR, so there is nothing for `./script/format` or `clippy` to act on beyond the compile above. User-facing note: the `yc` completion menu rendering from this exact spec was already demonstrated in a prior local GUI build against the spec branch; because this PR is a data-only dependency bump (no client code change), the GUI was not rebuilt for it. The rendering behavior is governed entirely by the upstream spec, which is validated by command-signatures#303. CHANGELOG-IMPROVEMENT: Added inline command completions for the Yandex Cloud CLI (`yc`) and git worktree name suggestions. Originating thread: https://warpdev.slack.com/archives/C0BDQDW8V5E/p1785974187380919 <!-- factory-agent: {"source":"factory-agent","task_id":"APP-5201","task_source":"linear","task_url":"https://linear.app/warpdotdev/issue/APP-5201/add-yc-yandex-cloud-cli-command-completions","linear_issue_id":"APP-5201","oz_run_id":"019fd4c1-7a3e-70e0-bcec-c9f12606fd8a","repo":"warpdotdev/warp"} --> Co-authored-by: Oz <oz-agent@warp.dev> Co-authored-by: Warp <agent@warp.dev>
Summary
Adds command completions for the Yandex Cloud CLI (
yc).Like
kubectlandoc,ycis Cobra-based, so instead of hand-maintaining its (very large) command tree as a static spec, completions are produced by a script-backed generator that shells out to the CLI's own hidden completion command,yc __complete. This keeps subcommand completions automatically in sync with the user's installedycversion, and — because__completeemitsvalue<TAB>descriptionper line — the suggestions carry the CLI's own descriptions.Changes:
command-signatures/src/generators/yc.rs— theyc_builtin_completiongenerator: acommand_from_tokensbuilder that runsyc __complete <tokens…>(piped throughsed '$d'to drop Cobra's trailing:<directive>metadata line) plus an output parser that splits each line on the first tab intoSuggestion::with_description(falling back to a plain suggestion when the description is empty), drops the directive/Completion endedtrailer and error output, and preserves the CLI's ordering. Modeled on the existingoc/kubectlgenerators.command-signatures/json/yc.json— static spec wiring that generator to a top-level variadic argument (so every level —yc,yc compute,yc compute instance— completes dynamically) plus the CLI's persistent global flags (--format,--profile,--folder-id,--cloud-id,--endpoint,--token,-h/--help, …) with descriptions. Global flags were verified against the authoritativeyc helpreference (yandex.cloud/en/docs/cli/cli-ref/help).command-signatures/src/generators/mod.rs— registers the generator.Approach: why a generator instead of a client-side signature
The requester explicitly asked for the completions to live here as a generator that leverages the CLI's own completion output, rather than as a hand-written signature in the
warpclient, precisely so they stay in sync with the CLI. This PR supersedes the earlier client-side draftwarpdotdev/warp#14722(a non-factory automation PR that added a hand-written signature undercrates/warp_completer); that PR should be closed in favor of this one.Verification
script/presubmitis green (prettierformat:check,cargo fmt --check,cargo clippy --all-targets --all-features -D warnings, andcargo test).New unit tests in
yc.rs(fail before / pass after):test_completion_command_completes_fresh_token,test_completion_command_completes_nested_subcommand,test_completion_command_completes_partial_token— assert the exactyc __complete … | sed '$d'command built for root, nested, and partial-token inputs.test_post_process_parses_descriptions_and_filters_metadata— assertsvalue<TAB>descriptionlines become described suggestions, the:4directive line andCompletion ended …trailer are stripped, and CLI order is preserved.test_post_process_handles_missing_description— asserts a line with no tab, and a line with a tab but an empty description, both yield a description-less suggestion.test_post_process_returns_nothing_on_error— asserts error output yields no suggestions.The repo's
generatorName-reference invariant test (inlib.rs) passes, confirmingyc_builtin_completionis correctly wired between the JSON spec and the registered generator.Visual proof (verified via computer use in a local Warp build)
Verified end-to-end in a locally-built Warp GUI (
warp-oss,fast_dev) with this branch'swarp-command-signaturesand the realycCLI installed. The completions dropdown renders each suggestion with the CLI's description alongside the value:yc+ Tab → top-level command groups with descriptions (e.g.compute— "Manage Yandex Compute Cloud resources",vpc— "Manage Yandex Virtual Private Cloud resources",dns— "Manage Yandex DNS resources").yc compute+ Tab → nested subcommands with descriptions (e.g.disk— "Manage disks",disk-type— "Show available disk types",filesystem— "Manage filesystems").yc --+ Tab → global flags with descriptions (e.g.--cloud-id— "Set the ID of the cloud to use",--debug— "Debug logging").Computer-use video recordings
Warp yc completions test: Launching the locally-built Warp terminal, then triggering yc and yc compute Tab completions to show the suggestion dropdowns with descriptions.
Computer-use screenshots (2)
Warp terminal showing the `yc ` top-level completions dropdown with subcommand values (iam, quota-manager, resource-manager, compute, vpc, dns) and their descriptions.
Warp terminal showing the `yc compute ` nested completions dropdown with values (v0, disk, disk-placement-group, disk-type, filesystem, gpu-cluster) and their descriptions.
Originating thread: https://warpdev.slack.com/archives/C0BDQDW8V5E/p1785974187380919
This PR was generated with Oz.