ai-lens 0.8.111 → 0.8.112

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/.commithash CHANGED
@@ -1 +1 @@
1
- c982dc2
1
+ 1411e25
package/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  History of changes to the `ai-lens` CLI package on npm. New entries go on top. Format: `## X.Y.Z — YYYY-MM-DD`, followed by user-facing bullets.
4
4
 
5
+ ## 0.8.112 — 2026-06-23
6
+ - feat: re-running `init --yes` no longer changes your MCP registration. On an already-set-up install it's left exactly as-is — if MCP is registered it stays (same scope), if it isn't it's left off — instead of being removed-and-re-added at user scope (which could migrate its scope, force it on, or drop it if the re-add failed). Fresh installs still register MCP; use `init --mcp-only` to deliberately (re)register.
7
+
5
8
  ## 0.8.111 — 2026-06-23
6
9
  - fix(status): case-fold project-filter-mismatch buckets on Windows
7
10
  - fix(client): tolerate Cursor Windows mojibake paths in project_filter
package/cli/init.js CHANGED
@@ -66,6 +66,24 @@ export function importMode(flags = {}) {
66
66
  return 'prompt'; // interactive: ask
67
67
  }
68
68
 
69
+ // How the FULL init flow should handle the MCP registration. Returns:
70
+ // 'skip' — never touch MCP (today's --no-mcp behavior; existing reg left intact)
71
+ // 'preserve' — existing install under --yes: leave MCP exactly as-is (no add/remove/migrate)
72
+ // 'setup' — fresh install under --yes, or interactive: register (onboarding / prompt)
73
+ //
74
+ // On an EXISTING install under --yes, MCP is ALWAYS preserved — neither --project-hooks
75
+ // nor --mcp-scope re-registers it. This stops `setupMcpServers` (which removes at all
76
+ // scopes then re-adds at one) from migrating an existing local/project registration to
77
+ // `user`, force-adding MCP for someone who never had it, or leaving MCP removed-but-not-
78
+ // re-added when the `claude mcp add` fails. The only explicit (re)register path is the
79
+ // separate `--mcp-only` branch, which never reaches this gate.
80
+ // "Existing install" = a prior auth token in config (read before this run authenticates).
81
+ export function mcpSetupAction({ noMcp, auto, hasToken } = {}) {
82
+ if (noMcp) return 'skip';
83
+ if (auto && hasToken) return 'preserve';
84
+ return 'setup';
85
+ }
86
+
69
87
  function getJson(url) {
70
88
  return new Promise((resolve, reject) => {
71
89
  const parsed = new URL(url);
@@ -1305,14 +1323,23 @@ export default async function init() {
1305
1323
  // --project-hooks installs hooks at project scope, so mirror that for the MCP:
1306
1324
  // default the scope to local and target the project .cursor/mcp.json (an explicit
1307
1325
  // --mcp-scope still wins; setupMcpServers maps scope → Cursor target).
1308
- if (!flags.noMcp) {
1326
+ const mcpAction = mcpSetupAction({
1327
+ noMcp: flags.noMcp,
1328
+ auto,
1329
+ hasToken: Boolean(currentConfig.authToken),
1330
+ });
1331
+ if (mcpAction === 'setup') {
1309
1332
  await setupMcpServers(serverUrl, {
1310
1333
  auto,
1311
1334
  mcpScope: flags.mcpScope,
1312
1335
  forcedScope: (flags.projectHooks && !flags.mcpScope) ? 'local' : null,
1313
1336
  projectRoot: flags.projectHooks ? resolve(process.cwd()) : null,
1314
1337
  });
1338
+ } else if (mcpAction === 'preserve') {
1339
+ // Existing install under --yes: leave the current MCP registration untouched.
1340
+ info(' MCP: сохранён как есть (для (пере)регистрации — npx -y ai-lens init --mcp-only)');
1315
1341
  }
1342
+ // 'skip' (--no-mcp) → do nothing; an existing registration is left intact.
1316
1343
 
1317
1344
  // Quick verification
1318
1345
  heading('Verification');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-lens",
3
- "version": "0.8.111",
3
+ "version": "0.8.112",
4
4
  "type": "module",
5
5
  "description": "Centralized session analytics for AI coding tools",
6
6
  "bin": {