From f428167c15a676752f70348ce2a8718323a4d4b8 Mon Sep 17 00:00:00 2001 From: Theo Ephraim Date: Wed, 22 Apr 2026 00:02:37 -0700 Subject: [PATCH 1/5] Add isCurrentBranch and publishTo to status --json output Enhances the JSON output of `bumpy status --json` with two new fields: - `isCurrentBranch`: indicates which bump files/releases belong to the current branch (only present when not on the base branch) - `publishTo`: array of publish targets per release ("npm", "custom", or empty) These enable workflows like preview package publishing where you need to know which npm packages are being changed in the current PR. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/bumpy/src/commands/status.ts | 64 ++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/packages/bumpy/src/commands/status.ts b/packages/bumpy/src/commands/status.ts index 3a716b7..f6c6c78 100644 --- a/packages/bumpy/src/commands/status.ts +++ b/packages/bumpy/src/commands/status.ts @@ -2,9 +2,10 @@ import { log, colorize } from '../utils/logger.ts'; import { loadConfig } from '../core/config.ts'; import { discoverPackages } from '../core/workspace.ts'; import { DependencyGraph } from '../core/dep-graph.ts'; -import { readBumpFiles } from '../core/bump-file.ts'; +import { readBumpFiles, filterBranchBumpFiles } from '../core/bump-file.ts'; import { assembleReleasePlan } from '../core/release-plan.ts'; -import type { PlannedRelease, WorkspacePackage } from '../types.ts'; +import { getCurrentBranch, getChangedFiles } from '../core/git.ts'; +import type { BumpyConfig, PackageConfig, PlannedRelease, WorkspacePackage } from '../types.ts'; interface StatusOptions { json?: boolean; @@ -35,6 +36,15 @@ export async function statusCommand(rootDir: string, opts: StatusOptions): Promi const plan = assembleReleasePlan(bumpFiles, packages, depGraph, config); + // Determine which bump files belong to the current branch (if not on base branch) + let branchBumpFileIds: Set | undefined; + const currentBranch = getCurrentBranch({ cwd: rootDir }); + if (currentBranch && currentBranch !== config.baseBranch) { + const changedFiles = getChangedFiles(rootDir, config.baseBranch); + const result = filterBranchBumpFiles(bumpFiles, changedFiles, rootDir); + branchBumpFileIds = result.branchBumpFileIds; + } + // Apply filters let releases = plan.releases; if (opts.bumpType) { @@ -53,17 +63,28 @@ export async function statusCommand(rootDir: string, opts: StatusOptions): Promi id: bf.id, summary: bf.summary, releases: bf.releases.map((r) => ({ name: r.name, type: r.type })), + ...(branchBumpFileIds ? { isCurrentBranch: branchBumpFileIds.has(bf.id) } : {}), })), - releases: releases.map((r) => ({ - name: r.name, - type: r.type, - oldVersion: r.oldVersion, - newVersion: r.newVersion, - dir: packages.get(r.name)?.relativeDir, - bumpFiles: r.bumpFiles, - isDependencyBump: r.isDependencyBump, - isCascadeBump: r.isCascadeBump, - })), + releases: releases.map((r) => { + const pkg = packages.get(r.name); + const pkgConfig = pkg?.bumpy || {}; + return { + name: r.name, + type: r.type, + oldVersion: r.oldVersion, + newVersion: r.newVersion, + dir: pkg?.relativeDir, + bumpFiles: r.bumpFiles, + isDependencyBump: r.isDependencyBump, + isCascadeBump: r.isCascadeBump, + ...(branchBumpFileIds + ? { + isCurrentBranch: r.bumpFiles.some((id) => branchBumpFileIds!.has(id)), + } + : {}), + publishTo: getPublishTargets(pkg, pkgConfig, config), + }; + }), packageNames: releases.map((r) => r.name), }; console.log(JSON.stringify(jsonOutput, null, 2)); @@ -133,3 +154,22 @@ function printRelease(r: PlannedRelease, packages: Map : ''; console.log(` ${r.name}: ${r.oldVersion} → ${colorize(r.newVersion, 'cyan')}${suffix}${dir}`); } + +/** Determine which publish targets a package will use */ +function getPublishTargets( + pkg: WorkspacePackage | undefined, + pkgConfig: Partial, + config: BumpyConfig, +): string[] { + if (!pkg) return []; + // Private packages with no custom command won't publish + if (pkg.private && !pkgConfig.publishCommand) return []; + const targets: string[] = []; + if (pkgConfig.publishCommand) { + targets.push('custom'); + } + if (!pkgConfig.publishCommand && !pkgConfig.skipNpmPublish) { + targets.push('npm'); + } + return targets; +} From b80c9a4f1d75132cdc9353b40a296dbe3ae0f17a Mon Sep 17 00:00:00 2001 From: Theo Ephraim Date: Wed, 22 Apr 2026 00:02:57 -0700 Subject: [PATCH 2/5] Fix unused config parameter lint warning Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/bumpy/src/commands/status.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/bumpy/src/commands/status.ts b/packages/bumpy/src/commands/status.ts index f6c6c78..303f7a6 100644 --- a/packages/bumpy/src/commands/status.ts +++ b/packages/bumpy/src/commands/status.ts @@ -159,7 +159,7 @@ function printRelease(r: PlannedRelease, packages: Map function getPublishTargets( pkg: WorkspacePackage | undefined, pkgConfig: Partial, - config: BumpyConfig, + _config: BumpyConfig, ): string[] { if (!pkg) return []; // Private packages with no custom command won't publish From df1853bd973c396e60d39e49f3dde0d88b5d0db7 Mon Sep 17 00:00:00 2001 From: Theo Ephraim Date: Wed, 22 Apr 2026 00:03:09 -0700 Subject: [PATCH 3/5] Add bump file for status --json enhancements Co-Authored-By: Claude Opus 4.6 (1M context) --- .bumpy/status-json-enhancements.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .bumpy/status-json-enhancements.md diff --git a/.bumpy/status-json-enhancements.md b/.bumpy/status-json-enhancements.md new file mode 100644 index 0000000..1359ca3 --- /dev/null +++ b/.bumpy/status-json-enhancements.md @@ -0,0 +1,5 @@ +--- +'@varlock/bumpy': patch +--- + +Add isCurrentBranch and publishTo fields to status --json output From 4af45a251a1bd5772b0effa3736e816c66bfad67 Mon Sep 17 00:00:00 2001 From: Theo Ephraim Date: Wed, 22 Apr 2026 00:06:42 -0700 Subject: [PATCH 4/5] Rename to inCurrentBranch and publishTargets Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/bumpy/src/commands/status.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bumpy/src/commands/status.ts b/packages/bumpy/src/commands/status.ts index 303f7a6..65b2ad7 100644 --- a/packages/bumpy/src/commands/status.ts +++ b/packages/bumpy/src/commands/status.ts @@ -63,7 +63,7 @@ export async function statusCommand(rootDir: string, opts: StatusOptions): Promi id: bf.id, summary: bf.summary, releases: bf.releases.map((r) => ({ name: r.name, type: r.type })), - ...(branchBumpFileIds ? { isCurrentBranch: branchBumpFileIds.has(bf.id) } : {}), + ...(branchBumpFileIds ? { inCurrentBranch: branchBumpFileIds.has(bf.id) } : {}), })), releases: releases.map((r) => { const pkg = packages.get(r.name); @@ -79,10 +79,10 @@ export async function statusCommand(rootDir: string, opts: StatusOptions): Promi isCascadeBump: r.isCascadeBump, ...(branchBumpFileIds ? { - isCurrentBranch: r.bumpFiles.some((id) => branchBumpFileIds!.has(id)), + inCurrentBranch: r.bumpFiles.some((id) => branchBumpFileIds!.has(id)), } : {}), - publishTo: getPublishTargets(pkg, pkgConfig, config), + publishTargets: getPublishTargets(pkg, pkgConfig, config), }; }), packageNames: releases.map((r) => r.name), From 4cec3210172e1379a96fdb5664d0db2efb710f6f Mon Sep 17 00:00:00 2001 From: Theo Ephraim Date: Wed, 22 Apr 2026 00:11:16 -0700 Subject: [PATCH 5/5] Update bump file with renamed field names Co-Authored-By: Claude Opus 4.6 (1M context) --- .bumpy/status-json-enhancements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bumpy/status-json-enhancements.md b/.bumpy/status-json-enhancements.md index 1359ca3..1529880 100644 --- a/.bumpy/status-json-enhancements.md +++ b/.bumpy/status-json-enhancements.md @@ -2,4 +2,4 @@ '@varlock/bumpy': patch --- -Add isCurrentBranch and publishTo fields to status --json output +Add `inCurrentBranch` and `publishTargets` fields to `status --json` output