codlyy 1.0.2 → 1.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/bin/codlyy.js +25 -8
- package/package.json +1 -1
package/bin/codlyy.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
import clear from "clear";
|
|
5
4
|
import figlet from "figlet";
|
|
6
5
|
import chalk from "chalk";
|
|
7
6
|
import gradient from "gradient-string";
|
|
8
7
|
import readline from "readline";
|
|
8
|
+
import { readFileSync } from "fs";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
import { dirname, join } from "path";
|
|
11
|
+
|
|
12
|
+
// ---- GET VERSION FROM package.json ----
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = dirname(__filename);
|
|
15
|
+
const pkg = JSON.parse(
|
|
16
|
+
readFileSync(join(__dirname, "../package.json"), "utf-8")
|
|
17
|
+
);
|
|
18
|
+
const VERSION = pkg.version;
|
|
9
19
|
|
|
10
20
|
// Clear terminal
|
|
11
21
|
clear();
|
|
12
22
|
|
|
13
23
|
// Ocean blue gradient
|
|
14
|
-
const ocean = gradient([
|
|
24
|
+
const ocean = gradient(["#00c6ff", "#0072ff"]);
|
|
15
25
|
|
|
16
26
|
// Banner
|
|
17
27
|
console.log(
|
|
@@ -19,12 +29,15 @@ console.log(
|
|
|
19
29
|
figlet.textSync("CODLYY", {
|
|
20
30
|
font: "Block",
|
|
21
31
|
horizontalLayout: "default",
|
|
22
|
-
verticalLayout: "default"
|
|
32
|
+
verticalLayout: "default",
|
|
23
33
|
})
|
|
24
34
|
)
|
|
25
35
|
);
|
|
26
36
|
|
|
27
|
-
|
|
37
|
+
// Header info
|
|
38
|
+
console.log(
|
|
39
|
+
chalk.gray(`⚡ Codlyy CLI v${VERSION} · Research Preview`)
|
|
40
|
+
);
|
|
28
41
|
console.log(chalk.gray("Type your prompt and press Enter"));
|
|
29
42
|
console.log(chalk.gray("Type 'exit' to quit\n"));
|
|
30
43
|
|
|
@@ -32,7 +45,7 @@ console.log(chalk.gray("Type 'exit' to quit\n"));
|
|
|
32
45
|
const rl = readline.createInterface({
|
|
33
46
|
input: process.stdin,
|
|
34
47
|
output: process.stdout,
|
|
35
|
-
prompt: chalk.cyanBright("❯ ")
|
|
48
|
+
prompt: chalk.cyanBright("❯ "),
|
|
36
49
|
});
|
|
37
50
|
|
|
38
51
|
// Start prompt
|
|
@@ -47,15 +60,19 @@ rl.on("line", (input) => {
|
|
|
47
60
|
process.exit(0);
|
|
48
61
|
}
|
|
49
62
|
|
|
63
|
+
if (prompt === "version" || prompt === "--version" || prompt === "-v") {
|
|
64
|
+
console.log(chalk.blueBright(`\nCodlyy CLI v${VERSION}\n`));
|
|
65
|
+
rl.prompt();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
50
69
|
if (prompt.length === 0) {
|
|
51
70
|
rl.prompt();
|
|
52
71
|
return;
|
|
53
72
|
}
|
|
54
73
|
|
|
55
74
|
// Coming soon response
|
|
56
|
-
console.log(
|
|
57
|
-
chalk.blueBright("\n🚧 Coming soon...")
|
|
58
|
-
);
|
|
75
|
+
console.log(chalk.blueBright("\n🚧 Coming soon..."));
|
|
59
76
|
console.log(
|
|
60
77
|
chalk.gray("Codlyy AI engine is under development.\n")
|
|
61
78
|
);
|