alex-c-line 1.17.1 → 1.17.3

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/dist/index.cjs CHANGED
@@ -39,8 +39,6 @@ let dotenv = require("dotenv");
39
39
  dotenv = __toESM(dotenv);
40
40
  let dotenv_stringify = require("dotenv-stringify");
41
41
  dotenv_stringify = __toESM(dotenv_stringify);
42
- let libsodium_wrappers = require("libsodium-wrappers");
43
- libsodium_wrappers = __toESM(libsodium_wrappers);
44
42
  let node_os = require("node:os");
45
43
  node_os = __toESM(node_os);
46
44
  let zod = require("zod");
@@ -55,8 +53,8 @@ function findFileDependencies(dependencies$1) {
55
53
  for (const dependency in dependencies$1) if (dependencies$1[dependency].includes("file:")) fileDependencies[dependency] = dependencies$1[dependency];
56
54
  return fileDependencies;
57
55
  }
58
- function checkForFileDependencies(program$1) {
59
- program$1.command("check-for-file-dependencies").description("Check for existence of file dependencies in package.json and give exit code 1 if such dependencies are found").action(async () => {
56
+ function checkForFileDependencies(program) {
57
+ program.command("check-for-file-dependencies").description("Check for existence of file dependencies in package.json and give exit code 1 if such dependencies are found").action(async () => {
60
58
  console.info("Checking for file dependencies...");
61
59
  const { dependencies: dependencies$1, devDependencies: devDependencies$1, peerDependencies } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.resolve(process.cwd(), "package.json"), "utf-8"));
62
60
  const allFileDependencies = {
@@ -67,7 +65,7 @@ function checkForFileDependencies(program$1) {
67
65
  if (Object.keys(allFileDependencies.dependencies ?? {}).length === 0) delete allFileDependencies.dependencies;
68
66
  if (Object.keys(allFileDependencies.devDependencies ?? {}).length === 0) delete allFileDependencies.devDependencies;
69
67
  if (Object.keys(allFileDependencies.peerDependencies ?? {}).length === 0) delete allFileDependencies.peerDependencies;
70
- if (Object.keys(allFileDependencies).length !== 0) program$1.error(`ERROR: File dependencies found:\n\n${JSON.stringify(allFileDependencies, void 0, 2)}
68
+ if (Object.keys(allFileDependencies).length !== 0) program.error(`ERROR: File dependencies found:\n\n${JSON.stringify(allFileDependencies, void 0, 2)}
71
69
  `, {
72
70
  exitCode: 1,
73
71
  code: "FILE_DEPENDENCIES_FOUND"
@@ -79,8 +77,8 @@ var check_for_file_dependencies_default = checkForFileDependencies;
79
77
 
80
78
  //#endregion
81
79
  //#region src/commands/check-lockfile-version-discrepancy.ts
82
- function checkLockfileVersionDiscrepancy(program$1) {
83
- program$1.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(() => {
80
+ function checkLockfileVersionDiscrepancy(program) {
81
+ program.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(() => {
84
82
  console.info("Checking for package.json and package-lock.json discrepancies...");
85
83
  const { version: packageVersion } = JSON.parse((0, node_fs.readFileSync)(node_path.default.resolve(process.cwd(), "package.json"), "utf-8"));
86
84
  const { version: packageLockVersion } = JSON.parse((0, node_fs.readFileSync)(node_path.default.resolve(process.cwd(), "package-lock.json"), "utf-8"));
@@ -115,8 +113,8 @@ async function execaNoFail(command, args, options) {
115
113
 
116
114
  //#endregion
117
115
  //#region src/commands/check-version-number-change.ts
118
- function checkVersionNumberChange(program$1) {
119
- program$1.command("check-version-number-change").description("Check that version number on branch has changed if source code differs between main and current branch").action(async () => {
116
+ function checkVersionNumberChange(program) {
117
+ program.command("check-version-number-change").description("Check that version number on branch has changed if source code differs between main and current branch").action(async () => {
120
118
  console.info("Checking for version change...");
121
119
  const { exitCode } = await execaNoFail("git", [
122
120
  "diff",
@@ -135,7 +133,7 @@ function checkVersionNumberChange(program$1) {
135
133
  const newMajorVersion = `${parseInt(currentBranchMajor) + 1}.0.0`;
136
134
  const newMinorVersion = `${currentBranchMajor}.${parseInt(currentBranchMinor) + 1}.0`;
137
135
  const newPatchVersion = `${currentBranchMajor}.${currentBranchMinor}.${parseInt(currentBranchPatch) + 1}`;
138
- if (mainPackageVersion === currentBranchPackageVersion) program$1.error(_alextheman_utility.normaliseIndents`
136
+ if (mainPackageVersion === currentBranchPackageVersion) program.error(_alextheman_utility.normaliseIndents`
139
137
  ❌ Version needs updating. Please run one of the following:
140
138
  - npm version major -m "Change version number to v%s" (v${mainPackageVersion} -> v${newMajorVersion})
141
139
  - npm version minor -m "Change version number to v%s" (v${mainPackageVersion} -> v${newMinorVersion})
@@ -219,8 +217,8 @@ var getPullRequestTemplates_default = getPullRequestTemplates;
219
217
 
220
218
  //#endregion
221
219
  //#region src/commands/create-pull-request-templates.ts
222
- function createPullRequestTemplates(program$1) {
223
- program$1.command("create-pull-request-templates").description("Create the standard pull request templates as found in my repositories").action(async () => {
220
+ function createPullRequestTemplates(program) {
221
+ program.command("create-pull-request-templates").description("Create the standard pull request templates as found in my repositories").action(async () => {
224
222
  const { name: name$1 } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
225
223
  const gitHubPath = node_path.default.join(process.cwd(), ".github");
226
224
  const pullRequestTemplatePath = node_path.default.join(gitHubPath, "PULL_REQUEST_TEMPLATE");
@@ -314,10 +312,10 @@ var getReleaseNoteTemplate_default = getReleaseNoteTemplate;
314
312
 
315
313
  //#endregion
316
314
  //#region src/commands/create-release-note.ts
317
- function createReleaseNote(program$1) {
318
- program$1.command("create-release-note").argument("[versionType]", "The version type to increment by (`major|minor|patch`). Note that this performs the version calculation without changing package.json. If left blank it will use the version in package.json").description("Create release notes based on the current version in package.json.").action(async (versionType) => {
315
+ function createReleaseNote(program) {
316
+ program.command("create-release-note").argument("[versionType]", "The version type to increment by (`major|minor|patch`). Note that this performs the version calculation without changing package.json. If left blank it will use the version in package.json", _alextheman_utility.parseVersionType).description("Create release notes based on the current version in package.json.").action(async (versionType) => {
319
317
  const { name: name$1, version: version$1 } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
320
- const versionNumber = versionType ? new _alextheman_utility.VersionNumber(version$1).increment((0, _alextheman_utility.parseVersionType)(versionType)) : new _alextheman_utility.VersionNumber(version$1);
318
+ const versionNumber = versionType ? new _alextheman_utility.VersionNumber(version$1).increment(versionType) : new _alextheman_utility.VersionNumber(version$1);
321
319
  const releaseNotePath = `${`docs/releases/${versionNumber.type}`}/${versionNumber}.md`;
322
320
  const fullReleaseNotePath = node_path.default.join(process.cwd(), releaseNotePath);
323
321
  const releaseNoteTemplate = getReleaseNoteTemplate_default(name$1, versionNumber, "In progress");
@@ -325,7 +323,7 @@ function createReleaseNote(program$1) {
325
323
  await (0, node_fs_promises.mkdir)(node_path.default.dirname(fullReleaseNotePath), { recursive: true });
326
324
  await (0, node_fs_promises.writeFile)(fullReleaseNotePath, releaseNoteTemplate, { flag: "wx" });
327
325
  } catch (error) {
328
- if (error instanceof Error && "code" in error && error.code === "EEXIST") program$1.error("❌ ERROR: Release notes already exist.", {
326
+ if (error instanceof Error && "code" in error && error.code === "EEXIST") program.error("❌ ERROR: Release notes already exist.", {
329
327
  exitCode: 1,
330
328
  code: "RELEASE_NOTE_EXISTS"
331
329
  });
@@ -338,8 +336,8 @@ var create_release_note_default = createReleaseNote;
338
336
 
339
337
  //#endregion
340
338
  //#region src/commands/edit-env.ts
341
- function editEnv(program$1) {
342
- program$1.command("edit-env <key> [value]").description("Edit property in .env file (leave value blank to delete property)").option("--file <file>", "The file to edit", ".env").action(async (key, value, { file }) => {
339
+ function editEnv(program) {
340
+ program.command("edit-env <key> [value]").description("Edit property in .env file (leave value blank to delete property)").option("--file <file>", "The file to edit", ".env").action(async (key, value, { file }) => {
343
341
  let newValue = value;
344
342
  if (typeof newValue === "string" && newValue.startsWith("--")) newValue = void 0;
345
343
  let currentEnvFileContents;
@@ -358,16 +356,12 @@ var edit_env_default = editEnv;
358
356
 
359
357
  //#endregion
360
358
  //#region src/commands/encrypt-with-key.ts
361
- function encryptWithKey(program$1) {
362
- program$1.command("encrypt-with-key").alias("encrypt").description("Encrypt a secret given the public base64 key and the thing you want to encrypt.").argument("<key>", "The public base64 key to encrypt with").argument("<value>", "The value to encrypt in plaintext").action(async (key, value) => {
359
+ function encryptWithKey(program) {
360
+ program.command("encrypt-with-key").alias("encrypt").description("Encrypt a secret given the public base64 key and the thing you want to encrypt.").argument("<publicKey>", "The public base64 key to encrypt with").argument("<plaintextValue>", "The value to encrypt in plaintext").action(async (publicKey, plaintextValue) => {
363
361
  try {
364
- await libsodium_wrappers.default.ready;
365
- const base64Key = libsodium_wrappers.default.from_base64(key, libsodium_wrappers.default.base64_variants.ORIGINAL);
366
- const encryptedValue = libsodium_wrappers.default.crypto_box_seal(value, base64Key);
367
- const encryptedBase64Value = libsodium_wrappers.default.to_base64(encryptedValue, libsodium_wrappers.default.base64_variants.ORIGINAL);
368
- console.info(encryptedBase64Value);
362
+ console.info(await (0, _alextheman_utility.encryptWithKey)(publicKey, plaintextValue));
369
363
  } catch {
370
- program$1.error("Encryption failed. Please double-check that the given key is a valid base 64 string.", {
364
+ program.error("Encryption failed. Please double-check that the given key is a valid base 64 string.", {
371
365
  exitCode: 1,
372
366
  code: "ENCRYPTION_FAILED"
373
367
  });
@@ -378,17 +372,19 @@ var encrypt_with_key_default = encryptWithKey;
378
372
 
379
373
  //#endregion
380
374
  //#region src/commands/get-version-type.ts
381
- function getVersionType(program$1) {
382
- program$1.command("get-version-type").description("Gets the version type of the given version number.").argument("<version>", "The version to get the version type from").action((version$1) => {
383
- console.info(new _alextheman_utility.VersionNumber(version$1).type);
375
+ function getVersionType(program) {
376
+ program.command("get-version-type").description("Gets the version type of the given version number.").argument("<version>", "The version to get the version type from", (rawVersion) => {
377
+ return new _alextheman_utility.VersionNumber(rawVersion);
378
+ }).action((version$1) => {
379
+ console.info(version$1.type);
384
380
  });
385
381
  }
386
382
  var get_version_type_default = getVersionType;
387
383
 
388
384
  //#endregion
389
385
  //#region src/commands/git-post-merge-cleanup.ts
390
- function gitPostMergeCleanup(program$1) {
391
- program$1.command("git-post-merge-cleanup").alias("git-cleanup").description("Run after merging into a given branch to quickly clean up").argument("[branch]", "The branch you want to merge into", "main").option("--rebase", "Enable if your repository mainly rebases into main").action(async (branch, { rebase: rebaseOption }) => {
386
+ function gitPostMergeCleanup(program) {
387
+ program.command("git-post-merge-cleanup").alias("git-cleanup").description("Run after merging into a given branch to quickly clean up").argument("[branch]", "The branch you want to merge into", "main").option("--rebase", "Enable if your repository mainly rebases into main").action(async (branch, { rebase: rebaseOption }) => {
392
388
  let alexCLineConfigJSON;
393
389
  try {
394
390
  alexCLineConfigJSON = await (0, node_fs_promises.readFile)(node_path.default.join(process.env.HOME ?? node_os.default.homedir(), "alex-c-line-config.json"), "utf-8");
@@ -397,7 +393,7 @@ function gitPostMergeCleanup(program$1) {
397
393
  const rebase = JSON.parse(alexCLineConfigJSON)["git-post-merge-cleanup"]?.rebase ?? rebaseOption;
398
394
  console.info(`Running git-post-merge-cleanup in ${rebase ? "rebase" : "merge"} mode...`);
399
395
  const { stdout: currentBranch } = await execa.execa`git branch --show-current`;
400
- if (currentBranch === branch) program$1.error(`❌ ERROR: Cannot run cleanup on ${branch} branch!`, {
396
+ if (currentBranch === branch) program.error(`❌ ERROR: Cannot run cleanup on ${branch} branch!`, {
401
397
  exitCode: 1,
402
398
  code: "INVALID_BRANCH"
403
399
  });
@@ -425,7 +421,7 @@ function gitPostMergeCleanup(program$1) {
425
421
  const { stdout: changes } = await execa.execa`git diff ${branch}..${currentBranch}`;
426
422
  if (changes) {
427
423
  await execa.execa`git checkout ${currentBranch}`;
428
- program$1.error("❌ ERROR: Changes on branch not fully merged!", {
424
+ program.error("❌ ERROR: Changes on branch not fully merged!", {
429
425
  exitCode: 1,
430
426
  code: "CHANGES_NOT_MERGED"
431
427
  });
@@ -441,7 +437,7 @@ function gitPostMergeCleanup(program$1) {
441
437
  } catch (error) {
442
438
  if (error instanceof execa.ExecaError) {
443
439
  await execa.execa`git checkout ${currentBranch}`;
444
- program$1.error("❌ ERROR: Changes on branch not fully merged!", {
440
+ program.error("❌ ERROR: Changes on branch not fully merged!", {
445
441
  exitCode: 1,
446
442
  code: "CHANGES_NOT_MERGED"
447
443
  });
@@ -453,15 +449,17 @@ var git_post_merge_cleanup_default = gitPostMergeCleanup;
453
449
 
454
450
  //#endregion
455
451
  //#region src/commands/increment-version.ts
456
- function incrementVersion(program$1) {
457
- program$1.command("increment-version").description("Increments the given input version depending on the given increment type.").argument("<version>", "The version to increment").argument("<incrementType>", _alextheman_utility.normaliseIndents`
452
+ function incrementVersion(program) {
453
+ program.command("increment-version").description("Increments the given input version depending on the given increment type.").argument("<version>", "The version to increment", (rawVersion) => {
454
+ return new _alextheman_utility.VersionNumber(rawVersion);
455
+ }).argument("<incrementType>", _alextheman_utility.normaliseIndents`
458
456
  The type of increment. Can be one of the following:
459
457
 
460
458
  - "major": Change the major version v1.2.3 → v2.0.0
461
459
  - "minor": Change the minor version v1.2.3 → v1.3.0
462
460
  - "patch": Change the patch version v1.2.3 → v1.2.4
463
- `).option("--no-prefix").option("--prefix", "Whether to add the `v` prefix from the output version or not (defaults to true).").action((version$1, incrementType, { prefix }) => {
464
- console.info(new _alextheman_utility.VersionNumber(version$1).increment((0, _alextheman_utility.parseVersionType)(incrementType)).toString({ omitPrefix: !prefix }));
461
+ `, _alextheman_utility.parseVersionType).option("--no-prefix").option("--prefix", "Whether to add the `v` prefix from the output version or not (defaults to true).").action((version$1, incrementType, { prefix }) => {
462
+ console.info(version$1.increment(incrementType).toString({ omitPrefix: !prefix }));
465
463
  });
466
464
  }
467
465
  var increment_version_default = incrementVersion;
@@ -469,8 +467,8 @@ var increment_version_default = incrementVersion;
469
467
  //#endregion
470
468
  //#region src/commands/pre-commit.ts
471
469
  const deprecationMessage = "[DEPRECATED]: This command does not support the new alex-c-line config system. Please use `pre-commit-2` instead.";
472
- function preCommit(program$1) {
473
- program$1.command("pre-commit").description(_alextheman_utility.normaliseIndents`
470
+ function preCommit(program) {
471
+ program.command("pre-commit").description(_alextheman_utility.normaliseIndents`
474
472
  ${deprecationMessage}
475
473
  Run the standard pre-commits used across all my repositories.`).option("--no-build", "Skip the build").option("--no-tests", "Skip the tests").option("--allow-unstaged", "Run even if nothing is staged").option("--repository-manager <repositoryManager>", "The repository manager if it is a monorepo (Only Turborepo is supported as of now)").action(async ({ build: shouldIncludeBuild, tests: shouldIncludeTests, allowUnstaged, repositoryManager: rawRepositoryManager }) => {
476
474
  console.warn(deprecationMessage);
@@ -481,7 +479,7 @@ function preCommit(program$1) {
481
479
  "--quiet"
482
480
  ]);
483
481
  switch (diffExitCode) {
484
- case 128: program$1.error("Not currently in a Git repository", {
482
+ case 128: program.error("Not currently in a Git repository", {
485
483
  exitCode: 1,
486
484
  code: "GIT_DIFF_FAILED"
487
485
  });
@@ -494,7 +492,7 @@ function preCommit(program$1) {
494
492
  const newArguments = [...args ?? []];
495
493
  if (repositoryManager === "turborepo") newArguments.push("--ui=stream");
496
494
  const result = await execaNoFail(command, newArguments, { stdio: "inherit" });
497
- if (result.exitCode !== 0) program$1.error(`Command failed: ${command}${newArguments.length ? ` ${newArguments.join(" ")}` : ""}`, {
495
+ if (result.exitCode !== 0) program.error(`Command failed: ${command}${newArguments.length ? ` ${newArguments.join(" ")}` : ""}`, {
498
496
  exitCode: result.exitCode ?? 1,
499
497
  code: "PRE_COMMIT_FAILED"
500
498
  });
@@ -589,15 +587,15 @@ var findAlexCLineConfig_default = findAlexCLineConfig;
589
587
 
590
588
  //#endregion
591
589
  //#region src/commands/pre-commit-2.ts
592
- function preCommit2(program$1) {
593
- program$1.command("pre-commit-2").description("Run the pre-commit scripts specified in the alex-c-line config (v2 experiment).").option("--allow-no-staged-changes", "Run even if nothing is staged").action(async ({ allowNoStagedChanges }) => {
590
+ function preCommit2(program) {
591
+ program.command("pre-commit-2").description("Run the pre-commit scripts specified in the alex-c-line config (v2 experiment).").option("--allow-no-staged-changes", "Run even if nothing is staged").action(async ({ allowNoStagedChanges }) => {
594
592
  const configPath = await findAlexCLineConfig_default(process.cwd());
595
- if (!configPath) program$1.error("Could not find the path to the alex-c-line config file. Does it exist?", {
593
+ if (!configPath) program.error("Could not find the path to the alex-c-line config file. Does it exist?", {
596
594
  exitCode: 1,
597
595
  code: "ALEX_C_LINE_CONFIG_NOT_FOUND"
598
596
  });
599
597
  const { preCommit: preCommitConfig } = await loadAlexCLineConfig_default(configPath);
600
- if (!preCommitConfig) program$1.error("Could not find the pre-commit config in alex-c-line config.", {
598
+ if (!preCommitConfig) program.error("Could not find the pre-commit config in alex-c-line config.", {
601
599
  exitCode: 1,
602
600
  code: "PRE_COMMIT_CONFIG_NOT_FOUND"
603
601
  });
@@ -607,7 +605,7 @@ function preCommit2(program$1) {
607
605
  "--quiet"
608
606
  ]);
609
607
  switch (diffExitCode) {
610
- case 128: program$1.error("Not currently in a Git repository", {
608
+ case 128: program.error("Not currently in a Git repository", {
611
609
  exitCode: 1,
612
610
  code: "GIT_DIFF_FAILED"
613
611
  });
@@ -618,7 +616,7 @@ function preCommit2(program$1) {
618
616
  }
619
617
  async function runCommandAndLogToConsole(command, args) {
620
618
  const result = await execaNoFail(command, args, { stdio: "inherit" });
621
- if (result.exitCode !== 0) program$1.error(`Command failed: ${command}${args?.length ? ` ${args.join(" ")}` : ""}`, {
619
+ if (result.exitCode !== 0) program.error(`Command failed: ${command}${args?.length ? ` ${args.join(" ")}` : ""}`, {
622
620
  exitCode: result.exitCode ?? 1,
623
621
  code: "PRE_COMMIT_FAILED"
624
622
  });
@@ -628,7 +626,7 @@ function preCommit2(program$1) {
628
626
  const rawPackageManager = preCommitConfig.packageManager ?? (typeof packagePackageManager === "string" ? packagePackageManager.split("@")[0] : void 0);
629
627
  const packageManager$1 = (0, _alextheman_utility.parseZodSchema)(zod.default.enum(PackageManager), rawPackageManager, new _alextheman_utility.DataError(rawPackageManager, "UNSUPPORTED_PACKAGE_MANAGER", `This repository manager is not currently supported. Only the following are supported: ${Object.values(PackageManager).join(", ")}`));
630
628
  function getCommandArguments(script, args) {
631
- if (!(script in (scripts$1 ?? {}))) program$1.error(`Could not find script \`${script}\` in package.json.`, {
629
+ if (!(script in (scripts$1 ?? {}))) program.error(`Could not find script \`${script}\` in package.json.`, {
632
630
  exitCode: 1,
633
631
  code: "SCRIPT_NOT_FOUND"
634
632
  });
@@ -648,8 +646,8 @@ var pre_commit_2_default = preCommit2;
648
646
 
649
647
  //#endregion
650
648
  //#region src/commands/say-hello.ts
651
- function sayHello(program$1) {
652
- program$1.command("say-hello").description("Quick test command").action(() => {
649
+ function sayHello(program) {
650
+ program.command("say-hello").description("Quick test command").action(() => {
653
651
  console.info("Hello!");
654
652
  });
655
653
  }
@@ -668,10 +666,10 @@ var isValidReleaseDocument_default = isValidReleaseDocument;
668
666
 
669
667
  //#endregion
670
668
  //#region src/commands/set-release-status.ts
671
- function setReleaseStatus(program$1) {
672
- program$1.command("set-release-status").description("Change the release status on a given release document initially generated from the `create-release-note` command.").argument("<documentPath>", "The path to the document").action(async (documentPath) => {
669
+ function setReleaseStatus(program) {
670
+ program.command("set-release-status").description("Change the release status on a given release document initially generated from the `create-release-note` command.").argument("<documentPath>", "The path to the document").action(async (documentPath) => {
673
671
  const { name: packageName } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
674
- if (!documentPath.endsWith("md")) program$1.error("❌ ERROR: Invalid file path. Path must lead to a .md file.", {
672
+ if (!documentPath.endsWith("md")) program.error("❌ ERROR: Invalid file path. Path must lead to a .md file.", {
675
673
  exitCode: 1,
676
674
  code: "INVALID_FILE_PATH"
677
675
  });
@@ -681,7 +679,7 @@ function setReleaseStatus(program$1) {
681
679
  }).join("."));
682
680
  const fullDocumentPath = node_path.default.join(process.cwd(), documentPath);
683
681
  const initialDocument = await (0, node_fs_promises.readFile)(fullDocumentPath, "utf-8");
684
- if (!isValidReleaseDocument_default(packageName, versionNumber, initialDocument)) program$1.error("❌ ERROR: Document does not match a valid release note template.", {
682
+ if (!isValidReleaseDocument_default(packageName, versionNumber, initialDocument)) program.error("❌ ERROR: Document does not match a valid release note template.", {
685
683
  exitCode: 1,
686
684
  code: "INVALID_RELEASE_NOTE"
687
685
  });
@@ -693,15 +691,15 @@ var set_release_status_default = setReleaseStatus;
693
691
 
694
692
  //#endregion
695
693
  //#region src/utility/loadCommands.ts
696
- function loadCommands(program$1, commandMap) {
697
- for (const loader of Object.values(commandMap)) loader(program$1);
694
+ function loadCommands(program, commandMap) {
695
+ for (const loader of Object.values(commandMap)) loader(program);
698
696
  }
699
697
  var loadCommands_default = loadCommands;
700
698
 
701
699
  //#endregion
702
700
  //#region src/commands/index.ts
703
- function createCommands(program$1) {
704
- loadCommands_default(program$1, {
701
+ function createCommands(program) {
702
+ loadCommands_default(program, {
705
703
  checkForFileDependencies: check_for_file_dependencies_default,
706
704
  checkLockfileVersionDiscrepancy: check_lockfile_version_discrepancy_default,
707
705
  checkVersionNumberChange: check_version_number_change_default,
@@ -722,7 +720,7 @@ var commands_default = createCommands;
722
720
 
723
721
  //#endregion
724
722
  //#region package.json
725
- var version = "1.17.1";
723
+ var version = "1.17.3";
726
724
  var package_default = {
727
725
  name: "alex-c-line",
728
726
  version,
@@ -787,7 +785,7 @@ var package_default = {
787
785
  "use-local-utility": "pnpm run prepare-local-utility"
788
786
  },
789
787
  dependencies: {
790
- "@alextheman/utility": "^4.4.2",
788
+ "@alextheman/utility": "^4.5.1",
791
789
  "commander": "^14.0.2",
792
790
  "dotenv": "^17.2.3",
793
791
  "dotenv-stringify": "^3.0.1",
@@ -798,6 +796,7 @@ var package_default = {
798
796
  },
799
797
  devDependencies: {
800
798
  "@alextheman/eslint-plugin": "^5.4.2",
799
+ "@commander-js/extra-typings": "^14.0.0",
801
800
  "@types/eslint": "^9.6.1",
802
801
  "@types/libsodium-wrappers": "^0.7.14",
803
802
  "@types/node": "^25.0.3",
@@ -823,10 +822,12 @@ var package_default = {
823
822
 
824
823
  //#endregion
825
824
  //#region src/index.ts
826
- const program = new commander.Command();
827
- program.name("alex-c-line").description("CLI tool built by Alex").version(version);
828
- (0, update_notifier.default)({ pkg: package_default }).notify();
829
- commands_default(program);
830
- program.parse(process.argv);
825
+ (async () => {
826
+ const program = new commander.Command();
827
+ program.name("alex-c-line").description("CLI tool built by Alex").version(version);
828
+ (0, update_notifier.default)({ pkg: package_default }).notify();
829
+ commands_default(program);
830
+ await program.parseAsync(process.argv);
831
+ })();
831
832
 
832
833
  //#endregion
package/dist/index.js CHANGED
@@ -5,11 +5,10 @@ import updateNotifier from "update-notifier";
5
5
  import { access, mkdir, readFile, writeFile } from "node:fs/promises";
6
6
  import path from "node:path";
7
7
  import { readFileSync } from "node:fs";
8
- import { DataError, VersionNumber, kebabToCamel, normaliseIndents, parseVersionType, parseZodSchema } from "@alextheman/utility";
8
+ import { DataError, VersionNumber, encryptWithKey, kebabToCamel, normaliseIndents, parseVersionType, parseZodSchema } from "@alextheman/utility";
9
9
  import { ExecaError, execa } from "execa";
10
10
  import dotenv from "dotenv";
11
11
  import dotenvStringify from "dotenv-stringify";
12
- import sodium from "libsodium-wrappers";
13
12
  import os from "node:os";
14
13
  import z from "zod";
15
14
  import { pathToFileURL } from "node:url";
@@ -21,8 +20,8 @@ function findFileDependencies(dependencies$1) {
21
20
  for (const dependency in dependencies$1) if (dependencies$1[dependency].includes("file:")) fileDependencies[dependency] = dependencies$1[dependency];
22
21
  return fileDependencies;
23
22
  }
24
- function checkForFileDependencies(program$1) {
25
- program$1.command("check-for-file-dependencies").description("Check for existence of file dependencies in package.json and give exit code 1 if such dependencies are found").action(async () => {
23
+ function checkForFileDependencies(program) {
24
+ program.command("check-for-file-dependencies").description("Check for existence of file dependencies in package.json and give exit code 1 if such dependencies are found").action(async () => {
26
25
  console.info("Checking for file dependencies...");
27
26
  const { dependencies: dependencies$1, devDependencies: devDependencies$1, peerDependencies } = JSON.parse(await readFile(path.resolve(process.cwd(), "package.json"), "utf-8"));
28
27
  const allFileDependencies = {
@@ -33,7 +32,7 @@ function checkForFileDependencies(program$1) {
33
32
  if (Object.keys(allFileDependencies.dependencies ?? {}).length === 0) delete allFileDependencies.dependencies;
34
33
  if (Object.keys(allFileDependencies.devDependencies ?? {}).length === 0) delete allFileDependencies.devDependencies;
35
34
  if (Object.keys(allFileDependencies.peerDependencies ?? {}).length === 0) delete allFileDependencies.peerDependencies;
36
- if (Object.keys(allFileDependencies).length !== 0) program$1.error(`ERROR: File dependencies found:\n\n${JSON.stringify(allFileDependencies, void 0, 2)}
35
+ if (Object.keys(allFileDependencies).length !== 0) program.error(`ERROR: File dependencies found:\n\n${JSON.stringify(allFileDependencies, void 0, 2)}
37
36
  `, {
38
37
  exitCode: 1,
39
38
  code: "FILE_DEPENDENCIES_FOUND"
@@ -45,8 +44,8 @@ var check_for_file_dependencies_default = checkForFileDependencies;
45
44
 
46
45
  //#endregion
47
46
  //#region src/commands/check-lockfile-version-discrepancy.ts
48
- function checkLockfileVersionDiscrepancy(program$1) {
49
- program$1.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(() => {
47
+ function checkLockfileVersionDiscrepancy(program) {
48
+ program.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(() => {
50
49
  console.info("Checking for package.json and package-lock.json discrepancies...");
51
50
  const { version: packageVersion } = JSON.parse(readFileSync(path.resolve(process.cwd(), "package.json"), "utf-8"));
52
51
  const { version: packageLockVersion } = JSON.parse(readFileSync(path.resolve(process.cwd(), "package-lock.json"), "utf-8"));
@@ -81,8 +80,8 @@ async function execaNoFail(command, args, options) {
81
80
 
82
81
  //#endregion
83
82
  //#region src/commands/check-version-number-change.ts
84
- function checkVersionNumberChange(program$1) {
85
- program$1.command("check-version-number-change").description("Check that version number on branch has changed if source code differs between main and current branch").action(async () => {
83
+ function checkVersionNumberChange(program) {
84
+ program.command("check-version-number-change").description("Check that version number on branch has changed if source code differs between main and current branch").action(async () => {
86
85
  console.info("Checking for version change...");
87
86
  const { exitCode } = await execaNoFail("git", [
88
87
  "diff",
@@ -101,7 +100,7 @@ function checkVersionNumberChange(program$1) {
101
100
  const newMajorVersion = `${parseInt(currentBranchMajor) + 1}.0.0`;
102
101
  const newMinorVersion = `${currentBranchMajor}.${parseInt(currentBranchMinor) + 1}.0`;
103
102
  const newPatchVersion = `${currentBranchMajor}.${currentBranchMinor}.${parseInt(currentBranchPatch) + 1}`;
104
- if (mainPackageVersion === currentBranchPackageVersion) program$1.error(normaliseIndents`
103
+ if (mainPackageVersion === currentBranchPackageVersion) program.error(normaliseIndents`
105
104
  ❌ Version needs updating. Please run one of the following:
106
105
  - npm version major -m "Change version number to v%s" (v${mainPackageVersion} -> v${newMajorVersion})
107
106
  - npm version minor -m "Change version number to v%s" (v${mainPackageVersion} -> v${newMinorVersion})
@@ -185,8 +184,8 @@ var getPullRequestTemplates_default = getPullRequestTemplates;
185
184
 
186
185
  //#endregion
187
186
  //#region src/commands/create-pull-request-templates.ts
188
- function createPullRequestTemplates(program$1) {
189
- program$1.command("create-pull-request-templates").description("Create the standard pull request templates as found in my repositories").action(async () => {
187
+ function createPullRequestTemplates(program) {
188
+ program.command("create-pull-request-templates").description("Create the standard pull request templates as found in my repositories").action(async () => {
190
189
  const { name: name$1 } = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
191
190
  const gitHubPath = path.join(process.cwd(), ".github");
192
191
  const pullRequestTemplatePath = path.join(gitHubPath, "PULL_REQUEST_TEMPLATE");
@@ -280,10 +279,10 @@ var getReleaseNoteTemplate_default = getReleaseNoteTemplate;
280
279
 
281
280
  //#endregion
282
281
  //#region src/commands/create-release-note.ts
283
- function createReleaseNote(program$1) {
284
- program$1.command("create-release-note").argument("[versionType]", "The version type to increment by (`major|minor|patch`). Note that this performs the version calculation without changing package.json. If left blank it will use the version in package.json").description("Create release notes based on the current version in package.json.").action(async (versionType) => {
282
+ function createReleaseNote(program) {
283
+ program.command("create-release-note").argument("[versionType]", "The version type to increment by (`major|minor|patch`). Note that this performs the version calculation without changing package.json. If left blank it will use the version in package.json", parseVersionType).description("Create release notes based on the current version in package.json.").action(async (versionType) => {
285
284
  const { name: name$1, version: version$1 } = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
286
- const versionNumber = versionType ? new VersionNumber(version$1).increment(parseVersionType(versionType)) : new VersionNumber(version$1);
285
+ const versionNumber = versionType ? new VersionNumber(version$1).increment(versionType) : new VersionNumber(version$1);
287
286
  const releaseNotePath = `${`docs/releases/${versionNumber.type}`}/${versionNumber}.md`;
288
287
  const fullReleaseNotePath = path.join(process.cwd(), releaseNotePath);
289
288
  const releaseNoteTemplate = getReleaseNoteTemplate_default(name$1, versionNumber, "In progress");
@@ -291,7 +290,7 @@ function createReleaseNote(program$1) {
291
290
  await mkdir(path.dirname(fullReleaseNotePath), { recursive: true });
292
291
  await writeFile(fullReleaseNotePath, releaseNoteTemplate, { flag: "wx" });
293
292
  } catch (error) {
294
- if (error instanceof Error && "code" in error && error.code === "EEXIST") program$1.error("❌ ERROR: Release notes already exist.", {
293
+ if (error instanceof Error && "code" in error && error.code === "EEXIST") program.error("❌ ERROR: Release notes already exist.", {
295
294
  exitCode: 1,
296
295
  code: "RELEASE_NOTE_EXISTS"
297
296
  });
@@ -304,8 +303,8 @@ var create_release_note_default = createReleaseNote;
304
303
 
305
304
  //#endregion
306
305
  //#region src/commands/edit-env.ts
307
- function editEnv(program$1) {
308
- program$1.command("edit-env <key> [value]").description("Edit property in .env file (leave value blank to delete property)").option("--file <file>", "The file to edit", ".env").action(async (key, value, { file }) => {
306
+ function editEnv(program) {
307
+ program.command("edit-env <key> [value]").description("Edit property in .env file (leave value blank to delete property)").option("--file <file>", "The file to edit", ".env").action(async (key, value, { file }) => {
309
308
  let newValue = value;
310
309
  if (typeof newValue === "string" && newValue.startsWith("--")) newValue = void 0;
311
310
  let currentEnvFileContents;
@@ -324,37 +323,35 @@ var edit_env_default = editEnv;
324
323
 
325
324
  //#endregion
326
325
  //#region src/commands/encrypt-with-key.ts
327
- function encryptWithKey(program$1) {
328
- program$1.command("encrypt-with-key").alias("encrypt").description("Encrypt a secret given the public base64 key and the thing you want to encrypt.").argument("<key>", "The public base64 key to encrypt with").argument("<value>", "The value to encrypt in plaintext").action(async (key, value) => {
326
+ function encryptWithKey$1(program) {
327
+ program.command("encrypt-with-key").alias("encrypt").description("Encrypt a secret given the public base64 key and the thing you want to encrypt.").argument("<publicKey>", "The public base64 key to encrypt with").argument("<plaintextValue>", "The value to encrypt in plaintext").action(async (publicKey, plaintextValue) => {
329
328
  try {
330
- await sodium.ready;
331
- const base64Key = sodium.from_base64(key, sodium.base64_variants.ORIGINAL);
332
- const encryptedValue = sodium.crypto_box_seal(value, base64Key);
333
- const encryptedBase64Value = sodium.to_base64(encryptedValue, sodium.base64_variants.ORIGINAL);
334
- console.info(encryptedBase64Value);
329
+ console.info(await encryptWithKey(publicKey, plaintextValue));
335
330
  } catch {
336
- program$1.error("Encryption failed. Please double-check that the given key is a valid base 64 string.", {
331
+ program.error("Encryption failed. Please double-check that the given key is a valid base 64 string.", {
337
332
  exitCode: 1,
338
333
  code: "ENCRYPTION_FAILED"
339
334
  });
340
335
  }
341
336
  });
342
337
  }
343
- var encrypt_with_key_default = encryptWithKey;
338
+ var encrypt_with_key_default = encryptWithKey$1;
344
339
 
345
340
  //#endregion
346
341
  //#region src/commands/get-version-type.ts
347
- function getVersionType(program$1) {
348
- program$1.command("get-version-type").description("Gets the version type of the given version number.").argument("<version>", "The version to get the version type from").action((version$1) => {
349
- console.info(new VersionNumber(version$1).type);
342
+ function getVersionType(program) {
343
+ program.command("get-version-type").description("Gets the version type of the given version number.").argument("<version>", "The version to get the version type from", (rawVersion) => {
344
+ return new VersionNumber(rawVersion);
345
+ }).action((version$1) => {
346
+ console.info(version$1.type);
350
347
  });
351
348
  }
352
349
  var get_version_type_default = getVersionType;
353
350
 
354
351
  //#endregion
355
352
  //#region src/commands/git-post-merge-cleanup.ts
356
- function gitPostMergeCleanup(program$1) {
357
- program$1.command("git-post-merge-cleanup").alias("git-cleanup").description("Run after merging into a given branch to quickly clean up").argument("[branch]", "The branch you want to merge into", "main").option("--rebase", "Enable if your repository mainly rebases into main").action(async (branch, { rebase: rebaseOption }) => {
353
+ function gitPostMergeCleanup(program) {
354
+ program.command("git-post-merge-cleanup").alias("git-cleanup").description("Run after merging into a given branch to quickly clean up").argument("[branch]", "The branch you want to merge into", "main").option("--rebase", "Enable if your repository mainly rebases into main").action(async (branch, { rebase: rebaseOption }) => {
358
355
  let alexCLineConfigJSON;
359
356
  try {
360
357
  alexCLineConfigJSON = await readFile(path.join(process.env.HOME ?? os.homedir(), "alex-c-line-config.json"), "utf-8");
@@ -363,7 +360,7 @@ function gitPostMergeCleanup(program$1) {
363
360
  const rebase = JSON.parse(alexCLineConfigJSON)["git-post-merge-cleanup"]?.rebase ?? rebaseOption;
364
361
  console.info(`Running git-post-merge-cleanup in ${rebase ? "rebase" : "merge"} mode...`);
365
362
  const { stdout: currentBranch } = await execa`git branch --show-current`;
366
- if (currentBranch === branch) program$1.error(`❌ ERROR: Cannot run cleanup on ${branch} branch!`, {
363
+ if (currentBranch === branch) program.error(`❌ ERROR: Cannot run cleanup on ${branch} branch!`, {
367
364
  exitCode: 1,
368
365
  code: "INVALID_BRANCH"
369
366
  });
@@ -391,7 +388,7 @@ function gitPostMergeCleanup(program$1) {
391
388
  const { stdout: changes } = await execa`git diff ${branch}..${currentBranch}`;
392
389
  if (changes) {
393
390
  await execa`git checkout ${currentBranch}`;
394
- program$1.error("❌ ERROR: Changes on branch not fully merged!", {
391
+ program.error("❌ ERROR: Changes on branch not fully merged!", {
395
392
  exitCode: 1,
396
393
  code: "CHANGES_NOT_MERGED"
397
394
  });
@@ -407,7 +404,7 @@ function gitPostMergeCleanup(program$1) {
407
404
  } catch (error) {
408
405
  if (error instanceof ExecaError) {
409
406
  await execa`git checkout ${currentBranch}`;
410
- program$1.error("❌ ERROR: Changes on branch not fully merged!", {
407
+ program.error("❌ ERROR: Changes on branch not fully merged!", {
411
408
  exitCode: 1,
412
409
  code: "CHANGES_NOT_MERGED"
413
410
  });
@@ -419,15 +416,17 @@ var git_post_merge_cleanup_default = gitPostMergeCleanup;
419
416
 
420
417
  //#endregion
421
418
  //#region src/commands/increment-version.ts
422
- function incrementVersion(program$1) {
423
- program$1.command("increment-version").description("Increments the given input version depending on the given increment type.").argument("<version>", "The version to increment").argument("<incrementType>", normaliseIndents`
419
+ function incrementVersion(program) {
420
+ program.command("increment-version").description("Increments the given input version depending on the given increment type.").argument("<version>", "The version to increment", (rawVersion) => {
421
+ return new VersionNumber(rawVersion);
422
+ }).argument("<incrementType>", normaliseIndents`
424
423
  The type of increment. Can be one of the following:
425
424
 
426
425
  - "major": Change the major version v1.2.3 → v2.0.0
427
426
  - "minor": Change the minor version v1.2.3 → v1.3.0
428
427
  - "patch": Change the patch version v1.2.3 → v1.2.4
429
- `).option("--no-prefix").option("--prefix", "Whether to add the `v` prefix from the output version or not (defaults to true).").action((version$1, incrementType, { prefix }) => {
430
- console.info(new VersionNumber(version$1).increment(parseVersionType(incrementType)).toString({ omitPrefix: !prefix }));
428
+ `, parseVersionType).option("--no-prefix").option("--prefix", "Whether to add the `v` prefix from the output version or not (defaults to true).").action((version$1, incrementType, { prefix }) => {
429
+ console.info(version$1.increment(incrementType).toString({ omitPrefix: !prefix }));
431
430
  });
432
431
  }
433
432
  var increment_version_default = incrementVersion;
@@ -435,8 +434,8 @@ var increment_version_default = incrementVersion;
435
434
  //#endregion
436
435
  //#region src/commands/pre-commit.ts
437
436
  const deprecationMessage = "[DEPRECATED]: This command does not support the new alex-c-line config system. Please use `pre-commit-2` instead.";
438
- function preCommit(program$1) {
439
- program$1.command("pre-commit").description(normaliseIndents`
437
+ function preCommit(program) {
438
+ program.command("pre-commit").description(normaliseIndents`
440
439
  ${deprecationMessage}
441
440
  Run the standard pre-commits used across all my repositories.`).option("--no-build", "Skip the build").option("--no-tests", "Skip the tests").option("--allow-unstaged", "Run even if nothing is staged").option("--repository-manager <repositoryManager>", "The repository manager if it is a monorepo (Only Turborepo is supported as of now)").action(async ({ build: shouldIncludeBuild, tests: shouldIncludeTests, allowUnstaged, repositoryManager: rawRepositoryManager }) => {
442
441
  console.warn(deprecationMessage);
@@ -447,7 +446,7 @@ function preCommit(program$1) {
447
446
  "--quiet"
448
447
  ]);
449
448
  switch (diffExitCode) {
450
- case 128: program$1.error("Not currently in a Git repository", {
449
+ case 128: program.error("Not currently in a Git repository", {
451
450
  exitCode: 1,
452
451
  code: "GIT_DIFF_FAILED"
453
452
  });
@@ -460,7 +459,7 @@ function preCommit(program$1) {
460
459
  const newArguments = [...args ?? []];
461
460
  if (repositoryManager === "turborepo") newArguments.push("--ui=stream");
462
461
  const result = await execaNoFail(command, newArguments, { stdio: "inherit" });
463
- if (result.exitCode !== 0) program$1.error(`Command failed: ${command}${newArguments.length ? ` ${newArguments.join(" ")}` : ""}`, {
462
+ if (result.exitCode !== 0) program.error(`Command failed: ${command}${newArguments.length ? ` ${newArguments.join(" ")}` : ""}`, {
464
463
  exitCode: result.exitCode ?? 1,
465
464
  code: "PRE_COMMIT_FAILED"
466
465
  });
@@ -555,15 +554,15 @@ var findAlexCLineConfig_default = findAlexCLineConfig;
555
554
 
556
555
  //#endregion
557
556
  //#region src/commands/pre-commit-2.ts
558
- function preCommit2(program$1) {
559
- program$1.command("pre-commit-2").description("Run the pre-commit scripts specified in the alex-c-line config (v2 experiment).").option("--allow-no-staged-changes", "Run even if nothing is staged").action(async ({ allowNoStagedChanges }) => {
557
+ function preCommit2(program) {
558
+ program.command("pre-commit-2").description("Run the pre-commit scripts specified in the alex-c-line config (v2 experiment).").option("--allow-no-staged-changes", "Run even if nothing is staged").action(async ({ allowNoStagedChanges }) => {
560
559
  const configPath = await findAlexCLineConfig_default(process.cwd());
561
- if (!configPath) program$1.error("Could not find the path to the alex-c-line config file. Does it exist?", {
560
+ if (!configPath) program.error("Could not find the path to the alex-c-line config file. Does it exist?", {
562
561
  exitCode: 1,
563
562
  code: "ALEX_C_LINE_CONFIG_NOT_FOUND"
564
563
  });
565
564
  const { preCommit: preCommitConfig } = await loadAlexCLineConfig_default(configPath);
566
- if (!preCommitConfig) program$1.error("Could not find the pre-commit config in alex-c-line config.", {
565
+ if (!preCommitConfig) program.error("Could not find the pre-commit config in alex-c-line config.", {
567
566
  exitCode: 1,
568
567
  code: "PRE_COMMIT_CONFIG_NOT_FOUND"
569
568
  });
@@ -573,7 +572,7 @@ function preCommit2(program$1) {
573
572
  "--quiet"
574
573
  ]);
575
574
  switch (diffExitCode) {
576
- case 128: program$1.error("Not currently in a Git repository", {
575
+ case 128: program.error("Not currently in a Git repository", {
577
576
  exitCode: 1,
578
577
  code: "GIT_DIFF_FAILED"
579
578
  });
@@ -584,7 +583,7 @@ function preCommit2(program$1) {
584
583
  }
585
584
  async function runCommandAndLogToConsole(command, args) {
586
585
  const result = await execaNoFail(command, args, { stdio: "inherit" });
587
- if (result.exitCode !== 0) program$1.error(`Command failed: ${command}${args?.length ? ` ${args.join(" ")}` : ""}`, {
586
+ if (result.exitCode !== 0) program.error(`Command failed: ${command}${args?.length ? ` ${args.join(" ")}` : ""}`, {
588
587
  exitCode: result.exitCode ?? 1,
589
588
  code: "PRE_COMMIT_FAILED"
590
589
  });
@@ -594,7 +593,7 @@ function preCommit2(program$1) {
594
593
  const rawPackageManager = preCommitConfig.packageManager ?? (typeof packagePackageManager === "string" ? packagePackageManager.split("@")[0] : void 0);
595
594
  const packageManager$1 = parseZodSchema(z.enum(PackageManager), rawPackageManager, new DataError(rawPackageManager, "UNSUPPORTED_PACKAGE_MANAGER", `This repository manager is not currently supported. Only the following are supported: ${Object.values(PackageManager).join(", ")}`));
596
595
  function getCommandArguments(script, args) {
597
- if (!(script in (scripts$1 ?? {}))) program$1.error(`Could not find script \`${script}\` in package.json.`, {
596
+ if (!(script in (scripts$1 ?? {}))) program.error(`Could not find script \`${script}\` in package.json.`, {
598
597
  exitCode: 1,
599
598
  code: "SCRIPT_NOT_FOUND"
600
599
  });
@@ -614,8 +613,8 @@ var pre_commit_2_default = preCommit2;
614
613
 
615
614
  //#endregion
616
615
  //#region src/commands/say-hello.ts
617
- function sayHello(program$1) {
618
- program$1.command("say-hello").description("Quick test command").action(() => {
616
+ function sayHello(program) {
617
+ program.command("say-hello").description("Quick test command").action(() => {
619
618
  console.info("Hello!");
620
619
  });
621
620
  }
@@ -634,10 +633,10 @@ var isValidReleaseDocument_default = isValidReleaseDocument;
634
633
 
635
634
  //#endregion
636
635
  //#region src/commands/set-release-status.ts
637
- function setReleaseStatus(program$1) {
638
- program$1.command("set-release-status").description("Change the release status on a given release document initially generated from the `create-release-note` command.").argument("<documentPath>", "The path to the document").action(async (documentPath) => {
636
+ function setReleaseStatus(program) {
637
+ program.command("set-release-status").description("Change the release status on a given release document initially generated from the `create-release-note` command.").argument("<documentPath>", "The path to the document").action(async (documentPath) => {
639
638
  const { name: packageName } = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
640
- if (!documentPath.endsWith("md")) program$1.error("❌ ERROR: Invalid file path. Path must lead to a .md file.", {
639
+ if (!documentPath.endsWith("md")) program.error("❌ ERROR: Invalid file path. Path must lead to a .md file.", {
641
640
  exitCode: 1,
642
641
  code: "INVALID_FILE_PATH"
643
642
  });
@@ -647,7 +646,7 @@ function setReleaseStatus(program$1) {
647
646
  }).join("."));
648
647
  const fullDocumentPath = path.join(process.cwd(), documentPath);
649
648
  const initialDocument = await readFile(fullDocumentPath, "utf-8");
650
- if (!isValidReleaseDocument_default(packageName, versionNumber, initialDocument)) program$1.error("❌ ERROR: Document does not match a valid release note template.", {
649
+ if (!isValidReleaseDocument_default(packageName, versionNumber, initialDocument)) program.error("❌ ERROR: Document does not match a valid release note template.", {
651
650
  exitCode: 1,
652
651
  code: "INVALID_RELEASE_NOTE"
653
652
  });
@@ -659,15 +658,15 @@ var set_release_status_default = setReleaseStatus;
659
658
 
660
659
  //#endregion
661
660
  //#region src/utility/loadCommands.ts
662
- function loadCommands(program$1, commandMap) {
663
- for (const loader of Object.values(commandMap)) loader(program$1);
661
+ function loadCommands(program, commandMap) {
662
+ for (const loader of Object.values(commandMap)) loader(program);
664
663
  }
665
664
  var loadCommands_default = loadCommands;
666
665
 
667
666
  //#endregion
668
667
  //#region src/commands/index.ts
669
- function createCommands(program$1) {
670
- loadCommands_default(program$1, {
668
+ function createCommands(program) {
669
+ loadCommands_default(program, {
671
670
  checkForFileDependencies: check_for_file_dependencies_default,
672
671
  checkLockfileVersionDiscrepancy: check_lockfile_version_discrepancy_default,
673
672
  checkVersionNumberChange: check_version_number_change_default,
@@ -688,7 +687,7 @@ var commands_default = createCommands;
688
687
 
689
688
  //#endregion
690
689
  //#region package.json
691
- var version = "1.17.1";
690
+ var version = "1.17.3";
692
691
  var package_default = {
693
692
  name: "alex-c-line",
694
693
  version,
@@ -753,7 +752,7 @@ var package_default = {
753
752
  "use-local-utility": "pnpm run prepare-local-utility"
754
753
  },
755
754
  dependencies: {
756
- "@alextheman/utility": "^4.4.2",
755
+ "@alextheman/utility": "^4.5.1",
757
756
  "commander": "^14.0.2",
758
757
  "dotenv": "^17.2.3",
759
758
  "dotenv-stringify": "^3.0.1",
@@ -764,6 +763,7 @@ var package_default = {
764
763
  },
765
764
  devDependencies: {
766
765
  "@alextheman/eslint-plugin": "^5.4.2",
766
+ "@commander-js/extra-typings": "^14.0.0",
767
767
  "@types/eslint": "^9.6.1",
768
768
  "@types/libsodium-wrappers": "^0.7.14",
769
769
  "@types/node": "^25.0.3",
@@ -789,11 +789,13 @@ var package_default = {
789
789
 
790
790
  //#endregion
791
791
  //#region src/index.ts
792
- const program = new Command();
793
- program.name("alex-c-line").description("CLI tool built by Alex").version(version);
794
- updateNotifier({ pkg: package_default }).notify();
795
- commands_default(program);
796
- program.parse(process.argv);
792
+ (async () => {
793
+ const program = new Command();
794
+ program.name("alex-c-line").description("CLI tool built by Alex").version(version);
795
+ updateNotifier({ pkg: package_default }).notify();
796
+ commands_default(program);
797
+ await program.parseAsync(process.argv);
798
+ })();
797
799
 
798
800
  //#endregion
799
801
  export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alex-c-line",
3
- "version": "1.17.1",
3
+ "version": "1.17.3",
4
4
  "description": "Command-line tool with commands to streamline the developer workflow.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@alextheman/utility": "^4.4.2",
36
+ "@alextheman/utility": "^4.5.1",
37
37
  "commander": "^14.0.2",
38
38
  "dotenv": "^17.2.3",
39
39
  "dotenv-stringify": "^3.0.1",
@@ -44,6 +44,7 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@alextheman/eslint-plugin": "^5.4.2",
47
+ "@commander-js/extra-typings": "^14.0.0",
47
48
  "@types/eslint": "^9.6.1",
48
49
  "@types/libsodium-wrappers": "^0.7.14",
49
50
  "@types/node": "^25.0.3",