Skip to content

feat(cluster): add shell completion for cluster names - #139

Merged
Marius MJ (M99) merged 3 commits into
mainfrom
feat/cluster-name-completion
Oct 16, 2026
Merged

Marius MJ (M99) merged 3 commits into
mainfrom
feat/cluster-name-completion

Conversation

@M99

Copy link
Copy Markdown
Contributor

Summary

Closes #122. Instead of accepting partial names, this adds tab completion for cluster names.

  • New pkg/completion package with ClusterNames, ClusterNameArg and RegisterClusterNameFlag
  • Wired into the positional name and --name/--cluster flags of cluster get, status, login, open, delete, access list/grant/revoke and pullsecret set
  • Completion never triggers an interactive sign-in. It returns no suggestions if you're not signed in, if ListClusters fails, or after 3 seconds.
  • Completion requests (__complete, __completeNoDesc) use a no-op tracer and don't start a telemetry upload, so a Tab press doesn't record a trace
  • File completion is disabled globally (SetDefaultShellCompDirective(NoFileComp)), since no command takes a file path

Existing completion scripts pick this up without changes, because they ask the binary for suggestions at Tab time.

Testing

  • Table-driven unit tests in pkg/completion/completion_test.go
  • Manually checked with indev __complete cluster get "" against a local API

🤖 Generated with Claude Code

Marius MJ (M99) and others added 2 commits October 5, 2026 15:55
Suggest cluster names on tab for the positional name argument and the
--name/--cluster flags of cluster get, status, login, open, delete,
access list/grant/revoke and pullsecret set. Completion stays silent
when not signed in, on API errors, or after a 3s timeout.

Completion requests skip telemetry, and file completion is disabled
globally since no command takes a file path.

Closes #122

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep shared helpers (timeout, signed-in check) in completion.go so
completions for other resources can be added as separate files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Cache names per resource, account and API host under the XDG cache
dir with a 10 minute TTL, one file per resource. Cache hits skip the
sign-in check and the list API call; a typed prefix that matches
nothing cached falls back to a live list and refreshes the cache.
Cluster names are the first resource: cluster create and delete
invalidate them, cluster list refreshes them, and logout removes the
whole cache directory. An empty list clears the entry, and
INDEV_NO_COMPLETION_CACHE opts out.
@M99
Marius MJ (M99) merged commit 5b9346e into main Oct 16, 2026
5 checks passed
@M99
Marius MJ (M99) deleted the feat/cluster-name-completion branch October 16, 2026 14:10
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.

Allow incomplete names as arguments

2 participants