Expand description
The typed project binding — projectless / non-git dir / git repo.
Why: “project” was one concept split across two disagreeing API surfaces —
task.run demanded a path it could not omit, session.create accepted a
label it could not index. Projectless was therefore inexpressible, which made
the shell’s entry state (spec DOC-39 screen 7a) unimplementable. This module
is the single object both surfaces now converge on.
What: ProjectBinding (None | Directory | GitRepo), BindingError,
and is_git_worktree — the crate’s one git-detection implementation.
Binding is NOT gated on .git: a non-git directory is a bound, indexing
state (#2728/#2747).
Test: binding::tests::*.
Project binding — the ONE typed object task.run and session.create
converge on (spec DOC-39 §4.2/§5.5, ACs 2.1–2.4 and 16.1–16.3).
Why: “project” was one concept split across two disagreeing API surfaces.
task.run took a REQUIRED project: PathBuf (task/protocol.rs:48), which
made a projectless workstream — Bob-mandated, and the entry state screen 7a
renders — literally impossible to express. session.create took an untyped,
free-form project: Option<String> label (session/protocol.rs:157) that was
never validated, never bound, and disconnected from the path task.run
demanded. A label that cannot be indexed and a path that cannot be omitted are
two halves of one missing object. ProjectBinding is that object.
What: a three-state enum, matching the spec’s §4.2 table exactly:
| State | Indexing | Git affordances |
|---|---|---|
ProjectBinding::None — projectless | none | none |
ProjectBinding::Directory — bound, non-git | yes | none |
ProjectBinding::GitRepo — bound, git worktree | yes | full |
Binding is NOT gated on .git. The design proposal this spec corrects
claimed work binds “the moment work touches files in a git repo”; that rule
would exclude the non-git working dirs (#2728) and OS temp dirs (#2747) we
deliberately support and have already shipped. Directory is a first-class
BOUND state that indexes — it is emphatically not a synonym for projectless.
The git/non-git split exists only to decide which git affordances are
offered, never whether the project binds or indexes.
Test: binding::tests::*.
Enums§
- Binding
Error - Why a path could not be resolved into a bound
ProjectBinding. - Project
Binding - A workstream’s project binding — zero or one project, in one of three states.
Constants§
- STATE_
DIRECTORY - The wire
statediscriminant forProjectBinding::Directory. - STATE_
GIT_ REPO - The wire
statediscriminant forProjectBinding::GitRepo. - STATE_
PROJECTLESS - The wire
statediscriminant forProjectBinding::None.
Functions§
- is_
git_ worktree - Whether
rootis inside a git worktree.