lace-mcp 0.0.2-alpha.30 → 0.0.2-alpha.31

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 +26 -17
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -136,7 +136,10 @@ import { join as join2 } from "node:path";
136
136
  function getAuthFilePath() {
137
137
  return join2(LACE_DATA, AUTH_FILE_NAME);
138
138
  }
139
- function buildAuthStartPayload() {
139
+ function buildAuthStartPayload(args = {}) {
140
+ if (args.forceAccountSelection) {
141
+ return { client: "mcp", email: "", forceAccountSelection: true };
142
+ }
140
143
  return { client: "mcp", email: "" };
141
144
  }
142
145
  function loadCachedCredentials() {
@@ -172,12 +175,12 @@ function openBrowser(url2) {
172
175
  function sleep(ms) {
173
176
  return new Promise((resolve3) => setTimeout(resolve3, ms));
174
177
  }
175
- async function startAuthFlow(apiBase) {
178
+ async function startAuthFlow(apiBase, options = {}) {
176
179
  try {
177
180
  const res = await fetch(`${apiBase}/authkit/start`, {
178
181
  method: "POST",
179
182
  headers: { "Content-Type": "application/json" },
180
- body: JSON.stringify(buildAuthStartPayload()),
183
+ body: JSON.stringify(buildAuthStartPayload(options)),
181
184
  signal: AbortSignal.timeout(AUTH_FETCH_TIMEOUT_MS)
182
185
  });
183
186
  if (!res.ok) throw new Error(`Auth start failed: ${res.status}`);
@@ -229,8 +232,8 @@ async function promptOrg(organizations) {
229
232
  const selected = await promptNumberedList("Which organization?", organizations, (o) => o.name);
230
233
  return selected.id;
231
234
  }
232
- async function browserLogin(apiBase = DEFAULT_API_BASE) {
233
- const { authUrl, state } = await startAuthFlow(apiBase);
235
+ async function browserLogin(apiBase = DEFAULT_API_BASE, options = {}) {
236
+ const { authUrl, state } = await startAuthFlow(apiBase, options);
234
237
  console.log("\n Opening browser to sign in...");
235
238
  openBrowser(authUrl);
236
239
  console.log(` \u2192 ${authUrl}
@@ -35253,18 +35256,23 @@ async function handleSearchDiscussion(loader, params, scope, onError) {
35253
35256
  isError: true
35254
35257
  };
35255
35258
  }
35256
- let threadId2 = params.threadId;
35257
- if (!threadId2) {
35258
- const links = await loader.loadThreadLinks(params.reviewId, scope);
35259
- if (links.length === 0) {
35260
- return {
35261
- content: [{ type: "text", text: "No discussion threads linked to this review." }],
35262
- structuredContent: { error: "no_threads", reviewId: params.reviewId }
35263
- };
35264
- }
35265
- threadId2 = links[0].thread_id;
35259
+ const links = await loader.loadThreadLinks(params.reviewId, scope);
35260
+ if (links.length === 0) {
35261
+ return {
35262
+ content: [{ type: "text", text: "No discussion threads linked to this review." }],
35263
+ structuredContent: { error: "no_threads", reviewId: params.reviewId }
35264
+ };
35265
+ }
35266
+ const link = params.threadId ? links.find((link2) => link2.thread_id === params.threadId) : links[0];
35267
+ if (!link) {
35268
+ return {
35269
+ content: [{ type: "text", text: "No discussion thread linked to this review for the requested threadId." }],
35270
+ structuredContent: { error: "thread_not_linked", reviewId: params.reviewId, threadId: params.threadId },
35271
+ isError: true
35272
+ };
35266
35273
  }
35267
- const messages = await loader.loadThreadMessages(threadId2, scope);
35274
+ const threadId2 = link.thread_id;
35275
+ const messages = await loader.loadThreadMessages(threadId2, scope, link);
35268
35276
  if (messages.length === 0) {
35269
35277
  return {
35270
35278
  content: [{ type: "text", text: "No messages in this discussion thread." }],
@@ -82226,7 +82234,8 @@ if (command === "install") {
82226
82234
  main3();
82227
82235
  } else if (command === "login") {
82228
82236
  const { browserLogin: browserLogin2 } = await Promise.resolve().then(() => (init_auth(), auth_exports));
82229
- await browserLogin2();
82237
+ const loginArgs = process.argv.slice(3);
82238
+ await browserLogin2(void 0, { forceAccountSelection: loginArgs.includes("--switch") });
82230
82239
  } else if (command === "health") {
82231
82240
  const { runHealthCheck: runHealthCheck2 } = await Promise.resolve().then(() => (init_health(), health_exports));
82232
82241
  await runHealthCheck2();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lace-mcp",
3
- "version": "0.0.2-alpha.30",
3
+ "version": "0.0.2-alpha.31",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/cli.js",