@wipcomputer/wip-ldm-os 0.2.11 → 0.2.13
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/README.md +1 -1
- package/SKILL.md +1 -1
- package/bin/ldm.js +20 -2
- package/lib/deploy.mjs +19 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/SKILL.md
CHANGED
package/bin/ldm.js
CHANGED
|
@@ -46,6 +46,7 @@ const DRY_RUN = args.includes('--dry-run');
|
|
|
46
46
|
const JSON_OUTPUT = args.includes('--json');
|
|
47
47
|
const YES_FLAG = args.includes('--yes') || args.includes('-y');
|
|
48
48
|
const NONE_FLAG = args.includes('--none');
|
|
49
|
+
const FIX_FLAG = args.includes('--fix');
|
|
49
50
|
|
|
50
51
|
function readJSON(path) {
|
|
51
52
|
try {
|
|
@@ -606,13 +607,30 @@ async function cmdDoctor() {
|
|
|
606
607
|
console.log(formatReconciliation(reconciled, { verbose: true }));
|
|
607
608
|
|
|
608
609
|
// Count issues from reconciliation
|
|
609
|
-
|
|
610
|
-
|
|
610
|
+
const registeredMissing = [];
|
|
611
|
+
for (const [name, entry] of Object.entries(reconciled)) {
|
|
612
|
+
if (entry.status === 'registered-missing') {
|
|
613
|
+
issues++;
|
|
614
|
+
registeredMissing.push(name);
|
|
615
|
+
}
|
|
611
616
|
if (entry.issues.length > 0 && entry.status !== 'installed-unlinked' && entry.status !== 'external') {
|
|
612
617
|
issues += entry.issues.length;
|
|
613
618
|
}
|
|
614
619
|
}
|
|
615
620
|
|
|
621
|
+
// --fix: clean up registered-missing entries
|
|
622
|
+
if (FIX_FLAG && registeredMissing.length > 0) {
|
|
623
|
+
const registry = readJSON(REGISTRY_PATH);
|
|
624
|
+
if (registry?.extensions) {
|
|
625
|
+
for (const name of registeredMissing) {
|
|
626
|
+
delete registry.extensions[name];
|
|
627
|
+
console.log(` + Removed stale registry entry: ${name}`);
|
|
628
|
+
issues--;
|
|
629
|
+
}
|
|
630
|
+
writeFileSync(REGISTRY_PATH, JSON.stringify(registry, null, 2) + '\n');
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
616
634
|
// 4. Check sacred locations
|
|
617
635
|
const sacred = [
|
|
618
636
|
{ path: join(LDM_ROOT, 'memory'), label: 'memory/' },
|
package/lib/deploy.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import { execSync } from 'node:child_process';
|
|
12
12
|
import {
|
|
13
|
-
existsSync, readFileSync, writeFileSync, cpSync, mkdirSync,
|
|
13
|
+
existsSync, readFileSync, writeFileSync, copyFileSync, cpSync, mkdirSync,
|
|
14
14
|
lstatSync, readlinkSync, unlinkSync, chmodSync, readdirSync,
|
|
15
15
|
renameSync, rmSync, statSync,
|
|
16
16
|
} from 'node:fs';
|
|
@@ -523,10 +523,26 @@ function installClaudeCodeHook(repoPath, door) {
|
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
const toolName = basename(repoPath);
|
|
526
|
-
const
|
|
526
|
+
const extDir = join(LDM_EXTENSIONS, toolName);
|
|
527
|
+
const installedGuard = join(extDir, 'guard.mjs');
|
|
528
|
+
|
|
529
|
+
// Deploy guard.mjs to ~/.ldm/extensions/{toolName}/ if not already there
|
|
530
|
+
const srcGuard = join(repoPath, 'guard.mjs');
|
|
531
|
+
if (!existsSync(installedGuard) && existsSync(srcGuard)) {
|
|
532
|
+
try {
|
|
533
|
+
if (!existsSync(extDir)) mkdirSync(extDir, { recursive: true });
|
|
534
|
+
copyFileSync(srcGuard, installedGuard);
|
|
535
|
+
// Also copy package.json for metadata
|
|
536
|
+
const srcPkg = join(repoPath, 'package.json');
|
|
537
|
+
if (existsSync(srcPkg)) copyFileSync(srcPkg, join(extDir, 'package.json'));
|
|
538
|
+
} catch (e) {
|
|
539
|
+
// Non-fatal: fall back to source path
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
527
543
|
const hookCommand = existsSync(installedGuard)
|
|
528
544
|
? `node ${installedGuard}`
|
|
529
|
-
: (door.command || `node "${
|
|
545
|
+
: (door.command || `node "${srcGuard}"`);
|
|
530
546
|
|
|
531
547
|
if (DRY_RUN) {
|
|
532
548
|
ok(`Claude Code: would add ${door.event || 'PreToolUse'} hook (dry run)`);
|