Skip to content

feat(cli): complete values for output, type, and status flags - #531

Merged
Sertaç Özercan (sozercan) merged 2 commits into
orka-agents:mainfrom
jabrailkhalil:feat/cli-flag-completion
Sep 12, 2026
Merged

Sertaç Özercan (sozercan) merged 2 commits into
orka-agents:mainfrom
jabrailkhalil:feat/cli-flag-completion

Conversation

@jabrailkhalil

Copy link
Copy Markdown
Contributor

Summary

Registers Cobra flag completion so Tab after a known flag suggests the valid values instead of nothing:

  • Output formats registered through addOutputFlag: table, json, yaml.
  • task create --type: ai, container, agent (canonical TaskType values).
  • task list --status: Pending, Running, Finalizing, Succeeded, Failed, Scheduled, Cancelled (canonical TaskPhase values).

Suggestions are static and filtered by the typed prefix, so completion works without an Orka server and never executes the target command. The NoFileComp directive suppresses filename suggestions for these enum flags. task download --output is untouched: it registers its own destination-path flag, so it keeps filename completion.

Try it:

orka __complete task list --output ""     # table, json, yaml
orka __complete task list --output j      # json
orka __complete task create --type ""     # ai, container, agent
orka __complete task list --status "F"    # Finalizing, Failed
orka __complete task download --output "" # no enum suggestions, :0 directive

Tests

Table-driven TestCLIFlagCompletion in cmd/cli/completion_test.go covers empty input, partial prefixes, unmatched prefixes, both --output and -o, all three flag groups, and the returned completion directive. It also verifies that task download --output does not suggest enum values.

Verification

go test ./cmd/cli -run '^TestCLIFlagCompletion' -count=1   # 8/8 pass
go vet ./cmd/cli                                           # pass
git diff --check                                           # pass

Note: the full go test ./cmd/cli suite has pre-existing Windows-only failures in helpers_test.go (config-path tests rely on $HOME redirects, which os.UserHomeDir ignores on Windows). They are unrelated to this change and fail on the base revision as well.

Documentation

Added a "value completion" example block to the shell completion section of website/docs/reference/cli.md.

Fixes #521.

Copilot AI balanced review requested due to automatic review settings September 9, 2026 19:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-09T19:48:09.823346Z c59730d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Register Cobra flag completion for three known value sets so Tab after the
flag suggests valid choices and suppresses filename completion:

- output formats registered by addOutputFlag: table, json, yaml
- task create --type: ai, container, agent (canonical task types)
- task list --status: Pending, Running, Finalizing, Succeeded, Failed,
  Scheduled, Cancelled (canonical task phases)

Suggestions are static and filtered by the typed prefix, so completion
never contacts an Orka server and never executes the target command.
task download --output keeps its destination-path meaning because it
registers its own flag and does not go through addOutputFlag.

Add a table-driven TestCLIFlagCompletion exercising empty input, partial
prefixes, unmatched prefixes, both --output and -o, and the returned
completion directive. Document the value completion in the shell
completion section of the CLI reference.

Fixes orka-agents#521.

Signed-off-by: jabrailkhalil <jabrailkhalil@gmail.com>
Signed-off-by: jabrailkhalil <jabrailkhalil@gmail.com>
Copilot AI review requested due to automatic review settings September 9, 2026 19:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@sozercan

Copy link
Copy Markdown
Member

@microsoft-github-policy-service rerun

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks, lgtm! do you mind signing the cla and we can merge

@sozercan

Copy link
Copy Markdown
Member

@microsoft-github-policy-service rerun

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, thanks!

@sozercan
Sertaç Özercan (sozercan) merged commit 0024b5d into orka-agents:main Sep 12, 2026
17 of 18 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.

Add Tab completion for CLI output formats, task types, and statuses

3 participants