用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/openshift/hypershift --skill restructure-commits命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | restructure-commits |
| description | Restructure branch commits into logical component-based commits for HyperShift PRs |
Reorganize all commits on a feature branch into logical, component-based commits that match HyperShift's architecture.
Commits are created in this order. Each commit groups files by architectural boundary.
| Order | Component | Scope | File Patterns |
|---|---|---|---|
| 1 | API | api | api/ (types, deepcopy, CRD manifests, go.mod) — excluding *_test.go |
| 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/, shared-ingress/, sharedingress-config-generator/ |
| 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/, sync-fg-configmap/, sync-global-pullsecret/, token-minter/ |
| 6 | E2E | e2e | test/, api/**/*_test.go |
| 7 | Docs | docs | docs/, examples/ |
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.
BASE_BRANCH=$(gh pr view --json baseRefName -q .baseRefName 2>/dev/null || echo "main")
MERGE_BASE=$(git merge-base ${BASE_BRANCH} HEAD)
git log --oneline ${MERGE_BASE}..HEAD # review existing commits
git diff ${MERGE_BASE}..HEAD --name-only | sort # all changed files
git reset --soft ${MERGE_BASE} # keep everything staged
git reset HEAD # unstage everything
For each component (in order), stage matching files and commit:
# Example: API commit (exclude test files — they belong in E2E)
git add api/ && git reset HEAD 'api/**/*_test.go' 2>/dev/null || true
git commit # use conventional commit format
# Example: Vendor commit
git add vendor/ client/ \
"cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/"
git commit
# ... repeat for CLI, HO, CPO, E2E, Docs
git status # must be clean
git log --oneline ${BASE_BRANCH}..HEAD # verify commit structure
git push --force-with-lease # requires user confirmation
Always invoke the git-commit-format skill first for the full formatting rules (line length, footer, Co-Authored-By, etc.). This section provides the component-specific type and scope, plus guidance on writing the subject and body.
| Component | Type(Scope) | Example Subject |
|---|---|---|
| API | feat(api): | feat(api): add FooBar CRD and platform config |
| Vendor | chore(api): | chore(api): regenerate CRDs, clients, deepcopy, and vendor |
| CLI | feat(cli): | feat(cli): add --foo-bar flags for cluster creation |
| HO | feat(hypershift-operator): | feat(hypershift-operator): add FooBar controller |
| CPO | feat(control-plane-operator): | feat(control-plane-operator): add FooBar controllers |
| E2E | test(e2e): | test(e2e): add FooBar e2e and validation tests |
| Docs | docs: | docs: add FooBar documentation and architecture reference |
Review the staged changes and write a body that describes what was added or changed. Use bullet points when there are multiple distinct changes. The body should give a reviewer enough context to understand the commit without reading every file. Each line must be under 140 characters (gitlint enforced).
chore(api): since it's regenerated output from the API committest(e2e): regardless of what's being testeddocs:support/ goes with HO (commit 4), not CPO.control-plane-pki-operator/, availability-prober/, dnsresolver/, etcd-*, ignition-server/, kas-bootstrap/, konnectivity-*, kubernetes-default-proxy/, sync-fg-configmap/, sync-global-pullsecret/, token-minter/ all go with CPO (commit 5) since they are control plane components managed by CPO.shared-ingress/ and sharedingress-config-generator/ go with HO (commit 4), not CPO, since they are part of the hypershift-operator.karpenter-operator/ goes with HO (commit 4) since it is managed by the hypershift-operator.control-plane-operator/**/testdata/ stays with CPO.cmd/install/assets/hypershift-operator/zz_generated.crd-manifests/ goes with Vendor (commit 2), not CLI.api/go.mod goes with API (commit 1), not Vendor.api/**/*_test.go (UX API validation tests) go with E2E (commit 6), not API. Stage API non-test files first, then include API test files when staging E2E.docs/ and examples/ go with Docs (commit 7), not Vendor. This includes mkdocs config, how-to guides, architecture references, and aggregated docs. The docs/content/reference/api.md (generated API reference) also goes here.hack/, contrib/, hypershift-ci-python/, self-managed-azure-ci-setup/ are not mapped to a default component. Include in the most relevant commit based on purpose, or HO when ambiguous.main)--soft (no data loss)