Skip to content

Add completion spec: Talos Linux CLI (talosctl)#294

Open
maxmilian wants to merge 1 commit into
warpdotdev:mainfrom
maxmilian:command-spec-talosctl
Open

Add completion spec: Talos Linux CLI (talosctl)#294
maxmilian wants to merge 1 commit into
warpdotdev:mainfrom
maxmilian:command-spec-talosctl

Conversation

@maxmilian

Copy link
Copy Markdown
Contributor

Closes #293 (tracks warpdotdev/warp#12693)

Adds a completion spec for talosctl, the Talos Linux CLI for out-of-band management of Kubernetes nodes.

What's included

  • json/talosctl.json — static spec walked from talosctl v1.13.6's Cobra command tree (106 nodes, 49 top-level commands), covering all subcommands, flags, and positional args, with filepaths/folders templates on path-like flags (--talosconfig, --file, --*-path, --*-dir, …).
  • src/generators/talosctl.rs — a single talosctl_builtin_completion generator that delegates dynamic completions to the CLI's hidden Cobra __complete command, mirroring oc_builtin_completion in oc.rs. It powers:
    • config context / config remove context names (offline, from talosconfig)
    • --context flag values
    • cluster-backed completions (service/logs/restart service IDs, get/edit/patch resource types, --nodes/--endpoints values), same connected-cluster assumption as the kubectl/oc specs
  • Cobra __complete emits value<TAB>description pairs, so the post-process splits on tab and surfaces descriptions in the menu. 3 unit tests cover plain values, descriptions, and error filtering.

Verification

  • script/presubmit green (fmt, clippy, full test suite incl. spec-deserialization invariants)
  • End-to-end in a local Warp build against this branch:

Static subcommand completions (talosctl + Tab):

talosctl subcommand completions

Dynamic contexts via talosctl_builtin_completion (talosctl config context + Tab, three contexts defined in a local talosconfig):

talosctl context generator completions

Notes for reviewers

  • The spec is machine-walked from the CLI's own --help/__complete output, then hand-curated — regeneration for future talosctl versions is reproducible.
  • --nodes/--endpoints completion via __complete can be slow when the configured cluster is unreachable (talosctl attempts discovery). This matches the CLI's native shell completion behavior and the connected-cluster assumption of the existing kubectl/oc generators, but happy to drop those two attachment points if you'd prefer offline-only generators.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XWwajmLbgJbK6JBCY8nKfk

Static spec generated by walking talosctl v1.13.6's Cobra command tree
(106 nodes, 49 top-level commands) via its help output, then curated:

- talosctl_builtin_completion generator delegates dynamic completions
  (config contexts, node services, resource types, --nodes/--endpoints/
  --context values) to the CLI's hidden Cobra __complete command,
  mirroring oc_builtin_completion in oc.rs
- filepaths/folders templates on path-like flags (--talosconfig,
  --file, --*-path, --*-dir, ...)
- hand-fixed usage strings the tokenizer can't parse (copy's
  '-|<local-path>', service's nested optional action)

Closes warpdotdev/warp#12693

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XWwajmLbgJbK6JBCY8nKfk
@cla-bot cla-bot Bot added the cla-signed label Jul 16, 2026
@oz-for-oss

oz-for-oss Bot commented Jul 16, 2026

Copy link
Copy Markdown

@maxmilian

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #293, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

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.

@maxmilian

Every PR must be linked to a same-repo issue before Oz can review it.

This PR is linked to #293, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /oz-review to re-trigger review.

Powered by Oz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add completion spec for talosctl (Talos Linux CLI)

1 participant