@monochange/skill 0.0.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,231 @@
1
+ # Changeset lifecycle guide
2
+
3
+ This guide explains how to actively manage changesets throughout the development lifecycle. Changesets are not fire-and-forget — they must be reviewed, updated, and removed as code evolves.
4
+
5
+ ## Lifecycle stages
6
+
7
+ Every changeset goes through these stages:
8
+
9
+ 1. **Created** — When a change is first written
10
+ 2. **Updated** — When the scope of the described change expands or shifts
11
+ 3. **Removed** — When the described change no longer applies (feature reverted, approach changed)
12
+ 4. **Consumed** — When the release runs and the changeset is deleted after publishing
13
+
14
+ ## Before creating a changeset
15
+
16
+ <!-- {=changesetLifecycleSteps} -->
17
+
18
+ Before creating any changeset, follow these steps:
19
+
20
+ 1. **Read all existing changesets** in `.changeset/` to understand current coverage
21
+ 2. **Identify which packages are affected** by the current diff
22
+ 3. **For each affected package**, determine:
23
+ - Does an existing changeset already describe this change? → **Update it**
24
+ - Does an existing changeset describe a removed feature? → **Remove it**
25
+ - Is this a genuinely new change? → **Create a new changeset**
26
+ 4. **Classify each change** by artifact type to choose the right bump level and section type
27
+ 5. **Write the changeset** following the artifact-type template
28
+ 6. **Validate** by running `mc validate` or `mc diagnostics --format json`
29
+
30
+ When removing a changeset for a reverted feature, delete the file entirely — do not leave empty or zero-bump changesets as they create noise in release notes.
31
+
32
+ <!-- {/changesetLifecycleSteps} -->
33
+
34
+ ## Decision matrix
35
+
36
+ <!-- {=changesetLifecycleDecisionMatrix} -->
37
+
38
+ | Scenario | Action | Rationale |
39
+ | --------------------------------- | ------------------------ | ----------------------------------------------- |
40
+ | New feature added | **Create new** | Granular tracking of distinct changes |
41
+ | New published package or crate | **Create new** | First release note should use a `major` bump |
42
+ | Existing feature expanded | **Update existing** | Keep related changes together |
43
+ | Feature removed or reverted | **Remove changeset** | Don't release notes for removed features |
44
+ | Same change, different approach | **Replace changeset** | Document the actual implementation |
45
+ | Multiple small related changes | **Create new** (grouped) | Summarize when exceeding threshold |
46
+ | Bug found in unreleased feature | **Update existing** | Combine fix with feature, not a separate entry |
47
+ | Refactor of unreleased change | **Update existing** | Rewrite description to reflect new structure |
48
+ | Changeset references removed code | **Remove changeset** | Stale changesets create confusing release notes |
49
+
50
+ <!-- {/changesetLifecycleDecisionMatrix} -->
51
+
52
+ ## How to update an existing changeset
53
+
54
+ When expanding an existing feature, edit the changeset file in place:
55
+
56
+ **Before** — `.changeset/add-config-validation.md`:
57
+
58
+ ```markdown
59
+ ---
60
+ core: minor
61
+ ---
62
+
63
+ #### add config validation
64
+
65
+ Introduce validation for monochange.toml files.
66
+ ```
67
+
68
+ **After** — same file, updated:
69
+
70
+ ```markdown
71
+ ---
72
+ core: minor
73
+ ---
74
+
75
+ #### add config validation with schema checking
76
+
77
+ Introduce validation for monochange.toml files including:
78
+
79
+ - Basic syntax validation
80
+ - Schema conformance checking
81
+ - Helpful error messages for common mistakes
82
+ ```
83
+
84
+ The bump level may need to change too — a `minor` might become `major` if the scope expanded to include breaking changes.
85
+
86
+ ## How to replace a changeset
87
+
88
+ When the implementation approach changed, delete the old changeset and create a new one:
89
+
90
+ ```bash
91
+ rm .changeset/add-config-validation.md
92
+ mc change --package core --bump minor --reason "add config validation with relaxed parsing" --output .changeset/add-config-validation.md
93
+ ```
94
+
95
+ Use `--output` to write to a deterministic path so the new changeset replaces the old one.
96
+
97
+ ## How to remove a stale changeset
98
+
99
+ When a feature was reverted or removed from the branch:
100
+
101
+ ```bash
102
+ rm .changeset/add-experimental-feature.md
103
+ ```
104
+
105
+ Do not leave orphaned changesets. A changeset that describes code that no longer exists creates confusing release notes.
106
+
107
+ ## Using MCP tools for lifecycle management
108
+
109
+ <!-- {=changesetAnalysisMcpTools} -->
110
+
111
+ The `monochange_analysis` crate provides MCP tools for semantic diff inspection and changeset validation.
112
+
113
+ `monochange_analyze_changes` and `monochange_validate_changeset` now return real semantic analysis for Cargo, npm, Deno, and Dart/Flutter packages. They surface ecosystem-specific evidence such as Rust public API diffs, JS/TS export changes, `package.json` and `deno.json` export metadata, and `pubspec.yaml` dependency or plugin-platform changes.
114
+
115
+ **`monochange_analyze_changes`** — Analyzes git diffs and returns granular semantic changes for affected packages:
116
+
117
+ ```json
118
+ {
119
+ "path": "/path/to/repo",
120
+ "frame": "main...feature-branch",
121
+ "detection_level": "signature",
122
+ "max_suggestions": 10
123
+ }
124
+ ```
125
+
126
+ Current output includes:
127
+
128
+ - Cargo public Rust API diffs plus `Cargo.toml` dependency and manifest metadata changes
129
+ - npm-family JS/TS exported symbol diffs plus `package.json` exports, commands, dependency, and script changes
130
+ - Deno JS/TS exported symbol diffs plus `deno.json` exports, import aliases, task, and compiler-option changes
131
+ - Dart and Flutter public `lib/` API diffs plus `pubspec.yaml` executables, dependency, environment, and plugin-platform changes
132
+
133
+ This tool intentionally **does not decide** whether the diff is patch/minor/major. It returns semantic evidence for the agent to interpret.
134
+
135
+ **`monochange_validate_changeset`** — Validates that a changeset matches the current semantic diff:
136
+
137
+ ```json
138
+ {
139
+ "path": "/path/to/repo",
140
+ "changeset_path": ".changeset/feature.md"
141
+ }
142
+ ```
143
+
144
+ The validator uses the same Cargo, npm, Deno, and Dart/Flutter analyzer registry as `monochange_analyze_changes`, so stale symbol checks and missing-item suggestions stay aligned with the semantic evidence surfaced for each ecosystem.
145
+
146
+ **Lifecycle integration:**
147
+
148
+ These tools integrate with the changeset lifecycle:
149
+
150
+ - Use `monochange_analyze_changes` to inspect semantic evidence before creating or updating a changeset
151
+ - Use `monochange_validate_changeset` to catch stale symbol references or underspecified summaries
152
+ - Treat the returned semantic model as evidence for the agent, not an automatic bump decision
153
+
154
+ <!-- {/changesetAnalysisMcpTools} -->
155
+
156
+ ## Dependency propagation with `caused_by`
157
+
158
+ <!-- {=changesetCausedByField} -->
159
+
160
+ ### Dependency propagation with `caused_by`
161
+
162
+ When a dependency changes, monochange automatically patches all dependents. This creates release notes with no context for _why_ the dependent is being updated.
163
+
164
+ The `caused_by` field in changeset frontmatter provides that context. It lists the root package(s) or group(s) that triggered this dependent change. Because `caused_by` is part of the object form, use table syntax instead of scalar shorthand whenever you need it:
165
+
166
+ ```markdown
167
+ ---
168
+ monochange_config:
169
+ bump: patch
170
+ caused_by: ["monochange_core"]
171
+ ---
172
+
173
+ #### update dependency on monochange_core
174
+
175
+ Bumps `monochange_core` dependency to v2.1.0 after the public API change to `ChangelogFormat`.
176
+ ```
177
+
178
+ **How it works:**
179
+
180
+ 1. Without `caused_by`: a dependent gets an automatic "dependency changed → patch" record with no explanation
181
+ 2. With `caused_by`: the authored changeset **replaces** the matching automatic propagation — it provides human-readable context instead
182
+ 3. A changeset with `caused_by` and `bump: patch` suppresses the automatic "dependency changed → patch" record for that package when the same upstream package or group triggered it
183
+ 4. A changeset with `caused_by` and `bump: none` suppresses that matching propagation entirely — the package is acknowledged as affected but no version bump is warranted
184
+ 5. Unrelated upstream sources can still propagate normally; `caused_by` is not a global opt-out for every dependency edge
185
+
186
+ **`none` bump with `caused_by` — the "nothing meaningful changed" case:**
187
+
188
+ When `mc step:affected-packages` (or a config-defined wrapper such as `mc affected`) flags a package but the change is not meaningful (just a lockfile update or a re-export), use `bump: none` with `caused_by`:
189
+
190
+ ```markdown
191
+ ---
192
+ monochange_config:
193
+ bump: none
194
+ caused_by: ["monochange_core"]
195
+ type: deps
196
+ ---
197
+
198
+ #### update monochange_core dependency
199
+
200
+ No user-facing changes. Dependency version updated to match the group release.
201
+ ```
202
+
203
+ This tells monochange: "this package is affected, but the change doesn't warrant a version bump for consumers. Suppress the matching automatic patch propagation entirely."
204
+
205
+ CLI authoring supports one or more `--caused-by` flags:
206
+
207
+ - `mc change --package <id> --bump patch --caused-by monochange_core --reason "update dependency"`
208
+ - `mc change --package <id> --bump none --caused-by sdk --reason "dependency-only follow-up"`
209
+
210
+ <!-- {/changesetCausedByField} -->
211
+
212
+ ## Validating changesets
213
+
214
+ After creating, updating, or removing changesets, always validate:
215
+
216
+ ```bash
217
+ mc validate
218
+ ```
219
+
220
+ This checks that:
221
+
222
+ - Every referenced package or group id exists in `monochange.toml`
223
+ - Bump levels are valid (`none`, `patch`, `minor`, `major`, or configured change types)
224
+ - Type values match configured `extra_changelog_sections`
225
+ - No orphaned references remain
226
+
227
+ For structured diagnostics with git provenance and linked metadata:
228
+
229
+ ```bash
230
+ mc diagnostics --format json
231
+ ```
@@ -0,0 +1,332 @@
1
+ # Changesets skill
2
+
3
+ Use this guide when the task is to create, review, update, replace, or remove `.changeset/*.md` files.
4
+
5
+ ## When to use this skill
6
+
7
+ Reach for it when you need to:
8
+
9
+ - create a new changeset from a code change
10
+ - decide whether to update an existing changeset instead of creating another one
11
+ - explain dependency propagation with `caused_by`
12
+ - choose between package ids and group ids
13
+ - describe a CLI, library, application, or protocol change in user-facing language
14
+
15
+ ## Start with the workspace model
16
+
17
+ Before writing anything:
18
+
19
+ 1. Read `monochange.toml`
20
+ 2. Run `mc validate`
21
+ 3. Run `mc discover --format json`
22
+ 4. Review existing `.changeset/*.md` files
23
+ 5. Use `mc diagnostics --format json` when you need git and PR context
24
+
25
+ ## The default creation flow
26
+
27
+ Create a new changeset for one package:
28
+
29
+ ```bash
30
+ mc change --package monochange --bump minor --reason "add release-record discovery"
31
+ ```
32
+
33
+ Create a dependency-follow-up changeset:
34
+
35
+ ```bash
36
+ mc change \
37
+ --package monochange_config \
38
+ --bump patch \
39
+ --caused-by monochange_core \
40
+ --reason "update dependency on monochange_core"
41
+ ```
42
+
43
+ Create a no-version-bump acknowledgement for an affected package:
44
+
45
+ ```bash
46
+ mc change \
47
+ --package monochange_config \
48
+ --bump none \
49
+ --caused-by monochange_core \
50
+ --reason "dependency-only follow-up"
51
+ ```
52
+
53
+ ## Package id vs. group id
54
+
55
+ Prefer a package id when one package changed directly:
56
+
57
+ ```markdown
58
+ ---
59
+ monochange_core: minor
60
+ ---
61
+ ```
62
+
63
+ Use a group id only when the outward release boundary is the whole group:
64
+
65
+ ```markdown
66
+ ---
67
+ sdk: minor
68
+ ---
69
+ ```
70
+
71
+ A good rule:
72
+
73
+ - **package id** — a leaf package changed and monochange can propagate the rest
74
+ - **group id** — the release note should read as one coordinated release owned by the group
75
+
76
+ ## Scalar vs. object frontmatter
77
+
78
+ Scalar syntax is the shortest form:
79
+
80
+ ```markdown
81
+ ---
82
+ monochange: patch
83
+ ---
84
+ ```
85
+
86
+ Object syntax is for richer intent:
87
+
88
+ ```markdown
89
+ ---
90
+ monochange:
91
+ bump: major
92
+ version: "2.0.0"
93
+ type: security
94
+ ---
95
+ ```
96
+
97
+ Use object syntax when you need:
98
+
99
+ - `version` for an explicit version target
100
+ - `type` for a custom changelog section
101
+ - `caused_by` for dependency propagation context
102
+
103
+ `caused_by` always uses the object form and can point at package ids or group ids.
104
+
105
+ ## `caused_by` and dependency propagation
106
+
107
+ Without `caused_by`, a dependent package gets an automatic dependency-bump record with little context.
108
+
109
+ **Without authored context:**
110
+
111
+ ```markdown
112
+ # automatic propagation, no authored explanation
113
+
114
+ monochange_config -> patch
115
+ ```
116
+
117
+ **With authored context:**
118
+
119
+ ```markdown
120
+ ---
121
+ monochange_config:
122
+ bump: patch
123
+ caused_by: ["monochange_core"]
124
+ ---
125
+
126
+ #### update dependency on monochange_core
127
+
128
+ Bumps `monochange_core` after the `ChangelogFormat` API change.
129
+ ```
130
+
131
+ Use `bump: none` when the package is affected but users do not need a version bump.
132
+
133
+ `caused_by` suppresses only the matching automatic propagation. Other unrelated upstream changes can still propagate normally.
134
+
135
+ CLI authoring accepts repeated `--caused-by <id>` flags when more than one upstream package or group explains the follow-up change.
136
+
137
+ ## Create vs. update vs. replace vs. remove
138
+
139
+ ### Create a new changeset
140
+
141
+ Use a new file when the outward change is genuinely new.
142
+
143
+ ```markdown
144
+ ---
145
+ monochange: minor
146
+ ---
147
+
148
+ #### add `mc diagnostics`
149
+
150
+ Introduce a command for changeset provenance.
151
+ ```
152
+
153
+ ### Update an existing changeset
154
+
155
+ Update in place when the same feature grew before release.
156
+
157
+ **Before:**
158
+
159
+ ```markdown
160
+ ---
161
+ monochange: minor
162
+ ---
163
+
164
+ #### add `mc diagnostics`
165
+
166
+ Introduce a command for changeset provenance.
167
+ ```
168
+
169
+ **After:**
170
+
171
+ ```markdown
172
+ ---
173
+ monochange: minor
174
+ ---
175
+
176
+ #### add `mc diagnostics` for provenance and review context
177
+
178
+ Introduce a command for changeset provenance, linked review requests, and related issues.
179
+ ```
180
+
181
+ ### Replace a changeset
182
+
183
+ Replace the file when the implementation changed so much that the old note is misleading.
184
+
185
+ ### Remove a changeset
186
+
187
+ Delete the file when the feature was reverted before release.
188
+
189
+ ## Write user-facing summaries
190
+
191
+ Changeset bodies should describe what users notice.
192
+
193
+ ### Weak
194
+
195
+ ```markdown
196
+ #### refactor release logic
197
+ ```
198
+
199
+ ### Better
200
+
201
+ ```markdown
202
+ #### add `--diff` previews to dry-run release output
203
+
204
+ `mc release --dry-run --diff` now shows unified file diffs for version and changelog updates without mutating the workspace.
205
+ ```
206
+
207
+ ## Artifact-specific framing
208
+
209
+ Different package types need different release-note framing:
210
+
211
+ - **Libraries** — public APIs, types, traits, exports, behavior
212
+ - **Applications** — routes, screens, workflows, UX changes
213
+ - **CLI tools** — commands, flags, output, exit codes, config shape
214
+ - **LSP/MCP** — tool names, schemas, protocol methods, response shapes
215
+
216
+ See [artifact-types.md](./artifact-types.md) for detailed templates.
217
+
218
+ ## Validation loop
219
+
220
+ After writing or editing changesets:
221
+
222
+ ```bash
223
+ mc validate
224
+ mc diagnostics --format json
225
+ mc release --dry-run --format json
226
+ ```
227
+
228
+ Use `mc step:affected-packages --verify --changed-paths ...` in CI or review workflows when you need to prove all changed packages are covered without depending on a config-defined wrapper.
229
+
230
+ ## Changeset cleanup job
231
+
232
+ Before release, audit all pending changesets and resolve duplicates, stale entries, and incomplete descriptions.
233
+
234
+ ### Step 1: Export diagnostics data
235
+
236
+ ```bash
237
+ mc diagnostics --format json > /tmp/changesets.json
238
+ ```
239
+
240
+ This produces a JSON document with `requestedChangesets` and `changesets` arrays containing paths, summaries, targets, and git context.
241
+
242
+ ### Step 2: Filter for common issues
243
+
244
+ **Find short summaries (likely incomplete):**
245
+
246
+ ```bash
247
+ cat /tmp/changesets.json | jq '.changesets[] | select((.summary | length) < 20)'
248
+ ```
249
+
250
+ **Find changesets touching a specific package:**
251
+
252
+ ```bash
253
+ cat /tmp/changesets.json | jq '.changesets[] | select(.targets[].id == "monochange_core")'
254
+ ```
255
+
256
+ **Find changesets without git context:**
257
+
258
+ ```bash
259
+ cat /tmp/changesets.json | jq '.changesets[] | select(.context.introduced == null)'
260
+ ```
261
+
262
+ **Find changesets with duplicate summaries:**
263
+
264
+ ```bash
265
+ cat /tmp/changesets.json | jq -r '.changesets[].summary' | sort | uniq -d
266
+ ```
267
+
268
+ ### Step 3: Decision matrix
269
+
270
+ | Situation | Action |
271
+ | ---------------------------------------- | -------------------------------------- |
272
+ | **Same feature in multiple changesets** | Merge into one multi-package changeset |
273
+ | **Feature reverted / PR closed** | Remove the changeset file |
274
+ | **Description too vague** | Update body with user-facing details |
275
+ | **Wrong target packages** | Edit frontmatter to correct targets |
276
+ | **Same change, same PR, multiple files** | Consolidate into single changeset |
277
+
278
+ ### Step 4: Merge duplicate changesets
279
+
280
+ When two changesets describe the same feature:
281
+
282
+ ```bash
283
+ # Read both source changesets
284
+ cat .changeset/feature-cli.md
285
+ cat .changeset/feature-core.md
286
+
287
+ # Create merged version
288
+ cat > .changeset/unified-feature.md << 'EOF'
289
+ ---
290
+ monochange_cli: minor
291
+ monochange_core: minor
292
+ ---
293
+
294
+ #### add unified feature across CLI and core
295
+
296
+ Description covering both packages.
297
+ EOF
298
+
299
+ # Remove obsolete changesets
300
+ git rm .changeset/feature-cli.md .changeset/feature-core.md
301
+ git add .changeset/unified-feature.md
302
+ ```
303
+
304
+ ### Step 5: Remove stale changesets
305
+
306
+ ```bash
307
+ # Verify the changeset is truly stale
308
+ mc diagnostics --changeset .changeset/stale-feature.md
309
+
310
+ # Confirm the feature was reverted or abandoned
311
+ git log --oneline -- .changeset/stale-feature.md
312
+
313
+ # Remove
314
+ git rm .changeset/stale-feature.md
315
+ ```
316
+
317
+ ### Step 6: Validation checklist
318
+
319
+ Before finalizing cleanup:
320
+
321
+ - [ ] `mc validate` passes
322
+ - [ ] `mc diagnostics --format json` loads all remaining changesets without error
323
+ - [ ] `mc step:affected-packages --verify --changed-paths <files>` confirms coverage for recent changes
324
+ - [ ] No duplicate summaries across changesets
325
+ - [ ] No changesets reference reverted features
326
+ - [ ] All changesets have user-facing descriptions per [changeset-guide.md](./changeset-guide.md)
327
+
328
+ ## Keep these references nearby
329
+
330
+ - [changeset-guide.md](./changeset-guide.md) — lifecycle details
331
+ - [artifact-types.md](./artifact-types.md) — package-type-specific guidance
332
+ - [reference.md](./reference.md) — longer examples and config cross-references