@spuentesp/lain-mcp 0.12.1 → 0.14.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/install.js +20 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spuentesp/lain-mcp",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "mcpName": "io.github.spuentesp/lain",
5
5
  "description": "High-performance knowledge graph MCP server for AI coding agents with semantic search.",
6
6
  "keywords": [
@@ -1,14 +1,30 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ const { spawnSync } = require('child_process');
3
4
  const { ensureBinary } = require('./runtime');
4
5
 
6
+ // Semantic search needs the default embedding model. A failed model install
7
+ // does not fail the package install; `lain models install` retries it.
8
+ function installModel(binary) {
9
+ if (process.env.LAIN_SKIP_MODEL_INSTALL === '1') {
10
+ return;
11
+ }
12
+ process.stderr.write('Installing the semantic search model (LAIN_SKIP_MODEL_INSTALL=1 skips it)...\n');
13
+ const result = spawnSync(binary, ['models', 'install'], { stdio: 'inherit' });
14
+ if (result.status !== 0) {
15
+ process.stderr.write('Model install failed. Retry later with: lain models install\n');
16
+ }
17
+ }
18
+
5
19
  if (process.env.CI && !process.env.LAIN_FORCE_INSTALL) {
6
20
  process.stderr.write('Skipping Lain download in CI; set LAIN_FORCE_INSTALL=1 to test installation.\n');
7
21
  } else if (process.env.npm_config_ignore_scripts === 'true') {
8
22
  process.stderr.write('Skipping Lain download because npm scripts are disabled.\n');
9
23
  } else {
10
- ensureBinary().catch((error) => {
11
- process.stderr.write(`Lain installation failed: ${error.message}\n`);
12
- process.exitCode = 1;
13
- });
24
+ ensureBinary()
25
+ .then((binary) => installModel(binary))
26
+ .catch((error) => {
27
+ process.stderr.write(`Lain installation failed: ${error.message}\n`);
28
+ process.exitCode = 1;
29
+ });
14
30
  }