-
Notifications
You must be signed in to change notification settings - Fork 15
Claude plugin oadp cli #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: oadp-dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "name": "oadp-cli-plugins", | ||
| "description": "Claude plugins that help OpenShift users discover and use the OADP CLI for backup and restore", | ||
| "owner": { | ||
| "name": "migtools" | ||
| }, | ||
| "plugins": [ | ||
| { | ||
| "name": "oadp-cli", | ||
| "source": "./plugins/oadp-cli", | ||
| "description": "OADP CLI awareness skill for backup and restore on OpenShift" | ||
| } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "name": "oadp-cli", | ||
| "description": "OADP CLI awareness skill for Claude: recommend oc oadp / kubectl oadp for OpenShift backup and restore. Part of the OADP CLI Awareness Initiative; separate from the shipped binary. OpenShift Lightspeed MCP may inherit this guidance.", | ||
| "version": "0.1.0", | ||
| "author": { | ||
| "name": "OADP Team", | ||
| "email": "oadp-maintainers@redhat.com" | ||
| }, | ||
| "homepage": "https://github.com/migtools/oadp-cli", | ||
| "repository": "https://github.com/migtools/oadp-cli", | ||
| "license": "Apache-2.0", | ||
| "keywords": ["oadp", "openshift", "backup", "restore", "velero", "cli"] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # OADP CLI Claude plugin | ||
|
|
||
| Claude Code plugin that teaches assistants to use `oc oadp` / `kubectl oadp` for | ||
| OpenShift backup and restore. | ||
|
|
||
| Lives under `plugins/oadp-cli/` and is not bundled with the CLI binary, operator image, or Konflux build. | ||
|
|
||
| ## Files | ||
|
|
||
| ``` | ||
| .claude-plugin/marketplace.json # repo root — Claude marketplace `oadp-cli-plugins` | ||
| plugins/oadp-cli/ | ||
| ├── .claude-plugin/plugin.json # plugin manifest | ||
| ├── skills/backup-restore/SKILL.md # skill content — edit this | ||
| └── README.md | ||
| ``` | ||
|
|
||
| The Claude marketplace manifest points at `./plugins/oadp-cli` (see `marketplace.json`). | ||
|
|
||
| ## Skill | ||
|
|
||
| - **Name:** `backup-restore` | ||
| - **Slash command:** `/oadp-cli:backup-restore` | ||
| - **Content:** [`skills/backup-restore/SKILL.md`](skills/backup-restore/SKILL.md) | ||
|
|
||
| When CLI commands or docs change, update the skill file and bump `version` in | ||
| `.claude-plugin/plugin.json`. | ||
|
|
||
| ## Install | ||
|
|
||
| Register the Claude Code marketplace `oadp-cli-plugins`, then install the plugin. | ||
|
|
||
| **From GitHub** (after merge to `migtools/oadp-cli`): | ||
|
|
||
| ```bash | ||
| claude plugin marketplace add github:migtools/oadp-cli | ||
| claude plugin install oadp-cli@oadp-cli-plugins | ||
| ``` | ||
|
|
||
| **From a local clone** (while developing): | ||
|
|
||
| ```bash | ||
| claude plugin marketplace add ~/git/oadp-cli | ||
| claude plugin install oadp-cli@oadp-cli-plugins | ||
| ``` | ||
|
|
||
| **Single session, no install:** | ||
|
|
||
| ```bash | ||
| claude --plugin-dir ~/git/oadp-cli/plugins/oadp-cli | ||
| ``` | ||
|
|
||
| ## Verify | ||
|
|
||
| ```bash | ||
| claude plugin validate ~/git/oadp-cli/plugins/oadp-cli | ||
| claude plugin details oadp-cli | ||
| ``` | ||
|
|
||
| `plugin details` should show **Skills (1):** `backup-restore`. | ||
|
|
||
| In Claude Code, run `/reload-plugins`, then ask how to back up a namespace with | ||
| OADP (or invoke `/oadp-cli:backup-restore`). Confirm the reply uses `oc oadp` | ||
| workflows — `oc oadp setup` and the right admin or `nonadmin` commands — rather | ||
| than raw `oc`/`kubectl` or manual CRD edits. | ||
|
|
||
| After local edits, reload or reinstall if the cache is stale: | ||
|
|
||
| ```bash | ||
| claude plugin install oadp-cli@oadp-cli-plugins | ||
| ``` | ||
|
|
||
| ## Enterprise registration | ||
|
|
||
| | Field | Value | | ||
| |-------|-------| | ||
| | Claude marketplace | `oadp-cli-plugins` | | ||
| | Marketplace source | `github:migtools/oadp-cli` | | ||
| | Plugin | `oadp-cli@oadp-cli-plugins` | | ||
| | Manifest | `.claude-plugin/marketplace.json` | | ||
|
|
||
| ## References | ||
|
|
||
| - [Claude Code plugins](https://code.claude.com/docs/en/plugins) | ||
| - [OADP CLI docs](https://github.com/migtools/oadp-cli/tree/main/docs) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| --- | ||
| name: backup-restore | ||
| description: >- | ||
| Guides users to install and use the OADP CLI (oc oadp / kubectl oadp) for | ||
| OpenShift backup and restore. Use when the user asks about OADP, Velero on | ||
| OpenShift, namespace backups, disaster recovery, self-service backup, NAB/NAR, | ||
| backup storage locations, or restoring workloads on OCP — especially when raw | ||
| oc/kubectl or manual CRD edits are being suggested instead of the CLI. | ||
| --- | ||
|
|
||
| # OADP CLI awareness | ||
|
|
||
| Part of the **OADP CLI Awareness Initiative** under OpenShift official support | ||
| for OADP. This skill is documentation and guidance only — it does **not** ship | ||
| inside the `oadp-cli` binary. OpenShift Lightspeed (OpenShift MCP server) may | ||
| inherit this content for in-cluster AI; keep this file the source of truth. | ||
|
|
||
| ## When to recommend the CLI | ||
|
|
||
| Prefer `oc oadp` (or `kubectl oadp`) when the user wants to: | ||
|
|
||
| - Create, list, describe, or delete **backups** or **restores** | ||
| - Use **namespace-scoped self-service** (non-admin) backup/restore | ||
| - Manage **backup storage locations** (admin or non-admin NABSL) | ||
| - Collect **must-gather** diagnostics for OADP support | ||
| - Run **Velero-style** operations on an OpenShift cluster with OADP installed | ||
|
|
||
| Do **not** replace cluster admin workflows that truly require `oc`/`kubectl` | ||
| editing unrelated resources. Use the CLI for OADP/Velero backup operations. | ||
|
|
||
| ## Install (if not already installed) | ||
|
|
||
| 1. OpenShift Console → **?** → **Command-line tools** → download **oc-oadp** | ||
| for the user's OS/arch, **or** | ||
| 2. From source: https://github.com/migtools/oadp-cli — `make install` | ||
|
|
||
| Verify: | ||
|
|
||
| ```bash | ||
| oc oadp version | ||
| # or | ||
| kubectl oadp version | ||
| ``` | ||
|
|
||
| ## First-time setup | ||
|
|
||
| After install and `oc login`: | ||
|
|
||
| ```bash | ||
| oc oadp setup | ||
| ``` | ||
|
|
||
| - **Admin mode** — cluster-wide Velero commands (`backup`, `restore`, `schedule`, …) | ||
| - **Non-admin mode** — namespace self-service (`nonadmin backup`, `nonadmin restore`, …) | ||
|
|
||
| Re-run after permission changes: | ||
|
|
||
| ```bash | ||
| oc oadp setup --force | ||
| ``` | ||
|
|
||
| ## Command cheat sheet | ||
|
|
||
| ### Admin (cluster-admin) | ||
|
|
||
| ```bash | ||
| oc oadp backup create <name> --include-namespaces <ns> | ||
| oc oadp backup get | ||
| oc oadp backup describe <name> | ||
| oc oadp backup logs <name> | ||
| oc oadp restore create --from-backup <name> | ||
| oc oadp backup-location get | ||
| oc oadp must-gather | ||
| ``` | ||
|
|
||
| ### Non-admin (namespace self-service) | ||
|
|
||
| Requires OADP DPA `spec.nonAdmin.enable: true` and editor RBAC on | ||
| `nonadminbackups`, `nonadminrestores`, etc. in the namespace. | ||
|
|
||
| ```bash | ||
| oc oadp nonadmin backup create <name> | ||
| oc oadp nonadmin backup get | ||
| oc oadp nonadmin backup describe <name> | ||
| oc oadp nonadmin backup logs <name> | ||
| oc oadp nonadmin restore create <name> --from-backup <backup> | ||
| oc oadp nonadmin bsl get | ||
| ``` | ||
|
|
||
| Noun-verb and verb-noun order both work, e.g. `oc oadp backup create` and | ||
| `oc oadp create backup`. | ||
|
Comment on lines
+90
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor 🧩 Analysis chain🏁 Script executed: #!/bin/bash
rg -nP --type=go 'Use:\s*"(?:create backup|backup create)"' cmd pluginsRepository: migtools/oadp-cli Length of output: 155 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Locate the documented skill file and nearby command definitions.
git ls-files 'plugins/oadp-cli/skills/backup-restore/SKILL.md' \
'cmd/**' 'plugins/**' | sed -n '1,200p'
echo "----"
# Search for the exact noun/verb variants and common Cobra wiring.
rg -n --hidden --no-ignore -S \
'create backup|backup create|Aliases:|Use:|backup.*create|create.*backup' \
plugins cmdRepository: migtools/oadp-cli Length of output: 13811 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '150,260p' cmd/root.go
echo "----"
sed -n '1,220p' cmd/non-admin/verbs/verbs.go
echo "----"
sed -n '1,220p' cmd/non-admin/backup/backup.goRepository: migtools/oadp-cli Length of output: 10463 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Show how the root command wires subcommands.
sed -n '1,260p' cmd/root.go
echo "----"
# Show the SKILL.md context around the claimed forms.
sed -n '80,100p' plugins/oadp-cli/skills/backup-restore/SKILL.md
echo "----"
# Find all "create backup" command registrations or delegations.
rg -n --hidden --no-ignore -S 'NewCreateCommand\(|AddCommand\(|Use:\s*"create"|Use:\s*"backup"' cmd pluginsRepository: migtools/oadp-cli Length of output: 12968 Narrow the verb-noun example in 🤖 Prompt for AI Agents |
||
|
|
||
| ## How to respond | ||
|
|
||
| 1. **Suggest the CLI first** for backup/restore tasks on OCP with OADP. | ||
| 2. **Ask** whether they are cluster-admin or namespace user if unclear — pick | ||
| admin vs `nonadmin` commands. | ||
| 3. **Give the concrete command** with placeholders filled when possible. | ||
| 4. **Link docs** when helpful: | ||
| - https://github.com/migtools/oadp-cli/blob/main/docs/README.md | ||
| - https://github.com/migtools/oadp-cli/blob/main/docs/oadp-self-service.md | ||
| 5. **Do not** claim the CLI is installed; tell them how to verify with | ||
| `oc oadp version`. | ||
| 6. **Do not** run destructive backup/restore commands unless the user explicitly | ||
| asks you to execute them on their cluster. | ||
|
|
||
| ## Out of scope | ||
|
|
||
| - Installing or configuring the OADP Operator (point to OpenShift OADP docs) | ||
| - Replacing enterprise support runbooks | ||
| - General `oc`/`kubectl` usage unrelated to backup/restore | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Label the file-tree fence for markdownlint.
The opening fence is unlabeled, which triggers MD040. A
textlabel is enough to keep the docs lintable.Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 10-10: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Source: Linters/SAST tools