latticesql 1.3.0 → 1.3.1

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/cli.js CHANGED
@@ -321,7 +321,7 @@ import { join as join3 } from "path";
321
321
  import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
322
322
 
323
323
  // src/render/writer.ts
324
- import { writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, renameSync, existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
324
+ import { writeFileSync as writeFileSync2, mkdirSync as mkdirSync2, renameSync, copyFileSync, unlinkSync, existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
325
325
  import { createHash } from "crypto";
326
326
  import { dirname as dirname3, join as join2 } from "path";
327
327
  import { tmpdir } from "os";
@@ -334,7 +334,16 @@ function atomicWrite(filePath, content) {
334
334
  if (currentHash === newHash) return false;
335
335
  const tmp = join2(tmpdir(), `lattice-${randomBytes(8).toString("hex")}.tmp`);
336
336
  writeFileSync2(tmp, content, "utf8");
337
- renameSync(tmp, filePath);
337
+ try {
338
+ renameSync(tmp, filePath);
339
+ } catch (err) {
340
+ if (err.code === "EXDEV") {
341
+ copyFileSync(tmp, filePath);
342
+ unlinkSync(tmp);
343
+ } else {
344
+ throw err;
345
+ }
346
+ }
338
347
  return true;
339
348
  }
340
349
  function existingHash(filePath) {
@@ -644,7 +653,7 @@ var Sanitizer = class {
644
653
 
645
654
  // src/render/engine.ts
646
655
  import { join as join5, basename, isAbsolute, resolve as resolve3 } from "path";
647
- import { mkdirSync as mkdirSync3, existsSync as existsSync5, copyFileSync } from "fs";
656
+ import { mkdirSync as mkdirSync3, existsSync as existsSync5, copyFileSync as copyFileSync2 } from "fs";
648
657
 
649
658
  // src/render/token-budget.ts
650
659
  function estimateTokens(text) {
@@ -1021,7 +1030,7 @@ ${tmpl.perRow.body(row)}
1021
1030
 
1022
1031
  // src/lifecycle/cleanup.ts
1023
1032
  import { join as join4 } from "path";
1024
- import { existsSync as existsSync4, readdirSync, unlinkSync, rmdirSync, statSync } from "fs";
1033
+ import { existsSync as existsSync4, readdirSync, unlinkSync as unlinkSync2, rmdirSync, statSync } from "fs";
1025
1034
  function cleanupEntityContexts(outputDir, entityContexts, currentSlugsByTable, manifest, options = {}, newManifest) {
1026
1035
  const result = {
1027
1036
  directoriesRemoved: [],
@@ -1063,7 +1072,7 @@ function cleanupEntityContexts(outputDir, entityContexts, currentSlugsByTable, m
1063
1072
  if (globalProtected.has(filename)) continue;
1064
1073
  const filePath = join4(entityDir, filename);
1065
1074
  if (!existsSync4(filePath)) continue;
1066
- if (!options.dryRun) unlinkSync(filePath);
1075
+ if (!options.dryRun) unlinkSync2(filePath);
1067
1076
  options.onOrphan?.(filePath, "file");
1068
1077
  result.filesRemoved.push(filePath);
1069
1078
  }
@@ -1108,7 +1117,7 @@ function cleanupEntityContexts(outputDir, entityContexts, currentSlugsByTable, m
1108
1117
  if (globalProtected.has(filename)) continue;
1109
1118
  const filePath = join4(entityDir, filename);
1110
1119
  if (!existsSync4(filePath)) continue;
1111
- if (!options.dryRun) unlinkSync(filePath);
1120
+ if (!options.dryRun) unlinkSync2(filePath);
1112
1121
  options.onOrphan?.(filePath, "file");
1113
1122
  result.filesRemoved.push(filePath);
1114
1123
  }
@@ -1284,7 +1293,7 @@ var RenderEngine = class {
1284
1293
  const destPath = join5(entityDir, basename(absPath));
1285
1294
  if (!existsSync5(destPath)) {
1286
1295
  try {
1287
- copyFileSync(absPath, destPath);
1296
+ copyFileSync2(absPath, destPath);
1288
1297
  filesWritten.push(destPath);
1289
1298
  } catch {
1290
1299
  }
package/dist/index.cjs CHANGED
@@ -89,7 +89,16 @@ function atomicWrite(filePath, content) {
89
89
  if (currentHash === newHash) return false;
90
90
  const tmp = (0, import_node_path.join)((0, import_node_os.tmpdir)(), `lattice-${(0, import_node_crypto2.randomBytes)(8).toString("hex")}.tmp`);
91
91
  (0, import_node_fs.writeFileSync)(tmp, content, "utf8");
92
- (0, import_node_fs.renameSync)(tmp, filePath);
92
+ try {
93
+ (0, import_node_fs.renameSync)(tmp, filePath);
94
+ } catch (err) {
95
+ if (err.code === "EXDEV") {
96
+ (0, import_node_fs.copyFileSync)(tmp, filePath);
97
+ (0, import_node_fs.unlinkSync)(tmp);
98
+ } else {
99
+ throw err;
100
+ }
101
+ }
93
102
  return true;
94
103
  }
95
104
  function existingHash(filePath) {
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { join as join2 } from "path";
6
6
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
7
7
 
8
8
  // src/render/writer.ts
9
- import { writeFileSync, mkdirSync, renameSync, existsSync, readFileSync } from "fs";
9
+ import { writeFileSync, mkdirSync, renameSync, copyFileSync, unlinkSync, existsSync, readFileSync } from "fs";
10
10
  import { createHash } from "crypto";
11
11
  import { dirname, join } from "path";
12
12
  import { tmpdir } from "os";
@@ -19,7 +19,16 @@ function atomicWrite(filePath, content) {
19
19
  if (currentHash === newHash) return false;
20
20
  const tmp = join(tmpdir(), `lattice-${randomBytes(8).toString("hex")}.tmp`);
21
21
  writeFileSync(tmp, content, "utf8");
22
- renameSync(tmp, filePath);
22
+ try {
23
+ renameSync(tmp, filePath);
24
+ } catch (err) {
25
+ if (err.code === "EXDEV") {
26
+ copyFileSync(tmp, filePath);
27
+ unlinkSync(tmp);
28
+ } else {
29
+ throw err;
30
+ }
31
+ }
23
32
  return true;
24
33
  }
25
34
  function existingHash(filePath) {
@@ -329,7 +338,7 @@ var Sanitizer = class {
329
338
 
330
339
  // src/render/engine.ts
331
340
  import { join as join4, basename, isAbsolute, resolve } from "path";
332
- import { mkdirSync as mkdirSync2, existsSync as existsSync4, copyFileSync } from "fs";
341
+ import { mkdirSync as mkdirSync2, existsSync as existsSync4, copyFileSync as copyFileSync2 } from "fs";
333
342
 
334
343
  // src/render/token-budget.ts
335
344
  function estimateTokens(text) {
@@ -713,7 +722,7 @@ ${tmpl.perRow.body(row)}
713
722
 
714
723
  // src/lifecycle/cleanup.ts
715
724
  import { join as join3 } from "path";
716
- import { existsSync as existsSync3, readdirSync, unlinkSync, rmdirSync, statSync } from "fs";
725
+ import { existsSync as existsSync3, readdirSync, unlinkSync as unlinkSync2, rmdirSync, statSync } from "fs";
717
726
  function cleanupEntityContexts(outputDir, entityContexts, currentSlugsByTable, manifest, options = {}, newManifest) {
718
727
  const result = {
719
728
  directoriesRemoved: [],
@@ -755,7 +764,7 @@ function cleanupEntityContexts(outputDir, entityContexts, currentSlugsByTable, m
755
764
  if (globalProtected.has(filename)) continue;
756
765
  const filePath = join3(entityDir, filename);
757
766
  if (!existsSync3(filePath)) continue;
758
- if (!options.dryRun) unlinkSync(filePath);
767
+ if (!options.dryRun) unlinkSync2(filePath);
759
768
  options.onOrphan?.(filePath, "file");
760
769
  result.filesRemoved.push(filePath);
761
770
  }
@@ -800,7 +809,7 @@ function cleanupEntityContexts(outputDir, entityContexts, currentSlugsByTable, m
800
809
  if (globalProtected.has(filename)) continue;
801
810
  const filePath = join3(entityDir, filename);
802
811
  if (!existsSync3(filePath)) continue;
803
- if (!options.dryRun) unlinkSync(filePath);
812
+ if (!options.dryRun) unlinkSync2(filePath);
804
813
  options.onOrphan?.(filePath, "file");
805
814
  result.filesRemoved.push(filePath);
806
815
  }
@@ -976,7 +985,7 @@ var RenderEngine = class {
976
985
  const destPath = join4(entityDir, basename(absPath));
977
986
  if (!existsSync4(destPath)) {
978
987
  try {
979
- copyFileSync(absPath, destPath);
988
+ copyFileSync2(absPath, destPath);
980
989
  filesWritten.push(destPath);
981
990
  } catch {
982
991
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "latticesql",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Persistent structured memory for AI agent systems — SQLite ↔ LLM context bridge",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",