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

Function main

packages/bumpy/src/cli.ts:26–247  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24}
25
26async function main() {
27 try {
28 // Strip and apply a global `--cwd <dir>` before anything else. Done here, inside
29 // the already-running process, so bunx/npx has already resolved & fetched bumpy
30 // from the original (trusted) directory — config files in the target tree
31 // (bunfig.toml, .npmrc) can't redirect where bumpy itself came from. See
32 // ./utils/cwd.ts and docs/github-actions.md for the security rationale.
33 const { cwd: cwdOverride, rest: args } = extractCwdFlag(process.argv.slice(2));
34 if (cwdOverride !== undefined) {
35 try {
36 process.chdir(resolve(cwdOverride));
37 } catch {
38 throw new Error(`--cwd: cannot change to directory "${cwdOverride}"`);
39 }
40 }
41
42 const command = args[0];
43 const flags = parseFlags(args.slice(1));
44
45 switch (command) {
46 case 'init': {
47 const rootDir = await findRoot();
48 const { initCommand } = await import('./commands/init.ts');
49 await initCommand(rootDir, {
50 force: flags.force === true,
51 });
52 break;
53 }
54
55 case 'add': {
56 const rootDir = await findRoot();
57 const { addCommand } = await import('./commands/add.ts');
58 await addCommand(rootDir, {
59 packages: flags.packages as string | undefined,
60 message: flags.message as string | undefined,
61 name: flags.name as string | undefined,
62 empty: flags.empty === true,
63 none: flags.none === true,
64 });
65 break;
66 }
67
68 case 'status': {
69 const rootDir = await findRoot();
70 const { statusCommand } = await import('./commands/status.ts');
71 await statusCommand(rootDir, {
72 json: flags.json === true,
73 packagesOnly: flags.packages === true,
74 bumpType: flags.bump as string | undefined,
75 filter: flags.filter as string | undefined,
76 verbose: flags.verbose === true,
77 channel: flags.channel as string | undefined,
78 });
79 break;
80 }
81
82 case 'version': {
83 const rootDir = await findRoot();

Callers 1

cli.tsFile · 0.85

Calls 15

extractCwdFlagFunction · 0.90
findRootFunction · 0.90
parseFlagsFunction · 0.85
initCommandFunction · 0.85
addCommandFunction · 0.85
statusCommandFunction · 0.85
versionCommandFunction · 0.85
generateCommandFunction · 0.85
checkCommandFunction · 0.85
ciCommentCommandFunction · 0.85
ciCheckCommandFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…