context-vault 2.7.0 → 2.7.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/bin/cli.js
CHANGED
|
@@ -1425,6 +1425,8 @@ async function runImport() {
|
|
|
1425
1425
|
async function runExport() {
|
|
1426
1426
|
const format = getFlag("--format") || "json";
|
|
1427
1427
|
const output = getFlag("--output");
|
|
1428
|
+
const rawPageSize = getFlag("--page-size");
|
|
1429
|
+
const pageSize = rawPageSize ? Math.max(1, parseInt(rawPageSize, 10) || 100) : null;
|
|
1428
1430
|
|
|
1429
1431
|
const { resolveConfig } = await import("@context-vault/core/core/config");
|
|
1430
1432
|
const { initDatabase, prepareStatements } = await import("@context-vault/core/index/db");
|
|
@@ -1438,25 +1440,33 @@ async function runExport() {
|
|
|
1438
1440
|
|
|
1439
1441
|
const db = await initDatabase(config.dbPath);
|
|
1440
1442
|
|
|
1441
|
-
const
|
|
1442
|
-
"SELECT * FROM vault WHERE (expires_at IS NULL OR expires_at > datetime('now')) ORDER BY created_at DESC"
|
|
1443
|
-
).all();
|
|
1443
|
+
const whereClause = "WHERE (expires_at IS NULL OR expires_at > datetime('now'))";
|
|
1444
1444
|
|
|
1445
|
-
|
|
1445
|
+
let entries;
|
|
1446
|
+
if (pageSize) {
|
|
1447
|
+
// Paginated: fetch in chunks to avoid loading everything into memory
|
|
1448
|
+
entries = [];
|
|
1449
|
+
let offset = 0;
|
|
1450
|
+
const stmt = db.prepare(
|
|
1451
|
+
`SELECT * FROM vault ${whereClause} ORDER BY created_at DESC LIMIT ? OFFSET ?`
|
|
1452
|
+
);
|
|
1453
|
+
while (true) {
|
|
1454
|
+
const rows = stmt.all(pageSize, offset);
|
|
1455
|
+
if (rows.length === 0) break;
|
|
1456
|
+
for (const row of rows) {
|
|
1457
|
+
entries.push(mapExportRow(row));
|
|
1458
|
+
}
|
|
1459
|
+
offset += rows.length;
|
|
1460
|
+
if (rows.length < pageSize) break;
|
|
1461
|
+
}
|
|
1462
|
+
} else {
|
|
1463
|
+
const rows = db.prepare(
|
|
1464
|
+
`SELECT * FROM vault ${whereClause} ORDER BY created_at DESC`
|
|
1465
|
+
).all();
|
|
1466
|
+
entries = rows.map(mapExportRow);
|
|
1467
|
+
}
|
|
1446
1468
|
|
|
1447
|
-
|
|
1448
|
-
id: row.id,
|
|
1449
|
-
kind: row.kind,
|
|
1450
|
-
category: row.category,
|
|
1451
|
-
title: row.title || null,
|
|
1452
|
-
body: row.body || null,
|
|
1453
|
-
tags: row.tags ? JSON.parse(row.tags) : [],
|
|
1454
|
-
meta: row.meta ? JSON.parse(row.meta) : {},
|
|
1455
|
-
source: row.source || null,
|
|
1456
|
-
identity_key: row.identity_key || null,
|
|
1457
|
-
expires_at: row.expires_at || null,
|
|
1458
|
-
created_at: row.created_at,
|
|
1459
|
-
}));
|
|
1469
|
+
db.close();
|
|
1460
1470
|
|
|
1461
1471
|
let content;
|
|
1462
1472
|
|
|
@@ -1489,6 +1499,22 @@ async function runExport() {
|
|
|
1489
1499
|
}
|
|
1490
1500
|
}
|
|
1491
1501
|
|
|
1502
|
+
function mapExportRow(row) {
|
|
1503
|
+
return {
|
|
1504
|
+
id: row.id,
|
|
1505
|
+
kind: row.kind,
|
|
1506
|
+
category: row.category,
|
|
1507
|
+
title: row.title || null,
|
|
1508
|
+
body: row.body || null,
|
|
1509
|
+
tags: row.tags ? JSON.parse(row.tags) : [],
|
|
1510
|
+
meta: row.meta ? JSON.parse(row.meta) : {},
|
|
1511
|
+
source: row.source || null,
|
|
1512
|
+
identity_key: row.identity_key || null,
|
|
1513
|
+
expires_at: row.expires_at || null,
|
|
1514
|
+
created_at: row.created_at,
|
|
1515
|
+
};
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1492
1518
|
// ─── Ingest Command ─────────────────────────────────────────────────────────
|
|
1493
1519
|
|
|
1494
1520
|
async function runIngest() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-vault",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Persistent memory for AI agents — saves and searches knowledge across sessions",
|
|
6
6
|
"bin": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@context-vault/core"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@context-vault/core": "^2.7.
|
|
59
|
+
"@context-vault/core": "^2.7.1",
|
|
60
60
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
61
61
|
"better-sqlite3": "^12.6.2",
|
|
62
62
|
"sqlite-vec": "^0.1.0"
|