Skip to content

NO-JIRA: chore(claude): add restructure-commits plugin command#7927

Merged
openshift-merge-bot[bot] merged 2 commits intoopenshift:mainfrom
bryan-cox:add-restructure-commits-skill
Mar 23, 2026
Merged

NO-JIRA: chore(claude): add restructure-commits plugin command#7927
openshift-merge-bot[bot] merged 2 commits intoopenshift:mainfrom
bryan-cox:add-restructure-commits-skill

Conversation

@bryan-cox
Copy link
Member

@bryan-cox bryan-cox commented Mar 11, 2026

Summary

  • Adds a .claude-plugin/plugin.json to make the hypershift repo a Claude Code plugin
  • Adds /restructure-commits as a user-invocable command that reorganizes branch commits into logical, component-based commits (API, Vendor, CLI, HO, CPO, E2E, Docs)
  • Maps all top-level repo directories to their appropriate component categories, including control plane sidecars (CPO), karpenter/kubevirt (HO), and build/CI tooling
  • Updates .claude/SKILLS.md with documentation for the new command

Test plan

  • Verify .claude-plugin/plugin.json is present with valid metadata
  • Verify .claude/commands/restructure-commits.md is present and correctly formatted
  • Test invoking /restructure-commits in Claude Code on a branch with multiple commits

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a HyperShift plugin with development workflow skills and new commands
    • Introduced a commit-restructuring capability for component-based commit grouping
  • Documentation

    • Added comprehensive docs for the commit-restructuring workflow, including step-by-step procedures, commit message conventions, edge-case handling, example commands, and a quick-reference checklist

Add a .claude-plugin structure and a /restructure-commits command
that reorganizes branch commits into logical, component-based commits
matching HyperShift's architecture.

- Add .claude-plugin/plugin.json for plugin metadata
- Add .claude/commands/restructure-commits.md as user-invocable command
- Update .claude/SKILLS.md with documentation

Signed-off-by: Bryan Cox <brcox@redhat.com>
Commit-Message-Assisted-by: Claude (via Claude Code)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@openshift-ci-robot
Copy link

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

Walkthrough

Adds a Claude plugin manifest and documentation for a HyperShift development workflow skill, including a new "Restructure Commits" command guide with component-to-file mappings, step-by-step commit reorganization instructions, commit message conventions, edge-case rules, and verification steps.

Changes

Cohort / File(s) Summary
Plugin manifest
/.claude-plugin/plugin.json
New plugin manifest defining the "hypershift" Claude plugin (name, description, version, author).
Skills documentation
/.claude/SKILLS.md
Added "Restructure Commits" skill entry under Available Commands with location, description, usage, when-to-use, and coverage details.
Command guide
/.claude/commands/restructure-commits.md
New detailed command guide: component-to-file mappings, step-by-step workflow (identify merge-base, reset, stage by component, commit per component), verification (force-push), commit message conventions, edge cases, examples, and checklist.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a restructure-commits plugin command to the Claude development workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Stable And Deterministic Test Names ✅ Passed PR only adds configuration and documentation files; custom check validates Go test files which are not present in this PR.
Test Structure And Quality ✅ Passed The custom check reviews Ginkgo test code quality. The PR contains only documentation and configuration files, not test code.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan for PR comments
  • Generate coding plan

Comment @coderabbitai help to get the list of available commands and usage tips.

@bryan-cox bryan-cox changed the title chore(claude): add restructure-commits plugin command NO-JIRA: chore(claude): add restructure-commits plugin command Mar 11, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 11, 2026
@openshift-ci-robot
Copy link

@bryan-cox: This pull request explicitly references no jira issue.

Details

In response to this:

Summary

  • Adds a .claude-plugin/plugin.json to make the hypershift repo a Claude Code plugin
  • Adds /restructure-commits as a user-invocable command that reorganizes branch commits into logical, component-based commits (API, Vendor, CLI, HO, CPO, E2E, Docs)
  • Maps all top-level repo directories to their appropriate component categories, including control plane sidecars (CPO), karpenter/kubevirt (HO), and build/CI tooling
  • Updates .claude/SKILLS.md with documentation for the new command

Test plan

  • Verify .claude-plugin/plugin.json is present with valid metadata
  • Verify .claude/commands/restructure-commits.md is present and correctly formatted
  • Test invoking /restructure-commits in Claude Code on a branch with multiple commits

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.claude-plugin/plugin.json (1)

5-7: Consider using an organization name for the author field.

The author.name field currently uses a GitHub repository path. While valid, plugin author fields typically contain a person or organization name (e.g., "OpenShift Team" or "Red Hat"). Using "github.com/openshift/hypershift" is unconventional for an author name.

♻️ Suggested alternative
   "author": {
-    "name": "github.com/openshift/hypershift"
+    "name": "OpenShift HyperShift Team"
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude-plugin/plugin.json around lines 5 - 7, Change the author.name value
in the plugin.json to a conventional person or organization label instead of the
GitHub repo path; locate the "author" object and update the "name" field
(author.name) to something like "OpenShift Team" or "Red Hat" to reflect an
author identity rather than a URL.
.claude/commands/restructure-commits.md (1)

30-30: Clarify the meaning of "excluded from restructuring."

The phrase "Excluded from restructuring" followed by "include them in the most relevant commit" is potentially ambiguous. The intent appears to be that these directories don't have automatic mappings but should still be included when changed. Consider rephrasing for clarity.

✍️ Suggested rewording
-**Excluded from restructuring:** `bin/` (build output), `hack/`, `contrib/`, `hypershift-ci-python/`, `self-managed-azure-ci-setup/`, and `.claude*/` are build tooling, CI helpers, or dev config. If changed, include them in the most relevant commit based on their purpose. When ambiguous, prefer HO.
+**No default mapping:** `bin/` (build output), `hack/`, `contrib/`, `hypershift-ci-python/`, `self-managed-azure-ci-setup/`, and `.claude*/` are build tooling, CI helpers, or dev config. If changed, include them in the most relevant commit based on their purpose. When ambiguous, prefer HO.

Or alternatively:

-**Excluded from restructuring:** `bin/` (build output), `hack/`, `contrib/`, `hypershift-ci-python/`, `self-managed-azure-ci-setup/`, and `.claude*/` are build tooling, CI helpers, or dev config. If changed, include them in the most relevant commit based on their purpose. When ambiguous, prefer HO.
+**Manual categorization required:** `bin/` (build output), `hack/`, `contrib/`, `hypershift-ci-python/`, `self-managed-azure-ci-setup/`, and `.claude*/` are build tooling, CI helpers, or dev config without automatic component mappings. If changed, include them in the most relevant commit based on their purpose. When ambiguous, prefer HO.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/SKILLS.md:
- Line 110: The SKILLS.md entry references a non-existent skill directory
`.claude/skills/restructure-hypershift-commits/` while the actual implementation
lives at `.claude/commands/restructure-commits.md`; fix this by either updating
the SKILLS.md line that mentions
`.claude/skills/restructure-hypershift-commits/` (around line 110) to point to
`.claude/commands/restructure-commits.md`, or create the missing skill directory
`.claude/skills/restructure-hypershift-commits/` and add a `SKILL.md` there that
mirrors the command content so the repository follows the established
skill/`SKILL.md` pattern.

---

Nitpick comments:
In @.claude-plugin/plugin.json:
- Around line 5-7: Change the author.name value in the plugin.json to a
conventional person or organization label instead of the GitHub repo path;
locate the "author" object and update the "name" field (author.name) to
something like "OpenShift Team" or "Red Hat" to reflect an author identity
rather than a URL.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2222af4d-1d25-4b41-b158-92ccd59ba78b

📥 Commits

Reviewing files that changed from the base of the PR and between 5271846 and 3f199a1.

📒 Files selected for processing (3)
  • .claude-plugin/plugin.json
  • .claude/SKILLS.md
  • .claude/commands/restructure-commits.md

@openshift-ci openshift-ci bot requested review from jparrill and sjenning March 11, 2026 14:07
@openshift-ci openshift-ci bot added area/ai Indicates the PR includes changes related to AI - Claude agents, Cursor rules, etc. and removed do-not-merge/needs-area labels Mar 11, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 11, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 11, 2026
@bryan-cox bryan-cox force-pushed the add-restructure-commits-skill branch from 3f199a1 to 83029a4 Compare March 11, 2026 14:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/commands/restructure-commits.md:
- Around line 53-57: The example that shows "git add api/" incorrectly stages
API test files; update that example to stage API sources but exclude files
matching the API test pattern (api/**/*_test.go) so tests remain in the E2E
commit. Edit the snippet that currently contains the "git add api/" line in the
restructure-commits example to use an add command or explicit file globs that
exclude api/**/*_test.go, and ensure the accompanying comment/instruction
mentions that API tests are excluded and belong in the E2E commit.
- Around line 34-40: The snippet hard-codes "main" when computing MERGE_BASE and
running git log/diff; change this to require an explicit base branch variable
(e.g. TARGET_BASE or BASE_BRANCH) and use that variable in the git merge-base,
git log and git diff commands instead of "main"; update the documentation text
to instruct the user to set or pass TARGET_BASE (with a sensible default note)
and apply the same change for the other occurrences referenced (the commands
around git merge-base/git log/git diff on lines 68-70) so all comparisons use
the explicit base variable.

In @.claude/SKILLS.md:
- Around line 108-130: The "### Restructure Commits" entry is currently under
the wrong section; move that entire block (the header "Restructure Commits", its
Description, Invoked with: `/restructure-commits`, Use when:, Covers:,
Benefits:) out of the "Available Skills" area and place it under the "Available
Commands" section, updating any surrounding headings or table-of-contents
references so the command is discoverable alongside other manual commands and
its classification text reflects it is a manually-invoked command rather than an
automatic skill.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d29e2729-ffa8-4e50-abfc-98fd65373746

📥 Commits

Reviewing files that changed from the base of the PR and between 3f199a1 and 83029a4.

📒 Files selected for processing (2)
  • .claude/SKILLS.md
  • .claude/commands/restructure-commits.md

| 2 | Vendor | `api` | `vendor/`, `client/`, `cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/` |
| 3 | CLI | `cli` | `cmd/cluster/`, `cmd/install/`, `cmd/nodepool/`, `product-cli/` (source, tests, testdata) |
| 4 | HO | `hypershift-operator` | `hypershift-operator/`, `support/`, `karpenter-operator/`, `kubevirtexternalinfra/`, `pkg/`, `manifests/` |
| 5 | CPO | `control-plane-operator` | `control-plane-operator/`, `control-plane-pki-operator/`, `availability-prober/`, `dnsresolver/`, `etcd-backup/`, `etcd-defrag/`, `etcd-recovery/`, `ignition-server/`, `kas-bootstrap/`, `konnectivity-https-proxy/`, `konnectivity-socks5-proxy/`, `kubernetes-default-proxy/`, `shared-ingress/`, `sharedingress-config-generator/`, `sync-fg-configmap/`, `sync-global-pullsecret/`, `token-minter/` |
Copy link
Contributor

Choose a reason for hiding this comment

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

shared-ingress is part of the HO.

Also support/ contains shared code used by the CPO as well as the HO

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Moved shared-ingress/ and sharedingress-config-generator/ from CPO to HO in the component table and edge cases section. Also noted that support/ is shared code used by both.


AI-assisted response via Claude Code

Address CodeRabbit review feedback by mapping all top-level directories
to their appropriate component categories:

- CPO: control-plane-pki-operator, availability-prober, dnsresolver,
  etcd-backup/defrag/recovery, ignition-server, kas-bootstrap,
  konnectivity-*, kubernetes-default-proxy, shared-ingress,
  sharedingress-config-generator, sync-fg-configmap,
  sync-global-pullsecret, token-minter
- HO: karpenter-operator, kubevirtexternalinfra, pkg, manifests
- Docs: examples
- Excluded: bin, hack, contrib, hypershift-ci-python,
  self-managed-azure-ci-setup, .claude*

Signed-off-by: Bryan Cox <brcox@redhat.com>
Commit-Message-Assisted-by: Claude (via Claude Code)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bryan-cox bryan-cox force-pushed the add-restructure-commits-skill branch from 83029a4 to e7abb46 Compare March 12, 2026 14:57
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.claude/SKILLS.md (1)

120-141: Consider adding a safety note for this destructive operation.

The command involves git history rewriting (git reset, rebasing), which is potentially destructive. While the "Fix HyperShift Repo Robot PR" command includes a "Safety features" section for similar operations, this entry lacks any mention of prerequisites or safety considerations.

Consider adding a brief note such as:

**Prerequisites:**
- Clean working tree (no uncommitted changes)
- Feature branch that can be force-pushed

or

**Note:** This command rewrites git history. Ensure you have a clean working tree and are on a branch that can be force-pushed.

The detailed safety procedures are likely in .claude/commands/restructure-commits.md, but a brief mention here would help users understand the implications before invoking the command.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/SKILLS.md around lines 120 - 141, Add a short safety note to the
"Restructure Commits" entry (the "/restructure-commits" command) stating that
the command rewrites git history and listing minimal prerequisites—e.g., a clean
working tree (no uncommitted changes) and that the feature branch can be
force-pushed—and/or a one-line "Note:" warning; also add a pointer that detailed
safety procedures live in the full "restructure-commits" command doc so users
know where to find the full precautions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.claude/SKILLS.md:
- Around line 120-141: Add a short safety note to the "Restructure Commits"
entry (the "/restructure-commits" command) stating that the command rewrites git
history and listing minimal prerequisites—e.g., a clean working tree (no
uncommitted changes) and that the feature branch can be force-pushed—and/or a
one-line "Note:" warning; also add a pointer that detailed safety procedures
live in the full "restructure-commits" command doc so users know where to find
the full precautions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 47238e13-7f01-430e-a8ed-a07b28d07f99

📥 Commits

Reviewing files that changed from the base of the PR and between 83029a4 and e7abb46.

📒 Files selected for processing (2)
  • .claude/SKILLS.md
  • .claude/commands/restructure-commits.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .claude/commands/restructure-commits.md

@bryan-cox
Copy link
Member Author

/retest

Copy link
Contributor

@jparrill jparrill left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 23, 2026
@openshift-ci-robot
Copy link

Scheduling required tests:
/test e2e-aks-cilium

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aks
/test e2e-aws
/test e2e-aws-upgrade-hypershift-operator
/test e2e-kubevirt-aws-ovn-reduced
/test e2e-v2-aws

@bryan-cox
Copy link
Member Author

/verified bypass

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 23, 2026
@openshift-ci-robot
Copy link

@bryan-cox: The verified label has been added.

Details

In response to this:

/verified bypass

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@bryan-cox
Copy link
Member Author

/override "ci/prow/e2e-aws"

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 23, 2026

@bryan-cox: Overrode contexts on behalf of bryan-cox: ci/prow/e2e-aws

Details

In response to this:

/override "ci/prow/e2e-aws"

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@bryan-cox
Copy link
Member Author

/override "ci/prow/e2e-aws"

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 23, 2026

@bryan-cox: Overrode contexts on behalf of bryan-cox: ci/prow/e2e-aws

Details

In response to this:

/override "ci/prow/e2e-aws"

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@bryan-cox
Copy link
Member Author

/override "ci/prow/e2e-azure-self-managed"

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 23, 2026

@bryan-cox: Overrode contexts on behalf of bryan-cox: ci/prow/e2e-azure-self-managed

Details

In response to this:

/override "ci/prow/e2e-azure-self-managed"

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-merge-bot openshift-merge-bot bot merged commit a384607 into openshift:main Mar 23, 2026
22 checks passed
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 23, 2026

@bryan-cox: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/ai Indicates the PR includes changes related to AI - Claude agents, Cursor rules, etc. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants