chore: update README and CHANGELOG with new PR workflow commands#2
Conversation
|
| Filename | Overview |
|---|---|
| lib/pr-message.ts | New module implementing AI PR title/body generation via two parallel model calls (OpenRouter + OpenAI Responses API), with sanitizers, git diff/log context building, gh availability check, and fallbackPrContent when no API key. |
| scripts/cli.ts | Adds case "pr" and extends case "commit" to support cnp pr / commit pr — correctly avoids double push by handling push only inside createPullRequest, and prints a single "done" after the full flow resolving the previously flagged UX bug. |
| test/pr-message.test.ts | New unit tests for cleanTitle and cleanBody — cover quote stripping, first-line extraction, prefix removal, length cap, fence unwrapping, and <think> tag scrubbing; all assertions are correct. |
| README.md | Adds gg cnp pr and gg pr rows to all command tables, updates the -y flag description, and adds a new "How AI pull requests work" section that accurately matches the implementation (including the "commit if dirty" step). |
| CHANGELOG.md | Adds an Unreleased section accurately documenting the new PR workflow commands, AI generation strategy, PR reuse behavior, and the single-done UX fix. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([gg pr / gg cnp pr]) --> B{Dirty working tree?}
B -- Yes --> C[git add . + git commit -m AI msg]
B -- No --> D[Log: nothing to commit]
C --> E[createPullRequest]
D --> E
E --> F{gh available?}
F -- No --> G([die: install gh + auth])
F -- Yes --> H[detectDefaultBase]
H --> I{baseHint provided or -y?}
I -- Yes --> J[Use hint / defaultBase]
I -- No --> K[Prompt user for base branch]
J --> L[git push / push -u origin]
K --> L
L --> M[gh pr list --head branch]
M --> N{Open PR exists?}
N -- Yes --> O([Print existing PR URL + done])
N -- No --> P[generatePrContent: 2x parallel AI calls]
P --> Q[cleanTitle + cleanBody]
Q --> R[gh pr create --base --head --title --body]
R --> S([Print new PR URL + done])
P -- API error / no key --> T[fallbackPrContent from git log]
T --> R
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A([gg pr / gg cnp pr]) --> B{Dirty working tree?}
B -- Yes --> C[git add . + git commit -m AI msg]
B -- No --> D[Log: nothing to commit]
C --> E[createPullRequest]
D --> E
E --> F{gh available?}
F -- No --> G([die: install gh + auth])
F -- Yes --> H[detectDefaultBase]
H --> I{baseHint provided or -y?}
I -- Yes --> J[Use hint / defaultBase]
I -- No --> K[Prompt user for base branch]
J --> L[git push / push -u origin]
K --> L
L --> M[gh pr list --head branch]
M --> N{Open PR exists?}
N -- Yes --> O([Print existing PR URL + done])
N -- No --> P[generatePrContent: 2x parallel AI calls]
P --> Q[cleanTitle + cleanBody]
Q --> R[gh pr create --base --head --title --body]
R --> S([Print new PR URL + done])
P -- API error / no key --> T[fallbackPrContent from git log]
T --> R
Reviews (2): Last reviewed commit: "fix: update PR workflow and AI to reuse ..." | Re-trigger Greptile
Summary