You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(bin): make the ship-branch prefix configurable per project - #2648
Add an optional branch=<prefix> annotation to the data/projects.md registry with a --branch-prefix query in bin/fm-project-mode.sh (defaulting to fm/), and thread a --branch-prefix flag through fm-brief.sh, fm-spawn.sh, and fm-promote.sh so ship tasks create and record <prefix><task-id> branches; fm-dod-lib.sh renders the resolved branch in delivery contracts under a machine-readable Ship branch: line, and spawn refuses a brief/spawn branch mismatch while persisting branch= in task meta for relaunches.
Honor the recorded branch downstream: fm-merge-local.sh and fm-review-diff.sh read it from task meta (falling back to fm/<id> for old records and refusing invalid names), fm-fleet-snapshot.sh exposes it in task JSON, and fm-bearings-snapshot.sh maps PR head refs to task IDs via recorded branches instead of stripping the fm/ prefix (task list moved to a temp file to avoid E2BIG on large fleets).
Document the prefix across README, AGENTS.md, architecture/scripts/Gerrit docs, and the project-management skill, and add branch-prefix coverage to five test suites (CI's expected Bearings test count raised 59→60).
Risk Assessment
✅ Low: Every prior finding verifies as genuinely fixed with exact merge-local parity on the refusal, a mechanically correct slurpfile temp-file path, a header-consistent unknown-mode fallback, and real behavior-level regression tests; the sole residual is a direction-dependent wording inaccuracy in one advisory notice.
Testing
Round 1's only finding is resolved: commit 2df387e (added by the fix phase) skips the two real-tasks-axi tests when the installed tasks-axi predates 0.2.6, so fm-control-relaunch and fm-bearings-snapshot now exit 0 — the bearings suite runs to completion for the first time in this environment (it previously aborted), with the skips printing an explicit reason and the branch-prefix-specific tests in both suites passing. All focused suites for the branch's touched scripts pass (fm-brief, fm-task-delivery, fm-review-diff, fm-dod-lib, fm-fleet-snapshot-view), and a manual end-to-end CLI demo over a real generated brief and registry — captured in the transcript artifact — shows the configurable prefix resolving at intake, rendering consistently across all brief sections, keeping legacy fm/ and default posture output unchanged, and refusing misuse. Visual evidence is not applicable: the change is CLI/library shell surface, so the end-user experience is command output, captured verbatim in the artifacts.
=== End-to-end demo of the configurable ship-branch prefix (branch fm/branch-prefix-config) ===
Run against the worktree checkout at HEAD (2df387e), with a scratch firstmate home.
Every command shown was executed for real; output is verbatim.
=== 1. The captain's registry (data/projects.md in the demo home) ===
- upstream-lib [local-only branch=contrib/] - a third-party repo that must not read as firstmate-authored (added 2026-09-23)
- bare-branch-lib [direct-PR branch=] - ships on a bare task-id branch (added 2026-09-23)
- legacy-lib - default posture, no prefix recorded (added 2026-09-23)
=== 2. Firstmate resolves the registered prefix at task intake (fm-project-mode.sh --branch-prefix) ===
$ for p in upstream-lib bare-branch-lib legacy-lib; do ...; done
upstream-lib: mode+yolo=[local-only off] branch-prefix=[contrib/]
bare-branch-lib: mode+yolo=[direct-PR off] branch-prefix=[]
legacy-lib: mode+yolo=[no-mistakes off] branch-prefix=[fm/]
The token is order-independent, an empty branch= resolves to "" (bare <task-id> branch),
an unannotated project keeps the legacy fm/, and the default "<mode> <yolo>" output that
existing mechanical callers consume is unchanged for every project.
=== 3. Scaffold a ship task with the resolved override (local-only mode shown) ===
$ FM_HOME=<home> bin/fm-brief.sh task-e2e some-proj --mode local-only --branch-prefix 'contrib/'
scaffolded: <home>/data/task-e2e/brief.md (ship, mode=local-only; replace {TASK} and {FIRSTMATE_SPEC})
Branch references in the generated brief (verbatim grep):
22:1. First action: create your branch: `git checkout -b contrib/task-e2e --`
25:1. Never push to any remote and never open a PR. Work only on your `contrib/task-e2e` branch; firstmate handles the merge into local `main`.
78:Ship branch: contrib/task-e2e
80:The task is complete only when committed on your branch `contrib/task-e2e`. Do NOT push, do NOT open a PR, do NOT merge.
83:When it is implemented and committed, append `done [at=<epoch>]: ready in branch contrib/task-e2e` to the status file and stop.
The override renders in every generated section: branch-creation command, never-push rule,
status line, definition-of-done text, and status-message text. No fm/task-e2e remains.
=== 4. Stock install: no flag, no annotation -> legacy fm/<task-id> unchanged ===
$ FM_HOME=<home> bin/fm-brief.sh task-e2e-legacy some-proj --mode local-only
22:1. First action: create your branch: `git checkout -b fm/task-e2e-legacy --`
25:1. Never push to any remote and never open a PR. Work only on your `fm/task-e2e-legacy` branch; ...
=== 5. Empty override resolves to a bare <task-id> branch, no leading slash ===
$ FM_HOME=<home> bin/fm-brief.sh task-e2e-bare some-proj --mode local-only --branch-prefix ''
22:1. First action: create your branch: `git checkout -b task-e2e-bare --`
25:1. Never push to any remote and never open a PR. Work only on your `task-e2e-bare` branch; ...
=== 6. Misuse is refused loudly ===
$ bin/fm-brief.sh scout-task some-proj --scout --branch-prefix contrib/
error: --branch-prefix applies only to ship briefs; a scout makes no branch and a secondmate charter is not a delivery contract (exit 1)
$ bin/fm-brief.sh bad-task some-proj --mode no-mistakes --branch-prefix 'bad prefix/'
error: --branch-prefix must not contain a space (got 'bad prefix/') (exit 1)
=== 7. Review side: bearings maps a custom-prefix PR row back to its recorded task ===
Suite run (tests/fm-bearings-snapshot.test.sh), verbatim line from the captured log:
ok - --include-prs maps a custom branch-prefix PR back to its recorded task
=== 8. Relaunch side: a promoted scout with a recorded custom branch relaunches on it ===
Suite run (tests/fm-control-relaunch.test.sh), verbatim line from the captured log:
ok - fm-spawn --relaunch: a promoted scout with a recorded custom branch relaunches on it instead of being refused
Evidence: Full fm-bearings-snapshot suite run (previously aborted; now completes with clean tasks-axi floor skips; custom-prefix PR mapping passes)
What Changed
branch=<prefix>annotation to thedata/projects.mdregistry with a--branch-prefixquery inbin/fm-project-mode.sh(defaulting tofm/), and thread a--branch-prefixflag throughfm-brief.sh,fm-spawn.sh, andfm-promote.shso ship tasks create and record<prefix><task-id>branches;fm-dod-lib.shrenders the resolved branch in delivery contracts under a machine-readableShip branch:line, and spawn refuses a brief/spawn branch mismatch while persistingbranch=in task meta for relaunches.fm-merge-local.shandfm-review-diff.shread it from task meta (falling back tofm/<id>for old records and refusing invalid names),fm-fleet-snapshot.shexposes it in task JSON, andfm-bearings-snapshot.shmaps PR head refs to task IDs via recorded branches instead of stripping thefm/prefix (task list moved to a temp file to avoid E2BIG on large fleets).Risk Assessment
✅ Low: Every prior finding verifies as genuinely fixed with exact merge-local parity on the refusal, a mechanically correct slurpfile temp-file path, a header-consistent unknown-mode fallback, and real behavior-level regression tests; the sole residual is a direction-dependent wording inaccuracy in one advisory notice.
Testing
Round 1's only finding is resolved: commit 2df387e (added by the fix phase) skips the two real-tasks-axi tests when the installed tasks-axi predates 0.2.6, so fm-control-relaunch and fm-bearings-snapshot now exit 0 — the bearings suite runs to completion for the first time in this environment (it previously aborted), with the skips printing an explicit reason and the branch-prefix-specific tests in both suites passing. All focused suites for the branch's touched scripts pass (fm-brief, fm-task-delivery, fm-review-diff, fm-dod-lib, fm-fleet-snapshot-view), and a manual end-to-end CLI demo over a real generated brief and registry — captured in the transcript artifact — shows the configurable prefix resolving at intake, rendering consistently across all brief sections, keeping legacy fm/ and default posture output unchanged, and refusing misuse. Visual evidence is not applicable: the change is CLI/library shell surface, so the end-user experience is command output, captured verbatim in the artifacts.
Evidence: End-to-end CLI transcript: registry annotation -> intake resolution -> generated brief -> refusals
Source: End-to-end CLI transcript: registry annotation -> intake resolution -> generated brief -> refusals
Evidence: Full fm-bearings-snapshot suite run (previously aborted; now completes with clean tasks-axi floor skips; custom-prefix PR mapping passes)
Source: Full fm-bearings-snapshot suite run (previously aborted; now completes with clean tasks-axi floor skips; custom-prefix PR mapping passes)