Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Changelog

## 1.0.7 — 2026-07-10
## Unreleased

- Automated release from main.
- **PR workflow:** `gg pr [base]` and `gg cnp pr [base]` — push the current branch, generate an AI title + description from the branch diff, and create a GitHub pull request via `gh`. Prompts for the merge target (base) branch; `-y` skips confirm and uses the default base.
- **PR AI:** title and body are two separate plain-text model calls (no JSON), which is more reliable on smaller models.
- **PR reuse:** if the head branch already has an open PR, push only and print that URL (skip AI create).
- **CLI UX:** `cnp pr` prints a single `done` after the full flow (no early done after commit).

## 1.0.6 — 2026-07-09

Expand Down
51 changes: 48 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ No browser required. No accounts beyond an optional OpenRouter key. Works in any
| You type | What runs |
|----------|-----------|
| `gg cnp` | `git add .` → AI commit → `git push` |
| `gg cnp pr` | commit → push → AI PR title/body → `gh pr create` |
| `gg pr [base]` | commit if dirty → push → AI PR → open PR into `base` (default: main) |
| `gg b feature/login` | new branch → add → commit → `push -u` |
| `gg m feature/login` | commit work → merge into `main` → push |
| `gg s` | commit work → checkout `main` |
Expand All @@ -52,7 +54,8 @@ Messages follow [Conventional Commits](https://www.conventionalcommits.org) (`fe

## Install

**Requirements:** [Node.js 18+](https://nodejs.org) and [Git](https://git-scm.com) on your `PATH`.
**Requirements:** [Node.js 18+](https://nodejs.org) and [Git](https://git-scm.com) on your `PATH`.
For pull requests: [GitHub CLI](https://cli.github.com) (`gh`) authenticated with `gh auth login`.

```bash
npm install -g git-command-generator
Expand Down Expand Up @@ -121,6 +124,11 @@ All of these work with **`gg`**, **`gitgen`**, or **`git-gen`**.
| `gg c` | `gg commit` | Stage all → commit (no push) |
| `gg c p` | `gg commit push` | Stage all → commit → push |
| `gg cnp` | `gg commit-and-push` | Same as commit + push (one token) |
| `gg cnp pr` | `gg commit-and-push pr` | Commit → push → AI PR title/body → create PR (asks base) |
| `gg cnp pr develop` | same | Same, base branch = `develop` (no prompt for base) |
| `gg pr` | `gg pr` | Commit if dirty → push → AI PR → `gh pr create` (asks base) |
| `gg pr main` | `gg pr main` | Same, merge target = `main` |
| `gg pr -y` | `gg pr -y` | PR into default base (no base prompt) |
| `gg b <name>` | `gg branch <name>` | Create branch → add → commit → `push -u origin <name>` |
| `gg m <src> [dst]` | `gg merge <src> [dst]` | Commit → checkout `dst` (default `main`) → merge `src` → push |
| `gg s` | `gg save` | Commit current work → checkout `main` |
Expand Down Expand Up @@ -151,7 +159,7 @@ All of these work with **`gg`**, **`gitgen`**, or **`git-gen`**.
| Flag | Commands | Effect |
|------|----------|--------|
| `-m "msg"` / `--message "msg"` | Any command that commits | Use this message instead of AI / default |
| `-y` / `--yes` | `restore` / `rs` | Skip the destructive confirmation |
| `-y` / `--yes` | `restore` / `rs` / `pr` | Skip restore confirm; on PR, use default base without prompting |
| `-v` / `-V` / `--version` | — | Same as `version` |
| `-h` / `--help` | — | Same as `help` |

Expand Down Expand Up @@ -226,12 +234,21 @@ gg c
# Explicit message (no AI)
gg c p -m "chore: bump dependencies"

# Feature branch end-to-end
# Feature branch end-to-end (merge locally)
gg b feature/checkout
# …work…
gg cnp
gg m feature/checkout # merge into main and push

# Feature branch → open a GitHub PR instead of merging locally
gg b feature/checkout
# …work…
gg cnp pr # commit + push + PR (asks which base branch)
# or, after work is already committed:
gg pr # asks base (default: main / origin HEAD)
gg pr develop # PR into develop
gg pr -y # default base, no base prompt

# Merge into a non-main branch
gg m feature/checkout develop

Expand Down Expand Up @@ -280,6 +297,34 @@ First AI use without a key launches the setup wizard automatically.

---

## How AI pull requests work

`gg pr` / `gg cnp pr` need the [GitHub CLI](https://cli.github.com) on your PATH and a logged-in account:

```bash
gh auth login
```

Flow:

1. Commit dirty work (if any) with the same AI commit rules as `cnp`
2. `git push` (or `push -u origin <branch>` when there is no upstream)
3. Ask for the **base branch** (merge target) — default is `origin/HEAD`, else `main` / `master`
4. Two OpenRouter calls on the same commit log + diff: one for the **title** (one line), one for the markdown **body** (no JSON)
5. If this head branch **already has an open PR**, skip create — print that URL (push already updated it)
6. Otherwise: show title/body preview and create immediately via `gh pr create`, then print the URL

Without an API key, title/body fall back to the latest commit subject and the commit list.

| Command | Notes |
|---------|--------|
| `gg cnp pr` | Full path: stage → commit → push → PR |
| `gg pr` | PR from current branch (commits first if dirty) |
| `gg pr develop` | Base = `develop` (no base prompt) |
| `gg pr -y` | Default base, no base prompt (creates immediately either way) |

---

## Optional web UI

The package is **CLI-first**. There is also a local Next.js UI if you clone the full repo.
Expand Down
Loading
Loading