|
| 1 | +--- |
| 2 | +description: Stage changes, commit with conventional commit message, and push to remote |
| 3 | +--- |
| 4 | + |
| 5 | +You are about to commit and push changes to the git repository. Follow these steps carefully: |
| 6 | + |
| 7 | +## Step 1: Analyze Current State |
| 8 | + |
| 9 | +Check the current git state: |
| 10 | +!`git status` |
| 11 | + |
| 12 | +View the changes: |
| 13 | +!`git diff` |
| 14 | + |
| 15 | +View staged changes (if any): |
| 16 | +!`git diff --staged` |
| 17 | + |
| 18 | +View recent commit history for style reference: |
| 19 | +!`git log -5 --oneline` |
| 20 | + |
| 21 | +## Step 2: Present Summary to User |
| 22 | + |
| 23 | +Before committing, you MUST: |
| 24 | + |
| 25 | +1. **Analyze all changes** (both staged and unstaged) |
| 26 | +2. **Provide a clear, concise summary** to the user including: |
| 27 | + - What files are being added/modified/deleted |
| 28 | + - The nature of the changes (new feature, bug fix, refactor, etc.) |
| 29 | + - The proposed conventional commit message you plan to use |
| 30 | +3. **Ask for confirmation** before proceeding with the commit |
| 31 | + |
| 32 | +Example summary format: |
| 33 | +``` |
| 34 | +I found the following changes: |
| 35 | +- Added: .opencode/commands/new-command.md (new custom command) |
| 36 | +- Modified: src/utils/helper.ts (refactored validation logic) |
| 37 | +
|
| 38 | +Proposed commit message: |
| 39 | +feat(commands): add new-command for automated deployment |
| 40 | +
|
| 41 | +This will create a new feature commit and push it to the remote repository. |
| 42 | +
|
| 43 | +Is it okay to proceed with this commit? |
| 44 | +``` |
| 45 | + |
| 46 | +## Step 3: Commit with Conventional Commits |
| 47 | + |
| 48 | +**IMPORTANT**: You MUST follow the Conventional Commits 1.0.0 specification. |
| 49 | + |
| 50 | +Reference the conventional commit skill: |
| 51 | +@.opencode/skills/conventional-git-commit/SKILL.md |
| 52 | + |
| 53 | +Create a commit message that: |
| 54 | +- Uses the correct type (feat, fix, docs, style, refactor, perf, test, build, ci, chore) |
| 55 | +- Includes scope if appropriate (e.g., `feat(auth):`, `fix(parser):`) |
| 56 | +- Has a clear, imperative-mood description |
| 57 | +- Includes a body if the changes need explanation |
| 58 | +- Uses `BREAKING CHANGE:` footer or `!` if there are breaking changes |
| 59 | + |
| 60 | +## Step 4: Stage, Commit, and Push |
| 61 | + |
| 62 | +Only after receiving user confirmation: |
| 63 | + |
| 64 | +1. Stage all relevant changes: `git add <files>` |
| 65 | +2. Create the commit with the conventional message |
| 66 | +3. Push to the remote repository: `git push` |
| 67 | +4. Verify the push was successful with `git status` |
| 68 | + |
| 69 | +## Important Notes |
| 70 | + |
| 71 | +- **DO NOT** commit files that likely contain secrets (.env, credentials.json, etc.) |
| 72 | +- **DO NOT** push without user confirmation |
| 73 | +- **DO** warn the user if they're about to commit sensitive files |
| 74 | +- **DO** provide clear feedback on what was committed and pushed |
| 75 | +- **DO** handle any errors gracefully and report them to the user |
| 76 | + |
| 77 | +## Example Workflow |
| 78 | + |
| 79 | +1. Show changes summary ✓ |
| 80 | +2. Show proposed commit message ✓ |
| 81 | +3. Ask: "Is it okay to proceed with this commit?" ✓ |
| 82 | +4. Wait for user confirmation ✓ |
| 83 | +5. Stage files: `git add .opencode/commands/new-command.md` |
| 84 | +6. Commit: `git commit -m "feat(commands): add new-command for automated deployment"` |
| 85 | +7. Push: `git push` |
| 86 | +8. Confirm: "✓ Changes committed and pushed successfully" |
0 commit comments