@codelia/cli 0.1.10 → 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 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) {
@@ -883,7 +931,7 @@ var runTui = (args2) => {
883
931
  const tuiArgs = process.env.CODELIA_TUI_ARGS ? splitArgs(process.env.CODELIA_TUI_ARGS) : [];
884
932
  const child = (0, import_node_child_process2.spawn)(tuiCmd, [...tuiArgs, ...args2], {
885
933
  stdio: "inherit",
886
- env: resolveRuntimeEnvForTui(process.env)
934
+ env: resolveLaunchEnvForTui(process.env)
887
935
  });
888
936
  child.on("exit", (code) => {
889
937
  process.exitCode = code ?? 0;
@@ -911,11 +959,21 @@ var runTui = (args2) => {
911
959
  // src/index.ts
912
960
  var args = process.argv.slice(2);
913
961
  var main = async () => {
914
- if (args[0] === "mcp") {
915
- const exitCode = await runMcpCommand(args.slice(1));
916
- process.exitCode = exitCode;
917
- return;
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;
918
977
  }
919
- runTui(args);
920
978
  };
921
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) {
@@ -867,7 +915,7 @@ var runTui = (args2) => {
867
915
  const tuiArgs = process.env.CODELIA_TUI_ARGS ? splitArgs(process.env.CODELIA_TUI_ARGS) : [];
868
916
  const child = spawn2(tuiCmd, [...tuiArgs, ...args2], {
869
917
  stdio: "inherit",
870
- env: resolveRuntimeEnvForTui(process.env)
918
+ env: resolveLaunchEnvForTui(process.env)
871
919
  });
872
920
  child.on("exit", (code) => {
873
921
  process.exitCode = code ?? 0;
@@ -895,11 +943,21 @@ var runTui = (args2) => {
895
943
  // src/index.ts
896
944
  var args = process.argv.slice(2);
897
945
  var main = async () => {
898
- if (args[0] === "mcp") {
899
- const exitCode = await runMcpCommand(args.slice(1));
900
- process.exitCode = exitCode;
901
- return;
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;
902
961
  }
903
- runTui(args);
904
962
  };
905
963
  void main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/cli",
3
- "version": "0.1.10",
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.10",
23
- "@codelia/protocol": "0.1.10",
24
- "@codelia/runtime": "0.1.10",
25
- "@codelia/storage": "0.1.10",
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.10",
31
- "@codelia/tui-darwin-x64": "0.1.10",
32
- "@codelia/tui-linux-arm64": "0.1.10",
33
- "@codelia/tui-linux-x64": "0.1.10",
34
- "@codelia/tui-win32-x64": "0.1.10"
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",