zen-code 4.4.1 → 4.6.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.
@@ -1,7 +1,7 @@
1
1
  import { K as T } from "./kysely-Bchvsze0.mjs";
2
2
  import { F as r } from "./sql-CJsUpKEQ.mjs";
3
- import { B as f, T as l, c as y, m } from "./app-CRslJvxg.mjs";
4
- import "./graphBuilder-B0bC88R_.mjs";
3
+ import { B as f, T as l, c as y, m } from "./app-CM8R0ZR6.mjs";
4
+ import "./graphBuilder-mpLrx9tk.mjs";
5
5
  const g = ["source", "step", "parents"];
6
6
  const E = g;
7
7
  class w extends f {
@@ -1,5 +1,5 @@
1
- import { T as l, B as N, W as k, m as y } from "./app-CRslJvxg.mjs";
2
- import "./graphBuilder-B0bC88R_.mjs";
1
+ import { T as l, B as N, W as k, m as y } from "./app-CM8R0ZR6.mjs";
2
+ import "./graphBuilder-mpLrx9tk.mjs";
3
3
  import w from "pg";
4
4
  const S = (h) => [
5
5
  "checkpoints",
package/dist/cli.mjs CHANGED
@@ -1,33 +1,57 @@
1
1
  #!/usr/bin/env node
2
- const t = process.argv.slice(2);
3
- async function o() {
4
- const s = t.indexOf("--yolo");
5
- if (s !== -1 && (process.env.YOLO_MODE = "true", t.splice(s, 1)), t[0] === "init")
6
- import("./zen-init.mjs");
7
- else if (t[0] === "keyboard")
2
+ import c from "node:path";
3
+ import m from "node:os";
4
+ import o from "node:fs";
5
+ import "node-notifier";
6
+ import "./metadata-XVTVXthy.mjs";
7
+ function p(e) {
8
+ const t = e.replace(/^~/, m.homedir()), s = c.resolve(t), n = c.dirname(s);
9
+ return o.existsSync(n) || o.mkdirSync(n, { recursive: !0 }), s;
10
+ }
11
+ function u(e, t) {
12
+ if (!o.existsSync(e)) {
13
+ process.env.DATABASE_INIT = "true";
14
+ return;
15
+ }
16
+ const n = (process.env.SQLITE_MAX_SIZE_MB ? parseInt(process.env.SQLITE_MAX_SIZE_MB, 10) * 1024 * 1024 : void 0) ?? 100 * 1024 * 1024, r = o.statSync(e).size, a = r / (1024 * 1024);
17
+ if (r > n) {
18
+ const d = n / 1048576;
19
+ console.warn(`⚠️ Database file is large: ${a.toFixed(2)}MB (limit: ${d.toFixed(2)}MB)`), console.warn(` Path: ${e}`), console.warn(" Set SQLITE_MAX_SIZE_MB to adjust limit");
20
+ }
21
+ }
22
+ function f(e) {
23
+ const t = p(e);
24
+ return process.env.SQLITE_DATABASE_URI = t, u(t), t;
25
+ }
26
+ const i = process.argv.slice(2);
27
+ async function l() {
28
+ const e = i.indexOf("--yolo");
29
+ if (e !== -1 && (process.env.YOLO_MODE = "true", i.splice(e, 1)), f("~/.zen-code/data/sessions.db"), i[0] === "init")
30
+ console.log("Please zen-code and use /m to configure models");
31
+ else if (i[0] === "keyboard")
8
32
  import("./zen-keyboard.mjs");
9
- else if (t[0] === "-p" || t[0] === "--prompt") {
10
- const e = t.slice(1).join(" "), { runNonInteractive: i } = await import("./nonInteractive.mjs");
11
- await i(e, !1);
12
- } else if (await r()) {
13
- const { runNonInteractive: i } = await import("./nonInteractive.mjs");
14
- await i(void 0, !0);
33
+ else if (i[0] === "-p" || i[0] === "--prompt") {
34
+ const t = i.slice(1).join(" "), { runNonInteractive: s } = await import("./nonInteractive.mjs");
35
+ await s(t, !1);
36
+ } else if (await S()) {
37
+ const { runNonInteractive: s } = await import("./nonInteractive.mjs");
38
+ await s(void 0, !0);
15
39
  } else
16
40
  await import("./zen-code.mjs");
17
41
  }
18
- async function r() {
19
- return new Promise((s) => {
42
+ async function S() {
43
+ return new Promise((e) => {
20
44
  if (process.stdin.isTTY) {
21
- s(!1);
45
+ e(!1);
22
46
  return;
23
47
  }
24
- const i = process.stdin.read();
25
- i ? (process.stdin.unshift(i), s(!0)) : setTimeout(() => {
48
+ const s = process.stdin.read();
49
+ s ? (process.stdin.unshift(s), e(!0)) : setTimeout(() => {
26
50
  const n = process.stdin.read();
27
- n ? (process.stdin.unshift(n), s(!0)) : s(!1);
51
+ n ? (process.stdin.unshift(n), e(!0)) : e(!1);
28
52
  }, 100);
29
53
  });
30
54
  }
31
- o().catch((s) => {
32
- console.error("❌ 执行失败:", s), process.exit(1);
55
+ l().catch((e) => {
56
+ console.error("❌ 执行失败:", e), process.exit(1);
33
57
  });