@indexnetwork/cli 0.13.1-rc.55.1 → 0.13.2-rc.57.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.
- package/README.md +6 -6
- package/dist/index.js +117 -78
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -102,18 +102,18 @@ Status values: `pending`, `accepted`, `rejected`, `expired`.
|
|
|
102
102
|
|
|
103
103
|
### `index network`
|
|
104
104
|
|
|
105
|
-
Manage networks (communities).
|
|
105
|
+
Manage networks (communities). Network creation is direct for eligible staff; otherwise the command submits an early-access request. Invitations accept any valid email and use the server invitation flow.
|
|
106
106
|
|
|
107
107
|
```bash
|
|
108
108
|
index network list # List your networks
|
|
109
|
-
index network create "My Network"
|
|
110
|
-
index network create "AI" --prompt "AI researchers" # Create with description
|
|
109
|
+
index network create "My Network" # Create directly when eligible; otherwise submit an early-access request
|
|
110
|
+
index network create "AI" --prompt "AI researchers" # Create or request with a description
|
|
111
111
|
index network show <id> # Show details and members
|
|
112
112
|
index network update <id> --title "New Name" # Update a network
|
|
113
113
|
index network delete <id> # Delete a network
|
|
114
114
|
index network join <id> # Join a public network
|
|
115
115
|
index network leave <id> # Leave a network
|
|
116
|
-
index network invite <id> user@email
|
|
116
|
+
index network invite <id> user@email # Invite directly by email
|
|
117
117
|
```
|
|
118
118
|
|
|
119
119
|
### `index conversation`
|
|
@@ -134,12 +134,12 @@ index conversation stream # Real-time SSE stream
|
|
|
134
134
|
|
|
135
135
|
### `index profile`
|
|
136
136
|
|
|
137
|
-
View user profiles and
|
|
137
|
+
View user profiles and synchronously enrich your public identity, social, and avatar data.
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
140
|
index profile # Show your own profile
|
|
141
141
|
index profile show <user-id> # Show another user's profile
|
|
142
|
-
index profile sync #
|
|
142
|
+
index profile sync # Enrich your profile now and return the resolved identity
|
|
143
143
|
index profile search <query> # Search profiles by name or keyword
|
|
144
144
|
index profile create # Generate profile from social links
|
|
145
145
|
index profile update <action> [--details <text>] # Update profile (action is the verb-phrase, e.g. "add interests")
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,38 @@ var __export = (target, all) => {
|
|
|
16
16
|
|
|
17
17
|
// src/main.ts
|
|
18
18
|
import { spawn } from "node:child_process";
|
|
19
|
+
// package.json
|
|
20
|
+
var package_default = {
|
|
21
|
+
name: "@indexnetwork/cli",
|
|
22
|
+
version: "0.13.2",
|
|
23
|
+
description: "Command-line interface for Index Network",
|
|
24
|
+
license: "MIT",
|
|
25
|
+
type: "module",
|
|
26
|
+
bin: {
|
|
27
|
+
index: "bin/index.cjs"
|
|
28
|
+
},
|
|
29
|
+
files: [
|
|
30
|
+
"bin/",
|
|
31
|
+
"dist/",
|
|
32
|
+
"README.md"
|
|
33
|
+
],
|
|
34
|
+
scripts: {
|
|
35
|
+
dev: "bun src/main.ts",
|
|
36
|
+
build: "bun scripts/build.ts",
|
|
37
|
+
test: "NODE_ENV=test bun test",
|
|
38
|
+
lint: "eslint src/**/*.ts",
|
|
39
|
+
"publish:all": "bun scripts/publish.ts"
|
|
40
|
+
},
|
|
41
|
+
optionalDependencies: {
|
|
42
|
+
"@indexnetwork/cli-linux-x64": "0.13.2",
|
|
43
|
+
"@indexnetwork/cli-linux-arm64": "0.13.2",
|
|
44
|
+
"@indexnetwork/cli-darwin-x64": "0.13.2",
|
|
45
|
+
"@indexnetwork/cli-darwin-arm64": "0.13.2"
|
|
46
|
+
},
|
|
47
|
+
devDependencies: {
|
|
48
|
+
"@types/bun": "1.3.14"
|
|
49
|
+
}
|
|
50
|
+
};
|
|
19
51
|
|
|
20
52
|
// src/args.parser.ts
|
|
21
53
|
var KNOWN_COMMANDS = new Set(["login", "logout", "profile", "intent", "opportunity", "negotiation", "network", "conversation", "contact", "scrape", "onboarding", "sync", "help", "version"]);
|
|
@@ -259,6 +291,12 @@ class ApiError extends Error {
|
|
|
259
291
|
this.name = "ApiError";
|
|
260
292
|
}
|
|
261
293
|
}
|
|
294
|
+
function isEarlyAccessNetworkCreationError(error) {
|
|
295
|
+
if (!(error instanceof ApiError) || error.status !== 403)
|
|
296
|
+
return false;
|
|
297
|
+
const response = error.response;
|
|
298
|
+
return typeof response === "object" && response !== null && "error" in response && typeof response.error === "string" && response.error.startsWith("Network creation is in early access.");
|
|
299
|
+
}
|
|
262
300
|
|
|
263
301
|
class ApiClient {
|
|
264
302
|
baseUrl;
|
|
@@ -318,10 +356,10 @@ class ApiClient {
|
|
|
318
356
|
const res = await this.get(`/api/opportunities/${id}`);
|
|
319
357
|
return await res.json();
|
|
320
358
|
}
|
|
321
|
-
async
|
|
359
|
+
async updateOpportunityStatus(id, status, acknowledgedUptakeQuestionIds) {
|
|
322
360
|
const res = await this.patch(`/api/opportunities/${id}/status`, {
|
|
323
|
-
status
|
|
324
|
-
...acknowledgedUptakeQuestionIds ? { acknowledgedUptakeQuestionIds } : {}
|
|
361
|
+
status,
|
|
362
|
+
...status === "accepted" && acknowledgedUptakeQuestionIds ? { acknowledgedUptakeQuestionIds } : {}
|
|
325
363
|
});
|
|
326
364
|
return await res.json();
|
|
327
365
|
}
|
|
@@ -369,6 +407,9 @@ class ApiClient {
|
|
|
369
407
|
const body = await res.json();
|
|
370
408
|
return body;
|
|
371
409
|
}
|
|
410
|
+
async updateIntent(intentId, description) {
|
|
411
|
+
return this.callTool("update_intent", { intentId, description });
|
|
412
|
+
}
|
|
372
413
|
async listNetworks() {
|
|
373
414
|
const res = await this.get("/api/networks");
|
|
374
415
|
const body = await res.json();
|
|
@@ -377,13 +418,24 @@ class ApiClient {
|
|
|
377
418
|
joinPolicy: n.joinPolicy ?? n.permissions?.joinPolicy
|
|
378
419
|
}));
|
|
379
420
|
}
|
|
380
|
-
async
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
421
|
+
async createNetworkOrRequest(title, prompt) {
|
|
422
|
+
try {
|
|
423
|
+
const res2 = await this.post("/api/networks", {
|
|
424
|
+
title,
|
|
425
|
+
...prompt ? { prompt } : {}
|
|
426
|
+
});
|
|
427
|
+
const body2 = await res2.json();
|
|
428
|
+
return { kind: "created", network: body2.network };
|
|
429
|
+
} catch (error) {
|
|
430
|
+
if (!isEarlyAccessNetworkCreationError(error))
|
|
431
|
+
throw error;
|
|
432
|
+
}
|
|
433
|
+
const res = await this.post("/api/network-requests", {
|
|
434
|
+
name: title,
|
|
435
|
+
...prompt ? { purpose: prompt } : {}
|
|
384
436
|
});
|
|
385
437
|
const body = await res.json();
|
|
386
|
-
return body.
|
|
438
|
+
return { kind: "requested", request: body.request };
|
|
387
439
|
}
|
|
388
440
|
async getNetwork(id) {
|
|
389
441
|
const res = await this.get(`/api/networks/${id}`);
|
|
@@ -404,18 +456,12 @@ class ApiClient {
|
|
|
404
456
|
async leaveNetwork(id) {
|
|
405
457
|
await this.post(`/api/networks/${id}/leave`, {});
|
|
406
458
|
}
|
|
407
|
-
async
|
|
408
|
-
const
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
return body.users;
|
|
414
|
-
}
|
|
415
|
-
async addNetworkMember(networkId, userId) {
|
|
416
|
-
const res = await this.post(`/api/networks/${networkId}/members`, { userId });
|
|
417
|
-
const body = await res.json();
|
|
418
|
-
return body;
|
|
459
|
+
async inviteNetworkMember(networkId, email, name) {
|
|
460
|
+
const res = await this.post(`/api/networks/${networkId}/members/invite`, {
|
|
461
|
+
email,
|
|
462
|
+
...name ? { name } : {}
|
|
463
|
+
});
|
|
464
|
+
return await res.json();
|
|
419
465
|
}
|
|
420
466
|
async listConversations() {
|
|
421
467
|
const res = await this.get("/api/conversations");
|
|
@@ -476,6 +522,19 @@ class ApiClient {
|
|
|
476
522
|
const body = await res.json();
|
|
477
523
|
return body.negotiations;
|
|
478
524
|
}
|
|
525
|
+
async enrichProfile() {
|
|
526
|
+
const res = await this.post("/api/enrichment/enrich", {});
|
|
527
|
+
return await res.json();
|
|
528
|
+
}
|
|
529
|
+
async readUserContexts(query = {}) {
|
|
530
|
+
return this.callTool("read_user_contexts", query);
|
|
531
|
+
}
|
|
532
|
+
async createUserContext(query) {
|
|
533
|
+
return this.callTool("create_user_context", query);
|
|
534
|
+
}
|
|
535
|
+
async updateUserContext(query) {
|
|
536
|
+
return this.callTool("update_user_context", query);
|
|
537
|
+
}
|
|
479
538
|
async callTool(toolName, query = {}) {
|
|
480
539
|
const res = await this.post(`/api/tools/${toolName}`, { query });
|
|
481
540
|
return await res.json();
|
|
@@ -982,9 +1041,9 @@ function toolActivity(description) {
|
|
|
982
1041
|
`);
|
|
983
1042
|
}
|
|
984
1043
|
var TOOL_DESCRIPTIONS = {
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1044
|
+
read_user_contexts: "Reading your profile...",
|
|
1045
|
+
create_user_context: "Creating your profile...",
|
|
1046
|
+
update_user_context: "Updating your profile...",
|
|
988
1047
|
read_intents: "Fetching your active signals...",
|
|
989
1048
|
create_intent: "Creating a new signal...",
|
|
990
1049
|
update_intent: "Updating signal...",
|
|
@@ -1688,7 +1747,7 @@ async function handleProfile(client, subcommand, positionals, options = {}) {
|
|
|
1688
1747
|
error("Usage: index profile search <query>", 1);
|
|
1689
1748
|
return;
|
|
1690
1749
|
}
|
|
1691
|
-
const result = await client.
|
|
1750
|
+
const result = await client.readUserContexts({ query });
|
|
1692
1751
|
if (options.json) {
|
|
1693
1752
|
console.log(JSON.stringify(result));
|
|
1694
1753
|
return;
|
|
@@ -1738,32 +1797,18 @@ async function profileShow(client, userId, json) {
|
|
|
1738
1797
|
}
|
|
1739
1798
|
async function profileSync(client, json) {
|
|
1740
1799
|
if (!json)
|
|
1741
|
-
info("
|
|
1742
|
-
const
|
|
1743
|
-
if (!check.success) {
|
|
1744
|
-
if (json) {
|
|
1745
|
-
console.log(JSON.stringify(check));
|
|
1746
|
-
return;
|
|
1747
|
-
}
|
|
1748
|
-
error(check.error ?? "Failed to check profile status", 1);
|
|
1749
|
-
return;
|
|
1750
|
-
}
|
|
1751
|
-
const hasProfile = check.data?.hasProfile;
|
|
1752
|
-
let result;
|
|
1753
|
-
if (hasProfile) {
|
|
1754
|
-
result = await client.callTool("update_user_profile", { action: "regenerate" });
|
|
1755
|
-
} else {
|
|
1756
|
-
result = await client.callTool("create_user_profile", { confirm: true });
|
|
1757
|
-
}
|
|
1800
|
+
info("Enriching profile...");
|
|
1801
|
+
const result = await client.enrichProfile();
|
|
1758
1802
|
if (json) {
|
|
1759
1803
|
console.log(JSON.stringify(result));
|
|
1760
1804
|
return;
|
|
1761
1805
|
}
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1806
|
+
success("Profile enriched.");
|
|
1807
|
+
if (result.profile.name)
|
|
1808
|
+
dim(` Name: ${result.profile.name}`);
|
|
1809
|
+
if (result.profile.location)
|
|
1810
|
+
dim(` Location: ${result.profile.location}`);
|
|
1811
|
+
dim(` Social links: ${result.profile.socials.length}`);
|
|
1767
1812
|
}
|
|
1768
1813
|
async function profileCreate(client, options, json) {
|
|
1769
1814
|
if (!json)
|
|
@@ -1775,7 +1820,7 @@ async function profileCreate(client, options, json) {
|
|
|
1775
1820
|
query.githubUrl = options.github;
|
|
1776
1821
|
if (options.twitter)
|
|
1777
1822
|
query.twitterUrl = options.twitter;
|
|
1778
|
-
const result = await client.
|
|
1823
|
+
const result = await client.createUserContext(query);
|
|
1779
1824
|
if (json) {
|
|
1780
1825
|
console.log(JSON.stringify(result));
|
|
1781
1826
|
return;
|
|
@@ -1792,7 +1837,7 @@ async function profileUpdate(client, action, details, json) {
|
|
|
1792
1837
|
const query = { action };
|
|
1793
1838
|
if (details)
|
|
1794
1839
|
query.details = details;
|
|
1795
|
-
const result = await client.
|
|
1840
|
+
const result = await client.updateUserContext(query);
|
|
1796
1841
|
if (json) {
|
|
1797
1842
|
console.log(JSON.stringify(result));
|
|
1798
1843
|
return;
|
|
@@ -1897,10 +1942,7 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1897
1942
|
}
|
|
1898
1943
|
if (!options.json)
|
|
1899
1944
|
info("Updating signal...");
|
|
1900
|
-
const result = await client.
|
|
1901
|
-
intentId: options.intentId,
|
|
1902
|
-
newDescription: options.intentContent
|
|
1903
|
-
});
|
|
1945
|
+
const result = await client.updateIntent(options.intentId, options.intentContent);
|
|
1904
1946
|
if (options.json) {
|
|
1905
1947
|
console.log(JSON.stringify(result));
|
|
1906
1948
|
return;
|
|
@@ -2063,7 +2105,7 @@ async function opportunityStatusUpdate(client, id, status2, json, acknowledgedUp
|
|
|
2063
2105
|
const opportunity = await client.getOpportunity(id);
|
|
2064
2106
|
if (status2 === "accepted") {
|
|
2065
2107
|
try {
|
|
2066
|
-
const result2 = await client.
|
|
2108
|
+
const result2 = await client.updateOpportunityStatus(opportunity.id, "accepted", acknowledgedUptakeQuestionIds);
|
|
2067
2109
|
if (json) {
|
|
2068
2110
|
console.log(JSON.stringify(result2));
|
|
2069
2111
|
return;
|
|
@@ -2093,18 +2135,11 @@ ${question.title}`);
|
|
|
2093
2135
|
}
|
|
2094
2136
|
return;
|
|
2095
2137
|
}
|
|
2096
|
-
const result = await client.
|
|
2097
|
-
opportunityId: opportunity.id,
|
|
2098
|
-
status: status2
|
|
2099
|
-
});
|
|
2138
|
+
const result = await client.updateOpportunityStatus(opportunity.id, "rejected");
|
|
2100
2139
|
if (json) {
|
|
2101
2140
|
console.log(JSON.stringify(result));
|
|
2102
2141
|
return;
|
|
2103
2142
|
}
|
|
2104
|
-
if (!result.success) {
|
|
2105
|
-
error(result.error ?? "Failed to reject opportunity", 1);
|
|
2106
|
-
return;
|
|
2107
|
-
}
|
|
2108
2143
|
success("Opportunity rejected.");
|
|
2109
2144
|
}
|
|
2110
2145
|
function uptakeAdvisoryFromError(error2) {
|
|
@@ -2285,8 +2320,8 @@ function negotiationCard(n) {
|
|
|
2285
2320
|
var NETWORK_HELP = `
|
|
2286
2321
|
Network Commands:
|
|
2287
2322
|
index network list List your networks
|
|
2288
|
-
index network create <name> Create
|
|
2289
|
-
index network create <name> --prompt Create with a description
|
|
2323
|
+
index network create <name> Create directly or submit an early-access request
|
|
2324
|
+
index network create <name> --prompt Create directly or request early access with a description
|
|
2290
2325
|
index network show <id|key> Show network details and members
|
|
2291
2326
|
index network update <id> [--title <t>] [--prompt <p>]
|
|
2292
2327
|
Update a network
|
|
@@ -2345,11 +2380,18 @@ async function networkCreate(client, name, prompt, json) {
|
|
|
2345
2380
|
error("Usage: index network create <name>", 1);
|
|
2346
2381
|
return;
|
|
2347
2382
|
}
|
|
2348
|
-
const
|
|
2383
|
+
const result = await client.createNetworkOrRequest(name, prompt);
|
|
2349
2384
|
if (json) {
|
|
2350
|
-
console.log(JSON.stringify(
|
|
2385
|
+
console.log(JSON.stringify(result));
|
|
2386
|
+
return;
|
|
2387
|
+
}
|
|
2388
|
+
if (result.kind === "requested") {
|
|
2389
|
+
success(`Network request submitted: ${result.request.title}`);
|
|
2390
|
+
dim(` Status: ${result.request.status}`);
|
|
2391
|
+
dim(` Request ID: ${result.request.id}`);
|
|
2351
2392
|
return;
|
|
2352
2393
|
}
|
|
2394
|
+
const { network } = result;
|
|
2353
2395
|
success(`Network created: ${network.title}`);
|
|
2354
2396
|
if (network.key) {
|
|
2355
2397
|
dim(` Key: ${network.key}`);
|
|
@@ -2443,21 +2485,18 @@ async function networkInvite(client, id, email, json) {
|
|
|
2443
2485
|
error("Usage: index network invite <id> <email>", 1);
|
|
2444
2486
|
return;
|
|
2445
2487
|
}
|
|
2446
|
-
const
|
|
2447
|
-
if (users.length === 0) {
|
|
2448
|
-
error("User not found.");
|
|
2449
|
-
return;
|
|
2450
|
-
}
|
|
2451
|
-
const user = users[0];
|
|
2452
|
-
const result = await client.addNetworkMember(id, user.id);
|
|
2488
|
+
const result = await client.inviteNetworkMember(id, email);
|
|
2453
2489
|
if (json) {
|
|
2454
|
-
console.log(JSON.stringify(
|
|
2490
|
+
console.log(JSON.stringify(result));
|
|
2455
2491
|
return;
|
|
2456
2492
|
}
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2493
|
+
if (result.alreadyMember) {
|
|
2494
|
+
info(`${result.user.email} is already a network member.`);
|
|
2495
|
+
return;
|
|
2460
2496
|
}
|
|
2497
|
+
success(`Invitation sent to ${result.user.email}.`);
|
|
2498
|
+
if (result.created)
|
|
2499
|
+
dim(" Created a pending account for this invitee.");
|
|
2461
2500
|
}
|
|
2462
2501
|
|
|
2463
2502
|
// src/conversation.command.ts
|
|
@@ -3000,7 +3039,7 @@ async function handleSync(client, options) {
|
|
|
3000
3039
|
if (!options.json)
|
|
3001
3040
|
info("Syncing context...");
|
|
3002
3041
|
const [profile, networks, intents, contacts] = await Promise.all([
|
|
3003
|
-
client.
|
|
3042
|
+
client.readUserContexts(),
|
|
3004
3043
|
client.callTool("read_networks", {}),
|
|
3005
3044
|
client.callTool("read_intents", {}),
|
|
3006
3045
|
client.callTool("list_contacts", {})
|
|
@@ -3053,7 +3092,7 @@ async function onboardingComplete(client, json) {
|
|
|
3053
3092
|
// src/main.ts
|
|
3054
3093
|
var DEFAULT_API_URL = "https://protocol.index.network";
|
|
3055
3094
|
var DEFAULT_APP_URL = "https://index.network";
|
|
3056
|
-
var VERSION =
|
|
3095
|
+
var VERSION = package_default.version;
|
|
3057
3096
|
var BOX = { tl: "╭", tr: "╮", bl: "╰", br: "╯", h: "─", v: "│" };
|
|
3058
3097
|
function visualLen(s) {
|
|
3059
3098
|
return stripAnsi(s).length;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indexnetwork/cli",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2-rc.57.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.13.
|
|
24
|
-
"@indexnetwork/cli-linux-arm64": "0.13.
|
|
25
|
-
"@indexnetwork/cli-darwin-x64": "0.13.
|
|
26
|
-
"@indexnetwork/cli-darwin-arm64": "0.13.
|
|
23
|
+
"@indexnetwork/cli-linux-x64": "0.13.2-rc.57.1",
|
|
24
|
+
"@indexnetwork/cli-linux-arm64": "0.13.2-rc.57.1",
|
|
25
|
+
"@indexnetwork/cli-darwin-x64": "0.13.2-rc.57.1",
|
|
26
|
+
"@indexnetwork/cli-darwin-arm64": "0.13.2-rc.57.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/bun": "1.3.14"
|