Repository navigation
feat: adopt sc-/type branch convention for crews - #1
Merged
Merged
Conversation
Crew branches were always `fm/<id>`. Switch the scaffolded ship brief to the new convention: - Ticket-mandated repos (AGENTS.md requires a Shortcut story): create the story first, then branch `sc-<story-id>-<short-slug>`. - Ticketless work, including the firstmate repo itself: branch `<type>/<short-slug>` with a conventional-commit type. - Never `fm/` for a branch; that prefix stays reserved for the work window. The scaffold cannot detect whether a repo mandates a ticket, so the brief emits both rules and has the crewmate pick, mirroring its other conditional steps. Every PR is now ticketed except genuinely-ticketless firstmate-repo work. The PR title must carry an `sc-<story-id>: ` or `<type>: ` prefix so it is visible and Shortcut auto-links the story. no-mistakes generates the PR title, so the no-mistakes brief now tells the crewmate to edit the title right after the PR opens; direct-PR sets it at creation. Consumer scripts that assumed an `fm/<id>` branch are updated to read the actual branch instead: - fm-merge-local.sh hardcoded `fm/<id>` with no fallback, so local-only landing would have broken. It now discovers the ready branch from the task worktree HEAD, keeping every existing merge guard. - fm-review-diff.sh dropped its dead `fm/<id>` first-try (it already fell back to the worktree branch). - fm-promote.sh relays the new branch convention in its ship instructions. - fm-bearings-snapshot.sh labels a candidate PR by its head branch instead of stripping `fm/` (which now yields "-" for every PR). - fm-tangle-lib.sh comment example refreshed. Window naming (`fm-<id>`) and teardown/pr-check are unchanged: teardown and fm-pr-check already read the actual branch, and the tangle guard keys on "named non-default branch", not the prefix. docs/architecture.md branch-naming reference updated. Backend-verification evidence docs keep their historical `fm/` branch names as recorded facts. Extends tests/fm-brief.test.sh with branch/PR-title coverage and updates tests/fm-tangle-guard.test.sh and tests/fm-bearings-snapshot.test.sh for the new convention.
…ffices Shortcut (and equivalent trackers) auto-link a PR from the branch name alone: a branch named sc-<id>-<slug> links without any PR-title prefix. The title prefix was never needed for linking, and the no-mistakes path could not set it cleanly anyway (no-mistakes drafts the title itself). Remove all PR-title machinery and keep the convention to branch names only: - ticket-mandated repos (+ticket:<prefix> flag): branch <prefix>-<ticket-id>-<slug>; the tracker auto-links from the branch name. - ticketless work (including this repo): branch <type>/<slug>. - windows keep the fm- prefix (unchanged). Removes PR_TITLE_RULE / COMMIT_SUBJECT_RULE and their injection into every delivery-mode definition of done, the commit-subject-prefix trick, and the direct-PR set-title-at-creation line, plus the matching header, skill, CONTRIBUTING, and test assertions. Also folds the independent review's trims: - Drop .serena/ from .gitignore - a local MCP tool dir has no place in a shared public template. - Safety: an unrecognized mode NAME in a registered bracket now REFUSES (fm-project-mode.sh exits non-zero, no stdout) instead of defaulting to the remote-pushing no-mistakes, so a mistyped local-only project can never become a push-and-PR project. Every consumer fails closed on that exit: fm-fleet-sync.sh skips the project (and no longer discards the warning), fm-brief.sh and fm-spawn.sh abort, and fm-home-seed.sh returns an error. - Soften the fm-merge-local.sh header overclaim (the no-other-task guarantee holds only while the worktree HEAD is readable). - Note the fm-bearings.v1 candidate_prs task->branch field change. Adds a fm-project-mode.sh refuse test and updates the brief and project-mode tests for the branch-only convention.
…umers Second-opinion review of the PR-title removal surfaced real gaps, several in this branch's own safety work: - fm-project-mode.sh: the unknown-mode refusal only fired for a position-1 mode. A typo written after a flag (e.g. `[+yolo locl-only]`) fell through to the remote-pushing no-mistakes default, worse with +yolo. Now a leftover bracket token with no valid position-1 mode also refuses (exit 3). - fm-spawn.sh: the fail-closed abort on an unresolvable mode ran after the window and worktree were created, stranding an orphan with no meta. Resolve the mode before any window/worktree is acquired so the abort leaks nothing. - fm-merge-local.sh: a --branch naming the default branch, or any no-op fast-forward, was reported as a successful land. Refuse a ready branch equal to the default and treat before==after as a failure. - fm-promote.sh: emit the concrete branch rule from the project's ticket flag (ticket-first for a +ticket project, else <type>/<slug>) so a promoted scout on a ticket-mandated project does not branch without its ticket and lose the auto-link; fail closed on an unresolvable mode before flipping state. - Trim stale PR-title prose left in fm-project-mode.sh and README.md. Also folds the reviewer's small trims: drop .serena/ from .gitignore (a local tool dir has no place in a public template), soften the fm-merge-local header overclaim, and note the fm-bearings.v1 candidate_prs task->branch field change. Adds tests for the flag-first mode typo refusal and the ready-branch-equals- default refusal. Lint clean (shellcheck 0.11.0); affected suites pass.
Two issues the full-suite run surfaced:
- bin/fm-brief.sh: removing the PR-title lines left the no-mistakes
definition-of-done heredoc with a single unbalanced apostrophe
("firstmate's"). macOS system bash 3.2 mis-parses an odd apostrophe count
inside a heredoc nested in $( ... ) (the issue kunchenguid#166 class), so the scaffold
failed to parse and every brief-dependent test cascaded. Rephrased to remove
the apostrophe; verified with `/bin/bash -n` under 3.2.57.
- tests/fm-test-run.test.sh: test_jobs_parallel_scheduler_and_failure_propagation
asserted an exact scheduler ordering (the replacement fixture must start before
the slow worker finished), which is inherently timing-flaky under load and was
intermittently failing the suite. Dropped that exact-ordering assertion per the
review ruling and kept the robust safety properties: all proven scripts run to
completion under --jobs 2, failures propagate, non-proven scripts are refused,
and gate-skips are recorded. Confirmed stable across repeated runs.
The bash 3.2 apostrophe fix reworded the no-mistakes brief's "Avoid --yes" line from "firstmate's authority check" to "the authority check firstmate applies". tests/fm-ask-user-authority.test.sh pins that exact sentence to prove the brief forbids silent ask-user auto-resolution, so update its expected string to match the new (apostrophe-free) wording.
…, 3.2 test) Carries over the fixes the no-mistakes pipeline surfaced during validation so the branch stands on its own: - bin/fm-spawn.sh: catch a metadata-publish redirection failure explicitly. Stock bash 3.2 does not trip errexit on a compound command's redirection error (bash 5 does), so an unwritable state/<id>.meta silently continued and left an unrecorded endpoint; now it errors and keeps the backend abort-cleanup armed. - bin/fm-promote.sh: stop discarding fm-project-mode.sh stderr, so the fail-closed diagnostics (invalid-prefix warning, refusal reason) reach the operator. - tests/fm-brief.test.sh: parse the scaffold under /bin/bash too, giving a macOS developer the same stock-bash (3.2) signal a CI stock-bash lane would. - tests/fm-project-mode.test.sh: drop the stale "and PR-title" from the header comment, matching the branch-name-only convention. Deferred: a repo-wide stock-bash-3.2 parse sweep in .github/workflows/ci.yml was also produced by the gate, but pushing a workflow change needs a token with the `workflow` scope, which this one lacks; it is a separable CI-infra follow-up. .serena/ (the review agent's local MCP scratch dir) is deliberately not tracked and stays out of the shared .gitignore, per the captain ruling.
Trim-and-clarify pass; no behavior change (convention, fm-merge-local safety,
+ticket parsing, and the consent-boundary refuse are all untouched).
Smaller: tightened the verbose header/inline comments in fm-brief.sh,
fm-merge-local.sh, and fm-project-mode.sh to their load-bearing essentials
(net -32 lines). The behavior, its guards, and the tests that lock them stay.
Prescriptive wording: rewrote the crew-facing and doc prohibitions into the
positive rule the reader should follow -
- brief scaffold: "Never name the branch fm/..." -> "The fm/ prefix names the
work window; branch names use the rule above"; dropped the redundant
"- do not stop for this" from the collision-recovery step.
- fm-promote ship-instruction hints: dropped the trailing ", never fm/..."; the
positive branch rule is already stated.
- CONTRIBUTING.md: "A branch is never named fm/..." -> "The fm/ prefix names a
crewmate's work window, not its branch".
Kept as genuine warnings only the crew safety rules ("Never push to the default
branch. Never merge a PR.") and the runtime refusal diagnostics, which have no
positive equivalent.
Test assertions updated to the reworded brief/--help text.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Changes firstmate's crewmate branch-naming convention. Crews previously always branched
fm/<task-id>. The new convention, owned bybin/fm-brief.shand keyed off a per-project+ticket:<prefix>registry flag indata/projects.md(parsed bybin/fm-project-mode.sh):+ticket:<prefix>): the crewmate creates or links the tracker ticket first (e.g. the Shortcut MCP for a Shortcut project), then branches<prefix>-<ticket-id>-<short-slug>. The tracker's GitHub integration auto-links purely from the branch name.<type>/<short-slug>with a conventional-commit type (feat/fix/chore/docs).fm/...; that prefix stays reserved for the work window (fm-<id>), which is unchanged.Linking is by branch name only - no PR-title machinery.
Consumers converted off the
fm/<id>assumptionfm-merge-local.sh: derives the ready branch from the task worktree HEAD, with a safety-guarded--branchfallback that refuses a name disagreeing with a readable HEAD, refuses a ready branch equal to the default, and refuses no-op merges. Now also guards an emptyproject=and errors when metadata cannot be published (a stock-bash-3.2set -egap).fm-review-diff.sh,fm-promote.sh(emits the concrete ticket-first-or-<type>rule),fm-bearings-snapshot.sh(task->branchfield),fm-tangle-lib.sh.Safety / consent boundary
An unrecognized mode name in a registered bracket now refuses (
fm-project-mode.shexits non-zero, no stdout) instead of defaulting to the remote-pushingno-mistakes- including a mode typo'd after the flags. Every consumer fails closed before acquiring resources:fm-spawnresolves the mode before creating any window/worktree,fm-fleet-syncskips the project, andfm-brief/fm-promoteabort.Docs / tests
AGENTS.mdstates no branch convention (the scaffold is the single owner);CONTRIBUTING.md,README.md,docs/architecture.md,docs/scripts.md, and theproject-managementskill are updated for branch-name-only linking. New/extended colocated tests cover the branch convention, the+ticketparser (including the refuse cases),fm-merge-localbranch resolution, andfm-review-diff. Lint clean (shellcheck 0.11.0); scaffold verified to parse under stock bash 3.2.All captain rulings from review are folded in (branch-name-only linking,
fm-merge-localsafety,+ticketflag with generic tracker wording and no private repo names, consent-boundary refuse, the de-flaked jobs scheduler test).A repo-wide stock-bash-3.2 CI parse sweep was also produced during review but is deferred as a separate CI-infra follow-up (pushing a workflow change needs a token
workflowscope this one lacks).