@indexnetwork/cli 0.10.9 → 0.10.10-rc.38.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 (2) hide show
  1. package/dist/index.js +44 -35
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -1376,6 +1376,9 @@ function memberTable(members) {
1376
1376
  console.log(` ${name.padEnd(nameW)} ${email.padEnd(emailW)} ${role.padEnd(roleW)} ${GRAY}${date}${RESET}`);
1377
1377
  }
1378
1378
  }
1379
+ function participantName(p) {
1380
+ return p.name ?? p.user?.name ?? p.participantId;
1381
+ }
1379
1382
  function conversationTable(conversations) {
1380
1383
  if (conversations.length === 0) {
1381
1384
  dim(" No conversations found.");
@@ -1388,7 +1391,7 @@ function conversationTable(conversations) {
1388
1391
  console.log(` ${GRAY}${"-".repeat(idWidth)} ${"-".repeat(participantsWidth)} ${"-".repeat(dateWidth)}${RESET}`);
1389
1392
  for (const c of conversations) {
1390
1393
  const shortId = c.id.slice(0, 8);
1391
- const names = c.participants.map((p) => p.name ?? p.user?.name ?? p.participantId).join(", ").slice(0, participantsWidth);
1394
+ const names = c.participants.map(participantName).join(", ").slice(0, participantsWidth);
1392
1395
  const date = new Date(c.createdAt).toLocaleDateString("en-US", {
1393
1396
  year: "numeric",
1394
1397
  month: "short",
@@ -1403,7 +1406,7 @@ function conversationCard(conversation) {
1403
1406
  console.log(` ${GRAY}${"─".repeat(40)}${RESET}`);
1404
1407
  console.log(` ${BOLD}ID${RESET} ${GRAY}${conversation.id}${RESET}`);
1405
1408
  if (conversation.participants.length > 0) {
1406
- const names = conversation.participants.map((p) => p.name ?? p.user?.name ?? p.participantId).join(", ");
1409
+ const names = conversation.participants.map(participantName).join(", ");
1407
1410
  console.log(` ${BOLD}Participants${RESET} ${names}`);
1408
1411
  }
1409
1412
  const date = new Date(conversation.createdAt).toLocaleDateString("en-US", {
@@ -1835,38 +1838,24 @@ async function handleOpportunity(client, subcommand, options) {
1835
1838
  }
1836
1839
  const hint = options.positionals?.slice(1).join(" ") || undefined;
1837
1840
  await discoverIntroduction(client, userA, userB, hint, options.json);
1838
- } else if (options.target) {
1839
- if (!options.json)
1840
- info("Discovering opportunities...");
1841
- const result = await client.callTool("discover_opportunities", {
1842
- targetUserId: options.target,
1843
- searchQuery: query
1844
- });
1845
- if (options.json) {
1846
- console.log(JSON.stringify(result));
1847
- return;
1848
- }
1849
- if (!result.success) {
1850
- error(result.error ?? "Discovery failed", 1);
1851
- return;
1852
- }
1853
- success("Discovery complete.");
1854
- renderDiscovery(result.data);
1855
- } else {
1856
- if (!options.json)
1857
- info("Discovering opportunities...");
1858
- const result = await client.callTool("discover_opportunities", { searchQuery: query });
1859
- if (options.json) {
1860
- console.log(JSON.stringify(result));
1861
- return;
1862
- }
1863
- if (!result.success) {
1864
- error(result.error ?? "Discovery failed", 1);
1865
- return;
1866
- }
1867
- success("Discovery complete.");
1868
- renderDiscovery(result.data);
1841
+ return;
1869
1842
  }
1843
+ if (!options.json)
1844
+ info("Discovering opportunities...");
1845
+ const result = await client.callTool("discover_opportunities", {
1846
+ ...options.target ? { targetUserId: options.target } : {},
1847
+ searchQuery: query
1848
+ });
1849
+ if (options.json) {
1850
+ console.log(JSON.stringify(result));
1851
+ return;
1852
+ }
1853
+ if (!result.success) {
1854
+ error(result.error ?? "Discovery failed", 1);
1855
+ return;
1856
+ }
1857
+ success("Discovery complete.");
1858
+ renderDiscovery(result.data);
1870
1859
  return;
1871
1860
  }
1872
1861
  default:
@@ -2119,6 +2108,16 @@ function roleLabel2(role) {
2119
2108
  return `${GRAY2}-${RESET2}`;
2120
2109
  }
2121
2110
  }
2111
+ function actionColorFor(action) {
2112
+ switch (action) {
2113
+ case "accept":
2114
+ return GREEN2;
2115
+ case "reject":
2116
+ return RED;
2117
+ default:
2118
+ return BLUE2;
2119
+ }
2120
+ }
2122
2121
  function negotiationTable(negotiations) {
2123
2122
  if (negotiations.length === 0) {
2124
2123
  dim(" No negotiations found.");
@@ -2170,7 +2169,7 @@ function negotiationCard(n) {
2170
2169
  minute: "2-digit",
2171
2170
  second: "2-digit"
2172
2171
  });
2173
- const actionColor = t.action === "accept" ? GREEN2 : t.action === "reject" ? RED : BLUE2;
2172
+ const actionColor = actionColorFor(t.action);
2174
2173
  console.log(` ${DIM2}Turn ${i + 1}${RESET2} ${CYAN2}${t.speaker?.name ?? "?"}${RESET2} ${actionColor}${t.action}${RESET2} ${GRAY2}${time}${RESET2}`);
2175
2174
  if (t.suggestedRoles) {
2176
2175
  console.log(` ${DIM2} roles: own=${t.suggestedRoles.ownUser ?? "?"} other=${t.suggestedRoles.otherUser ?? "?"}${RESET2}`);
@@ -3150,7 +3149,17 @@ async function runLogin(apiUrlOverride, appUrlOverride, manualToken) {
3150
3149
  ${authUrl}
3151
3150
  `);
3152
3151
  try {
3153
- const opener = process.platform === "darwin" ? "open" : process.platform === "linux" ? "xdg-open" : null;
3152
+ let opener;
3153
+ switch (process.platform) {
3154
+ case "darwin":
3155
+ opener = "open";
3156
+ break;
3157
+ case "linux":
3158
+ opener = "xdg-open";
3159
+ break;
3160
+ default:
3161
+ opener = null;
3162
+ }
3154
3163
  if (opener) {
3155
3164
  const child = spawn(opener, [authUrl], { stdio: "ignore", detached: true });
3156
3165
  child.on("error", () => {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/cli",
3
- "version": "0.10.9",
3
+ "version": "0.10.10-rc.38.1",
4
4
  "description": "Command-line interface for Index Network",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -20,10 +20,10 @@
20
20
  "publish:all": "bun scripts/publish.ts"
21
21
  },
22
22
  "optionalDependencies": {
23
- "@indexnetwork/cli-linux-x64": "0.10.9",
24
- "@indexnetwork/cli-linux-arm64": "0.10.9",
25
- "@indexnetwork/cli-darwin-x64": "0.10.9",
26
- "@indexnetwork/cli-darwin-arm64": "0.10.9"
23
+ "@indexnetwork/cli-linux-x64": "0.10.10-rc.38.1",
24
+ "@indexnetwork/cli-linux-arm64": "0.10.10-rc.38.1",
25
+ "@indexnetwork/cli-darwin-x64": "0.10.10-rc.38.1",
26
+ "@indexnetwork/cli-darwin-arm64": "0.10.10-rc.38.1"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/bun": "latest"