product-discovery-cli 0.0.3 → 0.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "product-discovery-cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "CLI to consume the Product Discovery Agent API",
5
5
  "license": "Apache-2.0",
6
6
  "author": "AuronForge",
@@ -2,13 +2,19 @@ const { Command } = require("commander");
2
2
  const { getTranslator } = require("../infrastructure/i18n");
3
3
 
4
4
  function buildOptions(defaultApiUrl) {
5
- const program = new Command();
6
- program.parse(process.argv);
7
- const preOpts = program.opts();
5
+ // First pass: get lang to determine i18n
6
+ const preProgram = new Command();
7
+ preProgram
8
+ .allowUnknownOption()
9
+ .option("-l, --lang <language>", "Language code (pt-br, en-us)", "pt-br");
10
+
11
+ preProgram.parse(process.argv);
12
+ const preOpts = preProgram.opts();
8
13
  const i18n = getTranslator(preOpts.lang || "pt-br");
9
14
 
10
- const programWithDesc = new Command();
11
- programWithDesc
15
+ // Second pass: full options with translations
16
+ const program = new Command();
17
+ program
12
18
  .name("product-discovery")
13
19
  .description(i18n.t("cliDescription"))
14
20
  .option("-u, --api-url <url>", i18n.t("optApiUrl"), defaultApiUrl)
@@ -19,8 +25,8 @@ function buildOptions(defaultApiUrl) {
19
25
  .option("-f, --file <name>", i18n.t("optFile"))
20
26
  .option("--no-save", i18n.t("optNoSave"));
21
27
 
22
- programWithDesc.parse(process.argv);
23
- return programWithDesc.opts();
28
+ program.parse(process.argv);
29
+ return program.opts();
24
30
  }
25
31
 
26
32
  module.exports = { buildOptions };
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const { CliController } = require("./presentation/CliController");
4
4
  const { PromptService } = require("./infrastructure/PromptService");