@senad-d/branchme 0.1.5 → 0.1.7

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/.env.example CHANGED
@@ -1,5 +1,9 @@
1
1
  # BranchMe GitHub token template.
2
- # Copy this file to .env only when you need pull_request support.
3
- # Keep committed placeholders empty; put real tokens only in your local .env file.
2
+ # Copy this file to .env only when you need pull_request support or PR field autofill.
3
+ # Keep committed token placeholders empty; put real tokens only in your local .env file.
4
4
  GITHUB_TOKEN=
5
5
  GH_TOKEN=
6
+
7
+ # Optional: allow pull_request to fill omitted branches, title, body, and draft.
8
+ # Explicit values always win. Disabled by default.
9
+ BRANCHME_PR_AUTOFILL=false
package/CHANGELOG.md CHANGED
@@ -3,9 +3,10 @@
3
3
  ## 0.1.0 - Unreleased
4
4
 
5
5
  - Implemented the `branchme` informational slash command with help aliases.
6
- - Added strict BranchMe tools: `branch_status`, `change_branch`, `pull_branch`, `create_branch`, `push_branch`, and `pull_request`.
7
- - Added argv-style git helpers for repository status, branch validation/creation/switching, clean-worktree preflight, upstream detection, fast-forward-only current-branch pull, and current-branch push/publish.
6
+ - Added strict BranchMe tools: `branch_status`, `change_branch`, `fetch_branch`, `pull_branch`, `rebase_branch`, `create_branch`, `push_branch`, and `pull_request`.
7
+ - Added argv-style git helpers for repository status, branch validation/creation/switching, clean-worktree preflight, upstream detection, configured-upstream fetch, fast-forward-only current-branch pull, current-branch rebase with automatic abort on failure, and current-branch push/publish.
8
8
  - Added GitHub repository resolution, environment-token and local `.env` token fallback handling, REST pull request creation, response validation, and token redaction.
9
+ - Added opt-in `BRANCHME_PR_AUTOFILL` support for omitted PR fields, including current/default branch inference, bounded, Markdown-safe, and token-redacted title/body generation from commit subjects, and a non-draft default.
9
10
  - Added bounded automatic Git context before each agent run with branch/upstream state, working-tree counts and unstaged paths, authenticated related-open-PR lookup, and recent commits.
10
11
  - Expanded `branch_status` into a shared, explicit, read-only context refresh for state that may change during a run.
11
12
  - Added unit tests with mocked `pi.exec` and `fetch` for Git context collection and prompt safety, git helpers, GitHub helpers, command behavior, tool schemas, prompt metadata, and extension registration.
package/README.md CHANGED
@@ -11,12 +11,12 @@
11
11
 
12
12
  <p align="center">
13
13
  Current-repository branch and pull request tools for <a href="https://pi.dev">pi</a>.
14
- <br />Inspect branch state, switch/create/update branches, push, and open GitHub PRs from pi prompts.
14
+ <br />Inspect branch state, fetch, switch/create/pull/rebase branches, push, and open GitHub PRs from pi prompts.
15
15
  </p>
16
16
 
17
17
  ---
18
18
 
19
- BranchMe is a Pi extension for safe branch workflow automation. Before each agent run, it appends a bounded, read-only snapshot of the current Git repository to the system prompt. It also adds an informational `/branchme` command and six agent-callable tools that explicitly refresh state, switch to an existing local branch, fast-forward the clean current branch from its upstream, create a branch from the current `HEAD`, push the current branch, and create a GitHub pull request.
19
+ BranchMe is a Pi extension for safe branch workflow automation. Before each agent run, it appends a bounded, read-only snapshot of the current Git repository to the system prompt. It also adds an informational `/branchme` command and eight agent-callable tools that explicitly refresh state, switch to an existing local branch, fetch its configured upstream remote, fast-forward or rebase the clean current branch onto its upstream, create a branch from the current `HEAD`, push the current branch, and create a GitHub pull request.
20
20
 
21
21
  <table align="center">
22
22
  <tr>
@@ -30,12 +30,13 @@ BranchMe is a Pi extension for safe branch workflow automation. Before each agen
30
30
  </table>
31
31
 
32
32
  - **Context-aware:** every agent run starts with bounded branch, working-tree, related-PR, and recent-commit metadata; repository metadata is untrusted data, not instructions.
33
- - **Current-repository only:** Git and GitHub operations are scoped to the checkout where pi is running; `pull_branch` updates only the clean current branch from its configured upstream.
34
- - **Commit-safe:** context collection is read-only, and BranchMe never stages files, creates commits, generates commit messages, rebases, creates merge commits, resets, or edits files directly.
33
+ - **Current-repository only:** Git and GitHub operations are scoped to the checkout where pi is running; fetch, pull, and rebase resolve the current branch's configured upstream.
34
+ - **Explicit history rewrites:** `rebase_branch` runs only when explicitly requested, requires a clean current branch with an upstream, disables autostash and multi-ref updates, and automatically attempts to abort on failure.
35
+ - **Commit-safe:** context collection is read-only, and BranchMe never stages files, creates user-authored commits, generates commit messages, force-pushes, creates merge commits, resets, or edits files directly.
35
36
  - **Strict tools:** tool schemas reject extra properties such as `force`, `stash`, `discard`, `owner`, `repo`, `path`, or `baseRef`.
36
- - **PR-ready:** create GitHub pull requests from existing local branches after verifying the `headBranch` matches GitHub and the base is visible, with explicit PR fields and `GITHUB_TOKEN` or `GH_TOKEN` from the process environment or a local `.env` fallback.
37
+ - **PR-ready:** create GitHub pull requests from existing local branches after verifying the `headBranch` matches GitHub and the base is visible. PR fields can stay explicit, or configured autofill can derive omitted fields from the current branch, default branch, and commit subjects.
37
38
 
38
- > **Security:** pi packages run with your full system permissions. BranchMe runs local `git` commands, may make an automatic authenticated GitHub request to find a related open pull request, can switch/create branches and push the current branch, and can create GitHub pull requests. Read [`SECURITY.md`](SECURITY.md).
39
+ > **Security:** pi packages run with your full system permissions. BranchMe runs local `git` commands, may make an automatic authenticated GitHub request to find a related open pull request, can fetch remotes, switch/create/pull/rebase branches, push the current branch, and create GitHub pull requests. Read [`SECURITY.md`](SECURITY.md).
39
40
 
40
41
  ## Table of Contents
41
42
 
@@ -88,7 +89,9 @@ A typical BranchMe flow is:
88
89
  7. Push the current branch with `push_branch`.
89
90
  8. After `push_branch` completes and GitHub can see the branches, create a pull request with `pull_request`.
90
91
 
91
- BranchMe is tool-based. The slash command is informational only and never changes or updates branches, pushes, commits, stages, edits files, or opens pull requests.
92
+ To refresh the current branch's configured remote-tracking ref without changing the local branch or working tree, use `fetch_branch`. To reconcile the clean current branch by rewriting its local commits, run `fetch_branch`, wait for it to complete, and then run `rebase_branch`. Both tools require a configured upstream; `rebase_branch` automatically attempts `git rebase --abort` if rebasing fails.
93
+
94
+ BranchMe is tool-based. The slash command is informational only and never changes or updates branches, fetches, rebases, pushes, commits, stages, edits files, or opens pull requests.
92
95
 
93
96
  ---
94
97
 
@@ -150,15 +153,16 @@ export GH_TOKEN=ghp_...
150
153
  pi
151
154
  ```
152
155
 
153
- Or copy `.env.example` to `.env` in the repository root and fill in one token value:
156
+ Or copy `.env.example` to `.env` in the repository root, fill in one token value, and optionally enable PR field autofill:
154
157
 
155
158
  ```bash
156
159
  cp .env.example .env
157
160
  $EDITOR .env
161
+ # Set BRANCHME_PR_AUTOFILL=true in .env if desired.
158
162
  pi
159
163
  ```
160
164
 
161
- `pull_branch` and `push_branch` use your normal Git remote credentials. BranchMe does not inject `GITHUB_TOKEN` into `git pull` or `git push`.
165
+ `fetch_branch`, `pull_branch`, and `push_branch` use your normal Git remote credentials. BranchMe does not inject `GITHUB_TOKEN` into `git fetch`, `git pull`, or `git push`. `rebase_branch` operates on the locally available configured upstream ref and makes no network request itself.
162
166
  When the current branch already has an upstream, BranchMe pushes an explicit `HEAD:<upstream-branch-ref>` refspec to the configured upstream remote instead of relying on a bare `git push`.
163
167
  Run `pull_request` only after `push_branch` has completed; `pull_request` preflights the GitHub `headBranch` and `baseBranch` before creating the PR and fails with retry guidance if a branch is not visible yet or the GitHub `headBranch` commit does not match the local branch.
164
168
 
@@ -166,15 +170,26 @@ Run `pull_request` only after `push_branch` has completed; `pull_request` prefli
166
170
 
167
171
  ## Configuration
168
172
 
169
- BranchMe has no project config file. It reads process environment variables for automatic related-PR lookup, GitHub pull request creation, and optional repository boundary checks, with a local `.env` token fallback when no process token is set. Token lookup checks `process.env.GITHUB_TOKEN`, then `process.env.GH_TOKEN`; if neither is set, BranchMe reads `.env` from the verified git root and checks `GITHUB_TOKEN`, then `GH_TOKEN`.
173
+ BranchMe has no separate project config file. It reads process environment variables and supported keys from a local `.env` file in the verified git root. Token lookup checks `process.env.GITHUB_TOKEN`, then `process.env.GH_TOKEN`; if neither is set, BranchMe checks the matching `.env` keys. Pull request field autofill checks `BRANCHME_PR_AUTOFILL` in the process environment first, then `.env`, and defaults to disabled.
170
174
 
171
175
  | Variable | Meaning |
172
176
  | --- | --- |
173
177
  | `GITHUB_TOKEN` | Preferred token for automatic related-PR lookup and `pull_request`; process environment first, then local `.env` fallback. |
174
178
  | `GH_TOKEN` | Fallback token for automatic related-PR lookup and `pull_request`; process environment first, then local `.env` fallback. |
179
+ | `BRANCHME_PR_AUTOFILL=true` | Allow `pull_request` to fill omitted PR fields. Accepts `true`/`false`, `1`/`0`, `yes`/`no`, or `on`/`off`; disabled by default. |
175
180
  | `GITHUB_REPOSITORY=owner/repo` | Optional CI fallback and boundary check for the current GitHub repository; process environment only. |
176
181
 
177
- BranchMe reads only `GITHUB_TOKEN` and `GH_TOKEN` from a small regular `.env` file; it rejects directories, symlinks, special files, and oversized files. BranchMe does not import other `.env` keys, read shell profiles, GitHub CLI credentials, or local credential stores. Token values are redacted from automatic context, errors, tool content, and tool details.
182
+ BranchMe reads only `GITHUB_TOKEN`, `GH_TOKEN`, and `BRANCHME_PR_AUTOFILL` from a small regular `.env` file; it rejects directories, symlinks, special files, and oversized files. BranchMe does not import other `.env` keys, read shell profiles, GitHub CLI credentials, or local credential stores. Token values are redacted from automatic context, errors, tool content, and tool details.
183
+
184
+ With autofill enabled, omitted fields are resolved as follows:
185
+
186
+ - `headBranch`: current local branch.
187
+ - `baseBranch`: the branch named by `origin/HEAD` when it exists locally, falling back to an existing local `main`, `master`, `trunk`, or `develop` branch.
188
+ - `title`: first commit subject in `baseBranch..headBranch`, falling back to a title derived from the head branch name.
189
+ - `body`: a bounded Markdown summary of commit subjects in `baseBranch..headBranch`.
190
+ - `draft`: `false`.
191
+
192
+ Explicit tool arguments always take precedence. Autofill does not create a PR by itself: the user must still ask the agent to create one.
178
193
 
179
194
  If local `origin` and `GITHUB_REPOSITORY` both resolve but disagree, `pull_request` fails closed.
180
195
 
@@ -199,12 +214,14 @@ Commands are informational only. BranchMe actions are performed by agent-callabl
199
214
  | --- | --- | --- |
200
215
  | `branch_status` | `{}` | Explicitly refreshes the same bounded context used at agent start: repo root in structured details, branch/detached state, upstream and ahead/behind counts, working-tree counts and unstaged/untracked paths, related open PR, and recent commits. It is read-only. |
201
216
  | `change_branch` | `{ "branchName": string }` | Validates `branchName`, requires `refs/heads/<branchName>` to exist locally, rejects dirty worktrees, and runs `git switch <branchName>`. |
217
+ | `fetch_branch` | `{}` | Requires a current branch with a configured upstream and runs `git fetch --no-tags --no-recurse-submodules <upstream-remote> <upstream-branch-ref>:<remote-tracking-ref>`; only that tracking ref is refreshed without changing local branches or working-tree files. |
202
218
  | `pull_branch` | `{}` | Requires a clean current branch with a configured upstream and runs `git pull --ff-only --no-rebase --no-autostash <upstream-remote> <upstream-branch-ref>`; divergence fails without rebasing or creating a merge commit. |
219
+ | `rebase_branch` | `{}` | Requires a clean current branch with a configured upstream and runs `git rebase --no-autostash --no-update-refs <upstream>`; it rewrites local commits and automatically attempts `git rebase --abort` on failure. |
203
220
  | `create_branch` | `{ "branchName": string }` | Validates `branchName`, rejects existing local branches, and runs `git switch -c <branchName>` from current `HEAD`. |
204
221
  | `push_branch` | `{}` | Pushes the current branch to its configured upstream remote with an explicit `HEAD:<upstream-branch-ref>` refspec, or publishes it with `git push --set-upstream origin <currentBranch>` when no upstream exists. |
205
- | `pull_request` | `{ "headBranch": string, "baseBranch": string, "title": string, "body": string, "draft": boolean }` | Preflights GitHub branch visibility and verifies the GitHub `headBranch` commit matches the local branch, then creates a pull request in the resolved current repository via `POST /repos/{owner}/{repo}/pulls`; branch refs must exist locally and cannot use `owner:branch`. |
222
+ | `pull_request` | `{ "headBranch"?: string, "baseBranch"?: string, "title"?: string, "body"?: string, "draft"?: boolean }` | Preflights GitHub branch visibility and verifies the GitHub `headBranch` commit matches the local branch, then creates a pull request in the resolved current repository. Omitted fields require `BRANCHME_PR_AUTOFILL=true`; branch refs must be distinct, exist locally, and cannot use `owner:branch`. |
206
223
 
207
- All schemas reject additional properties. `change_branch` never accepts `baseRef`, `force`, `stash`, `discard`, `create`, `owner`, `repo`, or path inputs. `pull_branch` has a strict empty schema and never accepts a branch, remote, force, or rebase option. `pull_request` never accepts `owner`, `repo`, or owner-prefixed branch refs; BranchMe resolves the repository from local `origin` and/or matching `GITHUB_REPOSITORY`.
224
+ All schemas reject additional properties. `change_branch` never accepts `baseRef`, `force`, `stash`, `discard`, `create`, `owner`, `repo`, or path inputs. `fetch_branch`, `pull_branch`, and `rebase_branch` have strict empty schemas and never accept a branch, remote, refspec, force, autostash, or arbitrary rebase target. `pull_request` never accepts `owner`, `repo`, or owner-prefixed branch refs; BranchMe resolves the repository from local `origin` and/or matching `GITHUB_REPOSITORY`.
208
225
 
209
226
  ---
210
227
 
@@ -218,11 +235,12 @@ Before each agent run, BranchMe appends an **Automatic Git Context** snapshot to
218
235
  - working-tree state and staged, unstaged, and untracked counts;
219
236
  - up to 20 unstaged or untracked change entries with Git status, path, and original path for renames/copies;
220
237
  - related open PR status and, when found, its number, title, repository, head/base branches, URL, state, and draft flag;
238
+ - whether pull request field autofill is enabled;
221
239
  - up to 5 recent commits with short hash, date, and subject.
222
240
 
223
241
  Collection defaults are a 5-second timeout per local Git command, a 4-second related-PR lookup timeout, at most 512 characters per metadata value, and at most 4,000 characters for the rendered snapshot. GitHub response bodies are limited to 64 KiB. The formatter can further shorten values or omit entries to stay within the total limit.
224
242
 
225
- The snapshot is fresh at agent start but is not live. A branch switch, pull, commit, file change, push, or other mutation later in the same run can make it stale. `branch_status` performs an explicit current-state refresh through the same shared collector and remains read-only; it does not mutate files, Git state, or GitHub state.
243
+ The snapshot is fresh at agent start but is not live. A fetch, branch switch, pull, rebase, commit, file change, push, or other mutation later in the same run can make it stale. `branch_status` performs an explicit current-state refresh through the same shared collector and remains read-only; it does not mutate files, Git state, or GitHub state.
226
244
 
227
245
  Related-PR metadata does not come from Git alone. When repository, branch, and credentials resolve, automatic collection and explicit `branch_status` may make an authenticated `GET /repos/{owner}/{repo}/pulls?state=open&head={owner}:{branch}&per_page=1` request. Without a token there is no unauthenticated fallback or GitHub request; the PR field is reported as unavailable while local Git context remains usable.
228
246
 
@@ -233,9 +251,11 @@ Use BranchMe from pi prompts or automation that drives pi with explicit tool cal
233
251
  ```text
234
252
  Use branch_status.
235
253
  Switch to the base branch with change_branch, then use pull_branch after the switch completes.
254
+ Fetch the current branch upstream with fetch_branch, wait for it to complete, then rebase with rebase_branch.
236
255
  Create branch feature/docs-refresh from the updated current HEAD with create_branch.
237
256
  Push the current branch with push_branch.
238
257
  After push_branch completes, create a draft pull request from feature/docs-refresh to main titled "Refresh docs" with this body: "...".
258
+ If pull request field autofill is enabled, after push_branch completes create a pull request and fill any details I did not provide.
239
259
  ```
240
260
 
241
261
  BranchMe operates only on the repository where pi is running:
@@ -243,13 +263,15 @@ BranchMe operates only on the repository where pi is running:
243
263
  - Automatic collection and `branch_status` run bounded, read-only Git commands from the verified git root.
244
264
  - Git commands use `pi.exec("git", args, { cwd, signal, timeout })` with argv arrays; repository mutations run from the verified git root.
245
265
  - `change_branch` switches only to existing local branches and has no `force`, `stash`, `discard`, remote, or path input.
266
+ - `fetch_branch` requires a configured upstream, uses an explicit source-to-remote-tracking refspec with tags and submodule recursion disabled, and does not change local branches or working-tree files.
246
267
  - `pull_branch` requires a clean worktree and configured upstream, updates only the current branch with `git pull --ff-only --no-rebase --no-autostash`, and has no branch, remote, force, or rebase input.
268
+ - `rebase_branch` requires a clean worktree and configured upstream, rewrites only the current branch onto the locally available upstream with autostash and multi-ref updates disabled, and automatically attempts to abort on failure.
247
269
  - `create_branch` creates from the current `HEAD` only and has no `baseRef` input.
248
270
  - `push_branch` pushes only the current branch, uses no bare upstream `git push`, and has no `branchName` input.
249
- - `pull_request` creates PRs only for the resolved current GitHub repository, requires `headBranch` and `baseBranch` to exist locally, requires the GitHub `headBranch` commit to match the local branch, queues behind in-flight same-repository git mutation windows when possible, and rejects `owner:branch` head refs.
271
+ - `pull_request` creates PRs only for the resolved current GitHub repository, requires resolved `headBranch` and `baseBranch` values to be distinct and exist locally, requires the GitHub `headBranch` commit to match the local branch, queues behind in-flight same-repository git mutation windows when possible, and rejects `owner:branch` head refs. Missing PR fields fail unless `BRANCHME_PR_AUTOFILL=true`.
250
272
  - If local `origin` and `GITHUB_REPOSITORY` both resolve but disagree, `pull_request` fails closed.
251
273
 
252
- BranchMe intentionally does **not** stage files, create commits, force checkout, stash changes, discard changes, edit files directly, or generate commit messages.
274
+ BranchMe intentionally does **not** stage files, create user-authored commits, force checkout, stash changes, discard changes, force-push, create merge commits, edit files directly, or generate commit messages. Rebase-driven commit rewriting occurs only through explicit `rebase_branch` calls.
253
275
 
254
276
  ---
255
277
 
@@ -292,15 +314,18 @@ Ensure the token and Git credentials have permission for the branch and pull req
292
314
  | Problem | Try |
293
315
  | --- | --- |
294
316
  | Not a git repository | Start pi from inside a git checkout. |
295
- | Detached `HEAD` | Use `change_branch` to switch to an existing local branch, or checkout a branch before `pull_branch`, `create_branch`, or `push_branch`. |
317
+ | Detached `HEAD` | Use `change_branch` to switch to an existing local branch, or checkout a branch before `fetch_branch`, `pull_branch`, `rebase_branch`, `create_branch`, or `push_branch`. |
296
318
  | Branch already exists | Choose a new local branch name for `create_branch`, or use `change_branch` to switch to it. |
297
319
  | Branch does not exist locally | Create a local branch first; `change_branch` does not checkout remote branches. |
298
- | Dirty worktree before branch switch or pull | Commit, stash, or discard changes outside BranchMe before using `change_branch` or `pull_branch`. |
299
- | Pull has no upstream | Configure the current branch upstream outside BranchMe, then retry `pull_branch`. |
300
- | Pull is not a fast-forward | Reconcile the divergent branch outside BranchMe; `pull_branch` never rebases, force-updates, or creates a merge commit. |
320
+ | Dirty worktree before branch switch, pull, or rebase | Commit, stash, or discard changes outside BranchMe before using `change_branch`, `pull_branch`, or `rebase_branch`. |
321
+ | Fetch, pull, or rebase has no upstream | Configure the current branch upstream outside BranchMe, then retry the tool. |
322
+ | Pull is not a fast-forward | Run `fetch_branch`, wait for it to complete, then explicitly run `rebase_branch` if rewriting local commits is intended; otherwise reconcile outside BranchMe. |
323
+ | Rebase fails or conflicts | `rebase_branch` automatically attempts `git rebase --abort`. Inspect repository state before continuing if automatic cleanup also fails. |
301
324
  | Push fails | Confirm the current branch is correct and your normal Git remote credentials can push. |
302
325
  | Related PR is unavailable | Set `GITHUB_TOKEN` or `GH_TOKEN` before starting pi if related-PR context is wanted. Without a token, BranchMe keeps local context and intentionally makes no unauthenticated GitHub request. |
303
326
  | PR auth fails | Set `GITHUB_TOKEN` or `GH_TOKEN` before starting pi, or copy `.env.example` to `.env` and fill in one token. |
327
+ | Missing PR fields | Provide all five fields, or set `BRANCHME_PR_AUTOFILL=true` in the process environment or repository `.env`. |
328
+ | Autofill cannot infer the base | Ensure `origin/HEAD` names an existing local branch, keep a local `main`, `master`, `trunk`, or `develop` branch, or provide `baseBranch` explicitly. |
304
329
  | PR branch does not exist locally | Create or fetch/check out the local `headBranch` and `baseBranch` branches first; BranchMe does not use remote-only or cross-repository PR refs. |
305
330
  | PR branch is not visible or is stale on GitHub | Run `push_branch`, wait for it to complete, then retry `pull_request`; do not batch `push_branch` and `pull_request` in the same assistant tool call. |
306
331
  | Repository mismatch | Make `origin` and `GITHUB_REPOSITORY` refer to the same `owner/repo`. |
@@ -319,7 +344,7 @@ npm run check:pack
319
344
  printf '/branchme help\n/quit\n' | pi --no-extensions -e .
320
345
  ```
321
346
 
322
- Validation covers TypeScript typechecking, formatting checks, automatic context collection and prompt injection, mocked GitHub lookup, unit tests, package checks, checkout Pi runtime smoke, and package-content verification. The checkout smoke loads BranchMe through Pi, then uses a temporary verifier command to confirm all six BranchMe tools are visible through `pi.getAllTools()` with strict schemas and prompt metadata. Smoke-test notes are recorded in [`docs/SMOKE_TEST.md`](docs/SMOKE_TEST.md), and TUI/help captures are stored in [`docs/TUI_CAPTURE.md`](docs/TUI_CAPTURE.md).
347
+ Validation covers TypeScript typechecking, formatting checks, automatic context collection and prompt injection, mocked GitHub lookup, unit tests, package checks, checkout Pi runtime smoke, and package-content verification. The checkout smoke loads BranchMe through Pi, then uses a temporary verifier command to confirm all eight BranchMe tools are visible through `pi.getAllTools()` with strict schemas and prompt metadata. Smoke-test notes are recorded in [`docs/SMOKE_TEST.md`](docs/SMOKE_TEST.md), and TUI/help captures are stored in [`docs/TUI_CAPTURE.md`](docs/TUI_CAPTURE.md).
323
348
 
324
349
  Refresh TUI captures intentionally with:
325
350
 
package/SECURITY.md CHANGED
@@ -17,16 +17,18 @@ Implemented git mutations are limited to:
17
17
 
18
18
  - `change_branch`: `git switch <branchName>` after branch-name validation, local `refs/heads/<branchName>` verification, and clean-worktree preflight.
19
19
  - `create_branch`: `git switch -c <branchName>` from current `HEAD` after branch-name validation and existing-branch checks.
20
+ - `fetch_branch`: `git fetch --no-tags --no-recurse-submodules <upstreamRemote> <upstreamBranchRef>:<remoteTrackingRef>` after validating the current branch's configured upstream target. The explicit destination is limited to that upstream's remote-tracking ref, so local branches and working-tree files are not changed.
20
21
  - `pull_branch`: `git pull --ff-only --no-rebase --no-autostash <upstreamRemote> <upstreamBranchRef>` for the clean current branch after validating its configured upstream target.
22
+ - `rebase_branch`: `git rebase --no-autostash --no-update-refs <upstream>` for the clean current branch after validating its configured upstream target. It rewrites local commits and automatically attempts `git rebase --abort` without the cancelled caller signal if the rebase fails or is killed.
21
23
  - `push_branch`: `git push <upstreamRemote> HEAD:<upstreamBranchRef>` for the current branch when an upstream exists, or `git push --set-upstream origin <currentBranch>` when no upstream exists.
22
24
 
23
- Before each agent run, BranchMe also runs bounded, read-only Git commands to collect branch/upstream/ahead-behind state, working-tree counts, up to 20 unstaged or untracked path entries, and up to 5 recent commits. The same collector runs when `branch_status` explicitly refreshes context. Collection does not run `switch`, `push`, `add`, `commit`, or any other mutation, and it never reads diffs or file contents.
25
+ Before each agent run, BranchMe also runs bounded, read-only Git commands to collect branch/upstream/ahead-behind state, working-tree counts, up to 20 unstaged or untracked path entries, and up to 5 recent commits. The same collector runs when `branch_status` explicitly refreshes context. Collection does not run `fetch`, `switch`, `pull`, `rebase`, `push`, `add`, `commit`, or any other mutation, and it never reads diffs or file contents.
24
26
 
25
- Branch switching and fast-forward pulls can update working-tree files as normal Git behavior. Mutating branch operations for the same repository are serialized to avoid same-turn branch races. `pull_request` also uses the same repository queue around PR preflight and creation so it can wait behind an already-started same-repository mutation. BranchMe rejects dirty worktrees before `change_branch` and `pull_branch`. It does not force checkout, stash, stage files, create commits, reset, rebase, create merge commits, or edit files directly.
27
+ Branch switching, fast-forward pulls, and successful rebases can update working-tree files as normal Git behavior; fetch updates one validated remote-tracking ref without changing local branches or the working tree. Mutating branch operations for the same repository are serialized to avoid same-turn branch races. `pull_request` also uses the same repository queue around PR preflight and creation so it can wait behind an already-started same-repository mutation. BranchMe rejects dirty worktrees before `change_branch`, `pull_branch`, and `rebase_branch`. It does not force checkout, stash, stage files, create user-authored commits, reset, force-push, create merge commits, or edit files directly. Rebase-driven commit rewriting occurs only through an explicit `rebase_branch` call.
26
28
 
27
29
  ## Network behavior
28
30
 
29
- `pull_branch` and `push_branch` contact the configured Git remote through the user's normal Git transport and credentials. They do not use or inject `GITHUB_TOKEN` or `GH_TOKEN`.
31
+ `fetch_branch`, `pull_branch`, and `push_branch` contact the configured Git remote through the user's normal Git transport and credentials. They do not use or inject `GITHUB_TOKEN` or `GH_TOKEN`. `rebase_branch` uses the locally available upstream ref and makes no network request.
30
32
 
31
33
  BranchMe's GitHub helpers use these REST API requests:
32
34
 
@@ -39,7 +41,7 @@ POST https://api.github.com/repos/{owner}/{repo}/pulls
39
41
 
40
42
  The first request is an automatic network boundary: it can run before each agent run and whenever `branch_status` explicitly refreshes context. It is a bounded, read-only lookup for one open pull request whose head is the current local branch (`per_page=1`), with a default 4-second timeout and a 64 KiB response-body limit. It is skipped when repository/branch resolution or authentication is unavailable, so BranchMe never makes an unauthenticated fallback request. Timeout, HTTP, network, malformed, and oversized-response failures become a safe unavailable state without exposing response bodies or raw network errors. Git alone is not used or claimed to provide PR metadata.
41
43
 
42
- The branch preflight requests have no body. BranchMe uses the `headBranch` preflight response to compare GitHub's branch commit with the local branch commit before creating the PR. The PR request body contains only the explicit PR fields supplied to the tool: title, head branch, base branch, body, and draft flag. All GitHub response reads are bounded.
44
+ The branch preflight requests have no body. BranchMe uses the resolved `headBranch` preflight response to compare GitHub's branch commit with the local branch commit before creating the PR. The PR request body contains only the resolved title, head branch, base branch, body, and draft flag. By default every field must be supplied explicitly. When `BRANCHME_PR_AUTOFILL=true`, omitted fields may be derived from local branch names and bounded commit subjects before being sent to GitHub. Generated body bullets escape Markdown punctuation so commit subjects remain text rather than active mentions or formatting. All GitHub response reads are bounded.
43
45
 
44
46
  ## Repository boundary
45
47
 
@@ -48,21 +50,23 @@ BranchMe operates on the current repository only.
48
50
  - The GitHub repository is inferred from local `origin` and/or `GITHUB_REPOSITORY`.
49
51
  - Tool inputs never accept filesystem paths, `owner`, `repo`, or owner-prefixed `owner:branch` PR refs.
50
52
  - `change_branch` accepts only `branchName` and never creates branches, checks out remote branches, forces, stashes, or discards changes.
53
+ - `fetch_branch` accepts no parameters, resolves the current branch's configured upstream remote and branch, constructs a source-to-remote-tracking refspec internally, disables tag fetching and submodule recursion, and does not prune or accept arbitrary refspecs.
51
54
  - `pull_branch` accepts no parameters, updates only the clean current branch from its configured upstream, and uses fast-forward-only semantics.
55
+ - `rebase_branch` accepts no parameters, rebases only the clean current branch onto its configured upstream, disables autostash and multi-ref updates, never pushes, and attempts to abort on failure.
52
56
  - If local `origin` and `GITHUB_REPOSITORY` both resolve but disagree, PR creation and related-PR lookup fail closed.
53
- - PR branch inputs are validated as existing local branch-name refs; missing local branches and cross-repository `head` values are rejected before token lookup or any GitHub request.
57
+ - Resolved PR branches are validated as distinct, existing local branch-name refs; identical or missing local branches and cross-repository `head` values are rejected before any GitHub request.
54
58
  - PR branch inputs must also be visible on GitHub before the PR is created, and `headBranch` must match the local branch commit; unpublished or stale `headBranch` values fail with guidance to run `push_branch`, wait for it to complete, and retry `pull_request`.
55
59
 
56
60
  ## Credentials
57
61
 
58
- Git pull and push authentication is handled by the user's configured Git credential and transport setup. BranchMe never passes GitHub API tokens to Git commands.
62
+ Git fetch, pull, and push authentication is handled by the user's configured Git credential and transport setup. BranchMe never passes GitHub API tokens to Git commands.
59
63
 
60
64
  `pull_request` and related-PR lookup check `process.env.GITHUB_TOKEN`, then `process.env.GH_TOKEN`. If neither process token is set, BranchMe reads a local `.env` file from the verified git root and checks:
61
65
 
62
66
  - `GITHUB_TOKEN` (preferred)
63
67
  - `GH_TOKEN` (fallback)
64
68
 
65
- Only these two token keys are read from `.env`; other `.env` keys are ignored. The fallback uses async file I/O, requires `.env` to be a small regular file, and rejects directories, symlinks, special files, and oversized files. BranchMe does not read shell profiles, GitHub CLI credentials, or local credential stores. Token values are redacted from thrown errors, automatic context, tool content, and tool details.
69
+ BranchMe also reads the non-secret `BRANCHME_PR_AUTOFILL` setting from the process environment or verified-root `.env`; all other `.env` keys are ignored. The `.env` reader uses async file I/O, requires a small regular file, and rejects directories, symlinks, special files, and oversized files. BranchMe does not read shell profiles, GitHub CLI credentials, or local credential stores. Token values are redacted from thrown errors, automatic context, generated PR text, tool content, and tool details.
66
70
 
67
71
  ## System prompt boundary
68
72
 
@@ -72,7 +76,7 @@ The automatic snapshot can become stale after a Git or filesystem mutation durin
72
76
 
73
77
  ## Telemetry
74
78
 
75
- BranchMe does not collect telemetry. Related-PR lookup sends only the resolved repository owner/name and current branch in the authenticated GitHub API URL. PR creation sends only the explicit GitHub pull request fields described above; BranchMe does not send diff contents, filenames, commit subjects, or local file contents to GitHub during context collection.
79
+ BranchMe does not collect telemetry. Related-PR lookup sends only the resolved repository owner/name and current branch in the authenticated GitHub API URL. PR creation sends only the resolved GitHub pull request fields described above. When autofill supplies title or body, those fields can contain bounded, redacted local commit subjects. BranchMe does not send diff contents, filenames, or local file contents to GitHub during context collection.
76
80
 
77
81
  ## Reporting vulnerabilities
78
82
 
@@ -26,7 +26,7 @@ Approved on 2026-06-30.
26
26
  - Push the current branch to its configured upstream, or publish it to `origin` when no upstream exists.
27
27
  - Create a PR in the current GitHub repo via REST API.
28
28
  - Non-goals:
29
- - No commit, staging, diff, or message generation behavior.
29
+ - No commit, staging, or diff generation behavior. Optional PR title/body autofill may summarize bounded commit subjects.
30
30
  - No GitHub CLI dependency.
31
31
  - No cross-repository PR creation.
32
32
  - No labels, reviewers, projects, or issue linking in v1.
@@ -41,7 +41,7 @@ Approved on 2026-06-30.
41
41
  | Tool | `change_branch` | Switch to an existing local branch | Required `branchName`; rejects dirty worktrees |
42
42
  | Tool | `create_branch` | Create + checkout new branch from current `HEAD` | Required `branchName`; fail if exists/invalid |
43
43
  | Tool | `push_branch` | Push current branch with explicit upstream target; publish with upstream if needed | No commits/staging |
44
- | Tool | `pull_request` | Preflight branch visibility/commit state and create PR via GitHub REST API | Required `headBranch`, `baseBranch`, `title`, `body`, `draft`; repo inferred from current checkout |
44
+ | Tool | `pull_request` | Preflight branch visibility/commit state and create PR via GitHub REST API | PR fields are explicit by default and may be omitted only with configured autofill; repo inferred from current checkout |
45
45
  | Event | `session_start/session_shutdown` | Optional status footer cleanup | No long-lived resources |
46
46
  | UI | TUI panel | Compact BranchMe workflow/config view | No persisted config assumed |
47
47
  | Resource | none | No skills/prompts/themes planned | Keep package minimal |
@@ -68,7 +68,7 @@ Approved on 2026-06-30.
68
68
 
69
69
  ## 6. Config, state, and persistence
70
70
 
71
- - Config source: no BranchMe config file; `/branchme` displays runtime status and workflow notes. GitHub tokens may come from process environment or a small regular `.env` fallback in the verified git root.
71
+ - Config source: no separate BranchMe config file; `/branchme` displays runtime status and workflow notes. GitHub tokens and `BRANCHME_PR_AUTOFILL` may come from process environment or a small regular `.env` fallback in the verified git root.
72
72
  - Session state: none; tool results include useful `details`.
73
73
  - Files written: none by extension code, except normal git metadata changes from branch checkout/push.
74
74
  - Cleanup behavior: clear any footer/status key on `session_shutdown` if used.
@@ -111,4 +111,4 @@ Approved on 2026-06-30.
111
111
  - Decisions:
112
112
  - No commit functionality.
113
113
  - Tools perform all actions; slash commands are help/config only.
114
- - PR tool requires all PR fields explicitly.
114
+ - PR tool requires all PR fields explicitly unless `BRANCHME_PR_AUTOFILL=true`; explicit values always take precedence.
@@ -18,7 +18,7 @@ pi --no-extensions -e .
18
18
  ## Automated smoke behavior
19
19
 
20
20
  - `npm run smoke:pi` first runs isolated checkout Pi processes from a temporary non-Git working directory: one with `pi --no-extensions -e <package> -e <temporary verifier>` and `/branchmeverify verify`, then one with `pi --no-extensions -e <package>` and `/branchme help`.
21
- - The temporary command verifier calls `pi.getAllTools()` after BranchMe loads and confirms `branch_status`, `change_branch`, `pull_branch`, `create_branch`, `push_branch`, and `pull_request` are active runtime tools with strict schemas, prompt guidelines, descriptions, and extension source metadata.
21
+ - The temporary command verifier calls `pi.getAllTools()` after BranchMe loads and confirms `branch_status`, `change_branch`, `fetch_branch`, `pull_branch`, `rebase_branch`, `create_branch`, `push_branch`, and `pull_request` are active runtime tools with strict schemas, prompt guidelines, descriptions, and extension source metadata.
22
22
  - A second temporary verifier registers a deterministic local smoke model, blocks `fetch`, and runs normal prompts through real Pi lifecycle handling. It verifies automatic no-tool Git context in a temporary repository, one real `branch_status` tool refresh after a verifier-created local change, safe credential-free related-PR status with no request, and non-Git startup fallback.
23
23
  - The checkout command smoke accepts either `/branchme help` text or the read-only BranchMe status fallback as equivalent non-mutating command output.
24
24
  - `npm run smoke:pi:packed` creates an npm tarball under a temporary directory, installs that tarball into a separate temporary package with `npm install --omit=dev`, and runs pi against the installed package instead of the source checkout.
@@ -32,7 +32,7 @@ pi --no-extensions -e .
32
32
  ## Result
33
33
 
34
34
  - `npm run validate` passed.
35
- - `npm run smoke:pi` loaded BranchMe through Pi, verified all six BranchMe tools through the real `pi.getAllTools()` runtime surface, and confirmed non-mutating BranchMe command output.
35
+ - `npm run smoke:pi` loaded BranchMe through Pi, verified all eight BranchMe tools through the real `pi.getAllTools()` runtime surface, and confirmed non-mutating BranchMe command output.
36
36
  - The isolated Git-context prompt smoke observed the `before_agent_start` snapshot, answered branch and dirty-tree state without a tool call, refreshed a verifier-created local change through one real `branch_status` call, returned safe unavailable context without credentials or outside Git, and attempted no network request.
37
37
  - `npm run smoke:pi:packed` packed BranchMe outside the repository, installed the artifact in a temporary production workspace, loaded the installed package through Pi, and confirmed non-mutating BranchMe command output.
38
38
  - `npm run check:pack` confirmed the package contents are limited to public docs, images, source, license, package metadata, `.env.example`, and `tsconfig.json`.
package/docs/STRUCTURE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # BranchMe Structure Guide
2
2
 
3
- BranchMe is a TypeScript Pi extension package for current-repository git branch update, push, and GitHub pull request workflows.
3
+ BranchMe is a TypeScript Pi extension package for current-repository git branch fetch/update/rebase, push, and GitHub pull request workflows.
4
4
 
5
5
  ## Source layout
6
6
 
@@ -13,7 +13,7 @@ src/
13
13
  ├── commands/
14
14
  │ └── branchme-command.ts # /branchme status/help command; informational only
15
15
  ├── tools/
16
- │ └── branchme-tools.ts # branch_status/change_branch/pull_branch/create_branch/push_branch/pull_request registration
16
+ │ └── branchme-tools.ts # registration for eight branch/GitHub workflow tools
17
17
  ├── git.ts # argv-style git helpers and per-repo workflow queue
18
18
  ├── github.ts # GitHub repo resolution, env/.env tokens, branch preflight, REST calls, redaction
19
19
  └── ui/
@@ -22,12 +22,12 @@ src/
22
22
 
23
23
  ## Module boundaries
24
24
 
25
- 1. `src/extension.ts` stays small and registers the command, six tools, and one `before_agent_start` context hook.
25
+ 1. `src/extension.ts` stays small and registers the command, eight tools, and one `before_agent_start` context hook.
26
26
  2. `src/git-context.ts` owns the shared read-only collector, escaped/bounded formatter, automatic system-prompt append, and the current-state output used by `branch_status`.
27
27
  3. `src/commands/branchme-command.ts` parses `/branchme`, `/branchme help`, `--help`, and `-h`; it never performs git or GitHub mutations and avoids raw stdout in JSON mode.
28
28
  4. `src/tools/branchme-tools.ts` owns TypeBox schemas, prompt metadata, tool content, and safe structured details. `branch_status` delegates to the shared context collector for an explicit refresh.
29
- 5. `src/git.ts` owns current-repository git behavior: root detection, branch/upstream/ahead-behind inspection, working-tree parsing, recent-commit collection, branch validation, branch creation, existing-local-branch switching, clean-worktree preflight, fast-forward-only current-branch pull, current-branch push/publish, and the per-repository workflow queue.
30
- 6. `src/github.ts` owns GitHub `owner/repo` parsing, repository boundary checks, `GITHUB_TOKEN`/`GH_TOKEN` process-env and hardened git-root `.env` fallback resolution, authenticated related-open-PR lookup, PR branch-name syntax validation, GitHub branch visibility/commit preflight, PR REST calls, bounded response validation, and redacted errors.
29
+ 5. `src/git.ts` owns current-repository git behavior: root detection, branch/upstream/ahead-behind inspection, working-tree parsing, recent-commit collection, PR base/commit-subject inference, branch validation, branch creation, existing-local-branch switching, configured-upstream fetch, clean-worktree preflight, fast-forward-only current-branch pull, current-branch rebase with automatic abort on failure, current-branch push/publish, and the per-repository workflow queue.
30
+ 6. `src/github.ts` owns GitHub `owner/repo` parsing, repository boundary checks, `GITHUB_TOKEN`/`GH_TOKEN` and `BRANCHME_PR_AUTOFILL` process-env/hardened git-root `.env` resolution, authenticated related-open-PR lookup, PR branch-name syntax validation, GitHub branch visibility/commit preflight, PR REST calls, bounded response validation, and redacted errors.
31
31
  7. `src/redaction.ts` owns shared credential redaction for Git, GitHub, and prompt-bound metadata.
32
32
  8. `src/types.ts` keeps serializable details shared by helpers, context, and tools.
33
33
  9. `src/ui/branchme-panel.ts` renders a compact status panel and clips lines to terminal width.
@@ -36,7 +36,7 @@ src/
36
36
 
37
37
  - No long-lived processes, watchers, timers, sockets, or background jobs start in the extension factory.
38
38
  - A single `before_agent_start` handler synchronously collects a fresh snapshot for each agent run and appends it to the existing system prompt; failures degrade to bounded unavailable context rather than blocking startup.
39
- - Slash commands are informational; tools perform branch update, push, and PR actions. There is no context command or seventh tool.
39
+ - Slash commands are informational; tools perform branch fetch/update/rebase, push, and PR actions. There is no context command.
40
40
  - Every tool uses a strict TypeBox object schema with `additionalProperties: false`.
41
41
  - Every tool defines a description, `promptSnippet`, and tool-specific `promptGuidelines` that explicitly name the tool.
42
42
  - Git commands use `pi.exec("git", args, { cwd, signal, timeout })` with argv arrays; repository mutations run from the verified git root and same-repository mutation/PR windows are serialized per repository.
@@ -51,12 +51,14 @@ src/
51
51
  - Related-PR lookup may issue an authenticated `GET /pulls` before every agent run and on explicit refresh. It has a 4-second timeout and 64 KiB response limit, and makes no unauthenticated fallback request.
52
52
  - The start-of-run snapshot may be stale after a mutation in that same run; `branch_status` is the explicit read-only refresh.
53
53
  - `change_branch` mutates local HEAD and working-tree files only through `git switch <branchName>` for existing local branches after a clean-worktree preflight.
54
+ - `fetch_branch` requires a configured upstream and runs `git fetch --no-tags --no-recurse-submodules <remote> <remote-ref>:<remote-tracking-ref>`; its explicit refspec updates only that tracking ref without changing local branches or working-tree files.
54
55
  - `pull_branch` requires a clean worktree and configured upstream, then updates only the current branch with an explicit `git pull --ff-only --no-rebase --no-autostash <remote> <remote-ref>` command; divergence fails without a rebase or merge commit.
56
+ - `rebase_branch` requires a clean worktree and configured upstream, then rebases only the current branch with `git rebase --no-autostash --no-update-refs <upstream>`; it rewrites local commits and automatically attempts `git rebase --abort` on failure.
55
57
  - `create_branch` mutates local branch/HEAD only with `git switch -c`.
56
58
  - `push_branch` mutates remote refs only for the current branch and uses an explicit upstream remote/refspec instead of bare `git push` when an upstream exists.
57
- - `pull_request` requires `headBranch` and `baseBranch` to exist locally, requires `headBranch` to match the GitHub-visible branch commit, queues behind already-started same-repository git mutation windows, makes GitHub REST API calls for the resolved current repository only, and rejects missing, owner-prefixed, or unsafe branch refs before token lookup or the request.
58
- - `pull_request` reads `GITHUB_TOKEN` or `GH_TOKEN` from process environment first; only when neither process token is set does it read those token keys from a small regular `.env` file in the verified git root as a fallback.
59
- - BranchMe does not force checkout, stash, stage, commit, rebase, create merge commits, directly edit files, read non-token `.env` keys, follow unsafe `.env` file types, depend on GitHub CLI, or collect telemetry.
59
+ - `pull_request` requires resolved `headBranch` and `baseBranch` values to be distinct and exist locally, requires `headBranch` to match the GitHub-visible branch commit, queues behind already-started same-repository git mutation windows, makes GitHub REST API calls for the resolved current repository only, and rejects owner-prefixed or unsafe branch refs before the request. Omitted fields require configured autofill.
60
+ - `pull_request` reads `GITHUB_TOKEN` or `GH_TOKEN` from process environment first; only when neither process token is set does it read those token keys from a small regular `.env` file in the verified git root as a fallback. `BRANCHME_PR_AUTOFILL` uses the same process-first, `.env`-fallback precedence and defaults off.
61
+ - BranchMe does not force checkout, stash, stage, create user-authored commits, reset, force-push, create merge commits, directly edit files, read unsupported `.env` keys, follow unsafe `.env` file types, depend on GitHub CLI, or collect telemetry. Rebase-driven commit rewriting occurs only through explicit `rebase_branch` calls.
60
62
 
61
63
  ## Documentation
62
64
 
@@ -23,19 +23,23 @@ Commands only show info; BranchMe tools perform actions.
23
23
  ## Workflow
24
24
 
25
25
  1. `branch_status` — inspect repo and branch state.
26
- 2. `change_branch` — switch to the clean local base branch.
27
- 3. `pull_branch` — fast-forward the current branch from its configured upstream.
28
- 4. `create_branch` — create a new branch from the updated `HEAD`.
29
- 5. Commit outside BranchMe.
30
- 6. `push_branch` — push the current branch.
31
- 7. `pull_request` — open a PR after `push_branch` completes and GitHub sees the branches.
26
+ 2. `change_branch` — switch to a clean existing local branch.
27
+ 3. `fetch_branch` — fetch its configured upstream remote without changing local files.
28
+ 4. `pull_branch` — fast-forward from upstream, or `rebase_branch` — rebase local commits onto upstream.
29
+ 5. `create_branch` — create a new branch from the updated `HEAD`.
30
+ 6. Commit outside BranchMe.
31
+ 7. `push_branch` — push the current branch.
32
+ 8. `pull_request` — open a PR after `push_branch` completes and GitHub sees the branches.
32
33
 
33
34
  ## Requirements
34
35
 
35
36
  - Run inside a Git repo with `git` available.
36
37
  - For PRs: GitHub `origin` and `GITHUB_TOKEN` or `GH_TOKEN` (environment or `.env`).
37
- - `pull_branch` requires a clean working tree and configured upstream.
38
- - BranchMe never stages, commits, rebases, or creates merge commits.
38
+ - Optional: set `BRANCHME_PR_AUTOFILL=true` in the environment or `.env` to generate omitted PR fields.
39
+ - `fetch_branch`, `pull_branch`, and `rebase_branch` require a configured upstream.
40
+ - `pull_branch` and `rebase_branch` require a clean working tree.
41
+ - `rebase_branch` rewrites local commits only when explicitly requested and auto-aborts on failure.
42
+ - BranchMe never stages, creates user-authored commits, force-pushes, or creates merge commits.
39
43
  ```
40
44
 
41
45
  ## Panel: Tiny mode: clean branch with token
@@ -65,6 +69,8 @@ Width: 40
65
69
  │ │
66
70
  │ │
67
71
  │ │
72
+ │ │
73
+ │ │
68
74
  ├──────────────────────────────────────┤
69
75
  │ 1/2 • status • current repository on…│
70
76
  ╰──────────────────────────────────────╯
@@ -85,6 +91,8 @@ Width: 80
85
91
  │ │ │
86
92
  │ │ │
87
93
  │ │ │
94
+ │ │ │
95
+ │ │ │
88
96
  ├─────────────────────┴────────────────────────────────────────────────────────┤
89
97
  │ 1/2 • status • current repository only • tools perform actions │
90
98
  ╰──────────────────────────────────────────────────────────────────────────────╯
@@ -101,12 +109,14 @@ Width: 80
101
109
  │ Status │ WORKFLOW │
102
110
  │▶ Workflow │ branch_status -> inspect │
103
111
  │ │ change_branch -> existing local │
112
+ │ │ fetch_branch -> upstream remote │
104
113
  │ │ pull_branch -> fast-forward │
114
+ │ │ rebase_branch -> onto upstream │
105
115
  │ │ create_branch -> from HEAD │
106
116
  │ │ push_branch -> current branch │
107
117
  │ │ pull_request -> after push │
108
118
  ├─────────────────────┴────────────────────────────────────────────────────────┤
109
- │ 2/2 • workflow • inspect → change → pull → create → push → PR │
119
+ │ 2/2 • workflow • inspect → change → fetch/pull/rebase → create → push → PR │
110
120
  ╰──────────────────────────────────────────────────────────────────────────────╯
111
121
  ```
112
122
 
@@ -125,6 +135,8 @@ Width: 112
125
135
  │ │ │
126
136
  │ │ │
127
137
  │ │ │
138
+ │ │ │
139
+ │ │ │
128
140
  ├──────────────────────┴───────────────────────────────────────────────────────────────────────┤
129
141
  │ 1/2 • status • current repository only • tools perform actions │
130
142
  ╰──────────────────────────────────────────────────────────────────────────────────────────────╯
@@ -146,6 +158,8 @@ Width: 50
146
158
  │ │
147
159
  │ │
148
160
  │ │
161
+ │ │
162
+ │ │
149
163
  ├────────────────────────────────────────────────┤
150
164
  │ 1/2 • warning • Unable to resolve a GitHub rep…│
151
165
  ╰────────────────────────────────────────────────╯
@@ -166,6 +180,8 @@ Width: 80
166
180
  │ │ │
167
181
  │ │ │
168
182
  │ │ │
183
+ │ │ │
184
+ │ │ │
169
185
  ├─────────────────────┴────────────────────────────────────────────────────────┤
170
186
  │ 1/2 • warning • Repository boundary mismatch: local origin resolves to senad…│
171
187
  ╰──────────────────────────────────────────────────────────────────────────────╯
@@ -186,6 +202,8 @@ Width: 72
186
202
  │ │ │
187
203
  │ │ │
188
204
  │ │ │
205
+ │ │ │
206
+ │ │ │
189
207
  ├───────────────────┴──────────────────────────────────────────────────┤
190
208
  │ 1/2 • warning • Unable to read .env file for GitHub token fallback: …│
191
209
  ╰──────────────────────────────────────────────────────────────────────╯
@@ -206,6 +224,8 @@ Width: 72
206
224
  │ │ │
207
225
  │ │ │
208
226
  │ │ │
227
+ │ │ │
228
+ │ │ │
209
229
  ├───────────────────┴──────────────────────────────────────────────────┤
210
230
  │ 1/2 • warning • This deliberately long status note is captured to de…│
211
231
  ╰──────────────────────────────────────────────────────────────────────╯
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@senad-d/branchme",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "description": "Minimal Pi extension for current-repository git branch, push, and pull request workflows.",
6
6
  "license": "MIT",
@@ -70,10 +70,10 @@
70
70
  "typebox": "*"
71
71
  },
72
72
  "devDependencies": {
73
- "@earendil-works/pi-coding-agent": "^0.80.2",
73
+ "@earendil-works/pi-coding-agent": "^0.84.1",
74
74
  "@earendil-works/pi-tui": "^0.80.2",
75
75
  "@types/node": "^26.0.1",
76
76
  "typebox": "^1.2.18",
77
- "typescript": "^6.0.3"
77
+ "typescript": "^7.0.2"
78
78
  }
79
79
  }
@@ -32,19 +32,23 @@ export function getBranchMeHelpText(): string {
32
32
  "## Workflow",
33
33
  "",
34
34
  "1. `branch_status` — inspect repo and branch state.",
35
- "2. `change_branch` — switch to the clean local base branch.",
36
- "3. `pull_branch` — fast-forward the current branch from its configured upstream.",
37
- "4. `create_branch` — create a new branch from the updated `HEAD`.",
38
- "5. Commit outside BranchMe.",
39
- "6. `push_branch` — push the current branch.",
40
- "7. `pull_request` — open a PR after `push_branch` completes and GitHub sees the branches.",
35
+ "2. `change_branch` — switch to a clean existing local branch.",
36
+ "3. `fetch_branch` — fetch its configured upstream remote without changing local files.",
37
+ "4. `pull_branch` — fast-forward from upstream, or `rebase_branch` — rebase local commits onto upstream.",
38
+ "5. `create_branch` — create a new branch from the updated `HEAD`.",
39
+ "6. Commit outside BranchMe.",
40
+ "7. `push_branch` — push the current branch.",
41
+ "8. `pull_request` — open a PR after `push_branch` completes and GitHub sees the branches.",
41
42
  "",
42
43
  "## Requirements",
43
44
  "",
44
45
  "- Run inside a Git repo with `git` available.",
45
46
  "- For PRs: GitHub `origin` and `GITHUB_TOKEN` or `GH_TOKEN` (environment or `.env`).",
46
- "- `pull_branch` requires a clean working tree and configured upstream.",
47
- "- BranchMe never stages, commits, rebases, or creates merge commits.",
47
+ "- Optional: set `BRANCHME_PR_AUTOFILL=true` in the environment or `.env` to generate omitted PR fields.",
48
+ "- `fetch_branch`, `pull_branch`, and `rebase_branch` require a configured upstream.",
49
+ "- `pull_branch` and `rebase_branch` require a clean working tree.",
50
+ "- `rebase_branch` rewrites local commits only when explicitly requested and auto-aborts on failure.",
51
+ "- BranchMe never stages, creates user-authored commits, force-pushes, or creates merge commits.",
48
52
  ].join("\n");
49
53
  }
50
54