MCPcopy Create free account
hub / github.com/dmno-dev/bumpy / channelStatus

Function channelStatus

packages/bumpy/src/commands/status.ts:171–276  ·  view source on GitHub ↗

* Status on a prerelease channel: shows the cycle (shipped + pending bump files) * and the derived prerelease versions. Counters come from the registry — when it's * unreachable, targets render with a ".?" counter placeholder.

(
  rootDir: string,
  config: BumpyConfig,
  channel: ResolvedChannel,
  packages: Map<string, WorkspacePackage>,
  depGraph: DependencyGraph,
  opts: StatusOptions,
)

Source from the content-addressed store, hash-verified

169 * unreachable, targets render with a ".?" counter placeholder.
170 */
171async function channelStatus(
172 rootDir: string,
173 config: BumpyConfig,
174 channel: ResolvedChannel,
175 packages: Map<string, WorkspacePackage>,
176 depGraph: DependencyGraph,
177 opts: StatusOptions,
178): Promise<void> {
179 const { bumpFiles, errors: parseErrors } = await readBumpFiles(rootDir, { channels: channelNames(config) });
180 for (const err of parseErrors) log.error(err);
181
182 const shipped = bumpFiles.filter((bf) => bf.channel === channel.name);
183 const pending = bumpFiles.filter((bf) => bf.channel !== channel.name);
184
185 if (bumpFiles.length === 0) {
186 if (opts.json) {
187 console.log(JSON.stringify({ channel: channel.name, bumpFiles: [], releases: [], packageNames: [] }, null, 2));
188 } else if (!opts.packagesOnly) {
189 log.info(`No bump files in the "${channel.name}" cycle.`);
190 }
191 process.exit(1); // exit 1 = no releases pending (useful for CI)
192 }
193
194 const stablePlan = assembleReleasePlan(bumpFiles, packages, depGraph, config, {
195 prereleasePreid: channel.preid,
196 });
197 let releases = stablePlan.releases;
198 let countersExact = false;
199 try {
200 const built = await buildChannelReleasePlan(stablePlan, channel, packages, rootDir, { forDisplay: true });
201 if (built.plan.releases.length > 0) {
202 releases = built.plan.releases;
203 countersExact = true;
204 }
205 } catch {
206 // registry unreachable — fall through to ".?" display
207 }
208 if (!countersExact) {
209 releases = releases.map((r) => ({ ...r, newVersion: `${r.newVersion}-${channel.preid}.?` }));
210 }
211
212 if (opts.bumpType) {
213 const types = opts.bumpType.split(',').map((t) => t.trim());
214 releases = releases.filter((r) => types.includes(r.type));
215 }
216 if (opts.filter) {
217 const { matchGlob } = await import('../core/config.ts');
218 const patterns = opts.filter.split(',').map((p) => p.trim());
219 releases = releases.filter((r) => patterns.some((p) => matchGlob(r.name, p)));
220 }
221
222 if (opts.json) {
223 console.log(
224 JSON.stringify(
225 {
226 channel: channel.name,
227 preid: channel.preid,
228 tag: channel.tag,

Callers 1

statusCommandFunction · 0.85

Calls 9

readBumpFilesFunction · 0.90
channelNamesFunction · 0.90
assembleReleasePlanFunction · 0.90
buildChannelReleasePlanFunction · 0.90
colorizeFunction · 0.90
matchGlobFunction · 0.85
printBumpFileGroupFunction · 0.85
printReleaseFunction · 0.85
getPublishTargetsFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…