lace-mcp 0.0.2-alpha.7 → 0.0.2-alpha.8

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/dist/cli.js +63 -44
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -56,6 +56,25 @@ function getEditorConfigPath(target) {
56
56
  if (target === "cursor") return join(home, ".cursor", "mcp.json");
57
57
  return join(home, ".codex", "config.toml");
58
58
  }
59
+ function getProjectMcpConfigPath(cwd = process.cwd()) {
60
+ return join(cwd, ".mcp.json");
61
+ }
62
+ function getProjectCursorConfigPath(cwd = process.cwd()) {
63
+ return join(cwd, ".cursor", "mcp.json");
64
+ }
65
+ function getJsonMcpRefreshConfigPaths(cwd = process.cwd()) {
66
+ return [
67
+ getEditorConfigPath("claude"),
68
+ getProjectMcpConfigPath(cwd),
69
+ getEditorConfigPath("cursor"),
70
+ getProjectCursorConfigPath(cwd)
71
+ ];
72
+ }
73
+ function getJsonMcpConfigPathsForTarget(target, cwd = process.cwd()) {
74
+ if (target === "claude") return [getEditorConfigPath("claude"), getProjectMcpConfigPath(cwd)];
75
+ if (target === "cursor") return [getEditorConfigPath("cursor"), getProjectCursorConfigPath(cwd)];
76
+ return [getEditorConfigPath("claude-desktop")];
77
+ }
59
78
  var LACE_DATA, DEFAULT_API_BASE;
60
79
  var init_paths = __esm({
61
80
  "src/paths.ts"() {
@@ -65,6 +84,33 @@ var init_paths = __esm({
65
84
  }
66
85
  });
67
86
 
87
+ // src/prompt.ts
88
+ import { createInterface } from "node:readline";
89
+ function promptNumberedList(header, items, label) {
90
+ return new Promise((resolve2) => {
91
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
92
+ console.log(`
93
+ ${header}
94
+ `);
95
+ for (let i = 0; i < items.length; i++) {
96
+ console.log(` ${i + 1}. ${label(items[i])}`);
97
+ }
98
+ rl.question("\n > ", (answer) => {
99
+ rl.close();
100
+ const idx = parseInt(answer.trim(), 10) - 1;
101
+ const selected = items[idx] ?? items[0];
102
+ if (!items[idx]) console.log(` Defaulting to ${label(selected)}`);
103
+ console.log("");
104
+ resolve2(selected);
105
+ });
106
+ });
107
+ }
108
+ var init_prompt = __esm({
109
+ "src/prompt.ts"() {
110
+ "use strict";
111
+ }
112
+ });
113
+
68
114
  // src/auth.ts
69
115
  var auth_exports = {};
70
116
  __export(auth_exports, {
@@ -77,7 +123,6 @@ import { execSync } from "node:child_process";
77
123
  import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
78
124
  import { platform as platform2 } from "node:os";
79
125
  import { join as join2 } from "node:path";
80
- import { createInterface } from "node:readline";
81
126
  function getAuthFilePath() {
82
127
  return join2(LACE_DATA, AUTH_FILE_NAME);
83
128
  }
@@ -169,22 +214,9 @@ async function switchOrg(apiBase, currentToken, orgId) {
169
214
  if (!res.ok) throw new Error(`Org switch failed: ${res.status}`);
170
215
  return await res.json();
171
216
  }
172
- function promptOrg(organizations) {
173
- return new Promise((resolve2) => {
174
- const rl = createInterface({ input: process.stdin, output: process.stderr });
175
- console.log("\n Which organization?\n");
176
- for (let i = 0; i < organizations.length; i++) {
177
- console.log(` ${i + 1}. ${organizations[i].name}`);
178
- }
179
- rl.question("\n > ", (answer) => {
180
- rl.close();
181
- const idx = parseInt(answer.trim(), 10) - 1;
182
- const org = organizations[idx] ?? organizations[0];
183
- if (!organizations[idx]) console.log(` Defaulting to ${org.name}`);
184
- console.log("");
185
- resolve2(org.id);
186
- });
187
- });
217
+ async function promptOrg(organizations) {
218
+ const selected = await promptNumberedList("Which organization?", organizations, (o) => o.name);
219
+ return selected.id;
188
220
  }
189
221
  async function browserLogin(apiBase = DEFAULT_API_BASE) {
190
222
  const { authUrl, state } = await startAuthFlow(apiBase);
@@ -221,6 +253,7 @@ var init_auth = __esm({
221
253
  "src/auth.ts"() {
222
254
  "use strict";
223
255
  init_paths();
256
+ init_prompt();
224
257
  AUTH_FILE_NAME = "mcp-auth.json";
225
258
  AUTH_FETCH_TIMEOUT_MS = 1e4;
226
259
  POLL_INTERVAL_MS = 2e3;
@@ -294,7 +327,6 @@ import { execSync as execSync2 } from "node:child_process";
294
327
  import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
295
328
  import { homedir as homedir2 } from "node:os";
296
329
  import { join as join3, resolve } from "node:path";
297
- import { createInterface as createInterface2 } from "node:readline";
298
330
  function parseFlags(args) {
299
331
  const flags = {};
300
332
  for (let i = 0; i < args.length; i++) {
@@ -308,21 +340,7 @@ function parseFlags(args) {
308
340
  }
309
341
  function promptScope(target) {
310
342
  const available = target === "claude" ? SCOPES : ["user", "project"];
311
- return new Promise((promptResolve) => {
312
- const rl = createInterface2({ input: process.stdin, output: process.stderr });
313
- console.log("\n Where should Lace be installed?\n");
314
- for (let i = 0; i < available.length; i++) {
315
- console.log(` ${i + 1}. ${SCOPE_LABELS[available[i]]}`);
316
- }
317
- rl.question("\n > ", (answer) => {
318
- rl.close();
319
- const idx = parseInt(answer.trim(), 10) - 1;
320
- const scope = available[idx] ?? available[0];
321
- if (!available[idx]) console.log(` Defaulting to ${scope}`);
322
- console.log("");
323
- promptResolve(scope);
324
- });
325
- });
343
+ return promptNumberedList("Where should Lace be installed?", available, (s) => SCOPE_LABELS[s]);
326
344
  }
327
345
  async function resolveCredentials(flags) {
328
346
  if (flags.token && flags.org) {
@@ -382,12 +400,9 @@ function refreshJsonMcpEntry(configPath, env) {
382
400
  writeFileSync2(configPath, JSON.stringify(config2, null, 2));
383
401
  }
384
402
  function refreshAllLaceConfigs(env) {
385
- const claudeUserPath = getEditorConfigPath("claude");
386
- refreshJsonMcpEntry(claudeUserPath, env);
387
- const projectMcpPath = join3(process.cwd(), ".mcp.json");
388
- refreshJsonMcpEntry(projectMcpPath, env);
389
- const cursorUserPath = getEditorConfigPath("cursor");
390
- refreshJsonMcpEntry(cursorUserPath, env);
403
+ for (const configPath of getJsonMcpRefreshConfigPaths()) {
404
+ refreshJsonMcpEntry(configPath, env);
405
+ }
391
406
  }
392
407
  function writeJsonMcpEntry(configPath, entry) {
393
408
  const dir = resolve(configPath, "..");
@@ -466,7 +481,7 @@ function installClaudeDesktop(env) {
466
481
  installClaudeSkill();
467
482
  }
468
483
  function getCursorConfigPath(scope) {
469
- if (scope === "project") return join3(process.cwd(), ".cursor", "mcp.json");
484
+ if (scope === "project") return getProjectCursorConfigPath();
470
485
  return getEditorConfigPath("cursor");
471
486
  }
472
487
  function installCursor(env, scope = "user") {
@@ -520,12 +535,13 @@ var init_install = __esm({
520
535
  init_auth();
521
536
  init_codexConfig();
522
537
  init_paths();
538
+ init_prompt();
523
539
  TARGETS = ["claude", "claude-desktop", "cursor", "codex"];
524
540
  PACKAGE_NAME = "lace-mcp";
525
541
  SCOPES = ["user", "project", "local"];
526
542
  SCOPE_LABELS = {
527
543
  user: "User \u2014 available in all projects",
528
- project: "Project \u2014 this project only (shared via .mcp.json)",
544
+ project: "Project \u2014 this project only",
529
545
  local: "Local \u2014 this machine only (not shared)"
530
546
  };
531
547
  SKILL_VERSION = 1;
@@ -571,9 +587,10 @@ function uninstallClaude() {
571
587
  execSync3("claude mcp remove lace", { stdio: "inherit" });
572
588
  console.log(" \u2713 MCP server removed via claude CLI");
573
589
  } catch {
574
- removeJsonMcpEntry(getEditorConfigPath("claude"));
575
590
  }
576
- removeJsonMcpEntry(join4(process.cwd(), ".mcp.json"));
591
+ for (const configPath of getJsonMcpConfigPathsForTarget("claude")) {
592
+ removeJsonMcpEntry(configPath);
593
+ }
577
594
  removeSkillFile("claude");
578
595
  }
579
596
  function uninstallTarget(target) {
@@ -586,7 +603,9 @@ function uninstallTarget(target) {
586
603
  console.log(` \u2713 Removed lace from ${configPath}`);
587
604
  }
588
605
  } else {
589
- removeJsonMcpEntry(getEditorConfigPath(target));
606
+ for (const configPath of getJsonMcpConfigPathsForTarget(target)) {
607
+ removeJsonMcpEntry(configPath);
608
+ }
590
609
  }
591
610
  removeSkillFile(target);
592
611
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lace-mcp",
3
- "version": "0.0.2-alpha.7",
3
+ "version": "0.0.2-alpha.8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/cli.js",