genbumppush 0.0.3 → 0.0.4

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/README.md CHANGED
@@ -66,7 +66,7 @@ genbumppush --retry-gitlab v1.2.4 # retry provider rel
66
66
  | `--yes`, `-y` | Skip confirmation |
67
67
  | `--help`, `-h` | Print help |
68
68
 
69
- Values are resolved in this order: CLI, config file, the `genbumppush` key in `package.json`, then defaults. A CLI flag such as `--no-push` overrides the config file.
69
+ Values are resolved in this order: CLI flags, C12 config file, the `"genbumppush"` key in `package.json`, then defaults. A CLI flag such as `--no-push` overrides both config surfaces.
70
70
 
71
71
  ## Commit detection
72
72
 
@@ -84,7 +84,7 @@ chore(deps): update vite -> excluded by default
84
84
 
85
85
  ## Configuration
86
86
 
87
- Create `genbumppush.config.ts`:
87
+ Prefer a dedicated C12 file so the config stays typed, commented, and out of dependency diffs. Create `genbumppush.config.ts`:
88
88
 
89
89
  ```ts
90
90
  import { defineConfig } from 'genbumppush';
@@ -113,35 +113,83 @@ export default defineConfig({
113
113
  });
114
114
  ```
115
115
 
116
- The same object can live under `"genbumppush"` in `package.json`. JavaScript and TypeScript C12 files are supported; use `--config` for another location.
117
-
118
- | Key | Type | Default | Behavior |
119
- | -------------------------- | ------------------------- | ------------------------------ | -------------------------------------- |
120
- | `release` | release type | detected | Force release type |
121
- | `preid` | string | `beta` | Prerelease channel |
122
- | `changelog` | `false \| true \| string` | `CHANGELOG.md` | Disable, default, or custom path |
123
- | `excludeDependencyCommits` | boolean | `true` | Ignore non-breaking dependency commits |
124
- | `files` | string[] | `['package.json']` | Version files |
125
- | `recursive` | boolean | `false` | Discover nested manifests |
126
- | `git.remote` | string | `origin` | Remote for checks and push |
127
- | `git.push` | boolean | `true` | Push branch and tag |
128
- | `git.sign` | boolean | `false` | Sign commit and tag |
129
- | `git.requireClean` | boolean | `true` | Reject uncommitted changes |
130
- | `git.requireUpstream` | boolean | `true` | Require upstream before pushing |
131
- | `git.commitMessage` | string | `chore(release): v{{version}}` | Commit template |
132
- | `git.tagName` | string | `v{{version}}` | Tag template |
133
- | `git.tagMessage` | string | `v{{version}}` | Annotated tag template |
134
- | `hooks.before` | string or string[] | unset | Commands before file changes |
135
- | `hooks.after` | string or string[] | unset | Commands after tag/push |
136
- | `github.enabled` | boolean | `false` | Create a GitHub release after push |
137
- | `github.host` | string | `github.com` | github.com or GHES host |
138
- | `github.repo` | string | `GITHUB_REPOSITORY` / remote | `owner/name` |
139
- | `github.tokenEnv` | string | `GITHUB_TOKEN` | Token environment variable |
140
- | `github.releaseName` | string | tag | Release title template |
141
- | `gitlab.enabled` | boolean | `false` | Create a GitLab release after push |
116
+ JavaScript C12 files are also supported. Use `--config <path>` to load a file at another location.
117
+
118
+ ### Config in `package.json`
119
+
120
+ For simple setups, the same object can live under the exact top-level key `"genbumppush"` in `package.json`. Other keys are ignored.
121
+
122
+ ```json
123
+ {
124
+ "name": "my-app",
125
+ "version": "1.2.3",
126
+ "genbumppush": {
127
+ "changelog": "CHANGELOG.md",
128
+ "files": ["package.json"],
129
+ "git": {
130
+ "remote": "origin",
131
+ "push": true,
132
+ "tagName": "v{{version}}"
133
+ }
134
+ }
135
+ }
136
+ ```
137
+
138
+ JSON has no comments and no `defineConfig` typing, so move to `genbumppush.config.ts` once the release config grows nested `github`/`gitlab` blocks or custom hooks. A config file always wins over the `package.json` key.
139
+
140
+ **Never put secrets in either surface.** Tokens, host credentials, and project IDs with credentials belong in the process environment or an uncommitted `.env`. Config may only name which env var to read (for example `tokenEnv`).
141
+
142
+ | Key | Type | Default | Behavior |
143
+ | -------------------------- | ------------------------- | ------------------------------ | --------------------------------------- |
144
+ | `release` | release type | detected | Force release type |
145
+ | `preid` | string | `beta` | Prerelease channel |
146
+ | `changelog` | `false \| true \| string` | `CHANGELOG.md` | Disable, default, or custom path |
147
+ | `excludeDependencyCommits` | boolean | `true` | Ignore non-breaking dependency commits |
148
+ | `files` | string[] | `['package.json']` | Version files |
149
+ | `recursive` | boolean | `false` | Discover nested manifests |
150
+ | `git.remote` | string | `origin` | Remote for checks and push |
151
+ | `git.push` | boolean | `true` | Push branch and tag |
152
+ | `git.sign` | boolean | `false` | Sign commit and tag |
153
+ | `git.requireClean` | boolean | `true` | Reject uncommitted changes |
154
+ | `git.requireUpstream` | boolean | `true` | Require upstream before pushing |
155
+ | `git.commitMessage` | string | `chore(release): v{{version}}` | Commit template |
156
+ | `git.tagName` | string | `v{{version}}` | Tag template |
157
+ | `git.tagMessage` | string | `v{{version}}` | Annotated tag template |
158
+ | `hooks.before` | string or string[] | unset | Commands before file changes |
159
+ | `hooks.after` | string or string[] | unset | Commands after tag/push |
160
+ | `github.enabled` | boolean | `false` | Create a GitHub release after push |
161
+ | `github.host` | string | `github.com` | github.com or GHES host |
162
+ | `github.repo` | string | env / remote | `owner/name` |
163
+ | `github.tokenEnv` | string | auto | Exact env var name (disables fallbacks) |
164
+ | `github.releaseName` | string | tag | Release title template |
165
+ | `gitlab.enabled` | boolean | `false` | Create a GitLab release after push |
142
166
 
143
167
  `{{version}}` is replaced in commit and tag templates. Hooks run through the shell in the repository directory; only use trusted configuration.
144
168
 
169
+ ## Environment variables and `.env`
170
+
171
+ Config never stores secrets — not in `genbumppush.config.ts`, not in `"genbumppush"` inside `package.json`. Those files are committed; tokens must not be. Provider credentials are read from the process environment. On every run, genbumppush loads `.env` from the working directory (same behavior as changelogen). Values already set in the real environment win over `.env`.
172
+
173
+ Preferred names use the `GENBUMPPUSH_` prefix. Legacy provider variables still work as fallbacks:
174
+
175
+ | Purpose | Preferred | Fallbacks |
176
+ | ----------------- | ------------------------------- | ------------------------------------------------------- |
177
+ | GitHub token | `GENBUMPPUSH_GITHUB_TOKEN` | `GITHUB_TOKEN`, `GH_TOKEN`, `CHANGELOGEN_TOKENS_GITHUB` |
178
+ | GitHub host | `GENBUMPPUSH_GITHUB_HOST` | `GITHUB_API_URL` |
179
+ | GitHub repository | `GENBUMPPUSH_GITHUB_REPOSITORY` | `GITHUB_REPOSITORY` |
180
+ | GitLab token | `GENBUMPPUSH_GITLAB_TOKEN` | `GITLAB_TOKEN` |
181
+ | GitLab host | `GENBUMPPUSH_GITLAB_HOST` | `GITLAB_HOST` |
182
+ | GitLab project | `GENBUMPPUSH_GITLAB_PROJECT` | `GITLAB_PROJECT` |
183
+
184
+ When `tokenEnv` is set in config, only that exact variable name is read; the fallback chain is skipped. Leave `tokenEnv` unset to use the preferred/fallback chain above.
185
+
186
+ ```bash
187
+ # .env (do not commit)
188
+ GENBUMPPUSH_GITHUB_TOKEN=ghp_...
189
+ ```
190
+
191
+ `.env` is optional. Add it to `.gitignore`. CI should inject the same variables through the job environment instead of a file.
192
+
145
193
  ## Version-file adapters
146
194
 
147
195
  Every configured file is validated before writes begin. Structured files must agree with the root version; mismatches fail without partial updates.
@@ -216,8 +264,8 @@ export default defineConfig({
216
264
  github: {
217
265
  enabled: true,
218
266
  // host: 'github.com', // or a GHES host
219
- // repo: 'group/project', // or GITHUB_REPOSITORY / package.json repository
220
- tokenEnv: 'GITHUB_TOKEN', // also honors GH_TOKEN and CHANGELOGEN_TOKENS_GITHUB
267
+ // repo: 'group/project', // or GENBUMPPUSH_GITHUB_REPOSITORY / GITHUB_REPOSITORY / package.json
268
+ // omit tokenEnv to use GENBUMPPUSH_GITHUB_TOKEN, then GITHUB_TOKEN / GH_TOKEN / CHANGELOGEN_TOKENS_GITHUB
221
269
  releaseName: 'v{{version}}',
222
270
  },
223
271
  });
@@ -234,14 +282,12 @@ export default defineConfig({
234
282
  enabled: true,
235
283
  host: 'https://gitlab.com',
236
284
  project: 'group/project',
237
- tokenEnv: 'GITLAB_TOKEN',
238
285
  releaseName: 'v{{version}}',
239
286
  },
240
287
  });
241
288
  ```
242
289
 
243
- `GITLAB_HOST` and `GITLAB_PROJECT` may be used as environment fallbacks. The token
244
- must be available as the configured `tokenEnv` (default `GITLAB_TOKEN`). GitLab receives
290
+ Without `tokenEnv`, GitLab tokens resolve from `GENBUMPPUSH_GITLAB_TOKEN`, then `GITLAB_TOKEN`. `GENBUMPPUSH_GITLAB_HOST` / `GITLAB_HOST` and `GENBUMPPUSH_GITLAB_PROJECT` / `GITLAB_PROJECT` cover host and project fallbacks. GitLab receives
245
291
  the matching `CHANGELOG.md` section as the release description. If `git.push` is false,
246
292
  the provider is rejected because GitLab cannot create a release for an unpublished tag.
247
293
 
@@ -320,6 +366,10 @@ vp pack
320
366
 
321
367
  The test suite covers CLI parsing, C12 configuration, SemVer edges, JSON/npm/Cargo adapters, recursive workspaces, dry runs, rollback, hooks, tag collisions, detached HEAD, upstream checks, and a real atomic push to a temporary bare Git remote.
322
368
 
369
+ ### Agent skill
370
+
371
+ This repository ships a project skill at `skills/genbumppush/`. Agents working in this checkout can load it for configuration recipes, CLI and error recovery, CI patterns, and library development notes. New conversations that open this worktree pick it up automatically; it is not published on npm.
372
+
323
373
  ## License
324
374
 
325
375
  MIT
package/dist/bin.mjs CHANGED
@@ -1,7 +1,21 @@
1
1
  #!/usr/bin/env node
2
- import { n as ReleaseError, t as runRelease } from "./release-CVQ5WSKG.mjs";
2
+ import { n as ReleaseError, t as runRelease } from "./release-gwyqzR0C.mjs";
3
3
  import { resolve } from "node:path";
4
4
  //#region src/types.ts
5
+ /**
6
+ * Every release type genbumppush can apply.
7
+ *
8
+ * The first seven values match Semantic Versioning. The `pre*` variants
9
+ * enter a prerelease channel (`beta` by default); `prerelease` continues
10
+ * an existing one.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import type { ReleaseType } from 'genbumppush';
15
+ *
16
+ * const forced: ReleaseType = 'minor';
17
+ * ```
18
+ */
5
19
  const RELEASE_TYPES = [
6
20
  "major",
7
21
  "premajor",
package/dist/index.d.mts CHANGED
@@ -1,81 +1,519 @@
1
1
  //#region src/types.d.ts
2
+ /**
3
+ * Every release type genbumppush can apply.
4
+ *
5
+ * The first seven values match Semantic Versioning. The `pre*` variants
6
+ * enter a prerelease channel (`beta` by default); `prerelease` continues
7
+ * an existing one.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import type { ReleaseType } from 'genbumppush';
12
+ *
13
+ * const forced: ReleaseType = 'minor';
14
+ * ```
15
+ */
2
16
  declare const RELEASE_TYPES: readonly ["major", "premajor", "minor", "preminor", "patch", "prepatch", "prerelease"];
17
+ /** One of {@link RELEASE_TYPES}. */
3
18
  type ReleaseType = (typeof RELEASE_TYPES)[number];
19
+ /**
20
+ * How genbumppush talks to Git: remote name, commit/tag templates,
21
+ * and the safety checks run before anything is written.
22
+ */
4
23
  type GitOptions = {
24
+ /** Remote used for tag collision checks and `git push`. Default: `'origin'`. */
5
25
  remote?: string;
26
+ /**
27
+ * Push the release commit and tag together with `git push --atomic`.
28
+ * Set to `false` for a local-only rehearsal.
29
+ * @defaultValue true
30
+ */
6
31
  push?: boolean;
32
+ /**
33
+ * Sign the release commit (`git commit -S`) and annotated tag (`git tag -s`).
34
+ * @defaultValue false
35
+ */
7
36
  sign?: boolean;
37
+ /**
38
+ * Refuse to release when the worktree has uncommitted changes.
39
+ * @defaultValue true
40
+ */
8
41
  requireClean?: boolean;
42
+ /**
43
+ * Require the current branch to have an upstream before pushing.
44
+ * Ignored when {@link GitOptions.push} is `false`.
45
+ * @defaultValue true
46
+ */
9
47
  requireUpstream?: boolean;
48
+ /**
49
+ * Release commit subject. `{{version}}` is replaced with the new version
50
+ * (without a leading `v` unless the template adds one).
51
+ * @defaultValue `'chore(release): v{{version}}'`
52
+ * @example `'release: v{{version}}'`
53
+ */
10
54
  commitMessage?: string;
55
+ /**
56
+ * Tag name template. `{{version}}` is replaced with the new version.
57
+ * @defaultValue `'v{{version}}'`
58
+ */
11
59
  tagName?: string;
60
+ /**
61
+ * Annotated tag message template. `{{version}}` is replaced with the new version.
62
+ * @defaultValue `'v{{version}}'`
63
+ */
12
64
  tagMessage?: string;
13
65
  };
66
+ /**
67
+ * Shell commands run around the release.
68
+ *
69
+ * Commands run in the repository root with a shell. Use them for gates you
70
+ * want on every release (checks, tests), not for storing secrets.
71
+ */
14
72
  type HookOptions = {
73
+ /**
74
+ * Runs after validation and before version files or the changelog change.
75
+ * A failing hook aborts the release with nothing written.
76
+ * @example
77
+ * ```ts
78
+ * hooks: {
79
+ * before: ['npm run check', 'npm test'],
80
+ * }
81
+ * ```
82
+ */
15
83
  before?: string | string[];
84
+ /**
85
+ * Runs after the commit, tag, and optional provider release succeed.
86
+ * @example
87
+ * ```ts
88
+ * hooks: {
89
+ * after: 'echo "Shipped {{version}}"',
90
+ * }
91
+ * ```
92
+ */
16
93
  after?: string | string[];
17
94
  };
95
+ /**
96
+ * Optional GitLab release creation after a successful Git push.
97
+ *
98
+ * Credentials come from the environment (`GENBUMPPUSH_GITLAB_TOKEN` or
99
+ * `GITLAB_TOKEN`). Never put the token itself in this object.
100
+ */
18
101
  type GitLabOptions = {
102
+ /**
103
+ * Create a GitLab release for the new tag.
104
+ * Requires {@link GitOptions.push} to stay enabled and a token in the environment.
105
+ * @defaultValue false
106
+ */
19
107
  enabled?: boolean;
108
+ /**
109
+ * GitLab base URL, including protocol when not on gitlab.com.
110
+ * @defaultValue `'https://gitlab.com'`
111
+ * @example `'https://gitlab.example.com'`
112
+ */
20
113
  host?: string;
114
+ /**
115
+ * Project path or numeric ID, as used by the GitLab API.
116
+ * Falls back to `GENBUMPPUSH_GITLAB_PROJECT` or `GITLAB_PROJECT`.
117
+ * @example `'group/subgroup/project'`
118
+ */
21
119
  project?: string;
120
+ /**
121
+ * Exact environment variable name to read the token from.
122
+ * When set, the usual fallback chain is skipped.
123
+ * @example `'CI_JOB_TOKEN'`
124
+ */
22
125
  tokenEnv?: string;
126
+ /**
127
+ * Release title template. `{{version}}` is replaced with the new version.
128
+ * @defaultValue the tag name (for example `v1.2.3`)
129
+ */
23
130
  releaseName?: string;
24
131
  };
132
+ /**
133
+ * Optional GitHub (or GitHub Enterprise Server) release after a successful Git push.
134
+ *
135
+ * Credentials come from the environment (`GENBUMPPUSH_GITHUB_TOKEN`,
136
+ * `GITHUB_TOKEN`, or `GH_TOKEN`). Never put the token itself in this object.
137
+ */
25
138
  type GitHubOptions = {
139
+ /**
140
+ * Create a GitHub release for the new tag.
141
+ * Requires {@link GitOptions.push} to stay enabled and a token in the environment.
142
+ * @defaultValue false
143
+ */
26
144
  enabled?: boolean;
145
+ /**
146
+ * GitHub host. `github.com` uses the public API; any other host is treated
147
+ * as GitHub Enterprise Server (`https://<host>/api/v3`).
148
+ * @defaultValue `'github.com'`
149
+ */
27
150
  host?: string;
151
+ /**
152
+ * Repository as `owner/name`. Usually inferred from the Git remote.
153
+ * Override when inference is wrong or unavailable.
154
+ * @example `'xcvzmoon/genbumppush'`
155
+ */
28
156
  repo?: string;
157
+ /**
158
+ * Exact environment variable name to read the token from.
159
+ * When set, the usual fallback chain is skipped.
160
+ */
29
161
  tokenEnv?: string;
162
+ /**
163
+ * Release title template. `{{version}}` is replaced with the new version.
164
+ * @defaultValue the tag name (for example `v1.2.3`)
165
+ */
30
166
  releaseName?: string;
31
167
  };
168
+ /**
169
+ * Full genbumppush configuration.
170
+ *
171
+ * Every field is optional. Missing values fall back to the built-in defaults
172
+ * documented on each property. Prefer {@link defineConfig} in a config file
173
+ * so your editor can check the shape.
174
+ *
175
+ * @example Minimal config in `genbumppush.config.ts`
176
+ * ```ts
177
+ * import { defineConfig } from 'genbumppush';
178
+ *
179
+ * export default defineConfig({
180
+ * files: ['package.json', 'package-lock.json'],
181
+ * git: { tagName: 'v{{version}}' },
182
+ * });
183
+ * ```
184
+ *
185
+ * @example Same object under `"genbumppush"` in `package.json`
186
+ * ```json
187
+ * {
188
+ * "genbumppush": {
189
+ * "changelog": false,
190
+ * "git": { "push": false }
191
+ * }
192
+ * }
193
+ * ```
194
+ */
32
195
  type GenBumpPushConfig = {
196
+ /**
197
+ * Force a release type instead of detecting it from Conventional Commits.
198
+ * Leave unset for automatic detection.
199
+ * @example `'patch'`
200
+ */
33
201
  release?: ReleaseType;
202
+ /**
203
+ * Prerelease identifier used by `premajor`, `preminor`, `prepatch`,
204
+ * and `prerelease`.
205
+ * @defaultValue `'beta'`
206
+ * @example `'rc'` produces `1.2.4-rc.0` from `1.2.3`
207
+ */
34
208
  preid?: string;
209
+ /**
210
+ * Files whose version strings are updated for the release.
211
+ * Each path is relative to the repository root and must stay inside it.
212
+ * @defaultValue `['package.json']`
213
+ * @example
214
+ * ```ts
215
+ * files: [
216
+ * 'package.json',
217
+ * 'src-tauri/tauri.conf.json',
218
+ * 'src-tauri/Cargo.toml',
219
+ * ]
220
+ * ```
221
+ */
35
222
  files?: string[];
223
+ /**
224
+ * Also update every nested `package.json` under the repository.
225
+ * Meant for fixed-version monorepos that share one version number.
226
+ * @defaultValue false
227
+ */
36
228
  recursive?: boolean;
229
+ /**
230
+ * Changelog behavior:
231
+ * - `false` — do not write a changelog
232
+ * - `true` — write `CHANGELOG.md`
233
+ * - `string` — write that path
234
+ * @defaultValue `'CHANGELOG.md'`
235
+ * @example `'docs/RELEASES.md'`
236
+ */
37
237
  changelog?: boolean | string;
238
+ /**
239
+ * Ignore non-breaking `chore(deps): …` commits when detecting the next
240
+ * version and building the changelog.
241
+ * @defaultValue true
242
+ */
38
243
  excludeDependencyCommits?: boolean;
244
+ /** Git commit, tag, and push behavior. See {@link GitOptions}. */
39
245
  git?: GitOptions;
246
+ /** Optional GitLab release after push. See {@link GitLabOptions}. */
40
247
  gitlab?: GitLabOptions;
248
+ /** Optional GitHub release after push. See {@link GitHubOptions}. */
41
249
  github?: GitHubOptions;
250
+ /** Shell commands run before and after the release. See {@link HookOptions}. */
42
251
  hooks?: HookOptions;
43
252
  };
253
+ /**
254
+ * Parsed CLI arguments for {@link runRelease}.
255
+ *
256
+ * You usually receive this from the binary rather than building it by hand.
257
+ * When embedding genbumppush, the minimum object is `{ cwd, dryRun: false, yes: true }`
258
+ * (plus `help: false` if you want a complete {@link CliOptions}).
259
+ *
260
+ * @example Non-interactive patch release in another directory
261
+ * ```ts
262
+ * import { runRelease } from 'genbumppush';
263
+ *
264
+ * await runRelease({
265
+ * cwd: '/path/to/repo',
266
+ * dryRun: false,
267
+ * yes: true,
268
+ * help: false,
269
+ * release: 'patch',
270
+ * });
271
+ * ```
272
+ */
44
273
  type CliOptions = {
274
+ /** Absolute path to the Git repository to release. Defaults to `process.cwd()` in the CLI. */
45
275
  cwd: string;
276
+ /** Explicit C12 config file path. Overrides discovery and the `package.json` key. */
46
277
  configFile?: string;
278
+ /** Retry only GitLab release creation for a tag that already exists on the remote. */
47
279
  gitlabRetryTag?: string;
280
+ /** Retry only GitHub release creation for a tag that already exists on the remote. */
48
281
  githubRetryTag?: string;
282
+ /** Force a release type; otherwise it is detected from commits (or config). */
49
283
  release?: ReleaseType;
284
+ /** Prerelease identifier; overrides the value from config when set. */
50
285
  preid?: string;
286
+ /** Preview the release without changing files, Git, or remotes. */
51
287
  dryRun: boolean;
288
+ /** `false` keeps the commit and tag local. Unset means “use config”. */
52
289
  push?: boolean;
290
+ /** Skip the interactive `Create a … release?` confirmation. */
53
291
  yes: boolean;
292
+ /** Print CLI help and exit without running a release. */
54
293
  help: boolean;
55
294
  };
295
+ /**
296
+ * What {@link runRelease} did (or would do, for a dry run).
297
+ *
298
+ * When there are no releasable commits, `releaseType`, `newVersion`, and
299
+ * `tag` stay `undefined` and `pushed` is `false`. That is a successful no-op.
300
+ *
301
+ * @example Inspect a dry run
302
+ * ```ts
303
+ * import { runRelease } from 'genbumppush';
304
+ *
305
+ * const result = await runRelease({ cwd: process.cwd(), dryRun: true, yes: true, help: false });
306
+ * if (result.releaseType === undefined) {
307
+ * console.log('Nothing to release');
308
+ * } else {
309
+ * console.log(`${result.currentVersion} → ${result.newVersion} as ${result.tag}`);
310
+ * }
311
+ * ```
312
+ */
56
313
  type ReleaseResult = {
314
+ /** Version before this run (from the root `package.json`). */
57
315
  currentVersion: string;
316
+ /** Version after the bump. Absent on dry-run skips and “no releasable commits”. */
58
317
  newVersion?: string;
318
+ /** Release type that was applied (or planned, for a dry run). */
59
319
  releaseType?: ReleaseType;
320
+ /** Tag name created or planned, after `{{version}}` substitution. */
60
321
  tag?: string;
322
+ /** `true` only when the branch and tag were pushed to the remote. */
61
323
  pushed: boolean;
324
+ /** `true` when the run was a dry run and nothing was written. */
62
325
  dryRun: boolean;
326
+ /** Number of Conventional Commits that fed the release decision. */
63
327
  commitCount: number;
328
+ /** `true` when a GitLab release was created after the Git push. */
64
329
  gitlabReleaseCreated?: boolean;
330
+ /** `true` when a GitHub release was created after the Git push. */
65
331
  githubReleaseCreated?: boolean;
66
332
  };
67
333
  //#endregion
68
334
  //#region src/config.d.ts
335
+ /**
336
+ * Identity helper that types a release config for your editor.
337
+ *
338
+ * It does not change the object at runtime — it only enables autocomplete
339
+ * and catches typos inside `defineConfig({ … })`.
340
+ *
341
+ * @typeParam Config - Config object shape; defaults to {@link GenBumpPushConfig}.
342
+ * @returns The same object you passed in.
343
+ *
344
+ * @example `genbumppush.config.ts`
345
+ * ```ts
346
+ * import { defineConfig } from 'genbumppush';
347
+ *
348
+ * export default defineConfig({
349
+ * preid: 'beta',
350
+ * files: ['package.json'],
351
+ * git: {
352
+ * commitMessage: 'chore(release): v{{version}}',
353
+ * },
354
+ * hooks: {
355
+ * before: ['npm run check', 'npm test'],
356
+ * },
357
+ * });
358
+ * ```
359
+ */
69
360
  export declare const defineConfig: import("c12").DefineConfig<GenBumpPushConfig, import("c12").ConfigLayerMeta>;
361
+ /**
362
+ * Load the effective release config for a repository.
363
+ *
364
+ * Resolution order (later wins):
365
+ * 1. {@link defaults}
366
+ * 2. `"genbumppush"` key in that directory’s `package.json`
367
+ * 3. C12 config file (`genbumppush.config.ts` / `.js`, or `configFile` when given)
368
+ * 4. `overrides` you pass here (CLI flags in the binary go through this)
369
+ *
370
+ * Also loads `.env` from `cwd` into `process.env` without overwriting
371
+ * variables that are already set. Secrets still belong in the environment —
372
+ * not in config files.
373
+ *
374
+ * @param cwd - Repository root to load config from.
375
+ * @param configFile - Optional explicit path to a C12 config file.
376
+ * @param overrides - Highest-priority values (for example CLI flags).
377
+ * @returns The fully merged config object.
378
+ * @throws May reject if the config file throws or cannot be loaded.
379
+ *
380
+ * @example Read what a repo already configured
381
+ * ```ts
382
+ * import { loadReleaseConfig } from 'genbumppush';
383
+ *
384
+ * const config = await loadReleaseConfig(process.cwd());
385
+ * console.log(config.git?.remote ?? 'origin');
386
+ * ```
387
+ *
388
+ * @example Force a dry-run-style push disable from a script
389
+ * ```ts
390
+ * import { loadReleaseConfig } from 'genbumppush';
391
+ *
392
+ * const config = await loadReleaseConfig(process.cwd(), undefined, {
393
+ * git: { push: false },
394
+ * });
395
+ * // config.git.push === false even if the file enabled push
396
+ * ```
397
+ */
70
398
  export declare function loadReleaseConfig(cwd: string, configFile?: string, overrides?: GenBumpPushConfig): Promise<GenBumpPushConfig>;
71
399
  //#endregion
72
400
  //#region src/error.d.ts
401
+ /**
402
+ * Error thrown by genbumppush for expected release failures.
403
+ *
404
+ * Unlike a generic `Error`, every {@link ReleaseError} carries a stable
405
+ * {@link ReleaseError.code} so scripts and the CLI can branch on the reason
406
+ * (`DIRTY_WORKTREE`, `TAG_EXISTS`, `CANCELLED`, …) without parsing messages.
407
+ *
408
+ * @example Branch on the failure reason
409
+ * ```ts
410
+ * import { runRelease, ReleaseError } from 'genbumppush';
411
+ *
412
+ * try {
413
+ * await runRelease({ cwd: process.cwd(), dryRun: false, yes: true, help: false });
414
+ * } catch (error) {
415
+ * if (error instanceof ReleaseError && error.code === 'CANCELLED') {
416
+ * process.exit(0);
417
+ * }
418
+ * throw error;
419
+ * }
420
+ * ```
421
+ *
422
+ * @example Print code and message the same way the CLI does
423
+ * ```ts
424
+ * if (error instanceof ReleaseError) {
425
+ * console.error(`[${error.code}] ${error.message}`);
426
+ * }
427
+ * ```
428
+ */
73
429
  export declare class ReleaseError extends Error {
430
+ /** Machine-readable reason, for example `'DIRTY_WORKTREE'` or `'TAG_EXISTS'`. */
74
431
  readonly code: string;
432
+ /**
433
+ * @param code - Stable machine-readable reason.
434
+ * @param message - Human-readable explanation shown to the user.
435
+ * @param options - Optional `cause` when wrapping an underlying error.
436
+ */
75
437
  constructor(code: string, message: string, options?: ErrorOptions);
76
438
  }
77
439
  //#endregion
78
440
  //#region src/release.d.ts
441
+ /**
442
+ * Run a full release (or a dry run / provider retry) for one repository.
443
+ *
444
+ * Typical flow:
445
+ * 1. Load config and `.env`
446
+ * 2. Verify the worktree is a clean Git repo on a branch
447
+ * 3. Detect (or force) a release type from Conventional Commits
448
+ * 4. Confirm, run `before` hooks, update version files and the changelog
449
+ * 5. Commit, tag, and atomically push branch + tag
450
+ * 6. Optionally create a GitHub/GitLab release, then run `after` hooks
451
+ *
452
+ * Version-file or commit failures restore files and the index. A failed tag
453
+ * or network push can leave the release commit locally so you can inspect
454
+ * and retry — see the returned {@link ReleaseResult} and any thrown
455
+ * {@link ReleaseError}.
456
+ *
457
+ * Prefer the `genbumppush` CLI for day-to-day use. Call this directly when
458
+ * embedding releases in a Node script or CI job that already builds
459
+ * {@link CliOptions}.
460
+ *
461
+ * @param options - Parsed CLI options. `cwd`, `dryRun`, `yes`, and `help` are required;
462
+ * the rest override config when set.
463
+ * @returns A summary of what happened. Never mutates when `dryRun` is `true`.
464
+ * @throws {@link ReleaseError} for expected failures (dirty worktree, existing tag,
465
+ * cancelled confirmation, Git/provider errors). Unexpected errors may also throw.
466
+ *
467
+ * @example Dry run in the current directory
468
+ * ```ts
469
+ * import { runRelease } from 'genbumppush';
470
+ *
471
+ * const result = await runRelease({
472
+ * cwd: process.cwd(),
473
+ * dryRun: true,
474
+ * yes: true,
475
+ * help: false,
476
+ * });
477
+ *
478
+ * console.log(result);
479
+ * // {
480
+ * // currentVersion: '1.2.3',
481
+ * // newVersion: '1.3.0',
482
+ * // releaseType: 'minor',
483
+ * // tag: 'v1.3.0',
484
+ * // pushed: false,
485
+ * // dryRun: true,
486
+ * // commitCount: 4
487
+ * // }
488
+ * ```
489
+ *
490
+ * @example Non-interactive patch release that stays local
491
+ * ```ts
492
+ * import { runRelease } from 'genbumppush';
493
+ *
494
+ * await runRelease({
495
+ * cwd: process.cwd(),
496
+ * dryRun: false,
497
+ * yes: true,
498
+ * help: false,
499
+ * release: 'patch',
500
+ * push: false,
501
+ * });
502
+ * ```
503
+ *
504
+ * @example Retry only the GitLab release after Git already succeeded
505
+ * ```ts
506
+ * import { runRelease } from 'genbumppush';
507
+ *
508
+ * await runRelease({
509
+ * cwd: process.cwd(),
510
+ * dryRun: false,
511
+ * yes: true,
512
+ * help: false,
513
+ * gitlabRetryTag: 'v1.3.0',
514
+ * });
515
+ * ```
516
+ */
79
517
  export declare function runRelease(options: CliOptions): Promise<ReleaseResult>;
80
518
  //#endregion
81
519
  export type { CliOptions, GenBumpPushConfig, GitHubOptions, GitLabOptions, GitOptions, HookOptions, ReleaseResult, ReleaseType };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { i as loadReleaseConfig, n as ReleaseError, r as defineConfig, t as runRelease } from "./release-CVQ5WSKG.mjs";
1
+ import { i as loadReleaseConfig, n as ReleaseError, r as defineConfig, t as runRelease } from "./release-gwyqzR0C.mjs";
2
2
  export { ReleaseError, defineConfig, loadReleaseConfig, runRelease };
@@ -1,4 +1,4 @@
1
- import { createDefineConfig, loadConfig } from "c12";
1
+ import { createDefineConfig, loadConfig, setupDotenv } from "c12";
2
2
  import { determineSemverChange, generateMarkDown, getGitDiff, loadChangelogConfig, parseCommits, resolveRepoConfig } from "changelogen";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { readFile, readdir, realpath, unlink, writeFile } from "node:fs/promises";
@@ -6,7 +6,38 @@ import { basename, dirname, isAbsolute, join, relative, resolve } from "node:pat
6
6
  import { createInterface } from "node:readline/promises";
7
7
  import { execFileSync, spawnSync } from "node:child_process";
8
8
  //#region src/config.ts
9
+ /**
10
+ * Identity helper that types a release config for your editor.
11
+ *
12
+ * It does not change the object at runtime — it only enables autocomplete
13
+ * and catches typos inside `defineConfig({ … })`.
14
+ *
15
+ * @typeParam Config - Config object shape; defaults to {@link GenBumpPushConfig}.
16
+ * @returns The same object you passed in.
17
+ *
18
+ * @example `genbumppush.config.ts`
19
+ * ```ts
20
+ * import { defineConfig } from 'genbumppush';
21
+ *
22
+ * export default defineConfig({
23
+ * preid: 'beta',
24
+ * files: ['package.json'],
25
+ * git: {
26
+ * commitMessage: 'chore(release): v{{version}}',
27
+ * },
28
+ * hooks: {
29
+ * before: ['npm run check', 'npm test'],
30
+ * },
31
+ * });
32
+ * ```
33
+ */
9
34
  const defineConfig = createDefineConfig();
35
+ /**
36
+ * Built-in defaults used when neither the CLI, a config file, nor
37
+ * `package.json` sets a field.
38
+ *
39
+ * Useful if you want to document or assert what an empty config resolves to.
40
+ */
10
41
  const defaults = {
11
42
  changelog: "CHANGELOG.md",
12
43
  excludeDependencyCommits: true,
@@ -22,7 +53,45 @@ const defaults = {
22
53
  tagMessage: "v{{version}}"
23
54
  }
24
55
  };
56
+ /**
57
+ * Load the effective release config for a repository.
58
+ *
59
+ * Resolution order (later wins):
60
+ * 1. {@link defaults}
61
+ * 2. `"genbumppush"` key in that directory’s `package.json`
62
+ * 3. C12 config file (`genbumppush.config.ts` / `.js`, or `configFile` when given)
63
+ * 4. `overrides` you pass here (CLI flags in the binary go through this)
64
+ *
65
+ * Also loads `.env` from `cwd` into `process.env` without overwriting
66
+ * variables that are already set. Secrets still belong in the environment —
67
+ * not in config files.
68
+ *
69
+ * @param cwd - Repository root to load config from.
70
+ * @param configFile - Optional explicit path to a C12 config file.
71
+ * @param overrides - Highest-priority values (for example CLI flags).
72
+ * @returns The fully merged config object.
73
+ * @throws May reject if the config file throws or cannot be loaded.
74
+ *
75
+ * @example Read what a repo already configured
76
+ * ```ts
77
+ * import { loadReleaseConfig } from 'genbumppush';
78
+ *
79
+ * const config = await loadReleaseConfig(process.cwd());
80
+ * console.log(config.git?.remote ?? 'origin');
81
+ * ```
82
+ *
83
+ * @example Force a dry-run-style push disable from a script
84
+ * ```ts
85
+ * import { loadReleaseConfig } from 'genbumppush';
86
+ *
87
+ * const config = await loadReleaseConfig(process.cwd(), undefined, {
88
+ * git: { push: false },
89
+ * });
90
+ * // config.git.push === false even if the file enabled push
91
+ * ```
92
+ */
25
93
  async function loadReleaseConfig(cwd, configFile, overrides) {
94
+ await setupDotenv({ cwd });
26
95
  return (await loadConfig({
27
96
  name: "genbumppush",
28
97
  cwd,
@@ -36,8 +105,42 @@ async function loadReleaseConfig(cwd, configFile, overrides) {
36
105
  }
37
106
  //#endregion
38
107
  //#region src/error.ts
108
+ /**
109
+ * Error thrown by genbumppush for expected release failures.
110
+ *
111
+ * Unlike a generic `Error`, every {@link ReleaseError} carries a stable
112
+ * {@link ReleaseError.code} so scripts and the CLI can branch on the reason
113
+ * (`DIRTY_WORKTREE`, `TAG_EXISTS`, `CANCELLED`, …) without parsing messages.
114
+ *
115
+ * @example Branch on the failure reason
116
+ * ```ts
117
+ * import { runRelease, ReleaseError } from 'genbumppush';
118
+ *
119
+ * try {
120
+ * await runRelease({ cwd: process.cwd(), dryRun: false, yes: true, help: false });
121
+ * } catch (error) {
122
+ * if (error instanceof ReleaseError && error.code === 'CANCELLED') {
123
+ * process.exit(0);
124
+ * }
125
+ * throw error;
126
+ * }
127
+ * ```
128
+ *
129
+ * @example Print code and message the same way the CLI does
130
+ * ```ts
131
+ * if (error instanceof ReleaseError) {
132
+ * console.error(`[${error.code}] ${error.message}`);
133
+ * }
134
+ * ```
135
+ */
39
136
  var ReleaseError = class extends Error {
137
+ /** Machine-readable reason, for example `'DIRTY_WORKTREE'` or `'TAG_EXISTS'`. */
40
138
  code;
139
+ /**
140
+ * @param code - Stable machine-readable reason.
141
+ * @param message - Human-readable explanation shown to the user.
142
+ * @param options - Optional `cause` when wrapping an underlying error.
143
+ */
41
144
  constructor(code, message, options) {
42
145
  super(message, options);
43
146
  this.name = "ReleaseError";
@@ -101,6 +204,26 @@ function runHook(command, cwd) {
101
204
  }).status !== 0) throw new ReleaseError("HOOK_FAILED", `Hook failed: ${command}`);
102
205
  }
103
206
  //#endregion
207
+ //#region src/env.ts
208
+ const ENV = {
209
+ GITHUB_TOKEN: "GENBUMPPUSH_GITHUB_TOKEN",
210
+ GITHUB_HOST: "GENBUMPPUSH_GITHUB_HOST",
211
+ GITHUB_REPOSITORY: "GENBUMPPUSH_GITHUB_REPOSITORY",
212
+ GITLAB_TOKEN: "GENBUMPPUSH_GITLAB_TOKEN",
213
+ GITLAB_HOST: "GENBUMPPUSH_GITLAB_HOST",
214
+ GITLAB_PROJECT: "GENBUMPPUSH_GITLAB_PROJECT"
215
+ };
216
+ function readEnv(name) {
217
+ const value = process.env[name];
218
+ return value !== void 0 && value.length > 0 ? value : void 0;
219
+ }
220
+ function readEnvFirst(...names) {
221
+ for (const name of names) {
222
+ const value = readEnv(name);
223
+ if (value !== void 0) return value;
224
+ }
225
+ }
226
+ //#endregion
104
227
  //#region src/github.ts
105
228
  function normalizeHost(host) {
106
229
  return host.replace(/^https?:\/\//, "").replace(/\/$/, "");
@@ -113,23 +236,22 @@ function apiBase(host) {
113
236
  function encodeRepoPath(repo) {
114
237
  return repo.split("/").map((segment) => encodeURIComponent(segment)).join("/");
115
238
  }
239
+ const GITHUB_TOKEN_FALLBACKS = [
240
+ ENV.GITHUB_TOKEN,
241
+ "GITHUB_TOKEN",
242
+ "GH_TOKEN",
243
+ "CHANGELOGEN_TOKENS_GITHUB"
244
+ ];
245
+ function githubTokenEnvLabel(tokenEnv) {
246
+ return tokenEnv ?? `${ENV.GITHUB_TOKEN} (or GITHUB_TOKEN, GH_TOKEN, CHANGELOGEN_TOKENS_GITHUB)`;
247
+ }
116
248
  function resolveGitHubToken(tokenEnv) {
117
- if (tokenEnv !== void 0) {
118
- const token = process.env[tokenEnv];
119
- return token !== void 0 && token.length > 0 ? token : void 0;
120
- }
121
- for (const name of [
122
- "GITHUB_TOKEN",
123
- "GH_TOKEN",
124
- "CHANGELOGEN_TOKENS_GITHUB"
125
- ]) {
126
- const token = process.env[name];
127
- if (token !== void 0 && token.length > 0) return token;
128
- }
249
+ if (tokenEnv !== void 0) return readEnv(tokenEnv);
250
+ return readEnvFirst(...GITHUB_TOKEN_FALLBACKS);
129
251
  }
130
252
  async function resolveGitHubRepo(cwd, source) {
131
- const host = normalizeHost(source.host ?? process.env.GITHUB_API_URL ?? "github.com");
132
- const explicit = source.repo ?? process.env.GITHUB_REPOSITORY;
253
+ const host = normalizeHost(source.host ?? readEnv(ENV.GITHUB_HOST) ?? readEnv("GITHUB_API_URL") ?? "github.com");
254
+ const explicit = source.repo ?? readEnvFirst(ENV.GITHUB_REPOSITORY, "GITHUB_REPOSITORY");
133
255
  if (explicit !== void 0 && explicit.length > 0) return {
134
256
  host,
135
257
  repo: explicit
@@ -139,7 +261,7 @@ async function resolveGitHubRepo(cwd, source) {
139
261
  host: normalizeHost(resolved.domain ?? host),
140
262
  repo: resolved.repo
141
263
  };
142
- throw new ReleaseError("GITHUB_RELEASE_FAILED", "Set github.repo or GITHUB_REPOSITORY to create a GitHub release.");
264
+ throw new ReleaseError("GITHUB_RELEASE_FAILED", `Set github.repo or ${ENV.GITHUB_REPOSITORY} (or GITHUB_REPOSITORY) to create a GitHub release.`);
143
265
  }
144
266
  async function githubFetch(options, path, init) {
145
267
  const url = `${apiBase(options.host)}/repos/${encodeRepoPath(options.repo)}${path}`;
@@ -201,6 +323,20 @@ async function createGitHubRelease(options) {
201
323
  }
202
324
  //#endregion
203
325
  //#region src/gitlab.ts
326
+ const GITLAB_TOKEN_FALLBACKS = [ENV.GITLAB_TOKEN, "GITLAB_TOKEN"];
327
+ function gitLabTokenEnvLabel(tokenEnv) {
328
+ return tokenEnv ?? `${ENV.GITLAB_TOKEN} (or GITLAB_TOKEN)`;
329
+ }
330
+ function resolveGitLabToken(tokenEnv) {
331
+ if (tokenEnv !== void 0) return readEnv(tokenEnv);
332
+ return readEnvFirst(...GITLAB_TOKEN_FALLBACKS);
333
+ }
334
+ function resolveGitLabHost(host) {
335
+ return host ?? readEnv(ENV.GITLAB_HOST) ?? readEnv("GITLAB_HOST") ?? "https://gitlab.com";
336
+ }
337
+ function resolveGitLabProject(project) {
338
+ return project ?? readEnvFirst(ENV.GITLAB_PROJECT, "GITLAB_PROJECT");
339
+ }
204
340
  function releaseNotes(changelog, tag) {
205
341
  const lines = changelog.split("\n");
206
342
  const heading = `## ${tag}`;
@@ -620,13 +756,12 @@ function isString(value) {
620
756
  }
621
757
  function gitLabContext(config) {
622
758
  if (config?.enabled !== true) throw new ReleaseError("GITLAB_RELEASE_FAILED", "Enable gitlab before creating a release.");
623
- const tokenEnv = config.tokenEnv ?? "GITLAB_TOKEN";
624
- const token = process.env[tokenEnv];
625
- const project = config.project ?? process.env.GITLAB_PROJECT;
626
- if (token === void 0 || token.length === 0) throw new ReleaseError("GITLAB_RELEASE_FAILED", `Set ${tokenEnv} to create a GitLab release.`);
627
- if (project === void 0 || project.length === 0) throw new ReleaseError("GITLAB_RELEASE_FAILED", "Set gitlab.project or GITLAB_PROJECT to create a GitLab release.");
759
+ const token = resolveGitLabToken(config.tokenEnv);
760
+ const project = resolveGitLabProject(config.project);
761
+ if (token === void 0) throw new ReleaseError("GITLAB_RELEASE_FAILED", `Set ${gitLabTokenEnvLabel(config.tokenEnv)} to create a GitLab release.`);
762
+ if (project === void 0) throw new ReleaseError("GITLAB_RELEASE_FAILED", "Set gitlab.project or GENBUMPPUSH_GITLAB_PROJECT (or GITLAB_PROJECT) to create a GitLab release.");
628
763
  const context = {
629
- host: config.host ?? process.env.GITLAB_HOST ?? "https://gitlab.com",
764
+ host: resolveGitLabHost(config.host),
630
765
  project,
631
766
  token
632
767
  };
@@ -636,7 +771,7 @@ function gitLabContext(config) {
636
771
  function resolveGitHubContext(config, cwd) {
637
772
  if (config?.enabled !== true) throw new ReleaseError("GITHUB_RELEASE_FAILED", "Enable github before creating a release.");
638
773
  const token = resolveGitHubToken(config.tokenEnv);
639
- if (token === void 0) throw new ReleaseError("GITHUB_RELEASE_FAILED", `Set ${config.tokenEnv ?? "GITHUB_TOKEN"} to create a GitHub release.`);
774
+ if (token === void 0) throw new ReleaseError("GITHUB_RELEASE_FAILED", `Set ${githubTokenEnvLabel(config.tokenEnv)} to create a GitHub release.`);
640
775
  return resolveGitHubRepo(cwd, {
641
776
  host: config.host,
642
777
  repo: config.repo
@@ -714,6 +849,82 @@ function packageVersion(cwd) {
714
849
  if (!isObject(data) || !("version" in data) || !isString(data.version)) throw new ReleaseError("INVALID_PACKAGE", "package.json must contain a version string.");
715
850
  return data.version;
716
851
  }
852
+ /**
853
+ * Run a full release (or a dry run / provider retry) for one repository.
854
+ *
855
+ * Typical flow:
856
+ * 1. Load config and `.env`
857
+ * 2. Verify the worktree is a clean Git repo on a branch
858
+ * 3. Detect (or force) a release type from Conventional Commits
859
+ * 4. Confirm, run `before` hooks, update version files and the changelog
860
+ * 5. Commit, tag, and atomically push branch + tag
861
+ * 6. Optionally create a GitHub/GitLab release, then run `after` hooks
862
+ *
863
+ * Version-file or commit failures restore files and the index. A failed tag
864
+ * or network push can leave the release commit locally so you can inspect
865
+ * and retry — see the returned {@link ReleaseResult} and any thrown
866
+ * {@link ReleaseError}.
867
+ *
868
+ * Prefer the `genbumppush` CLI for day-to-day use. Call this directly when
869
+ * embedding releases in a Node script or CI job that already builds
870
+ * {@link CliOptions}.
871
+ *
872
+ * @param options - Parsed CLI options. `cwd`, `dryRun`, `yes`, and `help` are required;
873
+ * the rest override config when set.
874
+ * @returns A summary of what happened. Never mutates when `dryRun` is `true`.
875
+ * @throws {@link ReleaseError} for expected failures (dirty worktree, existing tag,
876
+ * cancelled confirmation, Git/provider errors). Unexpected errors may also throw.
877
+ *
878
+ * @example Dry run in the current directory
879
+ * ```ts
880
+ * import { runRelease } from 'genbumppush';
881
+ *
882
+ * const result = await runRelease({
883
+ * cwd: process.cwd(),
884
+ * dryRun: true,
885
+ * yes: true,
886
+ * help: false,
887
+ * });
888
+ *
889
+ * console.log(result);
890
+ * // {
891
+ * // currentVersion: '1.2.3',
892
+ * // newVersion: '1.3.0',
893
+ * // releaseType: 'minor',
894
+ * // tag: 'v1.3.0',
895
+ * // pushed: false,
896
+ * // dryRun: true,
897
+ * // commitCount: 4
898
+ * // }
899
+ * ```
900
+ *
901
+ * @example Non-interactive patch release that stays local
902
+ * ```ts
903
+ * import { runRelease } from 'genbumppush';
904
+ *
905
+ * await runRelease({
906
+ * cwd: process.cwd(),
907
+ * dryRun: false,
908
+ * yes: true,
909
+ * help: false,
910
+ * release: 'patch',
911
+ * push: false,
912
+ * });
913
+ * ```
914
+ *
915
+ * @example Retry only the GitLab release after Git already succeeded
916
+ * ```ts
917
+ * import { runRelease } from 'genbumppush';
918
+ *
919
+ * await runRelease({
920
+ * cwd: process.cwd(),
921
+ * dryRun: false,
922
+ * yes: true,
923
+ * help: false,
924
+ * gitlabRetryTag: 'v1.3.0',
925
+ * });
926
+ * ```
927
+ */
717
928
  async function runRelease(options) {
718
929
  const overrides = {};
719
930
  if (options.release !== void 0) overrides.release = options.release;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "genbumppush",
3
3
  "description": "Generate changelog, bump version, then push",
4
- "version": "0.0.3",
4
+ "version": "0.0.4",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "license": "MIT",