@codelia/cli 0.1.3 → 0.1.12
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.cjs +69 -8
- package/dist/index.js +69 -8
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -23,6 +23,39 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
23
|
mod
|
|
24
24
|
));
|
|
25
25
|
|
|
26
|
+
// src/basic-options.ts
|
|
27
|
+
var TOP_LEVEL_HELP_TEXT = [
|
|
28
|
+
"usage: codelia [options] [-- <tui-options>]",
|
|
29
|
+
"",
|
|
30
|
+
"Top-level options:",
|
|
31
|
+
" -h, --help Show this help",
|
|
32
|
+
" -V, -v, --version Show codelia version",
|
|
33
|
+
"",
|
|
34
|
+
"Commands:",
|
|
35
|
+
" mcp ... Manage MCP servers and auth",
|
|
36
|
+
"",
|
|
37
|
+
"TUI options (passed through):",
|
|
38
|
+
" -r, --resume [session_id]",
|
|
39
|
+
" --debug[=true|false]",
|
|
40
|
+
" --initial-message <text>",
|
|
41
|
+
" --initial-user-message <text>",
|
|
42
|
+
" --debug-perf[=true|false]"
|
|
43
|
+
].join("\n");
|
|
44
|
+
var isHelpFlag = (value) => value === "-h" || value === "--help" || value === "help";
|
|
45
|
+
var isVersionFlag = (value) => value === "-V" || value === "-v" || value === "--version" || value === "version";
|
|
46
|
+
var resolveTopLevelAction = (args2) => {
|
|
47
|
+
if (args2[0] === "mcp") {
|
|
48
|
+
return "mcp";
|
|
49
|
+
}
|
|
50
|
+
if (args2.length === 1 && isHelpFlag(args2[0])) {
|
|
51
|
+
return "help";
|
|
52
|
+
}
|
|
53
|
+
if (args2.length === 1 && isVersionFlag(args2[0])) {
|
|
54
|
+
return "version";
|
|
55
|
+
}
|
|
56
|
+
return "tui";
|
|
57
|
+
};
|
|
58
|
+
|
|
26
59
|
// src/args.ts
|
|
27
60
|
var import_cac = require("cac");
|
|
28
61
|
var parseWithCac = (values) => {
|
|
@@ -736,6 +769,11 @@ var import_node_fs = __toESM(require("fs"), 1);
|
|
|
736
769
|
var import_node_module = require("module");
|
|
737
770
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
738
771
|
var import_storage3 = require("@codelia/storage");
|
|
772
|
+
|
|
773
|
+
// src/version.ts
|
|
774
|
+
var CLI_VERSION = "0.1.12".trim().length > 0 ? "0.1.12" : "0.0.0";
|
|
775
|
+
|
|
776
|
+
// src/tui/launcher.ts
|
|
739
777
|
var resolveTuiBinaryName = (platform) => platform === "win32" ? "codelia-tui.exe" : "codelia-tui";
|
|
740
778
|
var TUI_PACKAGE_BY_TARGET = {
|
|
741
779
|
"darwin-arm64": "@codelia/tui-darwin-arm64",
|
|
@@ -831,6 +869,16 @@ var resolveRuntimeEnvForTui = (env, resolveRuntimeEntry = resolveBundledRuntimeE
|
|
|
831
869
|
CODELIA_RUNTIME_ARGS: quoteShellWord(runtimeEntry)
|
|
832
870
|
};
|
|
833
871
|
};
|
|
872
|
+
var resolveLaunchEnvForTui = (env, cliVersion = CLI_VERSION, resolveRuntimeEntry = resolveBundledRuntimeEntry) => {
|
|
873
|
+
const runtimeEnv = resolveRuntimeEnvForTui(env, resolveRuntimeEntry);
|
|
874
|
+
if (runtimeEnv.CODELIA_CLI_VERSION || cliVersion.trim().length === 0) {
|
|
875
|
+
return runtimeEnv;
|
|
876
|
+
}
|
|
877
|
+
return {
|
|
878
|
+
...runtimeEnv,
|
|
879
|
+
CODELIA_CLI_VERSION: cliVersion
|
|
880
|
+
};
|
|
881
|
+
};
|
|
834
882
|
var resolveTuiCommand = (options = {}) => {
|
|
835
883
|
const env = options.env ?? process.env;
|
|
836
884
|
if (env.CODELIA_TUI_CMD) {
|
|
@@ -845,8 +893,7 @@ var resolveTuiCommand = (options = {}) => {
|
|
|
845
893
|
const cliPackageRoot = options.cliPackageRoot === void 0 ? resolveCliPackageRoot() : options.cliPackageRoot;
|
|
846
894
|
const seen = /* @__PURE__ */ new Set();
|
|
847
895
|
const optionalTuiBinary = resolveOptionalBinary(platform, arch);
|
|
848
|
-
const
|
|
849
|
-
...optionalTuiBinary ? [optionalTuiBinary] : [],
|
|
896
|
+
const localCandidates = [
|
|
850
897
|
...cliPackageRoot ? [
|
|
851
898
|
import_node_path2.default.resolve(cliPackageRoot, "dist/bin", tuiBinaryName),
|
|
852
899
|
import_node_path2.default.resolve(
|
|
@@ -865,6 +912,10 @@ var resolveTuiCommand = (options = {}) => {
|
|
|
865
912
|
import_node_path2.default.resolve(cwd, "crates/tui/target/release", tuiBinaryName),
|
|
866
913
|
import_node_path2.default.resolve(cwd, "crates/tui/target/debug", tuiBinaryName)
|
|
867
914
|
];
|
|
915
|
+
const candidates = [
|
|
916
|
+
...localCandidates,
|
|
917
|
+
...optionalTuiBinary ? [optionalTuiBinary] : []
|
|
918
|
+
];
|
|
868
919
|
for (const candidate of candidates) {
|
|
869
920
|
if (seen.has(candidate)) continue;
|
|
870
921
|
seen.add(candidate);
|
|
@@ -880,7 +931,7 @@ var runTui = (args2) => {
|
|
|
880
931
|
const tuiArgs = process.env.CODELIA_TUI_ARGS ? splitArgs(process.env.CODELIA_TUI_ARGS) : [];
|
|
881
932
|
const child = (0, import_node_child_process2.spawn)(tuiCmd, [...tuiArgs, ...args2], {
|
|
882
933
|
stdio: "inherit",
|
|
883
|
-
env:
|
|
934
|
+
env: resolveLaunchEnvForTui(process.env)
|
|
884
935
|
});
|
|
885
936
|
child.on("exit", (code) => {
|
|
886
937
|
process.exitCode = code ?? 0;
|
|
@@ -908,11 +959,21 @@ var runTui = (args2) => {
|
|
|
908
959
|
// src/index.ts
|
|
909
960
|
var args = process.argv.slice(2);
|
|
910
961
|
var main = async () => {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
962
|
+
switch (resolveTopLevelAction(args)) {
|
|
963
|
+
case "help":
|
|
964
|
+
console.log(TOP_LEVEL_HELP_TEXT);
|
|
965
|
+
return;
|
|
966
|
+
case "version":
|
|
967
|
+
console.log(CLI_VERSION);
|
|
968
|
+
return;
|
|
969
|
+
case "mcp": {
|
|
970
|
+
const exitCode = await runMcpCommand(args.slice(1));
|
|
971
|
+
process.exitCode = exitCode;
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
case "tui":
|
|
975
|
+
runTui(args);
|
|
976
|
+
return;
|
|
915
977
|
}
|
|
916
|
-
runTui(args);
|
|
917
978
|
};
|
|
918
979
|
void main();
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
// src/basic-options.ts
|
|
2
|
+
var TOP_LEVEL_HELP_TEXT = [
|
|
3
|
+
"usage: codelia [options] [-- <tui-options>]",
|
|
4
|
+
"",
|
|
5
|
+
"Top-level options:",
|
|
6
|
+
" -h, --help Show this help",
|
|
7
|
+
" -V, -v, --version Show codelia version",
|
|
8
|
+
"",
|
|
9
|
+
"Commands:",
|
|
10
|
+
" mcp ... Manage MCP servers and auth",
|
|
11
|
+
"",
|
|
12
|
+
"TUI options (passed through):",
|
|
13
|
+
" -r, --resume [session_id]",
|
|
14
|
+
" --debug[=true|false]",
|
|
15
|
+
" --initial-message <text>",
|
|
16
|
+
" --initial-user-message <text>",
|
|
17
|
+
" --debug-perf[=true|false]"
|
|
18
|
+
].join("\n");
|
|
19
|
+
var isHelpFlag = (value) => value === "-h" || value === "--help" || value === "help";
|
|
20
|
+
var isVersionFlag = (value) => value === "-V" || value === "-v" || value === "--version" || value === "version";
|
|
21
|
+
var resolveTopLevelAction = (args2) => {
|
|
22
|
+
if (args2[0] === "mcp") {
|
|
23
|
+
return "mcp";
|
|
24
|
+
}
|
|
25
|
+
if (args2.length === 1 && isHelpFlag(args2[0])) {
|
|
26
|
+
return "help";
|
|
27
|
+
}
|
|
28
|
+
if (args2.length === 1 && isVersionFlag(args2[0])) {
|
|
29
|
+
return "version";
|
|
30
|
+
}
|
|
31
|
+
return "tui";
|
|
32
|
+
};
|
|
33
|
+
|
|
1
34
|
// src/args.ts
|
|
2
35
|
import { cac } from "cac";
|
|
3
36
|
var parseWithCac = (values) => {
|
|
@@ -720,6 +753,11 @@ import fsSync from "fs";
|
|
|
720
753
|
import { createRequire } from "module";
|
|
721
754
|
import path2 from "path";
|
|
722
755
|
import { ensureStorageDirs, resolveStoragePaths as resolveStoragePaths2 } from "@codelia/storage";
|
|
756
|
+
|
|
757
|
+
// src/version.ts
|
|
758
|
+
var CLI_VERSION = "0.1.12".trim().length > 0 ? "0.1.12" : "0.0.0";
|
|
759
|
+
|
|
760
|
+
// src/tui/launcher.ts
|
|
723
761
|
var resolveTuiBinaryName = (platform) => platform === "win32" ? "codelia-tui.exe" : "codelia-tui";
|
|
724
762
|
var TUI_PACKAGE_BY_TARGET = {
|
|
725
763
|
"darwin-arm64": "@codelia/tui-darwin-arm64",
|
|
@@ -815,6 +853,16 @@ var resolveRuntimeEnvForTui = (env, resolveRuntimeEntry = resolveBundledRuntimeE
|
|
|
815
853
|
CODELIA_RUNTIME_ARGS: quoteShellWord(runtimeEntry)
|
|
816
854
|
};
|
|
817
855
|
};
|
|
856
|
+
var resolveLaunchEnvForTui = (env, cliVersion = CLI_VERSION, resolveRuntimeEntry = resolveBundledRuntimeEntry) => {
|
|
857
|
+
const runtimeEnv = resolveRuntimeEnvForTui(env, resolveRuntimeEntry);
|
|
858
|
+
if (runtimeEnv.CODELIA_CLI_VERSION || cliVersion.trim().length === 0) {
|
|
859
|
+
return runtimeEnv;
|
|
860
|
+
}
|
|
861
|
+
return {
|
|
862
|
+
...runtimeEnv,
|
|
863
|
+
CODELIA_CLI_VERSION: cliVersion
|
|
864
|
+
};
|
|
865
|
+
};
|
|
818
866
|
var resolveTuiCommand = (options = {}) => {
|
|
819
867
|
const env = options.env ?? process.env;
|
|
820
868
|
if (env.CODELIA_TUI_CMD) {
|
|
@@ -829,8 +877,7 @@ var resolveTuiCommand = (options = {}) => {
|
|
|
829
877
|
const cliPackageRoot = options.cliPackageRoot === void 0 ? resolveCliPackageRoot() : options.cliPackageRoot;
|
|
830
878
|
const seen = /* @__PURE__ */ new Set();
|
|
831
879
|
const optionalTuiBinary = resolveOptionalBinary(platform, arch);
|
|
832
|
-
const
|
|
833
|
-
...optionalTuiBinary ? [optionalTuiBinary] : [],
|
|
880
|
+
const localCandidates = [
|
|
834
881
|
...cliPackageRoot ? [
|
|
835
882
|
path2.resolve(cliPackageRoot, "dist/bin", tuiBinaryName),
|
|
836
883
|
path2.resolve(
|
|
@@ -849,6 +896,10 @@ var resolveTuiCommand = (options = {}) => {
|
|
|
849
896
|
path2.resolve(cwd, "crates/tui/target/release", tuiBinaryName),
|
|
850
897
|
path2.resolve(cwd, "crates/tui/target/debug", tuiBinaryName)
|
|
851
898
|
];
|
|
899
|
+
const candidates = [
|
|
900
|
+
...localCandidates,
|
|
901
|
+
...optionalTuiBinary ? [optionalTuiBinary] : []
|
|
902
|
+
];
|
|
852
903
|
for (const candidate of candidates) {
|
|
853
904
|
if (seen.has(candidate)) continue;
|
|
854
905
|
seen.add(candidate);
|
|
@@ -864,7 +915,7 @@ var runTui = (args2) => {
|
|
|
864
915
|
const tuiArgs = process.env.CODELIA_TUI_ARGS ? splitArgs(process.env.CODELIA_TUI_ARGS) : [];
|
|
865
916
|
const child = spawn2(tuiCmd, [...tuiArgs, ...args2], {
|
|
866
917
|
stdio: "inherit",
|
|
867
|
-
env:
|
|
918
|
+
env: resolveLaunchEnvForTui(process.env)
|
|
868
919
|
});
|
|
869
920
|
child.on("exit", (code) => {
|
|
870
921
|
process.exitCode = code ?? 0;
|
|
@@ -892,11 +943,21 @@ var runTui = (args2) => {
|
|
|
892
943
|
// src/index.ts
|
|
893
944
|
var args = process.argv.slice(2);
|
|
894
945
|
var main = async () => {
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
946
|
+
switch (resolveTopLevelAction(args)) {
|
|
947
|
+
case "help":
|
|
948
|
+
console.log(TOP_LEVEL_HELP_TEXT);
|
|
949
|
+
return;
|
|
950
|
+
case "version":
|
|
951
|
+
console.log(CLI_VERSION);
|
|
952
|
+
return;
|
|
953
|
+
case "mcp": {
|
|
954
|
+
const exitCode = await runMcpCommand(args.slice(1));
|
|
955
|
+
process.exitCode = exitCode;
|
|
956
|
+
return;
|
|
957
|
+
}
|
|
958
|
+
case "tui":
|
|
959
|
+
runTui(args);
|
|
960
|
+
return;
|
|
899
961
|
}
|
|
900
|
-
runTui(args);
|
|
901
962
|
};
|
|
902
963
|
void main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codelia/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20 <25"
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@codelia/config-loader": "0.1.
|
|
23
|
-
"@codelia/protocol": "0.1.
|
|
24
|
-
"@codelia/runtime": "0.1.
|
|
25
|
-
"@codelia/storage": "0.1.
|
|
22
|
+
"@codelia/config-loader": "0.1.12",
|
|
23
|
+
"@codelia/protocol": "0.1.12",
|
|
24
|
+
"@codelia/runtime": "0.1.12",
|
|
25
|
+
"@codelia/storage": "0.1.12",
|
|
26
26
|
"cac": "^6.7.14",
|
|
27
27
|
"zod": "^4.3.6"
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@codelia/tui-darwin-arm64": "0.1.
|
|
31
|
-
"@codelia/tui-darwin-x64": "0.1.
|
|
32
|
-
"@codelia/tui-linux-arm64": "0.1.
|
|
33
|
-
"@codelia/tui-linux-x64": "0.1.
|
|
34
|
-
"@codelia/tui-win32-x64": "0.1.
|
|
30
|
+
"@codelia/tui-darwin-arm64": "0.1.12",
|
|
31
|
+
"@codelia/tui-darwin-x64": "0.1.12",
|
|
32
|
+
"@codelia/tui-linux-arm64": "0.1.12",
|
|
33
|
+
"@codelia/tui-linux-x64": "0.1.12",
|
|
34
|
+
"@codelia/tui-win32-x64": "0.1.12"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsup --config tsup.config.ts",
|