@shogo-ai/cli 2.5.4 → 2.5.5

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,3 +1,7 @@
1
+ import {
2
+ __require
3
+ } from "./chunk-DGUM43GV.js";
4
+
1
5
  // src/child-process.ts
2
6
  import * as cp from "child_process";
3
7
  import { promisify } from "util";
@@ -76,7 +80,58 @@ var fork2 = wrap(hideSpawnArgs, () => cp.fork);
76
80
 
77
81
  // src/pkg.ts
78
82
  import { existsSync, readlinkSync, lstatSync } from "fs";
79
- import { isAbsolute, join, resolve as resolvePath, dirname } from "path";
83
+ import { isAbsolute as isAbsolute2, join as join2, resolve as resolvePath, dirname } from "path";
84
+
85
+ // src/sqlite-wal.ts
86
+ import { isAbsolute, join, resolve } from "path";
87
+ function sqliteFileFromUrl(url, cwd) {
88
+ if (!url || !url.startsWith("file:")) return null;
89
+ const raw = url.slice("file:".length).split("?")[0];
90
+ if (!raw || raw === ":memory:") return null;
91
+ return isAbsolute(raw) ? raw : resolve(cwd, raw);
92
+ }
93
+ function pushedSqliteFiles(cwd, env) {
94
+ const url = env?.DATABASE_URL;
95
+ if (url) {
96
+ const file = sqliteFileFromUrl(url, cwd);
97
+ return file ? [file] : [];
98
+ }
99
+ return [join(cwd, "prisma", "dev.db"), join(cwd, "dev.db")];
100
+ }
101
+ function loadBunSqlite() {
102
+ if (typeof globalThis.Bun === "undefined") return null;
103
+ const id = "bun:sqlite";
104
+ try {
105
+ return __require(id);
106
+ } catch {
107
+ return null;
108
+ }
109
+ }
110
+ function ensureSqliteWal(dbPath) {
111
+ const sqlite = loadBunSqlite();
112
+ if (!sqlite) return "unsupported";
113
+ let db = null;
114
+ try {
115
+ db = new sqlite.Database(dbPath, { readwrite: true, create: false });
116
+ } catch {
117
+ return "missing";
118
+ }
119
+ try {
120
+ const current = db.query("PRAGMA journal_mode").get()?.journal_mode?.toLowerCase();
121
+ if (current === "wal") return "already-wal";
122
+ const after = db.query("PRAGMA journal_mode = WAL").get()?.journal_mode?.toLowerCase();
123
+ return after === "wal" ? "wal" : "failed";
124
+ } catch {
125
+ return "failed";
126
+ } finally {
127
+ try {
128
+ db?.close();
129
+ } catch {
130
+ }
131
+ }
132
+ }
133
+
134
+ // src/pkg.ts
80
135
  var NodeMissingError = class extends Error {
81
136
  constructor() {
82
137
  super(
@@ -89,10 +144,10 @@ var NodeMissingError = class extends Error {
89
144
  var WINDOWS_NODE_DIR = "C:\\Program Files\\nodejs";
90
145
  function isNodeAvailableOnWindows(pathEnv = process.env.PATH) {
91
146
  if (process.platform !== "win32") return true;
92
- if (existsSync(join(WINDOWS_NODE_DIR, "npm.cmd"))) return true;
147
+ if (existsSync(join2(WINDOWS_NODE_DIR, "npm.cmd"))) return true;
93
148
  if (!pathEnv) return false;
94
149
  for (const dir of pathEnv.split(";")) {
95
- if (dir && existsSync(join(dir, "npm.cmd"))) return true;
150
+ if (dir && existsSync(join2(dir, "npm.cmd"))) return true;
96
151
  }
97
152
  return false;
98
153
  }
@@ -104,7 +159,7 @@ function isNodeAvailableOnUnix(pathEnv = process.env.PATH) {
104
159
  if (pathEnv) {
105
160
  for (const dir of pathEnv.split(":")) {
106
161
  if (!dir) continue;
107
- if (existsSync(join(dir, "node"))) {
162
+ if (existsSync(join2(dir, "node"))) {
108
163
  found = true;
109
164
  break;
110
165
  }
@@ -117,9 +172,9 @@ function _resetUnixNodeCache() {
117
172
  _unixNodeAvailable = null;
118
173
  }
119
174
  function resolveBinInvocation(workspaceDir, binName) {
120
- const binDir = join(workspaceDir, "node_modules", ".bin");
175
+ const binDir = join2(workspaceDir, "node_modules", ".bin");
121
176
  const isWindows = process.platform === "win32";
122
- const candidates = isWindows ? [join(binDir, `${binName}.CMD`), join(binDir, `${binName}.cmd`), join(binDir, `${binName}.exe`)] : [join(binDir, binName)];
177
+ const candidates = isWindows ? [join2(binDir, `${binName}.CMD`), join2(binDir, `${binName}.cmd`), join2(binDir, `${binName}.exe`)] : [join2(binDir, binName)];
123
178
  const shim = candidates.find((p) => existsSync(p));
124
179
  if (!shim) return null;
125
180
  if (isWindows) return { cmd: shim, argsPrefix: [] };
@@ -128,7 +183,7 @@ function resolveBinInvocation(workspaceDir, binName) {
128
183
  const st = lstatSync(shim);
129
184
  if (!st.isSymbolicLink()) return { cmd: shim, argsPrefix: [] };
130
185
  const target = readlinkSync(shim);
131
- const jsEntry = isAbsolute(target) ? target : resolvePath(dirname(shim), target);
186
+ const jsEntry = isAbsolute2(target) ? target : resolvePath(dirname(shim), target);
132
187
  if (!existsSync(jsEntry)) return { cmd: shim, argsPrefix: [] };
133
188
  const bun = process.env.SHOGO_BUN_PATH || "bun";
134
189
  return { cmd: bun, argsPrefix: [jsEntry] };
@@ -341,7 +396,7 @@ ${first.stderr}`);
341
396
  const bun = this.bunBinary;
342
397
  const baseArgs = ["install", ...extraArgs];
343
398
  const frozenArgs = opts?.frozen ? ["install", "--frozen-lockfile", ...extraArgs] : null;
344
- const runOnce = (args) => new Promise((resolve, reject) => {
399
+ const runOnce = (args) => new Promise((resolve2, reject) => {
345
400
  const proc = spawn2(bun, args, {
346
401
  cwd,
347
402
  stdio: "pipe",
@@ -359,7 +414,7 @@ ${first.stderr}`);
359
414
  });
360
415
  proc.on("exit", (code) => {
361
416
  clearTimeout(timer);
362
- resolve({ ok: code === 0, stderr });
417
+ resolve2({ ok: code === 0, stderr });
363
418
  });
364
419
  proc.on("error", (err) => {
365
420
  clearTimeout(timer);
@@ -488,6 +543,7 @@ ${first.stderr}`);
488
543
  stdio: opts?.stdio,
489
544
  env: opts?.env
490
545
  });
546
+ defaultProjectDbToWal(cwd, opts?.env);
491
547
  }
492
548
  // Async siblings of the prisma wrappers above. Use these from any
493
549
  // long-running service (runtime, agent gateway, preview manager) so a
@@ -508,8 +564,17 @@ ${first.stderr}`);
508
564
  stdio: opts?.stdio,
509
565
  env: opts?.env
510
566
  });
567
+ defaultProjectDbToWal(cwd, opts?.env);
511
568
  }
512
569
  };
570
+ function defaultProjectDbToWal(cwd, env) {
571
+ for (const dbPath of pushedSqliteFiles(cwd, env)) {
572
+ const result = ensureSqliteWal(dbPath);
573
+ if (result === "missing") continue;
574
+ if (result === "failed") console.warn(`[pkg] could not switch ${dbPath} to WAL; it stays in its current journal mode`);
575
+ return;
576
+ }
577
+ }
513
578
  function wrapWindowsNpmError(err) {
514
579
  if (!IS_WINDOWS) return null;
515
580
  const blob = `${err?.stderr?.toString?.() ?? ""}
@@ -542,4 +607,4 @@ export {
542
607
  isEresolveStderr,
543
608
  pkg
544
609
  };
545
- //# sourceMappingURL=chunk-HCXMH2GQ.js.map
610
+ //# sourceMappingURL=chunk-3K2CGQAD.js.map
@@ -0,0 +1,11 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ export {
9
+ __require
10
+ };
11
+ //# sourceMappingURL=chunk-DGUM43GV.js.map
package/dist/deploy.js CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  runDeploy,
6
6
  validateManifest
7
7
  } from "./chunk-YYO73V5H.js";
8
+ import "./chunk-DGUM43GV.js";
8
9
  export {
9
10
  AGENT_NAME_PATTERN,
10
11
  buildSyncPayload,
package/dist/index.cjs CHANGED
@@ -343,7 +343,58 @@ var fork2 = wrap(hideSpawnArgs, () => cp.fork);
343
343
 
344
344
  // src/pkg.ts
345
345
  var import_node_fs = require("fs");
346
+ var import_node_path2 = require("path");
347
+
348
+ // src/sqlite-wal.ts
346
349
  var import_node_path = require("path");
350
+ function sqliteFileFromUrl(url, cwd) {
351
+ if (!url || !url.startsWith("file:")) return null;
352
+ const raw = url.slice("file:".length).split("?")[0];
353
+ if (!raw || raw === ":memory:") return null;
354
+ return (0, import_node_path.isAbsolute)(raw) ? raw : (0, import_node_path.resolve)(cwd, raw);
355
+ }
356
+ function pushedSqliteFiles(cwd, env) {
357
+ const url = env?.DATABASE_URL;
358
+ if (url) {
359
+ const file = sqliteFileFromUrl(url, cwd);
360
+ return file ? [file] : [];
361
+ }
362
+ return [(0, import_node_path.join)(cwd, "prisma", "dev.db"), (0, import_node_path.join)(cwd, "dev.db")];
363
+ }
364
+ function loadBunSqlite() {
365
+ if (typeof globalThis.Bun === "undefined") return null;
366
+ const id = "bun:sqlite";
367
+ try {
368
+ return require(id);
369
+ } catch {
370
+ return null;
371
+ }
372
+ }
373
+ function ensureSqliteWal(dbPath) {
374
+ const sqlite = loadBunSqlite();
375
+ if (!sqlite) return "unsupported";
376
+ let db = null;
377
+ try {
378
+ db = new sqlite.Database(dbPath, { readwrite: true, create: false });
379
+ } catch {
380
+ return "missing";
381
+ }
382
+ try {
383
+ const current = db.query("PRAGMA journal_mode").get()?.journal_mode?.toLowerCase();
384
+ if (current === "wal") return "already-wal";
385
+ const after = db.query("PRAGMA journal_mode = WAL").get()?.journal_mode?.toLowerCase();
386
+ return after === "wal" ? "wal" : "failed";
387
+ } catch {
388
+ return "failed";
389
+ } finally {
390
+ try {
391
+ db?.close();
392
+ } catch {
393
+ }
394
+ }
395
+ }
396
+
397
+ // src/pkg.ts
347
398
  var NodeMissingError = class extends Error {
348
399
  constructor() {
349
400
  super(
@@ -356,10 +407,10 @@ var NodeMissingError = class extends Error {
356
407
  var WINDOWS_NODE_DIR = "C:\\Program Files\\nodejs";
357
408
  function isNodeAvailableOnWindows(pathEnv = process.env.PATH) {
358
409
  if (process.platform !== "win32") return true;
359
- if ((0, import_node_fs.existsSync)((0, import_node_path.join)(WINDOWS_NODE_DIR, "npm.cmd"))) return true;
410
+ if ((0, import_node_fs.existsSync)((0, import_node_path2.join)(WINDOWS_NODE_DIR, "npm.cmd"))) return true;
360
411
  if (!pathEnv) return false;
361
412
  for (const dir of pathEnv.split(";")) {
362
- if (dir && (0, import_node_fs.existsSync)((0, import_node_path.join)(dir, "npm.cmd"))) return true;
413
+ if (dir && (0, import_node_fs.existsSync)((0, import_node_path2.join)(dir, "npm.cmd"))) return true;
363
414
  }
364
415
  return false;
365
416
  }
@@ -371,7 +422,7 @@ function isNodeAvailableOnUnix(pathEnv = process.env.PATH) {
371
422
  if (pathEnv) {
372
423
  for (const dir of pathEnv.split(":")) {
373
424
  if (!dir) continue;
374
- if ((0, import_node_fs.existsSync)((0, import_node_path.join)(dir, "node"))) {
425
+ if ((0, import_node_fs.existsSync)((0, import_node_path2.join)(dir, "node"))) {
375
426
  found = true;
376
427
  break;
377
428
  }
@@ -384,9 +435,9 @@ function _resetUnixNodeCache() {
384
435
  _unixNodeAvailable = null;
385
436
  }
386
437
  function resolveBinInvocation(workspaceDir, binName) {
387
- const binDir = (0, import_node_path.join)(workspaceDir, "node_modules", ".bin");
438
+ const binDir = (0, import_node_path2.join)(workspaceDir, "node_modules", ".bin");
388
439
  const isWindows = process.platform === "win32";
389
- const candidates = isWindows ? [(0, import_node_path.join)(binDir, `${binName}.CMD`), (0, import_node_path.join)(binDir, `${binName}.cmd`), (0, import_node_path.join)(binDir, `${binName}.exe`)] : [(0, import_node_path.join)(binDir, binName)];
440
+ const candidates = isWindows ? [(0, import_node_path2.join)(binDir, `${binName}.CMD`), (0, import_node_path2.join)(binDir, `${binName}.cmd`), (0, import_node_path2.join)(binDir, `${binName}.exe`)] : [(0, import_node_path2.join)(binDir, binName)];
390
441
  const shim = candidates.find((p) => (0, import_node_fs.existsSync)(p));
391
442
  if (!shim) return null;
392
443
  if (isWindows) return { cmd: shim, argsPrefix: [] };
@@ -395,7 +446,7 @@ function resolveBinInvocation(workspaceDir, binName) {
395
446
  const st = (0, import_node_fs.lstatSync)(shim);
396
447
  if (!st.isSymbolicLink()) return { cmd: shim, argsPrefix: [] };
397
448
  const target = (0, import_node_fs.readlinkSync)(shim);
398
- const jsEntry = (0, import_node_path.isAbsolute)(target) ? target : (0, import_node_path.resolve)((0, import_node_path.dirname)(shim), target);
449
+ const jsEntry = (0, import_node_path2.isAbsolute)(target) ? target : (0, import_node_path2.resolve)((0, import_node_path2.dirname)(shim), target);
399
450
  if (!(0, import_node_fs.existsSync)(jsEntry)) return { cmd: shim, argsPrefix: [] };
400
451
  const bun = process.env.SHOGO_BUN_PATH || "bun";
401
452
  return { cmd: bun, argsPrefix: [jsEntry] };
@@ -608,7 +659,7 @@ ${first.stderr}`);
608
659
  const bun = this.bunBinary;
609
660
  const baseArgs = ["install", ...extraArgs];
610
661
  const frozenArgs = opts?.frozen ? ["install", "--frozen-lockfile", ...extraArgs] : null;
611
- const runOnce = (args) => new Promise((resolve, reject) => {
662
+ const runOnce = (args) => new Promise((resolve2, reject) => {
612
663
  const proc = spawn2(bun, args, {
613
664
  cwd,
614
665
  stdio: "pipe",
@@ -626,7 +677,7 @@ ${first.stderr}`);
626
677
  });
627
678
  proc.on("exit", (code) => {
628
679
  clearTimeout(timer);
629
- resolve({ ok: code === 0, stderr });
680
+ resolve2({ ok: code === 0, stderr });
630
681
  });
631
682
  proc.on("error", (err) => {
632
683
  clearTimeout(timer);
@@ -755,6 +806,7 @@ ${first.stderr}`);
755
806
  stdio: opts?.stdio,
756
807
  env: opts?.env
757
808
  });
809
+ defaultProjectDbToWal(cwd, opts?.env);
758
810
  }
759
811
  // Async siblings of the prisma wrappers above. Use these from any
760
812
  // long-running service (runtime, agent gateway, preview manager) so a
@@ -775,8 +827,17 @@ ${first.stderr}`);
775
827
  stdio: opts?.stdio,
776
828
  env: opts?.env
777
829
  });
830
+ defaultProjectDbToWal(cwd, opts?.env);
778
831
  }
779
832
  };
833
+ function defaultProjectDbToWal(cwd, env) {
834
+ for (const dbPath of pushedSqliteFiles(cwd, env)) {
835
+ const result = ensureSqliteWal(dbPath);
836
+ if (result === "missing") continue;
837
+ if (result === "failed") console.warn(`[pkg] could not switch ${dbPath} to WAL; it stays in its current journal mode`);
838
+ return;
839
+ }
840
+ }
780
841
  function wrapWindowsNpmError(err) {
781
842
  if (!IS_WINDOWS) return null;
782
843
  const blob = `${err?.stderr?.toString?.() ?? ""}
package/dist/index.js CHANGED
@@ -14,7 +14,8 @@ import {
14
14
  isNodeAvailableOnWindows,
15
15
  pkg,
16
16
  resolveBinInvocation
17
- } from "./chunk-HCXMH2GQ.js";
17
+ } from "./chunk-3K2CGQAD.js";
18
+ import "./chunk-DGUM43GV.js";
18
19
  export {
19
20
  AGENT_NAME_PATTERN,
20
21
  NodeMissingError,
package/dist/pkg.cjs CHANGED
@@ -119,7 +119,58 @@ var fork2 = wrap(hideSpawnArgs, () => cp.fork);
119
119
 
120
120
  // src/pkg.ts
121
121
  var import_node_fs = require("fs");
122
+ var import_node_path2 = require("path");
123
+
124
+ // src/sqlite-wal.ts
122
125
  var import_node_path = require("path");
126
+ function sqliteFileFromUrl(url, cwd) {
127
+ if (!url || !url.startsWith("file:")) return null;
128
+ const raw = url.slice("file:".length).split("?")[0];
129
+ if (!raw || raw === ":memory:") return null;
130
+ return (0, import_node_path.isAbsolute)(raw) ? raw : (0, import_node_path.resolve)(cwd, raw);
131
+ }
132
+ function pushedSqliteFiles(cwd, env) {
133
+ const url = env?.DATABASE_URL;
134
+ if (url) {
135
+ const file = sqliteFileFromUrl(url, cwd);
136
+ return file ? [file] : [];
137
+ }
138
+ return [(0, import_node_path.join)(cwd, "prisma", "dev.db"), (0, import_node_path.join)(cwd, "dev.db")];
139
+ }
140
+ function loadBunSqlite() {
141
+ if (typeof globalThis.Bun === "undefined") return null;
142
+ const id = "bun:sqlite";
143
+ try {
144
+ return require(id);
145
+ } catch {
146
+ return null;
147
+ }
148
+ }
149
+ function ensureSqliteWal(dbPath) {
150
+ const sqlite = loadBunSqlite();
151
+ if (!sqlite) return "unsupported";
152
+ let db = null;
153
+ try {
154
+ db = new sqlite.Database(dbPath, { readwrite: true, create: false });
155
+ } catch {
156
+ return "missing";
157
+ }
158
+ try {
159
+ const current = db.query("PRAGMA journal_mode").get()?.journal_mode?.toLowerCase();
160
+ if (current === "wal") return "already-wal";
161
+ const after = db.query("PRAGMA journal_mode = WAL").get()?.journal_mode?.toLowerCase();
162
+ return after === "wal" ? "wal" : "failed";
163
+ } catch {
164
+ return "failed";
165
+ } finally {
166
+ try {
167
+ db?.close();
168
+ } catch {
169
+ }
170
+ }
171
+ }
172
+
173
+ // src/pkg.ts
123
174
  var NodeMissingError = class extends Error {
124
175
  constructor() {
125
176
  super(
@@ -132,10 +183,10 @@ var NodeMissingError = class extends Error {
132
183
  var WINDOWS_NODE_DIR = "C:\\Program Files\\nodejs";
133
184
  function isNodeAvailableOnWindows(pathEnv = process.env.PATH) {
134
185
  if (process.platform !== "win32") return true;
135
- if ((0, import_node_fs.existsSync)((0, import_node_path.join)(WINDOWS_NODE_DIR, "npm.cmd"))) return true;
186
+ if ((0, import_node_fs.existsSync)((0, import_node_path2.join)(WINDOWS_NODE_DIR, "npm.cmd"))) return true;
136
187
  if (!pathEnv) return false;
137
188
  for (const dir of pathEnv.split(";")) {
138
- if (dir && (0, import_node_fs.existsSync)((0, import_node_path.join)(dir, "npm.cmd"))) return true;
189
+ if (dir && (0, import_node_fs.existsSync)((0, import_node_path2.join)(dir, "npm.cmd"))) return true;
139
190
  }
140
191
  return false;
141
192
  }
@@ -147,7 +198,7 @@ function isNodeAvailableOnUnix(pathEnv = process.env.PATH) {
147
198
  if (pathEnv) {
148
199
  for (const dir of pathEnv.split(":")) {
149
200
  if (!dir) continue;
150
- if ((0, import_node_fs.existsSync)((0, import_node_path.join)(dir, "node"))) {
201
+ if ((0, import_node_fs.existsSync)((0, import_node_path2.join)(dir, "node"))) {
151
202
  found = true;
152
203
  break;
153
204
  }
@@ -160,9 +211,9 @@ function _resetUnixNodeCache() {
160
211
  _unixNodeAvailable = null;
161
212
  }
162
213
  function resolveBinInvocation(workspaceDir, binName) {
163
- const binDir = (0, import_node_path.join)(workspaceDir, "node_modules", ".bin");
214
+ const binDir = (0, import_node_path2.join)(workspaceDir, "node_modules", ".bin");
164
215
  const isWindows = process.platform === "win32";
165
- const candidates = isWindows ? [(0, import_node_path.join)(binDir, `${binName}.CMD`), (0, import_node_path.join)(binDir, `${binName}.cmd`), (0, import_node_path.join)(binDir, `${binName}.exe`)] : [(0, import_node_path.join)(binDir, binName)];
216
+ const candidates = isWindows ? [(0, import_node_path2.join)(binDir, `${binName}.CMD`), (0, import_node_path2.join)(binDir, `${binName}.cmd`), (0, import_node_path2.join)(binDir, `${binName}.exe`)] : [(0, import_node_path2.join)(binDir, binName)];
166
217
  const shim = candidates.find((p) => (0, import_node_fs.existsSync)(p));
167
218
  if (!shim) return null;
168
219
  if (isWindows) return { cmd: shim, argsPrefix: [] };
@@ -171,7 +222,7 @@ function resolveBinInvocation(workspaceDir, binName) {
171
222
  const st = (0, import_node_fs.lstatSync)(shim);
172
223
  if (!st.isSymbolicLink()) return { cmd: shim, argsPrefix: [] };
173
224
  const target = (0, import_node_fs.readlinkSync)(shim);
174
- const jsEntry = (0, import_node_path.isAbsolute)(target) ? target : (0, import_node_path.resolve)((0, import_node_path.dirname)(shim), target);
225
+ const jsEntry = (0, import_node_path2.isAbsolute)(target) ? target : (0, import_node_path2.resolve)((0, import_node_path2.dirname)(shim), target);
175
226
  if (!(0, import_node_fs.existsSync)(jsEntry)) return { cmd: shim, argsPrefix: [] };
176
227
  const bun = process.env.SHOGO_BUN_PATH || "bun";
177
228
  return { cmd: bun, argsPrefix: [jsEntry] };
@@ -384,7 +435,7 @@ ${first.stderr}`);
384
435
  const bun = this.bunBinary;
385
436
  const baseArgs = ["install", ...extraArgs];
386
437
  const frozenArgs = opts?.frozen ? ["install", "--frozen-lockfile", ...extraArgs] : null;
387
- const runOnce = (args) => new Promise((resolve, reject) => {
438
+ const runOnce = (args) => new Promise((resolve2, reject) => {
388
439
  const proc = spawn2(bun, args, {
389
440
  cwd,
390
441
  stdio: "pipe",
@@ -402,7 +453,7 @@ ${first.stderr}`);
402
453
  });
403
454
  proc.on("exit", (code) => {
404
455
  clearTimeout(timer);
405
- resolve({ ok: code === 0, stderr });
456
+ resolve2({ ok: code === 0, stderr });
406
457
  });
407
458
  proc.on("error", (err) => {
408
459
  clearTimeout(timer);
@@ -531,6 +582,7 @@ ${first.stderr}`);
531
582
  stdio: opts?.stdio,
532
583
  env: opts?.env
533
584
  });
585
+ defaultProjectDbToWal(cwd, opts?.env);
534
586
  }
535
587
  // Async siblings of the prisma wrappers above. Use these from any
536
588
  // long-running service (runtime, agent gateway, preview manager) so a
@@ -551,8 +603,17 @@ ${first.stderr}`);
551
603
  stdio: opts?.stdio,
552
604
  env: opts?.env
553
605
  });
606
+ defaultProjectDbToWal(cwd, opts?.env);
554
607
  }
555
608
  };
609
+ function defaultProjectDbToWal(cwd, env) {
610
+ for (const dbPath of pushedSqliteFiles(cwd, env)) {
611
+ const result = ensureSqliteWal(dbPath);
612
+ if (result === "missing") continue;
613
+ if (result === "failed") console.warn(`[pkg] could not switch ${dbPath} to WAL; it stays in its current journal mode`);
614
+ return;
615
+ }
616
+ }
556
617
  function wrapWindowsNpmError(err) {
557
618
  if (!IS_WINDOWS) return null;
558
619
  const blob = `${err?.stderr?.toString?.() ?? ""}
package/dist/pkg.js CHANGED
@@ -7,7 +7,8 @@ import {
7
7
  isNodeAvailableOnWindows,
8
8
  pkg,
9
9
  resolveBinInvocation
10
- } from "./chunk-HCXMH2GQ.js";
10
+ } from "./chunk-3K2CGQAD.js";
11
+ import "./chunk-DGUM43GV.js";
11
12
  export {
12
13
  NodeMissingError,
13
14
  PlatformPackageManager,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shogo-ai/cli",
3
- "version": "2.5.4",
3
+ "version": "2.5.5",
4
4
  "description": "Shogo CLI helpers — deploy/manifest validation and packager for Shogo agents.",
5
5
  "license": "MIT",
6
6
  "type": "module",