claude-mem-lite 2.84.1 → 2.84.2
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/install.mjs +29 -8
- package/package.json +1 -1
package/install.mjs
CHANGED
|
@@ -5,7 +5,8 @@ import { execSync, execFileSync } from 'child_process';
|
|
|
5
5
|
import { readFileSync, writeFileSync, existsSync, rmSync, mkdirSync, copyFileSync, cpSync, renameSync, symlinkSync, unlinkSync, readdirSync, statSync, lstatSync } from 'fs';
|
|
6
6
|
import { join, resolve, dirname, isAbsolute } from 'path';
|
|
7
7
|
import { homedir, tmpdir } from 'os';
|
|
8
|
-
import { fileURLToPath } from 'url';
|
|
8
|
+
import { fileURLToPath, pathToFileURL } from 'url';
|
|
9
|
+
import { createRequire } from 'node:module';
|
|
9
10
|
|
|
10
11
|
const PROJECT_DIR = resolve(import.meta.dirname ?? dirname(fileURLToPath(import.meta.url)));
|
|
11
12
|
const SETTINGS_PATH = join(homedir(), '.claude', 'settings.json');
|
|
@@ -186,9 +187,19 @@ function registerVirtualResources(rdb) {
|
|
|
186
187
|
);
|
|
187
188
|
count += changes;
|
|
188
189
|
|
|
189
|
-
// Backfill FTS5 fields for existing resources
|
|
190
|
+
// Backfill FTS5 fields for existing resources.
|
|
191
|
+
// ?N numbered placeholders REQUIRE object-form binding in better-sqlite3 —
|
|
192
|
+
// positional .run(v1, v2, …) always throws "Too many parameter values"
|
|
193
|
+
// regardless of arg count. Pre-fix this swallow-warned on every install
|
|
194
|
+
// (masked by install.mjs:785 import failure before the v2.84.2 path fix).
|
|
190
195
|
if (changes === 0) {
|
|
191
|
-
updateFts.run(
|
|
196
|
+
updateFts.run({
|
|
197
|
+
1: meta.keywords || '',
|
|
198
|
+
2: meta.tech_stack || '',
|
|
199
|
+
3: meta.use_cases || '',
|
|
200
|
+
4: type,
|
|
201
|
+
5: name,
|
|
202
|
+
});
|
|
192
203
|
}
|
|
193
204
|
}
|
|
194
205
|
|
|
@@ -285,6 +296,16 @@ function isDevInstall() {
|
|
|
285
296
|
async function install() {
|
|
286
297
|
console.log('\nclaude-mem-lite installer\n');
|
|
287
298
|
|
|
299
|
+
// Resolve dynamic imports against the installed copy at INSTALL_DIR rather
|
|
300
|
+
// than install.mjs's own directory. Lets install.mjs run correctly from a
|
|
301
|
+
// /tmp staging dir (repair flow, `curl … | tar xz | node install.mjs install`)
|
|
302
|
+
// where PROJECT_DIR has no node_modules but INSTALL_DIR does — step 2 below
|
|
303
|
+
// ran `npm install --cwd INSTALL_DIR`. Pre-fix, steps 6/7 fired
|
|
304
|
+
// "Cannot find package 'better-sqlite3' imported from /tmp/…/registry.mjs"
|
|
305
|
+
// and silently skipped registry-DB seeding + DB health check on every repair.
|
|
306
|
+
const importFromInstall = (rel) => import(pathToFileURL(join(INSTALL_DIR, rel)).href);
|
|
307
|
+
const requireFromInstall = createRequire(pathToFileURL(join(INSTALL_DIR, 'package.json')).href);
|
|
308
|
+
|
|
288
309
|
// 1. Install source files to ~/.claude-mem-lite/
|
|
289
310
|
const IS_DEV = flags.has('--dev');
|
|
290
311
|
|
|
@@ -782,7 +803,7 @@ async function install() {
|
|
|
782
803
|
(deadRepos.size > 0 ? `, ${deadRepos.size} dead removed` : ''));
|
|
783
804
|
|
|
784
805
|
// 6b. Init registry DB and record preinstalled entries
|
|
785
|
-
const { ensureRegistryDb } = await
|
|
806
|
+
const { ensureRegistryDb } = await importFromInstall('registry.mjs');
|
|
786
807
|
const regDbPath = join(DATA_DIR, 'resource-registry.db');
|
|
787
808
|
const rdb = ensureRegistryDb(regDbPath);
|
|
788
809
|
|
|
@@ -830,7 +851,7 @@ async function install() {
|
|
|
830
851
|
|
|
831
852
|
// 6d. Scan and index resources (fallback-only, Haiku indexing deferred to first run)
|
|
832
853
|
log(' Scanning resources...');
|
|
833
|
-
const { scanAllResources, diffResources } = await
|
|
854
|
+
const { scanAllResources, diffResources } = await importFromInstall('registry-scanner.mjs');
|
|
834
855
|
const scanned = scanAllResources({ dataDir: DATA_DIR });
|
|
835
856
|
|
|
836
857
|
// Attach star counts and repo URLs
|
|
@@ -846,7 +867,7 @@ async function install() {
|
|
|
846
867
|
if (toIndex.length > 0) {
|
|
847
868
|
// Use fallback indexing at install time (no Haiku calls)
|
|
848
869
|
// Full Haiku indexing happens on first SessionStart
|
|
849
|
-
const { upsertResource } = await
|
|
870
|
+
const { upsertResource } = await importFromInstall('registry.mjs');
|
|
850
871
|
for (const res of toIndex) {
|
|
851
872
|
try {
|
|
852
873
|
const metaKey = `${res.type}:${res.name}`;
|
|
@@ -892,7 +913,7 @@ async function install() {
|
|
|
892
913
|
// 7. Verify database
|
|
893
914
|
if (existsSync(DB_PATH)) {
|
|
894
915
|
try {
|
|
895
|
-
const Database = (
|
|
916
|
+
const Database = requireFromInstall('better-sqlite3');
|
|
896
917
|
const db = new Database(DB_PATH, { readonly: true });
|
|
897
918
|
const count = db.prepare('SELECT COUNT(*) as c FROM observations').get();
|
|
898
919
|
db.close();
|
|
@@ -914,7 +935,7 @@ async function install() {
|
|
|
914
935
|
const remote = execFileSync('git', ['-C', PROJECT_DIR, 'config', '--get', 'remote.origin.url'], { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
915
936
|
const isDogfood = /github\.com[:/]sdsrss\/claude-mem-lite(\.git)?$/i.test(remote);
|
|
916
937
|
if (isDogfood) {
|
|
917
|
-
const { cmdAdopt } = await
|
|
938
|
+
const { cmdAdopt } = await importFromInstall('adopt-cli.mjs');
|
|
918
939
|
cmdAdopt([]);
|
|
919
940
|
ok('Invited-memory: auto-adopt for claude-mem-lite dogfood repo');
|
|
920
941
|
}
|