Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .claude-plugin/marketplace.json
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"
}
]
}
16 changes: 15 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,18 @@ jobs:
go-version-file: 'go.mod'

- name: Run tests
run: go test ./...
run: go test ./...

validate-plugin:

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.

The validate-plugin job should pin the @anthropic-ai/claude-code version and add actions/setup-node. Something like:

  
  - uses: actions/setup-node@v4
    with:
      node-version: '22'

  - name: Install Claude CLI
    run: npm install -g @anthropic-ai/claude-code@0.2.57

Pick whatever version you've validated against and bump it intentionally when needed.

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install Claude CLI
run: npm install -g @anthropic-ai/claude-code
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- name: Validate Claude plugin manifest
run: claude plugin validate plugins/oadp-cli
13 changes: 13 additions & 0 deletions plugins/oadp-cli/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "oadp-cli",
"description": "Teaches Claude to recommend oc oadp / kubectl oadp for OpenShift backup and restore instead of raw Velero or manual CRD edits. Covers admin and non-admin workflows, schedules, BSL management, and must-gather.",
"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"]
}
83 changes: 83 additions & 0 deletions plugins/oadp-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# 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

```text
.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 <path-to-oadp-cli>
claude plugin install oadp-cli@oadp-cli-plugins
```

**Single session, no install:**

```bash
claude --plugin-dir <path-to-oadp-cli>/plugins/oadp-cli
```

## Verify

```bash
claude plugin validate <path-to-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/oadp-dev/docs)
136 changes: 136 additions & 0 deletions plugins/oadp-cli/skills/backup-restore/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---

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.

Worth considering whether a lightweight CI check could verify SKILL.md against registered commands, or at minimum adding a note in SKILL.md or the plugin README reminding contributors to update the skill file when commands change

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.
---

## 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
```

> **Note:** `oc oadp setup` and `oc oadp must-gather` require the latest dev build and are not in the current release. Verify availability with `oc oadp setup --help`.

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.

This note should either be removed entirely or replaced with something version-aware, like "Available since v0.5.0" (or whatever version ships them). A static "not in the current release" statement in a living reference doc will rot quickly.


## Command cheat sheet

### Admin (cluster-admin)

```bash
# Backups
oc oadp backup create <name> --include-namespaces <ns>
oc oadp backup get
oc oadp backup describe <name>
oc oadp backup logs <name>
oc oadp backup delete <name>

# Restores
oc oadp restore create --from-backup <name>
oc oadp restore get
oc oadp restore describe <name>
oc oadp restore logs <name>

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.

The admin restore section should include:

oc oadp restore delete

to match the pattern of the backup section.


# Schedules
oc oadp schedule create <name> --schedule "0 1 * * *"
oc oadp schedule get
oc oadp schedule describe <name>
oc oadp schedule delete <name>
oc oadp schedule pause <name>
oc oadp schedule unpause <name>

# Backup storage locations
oc oadp backup-location get

# NABSL approval workflow (when requireApprovalForBSL: true)
oc oadp nabsl-request get
oc oadp nabsl-request describe <name>
oc oadp nabsl-request approve <name>
oc oadp nabsl-request reject <name>

# Diagnostics
oc oadp must-gather
```

> Admin commands use noun-verb order (e.g. `oc oadp backup create`). Non-admin
> commands also accept verb-noun order (e.g. `oc oadp nonadmin create backup`).

### Non-admin (namespace self-service)

Requires OADP DPA `spec.nonAdmin.enable: true` and editor RBAC on
`nonadminbackups`, `nonadminrestores`, etc. in the namespace.

`nonadmin` has an alias `na` — both forms work (e.g. `oc oadp na backup get`).

```bash
oc oadp nonadmin backup create <name> [--storage-location <nabsl-name>]
oc oadp nonadmin backup get
oc oadp nonadmin backup describe <name>
oc oadp nonadmin backup logs <name>
oc oadp nonadmin restore create <name> --backup-name <backup> # upcoming

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.

The non-admin section marks restore create, restore get, restore describe, and bsl get as # upcoming, but all four are implemented and registered in the current codebase. The # upcoming annotations should be removed.
Also, the non-admin cheat sheet is missing several commands that exist: nonadmin backup delete, nonadmin backup logs, nonadmin restore logs, and nonadmin restore delete. Since this plugin's purpose is to be the authoritative command reference for AI assistants, completeness matters here.

oc oadp nonadmin restore get # upcoming
oc oadp nonadmin restore describe <name> # upcoming
oc oadp nonadmin bsl create <name> --provider <provider> --bucket <bucket> --credential <secret>=<key>
oc oadp nonadmin bsl get # upcoming
```

## 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/oadp-dev/docs/README.md
- https://github.com/migtools/oadp-cli/blob/oadp-dev/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
Loading