@senad-d/branchme 0.3.0 → 0.3.2

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.
@@ -1,6 +1,6 @@
1
1
  # Project Definition Brief
2
2
 
3
- Originally approved on 2026-06-30. Updated to describe the implemented `0.3.0` package.
3
+ Originally approved on 2026-06-30. Updated to describe the implemented `0.3.1` package.
4
4
 
5
5
  ## 1. Bootstrap history
6
6
 
@@ -14,25 +14,29 @@ Originally approved on 2026-06-30. Updated to describe the implemented `0.3.0` p
14
14
  - Display name: `BranchMe`
15
15
  - Exported extension function: `branchMeExtension`
16
16
  - Repository URL: `https://github.com/senad-d/branchme`
17
- - One-sentence pitch: Verified current-repository Pi tools for branch, integration, retirement, linked-worktree, push, and GitHub pull request workflows.
18
- - Tool count: fourteen strict agent-callable tools.
17
+ - One-sentence pitch: Verified Pi tools for Git repository initialization plus current-repository branch, integration, retirement, linked-worktree, push, and GitHub pull request workflows.
18
+ - Tool count: nineteen strict agent-callable tools.
19
19
 
20
20
  ## 3. Users and use cases
21
21
 
22
22
  - Primary users: Pi users, specialized Git subagents, orchestrators, and CI/GitHub Actions workflows.
23
23
  - Primary use cases:
24
+ - Initialize pi's exact current directory as a verified non-bare Git repository with an unborn initial branch.
24
25
  - Inspect bounded current-repository branch, upstream, working-tree, related-PR, and recent-commit state, with an optional explicit local source/target ancestry proof.
25
26
  - Integrate one exact existing local source branch into the already-current clean local target, returning verified no-op, fast-forward, merge-commit, or restored-conflict details.
26
27
  - List the current repository's main and linked worktrees explicitly.
27
- - Create and verify a linked worktree for a new branch from current `HEAD` or an unoccupied existing local branch.
28
+ - Discover local/remote-tracking branches, upstream counts, and worktree occupancy with `list_branches`.
29
+ - Join an existing remote branch with verified `track_branch`, or merge a fresh remote base into the current feature with `update_from_base`.
30
+ - Create and verify a linked worktree from current `HEAD`, optional read-only `baseRef`, or an unoccupied existing local branch.
28
31
  - Return an exact, absolute, machine-readable worktree handoff for a caller-managed separate Pi session or subagent.
29
- - Remove an exact verified linked worktree only when it is clean and contains no ignored entries, while retaining its local branch.
32
+ - Remove an exact verified clean linked worktree while retaining its local branch; protect ignored residue by default and delete it only with explicit `deleteIgnored: true` authorization.
30
33
  - Land a host-merged feature in one cwd-independent call: fetch/prove remote ancestry, remove a clean linked checkout including ignored residue, lease-delete the source branch, and sync the target independently without touching a dirty checkout.
31
34
  - Retire one exact unoccupied local branch ref only when it matches a full expected `HEAD` and its relationship to one exact local target has been verified; unmerged retirement requires explicit force authorization.
32
35
  - Switch to an existing local branch after a clean-worktree preflight or create a new branch from current `HEAD`.
33
36
  - Fetch a configured upstream tracking ref, fast-forward the current branch, or explicitly rebase it.
34
37
  - Push the current branch to its configured upstream, or publish it to `origin` when no upstream exists.
35
- - Create a pull request in the resolved current GitHub repository through the REST API.
38
+ - Create or reuse an exact matching open PR in the resolved current GitHub repository; inspect lifecycle/commit identities with `pull_request_status`.
39
+ - Verify exact host-merge evidence through `land_branch.pullRequestNumber` for squash/rebase cleanup without falsifying graph ancestry.
36
40
  - Non-goals:
37
41
  - No staging, direct working-tree edits, user-authored commits, commit-message input/generation, diff generation, stashing, resets, or force pushes. Explicit `integrate_branch` may let Git create its standard merge commit for divergent histories.
38
42
  - No automatic Pi cwd changes, process/session creation, or copying of `.env` and other ignored/untracked files into linked worktrees.
@@ -46,15 +50,20 @@ Originally approved on 2026-06-30. Updated to describe the implemented `0.3.0` p
46
50
  | --- | --- | --- | --- |
47
51
  | Command | `/branchme` | Compact TUI status and workflow panel | Informational; no Git or GitHub mutations |
48
52
  | Command | `/branchme help` | Runtime requirements and workflow guidance | Informational; no actions |
49
- | Tool | `branch_status` | Refresh bounded current-worktree Git and related-PR context; optionally prove captured local-branch ancestry | Read-only; targeted ancestry is absent from automatic context |
53
+ | Tool | `list_branches` | Discover local and cached remote-tracking refs | Bounded, read-only; includes upstream counts and worktree occupancy |
54
+ | Tool | `track_branch` | Join an existing remote branch | Narrow fetch, clean idle checkout, verified HEAD/upstream |
55
+ | Tool | `update_from_base` | Fetch and merge an explicit remote base | Preserves published history; fixed merge policy and automatic conflict abort |
56
+ | Tool | `pull_request_status` | Read exact PR or latest PR for a head | Open/closed/merged state and commit identities; not a CI/review verdict |
57
+ | Tool | `init_repository` | Initialize the exact current directory as a new non-bare Git repository | Optional initial branch; rejects reinitialization/nesting; no path, commit, or project-file controls |
58
+ | Tool | `branch_status` | Refresh bounded current-worktree Git and related-PR context; optionally prove captured local or remote-tracking ancestry | Read-only; targeted ancestry is absent from automatic context |
50
59
  | Tool | `integrate_branch` | Integrate one exact local source into the already-current clean local target | Fixed normal-merge policy; verified automatic abort/restoration on conflict |
51
60
  | Tool | `list_worktrees` | List bounded main/linked worktree inventory | Read-only and explicit |
52
61
  | Tool | `create_worktree` | Create and verify a linked worktree | Exact absolute handoff cwd; new/existing local branch modes only |
53
- | Tool | `remove_worktree` | Remove an exact verified clean linked worktree | Force-free; ignored entries block removal; branch retained |
62
+ | Tool | `remove_worktree` | Remove an exact verified clean linked worktree | Force-free; ignored entries protected by default and deletable with explicit `deleteIgnored: true`; branch retained |
54
63
  | Tool | `retire_branch` | Delete one exact verified local branch ref | Expected-`HEAD` lease; exact target ancestry; explicit force for unmerged history; local-only |
55
- | Tool | `land_branch` | Post-host-merge cleanup and final target sync in one call | Remote ancestry gate, ignored-residue deletion, leased local source deletion, per-step receipts; run from repository root |
64
+ | Tool | `land_branch` | Post-host-merge cleanup and final target sync in one call | Remote ancestry or exact merged-PR evidence gate, ignored-residue deletion, leased local source deletion, per-step receipts; run from repository root |
56
65
  | Tool | `change_branch` | Switch to an existing local branch | Rejects dirty worktrees |
57
- | Tool | `fetch_branch` | Refresh the current branch's configured tracking ref | Explicit fetch refspec; no checkout change |
66
+ | Tool | `fetch_branch` | Refresh a configured upstream or explicit remote branch's tracking ref | Explicit fetch refspec; no checkout change |
58
67
  | Tool | `pull_branch` | Fast-forward the clean current branch | No rebase, merge commit, or autostash |
59
68
  | Tool | `rebase_branch` | Rebase the clean current branch onto its upstream | Explicit history rewrite; automatic abort attempt on failure |
60
69
  | Tool | `create_branch` | Create and check out a new branch from current `HEAD` | Fails when invalid or already present |
@@ -74,21 +83,24 @@ Originally approved on 2026-06-30. Updated to describe the implemented `0.3.0` p
74
83
  - `src/git-context.ts`
75
84
  - `src/commands/branchme-command.ts`
76
85
  - `src/tools/branchme-tools.ts`
86
+ - `src/tools/workflow-tools.ts`
77
87
  - `src/git.ts`
88
+ - `src/git-workflow.ts`
78
89
  - `src/git-integration.ts`
79
90
  - `src/git-retirement.ts`
80
91
  - `src/git-landing.ts`
81
92
  - `src/github.ts`
82
93
  - `src/ui/branchme-panel.ts`
83
94
  - Module boundaries:
84
- - The extension entry point registers the informational command, fourteen tools, and automatic context hook.
95
+ - The extension entry point registers the informational command, nineteen tools, and automatic context hook.
96
+ - `src/git-workflow.ts` and `src/tools/workflow-tools.ts` own verified remote tracking, base updates, and the new PR status registration.
85
97
  - The context module owns bounded read-only collection, prompt formatting, targeted ancestry rendering, and the `before_agent_start` hook; automatic context never runs ancestry queries.
86
98
  - The command and UI modules own mode-safe informational help/status behavior and never invoke mutations.
87
99
  - The tools module owns strict TypeBox schemas, descriptions, prompt metadata, bounded display content, and serializable result details.
88
- - The general Git helper owns reusable argv-style current-repository inspection, branch/ref/ancestry and operation-state primitives, branch/upstream workflows, worktree parsing/path validation/create/remove verification, and process-local same-repository mutation serialization.
100
+ - The general Git helper owns verified current-directory initialization plus reusable argv-style current-repository inspection, branch/ref/ancestry and operation-state primitives, branch/upstream workflows, worktree parsing/path validation/create/remove verification, and process-local same-repository mutation serialization.
89
101
  - The integration module owns the clean-control preflight, fixed merge mutation, automatic conflict abort, outcome classification, and repository/ref/worktree/ancestry verification without absorbing that state machine into the general helper.
90
102
  - The retirement module owns exact request validation, direct-ref and expected-`HEAD` preflight, complete worktree occupancy checks, target ancestry, leased local-ref deletion, cancellation-safe verification, and bounded uncertain outcomes without absorbing that state machine into the general helper.
91
- - The GitHub helper owns repository resolution, token/autofill configuration, related-PR lookup, branch visibility and commit preflight, and pull request REST calls.
103
+ - The GitHub helper owns repository resolution, token/autofill configuration, related-PR and PR-lifecycle lookup, branch visibility and commit preflight, idempotent pull request creation/reuse, and merged-PR evidence used by landing.
92
104
  - The redaction module owns shared credential redaction for display and prompt-bound metadata.
93
105
  - Shared public details remain JSON-serializable and contain no runtime objects or abort signals.
94
106
  - Dependencies:
@@ -99,23 +111,24 @@ Originally approved on 2026-06-30. Updated to describe the implemented `0.3.0` p
99
111
 
100
112
  ## 6. Configuration, state, and filesystem boundary
101
113
 
102
- - Config source: no separate BranchMe config file. `GITHUB_TOKEN`, `GH_TOKEN`, and `BRANCHME_PR_AUTOFILL` use process-environment values first and may fall back to supported keys in a hardened regular `.env` file at the verified Git root.
114
+ - Config source: no separate BranchMe config file. `GITHUB_TOKEN`, `GH_TOKEN`, and `BRANCHME_PR_AUTOFILL` use process-environment values first and may fall back to supported keys in a hardened regular `.env` file at the verified Git root. Tokens authenticate automatic related-PR lookup, explicit PR status, PR-aware landing evidence, and PR creation/reuse.
103
115
  - Session state: no persisted BranchMe state. Tool calls return serializable details, and mutation/PR coordination is in-memory and process-local only; other Pi sessions and external Git processes are not locked.
116
+ - Repository initialization: `init_repository` creates in-place `.git` metadata only in pi's canonical current directory after rejecting existing or nested repositories; it creates an unborn branch but no commit or project file.
104
117
  - Active-checkout mutations: explicit branch switching, creation, pull, rebase, and integration operations can update Git metadata and working-tree files through Git. Explicit retirement can delete one exact local branch ref. Push and fetch operations can update remote or remote-tracking refs through Git.
105
118
  - Linked-worktree mutations: `create_worktree` can create a checkout directory outside the active checkout after canonical destination and repository-boundary validation. `remove_worktree` can recursively remove only an exact verified linked-worktree directory after clean and ignored-entry preflights.
106
119
  - BranchMe does not directly edit project files, stage content, create user-authored commits, accept commit messages, copy local-only files into new worktrees, delete the retained branch during removal, or mutate worktrees through slash commands. `integrate_branch` may cause Git to create a standard merge commit under the verified boundary below; `retire_branch` may delete one exact local branch ref only under the separate leased boundary below.
107
120
 
108
- The standalone worktree-removal/retirement contracts below remain unchanged. `land_branch` is an explicit combined post-merge alternative: it authorizes deletion of ignored residue, uses the fetched remote-tracking target for leased retirement, reports each outcome, and syncs the local target last. See [README landing contract](../README.md#post-merge-cleanup-in-one-call) and [security boundary](../SECURITY.md#post-merge-landing-boundary).
121
+ Standalone removal retains its branch and requires explicit `deleteIgnored: true` authorization to delete ignored residue. `land_branch` is a combined post-merge alternative: it authorizes deletion of ignored residue, uses the fetched remote-tracking target for leased retirement, reports each outcome, and syncs the local target last. See [README landing contract](../README.md#post-merge-cleanup-in-one-call) and [security boundary](../SECURITY.md#post-merge-landing-boundary).
109
122
 
110
123
  ## 7. Worktree handoff contract
111
124
 
112
125
  - `list_worktrees` reads bounded NUL-delimited porcelain inventory and keeps worktree discovery out of automatic active-worktree context.
113
- - `create_worktree` requires an explicitly approved absolute destination whose immediate parent exists. It rejects existing destinations and locations inside registered worktrees or the repository's common Git directory.
114
- - New mode creates a local branch from current `HEAD` only. Existing mode accepts only an existing local branch not checked out in another worktree; no remote branch is inferred.
126
+ - `create_worktree` requires an explicitly approved absolute destination with a resolvable directory ancestor. Missing parents are created by Git only after validation. It rejects non-directory or dangling-symlink ancestors, existing destinations, and locations inside registered worktrees or the repository's common Git directory.
127
+ - New mode creates a local branch from current `HEAD` or an explicit read-only `baseRef` (local branch, remote-tracking ref, or full commit). Existing mode accepts only an existing local branch not checked out in another worktree; no remote branch is inferred.
115
128
  - Before mutation, canonical cwd and branch identity must fit documented limits and remain unchanged by redaction, escaping, Unicode handling, or truncation.
116
129
  - Successful creation verifies canonical path, local branch, full `HEAD`, and clean state, then returns the exact canonical absolute cwd and local branch in `handoff: { cwd, branch, head, ready: true, summary }`.
117
130
  - Removal accepts only an exact fresh inventory match that is linked, present, unlocked, non-prunable, non-bare, branch-attached, and neither main nor current.
118
- - Staged, unstaged, untracked, unmerged, and ignored entries all block removal. The bounded ignored-entry preflight does not disclose ignored paths or contents.
131
+ - Staged, unstaged, untracked, and unmerged entries block removal. Ignored entries block removal by default; `deleteIgnored: true` authorizes their deletion, and the bounded result reports only redacted top-level paths, never contents.
119
132
  - Successful force-free removal verifies that the worktree entry is absent and the retained local branch still points to its captured commit, then returns `handoff: { cwd: null, branch: <exact retained branch>, head, ready: false, summary }`.
120
133
  - BranchMe never returns a ready handoff containing `[REDACTED]`, escaped control sequences, or a BranchMe-introduced truncation ellipsis in machine-readable cwd or branch identity fields.
121
134
 
@@ -145,8 +158,8 @@ The standalone worktree-removal/retirement contracts below remain unchanged. `la
145
158
  - Every Git command uses `pi.exec("git", args, { cwd, signal, timeout })` with an argv array rather than shell interpolation.
146
159
  - Paths, branch names, Git output, commit subjects, and pull request metadata are treated as untrusted. Display and prompt surfaces are escaped, redacted, and bounded separately from prevalidated exact handoff identities.
147
160
  - Worktree paths are canonicalized and checked against a fresh current-repository inventory or the common Git directory before mutation. User-supplied removal paths are never passed directly to Git.
148
- - Worktree removal has no force path and rejects dirty, ignored-entry-containing, detached, locked, prunable/missing, bare, main, current, and foreign entries before mutation.
149
- - Worktree tools expose no force, move, prune, repair, lock, unlock, detached, orphan, remote-inference, arbitrary refspec, or arbitrary start-point controls. Git's incomplete submodule worktree support is not bypassed with force cleanup.
161
+ - Worktree removal has no force path and rejects dirty, detached, locked, prunable/missing, bare, main, current, and foreign entries before mutation. Ignored entries require explicit `deleteIgnored: true` authorization.
162
+ - Worktree tools expose no force, move, prune, repair, lock, unlock, detached, orphan, remote-inference, or arbitrary refspec controls; new-mode `baseRef` is explicitly read-only. Git's incomplete submodule worktree support is not bypassed with force cleanup.
150
163
  - Retirement requires exact direct local refs, full expected-`HEAD` leasing, complete worktree occupancy inspection, captured target ancestry, and explicit unmerged force authorization. Final verification is cancellation-safe and bounded; uncertain state requires manual inspection and no rollback mutation.
151
164
  - Automatic context and `branch_status` never collect diffs or file contents. Related-PR lookup may make a bounded authenticated GitHub request only when credentials and repository identity resolve; there is no unauthenticated fallback.
152
165
  - `pull_request` uses the resolved current GitHub repository, preflights local and GitHub branch identity, and rejects cross-repository head refs. Git fetch/pull/push use the user's normal Git credentials.
@@ -160,7 +173,7 @@ The standalone worktree-removal/retirement contracts below remain unchanged. `la
160
173
  - `SECURITY.md` documents local filesystem, Git, GitHub, credential, and prompt-insertion boundaries.
161
174
  - `docs/STRUCTURE.md` describes the implemented source and test layout.
162
175
  - `docs/SMOKE_TEST.md` records isolated checkout, handoff, and installed-package smoke behavior.
163
- - `CHANGELOG.md` tracks the active `0.2.0` unreleased changes.
176
+ - `CHANGELOG.md` tracks the active `0.3.1` unreleased changes.
164
177
  - npm distribution uses package `@senad-d/branchme`; package-content checks exclude private specs, credentials, generated files, caches, and local state.
165
178
 
166
179
  ## 12. Validation plan
@@ -180,8 +193,8 @@ The standalone worktree-removal/retirement contracts below remain unchanged. `la
180
193
  - Slash commands remain informational; tools perform all Git and GitHub actions.
181
194
  - Automatic context remains focused on the active worktree; inventory is available only through `list_worktrees`.
182
195
  - `create_worktree` returns a verified target for a caller-managed session but does not change cwd or create processes.
183
- - `integrate_branch` is the only merge surface; it uses normal local merge semantics, automatically aborts initial conflicts, and exposes no merge continuation or semantic-resolution workflow.
184
- - Worktree removal remains force-free, blocks ignored entries, and preserves the local branch.
196
+ - `integrate_branch` and `update_from_base` use the verified normal-merge state machine, automatically abort initial conflicts, and expose no merge continuation or semantic-resolution workflow. Only `update_from_base` fetches an explicit remote base before merging its captured commit.
197
+ - Worktree removal remains force-free, protects ignored entries by default, requires explicit authorization to delete them, and preserves the local branch.
185
198
  - Local branch retirement remains a separate explicit operation requiring a fresh expected `HEAD`, exact target ancestry, zero complete-inventory occupancy, and an explicit boolean force decision; it deletes only the leased local ref and leaves branch configuration and remote/remote-tracking refs untouched.
186
199
  - `push_branch` uses `origin` only when the current branch has no configured upstream.
187
200
  - `pull_request` infers owner/repository from the current checkout or matching `GITHUB_REPOSITORY`, never accepts owner/repository tool inputs, and requires local branch refs with the head matching GitHub.
@@ -1,6 +1,6 @@
1
1
  # BranchMe Smoke Test Notes
2
2
 
3
- Date: 2026-08-23
3
+ Baseline smoke record: 2026-08-23. Updated for the normal-workflow expansion.
4
4
 
5
5
  Validated from the repository checkout with no discovered extensions enabled.
6
6
 
@@ -23,9 +23,9 @@ pi --no-extensions -e .
23
23
  ## Automated smoke behavior
24
24
 
25
25
  - `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`.
26
- - The temporary command verifier calls `pi.getAllTools()` after BranchMe loads and confirms exactly fourteen tools—`branch_status`, `change_branch`, `create_branch`, `create_worktree`, `fetch_branch`, `integrate_branch`, `land_branch`, `list_worktrees`, `pull_branch`, `pull_request`, `push_branch`, `rebase_branch`, `remove_worktree`, and `retire_branch`—are each registered exactly once and active with strict schemas, named prompt guidelines, descriptions, and extension source metadata. It also proves `continue_merge` and `abort_merge` are absent.
26
+ - The temporary command verifier calls `pi.getAllTools()` after BranchMe loads and confirms exactly nineteen tools—`list_branches`, `track_branch`, `update_from_base`, `pull_request_status`, `branch_status`, `init_repository`, `change_branch`, `create_branch`, `create_worktree`, `fetch_branch`, `integrate_branch`, `land_branch`, `list_worktrees`, `pull_branch`, `pull_request`, `push_branch`, `rebase_branch`, `remove_worktree`, and `retire_branch`—are each registered exactly once and active with strict schemas, named prompt guidelines, descriptions, and extension source metadata. It also proves `continue_merge` and `abort_merge` are absent.
27
27
  - Runtime schema inspection verifies that `integrate_branch` has exactly the required `sourceBranch` and `targetBranch` fields and that `retire_branch` has exactly the required `branchName`, `expectedHead`, `targetBranch`, and `force` fields with `additionalProperties: false`. It also verifies that `branch_status` has only an optional top-level `ancestry` object whose required nested `sourceBranch` and `targetBranch` fields reject additional nested or top-level properties.
28
- - 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. It expects all fourteen tools but forbids `land_branch`, `retire_branch`, `integrate_branch`, and every remote or worktree mutation tool from executing.
28
+ - 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. It expects all nineteen tools but forbids `land_branch`, `retire_branch`, `integrate_branch`, and every remote or worktree mutation tool from executing.
29
29
  - The Pi runtime smoke validates worktree, integration, and retirement tool registration, strict schemas, and prompt contracts only; it never creates or removes a worktree, runs a merge, or retires a branch. Real-Git lifecycle coverage runs under `npm run test` in isolated temporary local repositories with no remote contact.
30
30
  - Isolated real-Git integration tests cover `already_integrated`, `fast_forward`, exact two-parent `merge_commit`, and conflict-path capture followed by verified automatic abort/restoration. They also cover target mismatch, dirty control state, rejection of branch-specific target merge options, unrelated histories, ignored-file overwrite protection, preserved repository hooks, and a committed source ref checked out in another dirty linked worktree. The recorded merge argv proves autostash and rerere are disabled, ignored-file protection is enabled, and `--no-verify` is absent.
31
31
  - Isolated real-Git retirement tests cover merged and explicitly forced-unmerged local-ref deletion, stale expected-`HEAD` rejection, current and linked-worktree occupancy, dirty unrelated worktrees, non-current targets, and preservation of target refs, remote-tracking refs, worktrees, working-tree files, and `branch.<name>.*` configuration without contacting a remote. Recorded argv proves retirement uses `update-ref --no-deref -d` with the captured expected commit and never uses `git branch -d/-D`, fetch, push, or a remote ref target.
@@ -41,11 +41,20 @@ pi --no-extensions -e .
41
41
  - Set `BRANCHME_SKIP_PI_SMOKE=1` to skip intentionally, or `BRANCHME_PI_BIN=/path/to/pi` to test a specific Pi binary for the checkout smoke.
42
42
  - If no Pi binary is available, the checkout smoke script prints an explicit skip message; default CI installs the Pi dev dependency, so `npm run validate` exercises the real Pi loading path.
43
43
 
44
+ ## Normal-workflow regression coverage
45
+
46
+ - `test/workflow.test.mjs` uses isolated repositories and local bare remotes for bounded branch discovery, upstream counts, tracking checkout verification, dirty/missing-branch refusals, and base no-op/fast-forward/divergent/conflict outcomes.
47
+ - `test/pr-workflow.test.mjs` mocks GitHub lifecycle state, repository/commit validation, API failures/cancellation, idempotent creation, and HTTP 422 races. It never contacts GitHub.
48
+ - `test/land-branch.test.mjs` additionally exercises real squash/cherry-pick rewritten histories with mocked merged-PR evidence, rejected mismatches, source movement, and unchanged remote refs.
49
+ - Review regressions cover symbolic fetch destinations before mutation, missing upstream tracking refs, initialization environment/discovery refusals and failed postconditions, and redaction before truncating PR cancellation errors.
50
+ - Runtime schema smoke checks all four new tools and `land_branch.pullRequestNumber`; none of these mutation or GitHub paths run against the user's repository.
51
+
44
52
  ## Result
45
53
 
54
+ - Normal-workflow expansion and review fixes: `npm run release:check` passed with all 306 tests, checkout schema/context smoke, package-content checks, isolated worktree handoff, and installed-production-package smoke. GitHub behavior used mocked REST responses; no live GitHub lifecycle mutation was tested or performed.
46
55
  - `npm run typecheck`, `npm run format:check`, `npm run test`, `npm run smoke:pi`, `npm run check:pack`, `npm run validate`, and `npm run smoke:pi:packed` passed.
47
56
  - `npm run smoke:worktree-handoff` returned `ok: true`, an absolute ready cwd, the expected `feature/isolated-handoff-smoke` branch and full commit ID from a separate process, `branchRetained: true` after force-free removal, `retireBranchInvoked: false`, zero network requests, and an isolated empty credential source.
48
- - `npm run smoke:pi` loaded BranchMe through Pi, verified exactly fourteen BranchMe tools (including strict `land_branch`, `integrate_branch`, `retire_branch`, and nested `branch_status.ancestry` schemas), proved merge-continuation tools absent, and confirmed non-mutating BranchMe command output.
57
+ - `npm run smoke:pi` loaded BranchMe through Pi, verified exactly nineteen BranchMe tools (including strict `land_branch`, `integrate_branch`, `retire_branch`, and nested `branch_status.ancestry` schemas), proved merge-continuation tools absent, and confirmed non-mutating BranchMe command output.
49
58
  - 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.
50
59
  - `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.
51
60
  - `npm run check:pack` confirmed the package contents are limited to public docs (including worktree, local integration, leased local branch-retirement, and security boundaries), images, source, license, package metadata, `.env.example`, and `tsconfig.json`; private planning specs and generated files remain excluded.
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, verified branch-integration and retirement, linked-worktree, push, and GitHub pull request workflows.
3
+ BranchMe is a TypeScript Pi extension package for Git repository initialization, current-repository branch, verified branch-integration and retirement, linked-worktree, push, and GitHub pull request workflows.
4
4
 
5
5
  ## Source layout
6
6
 
@@ -13,8 +13,10 @@ src/
13
13
  ├── commands/
14
14
  │ └── branchme-command.ts # /branchme status/help command; informational only
15
15
  ├── tools/
16
- │ └── branchme-tools.ts # registration for fourteen branch/integration/retirement/landing/worktree/GitHub tools
16
+ │ ├── branchme-tools.ts # main registration, including branch discovery
17
+ │ └── workflow-tools.ts # tracking, base update, and PR status registration
17
18
  ├── git.ts # shared argv-style Git primitives and per-repo mutation queue
19
+ ├── git-workflow.ts # narrow fetch, tracking checkout, and feature-base update
18
20
  ├── git-integration.ts # integration preflight, merge, cleanup, and verification state machine
19
21
  ├── git-retirement.ts # leased local-ref retirement and postcondition state machine
20
22
  ├── git-landing.ts # queued post-merge cleanup, explicit cwd routing, per-step receipts
@@ -25,30 +27,31 @@ src/
25
27
 
26
28
  ## Module boundaries
27
29
 
28
- 1. `src/extension.ts` stays small and registers the command, fourteen tools, and one `before_agent_start` context hook.
30
+ 1. `src/extension.ts` stays small and registers the command, nineteen tools, and one `before_agent_start` context hook.
29
31
  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`.
30
32
  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.
31
33
  4. `src/tools/branchme-tools.ts` owns strict TypeBox schemas, prompt metadata, bounded tool content, and safe structured details. `branch_status` delegates to the shared context collector and optional ancestry verifier; `integrate_branch` and `retire_branch` delegate to focused mutation state machines; worktree tools expose explicit inventory and verified handoff operations.
32
- 5. `src/git.ts` owns reusable current-repository Git primitives: root and canonical common-Git-directory identity, strict direct local-ref inspection, branch/ref validation, local commit ancestry, operation-state and working-tree inspection, complete bounded worktree occupancy, branch/upstream workflows, worktree parsing/path validation/create/remove verification, and the process-local per-repository mutation queue.
34
+ 5. `src/git.ts` owns verified current-directory repository initialization plus reusable current-repository Git primitives: root and canonical common-Git-directory identity, strict direct local-ref inspection, branch/ref validation, local commit ancestry, operation-state and working-tree inspection, complete bounded worktree occupancy, branch/upstream workflows, worktree parsing/path validation/create/remove verification, and the process-local per-repository mutation queue.
33
35
  6. `src/git-integration.ts` owns the integration preflight, one-window merge mutation, conflict-path capture, automatic abort, outcome classification, and repository/ref/worktree/ancestry postcondition verification. It never fetches, pushes, resets, switches branches, or continues merges.
34
36
  7. `src/git-retirement.ts` owns strict runtime input validation, expected-`HEAD` and target-ancestry preflight, complete worktree-occupancy rejection, expected-old-value `update-ref` deletion, cancellation-safe final inspection, merged/forced-unmerged classification, and bounded uncertain errors. It never deletes remote or remote-tracking refs, removes worktrees, edits branch configuration, or performs reset rollback.
35
- 8. `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.
37
+ 8. `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/all PR lookup, PR lifecycle and merged-evidence validation, PR branch-name syntax validation, GitHub branch visibility/commit preflight, idempotent PR creation/reuse, bounded response validation, and redacted errors.
36
38
  9. `src/redaction.ts` owns shared credential redaction for Git, GitHub, and prompt-bound metadata.
37
39
  10. `src/types.ts` keeps serializable details shared by helpers, context, and tools.
38
40
  11. `src/ui/branchme-panel.ts` renders a compact status panel and clips lines to terminal width.
39
- 12. `src/git-landing.ts` owns execution-only `land_branch` orchestration and receipt types. It resolves the primary checkout, routes every Git call with `-C`, and reuses queue-free targeted fetch/removal/retirement helpers under one primary-root mutation window. Remote ancestry gates cleanup; final target sync independently reports exact ref observations. No startup work or persistent landing state is added.
41
+ 12. `src/git-workflow.ts` owns tracking and base-update preflight, narrow fetching, and verified checkout/integration. `src/tools/workflow-tools.ts` registers those tools and explicit PR status.
42
+ 13. `src/git-landing.ts` owns execution-only `land_branch` orchestration and receipt types. It resolves the primary checkout, routes every Git call with `-C`, and reuses queue-free targeted fetch/removal/retirement helpers under one primary-root mutation window. Remote ancestry or exact merged-PR evidence gates cleanup; final target sync independently reports exact ref observations. No startup work or persistent landing state is added.
40
43
 
41
44
  ## Pi extension conventions
42
45
 
43
46
  - No long-lived processes, watchers, timers, sockets, or background jobs start in the extension factory.
44
47
  - 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.
45
- - Slash commands are informational; tools perform branch, integration, retirement, worktree, push, and PR actions. Commands never create/remove worktrees, merge or retire branches, change cwd, or start Pi sessions. There is no context command.
46
- - Every tool uses a strict TypeBox object schema with `additionalProperties: false`; `integrate_branch` requires exactly `sourceBranch` and `targetBranch`; `retire_branch` requires exactly `branchName`, full commit `expectedHead`, distinct `targetBranch`, and boolean `force`; worktree creation requires exactly `worktreePath`, `branchName`, and `branchMode`, listing is empty, and removal accepts only `worktreePath`.
48
+ - Slash commands are informational; tools perform repository initialization, branch, integration, retirement, worktree, push, and PR actions. Commands never initialize repositories, create/remove worktrees, merge or retire branches, change cwd, or start Pi sessions. There is no context command.
49
+ - Every tool uses a strict TypeBox object schema with `additionalProperties: false`; `init_repository` accepts only optional `initialBranch`; `integrate_branch` requires exactly `sourceBranch` and `targetBranch`; `retire_branch` requires exactly `branchName`, full commit `expectedHead`, distinct `targetBranch`, and boolean `force`; worktree creation requires `worktreePath`, `branchName`, and `branchMode` with optional new-mode `baseRef`, listing is empty, and removal requires `worktreePath` with optional boolean `deleteIgnored`.
47
50
  - Every tool defines a description, `promptSnippet`, and tool-specific `promptGuidelines` that explicitly name the tool.
48
- - Git commands use `pi.exec("git", args, { cwd, signal, timeout })` with argv arrays; repository mutations run from verified locations and same-repository mutation/PR windows are serialized per repository. Retirement uses one canonical-active-worktree-keyed queue window from preflight through final verification. The queue is process-local and does not lock a different active worktree, another Pi process, or an external Git process.
51
+ - Git commands use `pi.exec("git", args, { cwd, signal, timeout })` with argv arrays; `init_repository` uses Pi's file-mutation queue for the new `.git` entry and queues on the canonical target directory, and repository mutations run from verified locations and same-repository mutation/PR windows are serialized per repository. Retirement uses one canonical-active-worktree-keyed queue window from preflight through final verification. The queue is process-local and does not lock a different active worktree, another Pi process, or an external Git process.
49
52
  - Worktree results expose serializable requested and verified before/after state. Create returns `handoff: { cwd: <absolute>, branch, head, ready: true, summary }`; remove returns the retained branch/HEAD with `cwd: null` and `ready: false`.
50
53
  - Tool details avoid token values, abort signals, runtime objects, and unbounded raw command/API output.
51
- - Automatic and explicit context include branch/upstream/ahead-behind state, working-tree counts, up to 20 unstaged/untracked entries, related open PR state, and up to 5 recent commits. Explicit `branch_status` may additionally verify one strict local source/target ancestry query; automatic context never does. Metadata values default to 512 characters and rendered context to 4,000 characters.
54
+ - Automatic and explicit context include branch/upstream/ahead-behind state, working-tree counts, up to 20 unstaged/untracked entries, related open PR state, and up to 5 recent commits. Explicit `branch_status` may additionally verify one strict local or remote-tracking source/target ancestry query; automatic context never does. Metadata values default to 512 characters and rendered context to 4,000 characters.
52
55
  - Pi core packages, including `@earendil-works/pi-tui` for key/width utilities, remain in `peerDependencies` with `"*"`.
53
56
 
54
57
  ## Security-sensitive areas
@@ -57,6 +60,7 @@ src/
57
60
  - Repository-controlled paths, branch names, commit subjects, and PR fields are escaped, quoted, redacted, bounded, and labeled untrusted before system-prompt insertion.
58
61
  - 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.
59
62
  - The start-of-run snapshot may be stale after a mutation in that same run; `branch_status` is the explicit read-only refresh. Its optional targeted ancestry proof accepts exact local branches or remote-tracking refs such as `origin/main` as read-only endpoints and must run after `integrate_branch` or `fetch_branch`, not in the same parallel tool batch.
63
+ - `init_repository` canonicalizes pi's exact current directory, rejects filesystem root, existing `.git` entries, reinitialization, and nesting inside another repository, then runs `git init --no-template --initial-branch <name>`. It verifies the exact non-bare repository root, in-place `.git` directory, requested unborn branch, and absence of a commit. It accepts no path or repository-mode controls and performs no automatic cleanup after an uncertain failure.
60
64
  - `change_branch` mutates local HEAD and working-tree files only through `git switch <branchName>` for existing local branches after a clean-worktree preflight.
61
65
  - `fetch_branch` 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. Without arguments it requires a configured upstream; with an explicit `branch` (and optional configured `remote`, default `origin`) it refreshes only `refs/remotes/<remote>/<branch>` and never touches upstream configuration.
62
66
  - `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.
@@ -69,13 +73,15 @@ src/
69
73
  - Git hooks, custom merge drivers, clean/smudge filters, signing policy, and `reference-transaction` hooks stay active where Git invokes them and may execute commands or network operations outside BranchMe's direct argv boundary.
70
74
  - `create_branch` mutates local branch/HEAD only with `git switch -c`.
71
75
  - `list_worktrees` reads a bounded `git worktree list --porcelain -z` inventory and remains explicit rather than expanding automatic active-worktree context.
72
- - `create_worktree` requires an explicitly approved absolute destination, canonicalizes its existing parent, rejects existing or nested/common-Git-directory destinations, and creates from current `HEAD`, from an explicit read-only `baseRef` (exact local branch, remote-tracking ref, or full commit resolved to a commit before mutation and never checked out or reset), or from an unoccupied existing local branch. It verifies canonical path, branch, `HEAD`, and cleanliness before returning a ready handoff.
73
- - `remove_worktree` resolves an exact fresh current-repository inventory match, rejects main/current/dirty/ignored-entry-containing/detached/locked/prunable/missing/bare entries, runs a bounded removal-specific ignored-entry scan, performs force-free removal with the verified path, and confirms that the local branch remains at the same commit.
74
- - `land_branch` fetches the exact remote target, refuses unmerged history or a cwd inside the removal target, removes only a safe linked source/target checkout (including ignored residue), and lease-deletes only the source local ref against the fetched remote-tracking target. Target sync is last and uses a non-forced fetch refspec, a clean-worktree ff-only pull, dirty-skip, or no-op. Failed/unattempted sync is explicit; receipts include actual before/after refs and top-level deleted ignored paths. Standalone removal/retirement defaults are unchanged.
76
+ - `create_worktree` requires an explicitly approved absolute destination, canonicalizes its nearest existing directory ancestor, rejects non-directory/dangling ancestors and existing or nested/common-Git-directory destinations, lets Git create missing parents after validation, and creates from current `HEAD`, from an explicit read-only `baseRef` (exact local branch, remote-tracking ref, or full commit resolved to a commit before mutation and never checked out or reset), or from an unoccupied existing local branch. It verifies canonical path, branch, `HEAD`, and cleanliness before returning a ready handoff.
77
+ - `remove_worktree` resolves an exact fresh current-repository inventory match, rejects main/current/dirty/detached/locked/prunable/missing/bare entries, and performs a bounded ignored-entry scan. Ignored residue is refused by default; optional `deleteIgnored: true` explicitly authorizes deleting it and reports redacted top-level paths. Removal remains force-free and confirms that the local branch remains at the same commit.
78
+ - `land_branch` fetches the exact remote target, requires source ancestry or exact merged GitHub evidence via `pullRequestNumber`, refuses a cwd inside the removal target, removes only a safe linked source/target checkout (including ignored residue), and lease-deletes only the source local ref against the fetched remote-tracking target. Target sync is last and uses a non-forced fetch refspec, a clean-worktree ff-only pull, dirty-skip, or no-op. Failed/unattempted sync is explicit; receipts include actual before/after refs and top-level deleted ignored paths. Standalone removal/retirement defaults are unchanged.
75
79
  - `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.
76
80
  - `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.
77
81
  - `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.
78
- - BranchMe does not force checkout/removal, move/prune/repair/lock/unlock worktrees, create detached/orphan worktrees, infer remote worktree branches, copy ignored/untracked files such as `.env`, remove ignored-entry-containing worktrees through standalone `remove_worktree`, delete retained worktree branches during standalone removal, change Pi's cwd, or start Pi sessions. It also does not stash, stage, create user-authored commits, accept commit messages, reset, force-push, directly edit files, read unsupported `.env` keys, follow unsafe `.env` file types, depend on GitHub CLI, or collect telemetry. Only explicit `integrate_branch` may let Git create a standard merge commit for divergent histories; only explicit leased `retire_branch` or merged-only `land_branch` may delete one exact local branch ref. Retirement has no bulk, inferred-target, remote, remote-tracking, rollback, or automatic worktree deletion. Git documents submodule worktree support as incomplete; BranchMe adds no force-based submodule cleanup.
82
+ - BranchMe does not force checkout/removal, move/prune/repair/lock/unlock worktrees, create detached/orphan worktrees, infer remote worktree branches, copy ignored/untracked files such as `.env`, delete ignored worktree residue through standalone `remove_worktree` without explicit `deleteIgnored: true` authorization, delete retained worktree branches during standalone removal, change Pi's cwd, or start Pi sessions. It also does not stash, stage, create user-authored commits, accept commit messages, reset, force-push, directly edit project files, read unsupported `.env` keys, follow unsafe `.env` file types, depend on GitHub CLI, or collect telemetry. Explicit `integrate_branch` and `update_from_base` may let Git create a standard merge commit for divergent histories; only explicit leased `retire_branch` or merged-only `land_branch` may delete one exact local branch ref. Retirement has no bulk, inferred-target, remote, remote-tracking, rollback, or automatic worktree deletion. Git documents submodule worktree support as incomplete; BranchMe adds no force-based submodule cleanup.
83
+
84
+ `list_branches` returns bounded display metadata, including cached upstream counts and occupancy; automatic context is unchanged. `pull_request_status` reads exact-number or latest-head PR state, not CI/review requirements. `pull_request` reuses matching open PRs without overwriting their metadata. PR-aware landing verifies repository/remote identity, exact merged head/base, and merge-commit containment before allowing non-ancestor local retirement; it retains the expected-HEAD lease and reports graph ancestry separately from host evidence.
79
85
 
80
86
  ## Documentation
81
87
 
@@ -96,6 +102,8 @@ test/
96
102
  ├── git-retirement-integration.test.mjs # isolated real-Git local-ref retirement lifecycle coverage
97
103
  ├── land-branch.test.mjs # bare-origin post-merge cleanup, cwd safety, idempotence, and receipt regressions
98
104
  ├── github.test.mjs # GitHub parsing, token resolution, related-PR lookup, redaction
105
+ ├── workflow.test.mjs # discovery, verified remote tracking, base merges and conflicts
106
+ ├── pr-workflow.test.mjs # PR lifecycle validation, idempotence, races and schema
99
107
  ├── preparation.test.mjs # package/docs/source metadata checks
100
108
  ├── schema-validation.test.mjs # strict TypeBox schema validation, including worktree and retirement fields
101
109
  ├── tools.test.mjs # extension registration, prompt metadata, shared refresh, tool behavior
@@ -16,12 +16,13 @@ UPDATE_TUI_CAPTURE=1 node --test test/tui-capture.test.mjs
16
16
  ```text
17
17
  # BranchMe
18
18
 
19
- Current-repository Git workflow tools for Pi.
19
+ Git repository initialization and current-repository workflow tools for Pi.
20
20
 
21
21
  Commands only show info; BranchMe tools perform actions.
22
22
 
23
23
  ## Workflow
24
24
 
25
+ 0. `init_repository` — initialize the current directory when it is not already inside a Git repository.
25
26
  1. `branch_status` — inspect repo and branch state.
26
27
  2. `change_branch` — switch to a clean existing local branch.
27
28
  3. `fetch_branch` — fetch its configured upstream remote (or an explicit `remote`/`branch`) without changing local files.
@@ -31,6 +32,15 @@ Commands only show info; BranchMe tools perform actions.
31
32
  7. `push_branch` — push the current branch.
32
33
  8. `pull_request` — open a PR after `push_branch` completes and GitHub sees the branches.
33
34
 
35
+ ## Discovery and PR lifecycle
36
+
37
+ - `list_branches` — discover local/cached remote refs, upstream counts, and worktree occupancy without fetching.
38
+ - `track_branch` — fetch an existing remote branch and verify a new clean local tracking checkout.
39
+ - `update_from_base` — fetch and merge an explicit base into the current clean feature, preserving published history and upstream.
40
+ - `pull_request_status` — inspect a PR by number, or the latest PR for a head branch; not a CI/review verdict.
41
+ - `pull_request` — reuses an exact matching open PR without changing its title, body, or draft state.
42
+ - `land_branch` — after host merge, clean up from the primary checkout; use `pullRequestNumber` for squash/rebase evidence.
43
+
34
44
  ## Branch integration
35
45
 
36
46
  - `integrate_branch` — integrate an exact local source into an exact local target; the clean control worktree must already have the target checked out.
@@ -50,12 +60,12 @@ Commands only show info; BranchMe tools perform actions.
50
60
  - `list_worktrees` — inspect the main and linked worktrees in the current repository.
51
61
  - `create_worktree` — create a linked worktree and return a ready handoff with an absolute `handoff.cwd`.
52
62
  - A separate orchestrator starts the next Pi session or subagent in `handoff.cwd`.
53
- - `remove_worktree` — remove a verified clean linked worktree while retaining its local branch.
63
+ - `remove_worktree` — remove a verified clean linked worktree while retaining its local branch; `deleteIgnored: true` explicitly deletes ignored residue.
54
64
  - BranchMe does not change cwd, start Pi, or copy `.env`; `remove_worktree` never removes its retained branch automatically.
55
65
 
56
66
  ## Requirements
57
67
 
58
- - Run inside a Git repo with `git` available.
68
+ - Keep `git` available. Existing-repository tools run inside a Git repo; `init_repository` targets only the exact current non-repository directory.
59
69
  - For PRs: GitHub `origin` and `GITHUB_TOKEN` or `GH_TOKEN` (environment or `.env`).
60
70
  - Optional: set `BRANCHME_PR_AUTOFILL=true` in the environment or `.env` to generate omitted PR fields.
61
71
  - `fetch_branch` without `branch`, `pull_branch`, and `rebase_branch` require a configured upstream.
@@ -81,10 +91,11 @@ Width: 40
81
91
 
82
92
  ```text
83
93
  ╭ BranchMe ──────────────────── Status ╮
84
- │current repo only • informational │
94
+ │init or current repo • informational │
85
95
  │ ↑↓ section • q quit • /branchme help │
86
96
  ├──────────────────────────────────────┤
87
97
  │ STATUS │
98
+ │ init_repository -> new current dir…│
88
99
  │ Current branch: feature/current │
89
100
  │ GitHub repository: senad-d/branchme │
90
101
  │ GitHub token: present │
@@ -92,9 +103,8 @@ Width: 40
92
103
  │ │
93
104
  │ │
94
105
  │ │
95
- │ │
96
106
  ├──────────────────────────────────────┤
97
- │ 1/4 • status • current repository on…│
107
+ │ 1/4 • status • init or current repos…│
98
108
  ╰──────────────────────────────────────╯
99
109
  ```
100
110
 
@@ -104,7 +114,7 @@ Width: 40
104
114
 
105
115
  ```text
106
116
  ╭ BranchMe ───────────────── Lifecycle ╮
107
- │current repo only • informational │
117
+ │init or current repo • informational │
108
118
  │ ↑↓ section • q quit • /branchme help │
109
119
  ├──────────────────────────────────────┤
110
120
  │ LIFECYCLE │
@@ -130,16 +140,16 @@ Width: 80
130
140
  │ ↑↓ section • q quit • /branchme help │
131
141
  ├─────────────────────┬────────────────────────────────────────────────────────┤
132
142
  │▶ Status │ STATUS │
133
- │ Workflow │ Current branch: feature/current │
134
- │ Lifecycle │ GitHub repository: senad-d/branchme │
135
- │ Worktrees │ GitHub token: present │
136
- │ │ │
143
+ │ Workflow │ init_repository -> new current directory │
144
+ │ Lifecycle │ Current branch: feature/current │
145
+ │ Worktrees │ GitHub repository: senad-d/branchme │
146
+ │ │ GitHub token: present │
137
147
  │ │ │
138
148
  │ │ │
139
149
  │ │ │
140
150
  │ │ │
141
151
  ├─────────────────────┴────────────────────────────────────────────────────────┤
142
- │ 1/4 • status • current repository only • tools perform actions │
152
+ │ 1/4 • status • init or current repository • tools perform actions │
143
153
  ╰──────────────────────────────────────────────────────────────────────────────╯
144
154
  ```
145
155
 
@@ -218,16 +228,16 @@ Width: 112
218
228
  │ ↑↓ section • q quit • /branchme help │
219
229
  ├──────────────────────┬───────────────────────────────────────────────────────────────────────┤
220
230
  │▶ Status │ STATUS │
221
- │ Workflow │ Current branch: main │
222
- │ Lifecycle │ GitHub repository: senad-d/BranchMe │
223
- │ Worktrees │ GitHub token: not set │
224
- │ │ │
231
+ │ Workflow │ init_repository -> new current directory │
232
+ │ Lifecycle │ Current branch: main │
233
+ │ Worktrees │ GitHub repository: senad-d/BranchMe │
234
+ │ │ GitHub token: not set │
225
235
  │ │ │
226
236
  │ │ │
227
237
  │ │ │
228
238
  │ │ │
229
239
  ├──────────────────────┴───────────────────────────────────────────────────────────────────────┤
230
- │ 1/4 • status • current repository only • tools perform actions │
240
+ │ 1/4 • status • init or current repository • tools perform actions │
231
241
  ╰──────────────────────────────────────────────────────────────────────────────────────────────╯
232
242
  ```
233
243
 
@@ -237,10 +247,11 @@ Width: 50
237
247
 
238
248
  ```text
239
249
  ╭ BranchMe ────────────────────────────── Status ╮
240
- │current repo only • informational │
250
+ │init or current repo • informational │
241
251
  │ ↑↓ section • q quit • /branchme help │
242
252
  ├────────────────────────────────────────────────┤
243
253
  │ STATUS │
254
+ │ init_repository -> new current directory │
244
255
  │ Current branch: detached HEAD │
245
256
  │ GitHub repository: not resolved │
246
257
  │ GitHub token: not set │
@@ -248,7 +259,6 @@ Width: 50
248
259
  │ │
249
260
  │ │
250
261
  │ │
251
- │ │
252
262
  ├────────────────────────────────────────────────┤
253
263
  │ 1/4 • warning • Unable to resolve a GitHub rep…│
254
264
  ╰────────────────────────────────────────────────╯
@@ -263,10 +273,10 @@ Width: 80
263
273
  │ ↑↓ section • q quit • /branchme help │
264
274
  ├─────────────────────┬────────────────────────────────────────────────────────┤
265
275
  │▶ Status │ STATUS │
266
- │ Workflow │ Current branch: main │
267
- │ Lifecycle │ GitHub repository: warning: Repository boundary misma…│
268
- │ Worktrees │ GitHub token: present │
269
- │ │ │
276
+ │ Workflow │ init_repository -> new current directory │
277
+ │ Lifecycle │ Current branch: main │
278
+ │ Worktrees │ GitHub repository: warning: Repository boundary misma…│
279
+ │ │ GitHub token: present │
270
280
  │ │ │
271
281
  │ │ │
272
282
  │ │ │
@@ -285,10 +295,10 @@ Width: 72
285
295
  │ ↑↓ section • q quit • /branchme help │
286
296
  ├───────────────────┬──────────────────────────────────────────────────┤
287
297
  │▶ Status │ STATUS │
288
- │ Workflow │ Current branch: main │
289
- │ Lifecycle │ GitHub repository: senad-d/branchme │
290
- │ Worktrees │ GitHub token: warning: Unable to read .env…│
291
- │ │ │
298
+ │ Workflow │ init_repository -> new current directory │
299
+ │ Lifecycle │ Current branch: main │
300
+ │ Worktrees │ GitHub repository: senad-d/branchme │
301
+ │ │ GitHub token: warning: Unable to read .env…│
292
302
  │ │ │
293
303
  │ │ │
294
304
  │ │ │
@@ -307,10 +317,10 @@ Width: 72
307
317
  │ ↑↓ section • q quit • /branchme help │
308
318
  ├───────────────────┬──────────────────────────────────────────────────┤
309
319
  │▶ Status │ STATUS │
310
- │ Workflow │ Current branch: feature/super-long-branch-na…│
311
- │ Lifecycle │ GitHub repository: very-long-owner-name/very-lo…│
312
- │ Worktrees │ GitHub token: present │
313
- │ │ │
320
+ │ Workflow │ init_repository -> new current directory │
321
+ │ Lifecycle │ Current branch: feature/super-long-branch-na…│
322
+ │ Worktrees │ GitHub repository: very-long-owner-name/very-lo…│
323
+ │ │ GitHub token: present │
314
324
  │ │ │
315
325
  │ │ │
316
326
  │ │ │
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@senad-d/branchme",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
- "description": "Pi extension for verified current-repository Git branch, worktree, integration, retirement, push, and pull request workflows.",
5
+ "description": "Pi extension for verified Git repository initialization, branch, worktree, integration, retirement, push, and pull request workflows.",
6
6
  "license": "MIT",
7
7
  "author": "Senad Dizdarević <112484166+senad-d@users.noreply.github.com>",
8
8
  "repository": {
@@ -20,6 +20,7 @@
20
20
  "pi-coding-agent",
21
21
  "branchme",
22
22
  "git",
23
+ "git-init",
23
24
  "git-branch",
24
25
  "git-worktree",
25
26
  "git-workflow",
@@ -73,11 +74,16 @@
73
74
  "typebox": "*"
74
75
  },
75
76
  "devDependencies": {
76
- "@earendil-works/pi-ai": "^0.84.1",
77
- "@earendil-works/pi-coding-agent": "^0.84.1",
78
- "@earendil-works/pi-tui": "^0.84.1",
77
+ "@earendil-works/pi-ai": "^1.0.2",
78
+ "@earendil-works/pi-coding-agent": "^1.0.2",
79
+ "@earendil-works/pi-tui": "^1.0.2",
79
80
  "@types/node": "^26.0.1",
80
81
  "typebox": "^1.2.18",
81
82
  "typescript": "^7.0.2"
83
+ },
84
+ "allowScripts": {
85
+ "@google/genai@2.21.0": true,
86
+ "esbuild@0.28.2": true,
87
+ "protobufjs@7.6.6": true
82
88
  }
83
89
  }