@wipcomputer/wip-ldm-os 0.4.19 → 0.4.20
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 +26 -1
- package/package.json +1 -1
package/SKILL.md
CHANGED
package/bin/ldm.js
CHANGED
|
@@ -655,6 +655,31 @@ function autoDetectExtensions() {
|
|
|
655
655
|
async function cmdInstallCatalog() {
|
|
656
656
|
// No lock here. cmdInstall() already holds it when calling this.
|
|
657
657
|
|
|
658
|
+
// Self-update: check if CLI itself is outdated. Update first, then re-exec.
|
|
659
|
+
// This breaks the chicken-and-egg: new features in ldm install are always
|
|
660
|
+
// available because the installer upgrades itself before doing anything else.
|
|
661
|
+
if (!DRY_RUN && !process.env.LDM_SELF_UPDATED) {
|
|
662
|
+
try {
|
|
663
|
+
const latest = execSync('npm view @wipcomputer/wip-ldm-os version 2>/dev/null', {
|
|
664
|
+
encoding: 'utf8', timeout: 15000,
|
|
665
|
+
}).trim();
|
|
666
|
+
if (latest && latest !== PKG_VERSION) {
|
|
667
|
+
console.log(` LDM OS CLI v${PKG_VERSION} -> v${latest}. Updating first...`);
|
|
668
|
+
try {
|
|
669
|
+
execSync(`npm install -g @wipcomputer/wip-ldm-os@${latest}`, { stdio: 'inherit', timeout: 60000 });
|
|
670
|
+
console.log(` CLI updated to v${latest}. Re-running with new code...`);
|
|
671
|
+
console.log('');
|
|
672
|
+
// Re-exec with the new binary. LDM_SELF_UPDATED prevents infinite loop.
|
|
673
|
+
const newArgs = process.argv.slice(1);
|
|
674
|
+
execSync(`LDM_SELF_UPDATED=1 ldm ${newArgs.join(' ')}`, { stdio: 'inherit' });
|
|
675
|
+
process.exit(0);
|
|
676
|
+
} catch (e) {
|
|
677
|
+
console.log(` ! Self-update failed: ${e.message}. Continuing with v${PKG_VERSION}.`);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
} catch {}
|
|
681
|
+
}
|
|
682
|
+
|
|
658
683
|
autoDetectExtensions();
|
|
659
684
|
|
|
660
685
|
const { detectSystemState, reconcileState, formatReconciliation } = await import('../lib/state.mjs');
|
|
@@ -811,7 +836,7 @@ async function cmdInstallCatalog() {
|
|
|
811
836
|
console.log(' Summary');
|
|
812
837
|
console.log(' ────────────────────────────────────');
|
|
813
838
|
if (cliLatest && cliLatest !== PKG_VERSION) {
|
|
814
|
-
console.log(` LDM OS CLI v${PKG_VERSION} -> v${cliLatest} (
|
|
839
|
+
console.log(` LDM OS CLI v${PKG_VERSION} -> v${cliLatest} (auto-updates on install)`);
|
|
815
840
|
} else {
|
|
816
841
|
console.log(` LDM OS CLI v${PKG_VERSION} (latest)`);
|
|
817
842
|
}
|