MCPcopy Index your code
hub / github.com/dmno-dev/bumpy / statusCommand

Function statusCommand

packages/bumpy/src/commands/status.ts:27–164  ·  view source on GitHub ↗
(rootDir: string, opts: StatusOptions)

Source from the content-addressed store, hash-verified

25}
26
27export async function statusCommand(rootDir: string, opts: StatusOptions): Promise<void> {
28 const config = await loadConfig(rootDir);
29 const packages = await discoverPackages(rootDir, config);
30 const depGraph = new DependencyGraph(packages);
31
32 const channel = resolveActiveChannel(rootDir, config, opts.channel);
33 if (channel) {
34 await channelStatus(rootDir, config, channel, packages, depGraph, opts);
35 return;
36 }
37
38 // Channel-dir bump files count as pending on the base branch (promotion)
39 const { bumpFiles, errors: parseErrors } = await readBumpFiles(rootDir, { channels: channelNames(config) });
40
41 if (parseErrors.length > 0) {
42 for (const err of parseErrors) {
43 log.error(err);
44 }
45 }
46
47 if (bumpFiles.length === 0) {
48 if (opts.json) {
49 console.log(JSON.stringify({ bumpFiles: [], releases: [], packageNames: [] }, null, 2));
50 } else if (!opts.packagesOnly) {
51 log.info('No pending bump files.');
52 }
53 process.exit(1); // exit 1 = no releases pending (useful for CI)
54 }
55
56 const plan = assembleReleasePlan(bumpFiles, packages, depGraph, config);
57
58 // Determine which bump files belong to the current branch (if not on base branch)
59 let branchBumpFileIds: Set<string> | undefined;
60 const currentBranch = getCurrentBranch({ cwd: rootDir });
61 if (currentBranch && currentBranch !== config.baseBranch) {
62 const changedFiles = getChangedFiles(rootDir, config.baseBranch);
63 const result = filterBranchBumpFiles(bumpFiles, changedFiles, rootDir);
64 branchBumpFileIds = result.branchBumpFileIds;
65 }
66
67 // Apply filters
68 let releases = plan.releases;
69 if (opts.bumpType) {
70 const types = opts.bumpType.split(',').map((t) => t.trim());
71 releases = releases.filter((r) => types.includes(r.type));
72 }
73 if (opts.filter) {
74 const { matchGlob } = await import('../core/config.ts');
75 const patterns = opts.filter.split(',').map((p) => p.trim());
76 releases = releases.filter((r) => patterns.some((p) => matchGlob(r.name, p)));
77 }
78
79 if (opts.json) {
80 const jsonOutput = {
81 bumpFiles: plan.bumpFiles.map((bf) => ({
82 id: bf.id,
83 summary: bf.summary,
84 releases: bf.releases.map((r) => ({ name: r.name, type: r.type })),

Callers 1

mainFunction · 0.85

Calls 14

loadConfigFunction · 0.90
discoverPackagesFunction · 0.90
resolveActiveChannelFunction · 0.90
readBumpFilesFunction · 0.90
channelNamesFunction · 0.90
assembleReleasePlanFunction · 0.90
getCurrentBranchFunction · 0.90
getChangedFilesFunction · 0.90
filterBranchBumpFilesFunction · 0.90
colorizeFunction · 0.90
channelStatusFunction · 0.85
matchGlobFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…