-
Notifications
You must be signed in to change notification settings - Fork 311
openshift-developer: add hooks, skills, and workflow documentation #554
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
Changes from all commits
44a9e79
4a40db8
fcb3742
cf1fd75
d31623d
e938dd1
1f39082
c3a95fc
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,137 @@ | ||
| --- | ||
| name: git-commit-format | ||
| description: "Apply conventional commit formatting rules. Use when generating commit messages or creating commits." | ||
| --- | ||
|
|
||
| ## Name | ||
| openshift-developer:git-commit-format | ||
|
|
||
| ## Synopsis | ||
| ``` | ||
| /openshift-developer:git-commit-format | ||
| ``` | ||
|
|
||
| ## Description | ||
| Applies conventional commit formatting rules when generating commit messages. This skill is loaded as context for other skills and workflows — it defines the commit message format, required footers, and validation rules. | ||
|
|
||
| ## Implementation | ||
|
|
||
| ### Commit Message Format | ||
|
|
||
| ``` | ||
| <type>(<scope>): <description> | ||
|
|
||
| [optional body] | ||
|
|
||
| [footers] | ||
| ``` | ||
|
|
||
| ### Commit Types | ||
|
|
||
| - **feat**: New features | ||
| - **fix**: Bug fixes | ||
| - **docs**: Documentation changes | ||
| - **style**: Code style changes (formatting, etc.) | ||
| - **refactor**: Code refactoring (no functional changes) | ||
| - **test**: Adding/updating tests | ||
| - **chore**: Maintenance tasks | ||
| - **build**: Build system or dependency changes | ||
| - **ci**: CI/CD changes | ||
| - **perf**: Performance improvements | ||
| - **revert**: Revert previous commit | ||
|
|
||
| ### Breaking Changes | ||
|
|
||
| With `!` to draw attention: | ||
| ``` | ||
| feat!: send email when product shipped | ||
| ``` | ||
|
|
||
| With `BREAKING CHANGE` footer: | ||
| ``` | ||
| feat: allow config to extend other configs | ||
|
|
||
| BREAKING CHANGE: `extends` key now used for extending config files | ||
| ``` | ||
|
|
||
| ### Required Footers | ||
|
|
||
| #### Signed-off-by | ||
|
|
||
| **ALWAYS include `Signed-off-by`** footer with name and email. | ||
|
|
||
| Get credentials in this priority order: | ||
| 1. Environment variables: `$GIT_AUTHOR_NAME` and `$GIT_AUTHOR_EMAIL` | ||
| 2. Git config: `git config user.name` and `git config user.email` | ||
| 3. If neither configured, ask user to provide details | ||
|
|
||
| #### Commit-Message-Assisted-by | ||
|
|
||
| **ALWAYS include** when Claude assists with creating or generating the commit message: | ||
| ``` | ||
| Commit-Message-Assisted-by: Claude (via Claude Code) | ||
| ``` | ||
|
|
||
| ### Gitlint Validation Rules | ||
|
|
||
| - Run `make run-gitlint` to validate commit messages (if the repo has a gitlint target) | ||
| - **Title line**: 120 characters maximum | ||
| - **Body line**: 140 characters maximum per line | ||
| - Use conventional commit format | ||
| - Include required footers (Signed-off-by) | ||
| - No trailing whitespace | ||
|
|
||
| ## Return Value | ||
| - **Commit message**: A conventional commit message with type, scope, description, body, and all required footers | ||
|
|
||
| ## Examples | ||
|
|
||
| 1. **Simple commit**: | ||
| ``` | ||
| docs: correct spelling of CHANGELOG | ||
|
|
||
| Signed-off-by: Jane Doe <jdoe@example.com> | ||
| Commit-Message-Assisted-by: Claude (via Claude Code) | ||
| ``` | ||
|
|
||
| 2. **With scope**: | ||
| ``` | ||
| feat(azure): add workload identity support | ||
|
|
||
| Signed-off-by: Jane Doe <jdoe@example.com> | ||
| Commit-Message-Assisted-by: Claude (via Claude Code) | ||
| ``` | ||
|
|
||
| 3. **Multi-paragraph with footers**: | ||
| ``` | ||
| fix: prevent racing of requests | ||
|
|
||
| Introduce request ID and reference to latest request. Dismiss | ||
| incoming responses other than from latest request. | ||
|
|
||
| Remove timeouts which were used to mitigate racing but are | ||
| obsolete now. | ||
|
|
||
| Reviewed-by: John Smith | ||
| Refs: #123 | ||
| Signed-off-by: Jane Doe <jdoe@example.com> | ||
| Commit-Message-Assisted-by: Claude (via Claude Code) | ||
| ``` | ||
|
|
||
| ## Arguments | ||
| - None. This skill provides formatting rules as context for other skills and workflows. | ||
|
|
||
| ## Quick Checklist | ||
|
|
||
| When creating commits: | ||
| - [ ] Use conventional commit format: `<type>(<scope>): <description>` | ||
| - [ ] Title under 120 characters | ||
| - [ ] Body lines under 140 characters | ||
| - [ ] Include `Signed-off-by` footer | ||
| - [ ] Include `Commit-Message-Assisted-by: Claude (via Claude Code)` footer | ||
| - [ ] Validate with `make run-gitlint` if available | ||
| - [ ] Use "!" or `BREAKING CHANGE` for breaking changes | ||
|
|
||
| ## Reference | ||
|
|
||
| Conventional Commits Specification: https://www.conventionalcommits.org/en/v1.0.0/#specification |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,15 @@ | ||
| { | ||
| "name": "openshift-developer", | ||
| "description": "Bundle of curated plugins, skills, and MCP servers useful to any OpenShift engineer", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "author": { | ||
| "name": "github.com/openshift-eng" | ||
| }, | ||
| "dependencies": [ | ||
| { "name": "jira", "version": "^0.5.0" }, | ||
| { "name": "jira", "version": "^0.7.0" }, | ||
| { "name": "ci", "version": "^0.0.42" }, | ||
| { "name": "golang", "version": "^0.3.0" }, | ||
| { "name": "prodsec-skills", "marketplace": "prodsec-skills" } | ||
| { "name": "prodsec-skills", "marketplace": "prodsec-skills" }, | ||
| { "name": "git", "version": "^0.0.6" } | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,29 @@ | ||||||
| # openshift-developer | ||||||
|
|
||||||
| Bundle of curated plugins, skills, and MCP servers useful to any OpenShift engineer. | ||||||
| Executable workflows for OpenShift development. | ||||||
|
|
||||||
| These workflows are meant to be a common engine for different consumption models: | ||||||
|
|
||||||
| - Developer's laptop | ||||||
| - Shared infrastructure like Prow for the OCPBUG autofix platform | ||||||
| - Slack chai-bot | ||||||
|
|
||||||
| Each skill and command is a self-contained unit of work that any of these environments can invoke identically. | ||||||
|
|
||||||
| ## Common workflows | ||||||
|
|
||||||
| ### Pre-PR (author loop) | ||||||
|
|
||||||
| 1. `/jira:solve` — Pick up a Jira issue, analyze it, implement the fix. | ||||||
| 2. `/code-review:pre-commit-review` — Run a code review on the local changes before pushing. | ||||||
| 3. `/openshift-developer:address-review-precommit` — Apply the review findings, run verification, commit, and push. | ||||||
|
|
||||||
| ### Post-PR (review loop) | ||||||
|
|
||||||
| 1. `/code-review:pr` — Review an open PR for correctness and improvements. | ||||||
| 2. `/openshift-developer:address-review-pr` — Fetch reviewer comments, categorize by priority, make code changes, post replies, and push. | ||||||
|
|
||||||
| Repeat steps 4-5 until the PR is approved. | ||||||
|
Contributor
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. Fix the step reference in the Post-PR workflow iteration instruction. Line 26 references "steps 4-5", but the Post-PR workflow (lines 21–24) only defines 2 steps. This appears to be a stale or copy-pasted reference. Based on the workflow, the repetition instruction should likely be "Repeat steps 1-2 until the PR is approved" (i.e., iterate the review cycle: code review → address comments → push). 🔧 Proposed fix-Repeat steps 4-5 until the PR is approved.
+Repeat steps 1-2 until the PR is approved.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| ## What's included | ||||||
|
|
||||||
|
|
@@ -10,11 +33,32 @@ Bundle of curated plugins, skills, and MCP servers useful to any OpenShift engin | |||||
| - `ci` — OpenShift CI / Prow job analysis | ||||||
| - `golang` — Go development tools | ||||||
| - `prodsec-skills` — Product security skills | ||||||
| - `git` — Git workflow automation and utilities | ||||||
|
|
||||||
| ### Skills | ||||||
|
|
||||||
| - **jira:solve** — Pick up a Jira issue, analyze it, implement the fix, and open a PR. (via `jira` plugin) | ||||||
| - **git:git-commit-format** — Conventional commit formatting rules: types, scopes, required footers (Signed-off-by, Commit-Message-Assisted-by), and gitlint validation. (via `git` plugin) | ||||||
| - **code-review:pre-commit-review** — Run a code review on local changes before pushing. (via `code-review` plugin) | ||||||
| - **address-review-precommit** — Fix code review findings in the current branch before committing: applies fixes, runs verification, and pushes. | ||||||
| - **code-review:pr** — Review an open PR for correctness and improvements. (via `code-review` plugin) | ||||||
| - **address-review-pr** — Fetch and address all PR review comments: categorizes by priority, makes code changes, posts replies, and pushes. | ||||||
|
|
||||||
| ### Hooks | ||||||
|
|
||||||
| - **ensure-precommit** — On `SessionStart`, installs pre-commit and pre-push hooks via `pre-commit` if the repo has a `.pre-commit-config.yaml`. Fails if `pre-commit` is not installed. Every commit and push is then gated by the repo's hooks at zero ongoing token cost. | ||||||
|
|
||||||
| ### MCP Servers | ||||||
|
|
||||||
| - **atlassian** — Atlassian MCP server (`https://mcp.atlassian.com/v1/mcp`) | ||||||
|
|
||||||
| ## Prerequisites | ||||||
|
|
||||||
| - `pre-commit` — hook manager (`pip install pre-commit` or `brew install pre-commit`) | ||||||
| - `gitlint` — commit message linter (`pip install gitlint`) | ||||||
| - `gopls` — Go language server (`go install golang.org/x/tools/gopls@latest`) | ||||||
| - `gh` — GitHub CLI, authenticated (`brew install gh`) | ||||||
|
|
||||||
| ## Installation | ||||||
|
|
||||||
| Add the marketplaces (one-time): | ||||||
|
|
@@ -37,3 +81,4 @@ This bundle can also be installed via APM with `--target`: | |||||
| ```sh | ||||||
| apm install openshift-eng/ai-helpers/plugins/openshift-developer --global --target cursor | ||||||
| ``` | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "hooks": { | ||
| "SessionStart": [ | ||
| { | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "${CLAUDE_PLUGIN_ROOT}/scripts/ensure-precommit.sh" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } |
|
stbenjam marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| if [ ! -f .pre-commit-config.yaml ]; then | ||
| exit 0 | ||
| fi | ||
|
|
||
| if ! command -v pre-commit &>/dev/null; then | ||
| echo "ERROR: pre-commit is required but not found on PATH" >&2 | ||
| exit 2 | ||
| fi | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| python3 "$SCRIPT_DIR/validate_precommit_config.py" || exit $? | ||
|
|
||
| pre-commit install --hook-type pre-commit >&2 | ||
| pre-commit install --hook-type pre-push >&2 | ||
| echo "pre-commit hooks installed" >&2 |
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.
I am not 100% sure these skills belong here, should this remain as a meta-module that pulls in others?
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.
Me neither, I put it here initially instead of in the git plugin to avoid bringing many of those specs which are unneeded here as a dependency. This skill has a concrete use case and as a principle seems easier to iterate with less deps.
I moved it there and added the dependency with the git plugin. I would expect eventually we enforce distribution of a .gitlint file that runs on precommit hook