@heysalad/cheri-cli 0.9.0 → 0.10.0
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/cheri.js +7 -1
- package/package.json +1 -1
- package/src/lib/logger.js +15 -1
package/bin/cheri.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
import { readFileSync } from "fs";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import { dirname, join } from "path";
|
|
3
6
|
import { program } from "commander";
|
|
4
7
|
import { registerInitCommand } from "../src/commands/init.js";
|
|
5
8
|
import { registerLoginCommand } from "../src/commands/login.js";
|
|
@@ -10,10 +13,13 @@ import { registerWorkspaceCommand } from "../src/commands/workspace.js";
|
|
|
10
13
|
import { registerUsageCommand } from "../src/commands/usage.js";
|
|
11
14
|
import { registerAgentCommand } from "../src/commands/agent.js";
|
|
12
15
|
|
|
16
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
18
|
+
|
|
13
19
|
program
|
|
14
20
|
.name("cheri")
|
|
15
21
|
.description("Cheri CLI - AI-powered cloud IDE by HeySalad")
|
|
16
|
-
.version(
|
|
22
|
+
.version(pkg.version);
|
|
17
23
|
|
|
18
24
|
registerLoginCommand(program);
|
|
19
25
|
registerInitCommand(program);
|
package/package.json
CHANGED
package/src/lib/logger.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
+
import { readFileSync } from "fs";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { dirname, join } from "path";
|
|
5
|
+
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
let _version;
|
|
8
|
+
function getVersion() {
|
|
9
|
+
if (!_version) {
|
|
10
|
+
try { _version = JSON.parse(readFileSync(join(__dirname, "..", "..", "package.json"), "utf-8")).version; }
|
|
11
|
+
catch { _version = "0.0.0"; }
|
|
12
|
+
}
|
|
13
|
+
return _version;
|
|
14
|
+
}
|
|
2
15
|
|
|
3
16
|
export const log = {
|
|
4
17
|
info(msg) {
|
|
@@ -36,7 +49,8 @@ export const log = {
|
|
|
36
49
|
console.log(chalk.dim(prefix) + " " + item);
|
|
37
50
|
});
|
|
38
51
|
},
|
|
39
|
-
banner(version
|
|
52
|
+
banner(version) {
|
|
53
|
+
if (!version) version = getVersion();
|
|
40
54
|
console.log();
|
|
41
55
|
console.log(` ${chalk.red("🍒")} ${chalk.red.bold("Cheri")}`);
|
|
42
56
|
console.log(` ${chalk.dim("AI-powered cloud IDE by HeySalad")}`);
|