pcbjam/.claude/skills/git-feature-commit/SKILL.md
Balint Ipkovich 9ab7158057 fix(skills): make git-workflow script paths portable
All four git-feature-* skills hardcoded /Users/torcsi/dev/kicad-wasm/ for
the helper-script invocations and one documentation example. That path
only resolved on the original author's machine — anyone else picking up
/git-feature-{start,commit,sync,finish} would hit "No such file or
directory" before the first pre-flight check ran.

Replaces the absolute paths with relative ones (`bash scripts/...`) and
rewrites the rebase-conflict handoff message in git-feature-sync.md to use
`git -C kicad ...` style instead of a hardcoded cd.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-01 14:59:09 +02:00

54 lines
3.2 KiB
Markdown

---
name: git-feature-commit
description: Commit staged + unstaged work across all 3 repos. Submodules first (kicad, wxwidgets), then root with submodule pointer bumps. Asks the user to approve each commit separately and shows the pointer diff for the root commit. Usage - "/git-feature-commit [message]".
---
# git-feature-commit
Commit work-in-progress across root + kicad + wxwidgets in the correct order: **submodules first, then root** (so the root commit captures the new submodule pointers).
## Arguments
Optional positional message string. If omitted, ask the user for a message via `AskUserQuestion` before any commit step. Same message is reused across all repos (user can edit per-repo at the confirm step).
## Steps
1. **Status snapshot.** Run `bash scripts/git-workflow/repo-status.sh` to see which repos have changes.
2. **Show per-repo diff overview to the user first** (before any commit). For each repo, run:
- `git -C <path> status --short`
- `git -C <path> diff --stat HEAD`
so the user sees the full picture before being asked to commit anything.
3. **Submodule commits — kicad first, then wxwidgets.** For each submodule:
- If `git -C <path> status --porcelain` is empty AND no staged changes, print "kicad: no changes, skipping" and continue.
- Otherwise, prose-ask: "Commit kicad with message `<msg>`? Type `y`, `n`, or `edit` to change the message."
- On `y`: `git -C <path> add -A && git -C <path> commit -m "<msg>"` (auto-allowed).
- On `edit`: use `AskUserQuestion` to get a new message, then commit with that.
- On `n`: skip and continue.
4. **Root commit (last).** After submodules:
- Stage submodule pointer bumps explicitly: `git -C <root> add kicad wxwidgets` (only stages the gitlink pointer change if a submodule has a new HEAD).
- Stage other root changes: `git -C <root> add -A -- ':!kicad' ':!wxwidgets' ':!features'` (exclude submodule trees and features/ patch dir).
- Check what's staged: `git -C <root> diff --cached --stat`. If nothing is staged, print "root: no changes, skipping" and stop.
- Show the user:
- `git -C <root> diff --cached --stat` (overview)
- `git -C <root> diff --cached -- kicad wxwidgets` (the raw pointer-bump diff — the user wants to eyeball this every time)
- Prose-ask: "Commit root with message `<msg>`? `y`/`n`/`edit`."
- On `y`: `git -C <root> commit -m "<msg>"`.
5. **Report.** Print a summary of which repos committed and the new HEAD shas.
## Edge cases
- All 3 repos clean → print "nothing to commit anywhere" and stop.
- Only submodule changes, no other root changes → root commit still happens, but it'll only contain the pointer bumps. That's correct.
- Only root changes (no sub changes) → just root commits, submodules skipped.
- Submodule has commits but pointer was already bumped in a prior root commit → pointer add will be a no-op and that's fine.
## Safety
- Never use `git commit -a` (it ignores staging intent).
- Never `git add` paths outside the repo or with shell expansion that could grab unintended files.
- Always exclude `features/` from the root stage step (it contains patches that recursively include themselves if committed).
- Always echo commands before running.