@solidnumber/cli 2.23.0 → 2.24.1

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 (103) hide show
  1. package/README.md +13 -6
  2. package/dist/commands/ai.d.ts.map +1 -1
  3. package/dist/commands/ai.js +83 -1
  4. package/dist/commands/ai.js.map +1 -1
  5. package/dist/commands/auth.d.ts.map +1 -1
  6. package/dist/commands/auth.js +23 -4
  7. package/dist/commands/auth.js.map +1 -1
  8. package/dist/commands/connect.d.ts.map +1 -1
  9. package/dist/commands/connect.js +9 -1
  10. package/dist/commands/connect.js.map +1 -1
  11. package/dist/commands/context.js +2 -2
  12. package/dist/commands/context.js.map +1 -1
  13. package/dist/commands/deploy.js +18 -5
  14. package/dist/commands/deploy.js.map +1 -1
  15. package/dist/commands/domains.d.ts.map +1 -1
  16. package/dist/commands/domains.js +102 -17
  17. package/dist/commands/domains.js.map +1 -1
  18. package/dist/commands/find.d.ts +17 -2
  19. package/dist/commands/find.d.ts.map +1 -1
  20. package/dist/commands/find.js +66 -14
  21. package/dist/commands/find.js.map +1 -1
  22. package/dist/commands/import.d.ts +12 -1
  23. package/dist/commands/import.d.ts.map +1 -1
  24. package/dist/commands/import.js +43 -4
  25. package/dist/commands/import.js.map +1 -1
  26. package/dist/commands/init.d.ts +22 -0
  27. package/dist/commands/init.d.ts.map +1 -1
  28. package/dist/commands/init.js +64 -4
  29. package/dist/commands/init.js.map +1 -1
  30. package/dist/commands/mcp.d.ts +1 -0
  31. package/dist/commands/mcp.d.ts.map +1 -1
  32. package/dist/commands/mcp.js +259 -7
  33. package/dist/commands/mcp.js.map +1 -1
  34. package/dist/commands/onboarding.d.ts +20 -0
  35. package/dist/commands/onboarding.d.ts.map +1 -1
  36. package/dist/commands/onboarding.js +160 -32
  37. package/dist/commands/onboarding.js.map +1 -1
  38. package/dist/commands/publish.d.ts +41 -3
  39. package/dist/commands/publish.d.ts.map +1 -1
  40. package/dist/commands/publish.js +160 -14
  41. package/dist/commands/publish.js.map +1 -1
  42. package/dist/commands/pull.d.ts.map +1 -1
  43. package/dist/commands/pull.js +2 -12
  44. package/dist/commands/pull.js.map +1 -1
  45. package/dist/commands/push.d.ts.map +1 -1
  46. package/dist/commands/push.js +2 -1
  47. package/dist/commands/push.js.map +1 -1
  48. package/dist/commands/schema.d.ts +5 -4
  49. package/dist/commands/schema.d.ts.map +1 -1
  50. package/dist/commands/schema.js +40 -13
  51. package/dist/commands/schema.js.map +1 -1
  52. package/dist/commands/switch.d.ts.map +1 -1
  53. package/dist/commands/switch.js +41 -0
  54. package/dist/commands/switch.js.map +1 -1
  55. package/dist/commands/verbs.d.ts.map +1 -1
  56. package/dist/commands/verbs.js +6 -1
  57. package/dist/commands/verbs.js.map +1 -1
  58. package/dist/data/cms-blocks.json +205 -15
  59. package/dist/index.js +43 -25
  60. package/dist/index.js.map +1 -1
  61. package/dist/lib/ai-tool-connect.d.ts +75 -0
  62. package/dist/lib/ai-tool-connect.d.ts.map +1 -0
  63. package/dist/lib/ai-tool-connect.js +155 -0
  64. package/dist/lib/ai-tool-connect.js.map +1 -0
  65. package/dist/lib/block-schema-source.d.ts +59 -0
  66. package/dist/lib/block-schema-source.d.ts.map +1 -0
  67. package/dist/lib/block-schema-source.js +173 -0
  68. package/dist/lib/block-schema-source.js.map +1 -0
  69. package/dist/lib/block-types.d.ts +5 -0
  70. package/dist/lib/block-types.d.ts.map +1 -1
  71. package/dist/lib/dns-instructions.d.ts +44 -0
  72. package/dist/lib/dns-instructions.d.ts.map +1 -0
  73. package/dist/lib/dns-instructions.js +108 -0
  74. package/dist/lib/dns-instructions.js.map +1 -0
  75. package/dist/lib/esm-import.js +1 -1
  76. package/dist/lib/mcp-providers.d.ts +162 -0
  77. package/dist/lib/mcp-providers.d.ts.map +1 -0
  78. package/dist/lib/mcp-providers.js +488 -0
  79. package/dist/lib/mcp-providers.js.map +1 -0
  80. package/dist/lib/mcp-sync.d.ts +51 -0
  81. package/dist/lib/mcp-sync.d.ts.map +1 -0
  82. package/dist/lib/mcp-sync.js +176 -0
  83. package/dist/lib/mcp-sync.js.map +1 -0
  84. package/dist/lib/mcp-tenant-check.d.ts +92 -0
  85. package/dist/lib/mcp-tenant-check.d.ts.map +1 -0
  86. package/dist/lib/mcp-tenant-check.js +220 -0
  87. package/dist/lib/mcp-tenant-check.js.map +1 -0
  88. package/dist/lib/tenant-guard.d.ts +10 -0
  89. package/dist/lib/tenant-guard.d.ts.map +1 -1
  90. package/dist/lib/tenant-guard.js +31 -2
  91. package/dist/lib/tenant-guard.js.map +1 -1
  92. package/dist/lib/ui.d.ts.map +1 -1
  93. package/dist/lib/ui.js +26 -2
  94. package/dist/lib/ui.js.map +1 -1
  95. package/dist/lib/update-notice.d.ts +30 -0
  96. package/dist/lib/update-notice.d.ts.map +1 -0
  97. package/dist/lib/update-notice.js +143 -0
  98. package/dist/lib/update-notice.js.map +1 -0
  99. package/dist/lib/verb-metadata.d.ts.map +1 -1
  100. package/dist/lib/verb-metadata.js +4 -1
  101. package/dist/lib/verb-metadata.js.map +1 -1
  102. package/package.json +4 -5
  103. package/platform-docs/llms.txt +8 -8
@@ -0,0 +1,488 @@
1
+ "use strict";
2
+ /**
3
+ * Enumerate EVERY Solid# MCP provider an AI on this machine can reach — and
4
+ * decide which company each one will actually serve.
5
+ *
6
+ * ⛔ WHY THIS EXISTS — 2026-09-15, and it is not the bug we already fixed.
7
+ *
8
+ * `mcp-tenant-check.ts` answers "does the local API key match my session?".
9
+ * That was necessary and insufficient, because it can only see credentials that
10
+ * live in a FILE. The failure Adam hit has two providers loaded at once:
11
+ *
12
+ * claude.ai Solid# https://api.solidnumber.com/mcp/connector (account-level)
13
+ * solid npx -y @solidnumber/mcp (local stdio)
14
+ *
15
+ * The first is an account-level connector. Its token was minted on the OAuth
16
+ * consent screen and is pinned to the (user, company_id) captured there; it
17
+ * lives on the backend, NOT in ~/.claude.json. `readMcpApiKey` therefore
18
+ * returns null for it, `checkMcpTenant` returns null, and the old guard
19
+ * concluded "nothing to compare" — the quietest possible answer to the loudest
20
+ * possible problem.
21
+ *
22
+ * Measured on this machine, this session:
23
+ * ~/.solid/config.json company 61 (ANGL, adam@anglebuild.com) ← the CLI
24
+ * claude.ai Solid# company 1 (Solid-dev) ← the AI
25
+ * solid (local stdio) no credential at all — /auth/me 404s
26
+ *
27
+ * Three credentials; the one the agent actually uses is the one the CLI cannot
28
+ * touch. `solid switch` moves the JWT, re-login re-mints the local key, and the
29
+ * agent goes right on reporting company 1. There was no authority deciding
30
+ * which provider wins, so the AI picked, and it picked the remote one.
31
+ *
32
+ * ⛔ THE RULE THIS MODULE ENFORCES: two active Solid# providers is not a
33
+ * preference to resolve, it is a refusal. When we cannot prove which company an
34
+ * agent will act on, we say so and stop — we never launch with a reassuring
35
+ * line. A tenant mix-up that announces itself costs a minute; one that reads
36
+ * correct and coherent about the wrong business costs whatever the agent then
37
+ * writes.
38
+ */
39
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
40
+ if (k2 === undefined) k2 = k;
41
+ var desc = Object.getOwnPropertyDescriptor(m, k);
42
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
43
+ desc = { enumerable: true, get: function() { return m[k]; } };
44
+ }
45
+ Object.defineProperty(o, k2, desc);
46
+ }) : (function(o, m, k, k2) {
47
+ if (k2 === undefined) k2 = k;
48
+ o[k2] = m[k];
49
+ }));
50
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
51
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
52
+ }) : function(o, v) {
53
+ o["default"] = v;
54
+ });
55
+ var __importStar = (this && this.__importStar) || (function () {
56
+ var ownKeys = function(o) {
57
+ ownKeys = Object.getOwnPropertyNames || function (o) {
58
+ var ar = [];
59
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
60
+ return ar;
61
+ };
62
+ return ownKeys(o);
63
+ };
64
+ return function (mod) {
65
+ if (mod && mod.__esModule) return mod;
66
+ var result = {};
67
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
68
+ __setModuleDefault(result, mod);
69
+ return result;
70
+ };
71
+ })();
72
+ Object.defineProperty(exports, "__esModule", { value: true });
73
+ exports.isSolidProvider = isSolidProvider;
74
+ exports.parseClaudeMcpList = parseClaudeMcpList;
75
+ exports.parseScope = parseScope;
76
+ exports.isActiveHealth = isActiveHealth;
77
+ exports.providersFromClaudeCli = providersFromClaudeCli;
78
+ exports.providersFromConfigFiles = providersFromConfigFiles;
79
+ exports.enumerateSolidProviders = enumerateSolidProviders;
80
+ exports.assessProviders = assessProviders;
81
+ exports.renderProviderVerdict = renderProviderVerdict;
82
+ const child_process_1 = require("child_process");
83
+ const fs = __importStar(require("fs"));
84
+ const util_1 = require("util");
85
+ const mcp_client_config_1 = require("./mcp-client-config");
86
+ const mcp_tenant_check_1 = require("./mcp-tenant-check");
87
+ const execFileAsync = (0, util_1.promisify)(child_process_1.execFile);
88
+ /**
89
+ * Is this MCP server one of ours?
90
+ *
91
+ * ⛔ Deliberately narrow. Matching /solid/ anywhere would claim "SolidWorks" or
92
+ * a customer's "solid-state" server and then refuse to launch over it — a false
93
+ * refusal trains people to pass --allow-tenant-mismatch by reflex, which
94
+ * disables the real check. Name must be `solid` as a word, or the target must
95
+ * name our package or our host.
96
+ */
97
+ function isSolidProvider(name, target) {
98
+ if (/\bsolid#?\b/i.test(name))
99
+ return true;
100
+ if (/@solidnumber\/mcp/i.test(target))
101
+ return true;
102
+ if (/(^|\/\/|\.)solidnumber\.com/i.test(target))
103
+ return true;
104
+ return false;
105
+ }
106
+ /**
107
+ * Parse `claude mcp list` stdout.
108
+ *
109
+ * The format is `name: target - health`, and BOTH separators are ambiguous:
110
+ * the target holds `://` and can hold ` - `. So we take the name up to the
111
+ * FIRST `: ` and the health after the LAST ` - `, which is the only split that
112
+ * survives `claude.ai Solid#: https://api.solidnumber.com/mcp/connector - ✔ Connected`.
113
+ */
114
+ function parseClaudeMcpList(stdout) {
115
+ const out = [];
116
+ for (const raw of stdout.split('\n')) {
117
+ const line = raw.trim();
118
+ if (!line)
119
+ continue;
120
+ // Header/status chatter from the health check pass.
121
+ if (/^Checking MCP server health/i.test(line))
122
+ continue;
123
+ if (/^No MCP servers configured/i.test(line))
124
+ continue;
125
+ const colon = line.indexOf(': ');
126
+ if (colon === -1)
127
+ continue;
128
+ const name = line.slice(0, colon).trim();
129
+ let rest = line.slice(colon + 2).trim();
130
+ if (!name || !rest)
131
+ continue;
132
+ let health = '';
133
+ const dash = rest.lastIndexOf(' - ');
134
+ if (dash !== -1) {
135
+ health = rest.slice(dash + 3).trim();
136
+ rest = rest.slice(0, dash).trim();
137
+ }
138
+ out.push({ name, target: rest, health });
139
+ }
140
+ return out;
141
+ }
142
+ /** `Scope: claude.ai config` → 'account'. That line is the whole discriminator. */
143
+ function parseScope(getStdout) {
144
+ const m = /^\s*Scope:\s*(.+)$/im.exec(getStdout);
145
+ if (!m)
146
+ return 'unknown';
147
+ const v = m[1].toLowerCase();
148
+ if (v.includes('claude.ai'))
149
+ return 'account';
150
+ // ⛔ ORDER IS LORE, NOT STYLE. The real user-scope line reads
151
+ // "User config (available in all your projects)" — it contains the word
152
+ // "projects". Testing for 'project' first classifies every user-scoped
153
+ // server as project-scoped, which sends the operator to edit a .mcp.json
154
+ // that does not exist. Caught by the fixture taken off the actual terminal.
155
+ if (/\buser\b|\blocal\b/.test(v))
156
+ return 'user';
157
+ if (v.includes('project') || v.includes('.mcp.json'))
158
+ return 'project';
159
+ return 'unknown';
160
+ }
161
+ /** A health string that means "this server is serving tools right now". */
162
+ function isActiveHealth(health) {
163
+ if (!health)
164
+ return true; // came from a file, not a health check
165
+ if (/pending|approval/i.test(health))
166
+ return false;
167
+ if (/fail|error|disconnect/i.test(health))
168
+ return false;
169
+ return /connect/i.test(health) || /✔|✓/.test(health);
170
+ }
171
+ async function defaultRunClaude(args) {
172
+ const { stdout } = await execFileAsync('claude', args, {
173
+ timeout: 20000,
174
+ maxBuffer: 4 * 1024 * 1024,
175
+ encoding: 'utf8',
176
+ });
177
+ return stdout;
178
+ }
179
+ /**
180
+ * Ask the `claude` CLI what IT loads. This is the only way to see an
181
+ * account-level connector: it is not in any file on this machine.
182
+ *
183
+ * Returns [] when `claude` is absent or errors — a missing binary is a normal
184
+ * state (Cursor-only machine), not a fault to surface.
185
+ */
186
+ async function providersFromClaudeCli(deps) {
187
+ const run = deps.runClaude ?? defaultRunClaude;
188
+ let listed;
189
+ try {
190
+ listed = parseClaudeMcpList(await run(['mcp', 'list']));
191
+ }
192
+ catch {
193
+ return [];
194
+ }
195
+ const found = [];
196
+ for (const entry of listed) {
197
+ if (!isSolidProvider(entry.name, entry.target))
198
+ continue;
199
+ let scope = 'unknown';
200
+ try {
201
+ scope = parseScope(await run(['mcp', 'get', entry.name]));
202
+ }
203
+ catch {
204
+ // Keep the provider — we know it exists, we just cannot say whose config
205
+ // it came from. Dropping it would hide the conflict we exist to report.
206
+ }
207
+ const transport = /^https?:\/\//i.test(entry.target) ? 'remote' : 'stdio';
208
+ found.push({
209
+ name: entry.name,
210
+ scope,
211
+ transport,
212
+ target: entry.target,
213
+ health: entry.health,
214
+ active: isActiveHealth(entry.health),
215
+ companyId: null,
216
+ // ⛔ An account connector's company was fixed on the consent screen and
217
+ // its token lives on the backend. There is no local read that answers
218
+ // "which company", and guessing would be the exact inference that made
219
+ // this bug invisible. Unknown is reported as unknown.
220
+ unresolved: scope === 'account'
221
+ ? 'account-level connector — its company was fixed when you approved it, and is not readable from this machine'
222
+ : 'no credential found for this server',
223
+ cliCanRepoint: scope !== 'account',
224
+ });
225
+ }
226
+ return found;
227
+ }
228
+ /**
229
+ * Solid# providers configured in client config FILES, with their key resolved
230
+ * to a company. Covers Cursor/Windsurf/Desktop, which have no `claude mcp list`.
231
+ */
232
+ async function providersFromConfigFiles(deps) {
233
+ const exists = deps.existsSync ?? fs.existsSync;
234
+ const read = deps.readFileSync ?? ((p) => fs.readFileSync(p, 'utf8'));
235
+ const clients = deps.clients ?? mcp_client_config_1.SUPPORTED_CLIENTS;
236
+ const out = [];
237
+ for (const client of clients) {
238
+ let configPath;
239
+ try {
240
+ configPath = (0, mcp_client_config_1.configPathForClient)(client);
241
+ }
242
+ catch {
243
+ continue;
244
+ }
245
+ if (!configPath || !exists(configPath))
246
+ continue;
247
+ let parsed;
248
+ try {
249
+ parsed = JSON.parse(read(configPath));
250
+ }
251
+ catch {
252
+ continue;
253
+ }
254
+ for (const [name, cfg] of Object.entries(parsed.mcpServers || {})) {
255
+ const target = cfg?.url || [cfg?.command, ...(cfg?.args || [])].filter(Boolean).join(' ');
256
+ if (!isSolidProvider(name, String(target || '')))
257
+ continue;
258
+ const apiKey = cfg?.env?.SOLID_API_KEY;
259
+ let companyId = null;
260
+ let companyName;
261
+ let unresolved;
262
+ if (apiKey && apiKey.trim()) {
263
+ const r = await (0, mcp_tenant_check_1.resolveKeyCompany)(apiKey.trim(), deps.apiUrl);
264
+ companyId = r.companyId;
265
+ companyName = r.companyName;
266
+ if (companyId === null)
267
+ unresolved = r.error || 'key did not resolve to a company';
268
+ }
269
+ else {
270
+ // ⛔ REAL, AND MEASURED HERE: the local `solid` entry had only
271
+ // SOLID_API_URL. It is configured, it health-checks as Connected, and
272
+ // it is authenticated as nobody. "Connected" is not "working".
273
+ unresolved = 'no SOLID_API_KEY in this entry — it authenticates as nobody';
274
+ }
275
+ out.push({
276
+ name,
277
+ client,
278
+ scope: 'user',
279
+ transport: cfg?.url ? 'remote' : 'stdio',
280
+ target: String(target || ''),
281
+ active: true,
282
+ configPath,
283
+ companyId,
284
+ companyName,
285
+ unresolved,
286
+ cliCanRepoint: true,
287
+ });
288
+ }
289
+ }
290
+ return out;
291
+ }
292
+ /**
293
+ * Every Solid# provider reachable from this machine, de-duplicated.
294
+ *
295
+ * When the same server appears both in `claude mcp list` and in a config file,
296
+ * we keep ONE entry and prefer the file's resolved company — the CLI read the
297
+ * actual credential there, where the CLI listing only knows a name.
298
+ */
299
+ async function enumerateSolidProviders(deps) {
300
+ const [cli, files] = await Promise.all([
301
+ providersFromClaudeCli(deps),
302
+ providersFromConfigFiles(deps),
303
+ ]);
304
+ const merged = [];
305
+ const consumed = new Set();
306
+ for (const c of cli) {
307
+ // ⛔ `claude mcp list` reports what the Claude Code CLI loads, and that
308
+ // client's user-scope file is ~/.claude.json — the 'vscode' path in
309
+ // configPathForClient. So a user-scoped entry from the listing may ONLY be
310
+ // enriched from that file. Matching any file with the same name pulls in
311
+ // Claude Desktop's separate, differently-keyed server.
312
+ const match = c.scope === 'account'
313
+ ? undefined
314
+ : files.find((f) => f.name === c.name && f.client === 'vscode');
315
+ if (match) {
316
+ consumed.add(match);
317
+ merged.push({
318
+ ...c,
319
+ client: match.client,
320
+ configPath: match.configPath,
321
+ companyId: match.companyId,
322
+ companyName: match.companyName,
323
+ unresolved: match.companyId === null ? (match.unresolved ?? c.unresolved) : undefined,
324
+ cliCanRepoint: true,
325
+ });
326
+ }
327
+ else {
328
+ merged.push(c);
329
+ }
330
+ }
331
+ // Everything else is a real, separate provider — a Cursor or Desktop server
332
+ // the `claude` CLI never reports. Adam's stale Desktop key lives here, and
333
+ // dropping it would hide a credential on the wrong company.
334
+ for (const f of files) {
335
+ if (!consumed.has(f))
336
+ merged.push(f);
337
+ }
338
+ return merged;
339
+ }
340
+ /**
341
+ * Decide whether an AI may be launched.
342
+ *
343
+ * ⛔ ORDER MATTERS, AND IT IS NOT THE OBVIOUS ONE. `conflict` outranks
344
+ * `mismatch`: if two providers are live, a matching company on one of them
345
+ * proves nothing, because nothing guarantees the agent uses that one. Measured
346
+ * on this machine, the agent used the other one.
347
+ */
348
+ function assessProviders(providers, sessionCompanyId) {
349
+ const active = providers.filter((p) => p.active);
350
+ const base = { providers, active, sessionCompanyId };
351
+ if (active.length === 0) {
352
+ return { ...base, verdict: 'none', headline: 'No Solid# connection is active — an AI here sees no business data.' };
353
+ }
354
+ if (active.length > 1) {
355
+ return {
356
+ ...base,
357
+ verdict: 'conflict',
358
+ headline: `${active.length} Solid# connections are active at once — nothing decides which one the AI uses.`,
359
+ };
360
+ }
361
+ const only = active[0];
362
+ if (only.companyId === null) {
363
+ return {
364
+ ...base,
365
+ verdict: 'unverified',
366
+ headline: `Cannot prove which company "${only.name}" serves.`,
367
+ };
368
+ }
369
+ if (sessionCompanyId && only.companyId !== sessionCompanyId) {
370
+ return {
371
+ ...base,
372
+ verdict: 'mismatch',
373
+ headline: `This session is company ${sessionCompanyId}; the AI would act on company ${only.companyId}.`,
374
+ };
375
+ }
376
+ return {
377
+ ...base,
378
+ verdict: 'ok',
379
+ headline: `One Solid# connection, on company ${only.companyId}${only.companyName ? ` (${only.companyName})` : ''}.`,
380
+ };
381
+ }
382
+ /**
383
+ * Render a verdict as operator-readable lines.
384
+ *
385
+ * ⛔ EVERY BRANCH ENDS IN A COMMAND OR A SETTING THE READER CAN ACT ON. The
386
+ * version of this that shipped told people their setup was fine, and the
387
+ * version before that said nothing at all. A diagnostic that names a problem
388
+ * without naming the fix just relocates the confusion.
389
+ */
390
+ function renderProviderVerdict(a) {
391
+ // Local import keeps mcp-providers.ts itself free of presentation deps for
392
+ // the pure-function tests.
393
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
394
+ const chalk = require('chalk');
395
+ const L = [];
396
+ const describe = (p) => {
397
+ const who = p.companyId !== null
398
+ ? chalk.bold(`company ${p.companyId}`) + (p.companyName ? chalk.dim(` (${p.companyName})`) : '')
399
+ : chalk.yellow('company unknown');
400
+ const where = p.scope === 'account'
401
+ ? chalk.dim('account connector — lives on claude.ai, not on this machine')
402
+ : chalk.dim(`${p.client ? `${p.client}: ` : ''}${p.configPath || p.scope}`);
403
+ L.push(` ${p.active ? chalk.green('●') : chalk.dim('○')} ${chalk.bold(p.name)} → ${who}`);
404
+ L.push(` ${where}`);
405
+ if (p.unresolved)
406
+ L.push(` ${chalk.dim(p.unresolved)}`);
407
+ };
408
+ if (a.verdict === 'conflict') {
409
+ // ⛔ COUNT IT, DO NOT SPELL IT. This read "Two Solid# connections" while
410
+ // the census below it listed three — the summary contradicting its own
411
+ // evidence, on the screen whose entire job is to be believed.
412
+ L.push(chalk.red.bold(` ✗ ${a.active.length} Solid# connections are active. Nothing decides which one the AI uses.`));
413
+ L.push('');
414
+ for (const p of a.active)
415
+ describe(p);
416
+ L.push('');
417
+ L.push(chalk.dim(' Measured 2026-09-15: with both live, the agent used the account'));
418
+ L.push(chalk.dim(' connector and reported on its company, not this session\'s.'));
419
+ L.push('');
420
+ L.push(` ${chalk.bold('Leave exactly one active:')}`);
421
+ const account = a.active.find((p) => p.scope === 'account');
422
+ if (account) {
423
+ L.push(` ${chalk.dim('•')} Turn off ${chalk.bold(account.name)} in ${chalk.cyan('claude.ai → Settings → Connectors')},`);
424
+ L.push(` ${chalk.dim('or re-authorize it for the company you actually want. Its company was')}`);
425
+ L.push(` ${chalk.dim('fixed when you approved it — no CLI command can move it.')}`);
426
+ }
427
+ // ⛔ NAME THE FILE, NOT JUST THE SERVER. Every client calls it "solid", so
428
+ // "keep solid" is not an instruction when three of them are listed above.
429
+ const locals = a.active.filter((p) => p.scope !== 'account');
430
+ for (const l of locals) {
431
+ const where = l.client ? `${l.client} (${l.configPath})` : l.name;
432
+ L.push(` ${chalk.dim('•')} ${chalk.bold(l.name)} in ${chalk.dim(where)}`);
433
+ }
434
+ if (locals.length) {
435
+ L.push(` ${chalk.dim('Keep ONE and point it at this session:')} ${chalk.cyan('solid mcp connect')}`);
436
+ if (locals.length > 1) {
437
+ L.push(` ${chalk.dim('Remove the others:')} ${chalk.cyan('claude mcp remove <name> -s user')} ${chalk.dim('or edit the file.')}`);
438
+ }
439
+ }
440
+ return L;
441
+ }
442
+ if (a.verdict === 'mismatch') {
443
+ const p = a.active[0];
444
+ L.push(chalk.red.bold(' ✗ The AI would act on a different company than this session.'));
445
+ L.push('');
446
+ L.push(` ${chalk.dim('This session:')} company ${chalk.bold(String(a.sessionCompanyId))}`);
447
+ L.push(` ${chalk.dim('The AI:')} company ${chalk.bold.red(String(p.companyId))}${p.companyName ? chalk.dim(` (${p.companyName})`) : ''}`);
448
+ L.push('');
449
+ for (const q of a.active)
450
+ describe(q);
451
+ L.push('');
452
+ L.push(p.cliCanRepoint
453
+ ? ` ${chalk.bold('Fix:')} ${chalk.cyan('solid mcp connect')}`
454
+ : ` ${chalk.bold('Fix:')} re-authorize it in ${chalk.cyan('claude.ai → Settings → Connectors')} — this CLI cannot move it.`);
455
+ return L;
456
+ }
457
+ if (a.verdict === 'unverified') {
458
+ const p = a.active[0];
459
+ L.push(chalk.yellow.bold(' ⚠ Cannot prove which company this AI will act on.'));
460
+ L.push('');
461
+ describe(p);
462
+ L.push('');
463
+ if (p.scope === 'account') {
464
+ L.push(chalk.dim(' An account connector carries a token minted on the consent screen and'));
465
+ L.push(chalk.dim(' held on the backend. Nothing on this machine can read or change it.'));
466
+ L.push('');
467
+ L.push(` ${chalk.bold('To be certain:')} ask the AI ${chalk.cyan('"what company do you see"')}`);
468
+ // ⛔ NAME THE PLACE. "Turn the connector off" is not an instruction if
469
+ // the reader does not know where it lives — and by definition they do
470
+ // not, because it is the one piece of this that is NOT on their machine.
471
+ L.push(` ${chalk.bold('To control it here:')} turn it off in ${chalk.cyan('claude.ai → Settings → Connectors')},`);
472
+ L.push(` ${chalk.dim('then run')} ${chalk.cyan('solid mcp connect')}`);
473
+ }
474
+ else {
475
+ L.push(` ${chalk.bold('Fix:')} ${chalk.cyan('solid mcp connect')}`);
476
+ }
477
+ return L;
478
+ }
479
+ if (a.verdict === 'none') {
480
+ L.push(chalk.yellow.bold(' ⚠ No Solid# connection is active — an AI here sees no business data.'));
481
+ L.push('');
482
+ L.push(` ${chalk.bold('Fix:')} ${chalk.cyan('solid mcp connect')}`);
483
+ return L;
484
+ }
485
+ L.push(chalk.green(` ✓ ${a.headline}`));
486
+ return L;
487
+ }
488
+ //# sourceMappingURL=mcp-providers.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,IAAI,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;QACvE,OAAO,CAAC,CAAC;IACX,CAAC;IAED,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IACzC,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Keep the MCP credential pointing at the company the CLI is actually on.
3
+ *
4
+ * ⛔ WHY — 2026-09-15.
5
+ *
6
+ * `claude` reads the MCP server config in ~/.claude.json, which holds a STATIC
7
+ * API key. The backend takes the tenant from the key record. Logging in — or
8
+ * switching — writes ~/.solid/config.json, a file the MCP server never opens.
9
+ *
10
+ * So the agent served whatever company that key was minted for, forever, and no
11
+ * login could change it. An operator logged in for one company, typed `claude`,
12
+ * and got a confident session about a different one.
13
+ *
14
+ * This closes the loop: after login/switch, if the MCP key resolves to a
15
+ * different company than the session, mint a key for the RIGHT company and
16
+ * rewrite the config. Idempotent — a matching key is left alone, so this does
17
+ * not pile up keys against the 25-per-company cap.
18
+ */
19
+ import { type McpClient } from './mcp-client-config';
20
+ export interface McpSyncResult {
21
+ /** 'ok' — already correct. 'updated' — rewritten. 'skipped' — nothing to do. */
22
+ status: 'ok' | 'updated' | 'skipped' | 'failed';
23
+ companyId: number;
24
+ /** Config files rewritten. */
25
+ written: string[];
26
+ /** Why we could not sync, when status is 'failed' or 'skipped'. */
27
+ reason?: string;
28
+ }
29
+ export interface SyncDeps {
30
+ /** Mint an API key scoped to the CURRENT session company. */
31
+ createKey: (name: string, scopes: string[]) => Promise<string>;
32
+ apiUrl: string;
33
+ }
34
+ /**
35
+ * ⛔ NOT a silent re-mint on every call. We only touch the config when the key
36
+ * present resolves to a DIFFERENT company (or there is none). Re-minting every
37
+ * login would burn the 25-active-keys-per-company limit in a fortnight and
38
+ * leave a trail of orphaned credentials nobody can attribute.
39
+ */
40
+ export declare function syncMcpCredential(companyId: number | undefined, deps: SyncDeps, clients?: McpClient[]): Promise<McpSyncResult>;
41
+ /**
42
+ * Convenience wrapper: sync using the live CLI session.
43
+ *
44
+ * Callers are `solid auth login` and `solid switch` — the two moments the
45
+ * session's company can change. Never throws: a failure here must not fail a
46
+ * login, and `solid ai` still refuses to launch on a mismatch.
47
+ */
48
+ export declare function syncMcpForCurrentCompany(): Promise<McpSyncResult>;
49
+ /** One dim line for the terminal, or null when there is nothing worth saying. */
50
+ export declare function describeMcpSync(r: McpSyncResult): string | null;
51
+ //# sourceMappingURL=mcp-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-sync.d.ts","sourceRoot":"","sources":["../../src/lib/mcp-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,qBAAqB,CAAC;AAM7B,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,MAAM,EAAE,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,6DAA6D;IAC7D,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,IAAI,EAAE,QAAQ,EACd,OAAO,GAAE,SAAS,EAAiB,GAClC,OAAO,CAAC,aAAa,CAAC,CAoExB;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,aAAa,CAAC,CAmBvE;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAQ/D"}