box0-cli 0.1.0 → 0.1.1
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/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +10 -4
package/dist/index.js
CHANGED
|
@@ -18,19 +18,20 @@ function registerPing(program2) {
|
|
|
18
18
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
19
|
var require2 = createRequire(import.meta.url);
|
|
20
20
|
var pkg = require2(join(__dirname, "..", "package.json"));
|
|
21
|
+
var binName = Object.keys(pkg.bin)[0];
|
|
21
22
|
var program = new Command();
|
|
22
23
|
program.configureOutput({
|
|
23
24
|
outputError: (str, write) => {
|
|
24
25
|
if (str.includes("unknown command")) {
|
|
25
26
|
const cmd = process.argv[2] ?? "unknown";
|
|
26
|
-
write(chalk.red(`Unknown command '${cmd}'. See
|
|
27
|
+
write(chalk.red(`Unknown command '${cmd}'. See ${binName} --help.
|
|
27
28
|
`));
|
|
28
29
|
} else {
|
|
29
30
|
write(str);
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
});
|
|
33
|
-
program.name(
|
|
34
|
+
program.name(binName).description(pkg.description).version(pkg.version);
|
|
34
35
|
registerPing(program);
|
|
35
36
|
program.exitOverride((err) => {
|
|
36
37
|
if (err.code === "commander.unknownCommand") {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/ping.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { createRequire } from \"module\";\nimport { dirname, join } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport { registerPing } from \"./commands/ping.js\";\nimport { logger } from \"./utils/logger.js\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst require = createRequire(import.meta.url);\nconst pkg = require(join(__dirname, \"..\", \"package.json\")) as { version: string };\n\nconst program = new Command();\n\nprogram.configureOutput({\n outputError: (str, write) => {\n if (str.includes(\"unknown command\")) {\n const cmd = process.argv[2] ?? \"unknown\";\n write(chalk.red(`Unknown command '${cmd}'. See
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/ping.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { createRequire } from \"module\";\nimport { dirname, join } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport chalk from \"chalk\";\nimport { Command } from \"commander\";\nimport { registerPing } from \"./commands/ping.js\";\nimport { logger } from \"./utils/logger.js\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst require = createRequire(import.meta.url);\nconst pkg = require(join(__dirname, \"..\", \"package.json\")) as {\n name: string;\n version: string;\n description: string;\n bin: Record<string, string>;\n};\n\nconst binName = Object.keys(pkg.bin)[0];\nconst program = new Command();\n\nprogram.configureOutput({\n outputError: (str, write) => {\n if (str.includes(\"unknown command\")) {\n const cmd = process.argv[2] ?? \"unknown\";\n write(chalk.red(`Unknown command '${cmd}'. See ${binName} --help.\\n`));\n } else {\n write(str);\n }\n },\n});\n\nprogram\n .name(binName)\n .description(pkg.description)\n .version(pkg.version);\n\nregisterPing(program);\n\nprogram.exitOverride((err) => {\n if (err.code === \"commander.unknownCommand\") {\n process.exit(1);\n }\n process.exit(err.exitCode ?? 1);\n});\n\nprogram.parse();","import { Command } from \"commander\";\n\nexport function registerPing(program: Command): void {\n program\n .command(\"ping\")\n .description(\"Test command — prints pong to verify the command system works\")\n .action(() => {\n console.log(\"pong\");\n });\n}\n"],"mappings":";;;AACA,SAAS,qBAAqB;AAC9B,SAAS,SAAS,YAAY;AAC9B,SAAS,qBAAqB;AAC9B,OAAO,WAAW;AAClB,SAAS,eAAe;;;ACHjB,SAAS,aAAaA,UAAwB;AACnD,EAAAA,SACG,QAAQ,MAAM,EACd,YAAY,oEAA+D,EAC3E,OAAO,MAAM;AACZ,YAAQ,IAAI,MAAM;AAAA,EACpB,CAAC;AACL;;;ADAA,IAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AACxD,IAAMC,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,MAAMA,SAAQ,KAAK,WAAW,MAAM,cAAc,CAAC;AAOzD,IAAM,UAAU,OAAO,KAAK,IAAI,GAAG,EAAE,CAAC;AACtC,IAAM,UAAU,IAAI,QAAQ;AAE5B,QAAQ,gBAAgB;AAAA,EACtB,aAAa,CAAC,KAAK,UAAU;AAC3B,QAAI,IAAI,SAAS,iBAAiB,GAAG;AACnC,YAAM,MAAM,QAAQ,KAAK,CAAC,KAAK;AAC/B,YAAM,MAAM,IAAI,oBAAoB,GAAG,UAAU,OAAO;AAAA,CAAY,CAAC;AAAA,IACvE,OAAO;AACL,YAAM,GAAG;AAAA,IACX;AAAA,EACF;AACF,CAAC;AAED,QACG,KAAK,OAAO,EACZ,YAAY,IAAI,WAAW,EAC3B,QAAQ,IAAI,OAAO;AAEtB,aAAa,OAAO;AAEpB,QAAQ,aAAa,CAAC,QAAQ;AAC5B,MAAI,IAAI,SAAS,4BAA4B;AAC3C,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,UAAQ,KAAK,IAAI,YAAY,CAAC;AAChC,CAAC;AAED,QAAQ,MAAM;","names":["program","require"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "box0-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Make your coding agent works like OpenClawd",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
"typescript": "^5.7.2",
|
|
31
31
|
"vitest": "^4.0.18"
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -9,15 +9,21 @@ import { logger } from "./utils/logger.js";
|
|
|
9
9
|
|
|
10
10
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
11
11
|
const require = createRequire(import.meta.url);
|
|
12
|
-
const pkg = require(join(__dirname, "..", "package.json")) as {
|
|
12
|
+
const pkg = require(join(__dirname, "..", "package.json")) as {
|
|
13
|
+
name: string;
|
|
14
|
+
version: string;
|
|
15
|
+
description: string;
|
|
16
|
+
bin: Record<string, string>;
|
|
17
|
+
};
|
|
13
18
|
|
|
19
|
+
const binName = Object.keys(pkg.bin)[0];
|
|
14
20
|
const program = new Command();
|
|
15
21
|
|
|
16
22
|
program.configureOutput({
|
|
17
23
|
outputError: (str, write) => {
|
|
18
24
|
if (str.includes("unknown command")) {
|
|
19
25
|
const cmd = process.argv[2] ?? "unknown";
|
|
20
|
-
write(chalk.red(`Unknown command '${cmd}'. See
|
|
26
|
+
write(chalk.red(`Unknown command '${cmd}'. See ${binName} --help.\n`));
|
|
21
27
|
} else {
|
|
22
28
|
write(str);
|
|
23
29
|
}
|
|
@@ -25,8 +31,8 @@ program.configureOutput({
|
|
|
25
31
|
});
|
|
26
32
|
|
|
27
33
|
program
|
|
28
|
-
.name(
|
|
29
|
-
.description(
|
|
34
|
+
.name(binName)
|
|
35
|
+
.description(pkg.description)
|
|
30
36
|
.version(pkg.version);
|
|
31
37
|
|
|
32
38
|
registerPing(program);
|