@groupby/ai-dev 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/teams/fhr-core/skills/address-pr/SKILL.md +129 -0
- package/teams/fhr-core/skills/plan-spec/SKILL.md +1 -0
- package/teams/fhr-core/skills/ready-pr/SKILL.md +74 -0
- package/teams/fhr-core/skills/refine-spec/SKILL.md +1 -0
- package/teams/fhr-core/skills/review-pr/SKILL.md +122 -0
- package/teams/fhr-core/skills/tdd-green/SKILL.md +1 -0
- package/teams/fhr-core/skills/tdd-red/SKILL.md +1 -0
- package/teams/fhr-core/skills/tdd-workflow/SKILL.md +1 -0
- package/teams/fhr-core/skills/write-pr/SKILL.md +49 -0
package/package.json
CHANGED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: address-pr
|
|
3
|
+
description: Work through unresolved GitHub PR review threads on the current branch — fix valid findings in code and reply to invalid ones with an explanation. Use when the user wants to address review comments, respond to PR feedback, or run "/address-pr".
|
|
4
|
+
arguments: pr-number (optional)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Address PR
|
|
8
|
+
|
|
9
|
+
Work through unresolved GitHub PR review threads: fix the valid ones in code, and reply to the invalid ones with a clear explanation.
|
|
10
|
+
|
|
11
|
+
Argument: `$ARGUMENTS` — optional. Pass the PR number to target a specific PR; omit it to auto-detect from the current branch.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/address-pr
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Step 1: Find the PR
|
|
20
|
+
|
|
21
|
+
If a PR number was passed in `$ARGUMENTS`, substitute it for `<PR_NUMBER>` in the commands below; otherwise omit `<PR_NUMBER>` entirely and `gh` auto-detects the PR from the current branch:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
gh pr view <PR_NUMBER> --json number,url,title,headRefName
|
|
25
|
+
gh repo view --json owner,name --jq '.owner.login, .name' # first line = <OWNER>, second = <REPO>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Extract the PR number and `headRefName`. If no open PR exists, stop and report.
|
|
29
|
+
|
|
30
|
+
Make sure the working tree is on the PR's branch before changing any code — fixes must land on the right branch:
|
|
31
|
+
```bash
|
|
32
|
+
git checkout <headRefName>
|
|
33
|
+
git pull
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Step 2: Fetch unresolved review threads
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
gh api graphql -f query='
|
|
40
|
+
query($owner: String!, $repo: String!, $number: Int!) {
|
|
41
|
+
repository(owner: $owner, name: $repo) {
|
|
42
|
+
pullRequest(number: $number) {
|
|
43
|
+
reviewThreads(first: 100) {
|
|
44
|
+
nodes {
|
|
45
|
+
id
|
|
46
|
+
isResolved
|
|
47
|
+
isOutdated
|
|
48
|
+
comments(first: 10) {
|
|
49
|
+
nodes { id databaseId body path line author { login } createdAt }
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
' -f owner=<OWNER> -f repo=<REPO> -F number=<PR_NUMBER>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Keep threads where `isResolved` is `false`. Skip threads where `isOutdated` is `true` — they reference lines that have since changed and no longer block review.
|
|
60
|
+
|
|
61
|
+
If there are no unresolved threads, report "No open review threads" and stop.
|
|
62
|
+
|
|
63
|
+
## Step 3: Evaluate each unresolved thread
|
|
64
|
+
|
|
65
|
+
Read the full comment text and load the referenced file at the path/line for context. Decide for each thread:
|
|
66
|
+
- **Valid** — a real problem or improvement that is technically correct and appropriate for this codebase.
|
|
67
|
+
- **Invalid** — based on a misunderstanding, would be incorrect, or does not apply.
|
|
68
|
+
|
|
69
|
+
## Step 4: Apply fixes for valid findings
|
|
70
|
+
|
|
71
|
+
Apply each fix in the most specific module that owns the code (respect the `architecture.md` module boundaries). Collect all code changes, then run the tests for each affected module. Skip the build for docs/config-only changes (e.g. `suggest-docs`, `*.adoc`, `*.md`) — there is nothing to test:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
# Unit tests for an affected module (with upstream deps built):
|
|
75
|
+
mvn -pl <module> -am test
|
|
76
|
+
|
|
77
|
+
# Acceptance tests — run if an acceptance test module exists in the repository (e.g. suggest-tests):
|
|
78
|
+
mvn -pl suggest-tests verify
|
|
79
|
+
|
|
80
|
+
# Full build / static analysis before merge:
|
|
81
|
+
mvn -P verify-project verify
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
If tests fail, fix the failure before proceeding.
|
|
85
|
+
|
|
86
|
+
## Step 5: Commit and push (only if code changed)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
git add <changed files>
|
|
90
|
+
git commit -m "FHR-<number>: address review feedback"
|
|
91
|
+
git push
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Confirm with the user before pushing.
|
|
95
|
+
|
|
96
|
+
## Step 6: Reply to all threads
|
|
97
|
+
|
|
98
|
+
`<MODEL_NAME>` is the model powering this session (e.g., "Sonnet 4.6", "Opus 4.8") and `<MODEL_SLUG>` is its URL slug (e.g., "sonnet", "opus", "haiku") — substitute from your system context.
|
|
99
|
+
|
|
100
|
+
For each **valid** thread that was fixed:
|
|
101
|
+
```bash
|
|
102
|
+
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/comments \
|
|
103
|
+
--method POST \
|
|
104
|
+
--field body="Fixed — <one-sentence summary of the change made>.
|
|
105
|
+
|
|
106
|
+
🤖 Addressed by [Claude <MODEL_NAME>](https://www.anthropic.com/claude/<MODEL_SLUG>)" \
|
|
107
|
+
--field in_reply_to=<FIRST_COMMENT_DATABASE_ID>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For each **invalid** thread:
|
|
111
|
+
```bash
|
|
112
|
+
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/comments \
|
|
113
|
+
--method POST \
|
|
114
|
+
--field body="<Clear, professional explanation of why no change is needed.>
|
|
115
|
+
|
|
116
|
+
🤖 Addressed by [Claude <MODEL_NAME>](https://www.anthropic.com/claude/<MODEL_SLUG>)" \
|
|
117
|
+
--field in_reply_to=<FIRST_COMMENT_DATABASE_ID>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Use the `databaseId` of the first comment in each thread as `in_reply_to`.
|
|
121
|
+
|
|
122
|
+
## Step 7: Report
|
|
123
|
+
|
|
124
|
+
Summarise how many threads were fixed (with code changes), how many received a reply (no change), any that need manual attention, and the commit SHA if code was pushed.
|
|
125
|
+
|
|
126
|
+
## Constraints
|
|
127
|
+
|
|
128
|
+
- Never push without explicit user confirmation.
|
|
129
|
+
- Fix failing tests before moving on — do not push a broken build.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: plan-spec
|
|
3
3
|
description: Read a spec file and produce a detailed design and implementation plan — with BDD acceptance tests and TDD test cases per task — written into the spec's "Design and Implementation Plan" section, then committed. Use when user references a spec file and wants a plan, implementation design, or test specifications derived from requirements.
|
|
4
4
|
arguments: spec-file
|
|
5
|
+
model: claude-opus-4-8
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Plan Spec
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ready-pr
|
|
3
|
+
description: Check that all GitHub PR review threads are resolved, then promote the PR from draft to ready for review. Stops with a clear message if any unresolved threads remain. Use when the user wants to mark a PR ready, promote a draft, or run "/ready-pr".
|
|
4
|
+
arguments: pr-number (optional)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Ready PR
|
|
8
|
+
|
|
9
|
+
Check the PR's review threads. If all are resolved, mark the PR ready for review. If any are still open, stop and say what to do.
|
|
10
|
+
|
|
11
|
+
Argument: `$ARGUMENTS` — optional. Pass the PR number to target a specific PR; omit it to auto-detect from the current branch.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/ready-pr
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Step 1: Find the PR
|
|
20
|
+
|
|
21
|
+
If a PR number was passed in `$ARGUMENTS`, substitute it for `<PR_NUMBER>` in the commands below; otherwise omit `<PR_NUMBER>` entirely and `gh` auto-detects the PR from the current branch:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
gh pr view <PR_NUMBER> --json number,url,title,isDraft,state
|
|
25
|
+
gh repo view --json owner,name --jq '.owner.login, .name' # first line = <OWNER>, second = <REPO>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Stop and report if any of these hold — do not continue:
|
|
29
|
+
- No PR is found.
|
|
30
|
+
- `state` is not `OPEN` (the PR is merged or closed — there is nothing to promote).
|
|
31
|
+
- `isDraft` is `false` (the PR is already marked ready for review).
|
|
32
|
+
|
|
33
|
+
## Step 2: Check for unresolved review threads
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
gh api graphql -f query='
|
|
37
|
+
query($owner: String!, $repo: String!, $number: Int!) {
|
|
38
|
+
repository(owner: $owner, name: $repo) {
|
|
39
|
+
pullRequest(number: $number) {
|
|
40
|
+
reviewThreads(first: 100) {
|
|
41
|
+
nodes {
|
|
42
|
+
isResolved
|
|
43
|
+
isOutdated
|
|
44
|
+
comments(first: 1) {
|
|
45
|
+
nodes { body path line author { login } }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
' -f owner=<OWNER> -f repo=<REPO> -F number=<PR_NUMBER>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Keep threads where `isResolved` is `false` AND `isOutdated` is `false`. Outdated threads do not block readiness.
|
|
56
|
+
|
|
57
|
+
## Step 3: If unresolved threads exist — STOP
|
|
58
|
+
|
|
59
|
+
Report and do nothing further:
|
|
60
|
+
|
|
61
|
+
> **Not ready:** N unresolved review thread(s) remain:
|
|
62
|
+
>
|
|
63
|
+
> - `path:line` — "comment text" (by @reviewer)
|
|
64
|
+
> - …
|
|
65
|
+
>
|
|
66
|
+
> Run `/address-pr` to fix or reply to each thread, or resolve them manually on GitHub, then run `/ready-pr` again.
|
|
67
|
+
|
|
68
|
+
## Step 4: If all threads are resolved — mark ready
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
gh pr ready <PR_NUMBER>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Report the PR URL and confirm it is now ready for review.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: refine-spec
|
|
3
3
|
description: Conduct a structured requirements-refinement interview against a spec file, using the project's ubiquitous language from glossary.md, until scope and acceptance criteria are clear, then update the spec file in place. Use when user references a spec file and wants to clarify requirements, define scope, or sharpen acceptance criteria — but not write code or tests.
|
|
4
4
|
arguments: spec-file
|
|
5
|
+
model: claude-opus-4-8
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Refine Spec
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-pr
|
|
3
|
+
description: Review the current branch's GitHub PR — fetch its description and diff, compare against the spec/plan if present, and submit a GitHub PR review with inline comments for every finding. Use when the user wants to review a PR, run an AI review pass, or run "/review-pr".
|
|
4
|
+
arguments: pr-number (optional)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Review PR
|
|
8
|
+
|
|
9
|
+
Review the open GitHub PR for this branch by acting as a code reviewer. The output is a **submitted GitHub PR review with inline comments** — not a local file.
|
|
10
|
+
|
|
11
|
+
Argument: `$ARGUMENTS` — optional. Pass the PR number to review a specific PR; omit it to auto-detect from the current branch.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/review-pr
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Step 1: Find the PR
|
|
20
|
+
|
|
21
|
+
If a PR number was passed in `$ARGUMENTS`, substitute it for `<PR_NUMBER>` in the commands below; otherwise omit `<PR_NUMBER>` entirely and `gh` auto-detects the PR from the current branch:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
gh pr view <PR_NUMBER> --json number,url,title,state,body,headRefName,baseRefName
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Extract the PR number, title, description, and base branch. If no PR is found, stop and ask the user to run `/write-pr` first.
|
|
28
|
+
|
|
29
|
+
Get the latest commit SHA (required to anchor inline comments):
|
|
30
|
+
```bash
|
|
31
|
+
gh pr view <PR_NUMBER> --json commits --jq '.commits[-1].oid'
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Step 2: Fetch the diff
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
gh pr diff <PR_NUMBER>
|
|
38
|
+
gh pr view <PR_NUMBER> --json files --jq '[.files[].path]'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Step 3: Load spec/plan and project standards (if available)
|
|
42
|
+
|
|
43
|
+
Detect the ticket number from the branch name (pattern `FHR-\d+`).
|
|
44
|
+
|
|
45
|
+
Read if present (the spec may be in any of these locations):
|
|
46
|
+
- `.claude/resources/FHR-<number>-*.md`
|
|
47
|
+
- `suggest-docs/src/main/docs/specs/FHR-<number>-*.md`
|
|
48
|
+
- `documentation/releases/*/FHR-<number>-*.md`
|
|
49
|
+
|
|
50
|
+
The plan is embedded in the spec's `## Design and Implementation Plan` section — there is no separate plan file.
|
|
51
|
+
|
|
52
|
+
Also read:
|
|
53
|
+
- `coding-guidelines.md`, `architecture.md`, `glossary.md` (project root) — the standards to review against.
|
|
54
|
+
|
|
55
|
+
If the spec is missing, proceed and review code quality only.
|
|
56
|
+
|
|
57
|
+
## Step 4: Review the PR
|
|
58
|
+
|
|
59
|
+
Review the diff and PR description against `coding-guidelines.md` and `architecture.md`.
|
|
60
|
+
|
|
61
|
+
**What to check:**
|
|
62
|
+
|
|
63
|
+
1. **PR description accuracy** — does the body describe what actually changed? Are diagrams present and correct for complex changes?
|
|
64
|
+
2. **Spec compliance** (if a spec was found) — does the implementation satisfy each acceptance criterion? Are there missing tests for any plan task?
|
|
65
|
+
3. **Code quality:**
|
|
66
|
+
- Correctness and edge cases (nulls, boundary values, empty inputs)
|
|
67
|
+
- Error handling and resilience (no swallowed exceptions)
|
|
68
|
+
- Security and input validation (no injection, no hardcoded secrets)
|
|
69
|
+
- Test coverage (every new/changed conditional branch has a dedicated test)
|
|
70
|
+
- Readability, naming, complexity, duplication
|
|
71
|
+
- Architecture and module boundaries (refer to `architecture.md` for module structure and dependency rules; no circular dependencies)
|
|
72
|
+
- Domain language matches `glossary.md`
|
|
73
|
+
- Logging and observability (no secrets or PII in logs)
|
|
74
|
+
|
|
75
|
+
**For each finding, record:**
|
|
76
|
+
- `path` — relative file path in the repo
|
|
77
|
+
- `line` — absolute line number in the new version of the file
|
|
78
|
+
- `side` — always `"RIGHT"` for added or unchanged lines
|
|
79
|
+
- `severity` — `BLOCKER` | `MAJOR` | `MINOR` | `NIT`
|
|
80
|
+
- `body` — comment text prefixed with the severity tag, e.g. `BLOCKER: Missing null check. Add a guard before line 42.`
|
|
81
|
+
|
|
82
|
+
Only raise a finding if the evidence is clear from the diff. Do not speculate about code you cannot see.
|
|
83
|
+
|
|
84
|
+
**Inline comments can only anchor to lines that are part of the PR's diff hunks** (added or directly-adjacent context lines). The GitHub reviews API rejects the whole submission (HTTP 422) if any comment targets a line outside the diff. If a finding concerns an unchanged line, put it in the review `body` instead of inline.
|
|
85
|
+
|
|
86
|
+
## Step 5: Submit the GitHub PR review
|
|
87
|
+
|
|
88
|
+
Get the owner and repo (printed on separate lines — the first is `<OWNER>`, the second is `<REPO>`):
|
|
89
|
+
```bash
|
|
90
|
+
gh repo view --json owner,name --jq '.owner.login, .name'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Choose the review `event` from the highest finding severity:
|
|
94
|
+
- `REQUEST_CHANGES` — at least one `BLOCKER` or `MAJOR` finding (these block the PR).
|
|
95
|
+
- `COMMENT` — only `MINOR`/`NIT` findings (non-blocking, so the severity tags carry weight).
|
|
96
|
+
|
|
97
|
+
Submit the full review in a single API call:
|
|
98
|
+
```bash
|
|
99
|
+
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/reviews \
|
|
100
|
+
--method POST \
|
|
101
|
+
--field commit_id=<LATEST_COMMIT_SHA> \
|
|
102
|
+
--field body="Review: <N> finding(s) — <X> blocker(s), <Y> major, <Z> minor, <W> nit(s)." \
|
|
103
|
+
--field event="<REQUEST_CHANGES or COMMENT>" \
|
|
104
|
+
--raw-field comments='[
|
|
105
|
+
{"path":"suggest-api/src/main/java/Foo.java","line":42,"side":"RIGHT","body":"BLOCKER: …"},
|
|
106
|
+
{"path":"suggest-lucene/src/main/java/Bar.java","line":17,"side":"RIGHT","body":"MINOR: …"}
|
|
107
|
+
]'
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
If a finding cannot be anchored to a specific file line (e.g. a description-level issue), include it in the review `body` instead of as an inline comment.
|
|
111
|
+
|
|
112
|
+
If there are **no findings**, approve:
|
|
113
|
+
```bash
|
|
114
|
+
gh api repos/<OWNER>/<REPO>/pulls/<PR_NUMBER>/reviews \
|
|
115
|
+
--method POST \
|
|
116
|
+
--field body="LGTM — all quality gates pass." \
|
|
117
|
+
--field event="APPROVE"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Step 6: Report
|
|
121
|
+
|
|
122
|
+
Output the PR URL, the review decision (`REQUEST_CHANGES` or `APPROVE`), finding counts by severity, and any findings placed in the review body rather than inline.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: tdd-green
|
|
3
3
|
description: Implement production code (green phase) for the next incomplete task in a spec file's Design and Implementation Plan, writing only enough code to make the failing tests pass, then refactor while keeping tests green, mark the Production code sub-task done, and commit the green and refactor work separately. Use when user references a spec file and wants to implement a feature, or says "green phase", "make tests pass", "tdd green", or "green and refactor".
|
|
4
4
|
arguments: spec-file
|
|
5
|
+
model: claude-haiku-4-5-20251001
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# TDD Green
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: tdd-red
|
|
3
3
|
description: Write failing tests (red phase) for the next incomplete task in a spec file's Design and Implementation Plan — acceptance tests (JGiven BDD) and unit tests (JUnit Jupiter) — then mark the Acceptance tests and Unit tests sub-tasks done and commit. Use when user references a spec file and wants to write the failing tests before implementing a feature, or says "red phase", "write tests", or "tdd red".
|
|
4
4
|
arguments: spec-file
|
|
5
|
+
model: claude-haiku-4-5-20251001
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# TDD Red
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: tdd-workflow
|
|
3
3
|
description: Drive the full red-green-refactor TDD cycle across every task in a spec file's Design and Implementation Plan — picking the next incomplete task, then running the red, green, and refactor phases for it, then looping to the next task until the plan is complete. Use when user references a spec file and wants to implement the whole plan end to end, or says "run the tdd workflow", "implement the plan", or "tdd workflow".
|
|
4
4
|
arguments: spec-file
|
|
5
|
+
model: claude-haiku-4-5-20251001
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# TDD Workflow
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-pr
|
|
3
|
+
description: Render the repo PR template from the current branch's diff, and create (or update) a draft GitHub PR. Use when the user wants to open a PR, write a PR description, or run "/write-pr" on a branch.
|
|
4
|
+
arguments: extra-context (optional)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Write PR
|
|
8
|
+
|
|
9
|
+
Render the `.github/pull_request_template.md` from the current branch's changes and open a **draft** GitHub PR. PRs are always created as drafts — use `/ready-pr` to promote them once review is complete.
|
|
10
|
+
|
|
11
|
+
Argument: `$ARGUMENTS` — optional free text treated as extra context for the description.
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/write-pr
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
1. **Detect the ticket and diff**
|
|
22
|
+
- Read the ticket number from the branch name (pattern `FHR-\d+`). If the branch name has no ticket, ask the user for the ticket number before continuing.
|
|
23
|
+
- Make sure the branch is committed — `git diff origin/master...HEAD` only shows committed work, not uncommitted or untracked files. Get the diff vs `master`:
|
|
24
|
+
```bash
|
|
25
|
+
git diff origin/master...HEAD --stat
|
|
26
|
+
git diff origin/master...HEAD
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
2. **Render the template** — fill in `.github/pull_request_template.md`:
|
|
30
|
+
- Set the Jira link to `https://attraqt.atlassian.net/browse/FHR-<number>`.
|
|
31
|
+
- Tick the AI Development Checklist items that genuinely apply (spec present, tests present, docs present, AI review pass, etc.). Leave unticked anything not yet true.
|
|
32
|
+
- Prepend a `## Summary of changes` section (the template has no such section) describing what changed and why.
|
|
33
|
+
|
|
34
|
+
4. **Approve before publishing** — present the title and rendered body and wait for explicit approval. Support correction cycles.
|
|
35
|
+
|
|
36
|
+
5. **Publish** — write the approved body to a temp file (e.g. `pr-body.md`), then with confirmation push the branch and create or update the draft PR:
|
|
37
|
+
```bash
|
|
38
|
+
gh pr create --draft --title "FHR-<number>: <Title>" --body-file pr-body.md
|
|
39
|
+
# or, if a PR already exists for this branch (omit the number — gh auto-detects it):
|
|
40
|
+
gh pr edit --title "FHR-<number>: <Title>" --body-file pr-body.md
|
|
41
|
+
```
|
|
42
|
+
Delete the temp file afterwards and report the PR URL.
|
|
43
|
+
|
|
44
|
+
## Constraints
|
|
45
|
+
|
|
46
|
+
- Always create the PR as a **draft**.
|
|
47
|
+
- Never push without explicit user confirmation.
|
|
48
|
+
- The title MUST match `FHR-<number>: <description>` — the `pull-request.yml` CI check fails otherwise.
|
|
49
|
+
- Only tick checklist items that are actually true.
|