product-discovery-cli 0.0.12 → 0.0.14

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.12",
3
+ "version": "0.0.14",
4
4
  "description": "CLI to consume the Product Discovery Agent API",
5
5
  "license": "Apache-2.0",
6
6
  "author": "AuronForge",
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "boxen": "^5.1.2",
34
+ "cfonts": "^3.3.1",
34
35
  "chalk": "^4.1.2",
35
36
  "commander": "^11.1.0",
36
37
  "inquirer": "^8.2.6",
@@ -10,7 +10,7 @@ class RunDiscoveryFlow {
10
10
 
11
11
  async execute({ apiUrl, lang, saveDefaults, i18n }) {
12
12
  this.i18n = i18n;
13
- this.presenter.printHeader();
13
+ this.presenter.printHeader(apiUrl);
14
14
 
15
15
  let continueOuter = true;
16
16
 
package/src/index.js CHANGED
@@ -7,7 +7,7 @@ const { ProductDiscoveryApi } = require("./infrastructure/ProductDiscoveryApi");
7
7
  const { JsonFileStorage } = require("./infrastructure/JsonFileStorage");
8
8
  const { RunDiscoveryFlow } = require("./application/RunDiscoveryFlow");
9
9
 
10
- const DEFAULT_API_URL = process.env.API_URL || "http://localhost:3000/api/v1/discovery";
10
+ const DEFAULT_API_URL = process.env.API_URL || "http://localhost:3001/api/v1/discovery";
11
11
 
12
12
  const prompt = new PromptService();
13
13
  const presenter = new ConsolePresenter(null);
@@ -2,6 +2,7 @@ const { stdout: output } = require("node:process");
2
2
  const chalk = require("chalk");
3
3
  const boxen = require("boxen");
4
4
  const ora = require("ora");
5
+ const cfonts = require("cfonts");
5
6
  const pkg = require("../../package.json");
6
7
 
7
8
  class ConsolePresenter {
@@ -9,23 +10,36 @@ class ConsolePresenter {
9
10
  this.i18n = i18n;
10
11
  }
11
12
 
12
- printHeader() {
13
+ printHeader(apiUrl = null) {
13
14
  if (!this.i18n) return;
14
- const logo = chalk.cyan(
15
- String.raw`
16
- ____ _ _ ____ _
17
- | _ \ _ __ ___ __| |_ _ ___| |_ | _ \(_)___ ___ _____ _____ _ __
18
- | |_) | '__/ _ \ / _ | | | |/ __| __| | | | | / __|/ __/ _ \ \ / / _ \ '__|
19
- | __/| | | (_) | (_| | |_| | (__| |_ | |_| | \__ \ (_| (_) \ V / __/ |
20
- |_| |_| \___/ \__,_|\__,_|\___|\__| |____/|_|___/\___\___/ \_/ \___|_|
21
- `
22
- );
15
+ const logo = cfonts.render("product discovery", {
16
+ font: "chrome",
17
+ align: "left",
18
+ colors: ["cyan"],
19
+ background: "transparent",
20
+ letterSpacing: 1,
21
+ lineHeight: 1,
22
+ space: false,
23
+ maxLength: 0
24
+ }).string;
23
25
  const title = chalk.bold.cyan(this.i18n.t("headerTitle"));
24
26
  const subtitle = chalk.gray(this.i18n.t("headerSubtitle"));
25
27
  const author = chalk.gray(`${this.i18n.t("headerAuthor")}: ${pkg.author}`);
26
28
  const version = chalk.gray(`${this.i18n.t("headerVersion")}: ${pkg.version}`);
27
29
  const license = chalk.gray(`${this.i18n.t("headerLicense")}: ${pkg.license}`);
28
- const banner = `${logo}\n${title}\n${subtitle}\n\n${author}\n${version}\n${license}`;
30
+
31
+ let portLine = "";
32
+ if (apiUrl && apiUrl.includes("localhost")) {
33
+ try {
34
+ const url = new URL(apiUrl);
35
+ const port = url.port || (url.protocol === "https:" ? 443 : 80);
36
+ portLine = `\n${chalk.cyan(`🔌 ${this.i18n.t("runningOnPort")} ${port}`)}`;
37
+ } catch (error) {
38
+ // Ignora se falhar ao parsear
39
+ }
40
+ }
41
+
42
+ const banner = `${logo}\n${title}\n${subtitle}\n\n${author}\n${version}\n${license}${portLine}`;
29
43
  output.write(
30
44
  boxen(banner, {
31
45
  padding: 1,
@@ -19,6 +19,7 @@ const translations = {
19
19
 
20
20
  // ConsolePresenter
21
21
  generatedDiscovery: "Discovery JSON gerado:",
22
+ runningOnPort: "Rodando na porta",
22
23
  error: "Erro:",
23
24
 
24
25
  // RunDiscoveryFlow
@@ -63,6 +64,7 @@ const translations = {
63
64
 
64
65
  // ConsolePresenter
65
66
  generatedDiscovery: "Generated discovery JSON:",
67
+ runningOnPort: "Running on port",
66
68
  error: "Error:",
67
69
 
68
70
  // RunDiscoveryFlow