Skip to content

Branch management lives in its own package (#1725) - #1726

Merged
suleimansh merged 2 commits into
mainfrom
1725-branch-management-package
Aug 27, 2026
Merged

Branch management lives in its own package (#1725)#1726
suleimansh merged 2 commits into
mainfrom
1725-branch-management-package

Conversation

@suleimansh

@suleimansh suleimansh commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Step 1 of #1725: the git side of an agent's checkout moves into its own package, packages/branch-management, published as @superskill/branch-management. A lift with no behaviour change; the framework imports it as a workspace dependency.

Into the package (git mv, history kept): store/worktree.ts, store/worktree-deps.ts, branch-names.ts, branch-links.ts (the reconcile), git-exclude.ts, with their tests and SPECs. New in the package:

  • git.ts — the git runner, its per-subcommand time budgets and GitTimeoutError (from project.ts / cli-exec.ts), gitReason and pushBranch (from agent-handoff.ts).
  • reclaim.ts — the retention rule, cut out of worktrees.ts: keep a dirty tree, push when allowed, remove once the remote has it, delete a tf- branch that holds nothing, delete the birth branch when the kept branch contains it. Takes what only the caller knows as options (mayPush, heldBy, birthBranch) and returns a reason code.
  • branch-names.ts now also holds FRAMEWORK_DIR, BRANCHES_DIR and isSafeAgentId — the layout is the convention.

The framework keeps the agent's side: worktrees.ts reads the record (publish-nothing handoff, cloud anchor), hands the rule its options and words each refusal as before; the sweep, teardown, Remove/Delete/Prune, handoff untouched. branch-links-pass.ts is the daemon's turn of the reconcile. cli-exec.ts stays for gh.

Imports point at the package directly — no re-export shims. project.ts lost its git half; store/index.ts no longer re-exports the worktree API.

Tests: package 91 (the moved ones plus reclaim.test.ts and git.test.ts); framework 1552 + 864 dashboard, all green; pnpm build clean.

Second commit, after a review pass: the legacy the-framework/ prefix is gone after all (repo MEMORY.md: zero migration code — agentBranchFor now guesses tf-); the framework's own scripts build the package first so a fresh clone works; reclaimWorktree reads the tree once; git branch -D/-m/<new> get the write budget; cli-exec keeps only what gh uses; the branch-links pass is one line at its call site; the barrel exports what has an importer; SPECs caught up (root and packages/ name the package).

Not in this PR (steps 2–3 of #1725): the CLI, SKILL.md, dropping setSessionName.

Needs Rom: @superskill is your npm org. Nothing is published yet; framework's workspace:* dependency will need @superskill/branch-management@0.0.x on the registry before the next framework release.

🤖 automated · Fable 5, effort high

The git side of an agent's checkout — the naming conventions and the
.the-framework/branches/ layout, the git runner with its per-subcommand
time budgets, creating/attaching/listing/renaming/removing a worktree,
sharing the parent's dependency trees into it, the branch-name links, and
the retention rule under which a checkout is reclaimed — moves out of the
framework into packages/branch-management, published as
@superskill/branch-management. Step 1 of #1725: a lift with no behaviour
change; the framework imports the package as a workspace dependency.

What the framework keeps is the agent's side: its record (may the branch be
pushed, what did a cloud hand-off already push), the teardown and the sweep,
the dashboard's list and buttons, and how each refusal is worded. The
package's reclaimWorktree takes those as options and returns a reason code.

Also folded in: pushAgentBranch/gitReason (agent-handoff) were the same
push the rule needs, so there is one pushBranch now, in the package.
- The legacy the-framework/ prefix goes: agentBranchFor guesses tf-, the
  scratch sweep and isAgentBranch know one spelling, and the package's
  public API carries no compat layer (repo MEMORY.md: zero migration code).
- The framework's own build/dev/typecheck/test scripts build the package
  first, so a fresh clone works without a root build; the package sets
  publishConfig.access public.
- reclaimWorktree reads the tree once; the refusal union says which members
  carry a branch; git branch -D/-m/<new> run on the write budget.
- cli-exec keeps only what gh uses: a flat budget, no maxBuffer, no
  isCliTimeout; the daemon test times out with the package's error.
- The branch-links pass is one line at its call site; the barrel exports
  what has an importer; the framework proves it wires birthBranch and
  mayPush into the rule.
- SPECs: root and packages/ name the new package; index.SPEC.md; worktree,
  cli-exec and agent-handoff wording caught up with #1724 and this lift.
@suleimansh
suleimansh merged commit 6a40efd into main Aug 27, 2026
2 checks passed
@suleimansh
suleimansh deleted the 1725-branch-management-package branch August 27, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant