Skip to content

Commit 558d808

Browse files
committed
chore(skills): harden git-commit-push for Windows shells
Add cross-shell commit-message guidance and switch credential-helper remediation commands to mise-managed gh to reduce recurring push and heredoc failures. Made-with: Cursor
1 parent 21cf1fb commit 558d808

1 file changed

Lines changed: 34 additions & 8 deletions

File tree

  • home/dot_config/opencode/skills/git-commit-push

home/dot_config/opencode/skills/git-commit-push/SKILL.md

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: git-commit-push
3-
description: Execute a safe commit-and-push workflow with parallel git context checks, GitHub CLI credential diagnostics, and non-fast-forward rebase remediation. Use when the user asks to commit and push changes.
3+
description: Execute a safe commit-and-push workflow with parallel git context checks, cross-shell-safe commit message handling, and non-fast-forward remediation. Use when the user asks to commit and push changes.
44
---
55

66
## Goal
@@ -10,7 +10,7 @@ Capture the exact workflow for commit and push requests:
1010
1. Run three repo-inspection commands in parallel.
1111
2. Commit with a message that matches repo style.
1212
3. Push.
13-
4. If auth fails, run two diagnostics in parallel and retry push with `gh` credential helper.
13+
4. If auth fails, run two diagnostics in parallel and retry push with a `mise x -- gh` credential helper.
1414
5. If non-fast-forward, rebase onto `origin/main` and push again.
1515

1616
## Step 1, run three parallel checks
@@ -29,7 +29,7 @@ Use the outputs to:
2929

3030
## Step 2, stage and commit
3131

32-
Stage intended files and commit using a heredoc message.
32+
Stage intended files and commit using a shell-safe multiline message strategy.
3333

3434
Template:
3535

@@ -42,6 +42,23 @@ EOF
4242
)"
4343
```
4444

45+
Windows and mixed-shell rule:
46+
47+
- If command execution is wrapped by PowerShell, do not use bash heredoc directly.
48+
- Use a PowerShell here-string for multiline messages:
49+
50+
```powershell
51+
$msg = @'
52+
<type>(<scope>): <short why-focused subject>
53+
54+
<1-2 sentence rationale>
55+
'@
56+
git add -A
57+
git commit -m $msg
58+
```
59+
60+
- If you do use bash heredoc, invoke through `bash -lc` and keep all heredoc content inside that single bash command.
61+
4562
After commit, verify:
4663

4764
- `git status --short --branch`
@@ -61,21 +78,21 @@ If push fails with credential/auth errors, run these in parallel:
6178

6279
Then retry push with one-off helper (do not change global git config):
6380

64-
- `git -c credential.helper='!gh auth git-credential' push origin <branch>`
81+
- `git -c credential.helper='!mise x -- gh auth git-credential' push origin <branch>`
6582

6683
## Step 5, non-fast-forward remediation
6784

6885
If push is rejected with `fetch first` or non-fast-forward:
6986

70-
1. Fetch using `gh` helper:
71-
- `git -c credential.helper='!gh auth git-credential' fetch origin <branch>`
87+
1. Fetch using helper:
88+
- `git -c credential.helper='!mise x -- gh auth git-credential' fetch origin <branch>`
7289
2. Inspect divergence:
7390
- `git status --short --branch`
7491
- `git log --oneline --decorate --graph --left-right --boundary origin/<branch>...<branch> -n 20`
7592
3. Rebase local branch onto remote:
7693
- `git rebase origin/<branch>`
7794
4. Push again with helper:
78-
- `git -c credential.helper='!gh auth git-credential' push origin <branch>`
95+
- `git -c credential.helper='!mise x -- gh auth git-credential' push origin <branch>`
7996
5. Verify clean sync:
8097
- `git status --short --branch`
8198

@@ -87,4 +104,13 @@ If push is rejected with `fetch first` or non-fast-forward:
87104

88105
## Self-improvement loop
89106

90-
After each use, if any command order, diagnostics, or remediation step can be improved, update this skill in chezmoi source (`home/dot_config/opencode/skills/git-commit-push/SKILL.md`) and keep the workflow current.
107+
After each use, run this loop before ending the task:
108+
109+
1. Check command output for friction patterns:
110+
- PowerShell parse errors involving heredoc (`<<EOF`, redirection operator errors).
111+
- Credential-helper failures (`gh: command not found`, helper not executable in shell).
112+
- Rebase/push branches not handled by the current instructions.
113+
2. If a pattern appears, update this skill in chezmoi source:
114+
- `home/dot_config/opencode/skills/git-commit-push/SKILL.md`
115+
3. Keep updates concrete, command-level, and minimal.
116+
4. Re-run the failing step once to validate the skill update.

0 commit comments

Comments
 (0)