groove-groovebook-publish
Use $ARGUMENTS as the learning text if provided.
Outcome
A learning from the current project is published to the configured groovebook repo as a pull request, stripped of any project-specific context, ready for community review.
Acceptance Criteria
- Learning is published as a PR to
<groovebook> repo
- PR uses the groovebook PR template format (Summary, Context, Learning, Groove skill area)
- File is written at
learned/<topic>/<YYYY-MM-DD>-<slug>.md in the groovebook repo
- PR URL is printed to the user
Steps
Read groovebook: from .groove/index.md; if absent, exit with:
groovebook is not configured. Add 'groovebook: <owner>/<repo>' to .groove/index.md to enable.
Check gh auth status; if not authenticated, exit with:
Not authenticated with GitHub. Run: gh auth login
Verify the groovebook repo is accessible: gh repo view <groovebook>; if it fails, exit with a clear message.
Get the learning text:
- If $ARGUMENTS is provided, use it as a starting point
- Otherwise: ask "What's the learning you'd like to publish? (paste it or describe briefly)"
- Ask for a one-sentence summary (used as PR title and filename slug)
Show a preview of the learning text and ask:
Does this contain any repo-specific context to redact? (file paths, internal names, product names)
- If yes: help the user redact it — replace specific names with generic descriptions
- If no: proceed
Ask for topic (e.g. patterns, tools, anti-patterns, workflow) and skill area (e.g. compound, plan, review, daily)
Generate slug: lowercase the summary, replace spaces with hyphens, strip special characters, truncate to 40 chars. Construct:
- Branch name:
learning/<YYYY-MM-DD>-<slug>
- File path:
learned/<topic>/<YYYY-MM-DD>-<slug>.md
Fork the groovebook repo if not already forked: gh repo fork <groovebook> --clone=false
- If fork already exists, skip silently
Create the branch and file:
gh api repos/<user-fork>/git/refs to check if branch exists; if so, append a short unique suffix
- Write the file content (see format below) and commit via
gh api
- Or: use
git operations against the fork URL if gh api approach is too complex — prefer the simpler path
Open the PR:
gh pr create --repo <groovebook> \
--title "<one-sentence summary>" \
--body "<formatted body>" \
--head "<fork-user>:<branch-name>"
Print the PR URL
Learning file format
---
date: YYYY-MM-DD
topic: <topic>
skill-area: <skill-area>
source: groovebook-publish
---
# <One-sentence summary>
## Context
<What triggered this learning — what problem were you solving? Generic, no project specifics.>
## Learning
<The insight itself — what to do, what to avoid, or what pattern works.>
## Groove skill area
`<skill-area>` (e.g. `groove-work-compound`, `groove-work-plan`)
PR body format
## Summary
<one-sentence summary>
## Context
<what triggered this>
## Learning
<the insight>
## Groove skill area
`<skill-area>`
---
*Published via groove-groovebook-publish*
Constraints
- Never publish learning text that contains project-specific names, file paths, or internal identifiers without explicit user confirmation that it's intentional
- If the fork step fails due to permissions: suggest the user fork manually and set their fork as the
groovebook: value
- Slug must be safe for use as a filename: lowercase, hyphens only, no path separators or special characters
- If branch already exists: append
-2, -3, etc. until a free name is found
1---
2name: groove-groovebook-publish
3description: "Publish a workflow learning to the groovebook shared commons as a GitHub PR. Use after groove-work-compound when a learning is worth sharing."
4license: MIT
5allowed-tools: Read Write Edit Glob Grep Bash(git:*) Bash(gh:*) AskUserQuestion
6metadata:
7 author: andreadellacorte
8---
9
10# groove-groovebook-publish
11
12Use $ARGUMENTS as the learning text if provided.
13
14## Outcome
15
16A learning from the current project is published to the configured groovebook repo as a pull request, stripped of any project-specific context, ready for community review.
17
18## Acceptance Criteria
19
20- Learning is published as a PR to `<groovebook>` repo
21- PR uses the groovebook PR template format (Summary, Context, Learning, Groove skill area)
22- File is written at `learned/<topic>/<YYYY-MM-DD>-<slug>.md` in the groovebook repo
23- PR URL is printed to the user
24
25## Steps
26
271. Read `groovebook:` from `.groove/index.md`; if absent, exit with:
28 `groovebook is not configured. Add 'groovebook: <owner>/<repo>' to .groove/index.md to enable.`
29
302. Check `gh auth status`; if not authenticated, exit with:
31 `Not authenticated with GitHub. Run: gh auth login`
32
333. Verify the groovebook repo is accessible: `gh repo view <groovebook>`; if it fails, exit with a clear message.
34
354. Get the learning text:
36 - If $ARGUMENTS is provided, use it as a starting point
37 - Otherwise: ask "What's the learning you'd like to publish? (paste it or describe briefly)"
38 - Ask for a one-sentence summary (used as PR title and filename slug)
39
405. Show a preview of the learning text and ask:
41 `Does this contain any repo-specific context to redact? (file paths, internal names, product names)`
42 - If yes: help the user redact it — replace specific names with generic descriptions
43 - If no: proceed
44
456. Ask for topic (e.g. `patterns`, `tools`, `anti-patterns`, `workflow`) and skill area (e.g. `compound`, `plan`, `review`, `daily`)
46
477. Generate slug: lowercase the summary, replace spaces with hyphens, strip special characters, truncate to 40 chars. Construct:
48 - Branch name: `learning/<YYYY-MM-DD>-<slug>`
49 - File path: `learned/<topic>/<YYYY-MM-DD>-<slug>.md`
50
518. Fork the groovebook repo if not already forked: `gh repo fork <groovebook> --clone=false`
52 - If fork already exists, skip silently
53
549. Create the branch and file:
55 - `gh api repos/<user-fork>/git/refs` to check if branch exists; if so, append a short unique suffix
56 - Write the file content (see format below) and commit via `gh api`
57 - Or: use `git` operations against the fork URL if `gh api` approach is too complex — prefer the simpler path
58
5910. Open the PR:
60 ```
61 gh pr create --repo <groovebook> \
62 --title "<one-sentence summary>" \
63 --body "<formatted body>" \
64 --head "<fork-user>:<branch-name>"
65 ```
66
6711. Print the PR URL
68
69## Learning file format
70
71```markdown
72---
73date: YYYY-MM-DD
74topic: <topic>
75skill-area: <skill-area>
76source: groovebook-publish
77---
78
79# <One-sentence summary>
80
81## Context
82
83<What triggered this learning — what problem were you solving? Generic, no project specifics.>
84
85## Learning
86
87<The insight itself — what to do, what to avoid, or what pattern works.>
88
89## Groove skill area
90
91`<skill-area>` (e.g. `groove-work-compound`, `groove-work-plan`)
92```
93
94## PR body format
95
96```
97## Summary
98<one-sentence summary>
99
100## Context
101<what triggered this>
102
103## Learning
104<the insight>
105
106## Groove skill area
107`<skill-area>`
108
109---
110*Published via groove-groovebook-publish*
111```
112
113## Constraints
114
115- Never publish learning text that contains project-specific names, file paths, or internal identifiers without explicit user confirmation that it's intentional
116- If the fork step fails due to permissions: suggest the user fork manually and set their fork as the `groovebook:` value
117- Slug must be safe for use as a filename: lowercase, hyphens only, no path separators or special characters
118- If branch already exists: append `-2`, `-3`, etc. until a free name is found