Something went wrong. Try again.
my code lab
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475#+TITLE: cell decisions
* why "cell"A cell is both bounded and generative: a self-contained sandbox anagent can't escape, and a unit of a larger organism that grows byaccumulating them. Each cell buds off =main=, works in isolation, andpushes back, so the whole evolves.
* the convention: one shared bare repo, per-cell checkoutsA =.cell= directory holds a single bare git repo, =default.git=, andeach cell is its own colocated jj checkout of it(=jj git clone --colocate=). The tool just encodes this convention;how the checkouts are used is a higher-level concern and out of scope.* discover the cell dir as the nearest ancestor holding =.cell==cell= takes only a name and walks up from the current directory tothe nearest ancestor that holds a =.cell= directory, creating=<name>.jj= inside it. Nothing is hard-coded and no source argument isneeded.** why a hidden =.cell=, not a visible siblingA plain visible sibling would risk colliding with directories projectsalready keep (this repo has =default.jj/cells=), forcing a=default.git= guard and self-or-child matching to disambiguate. Ahidden, distinctive =.cell= has no such collision, so detectioncollapses to a plain containment check and works from anywhere in thetree below it (e.g. =~/lab/default.jj/src= finds =~/lab/.cell=).* each cell is its own colocated cloneCloning =default.git= gives each cell its own git+jj store with=default.git= wired as =origin=. A shared workspace would couple thecells to one store; independent clones keep them isolated and giveeach its own changesets, exchanged through the one bare repo.* subcommands: =init= seeds the bare repo, =new= starts a cell=cell init <src>= bare-clones =src= into the shared=.cell/default.git=; =cell new <name>= clones that bare repo into aper-cell checkout. Splitting them keeps =new= a walk-up-and-clone withno source argument while giving a first command to lay down =.cell= inthe first place. Usage errors exit 64.* =init= severs the clone from its sourceA clone records its source as =origin=. =init= removes it so the barerepo has no remaining relationship to the repo it was seeded from:that is the whole point, a repo the jail modifies that is disconnectedfrom the real checkout. Cells then wire =origin= to this bare repo,not to the original.* =init= clones only the source's default branch=--single-branch= keeps =default.git= to the source's default branchalone. A full bare clone would copy every branch the source holds, andfetching from =default.git= would then duplicate those unrelatedbranches into each cell and back into the primary workspace, drowningthe cell branches that matter. With single-branch the only other refs=default.git= ever gains are the ones cells push.* a cell pushes its work as one branchA cell never commits to =main=: it branches off =main=, commits ontop, and pushes a branch named for the cell, =<name>=, pointing at itshead.* =new= rejects a name that collides with a =default.git= branchThe cell name has to be unique among the branches in =default.git=,not just among local =<name>.jj= checkouts. The checkouts alone do notenforce this: a cell can be pushed and its checkout removed, leavingthe branch behind, after which the on-disk check would happily reusethe name. =new= thus checks =refs/heads/<name>= in =default.git=before cloning.* =resume= is a separate subcommand, not a flag on =new=A pushed cell can lose its checkout, leaving only its branch in=default.git=; getting back to it is a distinct operation from buddinga fresh cell, so it gets its own verb. Folding it into =new= as a flagor a collision fallback would make one command silently attach toexisting work, so a mistyped name would land on another cell's branchinstead of erroring. Separate verbs each carry one precondition —=new= needs the branch absent, =resume= needs it present — and failloudly pointing at the other.* deferred: a =cell bookmark= commandSetting the =<name>= bookmark is left to the in-cell workflow for now.A =cell bookmark= command might help, but its interface is unsettled;rather than guess, use the tool as-is and let real usage settle thedesign before building it.