.agents/commands/comet/create-pr.md
Command: cursor create-pr
Create a GitHub Pull Request for the current working branch with automatic Jira integration, quality checks, and template pre-filling. This command ensures code quality and proper workflow integration before creating PRs.
gh preferred, GitHub MCP fallback), re-validates the branch, re-evaluates git status, re-runs quality checks, and re-generates summary/template content regardless of prior runs.This workflow will:
OPIK-<number>, issue-<number>, or NA)share-progress-in-jiragh is installed and authenticated (gh auth status)gh is unavailable or unauthenticated, test GitHub MCP availability by fetching repository info for comet-ml/opik.
If both are unavailable, respond with: "Install/setup GitHub CLI first (
gh auth login). If CLI cannot be used in your environment, configure GitHub MCP and retry."
Stop here.
maingh preferred, MCP fallback) must be available before proceeding. Jira MCP validation is conditional and runs after branch key extraction in Step 2.OPIK-<number>, issue-<number>, or NA{USERNAME}/{TICKET-NUMBER}-{TICKET-SUMMARY}"Branch name doesn't follow Opik naming convention. Expected format:
{USERNAME}/{TICKET-NUMBER}-{TICKET-SUMMARY}with ticket keyOPIK-<number>,issue-<number>, orNA."
Examples:andrescrz/OPIK-2180-add-cursor-git-workflow-rule,someuser/issue-1234-some-task,someotheruser/NA-some-other-task
Current branch:<actual-branch-name>
OPIK-<number>, test Jira MCP availability by attempting to fetch user info using atlassianUserInfo.
If unavailable, respond with: "This command needs Jira MCP configured for OPIK ticket branches. Set MCP config/env, run
make cursor(Cursor) ormake claude(Claude CLI), then retry."
Stop here.
issue-<number> or NA, skip Jira MCP preflight and continue.Commit pending changes (auto, with meaningful message): If the working directory is dirty, the command will stage changes and the Agent will generate a descriptive commit message that summarizes what was introduced (akin to share-progress-in-jira), then commit. Avoid file counts/line stats.
# Stage everything
git add -A
# Agent: Generate first commit message in PR-title format:
# [OPIK-####] [COMPONENT] <type>: <description> (preferred)
# [issue-####] [COMPONENT] <type>: <description> (GitHub issue branches)
# [NA] [COMPONENT] <type>: <description> (no-ticket branches)
# where <type> is semantic: feat|fix|refactor|test|docs|chore
#
# <detailed description>
#
# Implements <TICKET-KEY>: <ticket summary>
#
# Example: "[OPIK-2180] [DOCS] docs: add cursor git workflow rule"
# Then commit (only if there are staged changes)
if ! git diff --cached --quiet; then
git commit -m "[<TICKET-KEY>] [<COMPONENT>] <TYPE>: <AGENT_GENERATED_DESCRIPTION>"
fi
Ensure remote branch exists (auto): Push local commits so the branch is on origin
git push -u origin HEAD
Sync with main (base branch) (auto): Ensure the working branch is up to date before proceeding
git fetch origin
git rev-list --left-right --count origin/main...HEAD
main, the command will perform a rebase. If rebase conflicts occur, it stops and reports them.
git rebase origin/main
# If conflicts arise, resolve them and continue with: git rebase --continue
git push --force-with-lease # after rebase
_pr-description-sync sub-skill (.agents/commands/comet/_pr-description-sync.md) with branch = git rev-parse --abbrev-ref HEAD. The sub-skill is a no-op when no PR exists, when the description is already in sync, or when the user has opted out of refreshes for this repo.gh pr list --head <branch> --state open); if CLI is unavailable, use GitHub MCP fallback."PR already exists for this branch: <PR_URL>. Continue with the flow (quality checks, Jira status, progress comment)? (y/n)"
_pr-description-sync sub-skill ran at the end of Step 3 — it refreshed the description if needed (no-op when the body was already in sync, the user opted out for this repo, or gh was unavailable). Either way, do not attempt a second refresh here.# For Java backend projects
(cd apps/opik-backend && mvn compile -DskipTests && mvn test && mvn spotless:check)
# For frontend projects
(cd apps/opik-frontend && npm run lint && npm run typecheck)
# For SDK changes
(cd "$(git rev-parse --show-toplevel)" && make precommit-sdks)
# For Java backend projects
(cd apps/opik-backend && mvn spotless:apply && mvn compile -DskipTests && mvn test)
# For frontend projects
(cd apps/opik-frontend && npm run lint:fix && npm run lint && npm run typecheck)
# For SDK changes
(cd "$(git rev-parse --show-toplevel)" && make precommit-sdks)
git diff origin/main...HEAD to get all changes since branching from the latest remote mainTitle: Format as [{TICKET-NUMBER}] [{COMPONENT}] {TYPE}: {TASK-SUMMARY} extracted from branch description and change analysis
[OPIK-2180] [DOCS] docs: add cursor git workflow rule, [OPIK-1234] [BE] feat(api): add trace request validation endpointDescription: Read the PR template from .github/pull_request_template.md at runtime and use it as the source of truth. The PR description is public on GitHub — never include any of the following unless the user explicitly requests it:
OPIK-#### key)When summarizing changes, describe behavior in generic terms ("a customer reported…", "in a production deployment…") rather than naming the source. Redact screenshots or log excerpts before including them. For anything that needs private context, reference the Jira ticket instead of embedding it here.
# Read the actual PR template — do NOT hardcode it
cat .github/pull_request_template.md
## section in the template — the PR linter requires all sections to be presentSection guidance:
OPIK-2180) or GitHub issue, or "NA" for hotfixesAI-WATERMARK: yes, then list: Tools (e.g., "Claude Code"), Model(s), Scope (e.g., "full implementation" or "assisted"), Human verification (e.g., "code review + manual testing")Before creating the PR, validate the generated title and body against the same rules enforced by .github/workflows/pr-lint.yml. This prevents PRs from failing the PR Linter CI check on first submission.
Read pr-lint rules at runtime: Parse .github/workflows/pr-lint.yml as source of truth for the title regex and required sections. Fall back to the rules below only if the workflow file cannot be read.
Title validation: Verify the PR title matches the regex:
^\[(OPIK-\d+|DND-\d+|DEV-\d+|CUST-\d+|issue-\d+|NA)\](\s*\[(BE|FE|DOCS|SDK|GHA|CI|HELM)\])*\s*.+$
[OPIK-1234]) or using invalid component tagsRequired sections validation: Verify the PR body contains all required ## headings:
## Details## Change checklist## Issues## Testing## DocumentationDetails section non-empty: Extract content between ## Details and the next ## heading. Verify it is not empty after trimming whitespace (matching CI's getSectionContent which only calls .trim()). Note: HTML comment placeholders are handled separately in the template placeholder cleanup step below — do not strip them during this validation check.
Issues section ticket reference: Extract content of ## Issues. Unless the PR title starts with [NA], verify it references at least one ticket matching: #\d+, OPIK-\d+, DND-\d+, DEV-\d+, or CUST-\d+.
Template placeholder cleanup: Scan the entire body for leftover HTML comment placeholders from the PR template (e.g., <!-- REPLACE ME, <!-- REPLACE ME WITH:). If any remain, strip them before submission.
On validation failure:
On validation success: Continue to PR creation
comet-ml/opik with pre-filled template (gh pr create --draft).OPIK-<number> branches, use Jira MCP to get ticket detailsOPIK-<number>, change ticket status to "In Review"addCommentToJiraIssue with the standard 2-section format:
issue-<number> or NA, skip Jira transition/comment and continue.gh installation/auth instructionsOPIK-<number>, issue-<number>, or NA): Stop and explain the requirement## sections with "N/A" contentgh auth status and repository permissions for comet-ml/opikThe command is successful when:
gh authenticated preferred, MCP fallback optional)OPIK-<number>, issue-<number>, or NAgh preferred, MCP fallback) must be available before operations begin; Jira MCP is required only for OPIK-<number> branchescomet-ml/opik for GitHub operationsgh first, MCP fallback) before proceeding, and validates Jira MCP only for OPIK-<number> branchesshare-progress-in-jira command:
git diff origin/main...HEAD) for accurate change detection against latest remote mainEnd Command