@lightupai/polaris 0.0.37 → 0.0.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightupai/polaris",
3
- "version": "0.0.37",
3
+ "version": "0.0.38",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "polaris": "bin/polaris",
@@ -267,17 +267,22 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
267
267
  try {
268
268
  const res = await daemonGet("/team");
269
269
  if (res.ok) {
270
- const body = await res.json() as { members: Array<{ name: string; participant_id: string | null; slack_id: string | null; slack_handle: string | null; slack_display: string | null; polaris_user: boolean }> };
270
+ const body = await res.json() as { members: Array<{ name: string; participant_id: string | null; slack_id: string | null; slack_handle: string | null; slack_display: string | null; polaris_user: boolean; alias: string | null }> };
271
271
  if (body.members.length === 0) {
272
272
  return { content: [{ type: "text", text: "No team members found." }] };
273
273
  }
274
274
  const taggable = body.members.filter((m) => m.slack_id && m.slack_handle);
275
275
  const list = taggable
276
- .map((m) => ` @${m.slack_handle} — ${m.name}${m.polaris_user ? " ✓" : ""} [${m.slack_id}]`)
276
+ .map((m) => {
277
+ const shortAlias = m.alias && m.alias !== m.slack_handle ? `@${m.alias}` : "";
278
+ const handle = `@${m.slack_handle}`;
279
+ const display = shortAlias ? `${shortAlias} (${handle})` : handle;
280
+ return ` ${display} — ${m.name}${m.polaris_user ? " ✓" : ""} [${m.slack_id}]`;
281
+ })
277
282
  .join("\n");
278
283
  const notTaggable = body.members.filter((m) => !m.slack_id);
279
284
  const note = notTaggable.length > 0 ? `\n\nNot on Slack: ${notTaggable.map(m => m.name).join(", ")}` : "";
280
- return { content: [{ type: "text", text: `Team members (use @handle to tag, ✓ = Polaris user):\n${list}${note}` }] };
285
+ return { content: [{ type: "text", text: `Team (use @alias or @handle to tag, ✓ = Polaris user):\n${list}${note}` }] };
281
286
  }
282
287
  return { content: [{ type: "text", text: "Failed to fetch team list." }] };
283
288
  } catch {
@@ -502,6 +502,26 @@ export async function startServer(opts: {
502
502
  }
503
503
  }
504
504
 
505
+ // Generate short aliases from first name, disambiguate collisions
506
+ const aliasCounts = new Map<string, number>();
507
+ for (const m of team) {
508
+ const firstName = m.name.split(/\s+/)[0]?.toLowerCase().replace(/[^a-z]/g, "") || "";
509
+ if (firstName) aliasCounts.set(firstName, (aliasCounts.get(firstName) ?? 0) + 1);
510
+ }
511
+ for (const m of team) {
512
+ const parts = m.name.split(/\s+/);
513
+ const firstName = parts[0]?.toLowerCase().replace(/[^a-z]/g, "") || "";
514
+ if (!firstName) {
515
+ (m as Record<string, unknown>).alias = null;
516
+ } else if ((aliasCounts.get(firstName) ?? 0) > 1 && parts.length > 1) {
517
+ // Collision — append first letter of last name
518
+ const lastInitial = parts[parts.length - 1]?.[0]?.toLowerCase() ?? "";
519
+ (m as Record<string, unknown>).alias = `${firstName}${lastInitial}`;
520
+ } else {
521
+ (m as Record<string, unknown>).alias = firstName;
522
+ }
523
+ }
524
+
505
525
  return json({ members: team });
506
526
  }
507
527