Skip to content

Make generated briefs forge-aware (github/gitlab) - #2519

Open
tieptoi wants to merge 4 commits into
kunchenguid:mainfrom
tieptoi:fm/firstmate-brief-forge-awareness
Open

Make generated briefs forge-aware (github/gitlab)#2519
tieptoi wants to merge 4 commits into
kunchenguid:mainfrom
tieptoi:fm/firstmate-brief-forge-awareness

Conversation

@tieptoi

@tieptoi tieptoi commented Aug 17, 2026

Copy link
Copy Markdown

Problem

bin/fm-brief.sh scaffolds hardcoded GitHub wording in every generated brief: Rules say "Use gh-axi for GitHub operations", Definition-of-done says "open PR with gh-axi". Every dispatch to a GitLab-hosted project needs hand-replaced glab and merge-request vocabulary — a recurring per-dispatch tax and a defect source for every GitLab-based fleet.

Design

  • --forge <github|gitlab> — explicit mechanism for crewmate ship and scout scaffolds; invalid values and the internal auto sentinel are refused loudly. Secondmate charter scaffolds are forge-neutral and refuse the flag.
  • Auto-detection is best-effort when the flag is absent, from the clone origin at $FM_HOME/projects/<repo-name> (honoring the documented FM_PROJECTS_OVERRIDE location): github.com origin → github; any host containing gitlab → gitlab; anything else (missing clone, self-hosted host without gitlab in the name, non-git placeholder directory) → forge-neutral wording and a loud scaffold-time warning.
  • The flag wins over detection.
  • Scaffolded geography is forge-specific end to end: github uses gh-axi and PR; gitlab uses glab and merge request/MR; neutral uses vague "your forge CLI" and PR/MR wording — in Rules, Setup, Definition-of-done, and the no-mistakes Direct-PR pipeline instructions.
  • Not enabled in this change: per-hostname forge-detection configuration for self-hosted GitLab hosts whose URL does not contain gitlab (e.g. noc-git.orion.co.com) — a deliberate follow-up, out of scope here.

Companion classifier fix (bin/fm-crew-state.sh)

Firstmate's CI-ready reconciliation classifier matched only *PR*"checks green"*. A gitlab-flavored no-mistakes wrapper appends done: MR <url> checks green, which never registered as CI-ready. Widened to also match the MR spelling so gitlab-dispatched tasks complete end-to-end.

Tests

tests/fm-brief.test.sh: explicit github/gitlab vocabulary assertions for ship, no-mistakes, and scout scaffolds; auto-detection fixtures for github.com, gitlab.example.com, unrecognized self-hosted hosts, missing clones, and non-git placeholder directories; --forge auto sentinel refusal; refusal rows moved to the correct test table.

Verified: 22/22 tests pass (also under stock macOS Bash 3.2), bin/fm-lint.sh clean, no-mistakes review/test/document/lint steps all green locally.

gary.nguyen added 4 commits August 17, 2026 16:55
fm-brief.sh scaffolds hardcoded gh-axi/PR wording, so every dispatch to a
GitLab-hosted project needs hand-replaced glab and merge-request vocabulary.

- Add --forge <github|gitlab>, the explicit mechanism for crewmate ship and
  scout scaffolds; secondmate charters are forge-neutral and refuse it.
- Best-effort auto-detection from the clone origin at
  $FM_HOME/projects/<repo-name> when the flag is absent: github.com chooses
  github, any host containing gitlab chooses gitlab, anything else (missing
  clone, self-hosted host without gitlab in its name) scaffolds forge-neutral
  wording - your forge CLI, PR/MR - and warns loudly at scaffold time.
- The flag wins over detection; an invalid value is refused loudly.

Extend tests/fm-brief.test.sh: explicit github/gitlab vocabulary for ship,
no-mistakes, and scout scaffolds; auto-detection fixtures for github.com,
gitlab.example.com, unrecognized self-hosted hosts, and missing clones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant