- Remove homelab special-case from commit-push command (all repos now use origin) - Update sync-config to use origin remote instead of homelab - Enhance card generation with season-pct params, CLI reference, and validation fixes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
46 lines
2.3 KiB
Markdown
46 lines
2.3 KiB
Markdown
Commit all staged/unstaged changes, push to remote, and optionally create a PR.
|
|
|
|
**This command IS explicit approval to commit and push — no need to ask for confirmation.**
|
|
|
|
## Arguments: $ARGUMENTS
|
|
|
|
If `$ARGUMENTS` contains "pr", also create a pull request after pushing.
|
|
|
|
## Steps
|
|
|
|
1. Run `git status` to see what has changed (never use `-uall`)
|
|
2. Run `git diff` to see staged and unstaged changes
|
|
3. Run `git log --oneline -5` to see recent commit style
|
|
4. If there are no changes, say "Nothing to commit" and stop
|
|
5. Determine the remote name and current branch:
|
|
- Remote: use `git remote` (if multiple, prefer `origin`)
|
|
- Branch: use `git branch --show-current`
|
|
6. Stage all relevant changed files (prefer specific files over `git add -A` — avoid secrets, .env, credentials)
|
|
7. Draft a concise commit message following the repo's existing style (focus on "why" not "what")
|
|
8. Create the commit with `Co-Authored-By: Claude <model> <noreply@anthropic.com>` where `<model>` is the model currently in use (check your own model identity — e.g., Opus 4.6, Sonnet 4.5, Haiku 4.5)
|
|
9. Push to the remote with `-u` flag: `git push -u <remote> <branch>`
|
|
10. Confirm success with the commit hash
|
|
|
|
## If `pr` argument is present
|
|
|
|
After pushing, create a pull request:
|
|
|
|
1. Detect the hosting platform:
|
|
- If remote URL contains `github.com` → use `gh pr create`
|
|
- If remote URL contains `git.manticorum.com` or other Gitea host → use `tea pulls create`
|
|
2. Determine the default branch: `git symbolic-ref refs/remotes/<remote>/HEAD | sed 's|.*/||'` (fallback to `main`)
|
|
3. Run `git log <default-branch>..HEAD --oneline` to summarize all commits in the PR
|
|
4. Create the PR:
|
|
- **GitHub**: `gh pr create --base <default-branch> --title "Title" --body "..."`
|
|
- **Gitea**: `tea pulls create --head <branch> --base <default-branch> --title "Title" --description "..."`
|
|
5. Include a summary section and test plan in the PR body
|
|
6. Return the PR URL
|
|
|
|
## Important
|
|
|
|
- This command IS explicit approval to commit, push, and (if requested) create a PR
|
|
- Do NOT ask for confirmation — the user invoked this command intentionally
|
|
- If push fails, show the error and suggest remediation
|
|
- Never force push unless the user explicitly says to
|
|
- If on `main` branch and `pr` is requested, warn that PRs are typically from feature branches
|