pcbjam/.claude/skills/git-feature-finish/SKILL.md
Gergő Törcsvári 0665b30762
chore(skills): include pcbjam-shared in the git-feature workflow
The pcbjam repo's own git-feature skills + scripts/git-workflow predated the
web/pcbjam-shared submodule and only covered root+kicad+wxwidgets. Add the MIT
contract repo as a fourth member everywhere:

- repos.sh: pcbjam_shared key (path web/pcbjam-shared, main `main`) + layout doc.
- assert-clean.sh / for-each-repo.sh: count-agnostic wording.
- git-feature-start/commit/sync/finish SKILL.md: pcbjam-shared in the branch /
  commit (kicad, wxwidgets, pcbjam-shared, then root) / rebase (root first) /
  finish orders; root pointer-bump staging + diff now include web/pcbjam-shared,
  and the root stage step excludes it like the other submodule trees.

Mirrors the root pcbjam-private skills, which already covered shared.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-12 14:05:40 +02:00

4.7 KiB

name description
git-feature-finish Merge the current feature branch back to main (fast-forward only) and push, across all 4 repos. Submodules first (kicad, wxwidgets, pcbjam-shared), then root - so the root push includes the merged submodule SHAs. Stops for confirmation at each merge and push. Usage - "/git-feature-finish".

git-feature-finish

Land the current feature branch into each repo's main and push. Uses --ff-only for clean linear history.

Per-repo main mapping is in scripts/git-workflow/repos.sh (root=main, kicad/wxwidgets=wasm-port, pcbjam-shared=main).

Pre-flight (all of these must pass before any merge happens)

  1. Fetch every origin FIRST. Run bash scripts/git-workflow/for-each-repo.sh fetch origin. This is mandatory and must happen before the status snapshot. repo-status.sh derives up_to_date_with_main from the local origin/<main> ref without fetching — so without this step a repo whose origin has moved looks "up to date", check 5 passes, and the staleness is only discovered mid-merge (the pull --ff-only in the steps below would catch it, but then you've already merged the earlier repos). Fetching here makes the pre-flight STOP cleanly with "run /git-feature-sync first" instead of bailing partway through.
  2. Run bash scripts/git-workflow/repo-status.sh. Parse the JSON. Because step 1 just fetched, up_to_date_with_main now reflects true remote state.
  3. All 4 repos must have dirty: false. If any is dirty, STOP and tell the user to commit (/git-feature-commit) or stash first.
  4. All 4 repos must be on the same feature branch (use root's branch as the reference). If not, STOP and report the mismatch.
  5. All 4 repos must have up_to_date_with_main: true (i.e. the feature is rebased onto the latest main). If any isn't, STOP and instruct: "run /git-feature-sync first".
  6. None may have rebase_in_progress: true. If so, STOP.

Steps — order: kicad, wxwidgets, pcbjam-shared, root

Submodules first so that when root checks out main and merges its feature branch, the pointer-bump commits land on root's main referencing the just-merged submodule mains.

For each repo in order [kicad, wxwidgets, pcbjam-shared, root]:

  1. Skip if already merged: run git -C <path> branch --merged <main> and check if the feature branch appears. If so, print ": feature already merged into

    , skipping merge+push" and proceed to step 5 (branch delete prompt).

  2. Prose-ask: "About to merge <feature> into <main> in (ff-only) — proceed?"

  3. Run, echoing each:

    • git -C <path> checkout <main> (auto-allowed)
    • git -C <path> pull --ff-only (auto-allowed) — if this fails because main moved with non-ff changes, STOP and tell the user: ": main moved with non-ff changes since last sync. Run /git-feature-sync and try again." Do NOT try --no-ff.
    • git -C <path> merge --ff-only <feature> (hits ask permission — user reconfirms at tool layer). If this fails because main moved in a way that breaks ff, STOP with the same message as above.
  4. Prose-ask: "Push 's

    to origin? — proceed?"

    • git -C <path> push (hits ask permission).
  5. Prose-ask: "Delete local feature branch <feature> in ?"

    • git -C <path> branch -d <feature> (hits ask permission). This is safe (-d, not -D) — git refuses if the branch isn't fully merged, which is exactly the safety we want.

After all 4 repos done

Report a summary table:

kicad:     merged feature/foo into wasm-port, pushed (origin/wasm-port now at <sha>), branch deleted
wxwidgets: merged feature/foo into wasm-port, pushed (origin/wasm-port now at <sha>), branch deleted
pcbjam-shared: merged feature/foo into main, pushed (origin/main now at <sha>), branch deleted
root:      merged feature/foo into main,      pushed (origin/main now at <sha>),      branch deleted

If features/<feature>/ exists from scripts/create-feature-patches.sh, mention it but do NOT auto-delete. The user may want to keep the patches as history.

Edge cases

  • Feature already merged in some repos but not all: the per-repo --merged check handles this naturally — finish skips re-merging and just offers branch delete.
  • No local feature branch left to delete in some repo: branch -d will fail; report and continue. Don't make this fatal.
  • -u first-push: this workflow never pushes feature branches, only mains. Mains always have tracking already.

Safety

  • --ff-only everywhere, no fallback to --no-ff.
  • branch -d not -D — never force-delete.
  • Never --force push. The settings.json deny rule blocks this regardless.
  • Always echo commands before running.
  • Always pose the prose confirmation BEFORE invoking the tool-layer prompt.