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.
|
|
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",
|
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:
|
|
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 =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
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
|