@wipcomputer/wip-ldm-os 0.3.3 → 0.3.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.
- package/SKILL.md +1 -1
- package/bin/ldm.js +13 -0
- package/lib/deploy.mjs +31 -11
- package/package.json +1 -1
package/SKILL.md
CHANGED
package/bin/ldm.js
CHANGED
|
@@ -45,6 +45,19 @@ try {
|
|
|
45
45
|
CATALOG = JSON.parse(readFileSync(catalogPath, 'utf8'));
|
|
46
46
|
} catch {}
|
|
47
47
|
|
|
48
|
+
// Auto-sync version.json when CLI version drifts (#33)
|
|
49
|
+
// npm install -g updates the binary but not version.json. Fix it on any CLI invocation.
|
|
50
|
+
if (existsSync(VERSION_PATH)) {
|
|
51
|
+
try {
|
|
52
|
+
const v = JSON.parse(readFileSync(VERSION_PATH, 'utf8'));
|
|
53
|
+
if (v.version && v.version !== PKG_VERSION) {
|
|
54
|
+
v.version = PKG_VERSION;
|
|
55
|
+
v.updated = new Date().toISOString();
|
|
56
|
+
writeFileSync(VERSION_PATH, JSON.stringify(v, null, 2) + '\n');
|
|
57
|
+
}
|
|
58
|
+
} catch {}
|
|
59
|
+
}
|
|
60
|
+
|
|
48
61
|
const args = process.argv.slice(2);
|
|
49
62
|
const command = args[0];
|
|
50
63
|
const DRY_RUN = args.includes('--dry-run');
|
package/lib/deploy.mjs
CHANGED
|
@@ -340,10 +340,37 @@ function installCLI(repoPath, door) {
|
|
|
340
340
|
// Build if needed (fix #6)
|
|
341
341
|
runBuildIfNeeded(repoPath);
|
|
342
342
|
|
|
343
|
+
// Prefer registry install over local install (#37).
|
|
344
|
+
// npm install -g . creates symlinks back to the source dir (often /tmp/).
|
|
345
|
+
// npm install -g @scope/pkg copies files. Only fall back to local for unpublished packages.
|
|
346
|
+
const packageName = pkg?.name;
|
|
347
|
+
const packageVersion = pkg?.version;
|
|
348
|
+
|
|
349
|
+
if (packageName && packageVersion) {
|
|
350
|
+
try {
|
|
351
|
+
// Check if this version exists on npm
|
|
352
|
+
const npmVersion = execSync(`npm view ${packageName}@${packageVersion} version 2>/dev/null`, {
|
|
353
|
+
encoding: 'utf8',
|
|
354
|
+
timeout: 15000,
|
|
355
|
+
}).trim();
|
|
356
|
+
|
|
357
|
+
if (npmVersion === packageVersion) {
|
|
358
|
+
// Install from registry (copies files, no symlinks)
|
|
359
|
+
execSync(`npm install -g ${packageName}@${packageVersion}`, { stdio: 'pipe', timeout: 60000 });
|
|
360
|
+
ensureBinExecutable(binNames);
|
|
361
|
+
ok(`CLI: ${binNames.join(', ')} installed from registry (v${packageVersion})`);
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
} catch {
|
|
365
|
+
// Registry check failed, fall through to local install
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// Fallback: local install (creates symlinks, but better than nothing)
|
|
343
370
|
try {
|
|
344
371
|
execSync('npm install -g .', { cwd: repoPath, stdio: 'pipe' });
|
|
345
372
|
ensureBinExecutable(binNames);
|
|
346
|
-
ok(`CLI: ${binNames.join(', ')} installed
|
|
373
|
+
ok(`CLI: ${binNames.join(', ')} installed locally (symlinked)`);
|
|
347
374
|
return true;
|
|
348
375
|
} catch (e) {
|
|
349
376
|
const stderr = e.stderr?.toString() || '';
|
|
@@ -362,19 +389,12 @@ function installCLI(repoPath, door) {
|
|
|
362
389
|
try {
|
|
363
390
|
execSync('npm install -g .', { cwd: repoPath, stdio: 'pipe' });
|
|
364
391
|
ensureBinExecutable(binNames);
|
|
365
|
-
ok(`CLI: ${binNames.join(', ')} installed
|
|
392
|
+
ok(`CLI: ${binNames.join(', ')} installed locally (replaced stale symlink)`);
|
|
366
393
|
return true;
|
|
367
394
|
} catch {}
|
|
368
395
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
ensureBinExecutable(binNames);
|
|
372
|
-
ok(`CLI: linked globally via npm link`);
|
|
373
|
-
return true;
|
|
374
|
-
} catch {
|
|
375
|
-
fail(`CLI: install failed. Run manually: cd "${repoPath}" && npm install -g .`);
|
|
376
|
-
return false;
|
|
377
|
-
}
|
|
396
|
+
fail(`CLI: install failed. Run manually: npm install -g ${packageName || '.'}`);
|
|
397
|
+
return false;
|
|
378
398
|
}
|
|
379
399
|
}
|
|
380
400
|
|