@optique/discover 1.4.0-dev.2678 → 1.4.0-dev.2679

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/cli.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  const require_chunk = require('./chunk-CUT6urMc.cjs');
3
3
  require('./command-CfkGTUEa.cjs');
4
- require('./src-B6mG1y_9.cjs');
5
- const require_generator = require('./generator-w9f9yABr.cjs');
4
+ require('./src-BRYaiQ7Y.cjs');
5
+ const require_generator = require('./generator-DwyzKqEQ.cjs');
6
6
  const require_main_check = require('./main-check-CwunSNpK.cjs');
7
7
  const __optique_core_constructs = require_chunk.__toESM(require("@optique/core/constructs"));
8
8
  const __optique_core_message = require_chunk.__toESM(require("@optique/core/message"));
@@ -15,7 +15,7 @@ const node_process = require_chunk.__toESM(require("node:process"));
15
15
 
16
16
  //#region deno.json
17
17
  var name = "@optique/discover";
18
- var version = "1.4.0-dev.2678+a475f32a";
18
+ var version = "1.4.0-dev.2679+3a3a57d2";
19
19
  var license = "MIT";
20
20
  var exports$1 = {
21
21
  ".": "./src/index.ts",
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import "./command-CfQmeg9P.js";
3
- import "./src-CKOT5gax.js";
4
- import { watchCommandsModule, writeCommandsModule } from "./generator-65GYfm_3.js";
3
+ import "./src-BxewopIn.js";
4
+ import { watchCommandsModule, writeCommandsModule } from "./generator-DPHYAQ4c.js";
5
5
  import { isMainModuleUrl } from "./main-check-mMnKfUZs.js";
6
6
  import { object } from "@optique/core/constructs";
7
7
  import { message } from "@optique/core/message";
@@ -14,7 +14,7 @@ import process from "node:process";
14
14
 
15
15
  //#region deno.json
16
16
  var name = "@optique/discover";
17
- var version = "1.4.0-dev.2678+a475f32a";
17
+ var version = "1.4.0-dev.2679+3a3a57d2";
18
18
  var license = "MIT";
19
19
  var exports = {
20
20
  ".": "./src/index.ts",
@@ -1,4 +1,4 @@
1
- import { getDefaultExtensions } from "./src-CKOT5gax.js";
1
+ import { getDefaultExtensions } from "./src-BxewopIn.js";
2
2
  import { mkdir, readdir, realpath, stat, writeFile } from "node:fs/promises";
3
3
  import { dirname, posix, relative, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-CUT6urMc.cjs');
2
- const require_src = require('./src-B6mG1y_9.cjs');
2
+ const require_src = require('./src-BRYaiQ7Y.cjs');
3
3
  const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
4
4
  const node_path = require_chunk.__toESM(require("node:path"));
5
5
  const node_url = require_chunk.__toESM(require("node:url"));
@@ -1,6 +1,6 @@
1
1
  require('./command-CfkGTUEa.cjs');
2
- require('./src-B6mG1y_9.cjs');
3
- const require_generator = require('./generator-w9f9yABr.cjs');
2
+ require('./src-BRYaiQ7Y.cjs');
3
+ const require_generator = require('./generator-DwyzKqEQ.cjs');
4
4
 
5
5
  exports.generateCommandsModule = require_generator.generateCommandsModule;
6
6
  exports.watchCommandsModule = require_generator.watchCommandsModule;
package/dist/generator.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./command-CfQmeg9P.js";
2
- import "./src-CKOT5gax.js";
3
- import { generateCommandsModule, watchCommandsModule, writeCommandsModule } from "./generator-65GYfm_3.js";
2
+ import "./src-BxewopIn.js";
3
+ import { generateCommandsModule, watchCommandsModule, writeCommandsModule } from "./generator-DPHYAQ4c.js";
4
4
 
5
5
  export { generateCommandsModule, watchCommandsModule, writeCommandsModule };
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  const require_command = require('./command-CfkGTUEa.cjs');
2
- const require_src = require('./src-B6mG1y_9.cjs');
2
+ const require_src = require('./src-BRYaiQ7Y.cjs');
3
3
 
4
4
  exports.commandsFromModules = require_src.commandsFromModules;
5
5
  exports.createProgramParser = require_src.createProgramParser;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { defineCommand, isCommand } from "./command-CfQmeg9P.js";
2
- import { commandsFromModules, createProgramParser, discoverCommands, getDefaultExtensions, runProgram } from "./src-CKOT5gax.js";
2
+ import { commandsFromModules, createProgramParser, discoverCommands, getDefaultExtensions, runProgram } from "./src-BxewopIn.js";
3
3
 
4
4
  export { commandsFromModules, createProgramParser, defineCommand, discoverCommands, getDefaultExtensions, isCommand, runProgram };
@@ -701,9 +701,10 @@ function withNamespaceListDocDescription(fragments, name, description) {
701
701
  }
702
702
  function namespaceCommandMetadata(metadata, inheritedHidden) {
703
703
  const hidden = (0, __optique_core_usage.mergeHidden)(inheritedHidden, metadata?.hidden);
704
- if (metadata?.aliases == null && metadata?.errors == null && hidden == null && metadata?.usageLine == null) return void 0;
704
+ if (metadata?.aliases == null && metadata?.showAliases == null && metadata?.errors == null && hidden == null && metadata?.usageLine == null) return void 0;
705
705
  return {
706
706
  ...metadata?.aliases != null && { aliases: metadata.aliases },
707
+ ...metadata?.showAliases != null && { showAliases: metadata.showAliases },
707
708
  ...metadata?.errors != null && { errors: metadata.errors },
708
709
  ...hidden != null && { hidden },
709
710
  ...metadata?.usageLine != null && { usageLine: metadata.usageLine }
@@ -744,14 +745,20 @@ function withRootDocs(parser, commands, metadata) {
744
745
  const fragments = [...root?.fragments ?? []];
745
746
  if (listedCommands.length > 0) fragments.push({
746
747
  type: "section",
747
- entries: listedCommands.map((entry) => ({
748
- term: {
749
- type: "command",
750
- name: entry.path.join(" "),
751
- hidden: commandPathHidden(entry.path, commandsByPath)
752
- },
753
- description: entry.command.metadata?.brief ?? entry.command.metadata?.description
754
- }))
748
+ entries: listedCommands.map((entry) => {
749
+ const aliases = qualifiedCommandAliases(entry.path, entry.command.metadata?.aliases);
750
+ const showAliases = entry.command.metadata?.showAliases;
751
+ return {
752
+ term: {
753
+ type: "command",
754
+ name: entry.path.join(" "),
755
+ ...aliases.length > 0 && { aliases },
756
+ hidden: commandPathHidden(entry.path, commandsByPath)
757
+ },
758
+ description: entry.command.metadata?.brief ?? entry.command.metadata?.description,
759
+ ...showAliases != null && { showAliases }
760
+ };
761
+ })
755
762
  });
756
763
  return {
757
764
  brief: metadata.brief,
@@ -792,9 +799,23 @@ function rootListedCommands(commands, commandsByPath, commandList) {
792
799
  }
793
800
  return [...topLevelEntries.values()];
794
801
  }
802
+ /**
803
+ * Spells each alias of the command at `path` as a full command path, since
804
+ * root command lists name commands by their full paths.
805
+ */
806
+ function qualifiedCommandAliases(path, aliases) {
807
+ if (aliases == null) return [];
808
+ const parent = path.slice(0, -1);
809
+ return aliases.map((alias) => [...parent, alias].join(" "));
810
+ }
811
+ /**
812
+ * Strips the documentation of a descendant command that stands in for a
813
+ * synthetic namespace, including its aliases, which belong to the
814
+ * descendant rather than the namespace.
815
+ */
795
816
  function withoutCommandDocs(commandDefinition) {
796
817
  if (commandDefinition.metadata == null) return commandDefinition;
797
- const { brief: _brief, description: _description,...metadata } = commandDefinition.metadata;
818
+ const { brief: _brief, description: _description, aliases: _aliases, showAliases: _showAliases,...metadata } = commandDefinition.metadata;
798
819
  return {
799
820
  ...commandDefinition,
800
821
  metadata
@@ -700,9 +700,10 @@ function withNamespaceListDocDescription(fragments, name, description) {
700
700
  }
701
701
  function namespaceCommandMetadata(metadata, inheritedHidden) {
702
702
  const hidden = mergeHidden(inheritedHidden, metadata?.hidden);
703
- if (metadata?.aliases == null && metadata?.errors == null && hidden == null && metadata?.usageLine == null) return void 0;
703
+ if (metadata?.aliases == null && metadata?.showAliases == null && metadata?.errors == null && hidden == null && metadata?.usageLine == null) return void 0;
704
704
  return {
705
705
  ...metadata?.aliases != null && { aliases: metadata.aliases },
706
+ ...metadata?.showAliases != null && { showAliases: metadata.showAliases },
706
707
  ...metadata?.errors != null && { errors: metadata.errors },
707
708
  ...hidden != null && { hidden },
708
709
  ...metadata?.usageLine != null && { usageLine: metadata.usageLine }
@@ -743,14 +744,20 @@ function withRootDocs(parser, commands, metadata) {
743
744
  const fragments = [...root?.fragments ?? []];
744
745
  if (listedCommands.length > 0) fragments.push({
745
746
  type: "section",
746
- entries: listedCommands.map((entry) => ({
747
- term: {
748
- type: "command",
749
- name: entry.path.join(" "),
750
- hidden: commandPathHidden(entry.path, commandsByPath)
751
- },
752
- description: entry.command.metadata?.brief ?? entry.command.metadata?.description
753
- }))
747
+ entries: listedCommands.map((entry) => {
748
+ const aliases = qualifiedCommandAliases(entry.path, entry.command.metadata?.aliases);
749
+ const showAliases = entry.command.metadata?.showAliases;
750
+ return {
751
+ term: {
752
+ type: "command",
753
+ name: entry.path.join(" "),
754
+ ...aliases.length > 0 && { aliases },
755
+ hidden: commandPathHidden(entry.path, commandsByPath)
756
+ },
757
+ description: entry.command.metadata?.brief ?? entry.command.metadata?.description,
758
+ ...showAliases != null && { showAliases }
759
+ };
760
+ })
754
761
  });
755
762
  return {
756
763
  brief: metadata.brief,
@@ -791,9 +798,23 @@ function rootListedCommands(commands, commandsByPath, commandList) {
791
798
  }
792
799
  return [...topLevelEntries.values()];
793
800
  }
801
+ /**
802
+ * Spells each alias of the command at `path` as a full command path, since
803
+ * root command lists name commands by their full paths.
804
+ */
805
+ function qualifiedCommandAliases(path, aliases) {
806
+ if (aliases == null) return [];
807
+ const parent = path.slice(0, -1);
808
+ return aliases.map((alias) => [...parent, alias].join(" "));
809
+ }
810
+ /**
811
+ * Strips the documentation of a descendant command that stands in for a
812
+ * synthetic namespace, including its aliases, which belong to the
813
+ * descendant rather than the namespace.
814
+ */
794
815
  function withoutCommandDocs(commandDefinition) {
795
816
  if (commandDefinition.metadata == null) return commandDefinition;
796
- const { brief: _brief, description: _description,...metadata } = commandDefinition.metadata;
817
+ const { brief: _brief, description: _description, aliases: _aliases, showAliases: _showAliases,...metadata } = commandDefinition.metadata;
797
818
  return {
798
819
  ...commandDefinition,
799
820
  metadata
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/discover",
3
- "version": "1.4.0-dev.2678",
3
+ "version": "1.4.0-dev.2679",
4
4
  "description": "Runtime-aware command discovery for Optique CLI programs",
5
5
  "keywords": [
6
6
  "CLI",
@@ -83,11 +83,11 @@
83
83
  "optique-discover": "./dist/cli.js"
84
84
  },
85
85
  "dependencies": {
86
- "@optique/core": "1.4.0-dev.2678+a475f32a",
87
- "@optique/run": "1.4.0-dev.2678+a475f32a"
86
+ "@optique/core": "1.4.0-dev.2679+3a3a57d2",
87
+ "@optique/run": "1.4.0-dev.2679+3a3a57d2"
88
88
  },
89
89
  "devDependencies": {
90
- "@optique/testing": "1.4.0-dev.2678+a475f32a",
90
+ "@optique/testing": "1.4.0-dev.2679+3a3a57d2",
91
91
  "@types/node": "^24.0.0",
92
92
  "tsdown": "^0.13.0",
93
93
  "typescript": "^5.8.3"