@r5n/sisyphus 0.5.1 → 0.6.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 +125 -234
  2. package/dist/cli.js +101 -100
  3. package/package.json +2 -6
package/README.md CHANGED
@@ -1,327 +1,218 @@
1
1
  # Sisyphus
2
2
 
3
- <div align="center">
3
+ 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.
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/@r5n/sisyphus.svg)](https://www.npmjs.com/package/@r5n/sisyphus)
6
- [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](./LICENSE)
7
- ![Bundle Size](https://img.shields.io/badge/bundle_size-~163KB-green.svg)
5
+ [![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)
8
6
 
9
- Monorepo versioning with changesets ("stones").
7
+ 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`.
10
8
 
11
- </div>
12
-
13
- ## Quick Start
9
+ ## Install
14
10
 
15
11
  ```bash
16
- # Install
17
12
  bun add -g @r5n/sisyphus
18
-
19
- # Initialize
20
- sisyphus init
21
-
22
- # Create a version "stone"
23
- sisyphus version
24
-
25
- # Release
26
- sisyphus roll --npm --github
27
13
  ```
28
14
 
29
- ## Why Stones?
15
+ Or add it as a dev dependency and run it with `bunx @r5n/sisyphus`.
30
16
 
31
- Traditional versioning forces immediate releases. Stones let you stack changes and release when ready:
17
+ ## Quick start
32
18
 
33
19
  ```bash
34
- # Monday: Bug fix
35
- sisyphus version --bump patch --filter @org/auth
36
-
37
- # Tuesday: New feature
38
- sisyphus version --bump minor --filter @org/api
39
-
40
- # Friday: Ship it
41
- sisyphus check # Review pending changes
42
- sisyphus roll --npm --github # Release all at once
20
+ sisyphus init
21
+ sisyphus version
22
+ sisyphus check
23
+ sisyphus roll
43
24
  ```
44
25
 
45
- **Benefits:**
46
- - Stack changes throughout the week
47
- - Coordinate multi-package updates
48
- - Review before releasing
49
- - Git-friendly (stones are markdown files)
50
-
51
- ## Commands
52
-
53
- ### `sisyphus init`
26
+ `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.
54
27
 
55
- Initialize config in your project.
28
+ 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.
56
29
 
57
- ```bash
58
- sisyphus init # Interactive
59
- sisyphus init --single # Single package mode
60
- sisyphus init --nonInteractive # Skip prompts
61
- ```
30
+ ## Commands
62
31
 
63
32
  ### `sisyphus version`
64
33
 
65
- Create a version stone (changeset).
34
+ Create a stone. Interactive when run without positionals; non-interactive with a message and package lists:
66
35
 
67
36
  ```bash
68
- # Interactive
69
- sisyphus version
70
-
71
- # Specify packages and bump
72
- sisyphus version --bump minor --filter @org/core
73
-
74
- # Snapshot/prerelease
75
- sisyphus version --snapshot --tag dev
37
+ sisyphus version "feat: add auth" -m @org/auth -p @org/core
38
+ sisyphus version "fix: rc fixes" -p @org/api -t beta
39
+ sisyphus version --fromCommits
76
40
  ```
77
41
 
78
- **Options:**
79
- - `-b, --bump` — Bump type: major, minor, patch
80
- - `-f, --filter` — Package name filter
81
- - `-s, --snapshot` — Create snapshot version
82
- - `-t, --tag` — Release tag (alpha, beta, rc, etc.)
83
- - `-y, --yes` — Skip confirmation
42
+ - `-M, --major` / `-m, --minor` / `-p, --patch` — comma-separated package lists
43
+ - `--fromCommits` — generate stones from conventional commits since the last release (`lastStone` in config; `commits.skip` filters apply)
44
+ - `-t, --tag` — prerelease tag (e.g. `beta`), applied to the computed versions
45
+ - `-f, --filter` — filter workspace packages by name
46
+ - `-d, --dryRun`, `-y, --yes`
47
+
48
+ Packages that depend on the bumped ones are picked up automatically and get a dependency (patch-level) bump.
84
49
 
85
50
  ### `sisyphus check`
86
51
 
87
- Review pending stones.
52
+ 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.
88
53
 
89
- ```bash
90
- sisyphus check
91
- sisyphus check --json # JSON output
92
- ```
54
+ ### `sisyphus stone`
93
55
 
94
- Shows:
95
- - Pending stones
96
- - Package version changes
97
- - Dependency updates
98
- - Last release info
56
+ 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.
99
57
 
100
58
  ### `sisyphus roll`
101
59
 
102
- Process stones and release.
60
+ Execute a release from all pending stones: bump versions, generate changelogs, delete the stones, commit, then optionally tag, publish, push, and create a provider release. Any step failure rolls back the created commit, tags, and file changes and restores the stones.
103
61
 
104
62
  ```bash
105
- # Full release
106
- sisyphus roll --npm --github --changelog
107
-
108
- # Dry run
109
- sisyphus roll --dry-run
110
-
111
- # Just changelogs
112
- sisyphus roll --changelog
63
+ sisyphus roll --dryRun
64
+ sisyphus roll -n -t -p -y
113
65
  ```
114
66
 
115
- **Options:**
116
- - `-n, --npm` — Publish to npm
117
- - `-g, --github` — Create GitHub releases
118
- - `-c, --changelog` — Generate changelogs
119
- - `-t, --withTags` — Create git tags
120
- - `-d, --dryRun` — Preview without changes
121
- - `--npmToken` — NPM authentication token
122
- - `--githubToken` — GitHub authentication token
67
+ - `-c, --changelog` — generate changelogs (default from `changelog.generate`)
68
+ - `-n, --npm` — publish to npm (default from `release.npm`)
69
+ - `-t, --tags` — create `name@version` git tags (default from `release.tags`)
70
+ - `-p, --push` — push commits and tags (default from `release.push`)
71
+ - `-r, --createRelease` — create a release on the git provider (default from `release.createRelease`)
72
+ - `--noCommit` — skip the release commit (also disables tags, push, and provider release)
73
+ - `--preview` — write changelogs, show them, then offer to revert
74
+ - `--publishOnly` — publish from `currentRelease` recorded by `actions release-pr`, without touching files
75
+ - `-d, --dryRun`, `-y, --yes`
123
76
 
124
- ### `sisyphus prerelease`
77
+ Publishing builds each package (`bun run build`) and runs `npm publish --tag <tag> --access public` in its directory. Private packages (`"private": true`) are skipped. Before publishing, each `package.json` is rewritten to a clean manifest: `workspace:` specifiers are resolved against the actual workspace versions (`workspace:*` pins the exact version, `workspace:^`/`workspace:~` become ranges), `catalog:` specifiers are resolved from the root `catalog`/`catalogs`, and `devDependencies` are stripped. The original file text is restored afterward, even if publishing fails.
125
78
 
126
- Manage prerelease versions.
79
+ ### `sisyphus pr`
127
80
 
128
- ```bash
129
- # Create beta prerelease
130
- sisyphus prerelease --type beta --bump minor
81
+ 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.
131
82
 
132
- # Promote prereleases interactively
133
- sisyphus prerelease --promote
83
+ ```bash
84
+ sisyphus pr -u https://github.com/org/repo/pull/123 -y
134
85
  ```
135
86
 
136
- **Promotion flow:**
137
- - Alpha → Beta, RC, or Stable
138
- - Beta → RC or Stable
139
- - RC → Stable
140
-
141
- ### `sisyphus stone`
87
+ ### `sisyphus migrate`
142
88
 
143
- Manage individual stones.
89
+ Convert an existing `.changeset/` directory to stones and map supported changeset config (`ignore`, `commit`, `access`, `changelog`) onto the Sisyphus config. `-d, --dryRun`, `-y, --yes`.
144
90
 
145
- ```bash
146
- sisyphus stone list # List all stones
147
- sisyphus stone show <id> # Show stone details
148
- sisyphus stone delete <id> # Remove a stone
149
- sisyphus stone edit <id> # Edit stone message
150
- sisyphus stone merge # Combine multiple stones
151
- ```
91
+ ### `sisyphus actions`
152
92
 
153
- ### `sisyphus graph`
93
+ 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`.
154
94
 
155
- Visualize package dependencies.
95
+ ### `sisyphus init`
156
96
 
157
- ```bash
158
- sisyphus graph # Show full graph
159
- sisyphus graph --filter @org/core # Focus on package
160
- sisyphus graph --json # Export as JSON
161
- ```
97
+ 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`.
162
98
 
163
99
  ## Configuration
164
100
 
165
- Sisyphus uses `.sisyphus/config.json`:
101
+ `.sisyphus/config.json`, created by `init` (trimmed excerpt — `init` writes the full default set, including an extended `pr.labelMapping` and commit-skip patterns):
166
102
 
167
103
  ```json
168
104
  {
169
- "$schema": "https://raw.githubusercontent.com/r5n-labs/clis/main/packages/sisyphus/schema.json",
170
- "tag": "latest",
171
- "ignore": ["*-internal"],
105
+ "$schema": "https://raw.githubusercontent.com/r5n-labs/clis/refs/heads/develop/packages/sisyphus/schema.json",
172
106
  "single": false,
107
+ "tag": "latest",
173
108
  "commit": {
174
- "message": "chore(release): ${message}"
109
+ "author": "r5n-bot",
110
+ "message": "chore(release): {message}"
111
+ },
112
+ "changelog": {
113
+ "generate": true,
114
+ "root": false,
115
+ "append": true,
116
+ "filename": "CHANGELOG.md",
117
+ "packageHeader": "{emoji} {version} ({date})",
118
+ "rootHeader": "{date} - {packages}"
175
119
  },
176
120
  "release": {
177
- "github": true,
178
- "npm": true,
179
- "tags": true
121
+ "npm": false,
122
+ "tags": false,
123
+ "push": false,
124
+ "createRelease": false
180
125
  },
181
- "changelog": {
182
- "generate": true
126
+ "commits": {
127
+ "skip": {
128
+ "authors": ["r5n-bot[bot]"],
129
+ "messagePatterns": ["^chore\\(release\\):"]
130
+ }
131
+ },
132
+ "pr": {
133
+ "labelMapping": { "breaking": "major", "feature": "minor", "fix": "patch" },
134
+ "skip": {
135
+ "labels": ["sisyphus-release", "skip-stone"],
136
+ "authors": ["r5n-bot[bot]"],
137
+ "titlePatterns": ["^chore\\(release\\):"]
138
+ }
183
139
  }
184
140
  }
185
141
  ```
186
142
 
187
- ## Stone Format
188
-
189
- Stones are stored in `.sisyphus/stones/` as markdown:
190
-
191
- ```markdown
192
- ### feat: add authentication
193
-
194
- Added OAuth2 support.
195
-
196
- ---
197
-
198
- | minor | patch |
199
- | :-------: | :-----------------: |
200
- | @org/auth | @org/core, @org/api |
201
- ```
202
-
203
- ## Project Structure
204
-
205
- ```
206
- your-project/
207
- ├── .sisyphus/
208
- │ ├── config.json
209
- │ └── stones/
210
- │ ├── feat-auth.md
211
- │ └── fix-bug.md
212
- ├── packages/
213
- │ ├── core/
214
- │ │ ├── package.json
215
- │ │ └── CHANGELOG.md
216
- │ └── auth/
217
- │ ├── package.json
218
- │ └── CHANGELOG.md
219
- └── CHANGELOG.md
220
- ```
221
-
222
- ## Examples
223
-
224
- ### Monorepo Workflow
225
-
226
- ```bash
227
- # Feature work
228
- sisyphus version --bump minor --filter @app/core
143
+ - `single` — version the root package instead of workspace packages
144
+ - `tag` — npm dist-tag used when publishing
145
+ - `commit` — release commit author/email and message template; `{message}` and `{packages}` are substituted
146
+ - `changelog` — `sections` maps conventional commit types (`feat`, `fix`, `breaking`, ...) to headings; `root` adds a combined root changelog; `packageHeader`/`rootHeader` support `{emoji}`, `{version}`, `{date}`, `{packages}`
147
+ - `commits.skip` / `pr.skip` — filters for `version --fromCommits` and `pr`
148
+ - `release` — defaults for the corresponding `roll` flags
149
+ - `sisyphusDir` / `stonesPath` — relocate the config directory or stone storage
150
+ - `lastStone`, `stones`, `currentRelease` — managed by the CLI; don't edit by hand
229
151
 
230
- # Bug fix
231
- sisyphus version --bump patch --filter @app/auth
152
+ ## Stones
232
153
 
233
- # Breaking change
234
- sisyphus version --bump major --filter @app/api
154
+ Each stone is a JSON file at `.sisyphus/stones/<id>.json`, safe to commit and review:
235
155
 
236
- # Release all
237
- sisyphus check
238
- sisyphus roll --npm --github --changelog
156
+ ```json
157
+ {
158
+ "id": "0001-741d2bed",
159
+ "message": "feat: add auth",
160
+ "description": "Optional longer notes",
161
+ "minor": ["@org/auth"],
162
+ "patch": ["@org/api"],
163
+ "dependency": ["@org/app"]
164
+ }
239
165
  ```
240
166
 
241
- ### Prerelease Flow
242
-
243
- ```bash
244
- # Create beta
245
- sisyphus prerelease --type beta --bump minor --filter @org/new-feature
246
-
247
- # Release beta
248
- sisyphus roll --npm
167
+ 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.
249
168
 
250
- # Promote to stable
251
- sisyphus prerelease --promote
252
- ```
169
+ ## GitHub Actions
253
170
 
254
- ### CI/CD Integration
171
+ 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.
255
172
 
256
173
  ```yaml
257
- # .github/workflows/release.yml
258
174
  name: Release
259
175
 
260
176
  on:
261
177
  push:
262
178
  branches: [main]
263
179
 
180
+ permissions:
181
+ contents: write
182
+ id-token: write
183
+
264
184
  jobs:
265
185
  release:
266
186
  runs-on: ubuntu-latest
187
+ if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
267
188
  steps:
268
189
  - uses: actions/checkout@v4
269
- - uses: oven-sh/setup-bun@v1
270
-
190
+ with:
191
+ fetch-depth: 0
192
+ - uses: oven-sh/setup-bun@v2
271
193
  - run: bun install
272
-
273
- - name: Check for stones
274
- id: check
194
+ - run: npm install -g npm@11
195
+ - name: Check for pending stones
196
+ run: |
197
+ COUNT=$(bunx @r5n/sisyphus check --json | jq '.stones | length')
198
+ echo "STONES_COUNT=$COUNT" >> "$GITHUB_ENV"
199
+ - name: Roll release
200
+ if: env.STONES_COUNT != '0'
275
201
  run: |
276
- if [ -d ".sisyphus/stones" ] && [ "$(ls -A .sisyphus/stones)" ]; then
277
- echo "has_stones=true" >> $GITHUB_OUTPUT
278
- fi
279
-
280
- - name: Release
281
- if: steps.check.outputs.has_stones == 'true'
282
- run: bunx @r5n/sisyphus roll --npm --github --changelog
202
+ git config user.name "github-actions[bot]"
203
+ git config user.email "github-actions[bot]@users.noreply.github.com"
204
+ bunx @r5n/sisyphus roll --yes
283
205
  env:
284
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
285
206
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
286
207
  ```
287
208
 
288
- ## Security
209
+ 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.
289
210
 
290
- ### Token Management
211
+ ## Requirements
291
212
 
292
- - **NPM:** Requires `NPM_TOKEN` env var or `--npmToken`
293
- - **GitHub:** Requires `GITHUB_TOKEN` env var or `--githubToken`
294
- - Never store tokens in config files
295
- - Use environment variables in CI/CD
296
-
297
- ### Best Practices
298
-
299
- 1. Review stones before rolling (`sisyphus check`)
300
- 2. Test with dry-run mode
301
- 3. Commit stones to version control
302
- 4. Use branch protection for releases
303
-
304
- ## Troubleshooting
305
-
306
- **No stones found:**
307
- - Create stones with `sisyphus version` first
308
- - Check `.sisyphus/stones/` directory exists
309
-
310
- **Package not found:**
311
- - Verify package name
312
- - Check if package is ignored in config
313
-
314
- **Publish failed:**
315
- - Verify NPM token permissions
316
- - Check if version already exists
317
- - Ensure package.json has required fields
318
-
319
- **Debug mode:**
320
- ```bash
321
- DEBUG=* sisyphus roll --dry-run
322
- cat .sisyphus/config.json
323
- ls -la .sisyphus/stones/
324
- ```
213
+ - Bun (the CLI is a Bun executable)
214
+ - git, with a `workspaces` field in the root `package.json` (unless `single`)
215
+ - `gh` CLI, authenticated, for GitHub PR and release operations (`pr`, `actions release-pr`, `roll --createRelease`); GitLab is supported via `GITLAB_TOKEN` or `glab`
325
216
 
326
217
  ## License
327
218