|
| 1 | +--- |
| 2 | +name: changeset-generator |
| 3 | +description: Generate changeset based on current branch changes or staged files |
| 4 | +--- |
| 5 | + |
| 6 | +# Changeset Generator for LikeC4 |
| 7 | + |
| 8 | +Generate changeset files based on current branch changes or staged files. |
| 9 | + |
| 10 | +## 1. Identify Changes |
| 11 | + |
| 12 | +**Step 1: Check for staged changes** |
| 13 | + |
| 14 | +```bash |
| 15 | +git diff --staged --name-only |
| 16 | +``` |
| 17 | + |
| 18 | +If there are staged files, use only staged changes and skip to Step 3. |
| 19 | + |
| 20 | +**Step 2: Find commits since main branch** (if no staged changes) |
| 21 | + |
| 22 | +```bash |
| 23 | +# Get all changed files compared to main |
| 24 | +git diff --name-only main...HEAD |
| 25 | + |
| 26 | +# List commits since diverging from main |
| 27 | +git log --oneline main..HEAD |
| 28 | +``` |
| 29 | + |
| 30 | +**Step 3: Gather context from commit messages** |
| 31 | + |
| 32 | +```bash |
| 33 | +git log --format="%s%n%b" main..HEAD |
| 34 | +``` |
| 35 | + |
| 36 | +- Use commit messages to understand intent behind changes |
| 37 | +- Conventional Commits hints: |
| 38 | + - `feat:` / `fix:` - Usually needs changeset |
| 39 | + - `chore:` / `test:` / `refactor:` - Usually skip unless user-facing |
| 40 | + |
| 41 | +## 2. Map Files to Packages |
| 42 | + |
| 43 | +Group changed files by their package folder: |
| 44 | + |
| 45 | +- `packages/<name>/*` - Read `packages/<name>/package.json` |
| 46 | +- `apps/<name>/*` - Read `apps/<name>/package.json` |
| 47 | +- `styled-system/<name>/*` - Read `styled-system/<name>/package.json` |
| 48 | + |
| 49 | +**Skip packages** with only: |
| 50 | + |
| 51 | +- Test files (`*.spec.ts`, `__tests__/*`, `__snapshots__/*`) |
| 52 | +- Generated files (in `.gitignore`) |
| 53 | +- Internal packages: `@likec4/icons`, `@likec4/tsconfig` |
| 54 | + |
| 55 | +## 3. Generate Summary |
| 56 | + |
| 57 | +For each affected package: |
| 58 | + |
| 59 | +- Focus on **user-facing changes** only |
| 60 | +- Write from user's perspective: what they can now do, what was fixed |
| 61 | +- Be concise: 1-3 bullet points or a single sentence |
| 62 | +- **DO NOT mention**: test changes, internal refactors, type-only changes, code cleanup |
| 63 | + |
| 64 | +## 4. Create Changeset File |
| 65 | + |
| 66 | +**Always use `patch`** - versioning is handled manually. |
| 67 | + |
| 68 | +Create file at `.changeset/<random-readable-name>.md`: |
| 69 | + |
| 70 | +```markdown |
| 71 | +--- |
| 72 | +'<package-name>': patch |
| 73 | +'<another-package>': patch |
| 74 | +--- |
| 75 | + |
| 76 | +<summary> |
| 77 | +``` |
| 78 | + |
| 79 | +## Examples |
| 80 | + |
| 81 | +### Good: |
| 82 | + |
| 83 | +```markdown |
| 84 | +--- |
| 85 | +'@likec4/diagram': patch |
| 86 | +--- |
| 87 | + |
| 88 | +Add reset manual layout button with tooltip guidance |
| 89 | +``` |
| 90 | + |
| 91 | +```markdown |
| 92 | +--- |
| 93 | +'@likec4/core': patch |
| 94 | +'@likec4/diagram': patch |
| 95 | +--- |
| 96 | + |
| 97 | +First iteration of element notes feature: |
| 98 | + |
| 99 | +- Add notes property to elements |
| 100 | +- Display visual indicator on diagrams |
| 101 | +``` |
| 102 | + |
| 103 | +### Bad (avoid): |
| 104 | + |
| 105 | +- "Refactored XyzService to use DI" (internal) |
| 106 | +- "Fixed failing tests" (tests are internal) |
| 107 | +- "Updated types for better inference" (internal) |
| 108 | + |
| 109 | +## Notes |
| 110 | + |
| 111 | +- Combine multiple packages in one changeset if they're part of the same feature |
| 112 | +- File names: lowercase with hyphens (e.g., `add-notes-feature.md`) |
| 113 | +- Link issues when relevant: `Fixes [#123](https://github.com/likec4/likec4/issues/123)` |
0 commit comments