@lossless-claude/lcm 0.3.0 → 0.3.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.
@@ -7,13 +7,13 @@
7
7
  },
8
8
  "plugins": [
9
9
  {
10
- "name": "lossless-claude",
10
+ "name": "lcm",
11
11
  "source": {
12
12
  "source": "github",
13
13
  "repo": "lossless-claude/lcm"
14
14
  },
15
15
  "description": "Lossless context management — DAG-based summarization that preserves every message",
16
- "version": "0.3.0",
16
+ "version": "0.3.2",
17
17
  "strict": true
18
18
  }
19
19
  ]
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "lossless-claude",
3
- "version": "0.3.0",
2
+ "name": "lcm",
3
+ "version": "0.3.2",
4
4
  "description": "Lossless context management — DAG-based summarization that preserves every message",
5
5
  "author": {
6
6
  "name": "Pedro Almeida",
@@ -13,33 +13,33 @@
13
13
  "commands": "./.claude-plugin/commands/",
14
14
  "mcpServers": {
15
15
  "lcm": {
16
- "command": "lcm",
17
- "args": ["mcp"]
16
+ "command": "node",
17
+ "args": ["${CLAUDE_PLUGIN_ROOT}/mcp.mjs"]
18
18
  }
19
19
  },
20
20
  "hooks": {
21
21
  "PreCompact": [
22
22
  {
23
23
  "matcher": "",
24
- "hooks": [{ "type": "command", "command": "lcm compact" }]
24
+ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/lcm.mjs\" compact" }]
25
25
  }
26
26
  ],
27
27
  "SessionStart": [
28
28
  {
29
29
  "matcher": "",
30
- "hooks": [{ "type": "command", "command": "lcm restore" }]
30
+ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/lcm.mjs\" restore" }]
31
31
  }
32
32
  ],
33
33
  "SessionEnd": [
34
34
  {
35
35
  "matcher": "",
36
- "hooks": [{ "type": "command", "command": "lcm session-end" }]
36
+ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/lcm.mjs\" session-end" }]
37
37
  }
38
38
  ],
39
39
  "UserPromptSubmit": [
40
40
  {
41
41
  "matcher": "",
42
- "hooks": [{ "type": "command", "command": "lcm user-prompt" }]
42
+ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/lcm.mjs\" user-prompt" }]
43
43
  }
44
44
  ]
45
45
  }
package/lcm.mjs ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ // CLI entrypoint for plugin hooks — auto-bootstraps on fresh install, then delegates to the built lcm CLI.
3
+ // Used by plugin.json hooks via ${CLAUDE_PLUGIN_ROOT}/lcm.mjs so no global binary is required.
4
+ import { execSync } from "node:child_process";
5
+ import { existsSync } from "node:fs";
6
+ import { fileURLToPath, pathToFileURL } from "node:url";
7
+ import { join, dirname } from "node:path";
8
+
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+
11
+ // Auto-bootstrap: install deps if node_modules is missing
12
+ if (!existsSync(join(__dirname, "node_modules"))) {
13
+ try {
14
+ execSync("npm install --silent", { cwd: __dirname, stdio: "pipe", timeout: 60000 });
15
+ } catch {}
16
+ }
17
+
18
+ // Auto-build: compile TypeScript if dist/ is missing (fresh GitHub install)
19
+ if (!existsSync(join(__dirname, "dist"))) {
20
+ try {
21
+ execSync("npm run build --silent", { cwd: __dirname, stdio: "pipe", timeout: 120000 });
22
+ } catch {}
23
+ }
24
+
25
+ // Delegate to the compiled CLI — process.argv passes through unchanged
26
+ const cliModule = join(__dirname, "dist", "bin", "lcm.js");
27
+ await import(pathToFileURL(cliModule).href);
package/mcp.mjs CHANGED
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env node
2
- // MCP entrypoint for plugin system — delegates to the built lcm MCP server.
2
+ // MCP entrypoint for plugin system — auto-bootstraps on fresh install, then delegates to the built lcm MCP server.
3
3
  // Uses import.meta.url to resolve paths relative to this file, so it works
4
4
  // regardless of how the plugin cache resolves ${CLAUDE_PLUGIN_ROOT}.
5
+ import { execSync } from "node:child_process";
6
+ import { existsSync } from "node:fs";
5
7
  import { fileURLToPath, pathToFileURL } from "node:url";
6
8
  import { join, dirname } from "node:path";
7
9
 
@@ -10,6 +12,21 @@ let __dirname = dirname(fileURLToPath(import.meta.url));
10
12
  if (__dirname.endsWith(".claude-plugin")) {
11
13
  __dirname = join(__dirname, "..");
12
14
  }
15
+
16
+ // Auto-bootstrap: install deps if node_modules is missing
17
+ if (!existsSync(join(__dirname, "node_modules"))) {
18
+ try {
19
+ execSync("npm install --silent", { cwd: __dirname, stdio: "pipe", timeout: 60000 });
20
+ } catch {}
21
+ }
22
+
23
+ // Auto-build: compile TypeScript if dist/ is missing (fresh GitHub install)
24
+ if (!existsSync(join(__dirname, "dist"))) {
25
+ try {
26
+ execSync("npm run build --silent", { cwd: __dirname, stdio: "pipe", timeout: 120000 });
27
+ } catch {}
28
+ }
29
+
13
30
  const serverModule = join(__dirname, "dist", "src", "mcp", "server.js");
14
31
 
15
32
  // Use file:// URL for cross-platform compatibility (notably Windows)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lossless-claude/lcm",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Never lose context again. lossless-claude compresses Claude Code sessions into searchable memory — every message preserved, every insight remembered.",
5
5
  "type": "module",
6
6
  "main": "dist/src/memory/index.js",
@@ -24,6 +24,7 @@
24
24
  "files": [
25
25
  "dist/",
26
26
  "mcp.mjs",
27
+ "lcm.mjs",
27
28
  ".claude-plugin/",
28
29
  "docs/",
29
30
  "README.md",