@indexnetwork/cli 0.9.1 → 0.9.2

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 (3) hide show
  1. package/README.md +1 -0
  2. package/dist/index.js +214 -100
  3. package/package.json +5 -5
package/README.md CHANGED
@@ -280,6 +280,7 @@ cli/
280
280
  contact.command.ts Contact subcommand handlers
281
281
  scrape.command.ts URL scraping command handler
282
282
  sync.command.ts Context sync command handler
283
+ onboarding.command.ts Onboarding command handler
283
284
  output/ Terminal formatting, colors, markdown renderer
284
285
  api.client.ts Typed HTTP client for the protocol API
285
286
  auth.store.ts Credential persistence (~/.index/credentials.json)
package/dist/index.js CHANGED
@@ -267,11 +267,6 @@ class ApiClient {
267
267
  const body = await res.json();
268
268
  return body.user;
269
269
  }
270
- async syncProfile() {
271
- const res = await this.post("/api/profiles/sync");
272
- const body = await res.json();
273
- return body;
274
- }
275
270
  async listOpportunities(opts) {
276
271
  const params = new URLSearchParams;
277
272
  if (opts?.status)
@@ -288,10 +283,6 @@ class ApiClient {
288
283
  const res = await this.get(`/api/opportunities/${id}`);
289
284
  return await res.json();
290
285
  }
291
- async updateOpportunityStatus(id, status) {
292
- const res = await this.patch(`/api/opportunities/${id}/status`, { status });
293
- return await res.json();
294
- }
295
286
  async streamChat(params) {
296
287
  const res = await fetch(`${this.baseUrl}/api/chat/stream`, {
297
288
  method: "POST",
@@ -327,14 +318,6 @@ class ApiClient {
327
318
  const body = await res.json();
328
319
  return body.intent;
329
320
  }
330
- async processIntent(content) {
331
- const res = await this.post("/api/intents/process", { content });
332
- return await res.json();
333
- }
334
- async archiveIntent(id) {
335
- const res = await this.patch(`/api/intents/${id}/archive`);
336
- return await res.json();
337
- }
338
321
  async listNetworks() {
339
322
  const res = await this.get("/api/indexes");
340
323
  const body = await res.json();
@@ -456,20 +439,6 @@ class ApiClient {
456
439
  }
457
440
  return res;
458
441
  }
459
- async patch(path, body) {
460
- const res = await fetch(`${this.baseUrl}${path}`, {
461
- method: "PATCH",
462
- headers: {
463
- "Content-Type": "application/json",
464
- Authorization: `Bearer ${this.token}`
465
- },
466
- ...body !== undefined ? { body: JSON.stringify(body) } : {}
467
- });
468
- if (!res.ok) {
469
- await this.handleError(res);
470
- }
471
- return res;
472
- }
473
442
  async del(path) {
474
443
  const res = await fetch(`${this.baseUrl}${path}`, {
475
444
  method: "DELETE",
@@ -1354,7 +1323,7 @@ function messageList(messages) {
1354
1323
  // src/profile.command.ts
1355
1324
  async function handleProfile(client, subcommand, positionals, options = {}) {
1356
1325
  if (subcommand === "create") {
1357
- await profileCreate(client, options);
1326
+ await profileCreate(client, options, options?.json);
1358
1327
  return;
1359
1328
  }
1360
1329
  if (subcommand === "update") {
@@ -1363,11 +1332,11 @@ async function handleProfile(client, subcommand, positionals, options = {}) {
1363
1332
  error("Usage: index profile update <action> [--details <text>]", 1);
1364
1333
  return;
1365
1334
  }
1366
- await profileUpdate(client, action, options.details);
1335
+ await profileUpdate(client, action, options.details, options?.json);
1367
1336
  return;
1368
1337
  }
1369
1338
  if (subcommand === "sync") {
1370
- await profileSync(client);
1339
+ await profileSync(client, options?.json);
1371
1340
  return;
1372
1341
  }
1373
1342
  if (subcommand === "show") {
@@ -1376,7 +1345,7 @@ async function handleProfile(client, subcommand, positionals, options = {}) {
1376
1345
  error("Usage: index profile show <user-id>", 1);
1377
1346
  return;
1378
1347
  }
1379
- await profileShow(client, userId);
1348
+ await profileShow(client, userId, options?.json);
1380
1349
  return;
1381
1350
  }
1382
1351
  if (subcommand === "search") {
@@ -1408,26 +1377,63 @@ async function handleProfile(client, subcommand, positionals, options = {}) {
1408
1377
  console.log();
1409
1378
  return;
1410
1379
  }
1411
- await profileMe(client);
1380
+ await profileMe(client, options?.json);
1412
1381
  }
1413
- async function profileMe(client) {
1414
- info("Loading your profile...");
1382
+ async function profileMe(client, json) {
1383
+ if (!json) {
1384
+ info("Loading your profile...");
1385
+ }
1415
1386
  const me = await client.getMe();
1416
1387
  const user = await client.getUser(me.id);
1388
+ if (json) {
1389
+ console.log(JSON.stringify(user));
1390
+ return;
1391
+ }
1417
1392
  profileCard(user);
1418
1393
  }
1419
- async function profileShow(client, userId) {
1420
- info("Loading profile...");
1394
+ async function profileShow(client, userId, json) {
1395
+ if (!json) {
1396
+ info("Loading profile...");
1397
+ }
1421
1398
  const user = await client.getUser(userId);
1399
+ if (json) {
1400
+ console.log(JSON.stringify(user));
1401
+ return;
1402
+ }
1422
1403
  profileCard(user);
1423
1404
  }
1424
- async function profileSync(client) {
1425
- info("Regenerating profile...");
1426
- await client.syncProfile();
1405
+ async function profileSync(client, json) {
1406
+ if (!json)
1407
+ info("Regenerating profile...");
1408
+ const check = await client.callTool("read_user_profiles", {});
1409
+ if (!check.success) {
1410
+ if (json) {
1411
+ console.log(JSON.stringify(check));
1412
+ return;
1413
+ }
1414
+ error(check.error ?? "Failed to check profile status", 1);
1415
+ return;
1416
+ }
1417
+ const hasProfile = check.data?.hasProfile;
1418
+ let result;
1419
+ if (hasProfile) {
1420
+ result = await client.callTool("update_user_profile", { action: "regenerate" });
1421
+ } else {
1422
+ result = await client.callTool("create_user_profile", { confirm: true });
1423
+ }
1424
+ if (json) {
1425
+ console.log(JSON.stringify(result));
1426
+ return;
1427
+ }
1428
+ if (!result.success) {
1429
+ error(result.error ?? "Profile regeneration failed", 1);
1430
+ return;
1431
+ }
1427
1432
  success("Profile regeneration triggered. It may take a moment to complete.");
1428
1433
  }
1429
- async function profileCreate(client, options) {
1430
- info("Creating profile...");
1434
+ async function profileCreate(client, options, json) {
1435
+ if (!json)
1436
+ info("Creating profile...");
1431
1437
  const query = { confirm: true };
1432
1438
  if (options.linkedin)
1433
1439
  query.linkedinUrl = options.linkedin;
@@ -1436,18 +1442,27 @@ async function profileCreate(client, options) {
1436
1442
  if (options.twitter)
1437
1443
  query.twitterUrl = options.twitter;
1438
1444
  const result = await client.callTool("create_user_profile", query);
1445
+ if (json) {
1446
+ console.log(JSON.stringify(result));
1447
+ return;
1448
+ }
1439
1449
  if (!result.success) {
1440
1450
  error(result.error ?? "Profile creation failed", 1);
1441
1451
  return;
1442
1452
  }
1443
1453
  success("Profile created.");
1444
1454
  }
1445
- async function profileUpdate(client, action, details) {
1446
- info("Updating profile...");
1455
+ async function profileUpdate(client, action, details, json) {
1456
+ if (!json)
1457
+ info("Updating profile...");
1447
1458
  const query = { action };
1448
1459
  if (details)
1449
1460
  query.details = details;
1450
1461
  const result = await client.callTool("update_user_profile", query);
1462
+ if (json) {
1463
+ console.log(JSON.stringify(result));
1464
+ return;
1465
+ }
1451
1466
  if (!result.success) {
1452
1467
  error(result.error ?? "Profile update failed", 1);
1453
1468
  return;
@@ -1513,16 +1528,23 @@ async function handleIntent(client, subcommand, options) {
1513
1528
  error("Missing content. Usage: index intent create <content>", 1);
1514
1529
  return;
1515
1530
  }
1516
- info("Processing signal...");
1517
- const result = await client.processIntent(options.intentContent);
1531
+ if (!options.json)
1532
+ info("Processing signal...");
1533
+ const result = await client.callTool("create_intent", {
1534
+ description: options.intentContent
1535
+ });
1518
1536
  if (options.json) {
1519
1537
  console.log(JSON.stringify(result));
1520
1538
  return;
1521
1539
  }
1522
- success("Signal processed successfully.");
1523
- if (result.message) {
1524
- dim(` ${result.message}`);
1540
+ if (!result.success) {
1541
+ error(result.error ?? "Failed to create signal", 1);
1542
+ return;
1525
1543
  }
1544
+ success("Signal created.");
1545
+ const data = result.data;
1546
+ if (data?.message)
1547
+ dim(` ${data.message}`);
1526
1548
  return;
1527
1549
  }
1528
1550
  case "update": {
@@ -1534,7 +1556,8 @@ async function handleIntent(client, subcommand, options) {
1534
1556
  error("Missing content. Usage: index intent update <id> <content>", 1);
1535
1557
  return;
1536
1558
  }
1537
- info("Updating signal...");
1559
+ if (!options.json)
1560
+ info("Updating signal...");
1538
1561
  const result = await client.callTool("update_intent", {
1539
1562
  intentId: options.intentId,
1540
1563
  newDescription: options.intentContent
@@ -1555,9 +1578,14 @@ async function handleIntent(client, subcommand, options) {
1555
1578
  error("Missing signal ID. Usage: index intent archive <id>", 1);
1556
1579
  return;
1557
1580
  }
1558
- await client.archiveIntent(options.intentId);
1581
+ const intent = await client.getIntent(options.intentId);
1582
+ const result = await client.callTool("delete_intent", { intentId: intent.id });
1559
1583
  if (options.json) {
1560
- console.log(JSON.stringify({ success: true }));
1584
+ console.log(JSON.stringify(result));
1585
+ return;
1586
+ }
1587
+ if (!result.success) {
1588
+ error(result.error ?? "Failed to archive signal", 1);
1561
1589
  return;
1562
1590
  }
1563
1591
  success(`Signal ${options.intentId} archived.`);
@@ -1698,7 +1726,8 @@ async function handleOpportunity(client, subcommand, options) {
1698
1726
  const hint = options.positionals?.slice(1).join(" ") || undefined;
1699
1727
  await discoverIntroduction(client, userA, userB, hint, options.json);
1700
1728
  } else if (options.target) {
1701
- info("Discovering opportunities...");
1729
+ if (!options.json)
1730
+ info("Discovering opportunities...");
1702
1731
  const result = await client.callTool("create_opportunities", {
1703
1732
  targetUserId: options.target,
1704
1733
  searchQuery: query
@@ -1716,7 +1745,8 @@ async function handleOpportunity(client, subcommand, options) {
1716
1745
  if (data?.message)
1717
1746
  dim(` ${data.message}`);
1718
1747
  } else {
1719
- info("Discovering opportunities...");
1748
+ if (!options.json)
1749
+ info("Discovering opportunities...");
1720
1750
  const result = await client.callTool("create_opportunities", { searchQuery: query });
1721
1751
  if (options.json) {
1722
1752
  console.log(JSON.stringify(result));
@@ -1757,13 +1787,20 @@ async function opportunityShow(client, id, json) {
1757
1787
  opportunityCard(opportunity);
1758
1788
  }
1759
1789
  async function opportunityStatusUpdate(client, id, status2, json) {
1760
- const result = await client.updateOpportunityStatus(id, status2);
1790
+ const opportunity = await client.getOpportunity(id);
1791
+ const result = await client.callTool("update_opportunity", {
1792
+ opportunityId: opportunity.id,
1793
+ status: status2
1794
+ });
1761
1795
  if (json) {
1762
1796
  console.log(JSON.stringify(result));
1763
1797
  return;
1764
1798
  }
1765
- const label = status2 === "accepted" ? "accepted" : "rejected";
1766
- success(`Opportunity ${label}.`);
1799
+ if (!result.success) {
1800
+ error(result.error ?? `Failed to ${status2 === "accepted" ? "accept" : "reject"} opportunity`, 1);
1801
+ return;
1802
+ }
1803
+ success(`Opportunity ${status2 === "accepted" ? "accepted" : "rejected"}.`);
1767
1804
  }
1768
1805
  async function discoverIntroduction(client, userA, userB, hint, json) {
1769
1806
  info("Gathering data for introduction...");
@@ -1861,46 +1898,54 @@ async function handleNetwork(client, subcommand, positionals, options) {
1861
1898
  }
1862
1899
  switch (subcommand) {
1863
1900
  case "list":
1864
- await networkList(client);
1901
+ await networkList(client, options.json);
1865
1902
  return;
1866
1903
  case "create":
1867
- await networkCreate(client, positionals[0], options.prompt);
1904
+ await networkCreate(client, positionals[0], options.prompt, options.json);
1868
1905
  return;
1869
1906
  case "show":
1870
- await networkShow(client, positionals[0]);
1907
+ await networkShow(client, positionals[0], options.json);
1871
1908
  return;
1872
1909
  case "join":
1873
- await networkJoin(client, positionals[0]);
1910
+ await networkJoin(client, positionals[0], options.json);
1874
1911
  return;
1875
1912
  case "leave":
1876
- await networkLeave(client, positionals[0]);
1913
+ await networkLeave(client, positionals[0], options.json);
1877
1914
  return;
1878
1915
  case "update":
1879
- await networkUpdate(client, positionals[0], options);
1916
+ await networkUpdate(client, positionals[0], options, options.json);
1880
1917
  return;
1881
1918
  case "delete":
1882
- await networkDelete(client, positionals[0]);
1919
+ await networkDelete(client, positionals[0], options.json);
1883
1920
  return;
1884
1921
  case "invite":
1885
- await networkInvite(client, positionals[0], positionals[1]);
1922
+ await networkInvite(client, positionals[0], positionals[1], options.json);
1886
1923
  return;
1887
1924
  default:
1888
1925
  error(`Unknown network subcommand: ${subcommand}`, 1);
1889
1926
  }
1890
1927
  }
1891
- async function networkList(client) {
1928
+ async function networkList(client, json) {
1892
1929
  const networks = await client.listNetworks();
1893
1930
  const filtered = networks.filter((n) => !n.isPersonal);
1931
+ if (json) {
1932
+ console.log(JSON.stringify(filtered));
1933
+ return;
1934
+ }
1894
1935
  heading("Networks");
1895
1936
  networkTable(filtered);
1896
1937
  console.log();
1897
1938
  }
1898
- async function networkCreate(client, name, prompt) {
1939
+ async function networkCreate(client, name, prompt, json) {
1899
1940
  if (!name) {
1900
1941
  error("Usage: index network create <name>", 1);
1901
1942
  return;
1902
1943
  }
1903
1944
  const network = await client.createNetwork(name, prompt);
1945
+ if (json) {
1946
+ console.log(JSON.stringify(network));
1947
+ return;
1948
+ }
1904
1949
  success(`Network created: ${network.title}`);
1905
1950
  if (network.key) {
1906
1951
  dim(` Key: ${network.key}`);
@@ -1908,35 +1953,47 @@ async function networkCreate(client, name, prompt) {
1908
1953
  dim(` ID: ${network.id}`);
1909
1954
  dim(` Join Policy: ${(network.joinPolicy ?? "invite_only").replace("_", " ")}`);
1910
1955
  }
1911
- async function networkShow(client, id) {
1956
+ async function networkShow(client, id, json) {
1912
1957
  if (!id) {
1913
1958
  error("Usage: index network show <id>", 1);
1914
1959
  return;
1915
1960
  }
1916
1961
  const network = await client.getNetwork(id);
1917
- networkCard(network);
1918
1962
  const members = await client.getNetworkMembers(id);
1963
+ if (json) {
1964
+ console.log(JSON.stringify({ ...network, members }));
1965
+ return;
1966
+ }
1967
+ networkCard(network);
1919
1968
  heading("Members");
1920
1969
  memberTable(members);
1921
1970
  console.log();
1922
1971
  }
1923
- async function networkJoin(client, id) {
1972
+ async function networkJoin(client, id, json) {
1924
1973
  if (!id) {
1925
1974
  error("Usage: index network join <id>", 1);
1926
1975
  return;
1927
1976
  }
1928
1977
  const network = await client.joinNetwork(id);
1978
+ if (json) {
1979
+ console.log(JSON.stringify(network));
1980
+ return;
1981
+ }
1929
1982
  success(`Joined network: ${network.title}`);
1930
1983
  }
1931
- async function networkLeave(client, id) {
1984
+ async function networkLeave(client, id, json) {
1932
1985
  if (!id) {
1933
1986
  error("Usage: index network leave <id>", 1);
1934
1987
  return;
1935
1988
  }
1936
1989
  await client.leaveNetwork(id);
1990
+ if (json) {
1991
+ console.log(JSON.stringify({ id, left: true }));
1992
+ return;
1993
+ }
1937
1994
  success("Left network.");
1938
1995
  }
1939
- async function networkUpdate(client, id, options) {
1996
+ async function networkUpdate(client, id, options, json) {
1940
1997
  if (!id) {
1941
1998
  error("Usage: index network update <id> [--title <t>] [--prompt <p>]", 1);
1942
1999
  return;
@@ -1951,25 +2008,33 @@ async function networkUpdate(client, id, options) {
1951
2008
  return;
1952
2009
  }
1953
2010
  const result = await client.callTool("update_index", { indexId: id, settings });
2011
+ if (json) {
2012
+ console.log(JSON.stringify(result));
2013
+ return;
2014
+ }
1954
2015
  if (!result.success) {
1955
2016
  error(result.error ?? "Network update failed", 1);
1956
2017
  return;
1957
2018
  }
1958
2019
  success("Network updated.");
1959
2020
  }
1960
- async function networkDelete(client, id) {
2021
+ async function networkDelete(client, id, json) {
1961
2022
  if (!id) {
1962
2023
  error("Usage: index network delete <id>", 1);
1963
2024
  return;
1964
2025
  }
1965
2026
  const result = await client.callTool("delete_index", { indexId: id });
2027
+ if (json) {
2028
+ console.log(JSON.stringify(result));
2029
+ return;
2030
+ }
1966
2031
  if (!result.success) {
1967
2032
  error(result.error ?? "Network deletion failed", 1);
1968
2033
  return;
1969
2034
  }
1970
2035
  success("Network deleted.");
1971
2036
  }
1972
- async function networkInvite(client, id, email) {
2037
+ async function networkInvite(client, id, email, json) {
1973
2038
  if (!id || !email) {
1974
2039
  error("Usage: index network invite <id> <email>", 1);
1975
2040
  return;
@@ -1981,6 +2046,10 @@ async function networkInvite(client, id, email) {
1981
2046
  }
1982
2047
  const user = users[0];
1983
2048
  const result = await client.addNetworkMember(id, user.id);
2049
+ if (json) {
2050
+ console.log(JSON.stringify({ user, ...result }));
2051
+ return;
2052
+ }
1984
2053
  success(`Invited ${user.name} (${user.email}) to the network.`);
1985
2054
  if (result.message) {
1986
2055
  dim(` ${result.message}`);
@@ -2112,6 +2181,10 @@ Conversation Commands:
2112
2181
  `;
2113
2182
  async function handleConversation(client, subcommand, positionals, options) {
2114
2183
  if (!subcommand) {
2184
+ if (options?.json) {
2185
+ error("`--json` requires an explicit conversation subcommand.", 1);
2186
+ return;
2187
+ }
2115
2188
  if (options?.message) {
2116
2189
  await chatOneShot(client, options.message, options.sessionId);
2117
2190
  } else {
@@ -2121,19 +2194,19 @@ async function handleConversation(client, subcommand, positionals, options) {
2121
2194
  }
2122
2195
  switch (subcommand) {
2123
2196
  case "sessions":
2124
- await chatSessionsList(client);
2197
+ await chatSessionsList(client, options?.json);
2125
2198
  return;
2126
2199
  case "list":
2127
- await conversationList(client);
2200
+ await conversationList(client, options?.json);
2128
2201
  return;
2129
2202
  case "with":
2130
- await conversationWith(client, positionals[0]);
2203
+ await conversationWith(client, positionals[0], options?.json);
2131
2204
  return;
2132
2205
  case "show":
2133
- await conversationShow(client, positionals[0], options?.limit);
2206
+ await conversationShow(client, positionals[0], options?.limit, options?.json);
2134
2207
  return;
2135
2208
  case "send":
2136
- await conversationSend(client, positionals[0], positionals.slice(1));
2209
+ await conversationSend(client, positionals[0], positionals.slice(1), options?.json);
2137
2210
  return;
2138
2211
  case "stream":
2139
2212
  await conversationStream(client);
@@ -2145,30 +2218,42 @@ async function handleConversation(client, subcommand, positionals, options) {
2145
2218
  error(`Unknown conversation subcommand: ${subcommand}`, 1);
2146
2219
  }
2147
2220
  }
2148
- async function conversationList(client) {
2221
+ async function conversationList(client, json) {
2149
2222
  const conversations = await client.listConversations();
2223
+ if (json) {
2224
+ console.log(JSON.stringify(conversations));
2225
+ return;
2226
+ }
2150
2227
  heading("Conversations");
2151
2228
  conversationTable(conversations);
2152
2229
  console.log();
2153
2230
  }
2154
- async function conversationWith(client, userId) {
2231
+ async function conversationWith(client, userId, json) {
2155
2232
  if (!userId) {
2156
2233
  error("Usage: index conversation with <user-id>", 1);
2157
2234
  return;
2158
2235
  }
2159
2236
  const conversation = await client.getOrCreateDM(userId);
2237
+ if (json) {
2238
+ console.log(JSON.stringify(conversation));
2239
+ return;
2240
+ }
2160
2241
  conversationCard(conversation);
2161
2242
  }
2162
- async function conversationShow(client, id, limit) {
2243
+ async function conversationShow(client, id, limit, json) {
2163
2244
  if (!id) {
2164
2245
  error("Usage: index conversation show <id>", 1);
2165
2246
  return;
2166
2247
  }
2167
2248
  const messages = await client.getMessages(id, { limit: limit ?? 20 });
2249
+ if (json) {
2250
+ console.log(JSON.stringify(messages));
2251
+ return;
2252
+ }
2168
2253
  heading("Messages");
2169
2254
  messageList(messages);
2170
2255
  }
2171
- async function conversationSend(client, id, messageParts) {
2256
+ async function conversationSend(client, id, messageParts, json) {
2172
2257
  if (!id) {
2173
2258
  error("Usage: index conversation send <id> <message>", 1);
2174
2259
  return;
@@ -2179,6 +2264,10 @@ async function conversationSend(client, id, messageParts) {
2179
2264
  }
2180
2265
  const text = messageParts.join(" ");
2181
2266
  const msg = await client.sendMessage(id, text);
2267
+ if (json) {
2268
+ console.log(JSON.stringify(msg));
2269
+ return;
2270
+ }
2182
2271
  success(`Message sent (${msg.id})`);
2183
2272
  }
2184
2273
  async function conversationStream(client) {
@@ -2232,8 +2321,12 @@ async function conversationStream(client) {
2232
2321
  reader.releaseLock();
2233
2322
  }
2234
2323
  }
2235
- async function chatSessionsList(client) {
2324
+ async function chatSessionsList(client, json) {
2236
2325
  const sessions = await client.listSessions();
2326
+ if (json) {
2327
+ console.log(JSON.stringify(sessions));
2328
+ return;
2329
+ }
2237
2330
  heading("Chat Sessions");
2238
2331
  sessionTable(sessions);
2239
2332
  console.log();
@@ -2524,10 +2617,38 @@ async function handleSync(client, options) {
2524
2617
  success("Context synced to ~/.index/context.json");
2525
2618
  }
2526
2619
 
2620
+ // src/onboarding.command.ts
2621
+ var ONBOARDING_HELP = `
2622
+ Onboarding Commands:
2623
+ index onboarding complete Mark onboarding as complete
2624
+ `;
2625
+ async function handleOnboarding(client, subcommand, options) {
2626
+ if (subcommand === "complete") {
2627
+ await onboardingComplete(client, options?.json);
2628
+ return;
2629
+ }
2630
+ console.log(ONBOARDING_HELP);
2631
+ }
2632
+ async function onboardingComplete(client, json) {
2633
+ if (!json) {
2634
+ info("Completing onboarding...");
2635
+ }
2636
+ const result = await client.callTool("complete_onboarding", {});
2637
+ if (json) {
2638
+ console.log(JSON.stringify(result));
2639
+ return;
2640
+ }
2641
+ if (result.success) {
2642
+ success("Onboarding marked as complete.");
2643
+ } else {
2644
+ error(result.error ?? "Failed to complete onboarding.");
2645
+ }
2646
+ }
2647
+
2527
2648
  // src/main.ts
2528
2649
  var DEFAULT_API_URL = "https://protocol.index.network";
2529
2650
  var DEFAULT_APP_URL = "https://index.network";
2530
- var VERSION = "0.7.0";
2651
+ var VERSION = "0.9.2";
2531
2652
  var HELP_TEXT = `
2532
2653
  Index CLI v${VERSION}
2533
2654
 
@@ -2720,14 +2841,16 @@ async function main() {
2720
2841
  case "network":
2721
2842
  await handleNetwork(client, args.subcommand, args.positionals ?? [], {
2722
2843
  prompt: args.prompt,
2723
- title: args.title
2844
+ title: args.title,
2845
+ json: args.json
2724
2846
  });
2725
2847
  return;
2726
2848
  case "conversation":
2727
2849
  await handleConversation(client, args.subcommand, args.positionals ?? [], {
2728
2850
  limit: args.limit,
2729
2851
  sessionId: args.sessionId,
2730
- message: args.message
2852
+ message: args.message,
2853
+ json: args.json
2731
2854
  });
2732
2855
  return;
2733
2856
  case "contact":
@@ -2744,16 +2867,7 @@ async function main() {
2744
2867
  });
2745
2868
  return;
2746
2869
  case "onboarding":
2747
- if (args.subcommand === "complete") {
2748
- const result = await client.callTool("complete_onboarding", {});
2749
- if (!result.success) {
2750
- error(result.error ?? "Onboarding completion failed", 1);
2751
- } else {
2752
- success("Onboarding completed.");
2753
- }
2754
- } else {
2755
- error("Usage: index onboarding complete", 1);
2756
- }
2870
+ await handleOnboarding(client, args.subcommand, { json: args.json });
2757
2871
  return;
2758
2872
  case "sync":
2759
2873
  await handleSync(client, { json: args.json });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indexnetwork/cli",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
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.9.1",
24
- "@indexnetwork/cli-linux-arm64": "0.9.1",
25
- "@indexnetwork/cli-darwin-x64": "0.9.1",
26
- "@indexnetwork/cli-darwin-arm64": "0.9.1"
23
+ "@indexnetwork/cli-linux-x64": "0.9.2",
24
+ "@indexnetwork/cli-linux-arm64": "0.9.2",
25
+ "@indexnetwork/cli-darwin-x64": "0.9.2",
26
+ "@indexnetwork/cli-darwin-arm64": "0.9.2"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/bun": "latest"