@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.
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ This is free and unencumbered software released into the public domain.
2
+
3
+ Anyone is free to copy, modify, publish, use, compile, sell, or
4
+ distribute this software, either in source code form or as a compiled
5
+ binary, for any purpose, commercial or non-commercial, and by any
6
+ means.
7
+
8
+ In jurisdictions that recognize copyright laws, the author or authors
9
+ of this software dedicate any and all copyright interest in the
10
+ software to the public domain. We make this dedication for the benefit
11
+ of the public at large and to the detriment of our heirs and
12
+ successors. We intend this dedication to be an overt act of
13
+ relinquishment in perpetuity of all present and future rights to this
14
+ software under copyright law.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ For more information, please refer to <http://unlicense.org/>
package/SKILL.md ADDED
@@ -0,0 +1,271 @@
1
+ ---
2
+ name: monochange
3
+ description: Guides agents through monochange adoption planning, discovery, changesets, release planning, and provider-aware release workflows. Use when working on `monochange.toml`, `.changeset/*.md`, release automation, grouped versions, migration into existing monorepos, cross-ecosystem monorepo releases, CLI step composition, MCP tool interactions, or linting configuration.
4
+ ---
5
+
6
+ # monochange
7
+
8
+ ## Quick start
9
+
10
+ If the user is still deciding how deeply to adopt monochange, start with [skills/adoption.md](skills/adoption.md) and [examples/readme.md](examples/readme.md) before generating files.
11
+
12
+ 1. If `monochange.toml` does not exist yet, run `mc init`. `mc init` writes editable `[cli.*]` workflow commands; built-in steps are always available directly as immutable `mc step:*` commands.
13
+ 2. Read `monochange.toml` first — it is the single source of truth.
14
+ 3. Run `mc validate` before making release-affecting edits.
15
+ 4. Use `mc discover --format json` to inspect the workspace model.
16
+ 5. Use `mc change` to write explicit release intent as `.changeset/*.md` files.
17
+ 6. Use `mc diagnostics --format json` to inspect changeset context and git provenance.
18
+ 7. Use `mc check` to validate the workspace and run configured manifest lint rules.
19
+ 8. Use `mc release --dry-run --format json` or `mc release --dry-run --diff` before mutating release state.
20
+
21
+ ## Working rules
22
+
23
+ - Treat `monochange.toml` as the source of truth for packages, groups, source providers, ecosystems, `[cli.<command>]` entries, and lint configuration.
24
+ - Prefer configured package or group ids over guessing manifest names.
25
+ - Use `.changeset/*.md` files for explicit release intent — each targets one or more package/group ids with a bump severity, optional `type`, optional explicit `version`, and a human-readable summary.
26
+ - Use `caused_by` in changeset frontmatter when a dependent package is updating because of a dependency change — this provides context and replaces the matching automatic "dependency changed → patch" propagation.
27
+ - `caused_by` uses object syntax in markdown changesets and can reference package ids or group ids; in CLI form, pass one or more `--caused-by <id>` flags.
28
+ - When `mc step:affected-packages` flags a package that has no meaningful change, create a changeset with `bump: none` and `caused_by` listing the root cause package(s).
29
+ - Review existing `.changeset/*.md` files before creating a new one so you can decide whether the right lifecycle action is create, update, replace, or remove.
30
+ - Keep changesets package-centric and granular. Distinct features should get distinct changesets even when they land in the same package; only expand an existing changeset when the new work is clearly the same feature growing in scope.
31
+ - Combine near-duplicate changesets when the outward change is the same across multiple related packages. Do not emit cloned compatibility notes that differ only by package name.
32
+ - Breaking changes must always get their own dedicated changeset with a migration path instead of being bundled into a broader feature note.
33
+ - Run dry-run flows before real release commands.
34
+ - Run `mc check` before releases to catch manifest inconsistencies early.
35
+ - Keep docs, templates, and changelog behavior aligned with config changes.
36
+ - Use `mc diagnostics --format json` to audit changesets before release — it shows git provenance, linked PRs, related issues, and introduced/last-updated commits.
37
+
38
+ ## Recommended command flow
39
+
40
+ <!-- {=recommendedCommandFlow} -->
41
+
42
+ 1. **Validate** — `mc validate` checks config and changeset targets.
43
+ 2. **Discover** — `mc discover --format json` inspects the workspace model.
44
+ 3. **Create changesets** — `mc change --package <id> --bump <severity> --reason "..."` writes explicit release intent.
45
+ 4. **Preview release** — `mc release --dry-run --format json` shows planned bumps, changelog output, and changed files.
46
+ 5. **Inspect changeset context** — `mc diagnostics --format json` shows git provenance and linked review metadata for all pending changesets.
47
+ 6. **Inspect cached manifest** — `mc release --dry-run --format json` refreshes the cached manifest and shows the downstream automation payload.
48
+ 7. **Publish** — `mc publish-release --format json` creates provider releases after human review.
49
+
50
+ <!-- {/recommendedCommandFlow} -->
51
+
52
+ Release-oriented commands default to markdown output. Use `--format json` for automation and `--diff` when you want unified file previews without mutating the workspace.
53
+
54
+ ## Deep dives
55
+
56
+ - [skills/reference.md](skills/reference.md) — high-context reference with more examples
57
+ - [skills/readme.md](skills/readme.md) — index of focused skill modules
58
+ - [skills/adoption.md](skills/adoption.md) — interactive setup planning, migration questions, and recommendation patterns
59
+ - [skills/changesets.md](skills/changesets.md) — creating, auditing, cleaning up, and managing changesets
60
+ - [skills/commands.md](skills/commands.md) — built-in commands and workflow selection
61
+ - [skills/configuration.md](skills/configuration.md) — creating and extending `monochange.toml`
62
+ - [skills/linting.md](skills/linting.md) — `mc check`, `[lints]`, presets, and manifest-focused rule explanations with examples
63
+ - [examples/readme.md](examples/readme.md) — condensed setup examples for quick recommendations
64
+ - [skills/multi-package-publishing.md](skills/multi-package-publishing.md) — patterns for publishing multiple public packages from one repository
65
+ - [skills/changeset-guide.md](skills/changeset-guide.md) — full lifecycle guidance
66
+ - [skills/artifact-types.md](skills/artifact-types.md) — package-type-specific release-note guidance
67
+
68
+ ## CLI commands
69
+
70
+ | Command | Purpose |
71
+ | ----------------------------- | ---------------------------------------------------------------------- |
72
+ | `mc init` | Generate a starter `monochange.toml` from detected packages |
73
+ | `mc validate` | Validate config and changeset targets |
74
+ | `mc check` | Validate config and run lint rules against package manifests |
75
+ | `mc lint` | Inspect registered lint rules and presets |
76
+ | `mc discover` | Discover packages across ecosystems |
77
+ | `mc change` | Create a `.changeset/*.md` file |
78
+ | `mc release` | Prepare a release plan from changesets and refresh the cached manifest |
79
+ | `mc placeholder-publish` | Publish placeholder versions for packages missing from registries |
80
+ | `mc publish-bootstrap` | Bootstrap release package placeholders and write a result artifact |
81
+ | `mc publish-readiness` | Check package-registry readiness and write a validation artifact |
82
+ | `mc publish-plan --readiness` | Plan rate-limit batches from ready package work only |
83
+ | `mc publish --output` | Publish package artifacts and write a resumable result artifact |
84
+ | `mc commit-release` | Prepare a release and create a local commit |
85
+ | `mc publish-release` | Create provider releases |
86
+ | `mc release-pr` | Open or update a release pull request |
87
+ | `mc step:affected-packages` | Evaluate changeset policy from changed paths without a config wrapper |
88
+ | `mc diagnostics` | Show changeset context with git and review metadata |
89
+ | `mc release-record` | Inspect a durable release declaration from git history |
90
+ | `mc repair-release` | Repair a recent release by retargeting tags |
91
+ | `mc subagents` | Generate repo-local monochange agent, subagent, and rule files |
92
+ | `mc mcp` | Start the stdio MCP server |
93
+
94
+ ## CLI step types
95
+
96
+ <!-- {=cliStepTypes} -->
97
+
98
+ **Standalone steps** (no prerequisites):
99
+
100
+ - `Validate` — validate config and changeset targets
101
+ - `Discover` — discover packages across ecosystems
102
+ - `CreateChangeFile` — write a `.changeset/*.md` file
103
+ - `AffectedPackages` — evaluate changeset policy from CI-supplied paths and labels
104
+ - `DiagnoseChangesets` — show changeset context and review metadata
105
+ - `RetargetRelease` — repair a recent release by moving its tags
106
+
107
+ **Release-state consumer steps** (require `PrepareRelease`):
108
+
109
+ - `PrepareRelease` — compute release plan, update versions, changelogs, and versioned files
110
+ - `CommitRelease` — create a local release commit
111
+ - `PublishRelease` — create provider releases
112
+ - `OpenReleaseRequest` — open or update a release pull request
113
+ - `CommentReleasedIssues` — comment on issues referenced in changesets
114
+
115
+ **Generic step:**
116
+
117
+ - `Command` — run an arbitrary shell command with template interpolation
118
+
119
+ <!-- {/cliStepTypes} -->
120
+
121
+ ## MCP tools
122
+
123
+ <!-- {=mcpToolsList} -->
124
+
125
+ - `monochange_validate` — validate `monochange.toml` and `.changeset` targets
126
+ - `monochange_discover` — discover packages, dependencies, and groups across the repository
127
+ - `monochange_diagnostics` — inspect pending changesets with git and review context as structured JSON
128
+ - `monochange_change` — write a `.changeset` markdown file for one or more package or group ids
129
+ - `monochange_release_preview` — prepare a dry-run release preview from discovered `.changeset` files
130
+ - `monochange_release_manifest` — generate a dry-run release manifest JSON document for downstream automation
131
+ - `monochange_affected_packages` — evaluate changeset policy from changed paths and optional labels
132
+ - `monochange_lint_catalog` — list registered manifest lint rules and presets
133
+ - `monochange_lint_explain` — explain one manifest lint rule or preset
134
+ - `monochange_analyze_changes` — analyze git diff state and return ecosystem-specific semantic changes
135
+ - `monochange_validate_changeset` — validate one changeset against the current semantic diff
136
+
137
+ <!-- {/mcpToolsList} -->
138
+
139
+ ## Key configuration concepts
140
+
141
+ ### Changeset generation
142
+
143
+ - Start by checking existing `.changeset/*.md` files and the current diff before you write anything new.
144
+ - Prefer one package per changeset unless a configured group is the real outward release boundary.
145
+ - Keep related changes together, but split unrelated features apart even if they touch the same package.
146
+ - If a package is only changing because of dependency propagation, prefer `caused_by` frontmatter and use `bump: none` when there is no real user-facing change.
147
+ - If multiple packages changed for the same reason and the release note would otherwise be nearly identical, combine them into one multi-package changeset instead of cloning the same body four times.
148
+ - Update an existing changeset only when the new work is clearly the same feature expanding in scope.
149
+ - Remove stale changesets when the feature was reverted or replaced before release.
150
+ - Breaking changes always get their own dedicated changeset with a migration guide.
151
+ - Changeset bodies still need the user-facing quality bar: headline, impact summary, and concrete before/after or usage examples.
152
+
153
+ ### Versioned files
154
+
155
+ `versioned_files` update additional managed files beyond native manifests when versions change. Three forms:
156
+
157
+ - **Package-scoped shorthand**: `versioned_files = ["Cargo.toml"]` — infers the package ecosystem
158
+ - **Explicit typed entries**: `versioned_files = [{ path = "group.toml", type = "cargo" }]`
159
+ - **Regex entries**: `versioned_files = [{ path = "README.md", regex = 'v(?<version>\d+\.\d+\.\d+)' }]` — for plain-text files; must include a named `version` capture
160
+
161
+ ### Lockfile commands
162
+
163
+ Lockfile refresh is command-driven via `[ecosystems.<name>].lockfile_commands`. monochange infers sensible defaults for Cargo, npm-family, Dart/Flutter, Python (`uv lock` / `poetry lock --no-update`), and Go (`go mod tidy`). Explicit configuration overrides inference.
164
+
165
+ ### Publishing and trust
166
+
167
+ - Package publishing is configured through `publish` on packages and ecosystems.
168
+ - Built-in publishing currently supports the canonical public registries and Go proxy/tag flow: `crates.io`, `npm`, `jsr`, `pub.dev`, `pypi`, and `go_proxy`. Use `mode = "external"` for private registries or custom publication flows.
169
+ - `mc publish-readiness` blocks built-in Cargo publishes to crates.io when the current `Cargo.toml` is not publishable: `publish = false`, `publish = [...]` without `crates-io`, missing `description`, or missing both `license` and `license-file`. Workspace-inherited Cargo metadata is accepted.
170
+ - `mc publish-plan --readiness <path>` validates a readiness artifact for the current release record, selected package set, and publish input fingerprint, then excludes package ids that are not ready in both the artifact and the fresh local readiness check. Placeholder planning does not accept readiness artifacts.
171
+ - `mc publish-bootstrap --from HEAD --output <path>` is the release-scoped first-release bootstrap command. It reads package ids from the release record, runs placeholder publishing, writes a JSON result artifact, and should be followed by a fresh `mc publish-readiness` run.
172
+ - Rerun `mc publish-readiness` whenever `monochange.toml`, package manifests, lockfiles, `.npmrc`, Cargo config/toolchain files, workspace `Cargo.toml`, or other publish tooling inputs change after an artifact was written.
173
+ - `mc placeholder-publish` remains the lower-level bootstrap command. It checks whether each managed package already exists in its registry and publishes a placeholder `0.0.0` version only for the missing ones.
174
+ - Placeholder README content can come from `publish.placeholder.readme` or `publish.placeholder.readme_file`.
175
+ - `publish.trusted_publishing = true` tells monochange to manage or verify trusted publishing for that package when supported.
176
+ - npm trusted publishing can be configured automatically from GitHub Actions context. pnpm workspaces use `pnpm exec npm trust ...` and `pnpm publish`, and monochange verifies the trust state before changing it.
177
+ - Cargo, `jsr`, `pub.dev`, and PyPI currently require manual trusted-publishing setup. monochange reports the setup URL and blocks the next built-in release publish until trust is configured.
178
+ - Prefer the official GitHub publishing workflows for manual registries when they exist: `rust-lang/crates-io-auth-action@v1` for `crates.io` and `dart-lang/setup-dart/.github/workflows/publish.yml@v1` for `pub.dev`.
179
+ - See [skills/trusted-publishing.md](skills/trusted-publishing.md) for the exact registry fields, commands, official workflow preferences, and GitHub Actions requirements across `npm`, `crates.io`, `jsr`, `pub.dev`, PyPI, and Go module tags.
180
+ - See [skills/multi-package-publishing.md](skills/multi-package-publishing.md) when one repository publishes multiple packages and you need to choose between shared readiness-enforced `mc publish` flows, package-specific jobs, or external workflows.
181
+ - Built-in publishing does not yet manage registry rate-limit retries or delayed requeues. Use `mode = "external"` if your workflow needs custom scheduling.
182
+
183
+ ### Release titles
184
+
185
+ <!-- {=releaseTitleConfig} -->
186
+
187
+ Two template fields control how release names and changelog version headings render:
188
+
189
+ - **`release_title`** — plain text title for provider releases (GitHub, GitLab, Gitea)
190
+ - **`changelog_version_title`** — markdown-capable title for changelog version headings
191
+
192
+ Both are configurable at `[defaults]`, `[package.*]`, and `[group.*]` levels.
193
+
194
+ Available template variables: `{{ version }}`, `{{ id }}`, `{{ date }}`, `{{ time }}`, `{{ datetime }}`, `{{ changes_count }}`, `{{ tag_url }}`, `{{ compare_url }}`.
195
+
196
+ ```toml
197
+ [defaults]
198
+ release_title = "{{ version }} ({{ date }})"
199
+ changelog_version_title = "[{{ version }}]({{ tag_url }}) ({{ date }})"
200
+
201
+ [group.main]
202
+ release_title = "v{{ version }} — released {{ date }}"
203
+ ```
204
+
205
+ <!-- {/releaseTitleConfig} -->
206
+
207
+ ### Groups and changelog filtering
208
+
209
+ Groups synchronize versions across packages. Group changelogs can filter included entries:
210
+
211
+ - `include = "all"` — all member changesets (default)
212
+ - `include = "group-only"` — only direct group-targeted changesets
213
+ - `include = ["package-id"]` — specific member changesets plus group-targeted ones
214
+
215
+ ## Changeset lifecycle
216
+
217
+ **Changesets must be actively managed, not just created.** Before writing a new changeset:
218
+
219
+ 1. Read all existing `.changeset/*.md` files to understand current coverage
220
+ 2. Determine the right action: **create new**, **update existing**, or **remove stale**
221
+ 3. Choose bump level and section type based on artifact type (library, application, CLI, LSP/MCP)
222
+ 4. Validate with `mc validate` or `mc diagnostics --format json`
223
+
224
+ See [skills/changeset-guide.md](skills/changeset-guide.md) for the full lifecycle management guide.
225
+
226
+ ## Artifact types
227
+
228
+ Different package types have different user-facing boundaries. Libraries expose APIs, applications expose UI, CLI tools expose commands, and LSP/MCP servers expose protocols. Changeset content, bump levels, and section types should adapt accordingly.
229
+
230
+ Applications and websites should use the `ux` changelog section type for visual and interaction changes, with screenshots when configured.
231
+
232
+ See [skills/artifact-types.md](skills/artifact-types.md) for per-type rules, templates, examples, and configuration.
233
+
234
+ ### Lint configuration
235
+
236
+ Configure manifest lint presets, global rules, and scoped overrides in the top-level `[lints]` section of `monochange.toml`, then run them with `mc check`:
237
+
238
+ ```toml
239
+ [lints]
240
+ use = ["cargo/recommended", "npm/recommended"]
241
+
242
+ [lints.rules]
243
+ "cargo/internal-dependency-workspace" = "error"
244
+ "npm/workspace-protocol" = "error"
245
+
246
+ [[lints.scopes]]
247
+ name = "published cargo packages"
248
+ match = { ecosystems = ["cargo"], managed = true, publishable = true }
249
+ rules = { "cargo/required-package-fields" = "error" }
250
+ ```
251
+
252
+ Each rule can be configured as:
253
+
254
+ - Simple severity: `"rule-id" = "error"`, `"rule-id" = "warning"`, or `"rule-id" = "off"`
255
+ - Detailed config: `{ level = "error", ...rule_specific_options }`
256
+
257
+ Use `mc lint list` or `mc lint explain <id>` to inspect available rules and presets.
258
+
259
+ Use `mc check --fix` to auto-fix issues where possible. Today the built-in rule sets focus on Cargo and npm-family manifests.
260
+
261
+ ## Guidance
262
+
263
+ Start with [skills/reference.md](skills/reference.md) for the broad reference.
264
+
265
+ Open [skills/readme.md](skills/readme.md) when you need the focused deep dives for adoption planning, changesets, commands, configuration, or linting.
266
+
267
+ Open [examples/readme.md](examples/readme.md) when a short scenario-based recommendation is more useful than a long reference document.
268
+
269
+ See [skills/trusted-publishing.md](skills/trusted-publishing.md) for GitHub/OIDC trusted-publishing setup details across the registries that monochange supports.
270
+
271
+ See [skills/multi-package-publishing.md](skills/multi-package-publishing.md) for monorepo publishing patterns when one repository ships multiple public packages.