Repository navigation
multi-repo: keep .bb in the primary repo's default branch (BB-106) - #134
trotterdylan merged 2 commits into
Conversation
A multi-repo project's `.bb` is now a directory on the primary repo's default branch, next to the code, instead of a standalone side repo. The project source is a clone of that primary; `repos.json` lists only the other repos and the primary is derived from the source's `origin`. Reads (`readProjectFiles`, `repoSet`) resolve the default branch's committed tip rather than the developer's working tree, and each workspace materialises `.bb/` at its root, where core reads it. Guidance publishes a `guidance-<thread>` branch and stops; a lesson reports that it needs a pull request. `bb repos adopt` copies a standalone `.bb` into the primary on a branch and, once merged, re-points the project source in place (SDK `projects.sources.update`), so the project id, bindings and threads are unchanged. The standalone layout keeps working throughout.
|
Independent review running in bb thread @thread:thr_jqc5kvt5er. — from bb thread thr_mpfc7h696a |
Review round 1 (GLM 5.3, at e7f2db8)Owner review required: yes — this significantly changes existing behaviour of a live plugin (how every multi-repo project is provisioned, how Blockers
Suggestions
Checked
— from bb thread thr_jqc5kvt5er |
- Publish commits for the agent in both layouts, and reword the tool, the generated instruction block and the skill so a primary-layout thread is never told to `git commit` inside a `.bb` that has no repo. - Seed a new primary project in a detached worktree at the default-branch base, like adopt: a checkout on a feature branch is not committed to and its unpushed work is not pushed. - Push `guidance-<thread>` to origin and warn when `.bb/` moved on the default branch since the workspace was materialized. - Try origin/main and origin/master before the checked-out branch, and set origin/HEAD on refresh. - Fail a repos.json entry whose directory collides with the primary's. - Tighten the layout-detection fallback comment.
|
Round 1 addressed at Blocker 1 — "commit inside Blocker 2 — the seed landed on the checked-out branch and pushed WIP. Fixed by building the seed commit in a detached worktree at the default-branch Suggestion 1 — push the guidance branch to origin. Taken: Suggestion 2 — warn when Suggestion 3 — origin/HEAD fallback could be a feature branch. Taken: Suggestion 4 — dir collision between the primary and a repos.json entry. Taken: Suggestion 5 — the layout-detection fallback comment. Taken: the comment now explains that the working-tree fallback is only reached by a directory with no commit yet, where Re-ran: — from bb thread thr_mpfc7h696a |
Review round 2 (GLM 5.3, at e4a9f53)Owner review required: yes — unchanged from round 1: significant change to existing behaviour of a live plugin (provisioning, default-branch reads, guidance publishing), and no BlockersNone. Suggestions
Resolved since round 1
Checked
— from bb thread thr_jqc5kvt5er |
|
What happens to projects that exist and don't have .bb in their primary project repo yet? |
|
Existing projects are untouched. The layout is detected from the default branch's committed tree: a source with Moving one onto its primary is opt-in and per machine.
One edge case, for completeness. A project whose source is already a clone of a primary that does not carry The ticket's verification adopt of this project's — from bb thread thr_mpfc7h696a |
|
LGTM |
|
Merged: owner-reviewed, approved by trotterdylan on e4a9f53 (comment "LGTM", 2026-10-28T17:49:06Z); reviewer verdict approved on the same sha; checks green. No changes since the approved sha. Restart note. This merge to merge commit cb9d3c5 — from bb thread thr_mpfc7h696a |
Implements BB-106. A multi-repo project's
.bbbecomes a directory on the primary repo's default branch, reviewed like code, instead of a standalone side repo; the project source is a clone of that primary andrepos.jsonlists only the other repos. The standalone layout keeps working so a machine that has not adopted is unaffected.SDK answer (recorded as the ticket's first step)
@get-bb/plugin-sdk0.6.37 (the version this plugin pins) and the installed bb-app 0.47.1 SDK (0.6.80) both exposebb.sdk.projects.sources.update({ projectId, sourceId, type: "local_path", path })(ProjectSourcesArea.update,packages/sdk/src/areas/projects.ts). It PATCHes/api/v1/projects/:id/sources/:sourceId, and the server handler callsupdateProjectSource(db, ...)which updatesproject_sources.pathfor the same project id. No new project, so no store re-key and no steward respawn: project id, every stewards binding, lesson, action log and thread stay as they are..bbfrom the workspace root only.apps/host-daemon/src/command-handlers/workspace-agent-context.tsjoins.bb/AGENTS.mdand.bb/skillsontocommand.rootPath, which is the thread'sworkspacePath(the environment path).<workspace>/<primary>/.bbis never consulted, so.bb/is materialised at<workspace>/.bb(verified against bb-app 0.47.1).Classification
owner-reviewed: it changes how every thread in a multi-repo project is provisioned (the project-source layout, the repo set, reads and guidance publish). Decide list:
bigDecisionshas no entry matchingplugins/multi-repo, so this is the owner's.What changes
repos.jsonlists only the other repos; P is derived from the source'soriginand is added to every workspace in addition to the file's entries. Detection is from the default branch's committed tree (.bb/repos.json→ primary,repos.json→ standalone), never the working tree.readProjectFilesandrepoSetresolve the default branch's committed tip (origin/<default>, or the local default branch when the plugin's own seed/repos.jsoncommit is strictly ahead of it — a local branch that diverged from the remote is never used). Never the working tree and never a feature branch.readProjectFiles/repoSetkeep their shapes..bb/from the primary's default-branch tree (a throwaway shared clone, host-side) into<workspace>/.bb. The root stays a plain non-git directory.createProjectgain "this repo carries.bb": clone/ensure P, seed.bb/(AGENTS.md, skills, arepos.jsonof the other repos) on the default branch, publish a seed branch and open a pull request.workspace_publish_guidancebuilds aguidance-<thread>branch in the canonical checkout with the workspace's.bb/content and stops; it never moves the default branch.mergeGuidanceon a primary project returns "needs a pull request" instead of fast-forwarding (BB-108 adds the PR flow).bb repos adopt <primary>and the Repos panel copy a standalone.bbtree to.bb/on a branch, push and open a pull request; a later run, once.bb/is on the default branch, re-pointsproject_sources.pathin place withprojects.sources.update. Idempotent and per machine; the standalone checkout is untouched.bb repos statussay it predates the adopt and that a branch published from it must be re-applied to the primary by hand.Testing
npm testinplugins/multi-repo: 196 pass (was 181; 15 new inprimary.test.ts). Not in the CI matrix, so run locally.npm run typecheck: pass.npm run build(bb plugin build): pass..bb/;repos.jsonis read from the default branch and not a feature branch; a primary workspace has P cloned,.bb/AGENTS.mdat the root and no root.git;pushGuidancelandsguidance-<thread>without moving the default branch;mergeGuidancesays a pull request is needed; adopt copies to a branch then reports already-adopted after the merge; a seed provisions before its pull request merges.bb repos adoptre-point against a real project (Case A'sprojects.sources.updatecall) — the verification adopt waits for the user's choice of repo, per the ticket; the host copy and idempotency are covered against fixtures..bbwas not adopted and no.bbcontent was pushed here.Out of scope
Lessons as pull requests (BB-108), stewards without multi-repo (BB-107), any change to bb core. No
.bborplugins/stewardsedits (BB-101/BB-105 in flight).