Skip to content

Commit 81be759

Browse files
committed
chore(xtask): rename strand branch prefix beads/ -> braid/
bd-yjh1y117. Add a shared strand_branch() helper emitting braid/<leaf>, used by create-worktree and switch-task; update the worktree conventions and skill docs. The beads/ prefix was a historical git namespace from before the braid migration; remote work-type prefixes (bugfix/, feature/) are unchanged.
1 parent cb20e8e commit 81be759

5 files changed

Lines changed: 48 additions & 21 deletions

File tree

.claude/rules/worktrees.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ the *shape* of the work, not on the strand boundary.
3636

3737
That switches the current worktree to `feature/q2-preview-command`,
3838
fast-forward-pulls (so any sibling sub-tasks that merged in the
39-
meantime show up), creates a fresh `beads/bd-yxqt-<slug>` topic
39+
meantime show up), creates a fresh `braid/bd-yxqt-<slug>` topic
4040
branch off the new tip, marks the braid strand `in_progress` (via
4141
`braid update`), and rewrites the `CLAUDE.local.md` context block.
4242
Omit `--from` to branch off the current HEAD.
@@ -53,7 +53,7 @@ Each sub-task lives on its own topic branch. When a sub-task closes:
5353

5454
```bash
5555
git switch feature/q2-preview-command
56-
git merge --no-ff beads/<id>-<slug>
56+
git merge --no-ff braid/<id>-<slug>
5757
git push origin feature/q2-preview-command
5858
```
5959

@@ -70,17 +70,18 @@ All worktrees live in `.worktrees/` at the project root. This directory is git-i
7070
## Branch naming
7171

7272
- **GH issue triage worktree** → branch `issue-<N>` at `.worktrees/issue-<N>/`. Local branch stays bare; only the remote uses a prefix (see § Pushing for PR).
73-
- **Braid strand investigation worktree** → branch `beads/<id>-<slug>` at `.worktrees/<id>-<slug>/`, where `<slug>` is a short kebab-case form of the strand title (3–5 words, lowercase).
74-
- **In-place sub-task branch (via `switch-task`)** → branch `beads/<id>-<slug>` *without* a corresponding `.worktrees/` directory; the branch lives wherever the caller's worktree is checked out.
73+
- **Braid strand investigation worktree** → branch `braid/<id>-<slug>` at `.worktrees/<id>-<slug>/`, where `<slug>` is a short kebab-case form of the strand title (3–5 words, lowercase).
74+
- **In-place sub-task branch (via `switch-task`)** → branch `braid/<id>-<slug>` *without* a corresponding `.worktrees/` directory; the branch lives wherever the caller's worktree is checked out.
7575

7676
The directory mirrors the leaf of the branch name. The conventions are stable so colleagues and tooling can recognize a worktree's origin from the path alone.
7777

78-
> **Note on the `beads/` branch prefix.** It is a *historical* git
79-
> namespace, kept after the braid migration because the xtask code emits
80-
> it and tooling/muscle-memory recognize it. It does not imply beads is
81-
> involved — the strand lives in the braid skein. Renaming the prefix to
82-
> `braid/` is a separable future cleanup (it would touch
83-
> `create_worktree.rs`, `switch_task.rs`, and this convention together).
78+
> **Note on the `braid/` branch prefix.** It is a plain git namespace —
79+
> the strand lives in the braid skein, and the branch name just mirrors
80+
> its id. It was renamed from the historical `beads/` prefix (bd-yjh1y117)
81+
> after the beads→braid migration; the emitter is `strand_branch()` in
82+
> `create_worktree.rs`, shared by `create-worktree` and `switch-task`.
83+
> Pre-rename branches/worktrees may still carry `beads/` locally; that is
84+
> harmless.
8485
8586
## Fresh worktree bootstrap
8687

@@ -170,14 +171,14 @@ which is regenerated from the skein and never hand-edited or re-imported.
170171

171172
## Pushing for PR
172173

173-
Local branch names stay bare (`issue-<N>`, `beads/<id>-<slug>`). The remote branch name uses a prefix that reflects the work type — `bugfix/`, `feature/`, etc.:
174+
Local branch names stay bare (`issue-<N>`, `braid/<id>-<slug>`). The remote branch name uses a prefix that reflects the work type — `bugfix/`, `feature/`, etc.:
174175

175176
```bash
176177
# GH issue, bug fix
177178
git push -u origin issue-<N>:bugfix/issue-<N>
178179

179180
# Braid strand, feature work
180-
git push -u origin beads/<id>-<slug>:feature/<id>-<slug>
181+
git push -u origin braid/<id>-<slug>:feature/<id>-<slug>
181182
```
182183

183184
This keeps local branches short and consistent while remote refs are self-describing in PR lists.
@@ -188,7 +189,7 @@ If `cargo xtask create-worktree` is unavailable (fresh clone before first build,
188189
the xtask binary is broken on the current branch), fall back to manual setup:
189190

190191
```bash
191-
git worktree add -b beads/<id>-<slug> .worktrees/<id>-<slug> main
192+
git worktree add -b braid/<id>-<slug> .worktrees/<id>-<slug> main
192193
```
193194

194195
No redirect step is needed (see § Braid skein resolution above). Verify with

.claude/skills/investigate-beads/references/plan-skeleton-template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Copy the body below into `claude-notes/plans/YYYY-MM-DD-<slug>.md` and fill it i
77

88
**Date:** YYYY-MM-DD
99
**Beads:** bd-XXXX
10-
**Worktree:** `.worktrees/<id>-<slug>` (branch `beads/<id>-<slug>`, based on `main` @ `<short-sha>`)
10+
**Worktree:** `.worktrees/<id>-<slug>` (branch `braid/<id>-<slug>`, based on `main` @ `<short-sha>`)
1111
**Status:** Investigation — pending design alignment with user. **Do not start implementation until the user gives the go-ahead.**
1212

1313
## Triage verdict

.claude/skills/preview-render-parity/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ EOF
151151
)"
152152
# braid prints the new strand id on stdout. Capture it as <id>.
153153
braid update <id> --status in_progress
154-
git switch -c beads/<id>-<short-slug>
154+
git switch -c braid/<id>-<short-slug>
155155
```
156156

157-
bd-kw93 is the q2-preview epic; every parity sub-strand is parent-child to it. (The git branch prefix stays `beads/` — a stable historical namespace.)
157+
bd-kw93 is the q2-preview epic; every parity sub-strand is parent-child to it. (The git branch prefix is `braid/` — a plain git namespace, renamed from the historical `beads/` in bd-yjh1y117.)
158158

159159
### Write the failing test FIRST
160160

@@ -222,7 +222,7 @@ git commit -m "...(bd-<id>)"
222222

223223
# Merge --no-ff into the integration branch
224224
git switch feature/q2-preview-command
225-
git merge --no-ff beads/<id>-<slug> -m "Merge bd-<id>: <one-line>"
225+
git merge --no-ff braid/<id>-<slug> -m "Merge bd-<id>: <one-line>"
226226

227227
# Push (only after explicit user OK, per CLAUDE.md GIT PUSH POLICY)
228228
git push origin feature/q2-preview-command

crates/xtask/src/create_worktree.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,15 @@ pub fn validate_slug(slug: &str) -> Result<()> {
107107
Ok(())
108108
}
109109

110+
/// Local git branch name for a braid strand's worktree / topic branch:
111+
/// `braid/<leaf>`, where `<leaf>` is `<id>-<slug>`. The `braid/` prefix is a
112+
/// plain git namespace (renamed from the historical `beads/` — bd-yjh1y117); it
113+
/// does not imply beads involvement. Remote refs use a work-type prefix
114+
/// (`bugfix/`, `feature/`) chosen at push time, not here.
115+
pub fn strand_branch(leaf: &str) -> String {
116+
format!("braid/{leaf}")
117+
}
118+
110119
#[derive(clap::Args)]
111120
#[command(group(clap::ArgGroup::new("mode").required(true).multiple(false)))]
112121
pub struct Args {
@@ -742,7 +751,7 @@ fn plan_braid(id: &str, slug_override: Option<&str>, base: &str, repo_root: &Pat
742751
eprintln!("note: external_ref {other:?} is not a `gh-` reference; omitting GitHub line");
743752
}
744753
Ok(Plan {
745-
branch: format!("beads/{leaf}"),
754+
branch: strand_branch(&leaf),
746755
dir: repo_root.join(".worktrees").join(&leaf),
747756
base: base.to_string(),
748757
kind: SectionKind::Braid {
@@ -1035,6 +1044,23 @@ mod tests {
10351044
);
10361045
}
10371046

1047+
#[test]
1048+
fn strand_branch_uses_the_braid_prefix() {
1049+
assert_eq!(
1050+
strand_branch("bd-abcd-some-slug"),
1051+
"braid/bd-abcd-some-slug"
1052+
);
1053+
let b = strand_branch("bd-x");
1054+
assert!(
1055+
b.starts_with("braid/"),
1056+
"strand branch must use the braid/ prefix: {b}"
1057+
);
1058+
assert!(
1059+
!b.starts_with("beads/"),
1060+
"historical beads/ prefix must be gone: {b}"
1061+
);
1062+
}
1063+
10381064
#[test]
10391065
fn repo_root_returns_absolute_directory_with_dot_git() {
10401066
// Test runs inside this checkout, so repo_root() must succeed and

crates/xtask/src/switch_task.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//! That:
1818
//! 1. switches the current worktree to `feature/q2-preview-command`
1919
//! and runs `git pull --ff-only` so it picks up siblings' merges,
20-
//! 2. creates a new topic branch `beads/<id>-<slug>` off the new
20+
//! 2. creates a new topic branch `braid/<id>-<slug>` off the new
2121
//! tip,
2222
//! 3. marks the braid strand `in_progress`,
2323
//! 4. rewrites the `<!-- BEGIN/END WORKTREE CONTEXT -->` block in
@@ -33,7 +33,7 @@ use std::process::Command;
3333

3434
use crate::create_worktree::{
3535
IssueMetadata, SectionKind, build_section, derive_slug, fetch_issue_metadata,
36-
parse_external_ref_to_github_url, update_claude_local_md, validate_slug,
36+
parse_external_ref_to_github_url, strand_branch, update_claude_local_md, validate_slug,
3737
};
3838

3939
/// Find the *current worktree's* root via `git rev-parse --show-toplevel`.
@@ -84,7 +84,7 @@ pub fn run(args: Args) -> Result<()> {
8484
}
8585
None => derive_slug(&meta.title)?,
8686
};
87-
let branch = format!("beads/{}-{}", args.beads_id, slug);
87+
let branch = strand_branch(&format!("{}-{}", args.beads_id, slug));
8888

8989
if let Some(from) = args.from.as_deref() {
9090
// Best-effort fetch so origin/<from> reflects the latest tip.

0 commit comments

Comments
 (0)