@botconnector/bccli 0.4.0-beta.43 → 0.4.0-beta.44

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/version.ts
4
- var VERSION = true ? "0.4.0-beta.43" : "0.0.0-dev";
4
+ var VERSION = true ? "0.4.0-beta.44" : "0.0.0-dev";
5
5
 
6
6
  export {
7
7
  VERSION
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import "./chunk-NVRNFR4S.js";
12
12
  import "./chunk-PSO7R5AD.js";
13
13
  import {
14
14
  VERSION
15
- } from "./chunk-DUSVS3XK.js";
15
+ } from "./chunk-LTAQXU5Z.js";
16
16
  import {
17
17
  helpText,
18
18
  parseCliArgs
@@ -44,6 +44,22 @@ import {
44
44
  t
45
45
  } from "./chunk-QHNWI3OT.js";
46
46
 
47
+ // src/exit.ts
48
+ var EXIT_GRACE_MS = 1e3;
49
+ function settleExit(code, deps) {
50
+ const d = {
51
+ setExitCode: (c) => {
52
+ process.exitCode = c;
53
+ },
54
+ exit: (c) => process.exit(c),
55
+ setTimer: (fn, ms) => setTimeout(fn, ms),
56
+ ...deps
57
+ };
58
+ d.setExitCode(code);
59
+ const force = d.setTimer(() => d.exit(code), EXIT_GRACE_MS);
60
+ force.unref();
61
+ }
62
+
47
63
  // src/cli.ts
48
64
  function chooseLanguage(argv) {
49
65
  let fromConfig;
@@ -92,7 +108,7 @@ async function main() {
92
108
  return runModelsCommand(args, { env: process.env, cwd, out: (s) => console.log(s), err: (s) => console.error(s), fetch: globalThis.fetch });
93
109
  }
94
110
  if (args.command === "update") {
95
- const { runUpdateCommand } = await import("./update-7SSREI2O.js");
111
+ const { runUpdateCommand } = await import("./update-34FDI6H3.js");
96
112
  return runUpdateCommand({ env: process.env });
97
113
  }
98
114
  if (args.command === "acp") {
@@ -101,7 +117,7 @@ async function main() {
101
117
  return 0;
102
118
  }
103
119
  if (args.command === "serve") {
104
- const { startServe } = await import("./serve-F7BYQ7X6.js");
120
+ const { startServe } = await import("./serve-HW5XZ5LF.js");
105
121
  const handle = await startServe({ port: args.port, host: args.host, token: args.token, cwd, env: process.env });
106
122
  process.stderr.write(`bccli serve ${handle.url} \u2014 Authorization: Bearer ${handle.token}
107
123
  `);
@@ -138,9 +154,9 @@ async function main() {
138
154
  return runCompletionCommand(args, { out: (s) => console.log(s), err: (s) => console.error(s) });
139
155
  }
140
156
  if (args.command === "stats") {
141
- const { runStatsCommand } = await import("./statsCli-RPCIMT5R.js");
157
+ const { runStatsCommand } = await import("./statsCli-4KYPVYCN.js");
142
158
  const { bccliHome } = await import("./config-LCY27K3L.js");
143
- return runStatsCommand({ subArgs: args.subArgs, home: bccliHome(process.env) }, { out: (s) => console.log(s), err: (s) => console.error(s) });
159
+ return runStatsCommand({ subArgs: args.subArgs, home: bccliHome(process.env), days: args.days }, { out: (s) => console.log(s), err: (s) => console.error(s) });
144
160
  }
145
161
  if (args.command === "export" || args.command === "import") {
146
162
  const { runExportCommand, runImportCommand } = await import("./transferCli-RQBB6RVY.js");
@@ -150,7 +166,7 @@ async function main() {
150
166
  return args.command === "export" ? runExportCommand(deps, io) : runImportCommand(deps, io);
151
167
  }
152
168
  if (args.command === "pr") {
153
- const { runPrCommand } = await import("./prCli-NR3ZQMST.js");
169
+ const { runPrCommand } = await import("./prCli-PE7KIPMK.js");
154
170
  return runPrCommand({ subArgs: args.subArgs, cwd }, { out: (s) => console.log(s), err: (s) => console.error(s) });
155
171
  }
156
172
  const rt = createRuntime({ cwd, args });
@@ -176,7 +192,7 @@ async function main() {
176
192
  if (!process.stdin.isTTY) throw new ConfigError(t('Interactive mode needs a terminal. For scripts/CI use: bccli -p "task"'));
177
193
  if (rt.config.updateCheck !== "off" && !process.env.BCCLI_NO_UPDATE_CHECK) {
178
194
  try {
179
- const { checkForUpdate } = await import("./update-7SSREI2O.js");
195
+ const { checkForUpdate } = await import("./update-34FDI6H3.js");
180
196
  const update = await checkForUpdate({ home: rt.home, fetch: globalThis.fetch, now: /* @__PURE__ */ new Date() });
181
197
  if (update) console.error(update);
182
198
  } catch {
@@ -186,9 +202,9 @@ async function main() {
186
202
  return startInteractive(rt, { initialPrompt: args.prompt, resume: args.resume, version: VERSION });
187
203
  }
188
204
  main().then(
189
- (code) => process.exit(code),
205
+ (code) => settleExit(code),
190
206
  (error) => {
191
207
  console.error(error instanceof ConfigError || error?.code === "ERR_PARSE_ARGS_UNKNOWN_OPTION" ? error.message : error);
192
- process.exit(1);
208
+ settleExit(1);
193
209
  }
194
210
  );
@@ -21,9 +21,9 @@ function defaultGh(argv) {
21
21
  });
22
22
  }
23
23
  async function defaultRunTask(opts) {
24
- const argv = process.execPath ? [new URL("../cli.js", import.meta.url).pathname, ...opts.prompt ? ["-p", opts.prompt] : [], "--allow-all"] : [];
24
+ const entry = process.argv[1];
25
+ if (!entry) return 1;
25
26
  return new Promise((resolve) => {
26
- const entry = new URL("../cli.js", import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, "$1");
27
27
  const child = spawn(process.execPath, [entry, ...opts.prompt ? ["-p", opts.prompt] : [], "--allow-all"], {
28
28
  shell: false,
29
29
  stdio: "inherit",
@@ -31,7 +31,6 @@ async function defaultRunTask(opts) {
31
31
  });
32
32
  child.on("error", () => resolve(1));
33
33
  child.on("close", (code) => resolve(code ?? 1));
34
- void argv;
35
34
  });
36
35
  }
37
36
  async function runPrCommand(args, deps) {
@@ -8,7 +8,7 @@ import "./chunk-NVRNFR4S.js";
8
8
  import "./chunk-PSO7R5AD.js";
9
9
  import {
10
10
  VERSION
11
- } from "./chunk-DUSVS3XK.js";
11
+ } from "./chunk-LTAQXU5Z.js";
12
12
  import {
13
13
  LOOPBACK_BIND,
14
14
  MAX_FRAME_BYTES,
@@ -71,7 +71,7 @@ function aggregateSessions(home, opts) {
71
71
  return [...byProject.values()].sort((a, b) => b.messages - a.messages || a.project.localeCompare(b.project));
72
72
  }
73
73
  function runStatsCommand(args, deps) {
74
- let days = 7;
74
+ let days = args.days ?? 7;
75
75
  const rest = args.subArgs;
76
76
  for (let i = 0; i < rest.length; i++) {
77
77
  if (rest[i] === "--days") {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  VERSION
4
- } from "./chunk-DUSVS3XK.js";
4
+ } from "./chunk-LTAQXU5Z.js";
5
5
  import {
6
6
  t
7
7
  } from "./chunk-QHNWI3OT.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botconnector/bccli",
3
- "version": "0.4.0-beta.43",
3
+ "version": "0.4.0-beta.44",
4
4
  "description": "BCCLI — BotConnector AI coding agent for the terminal",
5
5
  "type": "module",
6
6
  "bin": {