@velvetmonkey/vault-core 2.0.151 → 2.0.153
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/migrations.js +4 -0
- package/dist/sqlite.js +11 -0
- package/dist/types.d.ts +2 -2
- package/dist/wikilinks.js +15 -1
- package/package.json +1 -1
package/dist/migrations.js
CHANGED
|
@@ -47,6 +47,10 @@ export function getStateDbPath(vaultPath) {
|
|
|
47
47
|
export function initSchema(db) {
|
|
48
48
|
// Enable WAL mode for better concurrent read performance
|
|
49
49
|
db.pragma('journal_mode = WAL');
|
|
50
|
+
// Incremental auto-vacuum — reclaims freed pages without full VACUUM blocking.
|
|
51
|
+
// Only takes effect on new DBs (before first table). Existing DBs need a one-time
|
|
52
|
+
// VACUUM in openStateDb() to activate.
|
|
53
|
+
db.pragma('auto_vacuum = INCREMENTAL');
|
|
50
54
|
// Enable foreign keys
|
|
51
55
|
db.pragma('foreign_keys = ON');
|
|
52
56
|
// Performance tuning
|
package/dist/sqlite.js
CHANGED
|
@@ -50,6 +50,17 @@ export function openStateDb(vaultPath) {
|
|
|
50
50
|
try {
|
|
51
51
|
db = new Database(dbPath);
|
|
52
52
|
initSchema(db);
|
|
53
|
+
// Enable incremental auto_vacuum on existing databases (one-time cost).
|
|
54
|
+
// New DBs get it from initSchema before tables are created, but existing
|
|
55
|
+
// DBs need a VACUUM to switch the file format.
|
|
56
|
+
if (!isNewDb) {
|
|
57
|
+
const autoVacuum = db.pragma('auto_vacuum', { simple: true });
|
|
58
|
+
if (autoVacuum === 0) {
|
|
59
|
+
console.error('[vault-core] Enabling incremental auto_vacuum (one-time VACUUM)');
|
|
60
|
+
db.pragma('auto_vacuum = INCREMENTAL');
|
|
61
|
+
db.exec('VACUUM');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
53
64
|
// If we just created a fresh DB but backup files exist, salvage from them
|
|
54
65
|
if (isNewDb) {
|
|
55
66
|
attemptSalvage(db, dbPath);
|
package/dist/types.d.ts
CHANGED
|
@@ -155,7 +155,7 @@ export interface ImplicitEntityConfig {
|
|
|
155
155
|
* Which patterns to use for detection
|
|
156
156
|
* @default ['proper-nouns']
|
|
157
157
|
*/
|
|
158
|
-
implicitPatterns?: Array<'proper-nouns' | 'quoted-terms' | 'single-caps' | 'camel-case' | 'acronyms'>;
|
|
158
|
+
implicitPatterns?: Array<'proper-nouns' | 'quoted-terms' | 'single-caps' | 'camel-case' | 'acronyms' | 'ticket-refs'>;
|
|
159
159
|
/**
|
|
160
160
|
* Regex patterns to exclude from implicit detection
|
|
161
161
|
* @default ['^The ', '^A ', '^An ', '^This ', '^That ', '^These ', '^Those ']
|
|
@@ -187,7 +187,7 @@ export interface ImplicitEntityMatch {
|
|
|
187
187
|
/** End position in content */
|
|
188
188
|
end: number;
|
|
189
189
|
/** Detection method used */
|
|
190
|
-
pattern: 'proper-nouns' | 'quoted-terms' | 'single-caps' | 'camel-case' | 'acronyms';
|
|
190
|
+
pattern: 'proper-nouns' | 'quoted-terms' | 'single-caps' | 'camel-case' | 'acronyms' | 'ticket-refs';
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
193
|
* Options for resolving alias-based wikilinks
|
package/dist/wikilinks.js
CHANGED
|
@@ -1197,7 +1197,7 @@ export function detectImplicitEntities(content, config = {}) {
|
|
|
1197
1197
|
if (!/[a-zA-Z]/.test(text))
|
|
1198
1198
|
return true;
|
|
1199
1199
|
// Common words
|
|
1200
|
-
if (
|
|
1200
|
+
if (getMergedExcludeWords().has(text.toLowerCase()))
|
|
1201
1201
|
return true;
|
|
1202
1202
|
// Exclude patterns
|
|
1203
1203
|
for (const regex of excludeRegexes) {
|
|
@@ -1339,6 +1339,20 @@ export function detectImplicitEntities(content, config = {}) {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
|
+
// Pattern 6: Ticket/issue references (FW-123, PROJ-456, JIRA-1234)
|
|
1343
|
+
if (implicitPatterns.includes('ticket-refs')) {
|
|
1344
|
+
const ticketRegex = /\b([A-Z]{2,6}-\d{1,6})\b/g;
|
|
1345
|
+
let match;
|
|
1346
|
+
while ((match = ticketRegex.exec(content)) !== null) {
|
|
1347
|
+
const text = match[1];
|
|
1348
|
+
const start = match.index;
|
|
1349
|
+
const end = start + text.length;
|
|
1350
|
+
if (!shouldExclude(text) && !isProtected(start, end)) {
|
|
1351
|
+
detected.push({ text, start, end, pattern: 'ticket-refs' });
|
|
1352
|
+
seenTexts.add(text.toLowerCase());
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1342
1356
|
// Sort by position (earliest first; longest first at same position)
|
|
1343
1357
|
detected.sort((a, b) => {
|
|
1344
1358
|
if (a.start !== b.start)
|
package/package.json
CHANGED