alex-c-line 1.30.2 → 1.31.0

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.
@@ -23,7 +23,7 @@ interface CreatePullRequestTemplateInfrastructureConfig extends CreatePullReques
23
23
  }
24
24
  type CreatePullRequestTemplateConfig = CreatePullRequestTemplateGeneralConfig | CreatePullRequestTemplateInfrastructureConfig;
25
25
  //#endregion
26
- //#region src/commands/pre-commit/createStepRunner.d.ts
26
+ //#region src/cli/commands/pre-commit/createStepRunner.d.ts
27
27
  interface BaseOptions {
28
28
  stdio: "inherit";
29
29
  reject: false;
@@ -24,7 +24,7 @@ interface CreatePullRequestTemplateInfrastructureConfig extends CreatePullReques
24
24
  }
25
25
  type CreatePullRequestTemplateConfig = CreatePullRequestTemplateGeneralConfig | CreatePullRequestTemplateInfrastructureConfig;
26
26
  //#endregion
27
- //#region src/commands/pre-commit/createStepRunner.d.ts
27
+ //#region src/cli/commands/pre-commit/createStepRunner.d.ts
28
28
  interface BaseOptions {
29
29
  stdio: "inherit";
30
30
  reject: false;
@@ -22,7 +22,7 @@ interface CreatePullRequestTemplateInfrastructureConfig extends CreatePullReques
22
22
  }
23
23
  type CreatePullRequestTemplateConfig = CreatePullRequestTemplateGeneralConfig | CreatePullRequestTemplateInfrastructureConfig;
24
24
  //#endregion
25
- //#region src/commands/pre-commit/createStepRunner.d.ts
25
+ //#region src/cli/commands/pre-commit/createStepRunner.d.ts
26
26
  interface BaseOptions {
27
27
  stdio: "inherit";
28
28
  reject: false;
@@ -22,7 +22,7 @@ interface CreatePullRequestTemplateInfrastructureConfig extends CreatePullReques
22
22
  }
23
23
  type CreatePullRequestTemplateConfig = CreatePullRequestTemplateGeneralConfig | CreatePullRequestTemplateInfrastructureConfig;
24
24
  //#endregion
25
- //#region src/commands/pre-commit/createStepRunner.d.ts
25
+ //#region src/cli/commands/pre-commit/createStepRunner.d.ts
26
26
  interface BaseOptions {
27
27
  stdio: "inherit";
28
28
  reject: false;
package/dist/index.cjs CHANGED
@@ -58,6 +58,7 @@ gray_matter = __toESM(gray_matter);
58
58
  let _alextheman_utility_node = require("@alextheman/utility/node");
59
59
  let supports_color = require("supports-color");
60
60
  supports_color = __toESM(supports_color);
61
+ let node_crypto = require("node:crypto");
61
62
 
62
63
  //#region src/utility/miscellaneous/asciiToPng.ts
63
64
  async function asciiToPng(ascii, options) {
@@ -122,7 +123,7 @@ async function createAlexCLineArtwork(options) {
122
123
  }
123
124
 
124
125
  //#endregion
125
- //#region src/commands/artwork.ts
126
+ //#region src/cli/commands/artwork.ts
126
127
  function artwork(program) {
127
128
  program.command("artwork").description("Create the artwork for alex-c-line").option("--subtitle-text <subtitleText>", "Customise the subtitle text").option("--subtitle-color <subtitleColor>", "Customise the subtitle color").option("--save-png [fileName]", "Save the artwork as a PNG file, optionally specifying the path").action(async ({ savePng: fileName, subtitleText, subtitleColor = "green" }) => {
128
129
  if (subtitleColor !== "green" && subtitleColor !== "white") throw new _alextheman_utility.DataError({ subtitleColor }, "INVALID_SUBTITLE_COLOR", "Subtitle color must either be green or white.");
@@ -156,7 +157,7 @@ const { cache: ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY } = alexCLineEnvPaths;
156
157
  const ALEX_C_LINE_GLOBAL_CACHE_PATH = node_path.default.join(ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY, "cache.json");
157
158
 
158
159
  //#endregion
159
- //#region src/commands/cache-path.ts
160
+ //#region src/cli/commands/cache-path.ts
160
161
  function cachePath(program) {
161
162
  program.command("cache-path").description("Log the path to the alex-c-line cache files.").action(() => {
162
163
  console.info(ALEX_C_LINE_GLOBAL_CACHE_PATH);
@@ -164,7 +165,7 @@ function cachePath(program) {
164
165
  }
165
166
 
166
167
  //#endregion
167
- //#region src/commands/check-for-file-dependencies.ts
168
+ //#region src/cli/commands/check-for-file-dependencies.ts
168
169
  function findFileDependencies(dependencies) {
169
170
  const fileDependencies = {};
170
171
  if (!dependencies) return {};
@@ -193,7 +194,7 @@ function checkForFileDependencies(program) {
193
194
  }
194
195
 
195
196
  //#endregion
196
- //#region src/commands/check-lockfile-version-discrepancy.ts
197
+ //#region src/cli/commands/check-lockfile-version-discrepancy.ts
197
198
  function checkLockfileVersionDiscrepancy(program) {
198
199
  program.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(async () => {
199
200
  console.info("Checking for package.json and package-lock.json discrepancies...");
@@ -209,7 +210,7 @@ function checkLockfileVersionDiscrepancy(program) {
209
210
  }
210
211
 
211
212
  //#endregion
212
- //#region src/commands/deprecated/check-version-number-change.ts
213
+ //#region src/cli/commands/deprecated/check-version-number-change.ts
213
214
  function checkVersionNumberChange(program) {
214
215
  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 () => {
215
216
  console.info("Checking for version change...");
@@ -305,7 +306,7 @@ function getPullRequestTemplates(packageName) {
305
306
  }
306
307
 
307
308
  //#endregion
308
- //#region src/commands/deprecated/create-pull-request-templates.ts
309
+ //#region src/cli/commands/deprecated/create-pull-request-templates.ts
309
310
  const deprecationMessage$2 = "[DEPRECATED]: This command does not support the new markdown-native templates and alex-c-line config system. Please use `pre-commit-2` instead.";
310
311
  function createPullRequestTemplates(program) {
311
312
  program.command("create-pull-request-templates").description(_alextheman_utility.normaliseIndents`
@@ -401,7 +402,7 @@ function getReleaseNoteTemplate(packageName, version, status = "In progress", co
401
402
  }
402
403
 
403
404
  //#endregion
404
- //#region src/commands/deprecated/create-release-note.ts
405
+ //#region src/cli/commands/deprecated/create-release-note.ts
405
406
  function createReleaseNote(program) {
406
407
  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) => {
407
408
  const { name, version } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
@@ -424,7 +425,7 @@ function createReleaseNote(program) {
424
425
  }
425
426
 
426
427
  //#endregion
427
- //#region src/commands/deprecated/edit-env.ts
428
+ //#region src/cli/commands/deprecated/edit-env.ts
428
429
  const deprecationMessage$1 = "[DEPRECATED]: Please use `edit-env-2` instead.";
429
430
  function editEnv(program) {
430
431
  program.command("edit-env <key> [value]").description(_alextheman_utility.normaliseIndents`
@@ -447,7 +448,7 @@ function editEnv(program) {
447
448
  }
448
449
 
449
450
  //#endregion
450
- //#region src/commands/deprecated/pre-commit.ts
451
+ //#region src/cli/commands/deprecated/pre-commit.ts
451
452
  const deprecationMessage = "[DEPRECATED]: This command does not support the new alex-c-line config system. Please use `pre-commit-2` instead.";
452
453
  function preCommit(program) {
453
454
  program.command("pre-commit").description(_alextheman_utility.normaliseIndents`
@@ -496,7 +497,7 @@ function isValidReleaseDocument(packageName, version, initialDocument) {
496
497
  }
497
498
 
498
499
  //#endregion
499
- //#region src/commands/deprecated/set-release-status.ts
500
+ //#region src/cli/commands/deprecated/set-release-status.ts
500
501
  function setReleaseStatus(program) {
501
502
  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) => {
502
503
  const { name: packageName } = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
@@ -530,7 +531,7 @@ async function upsertDotenvFile(contents, envFilePath) {
530
531
  }
531
532
 
532
533
  //#endregion
533
- //#region src/commands/edit-env-file/addVariable.ts
534
+ //#region src/cli/commands/edit-env-file/addVariable.ts
534
535
  async function addVariable(program, envFileContents, file) {
535
536
  const newVariableName = await (0, _inquirer_prompts.input)({ message: "Please enter the name of the environment variable you would like to add." });
536
537
  if (newVariableName in envFileContents) program.error(`
@@ -556,7 +557,7 @@ async function addVariable(program, envFileContents, file) {
556
557
  }
557
558
 
558
559
  //#endregion
559
- //#region src/commands/edit-env-file/deleteVariable.ts
560
+ //#region src/cli/commands/edit-env-file/deleteVariable.ts
560
561
  async function deleteVariable(envFileContents, variableToEdit, file) {
561
562
  if (!await (0, _inquirer_prompts.confirm)({ message: `Are you sure you want to delete \`${String(variableToEdit)}\`?` })) {
562
563
  console.info("Deletion aborted");
@@ -567,7 +568,7 @@ async function deleteVariable(envFileContents, variableToEdit, file) {
567
568
  }
568
569
 
569
570
  //#endregion
570
- //#region src/commands/edit-env-file/editVariable.ts
571
+ //#region src/cli/commands/edit-env-file/editVariable.ts
571
572
  async function editVariable(envFileContents, variableToEdit, file) {
572
573
  const newValue = await (0, _inquirer_prompts.password)({ message: `Please enter new value for \`${String(variableToEdit)}\`` });
573
574
  await upsertDotenvFile({
@@ -586,7 +587,7 @@ function redact(secretString) {
586
587
  }
587
588
 
588
589
  //#endregion
589
- //#region src/commands/edit-env-file/changeExistingVariable.ts
590
+ //#region src/cli/commands/edit-env-file/changeExistingVariable.ts
590
591
  async function changeExistingVariable(envFileContents, variableToEdit, file) {
591
592
  switch (await (0, _inquirer_prompts.select)({
592
593
  message: _alextheman_utility.normaliseIndents`
@@ -624,7 +625,7 @@ async function parseDotenvFile(envFilePath) {
624
625
  }
625
626
 
626
627
  //#endregion
627
- //#region src/commands/edit-env-file/index.ts
628
+ //#region src/cli/commands/edit-env-file/index.ts
628
629
  function editEnvFile(program) {
629
630
  program.command("edit-env-file").description("Edit properties in a .env file").option("--interactive", "Enable interactive mode", true).option("--file <filePath>", "The path to the .env file you want to edit, relative to the working directory this command is run", ".env").action(async ({ interactive, file }) => {
630
631
  if (interactive) {
@@ -671,7 +672,7 @@ function editEnvFile(program) {
671
672
  }
672
673
 
673
674
  //#endregion
674
- //#region src/commands/encrypt-with-key.ts
675
+ //#region src/cli/commands/encrypt-with-key.ts
675
676
  function encryptWithKey(program) {
676
677
  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) => {
677
678
  try {
@@ -686,7 +687,7 @@ function encryptWithKey(program) {
686
687
  }
687
688
 
688
689
  //#endregion
689
- //#region src/commands/git-post-merge-cleanup.ts
690
+ //#region src/cli/commands/git-post-merge-cleanup.ts
690
691
  function gitPostMergeCleanup(program) {
691
692
  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 }) => {
692
693
  let alexCLineConfigJSON;
@@ -735,7 +736,7 @@ function gitPostMergeCleanup(program) {
735
736
  }
736
737
 
737
738
  //#endregion
738
- //#region src/commands/pre-commit/createStepRunner.ts
739
+ //#region src/cli/commands/pre-commit/createStepRunner.ts
739
740
  const runCommandAndLogToConsole = (0, execa.execa)({
740
741
  stdio: "inherit",
741
742
  reject: false
@@ -771,7 +772,7 @@ function createStepRunner(program) {
771
772
  }
772
773
 
773
774
  //#endregion
774
- //#region src/commands/pre-commit/getCommandArguments.ts
775
+ //#region src/cli/commands/pre-commit/getCommandArguments.ts
775
776
  function getCommandArguments(program, script, scripts, args) {
776
777
  if (!(script in (scripts ?? {}))) program.error(`Could not find script \`${script}\` in package.json.`, {
777
778
  exitCode: 1,
@@ -875,7 +876,7 @@ async function loadAlexCLineConfig(filePath) {
875
876
  }
876
877
 
877
878
  //#endregion
878
- //#region src/commands/pre-commit/pre-commit-2.ts
879
+ //#region src/cli/commands/pre-commit/pre-commit-2.ts
879
880
  function preCommit2(program) {
880
881
  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").option("--no-update-index").option("--update-index", "Update the git index after the run").action(async (options) => {
881
882
  const configPath = await findAlexCLineConfig(process.cwd());
@@ -915,7 +916,7 @@ function preCommit2(program) {
915
916
  }
916
917
 
917
918
  //#endregion
918
- //#region src/commands/say-hello.ts
919
+ //#region src/cli/commands/say-hello.ts
919
920
  function sayHello(program) {
920
921
  program.command("say-hello").description("Quick test command").action(() => {
921
922
  console.info("Hello!");
@@ -1007,7 +1008,7 @@ async function getPullRequestTemplatesFromMarkdown(config) {
1007
1008
  }
1008
1009
 
1009
1010
  //#endregion
1010
- //#region src/commands/template/pullRequest/create-pull-request-template-2.ts
1011
+ //#region src/cli/commands/template/pullRequest/create-pull-request-template-2.ts
1011
1012
  function createPullRequestTemplate(program) {
1012
1013
  program.command("create-pull-request-template").alias("create-pull-request-template-2").option("--category <category>", "The category of pull request templates to get (can be either `general` or `infrastructure`)", (rawValue) => {
1013
1014
  return (0, _alextheman_utility.parseZodSchema)(zod.default.enum(PullRequestTemplateCategory), rawValue, () => {
@@ -1119,7 +1120,7 @@ async function validateReleaseDocument(projectName, version, content, allowedRel
1119
1120
  }
1120
1121
 
1121
1122
  //#endregion
1122
- //#region src/commands/template/releaseNote/check-release-note.ts
1123
+ //#region src/cli/commands/template/releaseNote/check-release-note.ts
1123
1124
  function checkReleaseNote(program) {
1124
1125
  program.command("check-release-note").argument("<documentPath>", "The path to the document", _alextheman_utility_node.parseFilePath).option("--expected-release-status <expectedReleaseStatus>", "The expected release status of the document once we read it in.", parseReleaseStatus).description("Check whether a given release note is valid according to the templates or not. Returns exit code 0 for valid release note and non-zero otherwise.").action(async (documentPath, { expectedReleaseStatus }) => {
1125
1126
  const fileContents = await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), documentPath.fullPath), "utf-8");
@@ -1169,7 +1170,7 @@ async function getReleaseNoteTemplateFromMarkdown(projectName, version, metadata
1169
1170
  }
1170
1171
 
1171
1172
  //#endregion
1172
- //#region src/commands/template/releaseNote/create-release-note-2.ts
1173
+ //#region src/cli/commands/template/releaseNote/create-release-note-2.ts
1173
1174
  function createReleaseNote2(program) {
1174
1175
  program.command("create-release-note-2").argument("[createFor]", _alextheman_utility.normaliseIndents`
1175
1176
  Decide what version to create a release note for exactly:
@@ -1211,7 +1212,7 @@ function createReleaseNote2(program) {
1211
1212
  }
1212
1213
 
1213
1214
  //#endregion
1214
- //#region src/commands/template/releaseNote/migrate-release-notes.ts
1215
+ //#region src/cli/commands/template/releaseNote/migrate-release-notes.ts
1215
1216
  function migrateReleaseNotes(program) {
1216
1217
  program.command("migrate-release-notes").description(_alextheman_utility.normaliseIndents`
1217
1218
  Migrate the docs/releases folder generated from \`create-release-note\` to be more compatible with v2.
@@ -1267,7 +1268,7 @@ function migrateReleaseNotes(program) {
1267
1268
  }
1268
1269
 
1269
1270
  //#endregion
1270
- //#region src/commands/template/releaseNote/set-release-status-2.ts
1271
+ //#region src/cli/commands/template/releaseNote/set-release-status-2.ts
1271
1272
  function setReleaseStatus2(program) {
1272
1273
  program.command("set-release-status-2").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").argument("[status]", "The status to set the document to", parseReleaseStatus, ReleaseStatus.RELEASED).action(async (documentPath, status) => {
1273
1274
  const packageInfo = JSON.parse(await (0, node_fs_promises.readFile)(node_path.default.join(process.cwd(), "package.json"), "utf-8"));
@@ -1315,7 +1316,7 @@ function parseZodSchemaForProgram(programError, schema, data) {
1315
1316
  //#endregion
1316
1317
  //#region package.json
1317
1318
  var name = "alex-c-line";
1318
- var version = "1.30.2";
1319
+ var version = "1.31.0";
1319
1320
  var description = "Command-line tool with commands to streamline the developer workflow.";
1320
1321
 
1321
1322
  //#endregion
@@ -1351,7 +1352,7 @@ async function checkUpdate(options) {
1351
1352
  }
1352
1353
 
1353
1354
  //#endregion
1354
- //#region src/commands/update.ts
1355
+ //#region src/cli/commands/update.ts
1355
1356
  const optionsSchema = zod.default.object({ check: zod.default.boolean().optional() });
1356
1357
  function update(program) {
1357
1358
  program.command("update").description("Handle updates of the currently installed alex-c-line").option("--check", "Check for available updates").option("--apply", "Apply the latest update").action(async (rawOptions) => {
@@ -1450,7 +1451,7 @@ async function removeAllTarballs(packagePath, packageName) {
1450
1451
  }
1451
1452
 
1452
1453
  //#endregion
1453
- //#region src/commands/use-local-package.ts
1454
+ //#region src/cli/commands/use-local-package.ts
1454
1455
  function useLocalPackage(program) {
1455
1456
  program.command("use-local-package").description(_alextheman_utility.normaliseIndents`
1456
1457
  ${experimentalHeader}
@@ -1553,7 +1554,27 @@ function useLocalPackage(program) {
1553
1554
  }
1554
1555
 
1555
1556
  //#endregion
1556
- //#region src/commands/versioning/get-major-version.ts
1557
+ //#region src/cli/commands/uuid/generate.ts
1558
+ function generateUUID(program) {
1559
+ program.command("generate").description("Generate a random UUID").action(() => {
1560
+ console.info((0, node_crypto.randomUUID)());
1561
+ });
1562
+ }
1563
+
1564
+ //#endregion
1565
+ //#region src/utility/miscellaneous/loadCommands.ts
1566
+ function loadCommands(program, commandMap) {
1567
+ for (const loader of Object.values(commandMap)) loader(program);
1568
+ }
1569
+
1570
+ //#endregion
1571
+ //#region src/cli/commands/uuid/index.ts
1572
+ function uuid(program) {
1573
+ loadCommands(program.command("uuid").description("Commands to help manage UUIDs"), { generateUUID });
1574
+ }
1575
+
1576
+ //#endregion
1577
+ //#region src/cli/commands/versioning/get-major-version.ts
1557
1578
  function getMajorVersion(program) {
1558
1579
  program.command("get-major-version").description("Get the major representation of a version number (e.g. v2, v3 etc...)").argument("<version>", "The version to get the major representation of", (rawValue) => {
1559
1580
  return new _alextheman_utility.VersionNumber(rawValue);
@@ -1563,7 +1584,7 @@ function getMajorVersion(program) {
1563
1584
  }
1564
1585
 
1565
1586
  //#endregion
1566
- //#region src/commands/versioning/get-minor-version.ts
1587
+ //#region src/cli/commands/versioning/get-minor-version.ts
1567
1588
  function getMinorVersion(program) {
1568
1589
  program.command("get-minor-version").description("Get the minor representation of a version number (e.g. v2.1, v3.1 etc...)").argument("<version>", "The version to get the minor representation of", (rawValue) => {
1569
1590
  return new _alextheman_utility.VersionNumber(rawValue);
@@ -1573,7 +1594,7 @@ function getMinorVersion(program) {
1573
1594
  }
1574
1595
 
1575
1596
  //#endregion
1576
- //#region src/commands/versioning/get-version-type.ts
1597
+ //#region src/cli/commands/versioning/get-version-type.ts
1577
1598
  function getVersionType(program) {
1578
1599
  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) => {
1579
1600
  return new _alextheman_utility.VersionNumber(rawVersion);
@@ -1583,7 +1604,7 @@ function getVersionType(program) {
1583
1604
  }
1584
1605
 
1585
1606
  //#endregion
1586
- //#region src/commands/versioning/increment-version.ts
1607
+ //#region src/cli/commands/versioning/increment-version.ts
1587
1608
  function incrementVersion(program) {
1588
1609
  program.command("increment-version").description("Increments the given input version depending on the given increment type.").argument("<version>", "The version to increment", (rawVersion) => {
1589
1610
  return new _alextheman_utility.VersionNumber(rawVersion);
@@ -1599,13 +1620,7 @@ function incrementVersion(program) {
1599
1620
  }
1600
1621
 
1601
1622
  //#endregion
1602
- //#region src/utility/miscellaneous/loadCommands.ts
1603
- function loadCommands(program, commandMap) {
1604
- for (const loader of Object.values(commandMap)) loader(program);
1605
- }
1606
-
1607
- //#endregion
1608
- //#region src/commands/index.ts
1623
+ //#region src/cli/commands/index.ts
1609
1624
  function createCommands(program) {
1610
1625
  loadCommands(program, {
1611
1626
  artwork,
@@ -1633,7 +1648,8 @@ function createCommands(program) {
1633
1648
  setReleaseStatus,
1634
1649
  setReleaseStatus2,
1635
1650
  update,
1636
- useLocalPackage
1651
+ useLocalPackage,
1652
+ uuid
1637
1653
  });
1638
1654
  }
1639
1655
 
@@ -1709,7 +1725,7 @@ async function runAutomatedUpdateCheck() {
1709
1725
  }
1710
1726
 
1711
1727
  //#endregion
1712
- //#region src/index.ts
1728
+ //#region src/cli/index.ts
1713
1729
  (async () => {
1714
1730
  try {
1715
1731
  const program = new commander.Command();
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ import { fileURLToPath, pathToFileURL } from "node:url";
20
20
  import matter from "gray-matter";
21
21
  import { parseFilePath } from "@alextheman/utility/node";
22
22
  import supportsColor from "supports-color";
23
+ import { randomUUID } from "node:crypto";
23
24
 
24
25
  //#region src/utility/miscellaneous/asciiToPng.ts
25
26
  async function asciiToPng(ascii, options) {
@@ -84,7 +85,7 @@ async function createAlexCLineArtwork(options) {
84
85
  }
85
86
 
86
87
  //#endregion
87
- //#region src/commands/artwork.ts
88
+ //#region src/cli/commands/artwork.ts
88
89
  function artwork(program) {
89
90
  program.command("artwork").description("Create the artwork for alex-c-line").option("--subtitle-text <subtitleText>", "Customise the subtitle text").option("--subtitle-color <subtitleColor>", "Customise the subtitle color").option("--save-png [fileName]", "Save the artwork as a PNG file, optionally specifying the path").action(async ({ savePng: fileName, subtitleText, subtitleColor = "green" }) => {
90
91
  if (subtitleColor !== "green" && subtitleColor !== "white") throw new DataError({ subtitleColor }, "INVALID_SUBTITLE_COLOR", "Subtitle color must either be green or white.");
@@ -118,7 +119,7 @@ const { cache: ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY } = alexCLineEnvPaths;
118
119
  const ALEX_C_LINE_GLOBAL_CACHE_PATH = path.join(ALEX_C_LINE_GLOBAL_CACHE_DIRECTORY, "cache.json");
119
120
 
120
121
  //#endregion
121
- //#region src/commands/cache-path.ts
122
+ //#region src/cli/commands/cache-path.ts
122
123
  function cachePath(program) {
123
124
  program.command("cache-path").description("Log the path to the alex-c-line cache files.").action(() => {
124
125
  console.info(ALEX_C_LINE_GLOBAL_CACHE_PATH);
@@ -126,7 +127,7 @@ function cachePath(program) {
126
127
  }
127
128
 
128
129
  //#endregion
129
- //#region src/commands/check-for-file-dependencies.ts
130
+ //#region src/cli/commands/check-for-file-dependencies.ts
130
131
  function findFileDependencies(dependencies) {
131
132
  const fileDependencies = {};
132
133
  if (!dependencies) return {};
@@ -155,7 +156,7 @@ function checkForFileDependencies(program) {
155
156
  }
156
157
 
157
158
  //#endregion
158
- //#region src/commands/check-lockfile-version-discrepancy.ts
159
+ //#region src/cli/commands/check-lockfile-version-discrepancy.ts
159
160
  function checkLockfileVersionDiscrepancy(program) {
160
161
  program.command("check-lockfile-version-discrepancy").description("Check that version numbers in package.json and package-lock.json match").action(async () => {
161
162
  console.info("Checking for package.json and package-lock.json discrepancies...");
@@ -171,7 +172,7 @@ function checkLockfileVersionDiscrepancy(program) {
171
172
  }
172
173
 
173
174
  //#endregion
174
- //#region src/commands/deprecated/check-version-number-change.ts
175
+ //#region src/cli/commands/deprecated/check-version-number-change.ts
175
176
  function checkVersionNumberChange(program) {
176
177
  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 () => {
177
178
  console.info("Checking for version change...");
@@ -267,7 +268,7 @@ function getPullRequestTemplates(packageName) {
267
268
  }
268
269
 
269
270
  //#endregion
270
- //#region src/commands/deprecated/create-pull-request-templates.ts
271
+ //#region src/cli/commands/deprecated/create-pull-request-templates.ts
271
272
  const deprecationMessage$2 = "[DEPRECATED]: This command does not support the new markdown-native templates and alex-c-line config system. Please use `pre-commit-2` instead.";
272
273
  function createPullRequestTemplates(program) {
273
274
  program.command("create-pull-request-templates").description(normaliseIndents`
@@ -363,7 +364,7 @@ function getReleaseNoteTemplate(packageName, version, status = "In progress", co
363
364
  }
364
365
 
365
366
  //#endregion
366
- //#region src/commands/deprecated/create-release-note.ts
367
+ //#region src/cli/commands/deprecated/create-release-note.ts
367
368
  function createReleaseNote(program) {
368
369
  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) => {
369
370
  const { name, version } = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
@@ -386,7 +387,7 @@ function createReleaseNote(program) {
386
387
  }
387
388
 
388
389
  //#endregion
389
- //#region src/commands/deprecated/edit-env.ts
390
+ //#region src/cli/commands/deprecated/edit-env.ts
390
391
  const deprecationMessage$1 = "[DEPRECATED]: Please use `edit-env-2` instead.";
391
392
  function editEnv(program) {
392
393
  program.command("edit-env <key> [value]").description(normaliseIndents`
@@ -409,7 +410,7 @@ function editEnv(program) {
409
410
  }
410
411
 
411
412
  //#endregion
412
- //#region src/commands/deprecated/pre-commit.ts
413
+ //#region src/cli/commands/deprecated/pre-commit.ts
413
414
  const deprecationMessage = "[DEPRECATED]: This command does not support the new alex-c-line config system. Please use `pre-commit-2` instead.";
414
415
  function preCommit(program) {
415
416
  program.command("pre-commit").description(normaliseIndents`
@@ -458,7 +459,7 @@ function isValidReleaseDocument(packageName, version, initialDocument) {
458
459
  }
459
460
 
460
461
  //#endregion
461
- //#region src/commands/deprecated/set-release-status.ts
462
+ //#region src/cli/commands/deprecated/set-release-status.ts
462
463
  function setReleaseStatus(program) {
463
464
  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) => {
464
465
  const { name: packageName } = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
@@ -492,7 +493,7 @@ async function upsertDotenvFile(contents, envFilePath) {
492
493
  }
493
494
 
494
495
  //#endregion
495
- //#region src/commands/edit-env-file/addVariable.ts
496
+ //#region src/cli/commands/edit-env-file/addVariable.ts
496
497
  async function addVariable(program, envFileContents, file) {
497
498
  const newVariableName = await input({ message: "Please enter the name of the environment variable you would like to add." });
498
499
  if (newVariableName in envFileContents) program.error(`
@@ -518,7 +519,7 @@ async function addVariable(program, envFileContents, file) {
518
519
  }
519
520
 
520
521
  //#endregion
521
- //#region src/commands/edit-env-file/deleteVariable.ts
522
+ //#region src/cli/commands/edit-env-file/deleteVariable.ts
522
523
  async function deleteVariable(envFileContents, variableToEdit, file) {
523
524
  if (!await confirm({ message: `Are you sure you want to delete \`${String(variableToEdit)}\`?` })) {
524
525
  console.info("Deletion aborted");
@@ -529,7 +530,7 @@ async function deleteVariable(envFileContents, variableToEdit, file) {
529
530
  }
530
531
 
531
532
  //#endregion
532
- //#region src/commands/edit-env-file/editVariable.ts
533
+ //#region src/cli/commands/edit-env-file/editVariable.ts
533
534
  async function editVariable(envFileContents, variableToEdit, file) {
534
535
  const newValue = await password({ message: `Please enter new value for \`${String(variableToEdit)}\`` });
535
536
  await upsertDotenvFile({
@@ -548,7 +549,7 @@ function redact(secretString) {
548
549
  }
549
550
 
550
551
  //#endregion
551
- //#region src/commands/edit-env-file/changeExistingVariable.ts
552
+ //#region src/cli/commands/edit-env-file/changeExistingVariable.ts
552
553
  async function changeExistingVariable(envFileContents, variableToEdit, file) {
553
554
  switch (await select({
554
555
  message: normaliseIndents`
@@ -586,7 +587,7 @@ async function parseDotenvFile(envFilePath) {
586
587
  }
587
588
 
588
589
  //#endregion
589
- //#region src/commands/edit-env-file/index.ts
590
+ //#region src/cli/commands/edit-env-file/index.ts
590
591
  function editEnvFile(program) {
591
592
  program.command("edit-env-file").description("Edit properties in a .env file").option("--interactive", "Enable interactive mode", true).option("--file <filePath>", "The path to the .env file you want to edit, relative to the working directory this command is run", ".env").action(async ({ interactive, file }) => {
592
593
  if (interactive) {
@@ -633,7 +634,7 @@ function editEnvFile(program) {
633
634
  }
634
635
 
635
636
  //#endregion
636
- //#region src/commands/encrypt-with-key.ts
637
+ //#region src/cli/commands/encrypt-with-key.ts
637
638
  function encryptWithKey$1(program) {
638
639
  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) => {
639
640
  try {
@@ -648,7 +649,7 @@ function encryptWithKey$1(program) {
648
649
  }
649
650
 
650
651
  //#endregion
651
- //#region src/commands/git-post-merge-cleanup.ts
652
+ //#region src/cli/commands/git-post-merge-cleanup.ts
652
653
  function gitPostMergeCleanup(program) {
653
654
  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 }) => {
654
655
  let alexCLineConfigJSON;
@@ -697,7 +698,7 @@ function gitPostMergeCleanup(program) {
697
698
  }
698
699
 
699
700
  //#endregion
700
- //#region src/commands/pre-commit/createStepRunner.ts
701
+ //#region src/cli/commands/pre-commit/createStepRunner.ts
701
702
  const runCommandAndLogToConsole = execa({
702
703
  stdio: "inherit",
703
704
  reject: false
@@ -733,7 +734,7 @@ function createStepRunner(program) {
733
734
  }
734
735
 
735
736
  //#endregion
736
- //#region src/commands/pre-commit/getCommandArguments.ts
737
+ //#region src/cli/commands/pre-commit/getCommandArguments.ts
737
738
  function getCommandArguments(program, script, scripts, args) {
738
739
  if (!(script in (scripts ?? {}))) program.error(`Could not find script \`${script}\` in package.json.`, {
739
740
  exitCode: 1,
@@ -837,7 +838,7 @@ async function loadAlexCLineConfig(filePath) {
837
838
  }
838
839
 
839
840
  //#endregion
840
- //#region src/commands/pre-commit/pre-commit-2.ts
841
+ //#region src/cli/commands/pre-commit/pre-commit-2.ts
841
842
  function preCommit2(program) {
842
843
  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").option("--no-update-index").option("--update-index", "Update the git index after the run").action(async (options) => {
843
844
  const configPath = await findAlexCLineConfig(process.cwd());
@@ -877,7 +878,7 @@ function preCommit2(program) {
877
878
  }
878
879
 
879
880
  //#endregion
880
- //#region src/commands/say-hello.ts
881
+ //#region src/cli/commands/say-hello.ts
881
882
  function sayHello(program) {
882
883
  program.command("say-hello").description("Quick test command").action(() => {
883
884
  console.info("Hello!");
@@ -969,7 +970,7 @@ async function getPullRequestTemplatesFromMarkdown(config) {
969
970
  }
970
971
 
971
972
  //#endregion
972
- //#region src/commands/template/pullRequest/create-pull-request-template-2.ts
973
+ //#region src/cli/commands/template/pullRequest/create-pull-request-template-2.ts
973
974
  function createPullRequestTemplate(program) {
974
975
  program.command("create-pull-request-template").alias("create-pull-request-template-2").option("--category <category>", "The category of pull request templates to get (can be either `general` or `infrastructure`)", (rawValue) => {
975
976
  return parseZodSchema(z.enum(PullRequestTemplateCategory), rawValue, () => {
@@ -1081,7 +1082,7 @@ async function validateReleaseDocument(projectName, version, content, allowedRel
1081
1082
  }
1082
1083
 
1083
1084
  //#endregion
1084
- //#region src/commands/template/releaseNote/check-release-note.ts
1085
+ //#region src/cli/commands/template/releaseNote/check-release-note.ts
1085
1086
  function checkReleaseNote(program) {
1086
1087
  program.command("check-release-note").argument("<documentPath>", "The path to the document", parseFilePath).option("--expected-release-status <expectedReleaseStatus>", "The expected release status of the document once we read it in.", parseReleaseStatus).description("Check whether a given release note is valid according to the templates or not. Returns exit code 0 for valid release note and non-zero otherwise.").action(async (documentPath, { expectedReleaseStatus }) => {
1087
1088
  const fileContents = await readFile(path.join(process.cwd(), documentPath.fullPath), "utf-8");
@@ -1131,7 +1132,7 @@ async function getReleaseNoteTemplateFromMarkdown(projectName, version, metadata
1131
1132
  }
1132
1133
 
1133
1134
  //#endregion
1134
- //#region src/commands/template/releaseNote/create-release-note-2.ts
1135
+ //#region src/cli/commands/template/releaseNote/create-release-note-2.ts
1135
1136
  function createReleaseNote2(program) {
1136
1137
  program.command("create-release-note-2").argument("[createFor]", normaliseIndents`
1137
1138
  Decide what version to create a release note for exactly:
@@ -1173,7 +1174,7 @@ function createReleaseNote2(program) {
1173
1174
  }
1174
1175
 
1175
1176
  //#endregion
1176
- //#region src/commands/template/releaseNote/migrate-release-notes.ts
1177
+ //#region src/cli/commands/template/releaseNote/migrate-release-notes.ts
1177
1178
  function migrateReleaseNotes(program) {
1178
1179
  program.command("migrate-release-notes").description(normaliseIndents`
1179
1180
  Migrate the docs/releases folder generated from \`create-release-note\` to be more compatible with v2.
@@ -1229,7 +1230,7 @@ function migrateReleaseNotes(program) {
1229
1230
  }
1230
1231
 
1231
1232
  //#endregion
1232
- //#region src/commands/template/releaseNote/set-release-status-2.ts
1233
+ //#region src/cli/commands/template/releaseNote/set-release-status-2.ts
1233
1234
  function setReleaseStatus2(program) {
1234
1235
  program.command("set-release-status-2").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").argument("[status]", "The status to set the document to", parseReleaseStatus, ReleaseStatus.RELEASED).action(async (documentPath, status) => {
1235
1236
  const packageInfo = JSON.parse(await readFile(path.join(process.cwd(), "package.json"), "utf-8"));
@@ -1277,7 +1278,7 @@ function parseZodSchemaForProgram(programError, schema, data) {
1277
1278
  //#endregion
1278
1279
  //#region package.json
1279
1280
  var name = "alex-c-line";
1280
- var version = "1.30.2";
1281
+ var version = "1.31.0";
1281
1282
  var description = "Command-line tool with commands to streamline the developer workflow.";
1282
1283
 
1283
1284
  //#endregion
@@ -1313,7 +1314,7 @@ async function checkUpdate(options) {
1313
1314
  }
1314
1315
 
1315
1316
  //#endregion
1316
- //#region src/commands/update.ts
1317
+ //#region src/cli/commands/update.ts
1317
1318
  const optionsSchema = z.object({ check: z.boolean().optional() });
1318
1319
  function update(program) {
1319
1320
  program.command("update").description("Handle updates of the currently installed alex-c-line").option("--check", "Check for available updates").option("--apply", "Apply the latest update").action(async (rawOptions) => {
@@ -1412,7 +1413,7 @@ async function removeAllTarballs(packagePath, packageName) {
1412
1413
  }
1413
1414
 
1414
1415
  //#endregion
1415
- //#region src/commands/use-local-package.ts
1416
+ //#region src/cli/commands/use-local-package.ts
1416
1417
  function useLocalPackage(program) {
1417
1418
  program.command("use-local-package").description(normaliseIndents`
1418
1419
  ${experimentalHeader}
@@ -1515,7 +1516,27 @@ function useLocalPackage(program) {
1515
1516
  }
1516
1517
 
1517
1518
  //#endregion
1518
- //#region src/commands/versioning/get-major-version.ts
1519
+ //#region src/cli/commands/uuid/generate.ts
1520
+ function generateUUID(program) {
1521
+ program.command("generate").description("Generate a random UUID").action(() => {
1522
+ console.info(randomUUID());
1523
+ });
1524
+ }
1525
+
1526
+ //#endregion
1527
+ //#region src/utility/miscellaneous/loadCommands.ts
1528
+ function loadCommands(program, commandMap) {
1529
+ for (const loader of Object.values(commandMap)) loader(program);
1530
+ }
1531
+
1532
+ //#endregion
1533
+ //#region src/cli/commands/uuid/index.ts
1534
+ function uuid(program) {
1535
+ loadCommands(program.command("uuid").description("Commands to help manage UUIDs"), { generateUUID });
1536
+ }
1537
+
1538
+ //#endregion
1539
+ //#region src/cli/commands/versioning/get-major-version.ts
1519
1540
  function getMajorVersion(program) {
1520
1541
  program.command("get-major-version").description("Get the major representation of a version number (e.g. v2, v3 etc...)").argument("<version>", "The version to get the major representation of", (rawValue) => {
1521
1542
  return new VersionNumber(rawValue);
@@ -1525,7 +1546,7 @@ function getMajorVersion(program) {
1525
1546
  }
1526
1547
 
1527
1548
  //#endregion
1528
- //#region src/commands/versioning/get-minor-version.ts
1549
+ //#region src/cli/commands/versioning/get-minor-version.ts
1529
1550
  function getMinorVersion(program) {
1530
1551
  program.command("get-minor-version").description("Get the minor representation of a version number (e.g. v2.1, v3.1 etc...)").argument("<version>", "The version to get the minor representation of", (rawValue) => {
1531
1552
  return new VersionNumber(rawValue);
@@ -1535,7 +1556,7 @@ function getMinorVersion(program) {
1535
1556
  }
1536
1557
 
1537
1558
  //#endregion
1538
- //#region src/commands/versioning/get-version-type.ts
1559
+ //#region src/cli/commands/versioning/get-version-type.ts
1539
1560
  function getVersionType(program) {
1540
1561
  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) => {
1541
1562
  return new VersionNumber(rawVersion);
@@ -1545,7 +1566,7 @@ function getVersionType(program) {
1545
1566
  }
1546
1567
 
1547
1568
  //#endregion
1548
- //#region src/commands/versioning/increment-version.ts
1569
+ //#region src/cli/commands/versioning/increment-version.ts
1549
1570
  function incrementVersion(program) {
1550
1571
  program.command("increment-version").description("Increments the given input version depending on the given increment type.").argument("<version>", "The version to increment", (rawVersion) => {
1551
1572
  return new VersionNumber(rawVersion);
@@ -1561,13 +1582,7 @@ function incrementVersion(program) {
1561
1582
  }
1562
1583
 
1563
1584
  //#endregion
1564
- //#region src/utility/miscellaneous/loadCommands.ts
1565
- function loadCommands(program, commandMap) {
1566
- for (const loader of Object.values(commandMap)) loader(program);
1567
- }
1568
-
1569
- //#endregion
1570
- //#region src/commands/index.ts
1585
+ //#region src/cli/commands/index.ts
1571
1586
  function createCommands(program) {
1572
1587
  loadCommands(program, {
1573
1588
  artwork,
@@ -1595,7 +1610,8 @@ function createCommands(program) {
1595
1610
  setReleaseStatus,
1596
1611
  setReleaseStatus2,
1597
1612
  update,
1598
- useLocalPackage
1613
+ useLocalPackage,
1614
+ uuid
1599
1615
  });
1600
1616
  }
1601
1617
 
@@ -1671,7 +1687,7 @@ async function runAutomatedUpdateCheck() {
1671
1687
  }
1672
1688
 
1673
1689
  //#endregion
1674
- //#region src/index.ts
1690
+ //#region src/cli/index.ts
1675
1691
  (async () => {
1676
1692
  try {
1677
1693
  const program = new Command();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alex-c-line",
3
- "version": "1.30.2",
3
+ "version": "1.31.0",
4
4
  "description": "Command-line tool with commands to streamline the developer workflow.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,7 +34,7 @@
34
34
  "templates"
35
35
  ],
36
36
  "dependencies": {
37
- "@alextheman/utility": "^5.3.0",
37
+ "@alextheman/utility": "^5.4.1",
38
38
  "@inquirer/prompts": "^8.2.1",
39
39
  "boxen": "^8.0.1",
40
40
  "canvas": "^3.2.1",