|
| 1 | +# Commit Changes |
| 2 | + |
| 3 | +Complete workflow: branch → commit → push → PR |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +```bash |
| 8 | +/commit [options] |
| 9 | +``` |
| 10 | + |
| 11 | +**Options:** |
| 12 | + |
| 13 | +- `--push` or `-p`: Push to remote after commit |
| 14 | +- `--pr`: Create PR after push |
| 15 | +- `--all` or `-a`: Commit all changes at once |
| 16 | +- `<path>`: Commit only specific path (e.g., `packages/kstyled`, `packages/babel-plugin-kstyled`) |
| 17 | + |
| 18 | +## Examples |
| 19 | + |
| 20 | +```bash |
| 21 | +# Full workflow: commit src changes, push, create PR |
| 22 | +/commit packages/kstyled --pr |
| 23 | + |
| 24 | +# Commit all and create PR |
| 25 | +/commit --all --pr |
| 26 | + |
| 27 | +# Just commit specific path |
| 28 | +/commit packages/babel-plugin-kstyled |
| 29 | +``` |
| 30 | + |
| 31 | +## Complete Workflow |
| 32 | + |
| 33 | +### 1. Check Branch |
| 34 | + |
| 35 | +```bash |
| 36 | +# Check current branch |
| 37 | +git branch --show-current |
| 38 | +``` |
| 39 | + |
| 40 | +**If on `main`** → Create a feature branch first: |
| 41 | + |
| 42 | +```bash |
| 43 | +git checkout -b feat/<feature-name> |
| 44 | +``` |
| 45 | + |
| 46 | +**If NOT on `main`** → Proceed with commits directly. |
| 47 | + |
| 48 | +**Branch naming conventions:** |
| 49 | + |
| 50 | +- `feat/<feature-name>` - New features |
| 51 | +- `fix/<bug-description>` - Bug fixes |
| 52 | +- `docs/<doc-update>` - Documentation only |
| 53 | +- `chore/<task>` - Maintenance tasks |
| 54 | + |
| 55 | +### 2. Pre-Commit Checks (CRITICAL) |
| 56 | + |
| 57 | +Before staging any changes, run the following checks: |
| 58 | + |
| 59 | +```bash |
| 60 | +# Lint check |
| 61 | +bun run lint |
| 62 | + |
| 63 | +# Type check |
| 64 | +bun run typecheck |
| 65 | + |
| 66 | +# Run tests |
| 67 | +bun run test |
| 68 | +``` |
| 69 | + |
| 70 | +**IMPORTANT:** Only proceed with commit if ALL checks pass. |
| 71 | + |
| 72 | +### 3. Check Current Status |
| 73 | + |
| 74 | +```bash |
| 75 | +git status |
| 76 | +git diff --name-only |
| 77 | +``` |
| 78 | + |
| 79 | +### 4. Stage Changes |
| 80 | + |
| 81 | +**kstyled package:** |
| 82 | + |
| 83 | +```bash |
| 84 | +git add packages/kstyled/ |
| 85 | +``` |
| 86 | + |
| 87 | +**Babel plugin:** |
| 88 | + |
| 89 | +```bash |
| 90 | +git add packages/babel-plugin-kstyled/ |
| 91 | +``` |
| 92 | + |
| 93 | +**All changes:** |
| 94 | + |
| 95 | +```bash |
| 96 | +git add . |
| 97 | +``` |
| 98 | + |
| 99 | +### 5. Review Staged Changes |
| 100 | + |
| 101 | +```bash |
| 102 | +git diff --cached --stat |
| 103 | +git diff --cached --name-only |
| 104 | +``` |
| 105 | + |
| 106 | +### 6. Create Commit |
| 107 | + |
| 108 | +Follow Angular Conventional Commit format: |
| 109 | + |
| 110 | +```bash |
| 111 | +git commit -m "$(cat <<'EOF' |
| 112 | +<type>(<scope>): <description> |
| 113 | +
|
| 114 | +<body - what changed and why> |
| 115 | +
|
| 116 | +Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
| 117 | +EOF |
| 118 | +)" |
| 119 | +``` |
| 120 | + |
| 121 | +**Commit Types:** | Type | Description | |------|-------------| | `feat` | New feature | | `fix` | Bug fix | | `docs` | Documentation only | | `refactor` | Code refactoring | | `chore` | Maintenance tasks | | `test` | Adding/updating tests | | `perf` | Performance improvement | | `style` | Code style (formatting, semicolons, etc.) | |
| 122 | + |
| 123 | +**Scope Examples:** |
| 124 | + |
| 125 | +- `css` - css`` tagged template helper |
| 126 | +- `styled` - styled component system |
| 127 | +- `theme` - Theme provider |
| 128 | +- `babel` - Babel plugin changes |
| 129 | +- `types` - TypeScript type definitions |
| 130 | + |
| 131 | +### 7. Push to Remote |
| 132 | + |
| 133 | +```bash |
| 134 | +git push -u origin <branch-name> |
| 135 | +``` |
| 136 | + |
| 137 | +### 8. Create Pull Request |
| 138 | + |
| 139 | +```bash |
| 140 | +gh pr create --title "<type>(<scope>): <description>" --body "$(cat <<'EOF' |
| 141 | +## Summary |
| 142 | +
|
| 143 | +<1-3 bullet points describing changes> |
| 144 | +
|
| 145 | +## Changes |
| 146 | +
|
| 147 | +- Change 1 |
| 148 | +- Change 2 |
| 149 | +
|
| 150 | +## Test plan |
| 151 | +
|
| 152 | +- [ ] `bun run lint` passes |
| 153 | +- [ ] `bun run typecheck` passes |
| 154 | +- [ ] `bun run test` passes |
| 155 | +
|
| 156 | +🤖 Generated with [Claude Code](https://claude.ai/code) |
| 157 | +EOF |
| 158 | +)" |
| 159 | +``` |
| 160 | + |
| 161 | +--- |
| 162 | + |
| 163 | +## Important Notes |
| 164 | + |
| 165 | +- **ALWAYS** run pre-commit checks before committing |
| 166 | +- **ALWAYS** include `Co-Authored-By` footer for Claude-assisted commits |
| 167 | +- Use `bun` exclusively for all package management |
0 commit comments