@r5n/sisyphus 0.10.0 → 0.12.0

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.
Files changed (3) hide show
  1. package/README.md +36 -286
  2. package/dist/cli.js +151 -144
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,311 +1,61 @@
1
1
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/r5n-labs/clis/develop/packages/sisyphus/assets/logo.svg" width="128" alt="Sisyphus logo — a boulder resting on a slope">
2
+ <img src="https://raw.githubusercontent.com/r5n-labs/clis/develop/packages/sisyphus/assets/logo.svg" width="128" alt="Sisyphus logo — a figure pushing a boulder uphill">
3
3
  </p>
4
4
 
5
5
  # Sisyphus
6
6
 
7
- Monorepo versioning and release tool. Pending changes are recorded as "stones" (JSON files in `.sisyphus/stones/`, in the spirit of changesets); rolling them bumps versions, writes changelogs, tags, publishes, and pushes in one step.
7
+ **Small change records. One release.**
8
8
 
9
- [![npm](https://img.shields.io/npm/v/@r5n/sisyphus.svg)](https://www.npmjs.com/package/@r5n/sisyphus) [![license](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](./LICENSE)
10
-
11
- The binary is `sisyphus`, with `sis` as a short alias. Sisyphus runs on [Bun](https://bun.sh) and discovers packages from the `workspaces` globs in your root `package.json`.
12
-
13
- ## Install
9
+ Record pending package changes as **stones**: reviewable JSON files in `.sisyphus/stones/`. Roll them together to bump versions, write changelogs and create a release commit. Enable tags, pushes, npm publication and provider releases when you need them.
14
10
 
15
- ```bash
16
- bun add -g @r5n/sisyphus
17
- ```
11
+ [![npm](https://img.shields.io/npm/v/@r5n/sisyphus.svg)](https://www.npmjs.com/package/@r5n/sisyphus) [![license](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](./LICENSE)
18
12
 
19
- Or add it as a dev dependency and run it with `bunx @r5n/sisyphus`.
13
+ Runs on [Bun](https://bun.sh). The command is `sisyphus`, or `sis` for short. Packages are discovered from your root `package.json` workspaces.
20
14
 
21
15
  ## Quick start
22
16
 
23
- ```bash
24
- sisyphus init
25
- sisyphus version
26
- sisyphus check
27
- sisyphus roll
28
- ```
29
-
30
- `init` writes `.sisyphus/config.json` (flag-driven; an interactive form lives in the `sis -i` menu). `version` with no arguments prompts you to pick packages per bump type and enter a message, then writes a stone. `check` shows workspace packages and what each pending stone will release. `roll` merges all pending stones, applies the version bumps, and deletes the stones.
31
-
32
- By default `roll` only updates files and creates the release commit. Publishing, tagging, pushing, and provider releases are opt-in via flags or the `release` section of the config.
33
-
34
- ## Commands
35
-
36
- ### `sisyphus version`
37
-
38
- Create a stone. Interactive when run without positionals; non-interactive with a message and package lists:
39
-
40
- ```bash
41
- # Interactive
42
- sisyphus version
43
-
44
- # Apply one bump to every filtered package without prompts
45
- sisyphus version --bump minor --all --filter @org/core --message "feat: update core" --yes
46
-
47
- # Assign packages to bump groups without prompts
48
- sisyphus version --minor @org/core,@org/api --patch @org/utils --message "feat: update workspace" --yes
49
-
50
- # Generate stones from conventional commits
51
- sisyphus version --fromCommits --filter @org/core --dryRun
52
-
53
- # Create a tagged prerelease stone
54
- sisyphus version --bump patch --all --filter @org/core --message "fix: beta repair" --tag beta --yes
55
- ```
56
-
57
- **Options:**
58
- - `-a, --all` — Select every filtered package (requires `--bump`)
59
- - `-b, --bump` — Apply `major`, `minor`, or `patch` to every selected package
60
- - `-d, --dryRun` — Preview without writing stones
61
- - `-f, --filter` — Constrain interactive choices, explicit package lists, or commit analysis by package name
62
- - `--fromCommits` — Generate stones from conventional commits instead of manual selections
63
- - `-M, --major` — Comma-separated packages receiving a major bump
64
- - `--message` — Stone message; required for non-interactive manual selection
65
- - `-m, --minor` — Comma-separated packages receiving a minor bump
66
- - `-p, --patch` — Comma-separated packages receiving a patch bump
67
- - `-t, --tag` — Prerelease tag (alpha, beta, rc, etc.)
68
- - `-y, --yes` — Skip confirmation
69
-
70
- Packages that depend on the bumped ones are picked up automatically and get a dependency (patch-level) bump.
71
-
72
- The message and optional description can also be supplied as positional arguments. Do not combine a positional message
73
- with `--message`.
74
-
75
- ### `sisyphus check`
76
-
77
- Show the root package, workspace packages, and pending stones with the versions they will produce. `--json` for machine-readable output (used in CI), `-c, --config` to include the resolved config.
78
-
79
- ### `sisyphus stone`
80
-
81
- Manage pending stones: `list` (`-j`, `-v`), `show <id>` (`-j`), `edit <id> -m "new message"`, `merge <id...> -m "message"` (`-d` deletes the originals; conflicting bumps resolve to the highest), `delete <id>`. Subcommands prompt for a stone when no id is given.
82
-
83
- ### `sisyphus roll`
84
-
85
- Execute a release from all pending stones: bump versions, generate changelogs, delete the stones, commit, then optionally tag, push, publish, and create provider releases. Failures before an external operation roll back the commit, tags, file changes, and stones. Once an external operation starts, local state and a durable release ledger are preserved so the release can be reconciled and resumed.
86
-
87
- ```bash
88
- sisyphus roll --dryRun
89
- sisyphus roll -n -t -p -y
90
- sisyphus roll --resume
91
- ```
92
-
93
- - `-c, --changelog` — generate changelogs (default from `changelog.generate`)
94
- - `-n, --npm` — publish to npm (default from `release.npm`)
95
- - `-t, --tags` — create `name@version` git tags (default from `release.tags`)
96
- - `-p, --push` — push commits and tags (default from `release.push`)
97
- - `-r, --createRelease` — create a release on the git provider (default from `release.createRelease`)
98
- - `--noCommit` — skip the release commit (also disables tags, push, and provider release)
99
- - `--preview` — write changelogs, show them, then offer to revert
100
- - `--publishOnly` — publish from `currentRelease` recorded by `actions release-pr`, without touching files
101
- - `-j, --json` — print a machine-readable release report on stdout instead of the interactive output; the report carries a required `warnings` string array listing ignore exclusions, cycle-order caveats, and channel problems
102
- - `--resume` — reconcile and continue the active incomplete release
103
- - `--abort` — abandon the incomplete release if nothing external has started; releases with external progress must use `--resume`
104
- - `-d, --dryRun`, `-y, --yes`
105
-
106
- Provider releases require tags to be pushed to the same repository first, so normal releases must enable `--tags --push --createRelease`; publish-only releases require `--tags --createRelease` and push those exact tags before creating releases.
107
-
108
- Publishing builds each public package, rewrites its `package.json` to a clean publish manifest, and packs an immutable tarball before any package is uploaded. `workspace:` specifiers are resolved against actual workspace versions (`workspace:*` pins the exact version and `workspace:^`/`workspace:~` become ranges), `catalog:` specifiers are resolved from the root `catalog`/`catalogs`, and `devDependencies` are stripped. The source manifest is restored after packing, even if preparation fails. Private packages (`"private": true`) are skipped.
109
-
110
- Publication defaults to public access and honours `publishConfig.access: "restricted"` from the immutable package manifest. Invalid access values fail before publication.
111
-
112
- For releases with external operations, Sisyphus stores the plan, immutable artifacts, exact Git refs, and per-operation progress below Git's worktree-specific administrative directory. `--resume` verifies an ambiguous npm upload by SHA-512 integrity, verifies an ambiguous push from exact remote refs, and verifies provider releases by tag, title, and notes. If the external system cannot confirm the expected state, resume stops rather than repeating the operation.
113
-
114
- Npm publication requires a release commit, so it cannot be combined with `--noCommit`. Publish-only releases verify the source hash recorded by `actions release-pr`, the exact package versions, and the complete archived-stone set before creating tags or artifacts.
115
-
116
- ### `sisyphus pr`
117
-
118
- Create a stone from a pull request (GitHub via the `gh` CLI, which must be installed and authenticated). Reads title, body, labels, commits, and changed files; the bump type comes from labels via `pr.labelMapping`, the title, `-b/--bump`, or a prompt. PRs matching `pr.skip` (labels, authors, title patterns) are ignored.
119
-
120
- ```bash
121
- sisyphus pr -u https://github.com/org/repo/pull/123 -y
122
- ```
123
-
124
- ### `sisyphus migrate`
125
-
126
- Convert an existing `.changeset/` directory to stones and map supported changeset config (`ignore`, `commit`, `access`, `changelog`) onto the Sisyphus config. `-d, --dryRun`, `-y, --yes`.
127
-
128
- ### `sisyphus actions`
129
-
130
- CI integration. `actions init` detects your provider (GitHub Actions or GitLab CI) and installs workflow templates: a create-stone workflow that turns merged PRs into stones and maintains a release PR, and a release workflow that publishes when the release PR merges (`--all`, `--createStone`, `--release`, `-d`, `-y`). `actions release-pr` creates or updates the `sisyphus/release` branch and PR from pending stones, archives the stones to `.sisyphus/released/<timestamp>/`, and records `currentRelease` in the config for a later `roll --publishOnly`.
131
-
132
- Run `actions release-pr` from a clean working tree; commit or stash local changes first. It returns to the original branch after preparing or previewing the release PR.
133
-
134
- The generated GitLab workflows require `GITLAB_TOKEN` with API access and repository write permission; `SIS_PUSH_TOKEN` can supply a separate repository write credential. They configure a credential-free origin URL and a credential helper for both stone and release-branch pushes. Automatic MR detection expects GitLab's standard merge commit title and `See merge request <project>!<number>` footer. Use merge commits for release merge requests; squash, rebase and custom commit messages require adapting the rules or running the release job manually.
135
-
136
- ### `sisyphus init`
137
-
138
- Create or edit `.sisyphus/config.json`. Flag-driven when invoked directly (the interactive form lives in the `sis -i` menu); every form field has a matching flag (`--single`, `--tag`, `--npm`, `--tags`, `--push`, `--createRelease`, `--changelog`, `--rootChangelog`, `--commitAuthor`, `--commitEmail`, `--commitMessage`). `--default` resets to defaults, `--force` overwrites non-interactively. Also records the current HEAD as `lastStone`, the baseline for `version --fromCommits`.
139
-
140
- ## Configuration
141
-
142
- `.sisyphus/config.json`, created by `init` (trimmed excerpt — `init` writes the full default set, including an extended `pr.labelMapping` and commit-skip patterns):
143
-
144
- ```json
145
- {
146
- "$schema": "https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/sisyphus/schema.json",
147
- "single": false,
148
- "tag": "latest",
149
- "commit": {
150
- "author": "r5n-bot",
151
- "email": "r5n-bot@users.noreply.github.com",
152
- "message": "chore(release): {message}"
153
- },
154
- "changelog": {
155
- "generate": true,
156
- "root": false,
157
- "append": true,
158
- "filename": "CHANGELOG.md",
159
- "packageHeader": "{emoji} {version} ({date})",
160
- "rootHeader": "{date} - {packages}"
161
- },
162
- "release": {
163
- "npm": false,
164
- "tags": false,
165
- "push": false,
166
- "createRelease": false
167
- },
168
- "commits": {
169
- "skip": {
170
- "authors": ["r5n-bot[bot]"],
171
- "messagePatterns": ["^chore\\(release\\):"]
172
- }
173
- },
174
- "pr": {
175
- "labelMapping": { "breaking": "major", "feature": "minor", "fix": "patch" },
176
- "skip": {
177
- "labels": ["sisyphus-release", "skip-stone"],
178
- "authors": ["r5n-bot[bot]"],
179
- "titlePatterns": ["^chore\\(release\\):"]
180
- }
181
- }
182
- }
183
- ```
184
-
185
- - `single` — version the root package instead of workspace packages
186
- - `tag` — npm dist-tag used when publishing
187
- - `commit` — release commit author/email and message template; `{message}` and `{packages}` are substituted; a valid `email` is required whenever `author` is set
188
- - `changelog` — `sections` maps conventional commit types (`feat`, `fix`, `breaking`, ...) to headings; `root` adds a combined root changelog; `packageHeader`/`rootHeader` support `{emoji}`, `{version}`, `{date}`, `{packages}`
189
- - `commits.skip` / `pr.skip` — filters for `version --fromCommits` and `pr`
190
- - `release` — defaults for the corresponding `roll` flags, plus `release.build` (see below)
191
- - `dependents` — which manifest sections pull a dependent into a release (`kinds`) and whether dependents are always released or only when their published range no longer admits the new version (`updateInternal`)
192
- - `ignore` — package names or globs that are never released; they are skipped when selecting packages, never pulled in as dependents, and never traversed through
193
- - `sisyphusDir` / `stonesPath` — relocate the config directory or stone storage
194
- - `lastStone`, `stones`, `currentRelease` — managed by the CLI; don't edit by hand
195
-
196
- ## Stones
197
-
198
- Each stone is a JSON file at `.sisyphus/stones/<id>.json`, safe to commit and review:
199
-
200
- ```json
201
- {
202
- "id": "0001-741d2bed",
203
- "message": "feat: add auth",
204
- "description": "Optional longer notes",
205
- "minor": ["@org/auth"],
206
- "patch": ["@org/api"],
207
- "dependency": ["@org/app"]
208
- }
209
- ```
210
-
211
- Stones may also carry a `tag` (prerelease) and the `commits` they were generated from. `roll` merges every pending stone, keeping the highest bump per package. Every pending stone must agree on the prerelease tag, and a package cannot be both a snapshot and a normal release in one roll.
212
-
213
- ## Dependents
214
-
215
- Selecting a package pulls in everything that depends on it, transitively, as a `dependency` bump. Propagation follows only `workspace:` protocol specifiers — a dependency declared with a plain version range is never treated as an internal edge, even when its name matches a workspace package. Edges come from the manifest sections listed in `dependents.kinds`; the default includes `devDependencies` because bundled packages inline their workspace dependencies at build time. Drop it when only the published manifest matters:
216
-
217
- ```json
218
- {
219
- "dependents": {
220
- "kinds": ["dependencies", "optionalDependencies", "peerDependencies"],
221
- "updateInternal": "always"
222
- }
223
- }
224
- ```
225
-
226
- `updateInternal: "outOfRange"` releases a dependent only when its published range would no longer admit the new version — `workspace:*` is always invalidated, `workspace:^` survives a minor bump above 0.x, `workspace:~` survives a patch, and a literal `workspace:<range>` is never rewritten so it never triggers a release. Releases are ordered so a dependency is tagged and published before the dependent that pins it. Publication order follows runtime, optional and peer dependencies; development dependencies are removed from the published manifest and do not constrain that order.
227
-
228
- When an untagged release graduates a prerelease package, selected prerelease dependents connected through the sections in `dependents.kinds` graduate with it. Excluded sections cannot cause a dependent to leave its prerelease channel.
229
-
230
- ## Prereleases
231
-
232
- Pass `--tag` to `version` to open a prerelease channel. The base version is bumped first, so the prerelease always sorts above the last stable release:
233
-
234
- | current | stone | result |
235
- | --- | --- | --- |
236
- | `1.0.0` | minor + `--tag beta` | `1.1.0-beta.0` |
237
- | `1.1.0-beta.0` | patch + `--tag beta` | `1.1.0-beta.1` |
238
- | `1.1.0-beta.1` | major + `--tag beta` | `2.0.0-beta.0` |
239
- | `1.1.0-beta.1` | patch, no tag | `1.1.0` |
240
-
241
- Omitting `--tag` leaves the channel and lands on the accumulated stable target. The npm dist-tag follows the channel, so prereleases never publish as `latest`. A single roll cannot publish stable and prerelease packages to npm together — the dist-tag applies to the whole release — so such a mix fails closed before anything is published. In practice, graduate the prerelease packages first or roll the two channels separately.
242
-
243
- ## Build
244
-
245
- `roll` builds each package before packing it. By default that is `bun run build` in the package directory:
246
-
247
- ```json
248
- {
249
- "release": {
250
- "build": {
251
- "command": ["bun", "run", "build"],
252
- "root": [["bun", "run", "build:dts"]],
253
- "outputs": ["packages/*/dist/**"]
254
- }
255
- }
256
- }
17
+ ```sh
18
+ bun add -g @r5n/sisyphus
19
+ sis init
20
+ sis version
21
+ sis check
22
+ sis roll
257
23
  ```
258
24
 
259
- `root` runs once at the repository root before the first package is packed — for declarations or bundles generated centrally. `command: []` disables the per-package build. `outputs` declares the gitignored paths the build writes: they are removed before the build and exempted from the guards that otherwise reject untracked and ignored files, while everything else stays rejected. A declared output that Git tracks is refused before any build runs. Commands are executed directly, never through a shell.
25
+ `init` creates the configuration. `version` prompts for package bumps and a message, then saves a stone. `check` previews the release. `roll` applies the pending stones and creates a release commit.
260
26
 
261
- ## GitHub Actions
27
+ **Publishing is opt-in.** By default, `roll` updates local files and creates the commit. Review the [release options](https://github.com/r5n-labs/clis/blob/develop/packages/sisyphus/docs/commands.md#sisyphus-roll) before enabling external operations.
262
28
 
263
- A push-based release job, modeled on this repo's own workflow: roll whenever pending stones land on the main branch. Uses npm trusted publishing (OIDC), which needs `id-token: write` and npm >= 11.5.1, plus each package configured for trusted publishing on npmjs.com. If you don't use OIDC, `roll` publishes with plain `npm publish`, so a granular token in `~/.npmrc` (via `NPM_TOKEN`) works too.
29
+ ## Everyday commands
264
30
 
265
- ```yaml
266
- name: Release
31
+ | Task | Command |
32
+ | --- | --- |
33
+ | Create a stone interactively | `sis version` |
34
+ | Preview stones from conventional commits | `sis version --fromCommits --dryRun` |
35
+ | Inspect pending changes | `sis check` |
36
+ | Edit or combine stones | `sis stone` |
37
+ | Preview a release | `sis roll --dryRun` |
38
+ | Resume an interrupted release | `sis roll --resume` |
39
+ | Create a stone from a pull request | `sis pr -u <url>` |
40
+ | Install CI workflows | `sis actions init` |
267
41
 
268
- on:
269
- push:
270
- branches: [main]
42
+ Use `sis -i` for the interactive menu and `sis <command> --help` for options. Sisyphus follows workspace dependencies, supports prerelease channels and keeps a durable ledger so interrupted external operations can be reconciled before resuming.
271
43
 
272
- permissions:
273
- contents: write
274
- id-token: write
44
+ ## Guides
275
45
 
276
- jobs:
277
- release:
278
- runs-on: ubuntu-latest
279
- if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
280
- steps:
281
- - uses: actions/checkout@v7
282
- with:
283
- fetch-depth: 0
284
- - uses: oven-sh/setup-bun@v2
285
- - run: bun install
286
- - run: npm install -g npm@11
287
- - name: Check for pending stones
288
- run: |
289
- COUNT=$(bunx @r5n/sisyphus check --json | jq '.stones | length')
290
- echo "STONES_COUNT=$COUNT" >> "$GITHUB_ENV"
291
- - name: Roll release
292
- if: env.STONES_COUNT != '0'
293
- run: |
294
- git config user.name "github-actions[bot]"
295
- git config user.email "github-actions[bot]@users.noreply.github.com"
296
- bunx @r5n/sisyphus roll --yes
297
- env:
298
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
299
- ```
46
+ | Guide | Covers |
47
+ | --- | --- |
48
+ | [Command reference](https://github.com/r5n-labs/clis/blob/develop/packages/sisyphus/docs/commands.md) | Versioning, releases, stones, pull requests, migration and CI commands |
49
+ | [Configuration and release model](https://github.com/r5n-labs/clis/blob/develop/packages/sisyphus/docs/configuration.md) | Config fields, stone format, dependency propagation, prereleases and builds |
50
+ | [GitHub Actions](https://github.com/r5n-labs/clis/blob/develop/packages/sisyphus/docs/github-actions.md) | Push-based releases, trusted publishing and generated workflows |
300
51
 
301
- On self-hosted runners, set `NPM_CONFIG_PROVENANCE: "false"` on the roll step; provenance generation only works on GitHub-hosted runners. For the PR-driven flow (stone per merged PR, rolling release PR, publish on merge), run `sisyphus actions init` and commit the generated workflows instead.
52
+ Configuration has an [editor schema](https://github.com/r5n-labs/clis/blob/develop/packages/sisyphus/schema.json).
302
53
 
303
54
  ## Requirements
304
55
 
305
- - Bun (the CLI is a Bun executable)
306
- - git, with a `workspaces` field in the root `package.json` (unless `single`)
307
- - `gh` CLI, authenticated, for GitHub PR and release operations (`pr`, `actions release-pr`, `roll --createRelease`); GitLab is supported via `GITLAB_TOKEN` or `glab`
56
+ - Bun and Git; a root `workspaces` field unless using `single` mode.
57
+ - Authenticated `gh` for GitHub pull requests and releases. GitLab operations use `GITLAB_TOKEN` or `glab`.
308
58
 
309
- ## License
59
+ ## Licence
310
60
 
311
- Apache 2.0 — see [LICENSE](./LICENSE)
61
+ [Apache 2.0](LICENSE).