@martinffx/atelier 1.2.2 → 1.4.0
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/.codex-plugin/plugin.json +27 -0
- package/CHANGELOG.md +33 -0
- package/README.md +51 -59
- package/agents/architect.md +1 -1
- package/agents/oracle.md +1 -1
- package/dist/atelier.js +14171 -12949
- package/package.json +6 -1
- package/skills/code-commit/SKILL.md +77 -77
- package/skills/code-handoff/SKILL.md +1 -1
- package/skills/code-pull-request/SKILL.md +36 -0
- package/skills/code-pull-request/references/common.md +76 -0
- package/skills/code-pull-request/references/create-pr.md +122 -0
- package/skills/code-pull-request/references/default-template.md +25 -0
- package/skills/code-pull-request/references/leave-comment.md +53 -0
- package/skills/code-pull-request/references/merge-pr.md +94 -0
- package/skills/code-pull-request/references/read-comments.md +61 -0
- package/skills/code-pull-request/references/respond-to-comment.md +66 -0
- package/skills/code-review/SKILL.md +21 -12
- package/skills/code-review/references/reviewers.md +142 -41
- package/skills/code-review/references/rq.md +48 -32
- package/skills/oracle-debug/SKILL.md +218 -0
- package/skills/{code-debug → oracle-debug}/references/bug-patterns.md +3 -3
- package/skills/oracle-domain-modelling/SKILL.md +84 -0
- package/skills/oracle-grill-me/SKILL.md +20 -0
- package/skills/spec-brainstorm/SKILL.md +91 -71
- package/skills/spec-finish/SKILL.md +20 -14
- package/skills/spec-implement/SKILL.md +3 -2
- package/skills/spec-orchestrator/SKILL.md +4 -15
- package/skills/spec-plan/SKILL.md +1 -1
- package/agents/scout.md +0 -40
- package/skills/code-commit/references/pr-workflow.md +0 -145
- package/skills/code-debug/SKILL.md +0 -199
- package/skills/code-docs/SKILL.md +0 -171
- package/skills/code-docs/references/api-docs.md +0 -116
- package/skills/code-docs/references/changelog.md +0 -64
- package/skills/code-docs/references/readme-structure.md +0 -94
- package/skills/oracle-architect/SKILL.md +0 -327
- package/skills/oracle-architect/references/api-design.md +0 -345
- package/skills/oracle-architect/references/data-modeling.md +0 -318
- package/skills/oracle-architect/references/ddd-patterns.md +0 -348
- package/skills/oracle-architect/references/interface-design.md +0 -203
- package/skills/oracle-challenge/SKILL.md +0 -126
- package/skills/oracle-doubt/SKILL.md +0 -252
- package/skills/oracle-doubt/references/adversarial-prompt.md +0 -47
- package/skills/oracle-grillme/SKILL.md +0 -160
- package/skills/oracle-security/SKILL.md +0 -225
- package/skills/oracle-security/references/security-patterns.md +0 -236
- package/skills/oracle-security/references/threat-modeling-guide.md +0 -137
- package/skills/oracle-testing/SKILL.md +0 -237
- package/skills/oracle-testing/references/anti-patterns.md +0 -618
- package/skills/oracle-testing/references/boundaries.md +0 -579
- package/skills/oracle-testing/references/core-testing.md +0 -691
- package/skills/oracle-testing/references/edge-testing.md +0 -794
- package/skills/oracle-testing/references/stub-driven-tdd.md +0 -322
- package/skills/oracle-thinkdeep/SKILL.md +0 -164
- /package/skills/{code-debug → oracle-debug}/references/language-tools.md +0 -0
- /package/skills/{code-debug → oracle-debug}/references/techniques.md +0 -0
- /package/skills/{oracle-grillme → oracle-domain-modelling}/references/ADR-FORMAT.md +0 -0
- /package/skills/{oracle-grillme → oracle-domain-modelling}/references/CONTEXT-FORMAT.md +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@martinffx/atelier",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Personal development toolkit - spec-driven development, code quality, deep thinking, and ecosystem patterns",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"cli",
|
|
12
12
|
"claude-code",
|
|
13
13
|
"opencode",
|
|
14
|
+
"codex",
|
|
14
15
|
"ai-agents",
|
|
15
16
|
"spec-driven-development"
|
|
16
17
|
],
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
"dist/",
|
|
20
21
|
"skills/",
|
|
21
22
|
"agents/",
|
|
23
|
+
".codex-plugin/",
|
|
22
24
|
"README.md",
|
|
23
25
|
"LICENSE",
|
|
24
26
|
"CHANGELOG.md"
|
|
@@ -28,6 +30,8 @@
|
|
|
28
30
|
},
|
|
29
31
|
"scripts": {
|
|
30
32
|
"build": "bun build ./src/atelier.ts --outdir ./dist --target bun",
|
|
33
|
+
"clean": "rm -rf dist .agents .claude .codex .opencode hooks && rm -f *.log .DS_Store",
|
|
34
|
+
"cli": "bun src/atelier.ts",
|
|
31
35
|
"typecheck": "tsgo --noEmit",
|
|
32
36
|
"test": "bun test",
|
|
33
37
|
"prepare": "simple-git-hooks"
|
|
@@ -39,6 +43,7 @@
|
|
|
39
43
|
"commander": "^13.1.0",
|
|
40
44
|
"gray-matter": "^4.0.3",
|
|
41
45
|
"inquirer": "^12.5.2",
|
|
46
|
+
"smol-toml": "^1.7.0",
|
|
42
47
|
"zod": "^3.25.0"
|
|
43
48
|
},
|
|
44
49
|
"devDependencies": {
|
|
@@ -6,113 +6,116 @@ user-invocable: true
|
|
|
6
6
|
|
|
7
7
|
# Conventional Commit Skill
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Create coherent, reviewable commits that follow the
|
|
10
|
+
[Conventional Commits](https://www.conventionalcommits.org/) specification.
|
|
11
|
+
Message syntax matters, but the selected changes must tell one clear story too.
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Message Format
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
<type>(<scope>): <subject>
|
|
15
|
+
Every generated commit has a title and body:
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
```
|
|
18
|
+
<type>(<scope>): <imperative title>
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
<1-5 lines describing the change and, when useful, its reason or effect>
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
Use a lowercase scope that identifies the affected component. The title is concise,
|
|
24
|
+
imperative, lowercase, and has no trailing period. The body is concrete: explain the
|
|
25
|
+
behavior, motivation, or important implementation decision rather than restating the title.
|
|
22
26
|
|
|
23
|
-
| Type |
|
|
24
|
-
|
|
25
|
-
| `feat` | New
|
|
26
|
-
| `fix` |
|
|
27
|
+
| Type | Use for |
|
|
28
|
+
|------|---------|
|
|
29
|
+
| `feat` | New user-facing capability |
|
|
30
|
+
| `fix` | Corrected behavior |
|
|
27
31
|
| `docs` | Documentation only |
|
|
28
|
-
| `style` |
|
|
29
|
-
| `refactor` |
|
|
30
|
-
| `test` |
|
|
31
|
-
| `chore` |
|
|
32
|
+
| `style` | Formatting only |
|
|
33
|
+
| `refactor` | Restructuring without behavior change |
|
|
34
|
+
| `test` | Tests only |
|
|
35
|
+
| `chore` | Maintenance or tooling |
|
|
32
36
|
| `perf` | Performance improvement |
|
|
33
|
-
| `ci` |
|
|
37
|
+
| `ci` | Continuous integration configuration |
|
|
34
38
|
| `build` | Build system or dependencies |
|
|
35
|
-
| `revert` | Reverting a
|
|
39
|
+
| `revert` | Reverting a prior commit |
|
|
36
40
|
|
|
37
|
-
|
|
41
|
+
For breaking changes, add `!` after the scope and include a `BREAKING CHANGE:` footer.
|
|
42
|
+
Include issue footers such as `Closes #123` only when the issue is known.
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
- **Scope**: Optional, lowercase, describes what was changed (e.g., `auth`, `api`, `ui`)
|
|
41
|
-
- **Breaking changes**: Add `!` after type/scope: `feat(auth)!: change API`
|
|
42
|
-
- **Footer**: For breaking changes (`BREAKING CHANGE:`) or issue references (`Closes #123`)
|
|
44
|
+
## Create a Commit
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
When the user asks to commit, first inspect the complete worktree:
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
1. Run `git status --short`.
|
|
49
|
+
2. Read both `git diff --cached` and `git diff` so pre-staged work is not mistaken for the entire change.
|
|
50
|
+
3. List untracked files with `git ls-files --others --exclude-standard` and inspect relevant ones.
|
|
51
|
+
4. Read recent subjects with `git log --oneline -10` to match established scopes and wording.
|
|
52
|
+
5. Flag likely secrets, credentials, local configuration, or generated output. Do not stage them without explicit direction.
|
|
47
53
|
|
|
48
|
-
|
|
54
|
+
### Decide Whether to Split
|
|
49
55
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
3. Analyze what changed to determine:
|
|
53
|
-
- **Type**: Which type best describes the changes?
|
|
54
|
-
- **Scope**: What area was affected? (optional)
|
|
55
|
-
- **Subject**: What was done? (imperative: "add" not "added")
|
|
56
|
-
4. Create a conventional commit message
|
|
57
|
-
5. Run `git commit -m "<message>"`
|
|
56
|
+
Default to one commit containing all intended, related changes. Look for an obvious
|
|
57
|
+
file-level split only when changes are independent and each group can stand alone.
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
```
|
|
61
|
-
feat(auth): add JWT token refresh
|
|
59
|
+
Keep these together:
|
|
62
60
|
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
- Implementation and its tests.
|
|
62
|
+
- Documentation that describes the same change.
|
|
63
|
+
- Dependency manifests and their lockfiles.
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
Do not invent a split for adjacent work, use hunk-level staging, or force the user
|
|
66
|
+
to reorganize a coherent change. If an obvious split exists, propose each commit with
|
|
67
|
+
its files and full message, then ask once for approval. If not, propose one commit.
|
|
68
|
+
|
|
69
|
+
### Approve, Stage, Commit
|
|
70
|
+
|
|
71
|
+
Before making any write, show:
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
- The files in each proposed commit.
|
|
74
|
+
- The full title and 1-5 line body for each commit.
|
|
75
|
+
- Any excluded files and why they are excluded.
|
|
70
76
|
|
|
71
|
-
|
|
77
|
+
Ask for approval unless the user explicitly authorizes committing immediately. After
|
|
78
|
+
approval, stage only the files for the approved commit with `git add -- <paths>` and
|
|
79
|
+
commit with the proposed title and body. Do not amend, rebase, push, or include
|
|
80
|
+
unapproved files.
|
|
72
81
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
4. Check subject follows rules (lowercase, imperative, no period)
|
|
77
|
-
5. Flag any issues found
|
|
82
|
+
Repository commit hooks are the final message validation when configured. Never bypass
|
|
83
|
+
a failing hook. Report the commit hash on success; report the error and leave changes
|
|
84
|
+
intact on failure.
|
|
78
85
|
|
|
79
|
-
|
|
86
|
+
## Validate a Commit Message
|
|
80
87
|
|
|
81
|
-
When user
|
|
88
|
+
When the user asks to validate a message, check:
|
|
82
89
|
|
|
83
|
-
1.
|
|
84
|
-
2.
|
|
85
|
-
3.
|
|
86
|
-
4.
|
|
87
|
-
|
|
88
|
-
- Use `--draft` for work-in-progress
|
|
89
|
-
- Use interactive mode if body needs custom content
|
|
90
|
-
5. Show the PR URL to the user
|
|
90
|
+
1. It follows `type(scope): imperative title`.
|
|
91
|
+
2. The type is listed above and the scope is lowercase.
|
|
92
|
+
3. The title is lowercase, imperative, concise, and has no trailing period.
|
|
93
|
+
4. A body follows after a blank line and contains 1-5 meaningful lines.
|
|
94
|
+
5. Breaking changes use both `!` and a `BREAKING CHANGE:` footer.
|
|
91
95
|
|
|
92
|
-
|
|
96
|
+
Return specific corrections and a revised message. When the repository configures
|
|
97
|
+
commitlint, use it as the authoritative validation rule.
|
|
98
|
+
|
|
99
|
+
### Delegated: Pull Request Creation
|
|
100
|
+
|
|
101
|
+
If the user wants to create a PR after committing, invoke the
|
|
102
|
+
[code-pull-request](../code-pull-request/SKILL.md) skill. It detects the platform
|
|
103
|
+
(GitHub/GitLab), finds a template, generates the body, and opens the PR via `gh`
|
|
104
|
+
or `glab`.
|
|
93
105
|
|
|
94
106
|
## Input Methods
|
|
95
107
|
|
|
96
108
|
| Input | Action |
|
|
97
109
|
|-------|--------|
|
|
98
|
-
| User says "commit" or "git commit" |
|
|
110
|
+
| User says "commit" or "git commit" | Inspect the worktree, propose coherent commit(s), then commit after approval |
|
|
99
111
|
| User says "validate commit" | Check the commit message format |
|
|
100
112
|
| User pastes commit message | Validate the provided message |
|
|
101
113
|
|
|
102
|
-
## Auto-Commit Workflow
|
|
103
|
-
|
|
104
|
-
When generating a commit:
|
|
105
|
-
|
|
106
|
-
1. Show the user the commit message first
|
|
107
|
-
2. Ask for confirmation before committing (unless user explicitly says "just do it")
|
|
108
|
-
3. Execute `git commit -m "<message>"` after confirmation
|
|
109
|
-
4. Show the result of the commit
|
|
110
|
-
|
|
111
114
|
## Error Handling
|
|
112
115
|
|
|
113
|
-
- If no
|
|
114
|
-
- If
|
|
115
|
-
- If commit fails:
|
|
116
|
+
- If there are no changes: report that there is nothing to commit.
|
|
117
|
+
- If Git is not initialized: report it; do not initialize a repository unless asked.
|
|
118
|
+
- If a commit fails: show the error, preserve the worktree, and do not bypass hooks.
|
|
116
119
|
|
|
117
120
|
## Examples
|
|
118
121
|
|
|
@@ -121,8 +124,7 @@ When generating a commit:
|
|
|
121
124
|
```
|
|
122
125
|
fix(auth): resolve login timeout issue
|
|
123
126
|
|
|
124
|
-
|
|
125
|
-
incorrect token expiry calculation.
|
|
127
|
+
Correct token expiry calculation so active users are not logged out after five minutes.
|
|
126
128
|
```
|
|
127
129
|
|
|
128
130
|
**Input:** "I added a new API endpoint for users"
|
|
@@ -130,8 +132,7 @@ incorrect token expiry calculation.
|
|
|
130
132
|
```
|
|
131
133
|
feat(api): add user profile endpoint
|
|
132
134
|
|
|
133
|
-
GET /users/:id
|
|
134
|
-
name, email, and avatar URL.
|
|
135
|
+
Expose name, email, and avatar URL from `GET /users/:id`.
|
|
135
136
|
|
|
136
137
|
Closes #89
|
|
137
138
|
```
|
|
@@ -141,8 +142,7 @@ Closes #89
|
|
|
141
142
|
```
|
|
142
143
|
feat(auth)!: change token validation endpoint
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
instead of query parameter.
|
|
145
|
+
Require a Bearer token on `/auth/verify` instead of a query parameter.
|
|
146
146
|
|
|
147
147
|
BREAKING CHANGE: Clients must update to send
|
|
148
148
|
Authorization header with Bearer token.
|
|
@@ -5,7 +5,7 @@ argument-hint: "What will the next session be used for?"
|
|
|
5
5
|
user-invocable: true
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
Write a handoff document summarising the current conversation so a fresh agent can continue the work.
|
|
8
|
+
Write a handoff document summarising the current conversation so a fresh agent can continue the work. Create `<project-root>/.handoff/` if needed and save the document there with a descriptive `.md` filename.
|
|
9
9
|
|
|
10
10
|
Include a "suggested skills" section in the document, which suggests skills that the agent should invoke.
|
|
11
11
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-pull-request
|
|
3
|
+
description: >
|
|
4
|
+
Manage GitHub pull requests or GitLab merge requests: create, read/leave/respond to
|
|
5
|
+
comments, and merge. Triggers on "open a PR", "make a PR", "merge this PR", "merge the
|
|
6
|
+
MR", "read PR comments", "leave a comment on the PR", "respond to a comment", "ship this",
|
|
7
|
+
or when a feature branch is ready for review.
|
|
8
|
+
user-invocable: true
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Pull Request / Merge Request Skill
|
|
12
|
+
|
|
13
|
+
Create, comment on, and merge GitHub pull requests or GitLab merge requests for the
|
|
14
|
+
current branch. Assumes the relevant CLI (`gh` or `glab`) is installed and authenticated.
|
|
15
|
+
|
|
16
|
+
This skill is **create/read + write-gated**. Every write action (create PR, leave
|
|
17
|
+
comment, respond to comment, merge) requires explicit human confirmation before running.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Start Here
|
|
22
|
+
|
|
23
|
+
1. Detect the platform and find the current branch's open PR/MR — see
|
|
24
|
+
[references/common.md](references/common.md).
|
|
25
|
+
2. Pick a workflow:
|
|
26
|
+
|
|
27
|
+
| Workflow | Reference | Trigger phrases |
|
|
28
|
+
|----------|-----------|------------------|
|
|
29
|
+
| Create PR/MR | [create-pr.md](references/create-pr.md) | "open a PR", "make a PR", "submit for review" |
|
|
30
|
+
| Read comments | [read-comments.md](references/read-comments.md) | "read PR comments", "show MR comments" |
|
|
31
|
+
| Leave a comment | [leave-comment.md](references/leave-comment.md) | "leave a comment", "comment on the PR" |
|
|
32
|
+
| Respond to a comment | [respond-to-comment.md](references/respond-to-comment.md) | "respond to a comment", "reply on the PR" |
|
|
33
|
+
| Merge PR/MR | [merge-pr.md](references/merge-pr.md) | "merge this PR", "ship it", "merge the MR" |
|
|
34
|
+
|
|
35
|
+
Both GitHub (`gh`) and GitLab (`glab`) are first-class. Every write step pauses for
|
|
36
|
+
human approval before running the CLI command.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Common: Platform Detection and PR Lookup
|
|
2
|
+
|
|
3
|
+
Shared steps used by every workflow. Run these first.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Detect Platform
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git remote -v
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Scan the push URLs for the platform host — don't assume the remote is named
|
|
14
|
+
`origin` (forks and multi-remote setups often use `upstream` or other names):
|
|
15
|
+
|
|
16
|
+
- Contains `github.com` → use `gh` (GitHub PR)
|
|
17
|
+
- Contains `gitlab` → use `glab` (GitLab MR)
|
|
18
|
+
- Multiple or no matches → ask the human which remote to use.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Determine the Base Branch
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
base=$(git symbolic-ref --quiet refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
|
|
26
|
+
if [ -z "$base" ]; then
|
|
27
|
+
for candidate in main master; do
|
|
28
|
+
git rev-parse --verify --quiet "origin/$candidate" >/dev/null && base=$candidate && break
|
|
29
|
+
done
|
|
30
|
+
fi
|
|
31
|
+
echo "$base"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If that's still empty, ask the human what the base branch is.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Preflight the CLI
|
|
39
|
+
|
|
40
|
+
Confirm the relevant CLI is installed and authenticated before any write:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
gh auth status # GitHub
|
|
44
|
+
glab auth status # GitLab
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
If not authenticated, stop and tell the human. Don't proceed with writes.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Find the Open PR/MR for the Current Branch
|
|
52
|
+
|
|
53
|
+
GitHub:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
gh pr view --json state,number,url,headRefName
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
GitLab:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
glab mr view --json state,iid,web_url,source_branch
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- **Open** → use this PR/MR number/URL for comment and merge workflows.
|
|
66
|
+
- **Closed/merged** → for merge workflow: check for new commits
|
|
67
|
+
(`git log --oneline origin/<base>..HEAD`); otherwise stop and tell the human.
|
|
68
|
+
- **None** → for merge workflow: run [create-pr.md](create-pr.md), then continue.
|
|
69
|
+
For comment workflows: stop — nothing to comment on.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Safety Guard
|
|
74
|
+
|
|
75
|
+
Refuse to operate from the default branch — that's almost always a mistake. Ask the
|
|
76
|
+
human to switch to a feature branch first.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Workflow: Create PR/MR
|
|
2
|
+
|
|
3
|
+
Create a pull request (GitHub) or merge request (GitLab) for the current branch.
|
|
4
|
+
|
|
5
|
+
Start with [common.md](common.md) (platform detection, base branch, preflight).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1: Check for Existing PR/MR
|
|
10
|
+
|
|
11
|
+
GitHub:
|
|
12
|
+
```bash
|
|
13
|
+
gh pr view --json state,number,url
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
GitLab:
|
|
17
|
+
```bash
|
|
18
|
+
glab mr view --json state,iid,web_url
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- **Open** → show the URL, stop. Don't create a duplicate.
|
|
22
|
+
- **Closed/merged** → check for new commits since the PR was closed:
|
|
23
|
+
```bash
|
|
24
|
+
git log --oneline origin/<base>..HEAD
|
|
25
|
+
```
|
|
26
|
+
New commits exist → proceed to create a new PR.
|
|
27
|
+
No new commits → tell the human, stop.
|
|
28
|
+
- **None** → proceed to create.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Step 2: Find a Template
|
|
33
|
+
|
|
34
|
+
Look for the repo's PR/MR template:
|
|
35
|
+
|
|
36
|
+
GitHub:
|
|
37
|
+
```bash
|
|
38
|
+
ls .github/PULL_REQUEST_TEMPLATE.md 2>/dev/null
|
|
39
|
+
ls .github/PULL_REQUEST_TEMPLATE/*.md 2>/dev/null
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
GitLab:
|
|
43
|
+
```bash
|
|
44
|
+
ls .gitlab/merge_request_templates/*.md 2>/dev/null
|
|
45
|
+
ls .gitlab/merge_request_template.md 2>/dev/null
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Also check common locations:
|
|
49
|
+
```bash
|
|
50
|
+
ls docs/PULL_REQUEST_TEMPLATE.md 2>/dev/null
|
|
51
|
+
ls PULL_REQUEST_TEMPLATE.md 2>/dev/null
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- **Template found** → use it. The CLI will auto-apply it in interactive mode, or
|
|
55
|
+
fill each section from the commits and diff for inline mode.
|
|
56
|
+
- **No template** → use the fallback template at
|
|
57
|
+
[default-template.md](default-template.md).
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Step 3: Generate Title and Body
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git log --oneline origin/<base>..HEAD # commit list
|
|
65
|
+
git log origin/<base>..HEAD --format='%H %s%n%b' # full commit messages
|
|
66
|
+
git diff --stat origin/<base>...HEAD # changed files summary
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Derive the title from the most significant conventional commit. If commits are
|
|
70
|
+
messy, synthesize from the diff:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
<type>(<scope>): <description>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Fill the body (template sections or fallback) from the commits and diff:
|
|
77
|
+
- **Summary** — what and why, one or two sentences
|
|
78
|
+
- **Changes** — bulleted, grouped by area
|
|
79
|
+
- **Testing** — how it was verified (if known)
|
|
80
|
+
- **Checklist** — tests pass, conventional commits, docs updated
|
|
81
|
+
- **Linked issues** — extract `Closes #N`, `Fixes #N`, `Relates to #N` from commit
|
|
82
|
+
footers
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Step 4: Create the PR
|
|
87
|
+
|
|
88
|
+
Push the branch first if it isn't on the remote:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git push -u origin <branch-name>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Show the human the generated title and body before creating.** Ask for confirmation,
|
|
95
|
+
or proceed if they said "just do it" up front.
|
|
96
|
+
|
|
97
|
+
### GitHub
|
|
98
|
+
|
|
99
|
+
| Mode | Command |
|
|
100
|
+
|------|---------|
|
|
101
|
+
| Auto-fill | `gh pr create --fill` |
|
|
102
|
+
| Inline | `gh pr create --title "<title>" --body-file -` (body via stdin) |
|
|
103
|
+
| Draft | `gh pr create --draft --title "<title>" --body-file -` (body via stdin) |
|
|
104
|
+
|
|
105
|
+
### GitLab
|
|
106
|
+
|
|
107
|
+
| Mode | Command |
|
|
108
|
+
|------|---------|
|
|
109
|
+
| Auto-fill | `glab mr create --fill` |
|
|
110
|
+
| Inline | `glab mr create --title "<title>" --description "$(cat <body-file>)"` |
|
|
111
|
+
| Draft | `glab mr create --draft --title "<title>" --description "$(cat <body-file>)"` |
|
|
112
|
+
|
|
113
|
+
Default to inline with the generated body. **Never pass a multi-line body directly
|
|
114
|
+
in the command string** (`--body "<body>"`) — quotes, backticks, and `$` in
|
|
115
|
+
Markdown break shell quoting. Write the body to a temp file first, then pass it
|
|
116
|
+
via stdin (`gh --body-file -`) or command substitution (`glab` has no
|
|
117
|
+
description-file flag). Reserve direct inline strings for one-line bodies.
|
|
118
|
+
|
|
119
|
+
Use `--fill` when commits are clean and the body would be redundant. Use `--draft`
|
|
120
|
+
when the human signals work in progress.
|
|
121
|
+
|
|
122
|
+
After creation, show the PR/MR URL to the human. Done.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Default PR/MR Template
|
|
2
|
+
|
|
3
|
+
Fallback body template when the repository has no `.github/PULL_REQUEST_TEMPLATE.md`
|
|
4
|
+
or `.gitlab/merge_request_template.md`. Fill each section from the conventional
|
|
5
|
+
commits and diff.
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
## Summary
|
|
9
|
+
<!-- One or two sentences: what and why -->
|
|
10
|
+
|
|
11
|
+
## Changes
|
|
12
|
+
<!-- Bulleted, grouped by area. Each bullet self-contained. -->
|
|
13
|
+
-
|
|
14
|
+
|
|
15
|
+
## Testing
|
|
16
|
+
<!-- How it was verified: test commands run, manual steps, edge cases checked -->
|
|
17
|
+
|
|
18
|
+
## Checklist
|
|
19
|
+
- [ ] Tests pass
|
|
20
|
+
- [ ] Commits follow conventional format
|
|
21
|
+
- [ ] Documentation updated (if needed)
|
|
22
|
+
|
|
23
|
+
## Linked Issues
|
|
24
|
+
<!-- Closes #123, Fixes #456, Relates to #789 -->
|
|
25
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Workflow: Leave a Comment
|
|
2
|
+
|
|
3
|
+
Post a new top-level comment on the current branch's open PR/MR.
|
|
4
|
+
|
|
5
|
+
Start with [common.md](common.md) (platform detection, find the open PR/MR).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Step 1: Find the Open PR/MR
|
|
10
|
+
|
|
11
|
+
Run the lookup in [common.md](common.md#find-the-open-prmr-for-the-current-branch).
|
|
12
|
+
If none is open, stop — nothing to comment on.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Step 2: Compose the Comment
|
|
17
|
+
|
|
18
|
+
Ask the human for the comment body. Accept either:
|
|
19
|
+
|
|
20
|
+
- Their exact text, or
|
|
21
|
+
- A draft you generate (e.g., a status update, summary, or question) that they edit.
|
|
22
|
+
|
|
23
|
+
Prefer passing the body via stdin or a temp file to avoid shell-escaping issues with
|
|
24
|
+
quotes, backticks, or `$` in the message:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
gh pr comment <number> --body-file -
|
|
28
|
+
glab mr note <iid> --message-file - # if supported; otherwise --message
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Step 3: Confirm and Post
|
|
34
|
+
|
|
35
|
+
**Show the human the final comment text and target PR/MR. Ask for confirmation
|
|
36
|
+
before running the write command.**
|
|
37
|
+
|
|
38
|
+
### GitHub
|
|
39
|
+
```bash
|
|
40
|
+
gh pr comment <number> --body "<body>"
|
|
41
|
+
```
|
|
42
|
+
Or via stdin to avoid escaping:
|
|
43
|
+
```bash
|
|
44
|
+
echo "$body" | gh pr comment <number> --body-file -
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### GitLab
|
|
48
|
+
```bash
|
|
49
|
+
glab mr note <iid> --message "<body>"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
After posting, show the human the comment URL or the updated PR/MR URL. Done. Do not
|
|
53
|
+
merge or make further changes unless the human asks for another workflow.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Workflow: Merge PR/MR
|
|
2
|
+
|
|
3
|
+
Merge the current branch's open PR/MR after confirming CI is green.
|
|
4
|
+
|
|
5
|
+
Defaults: **squash merge + delete the source branch**. If CI is pending, abort and
|
|
6
|
+
report — don't block waiting unless the human says otherwise.
|
|
7
|
+
|
|
8
|
+
Start with [common.md](common.md) (platform detection, base branch, preflight).
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Step 1: Find or Create the Open PR/MR
|
|
13
|
+
|
|
14
|
+
Run the lookup in [common.md](common.md#find-the-open-prmr-for-the-current-branch).
|
|
15
|
+
|
|
16
|
+
- **Open** → continue to Step 2.
|
|
17
|
+
- **None** → run [create-pr.md](create-pr.md) first, then continue.
|
|
18
|
+
- **Closed/merged** → check for new commits since it was closed
|
|
19
|
+
(`git log --oneline origin/<base>..HEAD`); stop if none.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Step 2: Check CI Is Green
|
|
24
|
+
|
|
25
|
+
### GitHub
|
|
26
|
+
```bash
|
|
27
|
+
gh pr checks <number> # all checks
|
|
28
|
+
gh pr checks <number> --required # the merge gate
|
|
29
|
+
```
|
|
30
|
+
Exit codes for `--required`: 0 = all required checks pass; non-zero includes the
|
|
31
|
+
pending case (exit 8). Use `gh pr checks <number> --watch` to wait if the human
|
|
32
|
+
asks for it.
|
|
33
|
+
|
|
34
|
+
`--required` only shows required checks. If the full run shows failing **optional**
|
|
35
|
+
checks (lint, coverage, etc.), warn the human before proceeding — don't silently
|
|
36
|
+
ignore them.
|
|
37
|
+
|
|
38
|
+
### GitLab
|
|
39
|
+
```bash
|
|
40
|
+
glab ci status
|
|
41
|
+
# or
|
|
42
|
+
glab pipeline status
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If any required check is **pending**, offer auto-merge instead of a direct merge:
|
|
46
|
+
`gh pr merge --auto` (GitHub) or `glab mr merge --auto-merge` (GitLab) queues the
|
|
47
|
+
merge to run once checks pass. A bare `gh pr merge` fails while required checks
|
|
48
|
+
are pending — "merge anyway" does not work in that state. Note: `glab mr merge`
|
|
49
|
+
enables auto-merge by default while a pipeline is running.
|
|
50
|
+
|
|
51
|
+
If any required check is **failing**, stop and report the status to the human.
|
|
52
|
+
Don't merge on red. If the human says "merge anyway": on GitHub a forced merge
|
|
53
|
+
requires `--admin` (bypasses branch protection, needs admin rights on the repo) —
|
|
54
|
+
state that implication explicitly before using it. On GitLab, merging on red is
|
|
55
|
+
controlled by project settings — ask the human to fix the pipeline or adjust the
|
|
56
|
+
setting.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Step 3: Confirm Before Merging
|
|
61
|
+
|
|
62
|
+
**Show the human:**
|
|
63
|
+
- PR/MR URL and number/iid
|
|
64
|
+
- CI status (green/red)
|
|
65
|
+
- Merge strategy (squash by default)
|
|
66
|
+
- Whether the source branch will be deleted
|
|
67
|
+
|
|
68
|
+
Ask for explicit confirmation before running the merge command.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Step 4: Merge
|
|
73
|
+
|
|
74
|
+
### GitHub
|
|
75
|
+
```bash
|
|
76
|
+
gh pr merge <number> --squash --delete-branch
|
|
77
|
+
```
|
|
78
|
+
Alternatives: `--rebase`, `--merge`, `--auto` (merge automatically once required
|
|
79
|
+
checks pass), or `--admin` (forced merge — see Step 2) per the human's request.
|
|
80
|
+
|
|
81
|
+
### GitLab
|
|
82
|
+
```bash
|
|
83
|
+
glab mr merge <iid> --squash --remove-source-branch
|
|
84
|
+
```
|
|
85
|
+
Alternatives: `--rebase`, or `--auto-merge` (merge once the pipeline succeeds —
|
|
86
|
+
already the default while a pipeline is running) per the human's request.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Step 5: Report
|
|
91
|
+
|
|
92
|
+
Show the human the merge result — the merge commit SHA, the target branch tip, and
|
|
93
|
+
whether the source branch was deleted. Suggest switching back to the base branch
|
|
94
|
+
locally (`git checkout <base> && git pull`) if the source branch was removed. Done.
|