@varlock/bumpy 1.8.0 → 1.9.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.
package/README.md CHANGED
@@ -50,7 +50,7 @@ Fixed locale fallback logic in utils.
50
50
 
51
51
  - **All package managers** - npm, pnpm, yarn, and bun workspaces
52
52
  - **Smart dependency propagation** - configurable rules for how version bumps cascade through your dependency graph (see [version propagation docs](https://github.com/dmno-dev/bumpy/blob/main/docs/version-propagation.md))
53
- - **Pack-then-publish** - by default, publishes to npm (resolving `workspace:` and `catalog:` protocols, with OIDC/provenance support). Per-package custom publish commands let you target anything - VSCode extensions, Docker images, JSR, private registries, etc.
53
+ - **Pack-then-publish** - by default, publishes to npm (resolving `workspace:` and `catalog:` protocols, with OIDC/provenance support). Supports [npm staged publishing](https://docs.npmjs.com/about-staged-publishes) for 2FA-gated releases. Per-package custom publish commands let you target anything - VSCode extensions, Docker images, JSR, private registries, etc.
54
54
  - **Flexible package management** - include/exclude any package individually via per-package config, glob patterns, or `privatePackages` setting
55
55
  - **Non-interactive CLI** - `bumpy add` works fully non-interactively for CI/CD and AI-assisted development
56
56
  - **Aggregated GitHub releases** - optionally create a single consolidated release instead of one per package
@@ -1,11 +1,11 @@
1
1
  import { n as log, r as require_picocolors, s as __toESM } from "./logger-BgksGFuf.mjs";
2
2
  import { n as exists, t as ensureDir } from "./fs-CBXKZhoU.mjs";
3
- import { a as loadConfig, o as loadPackageConfig, r as getBumpyDir } from "./config-gMu1z0bz.mjs";
4
- import { a as discoverPackages, i as writeBumpFile, o as discoverWorkspace, r as readBumpFiles, t as filterBranchBumpFiles } from "./bump-file-BZT3KCns.mjs";
5
- import { r as getChangedFiles } from "./git-nTR-JccX.mjs";
3
+ import { a as loadConfig, o as loadPackageConfig, r as getBumpyDir } from "./config-CDC1Y_ye.mjs";
4
+ import { a as writeBumpFile, o as discoverPackages, r as readBumpFiles, s as discoverWorkspace, t as filterBranchBumpFiles } from "./bump-file-BOqrdkYP.mjs";
5
+ import { r as getChangedFiles } from "./git-CpJqzpp-.mjs";
6
6
  import { l as pt, o as gt, r as Ot, s as mt, t as unwrap, u as wt } from "./clack-W95rXis0.mjs";
7
7
  import { n as slugify, t as randomName } from "./names-COooXAFg.mjs";
8
- import { n as findChangedPackages, r as require_picomatch } from "./check-C-l4yr0C.mjs";
8
+ import { n as findChangedPackages, r as require_picomatch } from "./check-Dc0ts_q3.mjs";
9
9
  import { relative, resolve } from "node:path";
10
10
  import * as readline from "node:readline";
11
11
  //#region src/prompts/bump-select.ts
@@ -1,6 +1,6 @@
1
1
  import { a as readJson, c as removeFile, f as writeText, i as listFiles, l as updateJsonFields, n as exists, s as readText, u as updateJsonNestedField } from "./fs-CBXKZhoU.mjs";
2
- import { r as getBumpyDir } from "./config-gMu1z0bz.mjs";
3
- import { a as prependToChangelog, i as loadFormatter, n as generateChangelogEntry } from "./changelog-CFWf9s2q.mjs";
2
+ import { r as getBumpyDir } from "./config-CDC1Y_ye.mjs";
3
+ import { a as prependToChangelog, i as loadFormatter, n as generateChangelogEntry } from "./changelog-DrAf-rL6.mjs";
4
4
  import { resolve } from "node:path";
5
5
  //#region src/core/apply-release-plan.ts
6
6
  /** Apply the release plan: bump versions, update changelogs, delete bump files */
@@ -1,5 +1,5 @@
1
1
  import { a as readJson, f as writeText, i as listFiles, n as exists, s as readText } from "./fs-CBXKZhoU.mjs";
2
- import { i as isPackageManaged, o as loadPackageConfig, r as getBumpyDir } from "./config-gMu1z0bz.mjs";
2
+ import { i as isPackageManaged, o as loadPackageConfig, r as getBumpyDir } from "./config-CDC1Y_ye.mjs";
3
3
  import { i as jsYaml, n as detectWorkspaces } from "./package-manager-BQPwXwu5.mjs";
4
4
  import { s as tryRunArgs } from "./shell-C8KgKnMQ.mjs";
5
5
  import { relative, resolve } from "node:path";
@@ -272,6 +272,37 @@ async function writeBumpFile(rootDir, filename, releases, summary) {
272
272
  }).trim()}\n---\n\n${summary}\n`);
273
273
  return filePath;
274
274
  }
275
+ /**
276
+ * Recover bump files that were deleted in the HEAD commit (version commit).
277
+ * Used during the publish-only flow (after version PR merge) to provide
278
+ * bump file context for GitHub release body generation.
279
+ */
280
+ function recoverDeletedBumpFiles(rootDir) {
281
+ const deleted = tryRunArgs([
282
+ "git",
283
+ "diff",
284
+ "--diff-filter=D",
285
+ "--name-only",
286
+ "HEAD~1",
287
+ "HEAD",
288
+ "--",
289
+ ".bumpy/*.md"
290
+ ], { cwd: rootDir });
291
+ if (!deleted) return [];
292
+ const bumpFiles = [];
293
+ for (const filePath of deleted.split("\n").filter(Boolean)) {
294
+ if (filePath.endsWith("README.md")) continue;
295
+ const content = tryRunArgs([
296
+ "git",
297
+ "show",
298
+ `HEAD~1:${filePath}`
299
+ ], { cwd: rootDir });
300
+ if (!content) continue;
301
+ const { bumpFile } = parseBumpFile(content, filePath.replace(/^\.bumpy\//, "").replace(/\.md$/, ""));
302
+ if (bumpFile) bumpFiles.push(bumpFile);
303
+ }
304
+ return bumpFiles;
305
+ }
275
306
  function fileToId(filePath) {
276
307
  return filePath.split("/").pop().replace(/\.md$/, "");
277
308
  }
@@ -309,4 +340,4 @@ function filterBranchBumpFiles(allBumpFiles, changedFiles, rootDir, parseErrors
309
340
  };
310
341
  }
311
342
  //#endregion
312
- export { discoverPackages as a, writeBumpFile as i, parseBumpFile as n, discoverWorkspace as o, readBumpFiles as r, filterBranchBumpFiles as t };
343
+ export { writeBumpFile as a, recoverDeletedBumpFiles as i, parseBumpFile as n, discoverPackages as o, readBumpFiles as r, discoverWorkspace as s, filterBranchBumpFiles as t };
@@ -1,5 +1,5 @@
1
1
  import { n as log } from "./logger-BgksGFuf.mjs";
2
- import { c as maxBump, t as BUMP_LEVELS } from "./types-CAwBhUsn.mjs";
2
+ import { c as maxBump, t as BUMP_LEVELS } from "./types-CL2pqN9N.mjs";
3
3
  import { relative, resolve } from "node:path";
4
4
  import { realpathSync } from "node:fs";
5
5
  //#region src/core/changelog.ts
@@ -45,7 +45,7 @@ const defaultFormatter = (ctx) => {
45
45
  const BUILTIN_FORMATTERS = {
46
46
  default: defaultFormatter,
47
47
  github: async () => {
48
- const { createGithubFormatter } = await import("./changelog-github-T5LqaTwV.mjs");
48
+ const { createGithubFormatter } = await import("./changelog-github-BYqd2jw1.mjs");
49
49
  return createGithubFormatter();
50
50
  }
51
51
  };
@@ -56,7 +56,7 @@ const BUILTIN_FORMATTERS = {
56
56
  async function loadFormatter(changelog, rootDir) {
57
57
  const [name, options] = Array.isArray(changelog) ? changelog : [changelog, {}];
58
58
  if (name === "github") {
59
- const { createGithubFormatter } = await import("./changelog-github-T5LqaTwV.mjs");
59
+ const { createGithubFormatter } = await import("./changelog-github-BYqd2jw1.mjs");
60
60
  return createGithubFormatter(options);
61
61
  }
62
62
  if (typeof name === "string" && BUILTIN_FORMATTERS[name]) {
@@ -1,6 +1,6 @@
1
- import { c as maxBump } from "./types-CAwBhUsn.mjs";
1
+ import { c as maxBump } from "./types-CL2pqN9N.mjs";
2
2
  import { s as tryRunArgs } from "./shell-C8KgKnMQ.mjs";
3
- import { o as sortBumpFilesByType, r as getBumpTypeForPackage } from "./changelog-CFWf9s2q.mjs";
3
+ import { o as sortBumpFilesByType, r as getBumpTypeForPackage } from "./changelog-DrAf-rL6.mjs";
4
4
  //#region src/core/changelog-github.ts
5
5
  /** Authors filtered from "Thanks" attribution by default (e.g. bots) */
6
6
  /** Authors filtered from "Thanks" attribution by default (e.g. AI/automation bots) */
@@ -1,7 +1,7 @@
1
1
  import { a as __exportAll, i as __commonJSMin, n as log, s as __toESM, t as colorize } from "./logger-BgksGFuf.mjs";
2
- import { a as loadConfig, o as loadPackageConfig, r as getBumpyDir } from "./config-gMu1z0bz.mjs";
3
- import { o as discoverWorkspace, r as readBumpFiles, t as filterBranchBumpFiles } from "./bump-file-BZT3KCns.mjs";
4
- import { a as getFileStatuses, r as getChangedFiles } from "./git-nTR-JccX.mjs";
2
+ import { a as loadConfig, o as loadPackageConfig, r as getBumpyDir } from "./config-CDC1Y_ye.mjs";
3
+ import { r as readBumpFiles, s as discoverWorkspace, t as filterBranchBumpFiles } from "./bump-file-BOqrdkYP.mjs";
4
+ import { a as getFileStatuses, r as getChangedFiles } from "./git-CpJqzpp-.mjs";
5
5
  import { relative } from "node:path";
6
6
  //#region ../../node_modules/.bun/picomatch@4.0.4/node_modules/picomatch/lib/constants.js
7
7
  var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -1,12 +1,12 @@
1
1
  import { n as log, t as colorize } from "./logger-BgksGFuf.mjs";
2
- import { a as loadConfig } from "./config-gMu1z0bz.mjs";
2
+ import { a as loadConfig } from "./config-CDC1Y_ye.mjs";
3
3
  import { t as detectPackageManager } from "./package-manager-BQPwXwu5.mjs";
4
- import { o as discoverWorkspace, r as readBumpFiles, t as filterBranchBumpFiles } from "./bump-file-BZT3KCns.mjs";
5
- import { a as DependencyGraph, t as assembleReleasePlan } from "./release-plan-7ApKPR6T.mjs";
4
+ import { i as recoverDeletedBumpFiles, r as readBumpFiles, s as discoverWorkspace, t as filterBranchBumpFiles } from "./bump-file-BOqrdkYP.mjs";
5
+ import { a as DependencyGraph, t as assembleReleasePlan } from "./release-plan-Ck_DlgcK.mjs";
6
6
  import { n as runArgs, r as runArgsAsync, s as tryRunArgs } from "./shell-C8KgKnMQ.mjs";
7
- import { r as getChangedFiles } from "./git-nTR-JccX.mjs";
7
+ import { d as withGitToken, r as getChangedFiles } from "./git-CpJqzpp-.mjs";
8
8
  import { t as randomName } from "./names-COooXAFg.mjs";
9
- import { n as findChangedPackages } from "./check-C-l4yr0C.mjs";
9
+ import { n as findChangedPackages } from "./check-Dc0ts_q3.mjs";
10
10
  import { t as resolveCommitMessage } from "./commit-message-CSWVKPJ-.mjs";
11
11
  import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
12
12
  import { createHash } from "node:crypto";
@@ -155,7 +155,7 @@ async function ciPlanCommand(rootDir) {
155
155
  packageNames: plan.releases.map((r) => r.name)
156
156
  };
157
157
  } else {
158
- const { findUnpublishedPackages } = await import("./publish-X8IGj3AF.mjs");
158
+ const { findUnpublishedPackages } = await import("./publish-BplMRp4-.mjs");
159
159
  const unpublished = await findUnpublishedPackages(packages, config);
160
160
  if (unpublished.length > 0) output = {
161
161
  mode: "publish",
@@ -225,8 +225,12 @@ async function ciReleaseCommand(rootDir, opts) {
225
225
  }
226
226
  if (bumpFiles.length === 0) {
227
227
  log.info("No pending bump files — checking for unpublished packages...");
228
- const { publishCommand } = await import("./publish-X8IGj3AF.mjs");
229
- await publishCommand(rootDir, { tag: opts.tag });
228
+ const recoveredBumpFiles = recoverDeletedBumpFiles(rootDir);
229
+ const { publishCommand } = await import("./publish-BplMRp4-.mjs");
230
+ await publishCommand(rootDir, {
231
+ tag: opts.tag,
232
+ recoveredBumpFiles
233
+ });
230
234
  return;
231
235
  }
232
236
  const plan = assembleReleasePlan(bumpFiles, packages, depGraph, config);
@@ -239,7 +243,7 @@ async function ciReleaseCommand(rootDir, opts) {
239
243
  }
240
244
  async function autoPublish(rootDir, config, plan, tag) {
241
245
  log.step("Running bumpy version...");
242
- const { versionCommand } = await import("./version-DvjKjAsp.mjs");
246
+ const { versionCommand } = await import("./version-fTSOVlym.mjs");
243
247
  await versionCommand(rootDir);
244
248
  log.step("Committing version changes...");
245
249
  runArgs([
@@ -268,7 +272,7 @@ async function autoPublish(rootDir, config, plan, tag) {
268
272
  ], { cwd: rootDir });
269
273
  }
270
274
  log.step("Running bumpy publish...");
271
- const { publishCommand } = await import("./publish-X8IGj3AF.mjs");
275
+ const { publishCommand } = await import("./publish-BplMRp4-.mjs");
272
276
  await publishCommand(rootDir, { tag });
273
277
  }
274
278
  /**
@@ -284,100 +288,7 @@ async function autoPublish(rootDir, config, plan, tag) {
284
288
  */
285
289
  function pushWithToken(rootDir, branch, config) {
286
290
  if (branch === config.baseBranch || branch === "main" || branch === "master") throw new Error(`Refusing to force-push to "${branch}" — this looks like a base branch, not a version PR branch`);
287
- const token = process.env.BUMPY_GH_TOKEN;
288
- const repo = process.env.GITHUB_REPOSITORY;
289
- const server = process.env.GITHUB_SERVER_URL || "https://github.com";
290
- if (token && repo) {
291
- const authedUrl = `${server.replace("://", `://x-access-token:${token}@`)}/${repo}.git`;
292
- const originalUrl = tryRunArgs([
293
- "git",
294
- "remote",
295
- "get-url",
296
- "origin"
297
- ], { cwd: rootDir });
298
- const extraHeaderKey = `http.${server}/.extraheader`;
299
- const savedHeader = tryRunArgs([
300
- "git",
301
- "config",
302
- "--local",
303
- extraHeaderKey
304
- ], { cwd: rootDir });
305
- const includeIfRaw = tryRunArgs([
306
- "git",
307
- "config",
308
- "--local",
309
- "--get-regexp",
310
- "^includeif\\.gitdir:"
311
- ], { cwd: rootDir });
312
- const savedIncludeIfs = [];
313
- if (includeIfRaw) for (const line of includeIfRaw.split("\n").filter(Boolean)) {
314
- const spaceIdx = line.indexOf(" ");
315
- if (spaceIdx > 0) savedIncludeIfs.push({
316
- key: line.slice(0, spaceIdx),
317
- value: line.slice(spaceIdx + 1)
318
- });
319
- }
320
- try {
321
- if (savedHeader) runArgs([
322
- "git",
323
- "config",
324
- "--local",
325
- "--unset-all",
326
- extraHeaderKey
327
- ], { cwd: rootDir });
328
- for (const entry of savedIncludeIfs) tryRunArgs([
329
- "git",
330
- "config",
331
- "--local",
332
- "--unset",
333
- entry.key
334
- ], { cwd: rootDir });
335
- runArgs([
336
- "git",
337
- "remote",
338
- "set-url",
339
- "origin",
340
- authedUrl
341
- ], { cwd: rootDir });
342
- try {
343
- runArgs([
344
- "git",
345
- "push",
346
- "-u",
347
- "origin",
348
- branch,
349
- "--force",
350
- "--no-verify"
351
- ], { cwd: rootDir });
352
- } catch (err) {
353
- const msg = err instanceof Error ? err.message : String(err);
354
- throw new Error(msg.replaceAll(token, "***"));
355
- }
356
- } finally {
357
- if (originalUrl) runArgs([
358
- "git",
359
- "remote",
360
- "set-url",
361
- "origin",
362
- originalUrl
363
- ], { cwd: rootDir });
364
- if (savedHeader) runArgs([
365
- "git",
366
- "config",
367
- "--local",
368
- extraHeaderKey,
369
- savedHeader
370
- ], { cwd: rootDir });
371
- for (const entry of savedIncludeIfs) tryRunArgs([
372
- "git",
373
- "config",
374
- "--local",
375
- entry.key,
376
- entry.value
377
- ], { cwd: rootDir });
378
- }
379
- log.dim(" Pushed with custom token — PR workflows will be triggered");
380
- } else {
291
+ withGitToken(rootDir, () => {
381
292
  runArgs([
382
293
  "git",
383
294
  "push",
@@ -387,8 +298,9 @@ function pushWithToken(rootDir, branch, config) {
387
298
  "--force",
388
299
  "--no-verify"
389
300
  ], { cwd: rootDir });
390
- if (!token && repo) log.warn("BUMPY_GH_TOKEN is not set — PR checks will not trigger automatically.\n Run `bumpy ci setup` for help.");
391
- }
301
+ });
302
+ if (process.env.BUMPY_GH_TOKEN && process.env.GITHUB_REPOSITORY) log.dim(" Pushed with custom token — PR workflows will be triggered");
303
+ else if (!process.env.BUMPY_GH_TOKEN && process.env.GITHUB_REPOSITORY) log.warn("BUMPY_GH_TOKEN is not set — PR checks will not trigger automatically.\n Run `bumpy ci setup` for help.");
392
304
  }
393
305
  async function createVersionPr(rootDir, plan, config, packageDirs, branchName) {
394
306
  const branch = validateBranchName(branchName || config.versionPr.branch);
@@ -434,7 +346,7 @@ async function createVersionPr(rootDir, plan, config, packageDirs, branchName) {
434
346
  branch
435
347
  ], { cwd: rootDir });
436
348
  log.step("Running bumpy version...");
437
- const { versionCommand } = await import("./version-DvjKjAsp.mjs");
349
+ const { versionCommand } = await import("./version-fTSOVlym.mjs");
438
350
  await versionCommand(rootDir);
439
351
  runArgs([
440
352
  "git",
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { n as log, t as colorize } from "./logger-BgksGFuf.mjs";
3
- import { n as findRoot } from "./config-gMu1z0bz.mjs";
3
+ import { n as findRoot } from "./config-CDC1Y_ye.mjs";
4
4
  //#region src/cli.ts
5
5
  const args = process.argv.slice(2);
6
6
  const command = args[0];
@@ -31,7 +31,7 @@ async function main() {
31
31
  }
32
32
  case "add": {
33
33
  const rootDir = await findRoot();
34
- const { addCommand } = await import("./add-Ci3vfJCF.mjs");
34
+ const { addCommand } = await import("./add-D3HlRjOy.mjs");
35
35
  await addCommand(rootDir, {
36
36
  packages: flags.packages,
37
37
  message: flags.message,
@@ -43,7 +43,7 @@ async function main() {
43
43
  }
44
44
  case "status": {
45
45
  const rootDir = await findRoot();
46
- const { statusCommand } = await import("./status-Cgr3Opiw.mjs");
46
+ const { statusCommand } = await import("./status-CV8wBBiI.mjs");
47
47
  await statusCommand(rootDir, {
48
48
  json: flags.json === true,
49
49
  packagesOnly: flags.packages === true,
@@ -55,13 +55,13 @@ async function main() {
55
55
  }
56
56
  case "version": {
57
57
  const rootDir = await findRoot();
58
- const { versionCommand } = await import("./version-DvjKjAsp.mjs");
58
+ const { versionCommand } = await import("./version-fTSOVlym.mjs");
59
59
  await versionCommand(rootDir, { commit: flags.commit === true });
60
60
  break;
61
61
  }
62
62
  case "generate": {
63
63
  const rootDir = await findRoot();
64
- const { generateCommand } = await import("./generate-BuH9DEZO.mjs");
64
+ const { generateCommand } = await import("./generate-BgKOXV47.mjs");
65
65
  await generateCommand(rootDir, {
66
66
  from: flags.from,
67
67
  dryRun: flags["dry-run"] === true,
@@ -71,7 +71,7 @@ async function main() {
71
71
  }
72
72
  case "check": {
73
73
  const rootDir = await findRoot();
74
- const { checkCommand } = await import("./check-C-l4yr0C.mjs").then((n) => n.t);
74
+ const { checkCommand } = await import("./check-Dc0ts_q3.mjs").then((n) => n.t);
75
75
  const hookValue = flags.hook;
76
76
  if (hookValue && hookValue !== "pre-commit" && hookValue !== "pre-push") {
77
77
  log.error(`Invalid --hook value "${hookValue}". Expected "pre-commit" or "pre-push".`);
@@ -89,17 +89,17 @@ async function main() {
89
89
  const subcommand = args[1];
90
90
  const ciFlags = parseFlags(args.slice(2));
91
91
  if (subcommand === "check") {
92
- const { ciCheckCommand } = await import("./ci-Ukh4gbGo.mjs");
92
+ const { ciCheckCommand } = await import("./ci-9tmC3oNF.mjs");
93
93
  await ciCheckCommand(rootDir, {
94
94
  comment: ciFlags.comment !== void 0 ? ciFlags.comment === true : void 0,
95
95
  strict: ciFlags.strict === true,
96
96
  noFail: ciFlags["no-fail"] === true
97
97
  });
98
98
  } else if (subcommand === "plan") {
99
- const { ciPlanCommand } = await import("./ci-Ukh4gbGo.mjs");
99
+ const { ciPlanCommand } = await import("./ci-9tmC3oNF.mjs");
100
100
  await ciPlanCommand(rootDir);
101
101
  } else if (subcommand === "release") {
102
- const { ciReleaseCommand } = await import("./ci-Ukh4gbGo.mjs");
102
+ const { ciReleaseCommand } = await import("./ci-9tmC3oNF.mjs");
103
103
  await ciReleaseCommand(rootDir, {
104
104
  mode: ciFlags["auto-publish"] === true ? "auto-publish" : "version-pr",
105
105
  tag: ciFlags.tag,
@@ -116,7 +116,7 @@ async function main() {
116
116
  }
117
117
  case "publish": {
118
118
  const rootDir = await findRoot();
119
- const { publishCommand } = await import("./publish-X8IGj3AF.mjs");
119
+ const { publishCommand } = await import("./publish-BplMRp4-.mjs");
120
120
  await publishCommand(rootDir, {
121
121
  dryRun: flags["dry-run"] === true,
122
122
  tag: flags.tag,
@@ -140,7 +140,7 @@ async function main() {
140
140
  }
141
141
  case "--version":
142
142
  case "-v":
143
- console.log(`bumpy 1.8.0`);
143
+ console.log(`bumpy 1.9.0`);
144
144
  break;
145
145
  case "help":
146
146
  case "--help":
@@ -160,7 +160,7 @@ async function main() {
160
160
  }
161
161
  function printHelp() {
162
162
  console.log(`
163
- ${colorize(`🐸 bumpy v1.8.0`, "bold")} - Modern monorepo versioning
163
+ ${colorize(`🐸 bumpy v1.9.0`, "bold")} - Modern monorepo versioning
164
164
 
165
165
  Usage: bumpy <command> [options]
166
166
 
@@ -1,6 +1,6 @@
1
1
  import { a as __exportAll } from "./logger-BgksGFuf.mjs";
2
2
  import { a as readJson, n as exists, o as readJsonc } from "./fs-CBXKZhoU.mjs";
3
- import { l as normalizeCascadeConfig, r as DEFAULT_CONFIG } from "./types-CAwBhUsn.mjs";
3
+ import { l as normalizeCascadeConfig, r as DEFAULT_CONFIG } from "./types-CL2pqN9N.mjs";
4
4
  import { resolve } from "node:path";
5
5
  //#region src/core/config.ts
6
6
  var config_exports = /* @__PURE__ */ __exportAll({
@@ -1,9 +1,9 @@
1
1
  import { n as log, t as colorize } from "./logger-BgksGFuf.mjs";
2
2
  import { t as ensureDir } from "./fs-CBXKZhoU.mjs";
3
- import { a as loadConfig, r as getBumpyDir } from "./config-gMu1z0bz.mjs";
4
- import { a as discoverPackages, i as writeBumpFile } from "./bump-file-BZT3KCns.mjs";
3
+ import { a as loadConfig, r as getBumpyDir } from "./config-CDC1Y_ye.mjs";
4
+ import { a as writeBumpFile, o as discoverPackages } from "./bump-file-BOqrdkYP.mjs";
5
5
  import { s as tryRunArgs } from "./shell-C8KgKnMQ.mjs";
6
- import { n as getBranchCommits, o as getFilesChangedInCommit } from "./git-nTR-JccX.mjs";
6
+ import { n as getBranchCommits, o as getFilesChangedInCommit } from "./git-CpJqzpp-.mjs";
7
7
  import { n as slugify, t as randomName } from "./names-COooXAFg.mjs";
8
8
  import { relative } from "node:path";
9
9
  //#region src/commands/generate.ts
@@ -8,14 +8,111 @@ function createTag(tag, opts) {
8
8
  tag
9
9
  ], opts);
10
10
  }
11
- /** Push commits and tags to remote */
11
+ /** Push tags to remote, using BUMPY_GH_TOKEN if available */
12
12
  function pushWithTags(opts) {
13
- runArgs(["git", "push"], opts);
14
- runArgs([
13
+ withGitToken(opts?.cwd, () => {
14
+ runArgs([
15
+ "git",
16
+ "push",
17
+ "--tags"
18
+ ], opts);
19
+ });
20
+ }
21
+ /**
22
+ * Temporarily configure git credentials using BUMPY_GH_TOKEN (or GH_TOKEN),
23
+ * execute a callback, then restore the original config.
24
+ *
25
+ * Embeds the token in the remote URL and clears any existing credential config
26
+ * set by actions/checkout (extraheader or includeIf entries) so our token is
27
+ * used instead of the default GITHUB_TOKEN.
28
+ */
29
+ function withGitToken(cwd, fn) {
30
+ const token = process.env.BUMPY_GH_TOKEN || process.env.GH_TOKEN;
31
+ const server = process.env.GITHUB_SERVER_URL || "https://github.com";
32
+ if (!token) {
33
+ fn();
34
+ return;
35
+ }
36
+ const extraHeaderKey = `http.${server}/.extraheader`;
37
+ const savedHeader = tryRunArgs([
15
38
  "git",
16
- "push",
17
- "--tags"
18
- ], opts);
39
+ "config",
40
+ "--local",
41
+ extraHeaderKey
42
+ ], { cwd });
43
+ const includeIfRaw = tryRunArgs([
44
+ "git",
45
+ "config",
46
+ "--local",
47
+ "--get-regexp",
48
+ "^includeif\\.gitdir:"
49
+ ], { cwd });
50
+ const savedIncludeIfs = [];
51
+ if (includeIfRaw) for (const line of includeIfRaw.split("\n").filter(Boolean)) {
52
+ const spaceIdx = line.indexOf(" ");
53
+ if (spaceIdx > 0) savedIncludeIfs.push({
54
+ key: line.slice(0, spaceIdx),
55
+ value: line.slice(spaceIdx + 1)
56
+ });
57
+ }
58
+ const originalUrl = tryRunArgs([
59
+ "git",
60
+ "remote",
61
+ "get-url",
62
+ "origin"
63
+ ], { cwd });
64
+ const authedUrl = originalUrl ? originalUrl.replace(/^https:\/\//, `https://x-access-token:${token}@`) : null;
65
+ try {
66
+ if (savedHeader) runArgs([
67
+ "git",
68
+ "config",
69
+ "--local",
70
+ "--unset-all",
71
+ extraHeaderKey
72
+ ], { cwd });
73
+ for (const entry of savedIncludeIfs) tryRunArgs([
74
+ "git",
75
+ "config",
76
+ "--local",
77
+ "--unset",
78
+ entry.key
79
+ ], { cwd });
80
+ if (authedUrl) runArgs([
81
+ "git",
82
+ "remote",
83
+ "set-url",
84
+ "origin",
85
+ authedUrl
86
+ ], { cwd });
87
+ try {
88
+ fn();
89
+ } catch (err) {
90
+ const msg = err instanceof Error ? err.message : String(err);
91
+ throw new Error(msg.replaceAll(token, "***"));
92
+ }
93
+ } finally {
94
+ if (originalUrl) runArgs([
95
+ "git",
96
+ "remote",
97
+ "set-url",
98
+ "origin",
99
+ originalUrl
100
+ ], { cwd });
101
+ if (savedHeader) runArgs([
102
+ "git",
103
+ "config",
104
+ "--local",
105
+ extraHeaderKey,
106
+ savedHeader
107
+ ], { cwd });
108
+ for (const entry of savedIncludeIfs) tryRunArgs([
109
+ "git",
110
+ "config",
111
+ "--local",
112
+ entry.key,
113
+ entry.value
114
+ ], { cwd });
115
+ }
19
116
  }
20
117
  /** Check if there are uncommitted changes */
21
118
  function hasUncommittedChanges(opts) {
@@ -156,4 +253,4 @@ function listTags(pattern, opts) {
156
253
  return result.split("\n").filter(Boolean);
157
254
  }
158
255
  //#endregion
159
- export { getFileStatuses as a, listTags as c, getCurrentBranch as i, pushWithTags as l, getBranchCommits as n, getFilesChangedInCommit as o, getChangedFiles as r, hasUncommittedChanges as s, createTag as t, tagExists as u };
256
+ export { getFileStatuses as a, listTags as c, withGitToken as d, getCurrentBranch as i, pushWithTags as l, getBranchCommits as n, getFilesChangedInCommit as o, getChangedFiles as r, hasUncommittedChanges as s, createTag as t, tagExists as u };
package/dist/index.d.mts CHANGED
@@ -38,6 +38,13 @@ interface PublishConfig {
38
38
  * Default: "pack"
39
39
  */
40
40
  protocolResolution: 'pack' | 'in-place' | 'none';
41
+ /**
42
+ * Use npm staged publishing (`npm stage publish`).
43
+ * Stages the publish on npmjs.com, requiring manual 2FA approval before going live.
44
+ * Only works with publishManager "npm" and requires npm >= 11.5.1.
45
+ * Default: false
46
+ */
47
+ npmStaged: boolean;
41
48
  }
42
49
  interface BumpyConfig {
43
50
  baseBranch: string;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { a as DEP_TYPES, c as maxBump, i as DEFAULT_PUBLISH_CONFIG, l as normalizeCascadeConfig, n as DEFAULT_BUMP_RULES, o as bumpLevel, r as DEFAULT_CONFIG, s as hasCascade, t as BUMP_LEVELS } from "./types-CAwBhUsn.mjs";
2
- import { a as loadConfig, n as findRoot, r as getBumpyDir, s as matchGlob } from "./config-gMu1z0bz.mjs";
3
- import { a as discoverPackages, i as writeBumpFile, n as parseBumpFile, r as readBumpFiles } from "./bump-file-BZT3KCns.mjs";
4
- import { a as DependencyGraph, i as stripProtocol, n as bumpVersion, r as satisfies, t as assembleReleasePlan } from "./release-plan-7ApKPR6T.mjs";
5
- import { a as prependToChangelog, i as loadFormatter, n as generateChangelogEntry, t as defaultFormatter } from "./changelog-CFWf9s2q.mjs";
6
- import { t as applyReleasePlan } from "./apply-release-plan-DncfboRW.mjs";
7
- import { t as publishPackages } from "./publish-pipeline-DHSCchtX.mjs";
1
+ import { a as DEP_TYPES, c as maxBump, i as DEFAULT_PUBLISH_CONFIG, l as normalizeCascadeConfig, n as DEFAULT_BUMP_RULES, o as bumpLevel, r as DEFAULT_CONFIG, s as hasCascade, t as BUMP_LEVELS } from "./types-CL2pqN9N.mjs";
2
+ import { a as loadConfig, n as findRoot, r as getBumpyDir, s as matchGlob } from "./config-CDC1Y_ye.mjs";
3
+ import { a as writeBumpFile, n as parseBumpFile, o as discoverPackages, r as readBumpFiles } from "./bump-file-BOqrdkYP.mjs";
4
+ import { a as DependencyGraph, i as stripProtocol, n as bumpVersion, r as satisfies, t as assembleReleasePlan } from "./release-plan-Ck_DlgcK.mjs";
5
+ import { a as prependToChangelog, i as loadFormatter, n as generateChangelogEntry, t as defaultFormatter } from "./changelog-DrAf-rL6.mjs";
6
+ import { t as applyReleasePlan } from "./apply-release-plan-CCoCcpdv.mjs";
7
+ import { t as publishPackages } from "./publish-pipeline-BGyQsVyw.mjs";
8
8
  export { BUMP_LEVELS, DEFAULT_BUMP_RULES, DEFAULT_CONFIG, DEFAULT_PUBLISH_CONFIG, DEP_TYPES, DependencyGraph, applyReleasePlan, assembleReleasePlan, bumpLevel, bumpVersion, defaultFormatter, discoverPackages, findRoot, generateChangelogEntry, getBumpyDir, hasCascade, loadConfig, loadFormatter, matchGlob, maxBump, normalizeCascadeConfig, parseBumpFile, prependToChangelog, publishPackages, readBumpFiles, satisfies, stripProtocol, writeBumpFile };
@@ -1,13 +1,13 @@
1
1
  import { n as log, o as __require, t as colorize } from "./logger-BgksGFuf.mjs";
2
- import { a as loadConfig } from "./config-gMu1z0bz.mjs";
2
+ import { a as loadConfig } from "./config-CDC1Y_ye.mjs";
3
3
  import { n as detectWorkspaces } from "./package-manager-BQPwXwu5.mjs";
4
- import { o as discoverWorkspace } from "./bump-file-BZT3KCns.mjs";
5
- import { a as DependencyGraph } from "./release-plan-7ApKPR6T.mjs";
4
+ import { s as discoverWorkspace } from "./bump-file-BOqrdkYP.mjs";
5
+ import { a as DependencyGraph } from "./release-plan-Ck_DlgcK.mjs";
6
6
  import { r as runArgsAsync, s as tryRunArgs } from "./shell-C8KgKnMQ.mjs";
7
- import { i as loadFormatter, n as generateChangelogEntry } from "./changelog-CFWf9s2q.mjs";
8
- import { c as listTags, l as pushWithTags, s as hasUncommittedChanges } from "./git-nTR-JccX.mjs";
9
- import { t as publishPackages } from "./publish-pipeline-DHSCchtX.mjs";
10
- import { CI_PLAN_CACHE_PATH } from "./ci-Ukh4gbGo.mjs";
7
+ import { i as loadFormatter, n as generateChangelogEntry } from "./changelog-DrAf-rL6.mjs";
8
+ import { c as listTags, l as pushWithTags, s as hasUncommittedChanges } from "./git-CpJqzpp-.mjs";
9
+ import { t as publishPackages } from "./publish-pipeline-BGyQsVyw.mjs";
10
+ import { CI_PLAN_CACHE_PATH } from "./ci-9tmC3oNF.mjs";
11
11
  //#region src/core/github-release.ts
12
12
  /** Get the current HEAD commit SHA */
13
13
  function getHeadSha(rootDir) {
@@ -197,7 +197,7 @@ async function publishCommand(rootDir, opts) {
197
197
  }
198
198
  let toPublish = await findUnpublishedWithCache(rootDir, packages, config);
199
199
  if (opts.filter) {
200
- const { matchGlob } = await import("./config-gMu1z0bz.mjs").then((n) => n.t);
200
+ const { matchGlob } = await import("./config-CDC1Y_ye.mjs").then((n) => n.t);
201
201
  const patterns = opts.filter.split(",").map((p) => p.trim());
202
202
  toPublish = toPublish.filter((r) => patterns.some((p) => matchGlob(r.name, p)));
203
203
  }
@@ -205,8 +205,10 @@ async function publishCommand(rootDir, opts) {
205
205
  log.info("No unpublished packages found.");
206
206
  return;
207
207
  }
208
+ const recoveredBumpFiles = opts.recoveredBumpFiles || [];
209
+ if (recoveredBumpFiles.length > 0) for (const release of toPublish) release.bumpFiles = recoveredBumpFiles.filter((bf) => bf.releases.some((r) => r.name === release.name)).map((bf) => bf.id);
208
210
  const releasePlan = {
209
- bumpFiles: [],
211
+ bumpFiles: recoveredBumpFiles,
210
212
  releases: toPublish,
211
213
  warnings: []
212
214
  };
@@ -1,9 +1,9 @@
1
1
  import { n as log, t as colorize } from "./logger-BgksGFuf.mjs";
2
2
  import { a as readJson, u as updateJsonNestedField } from "./fs-CBXKZhoU.mjs";
3
3
  import { r as resolveCatalogDep } from "./package-manager-BQPwXwu5.mjs";
4
- import { i as stripProtocol } from "./release-plan-7ApKPR6T.mjs";
4
+ import { i as stripProtocol } from "./release-plan-Ck_DlgcK.mjs";
5
5
  import { i as runAsync, o as sq, r as runArgsAsync, s as tryRunArgs } from "./shell-C8KgKnMQ.mjs";
6
- import { t as createTag, u as tagExists } from "./git-nTR-JccX.mjs";
6
+ import { t as createTag, u as tagExists } from "./git-CpJqzpp-.mjs";
7
7
  import { resolve } from "node:path";
8
8
  import { unlink } from "node:fs/promises";
9
9
  import { appendFileSync, existsSync, readFileSync, writeFileSync } from "node:fs";
@@ -88,6 +88,15 @@ async function publishPackages(releasePlan, packages, depGraph, config, rootDir,
88
88
  };
89
89
  const publishConfig = config.publish;
90
90
  setupNpmAuth(rootDir, publishConfig.publishManager);
91
+ if (publishConfig.npmStaged) if (publishConfig.publishManager !== "npm") log.warn("Staged publishing is only supported with publishManager \"npm\" — ignoring staged option");
92
+ else {
93
+ const npmVersion = tryRunArgs(["npm", "--version"]);
94
+ if (npmVersion) {
95
+ const [major, minor, patch] = npmVersion.split(".").map(Number);
96
+ if (!(major > 11 || major === 11 && (minor > 5 || minor === 5 && patch >= 1))) log.warn(`Staged publishing requires npm >= 11.5.1 (found ${npmVersion})`);
97
+ else log.dim(`Staged publishing enabled — packages will require 2FA approval on npmjs.com`);
98
+ }
99
+ }
91
100
  const packManager = publishConfig.packManager === "auto" ? detectedPm : publishConfig.packManager;
92
101
  const topoOrder = depGraph.topologicalSort(packages);
93
102
  const releaseMap = new Map(releasePlan.releases.map((r) => [r.name, r]));
@@ -200,7 +209,8 @@ function getPackArgs(pm) {
200
209
  function buildPublishArgs(pkg, pkgConfig, config, opts, tarball) {
201
210
  const publishManager = config.publish.publishManager;
202
211
  const args = [];
203
- if (publishManager === "yarn") args.push("yarn", "npm", "publish");
212
+ if (config.publish.npmStaged && publishManager === "npm") args.push("npm", "stage", "publish");
213
+ else if (publishManager === "yarn") args.push("yarn", "npm", "publish");
204
214
  else args.push(publishManager, "publish");
205
215
  if (tarball) args.push(tarball);
206
216
  const access = pkgConfig?.access || config.access;
@@ -1,6 +1,6 @@
1
1
  import { i as __commonJSMin, s as __toESM } from "./logger-BgksGFuf.mjs";
2
- import { c as maxBump, l as normalizeCascadeConfig, n as DEFAULT_BUMP_RULES, o as bumpLevel, s as hasCascade } from "./types-CAwBhUsn.mjs";
3
- import { s as matchGlob } from "./config-gMu1z0bz.mjs";
2
+ import { c as maxBump, l as normalizeCascadeConfig, n as DEFAULT_BUMP_RULES, o as bumpLevel, s as hasCascade } from "./types-CL2pqN9N.mjs";
3
+ import { s as matchGlob } from "./config-CDC1Y_ye.mjs";
4
4
  //#region src/core/dep-graph.ts
5
5
  var DependencyGraph = class {
6
6
  /** Map from package name → packages that depend on it */
@@ -1,8 +1,8 @@
1
1
  import { n as log, t as colorize } from "./logger-BgksGFuf.mjs";
2
- import { a as loadConfig } from "./config-gMu1z0bz.mjs";
3
- import { a as discoverPackages, r as readBumpFiles, t as filterBranchBumpFiles } from "./bump-file-BZT3KCns.mjs";
4
- import { a as DependencyGraph, t as assembleReleasePlan } from "./release-plan-7ApKPR6T.mjs";
5
- import { i as getCurrentBranch, r as getChangedFiles } from "./git-nTR-JccX.mjs";
2
+ import { a as loadConfig } from "./config-CDC1Y_ye.mjs";
3
+ import { o as discoverPackages, r as readBumpFiles, t as filterBranchBumpFiles } from "./bump-file-BOqrdkYP.mjs";
4
+ import { a as DependencyGraph, t as assembleReleasePlan } from "./release-plan-Ck_DlgcK.mjs";
5
+ import { i as getCurrentBranch, r as getChangedFiles } from "./git-CpJqzpp-.mjs";
6
6
  //#region src/commands/status.ts
7
7
  async function statusCommand(rootDir, opts) {
8
8
  const config = await loadConfig(rootDir);
@@ -29,7 +29,7 @@ async function statusCommand(rootDir, opts) {
29
29
  releases = releases.filter((r) => types.includes(r.type));
30
30
  }
31
31
  if (opts.filter) {
32
- const { matchGlob } = await import("./config-gMu1z0bz.mjs").then((n) => n.t);
32
+ const { matchGlob } = await import("./config-CDC1Y_ye.mjs").then((n) => n.t);
33
33
  const patterns = opts.filter.split(",").map((p) => p.trim());
34
34
  releases = releases.filter((r) => patterns.some((p) => matchGlob(r.name, p)));
35
35
  }
@@ -49,6 +49,7 @@ const DEFAULT_PUBLISH_CONFIG = {
49
49
  packManager: "auto",
50
50
  publishManager: "npm",
51
51
  publishArgs: [],
52
+ npmStaged: false,
52
53
  protocolResolution: "pack"
53
54
  };
54
55
  const DEFAULT_CONFIG = {
@@ -1,10 +1,10 @@
1
1
  import { n as log, t as colorize } from "./logger-BgksGFuf.mjs";
2
- import { a as loadConfig } from "./config-gMu1z0bz.mjs";
2
+ import { a as loadConfig } from "./config-CDC1Y_ye.mjs";
3
3
  import { n as detectWorkspaces } from "./package-manager-BQPwXwu5.mjs";
4
- import { a as discoverPackages, r as readBumpFiles } from "./bump-file-BZT3KCns.mjs";
5
- import { a as DependencyGraph, t as assembleReleasePlan } from "./release-plan-7ApKPR6T.mjs";
4
+ import { o as discoverPackages, r as readBumpFiles } from "./bump-file-BOqrdkYP.mjs";
5
+ import { a as DependencyGraph, t as assembleReleasePlan } from "./release-plan-Ck_DlgcK.mjs";
6
6
  import { n as runArgs, s as tryRunArgs } from "./shell-C8KgKnMQ.mjs";
7
- import { t as applyReleasePlan } from "./apply-release-plan-DncfboRW.mjs";
7
+ import { t as applyReleasePlan } from "./apply-release-plan-CCoCcpdv.mjs";
8
8
  import { t as resolveCommitMessage } from "./commit-message-CSWVKPJ-.mjs";
9
9
  //#region src/commands/version.ts
10
10
  async function versionCommand(rootDir, opts = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlock/bumpy",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Modern monorepo versioning and changelog tool",
5
5
  "keywords": [
6
6
  "bump",