Skip to content

Add completion spec: Yandex Cloud CLI (yc) - #303

Merged
acarl005 merged 2 commits into
mainfrom
app-5201/command-spec-yandex-cloud
Aug 6, 2026
Merged

Add completion spec: Yandex Cloud CLI (yc)#303
acarl005 merged 2 commits into
mainfrom
app-5201/command-spec-yandex-cloud

Conversation

@warp-agent-staging

@warp-agent-staging warp-agent-staging Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds command completions for the Yandex Cloud CLI (yc).

Like kubectl and oc, yc is 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 installed yc version, and — because __complete emits value<TAB>description per line — the suggestions carry the CLI's own descriptions.

Changes:

  • command-signatures/src/generators/yc.rs — the yc_builtin_completion generator: a command_from_tokens builder that runs yc __complete <tokens…> (piped through sed '$d' to drop Cobra's trailing :<directive> metadata line) plus an output parser that splits each line on the first tab into Suggestion::with_description (falling back to a plain suggestion when the description is empty), drops the directive/Completion ended trailer and error output, and preserves the CLI's ordering. Modeled on the existing oc/kubectl generators.
  • 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 authoritative yc help reference (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 warp client, precisely so they stay in sync with the CLI. This PR supersedes the earlier client-side draft warpdotdev/warp#14722 (a non-factory automation PR that added a hand-written signature under crates/warp_completer); that PR should be closed in favor of this one.

Verification

script/presubmit is green (prettier format:check, cargo fmt --check, cargo clippy --all-targets --all-features -D warnings, and cargo 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 exact yc __complete … | sed '$d' command built for root, nested, and partial-token inputs.
  • test_post_process_parses_descriptions_and_filters_metadata — asserts value<TAB>description lines become described suggestions, the :4 directive line and Completion 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 (in lib.rs) passes, confirming yc_builtin_completion is 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's warp-command-signatures and the real yc CLI 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

Launching the locally-built Warp terminal, then triggering yc and yc compute Tab completions to show the suggestion dropdowns with descriptions.
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 ` 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.
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.

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>
@cla-bot cla-bot Bot added the cla-signed label Aug 6, 2026
@warp-agent-staging warp-agent-staging Bot added the warpy-factory Opened by the Warp factory agents label Aug 6, 2026
@warp-agent-staging
warp-agent-staging Bot marked this pull request as ready for review August 6, 2026 01:05
@warp-agent-staging
warp-agent-staging Bot requested a review from acarl005 August 6, 2026 01:05
@oz-for-oss

oz-for-oss Bot commented Aug 6, 2026

Copy link
Copy Markdown

@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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(" ")),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] [SECURITY] This joins unescaped user-supplied tokens into the shell command Warp runs for completions, so a token like $(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>
@acarl005
acarl005 merged commit 4094b65 into main Aug 6, 2026
8 checks passed
@acarl005
acarl005 deleted the app-5201/command-spec-yandex-cloud branch August 6, 2026 01:45
acarl005 pushed a commit to warpdotdev/warp that referenced this pull request Aug 6, 2026
## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed warpy-factory Opened by the Warp factory agents

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants