Skip to content

Add completion spec: openshift (oc)#223

Merged
lucieleblanc merged 5 commits into
mainfrom
app-3507/command-spec-openshift
Apr 3, 2026
Merged

Add completion spec: openshift (oc)#223
lucieleblanc merged 5 commits into
mainfrom
app-3507/command-spec-openshift

Conversation

@lucieleblanc
Copy link
Copy Markdown
Contributor

Summary

Add a comprehensive completion spec for the OpenShift CLI (oc).

Closes APP-3507

What's included

JSON Spec (command-signatures/json/oc.json)

  • 62 subcommands total: 34 shared with kubectl + 28 OpenShift-specific
  • Shared commands (annotate, apply, create, get, delete, etc.) adapted from kubectl spec
  • OpenShift-specific commands including:
    • Authentication: login, logout, whoami, get-token
    • Build/Deploy: new-app, new-build, start-build, cancel-build, rollback
    • Projects: project, projects, new-project
    • Image management: import-image, tag, image, registry
    • Debugging: debug, rsh, rsync
    • Admin: adm with full subcommand tree (cordon, drain, upgrade, policy, groups, prune, etc.)
    • Other: process, extract, observe, policy, secrets, idle, events, status

Generators (command-signatures/src/generators/oc.rs)

  • Reuses kubectl generators for shared Kubernetes resources (resource types, pods, deployments, nodes, roles, namespaces, etc.)
  • oc_builtin_completion: Uses oc's Cobra __complete protocol for dynamic completions
  • projects: Lists available OpenShift projects for oc project switching
  • build_configs: Lists build configurations for oc start-build

Testing

Tested E2E in a local Warp build. Screenshots of completions working:

oc top-level subcommands

Completions dropdown shows all subcommands with descriptions (adm, annotate, api-resources, apply, etc.)

oc login options

Shows login-specific options (--username, --password, --token, --web, --certificate-authority, etc.)

oc start-build options

Shows start-build options (--from-build, --from-dir, --follow, --wait, etc.)

oc project options

Shows project command options (-q/--short) and global flags

All presubmit checks pass (prettier formatting, cargo fmt, cargo clippy, cargo test).


Conversation: https://staging.warp.dev/conversation/51c03c7e-989d-49ad-9fce-a3b49b579646
Run: https://oz.staging.warp.dev/runs/019d4aa5-bddf-7179-8903-8b1d63506b22

This PR was generated with Oz.

Add a comprehensive completion spec for the OpenShift CLI (oc) with:

- JSON spec covering all 62 oc subcommands, including shared kubectl
  commands and OpenShift-specific ones (login, new-app, new-build,
  start-build, adm, project, etc.)
- Generators for dynamic completions:
  - Reuses kubectl generators for shared Kubernetes resources
  - oc_builtin_completion using oc's Cobra __complete protocol
  - projects generator for oc project switching
  - build_configs generator for oc start-build

Closes APP-3507

Co-Authored-By: Oz <oz-agent@warp.dev>
@linear
Copy link
Copy Markdown

linear Bot commented Apr 1, 2026

APP-3507 Add OpenShift (oc) completion spec

No completion spec exists for oc, despite it being nearly identical to kubectl (both Cobra-based, same __complete protocol). Can likely reuse kubectl spec + generators as a starting point.

See GitHub #4147, #5073

@lucieleblanc
Copy link
Copy Markdown
Contributor Author

Co-Authored-By: Oz <oz-agent@warp.dev>
Copy link
Copy Markdown
Contributor Author

Generator Validation Screenshots

Tested the OpenShift (oc) completion generators by building Warp locally against this branch's command-signatures changes and pressing Tab to trigger the completions menu.

Test Environment

  • oc v4.21.7 installed
  • Kubeconfig with mock contexts configured (for testing context/cluster generators)
  • No active OpenShift cluster (so projects and build_configs generators correctly return empty results)

1. oc_builtin_completion generator — oc logs <Tab>

Shows resource types from oc __complete: daemonsets/, deployments/, pods/, jobs/, replicasets/, replicationcontrollers/

oc logs completions

2. context generator (shared from kubectl) — oc config use-context <Tab>

Shows kubeconfig contexts: dev-context, example-context

oc config use-context completions

3. Static subcommand completions — oc <Tab>

Shows all subcommands with descriptions: adm, annotate, api-resources, api-versions, apply, attach, etc.

oc static completions

4. projects generator — oc project <Tab>

Generator runs correctly. Without an active cluster, returns empty results (expected behavior — the oc_post_process error handler filters error output). Falls through to flag completions.

oc project completions

5. build_configs generator — oc start-build <Tab>

Generator runs correctly. Without an active cluster, returns empty results (expected — same error handling). Falls through to flag completions.

oc start-build completions

@lucieleblanc
Copy link
Copy Markdown
Contributor Author

Confirmed the builtins and context generator work. Re-requested screenshots for the projects and build_configs generators: https://oz.staging.warp.dev/runs/019d4af6-c583-7e3c-ba13-fad8d0970f69?createdBy=5gyxwUE9o2ebwBT8yUO7CZ2gpkt2

Screenshots showing the projects and build_configs generators working in Warp:
- oc_projects_completions.png: oc project <Tab> showing project names
- oc_build_configs_completions.png: oc start-build <Tab> showing build config names

Co-Authored-By: Oz <oz-agent@warp.dev>
Copy link
Copy Markdown
Contributor Author

Generator Validation Screenshots

Tested the projects and build_configs generators locally against a kind cluster with OpenShift CRDs.

projects generator (oc project <Tab>)

Shows project/namespace completions from oc projects -q:

oc project completions

build_configs generator (oc start-build <Tab>)

Shows build config completions from oc get buildconfigs:

oc start-build completions

@lucieleblanc
Copy link
Copy Markdown
Contributor Author

Very nice, ty

@lucieleblanc lucieleblanc marked this pull request as ready for review April 1, 2026 22:00
@lucieleblanc lucieleblanc merged commit 767648f into main Apr 3, 2026
3 checks passed
@lucieleblanc lucieleblanc deleted the app-3507/command-spec-openshift branch April 3, 2026 15:02
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.

3 participants