Skip to content

feat: complete CLI argument values - #627

Merged
nklmilojevic merged 2 commits into
mainfrom
feat/cli-value-completion
Sep 17, 2026
Merged

nklmilojevic merged 2 commits into
mainfrom
feat/cli-value-completion

Conversation

@nklmilojevic

@nklmilojevic nklmilojevic commented Sep 17, 2026

Copy link
Copy Markdown
Owner

CLI completion supplied option names and fixed values, but no context or namespace values. This change adds value completion for all applicable CLI arguments in Bash, Zsh, Fish, Elvish, and PowerShell.

  • Read contexts from kubeconfig and namespaces and resource types from the selected cluster. Respect earlier kubeconfig, context, and TLS options.
  • Complete local paths, configured resource aliases, cached plugin IDs and versions, and installed managed plugin IDs. Install suggestions use the catalog eligibility checks; describe retains all cached versions.
  • Limit completion requests to two seconds, suppress errors, and read configuration without writing migrations. On Windows, assign the worker to a Job Object before it can start helpers, and terminate its descendants when the job closes.

Discussion: #620. The maintainer approved the expanded scope in the implementation session. Follow-up to #621 and #621 (comment).

Validation: just check passed. Tests cover all five shell interfaces, kubeconfig merging, context selection, mocked namespace and discovery APIs, plugin metadata, paths, timeouts, and configuration preservation. Generated Bash and Fish scripts passed execution checks; Zsh and Fish passed syntax checks. Elvish and PowerShell were tested through their completion interfaces, without running those shells.

Users must reload their completion scripts after installing the update. Plugin catalog suggestions use the local cache. The CLI has no object-name argument, so resource suggestions are resource types only.

The Windows cleanup module and its process-tree test passed cross-compilation and Clippy checks for x86_64-pc-windows-gnu. Native Windows execution was not available on the development host.

Static completion scripts only supplied option names and fixed values. Query contexts, namespaces, resource types, paths, and plugin metadata when the user requests completion. Bound requests and read configuration without writing migrations.

Follow-up to #621. Discussion: #620
@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the two previously reported completion issues are resolved and no new actionable defects were identified.

Summary

This PR adds dynamic CLI argument-value completion across Bash, Zsh, Fish, Elvish, and PowerShell.

  • Completes Kubernetes contexts, namespaces, discovered resource types, configured aliases, and local paths.
  • Completes cached catalog plugins and managed plugin installations, applying install eligibility rules where appropriate.
  • Runs potentially blocking completion work in a bounded worker and adds Windows Job Object cleanup for its process tree.
  • Adds read-only configuration resolution and extensive shell, Kubernetes, plugin, timeout, and Windows lifecycle tests.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
    S[Shell completion request] --> P[Sofka parent process]
    P --> W[Bounded completion worker]
    W --> A[Parse arguments before cursor]
    A --> K{Requested value}
    K -->|Context| C[Read kubeconfig]
    K -->|Namespace or resource| API[Query selected Kubernetes cluster]
    K -->|Plugin| PC[Read catalog or managed-plugin cache]
    K -->|Path| FS[Complete local filesystem path]
    C --> O[Filter, sort, and deduplicate candidates]
    API --> O
    PC --> O
    FS --> O
    O --> R[Return shell-formatted suggestions]
    P -->|Two-second timeout| X[Terminate worker process tree]
Loading

Reviews (2) · Last reviewed commit: "fix: clean up Windows completion helpers..."

Comment thread src/completion.rs
Comment thread src/completion.rs
The completion timeout only cleaned up process groups on Unix, and install suggestions bypassed catalog eligibility checks. Hold Windows workers until Job Object setup succeeds and close the job to terminate descendants. Reuse catalog selection rules for install candidates while preserving describe results.
@nklmilojevic
nklmilojevic merged commit 6a88fbd into main Sep 17, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant