groove-groovebook-publish
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesegroove-groovebook-publish
groove-groovebook-publish
Use $ARGUMENTS as the learning text if provided.
如果提供了$ARGUMENTS,则将其用作经验文本。
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.
当前项目的经验会以拉取请求的形式发布到已配置的groovebook仓库,所有项目专属上下文都会被移除,可供社区评审。
Acceptance Criteria
验收标准
- Learning is published as a PR to repo
<groovebook> - PR uses the groovebook PR template format (Summary, Context, Learning, Groove skill area)
- File is written at in the groovebook repo
learned/<topic>/<YYYY-MM-DD>-<slug>.md - PR URL is printed to the user
- 经验作为PR发布到仓库
<groovebook> - PR遵循groovebook PR模板格式(摘要、上下文、经验、Groove技能领域)
- 文件写入groovebook仓库的路径下
learned/<topic>/<YYYY-MM-DD>-<slug>.md - 向用户打印输出PR URL
Steps
操作步骤
-
Readfrom
groovebook:; if absent, exit with:.groove/index.mdgroovebook is not configured. Add 'groovebook: <owner>/<repo>' to .groove/index.md to enable. -
Check; if not authenticated, exit with:
gh auth statusNot authenticated with GitHub. Run: gh auth login -
Verify the groovebook repo is accessible:; if it fails, exit with a clear message.
gh repo view <groovebook> -
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) and skill area (e.g.workflow,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
- Branch name:
-
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:
- to check if branch exists; if so, append a short unique suffix
gh api repos/<user-fork>/git/refs - Write the file content (see format below) and commit via
gh api - Or: use operations against the fork URL if
gitapproach is too complex — prefer the simpler pathgh api
-
Open the PR:
gh pr create --repo <groovebook> \ --title "<one-sentence summary>" \ --body "<formatted body>" \ --head "<fork-user>:<branch-name>" -
Print the PR URL
-
读取中的
.groove/index.md配置;如果不存在,退出并提示:groovebook:groovebook is not configured. Add 'groovebook: <owner>/<repo>' to .groove/index.md to enable. -
检查;如果未认证,退出并提示:
gh auth statusNot authenticated with GitHub. Run: gh auth login -
验证groovebook仓库可访问:;如果失败,输出清晰的错误提示后退出。
gh repo view <groovebook> -
获取经验文本:
- 如果提供了$ARGUMENTS,将其作为初始内容
- 否则询问用户:"你想要发布的经验是什么?(可以粘贴内容或者简要描述)"
- 向用户索要一句话摘要(用作PR标题和文件名slug)
-
预览经验文本并询问用户:
这份内容里有没有需要脱敏的仓库专属上下文?(比如文件路径、内部名称、产品名称)- 如果有:协助用户完成脱敏,将特定名称替换为通用描述
- 如果没有:继续后续步骤
-
询问用户主题(例如、
patterns、tools、anti-patterns)和技能领域(例如workflow、compound、plan、review)daily -
生成slug:将摘要转为小写,空格替换为连字符,移除特殊字符,截断到40个字符。构造:
- 分支名:
learning/<YYYY-MM-DD>-<slug> - 文件路径:
learned/<topic>/<YYYY-MM-DD>-<slug>.md
- 分支名:
-
如果还未fork groobook仓库则执行fork操作:
gh repo fork <groovebook> --clone=false- 如果已经fork过,静默跳过该步骤
-
创建分支和文件:
- 调用检查分支是否存在;如果存在,追加一个简短的唯一后缀
gh api repos/<user-fork>/git/refs - 写入文件内容(参考下方格式)并通过提交
gh api - 或者:如果方式太复杂,可以针对fork仓库URL执行
gh api操作,优先选择更简单的实现方式git
- 调用
-
提交PR:
gh pr create --repo <groovebook> \ --title "<one-sentence summary>" \ --body "<formatted body>" \ --head "<fork-user>:<branch-name>" -
打印输出PR URL
Learning file format
经验文件格式
markdown
---
date: YYYY-MM-DD
topic: <topic>
skill-area: <skill-area>
source: groovebook-publish
---markdown
---
date: YYYY-MM-DD
topic: <topic>
skill-area: <skill-area>
source: groovebook-publish
---<One-sentence summary>
<One-sentence summary>
Context
Context
<What triggered this learning — what problem were you solving? Generic, no project specifics.>
<What triggered this learning — what problem were you solving? Generic, no project specifics.>
Learning
Learning
<The insight itself — what to do, what to avoid, or what pattern works.>
<The insight itself — what to do, what to avoid, or what pattern works.>
Groove skill area
Groove skill area
<skill-area>groove-work-compoundgroove-work-planundefined<skill-area>groove-work-compoundgroove-work-planundefinedPR body format
PR正文格式
undefinedundefinedSummary
Summary
<one-sentence summary>
<one-sentence summary>
Context
Context
<what triggered this>
<what triggered this>
Learning
Learning
<the insight>
<the insight>
Groove skill area
Groove skill area
<skill-area>Published via groove-groovebook-publish
undefined<skill-area>Published via groove-groovebook-publish
undefinedConstraints
约束条件
- 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 value
groovebook: - Slug must be safe for use as a filename: lowercase, hyphens only, no path separators or special characters
- If branch already exists: append ,
-2, etc. until a free name is found-3
- 没有用户明确确认是故意发布的情况下,绝对不能发布包含项目专属名称、文件路径或内部标识符的经验文本
- 如果fork步骤因权限失败:建议用户手动fork仓库,并将他们的fork仓库地址设置为的配置值
groovebook: - Slug必须符合文件名安全规范:仅小写、仅使用连字符、无路径分隔符或特殊字符
- 如果分支已存在:追加、
-2等后缀直到找到可用的名称-3