@heyamiko/amiko-cli 0.9.0-beta.12 → 0.9.0-beta.14

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 +269 -3
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -20696,7 +20696,7 @@ function registerDocsCommand(program2) {
20696
20696
  dim("CREATED")
20697
20697
  ],
20698
20698
  ...d.docs.map((doc2) => [
20699
- doc2.id.slice(0, 8),
20699
+ doc2.id,
20700
20700
  doc2.title || doc2.filename,
20701
20701
  doc2.file_type || "-",
20702
20702
  doc2.is_processed ? "processed" : doc2.is_parsed ? "parsed" : "pending",
@@ -20989,7 +20989,7 @@ function registerFriendsCommand(program2) {
20989
20989
  const rows = [
20990
20990
  [dim("ID"), dim("NAME"), dim("HANDLE"), dim("TYPE"), dim("SINCE")],
20991
20991
  ...items.map((f) => [
20992
- f.friendship_id.slice(0, 8),
20992
+ f.friendship_id,
20993
20993
  f.friend.name ?? "-",
20994
20994
  f.friend.handle ?? "-",
20995
20995
  f.friend.type,
@@ -21037,6 +21037,191 @@ function registerFriendsCommand(program2) {
21037
21037
  process.exit(1);
21038
21038
  }
21039
21039
  });
21040
+ program2.command("requests").description("List pending friend requests (incoming and outgoing)").option("--direction <incoming|outgoing|all>", "Filter direction", "all").option("--json", "Output as JSON").action(async (opts) => {
21041
+ const auth = resolveAuth();
21042
+ const spinner = opts.json ? null : ora("Loading requests...").start();
21043
+ try {
21044
+ const data = await amikoWebFetch(auth, "/api/friends/requests");
21045
+ spinner?.stop();
21046
+ renderOutput(data, (d) => {
21047
+ const dir = opts.direction;
21048
+ const showIn = dir === "all" || dir === "incoming";
21049
+ const showOut = dir === "all" || dir === "outgoing";
21050
+ const incoming = d.incoming ?? [];
21051
+ const outgoing = d.outgoing ?? [];
21052
+ if (showIn) {
21053
+ console.log(heading(`Incoming (${incoming.length})`));
21054
+ if (incoming.length === 0) {
21055
+ console.log(dim(" none"));
21056
+ } else {
21057
+ const rows = [
21058
+ [dim("FRIENDSHIP"), dim("FROM"), dim("HANDLE"), dim("SENT")],
21059
+ ...incoming.map((r) => [
21060
+ r.friendship_id,
21061
+ r.user.name ?? "-",
21062
+ r.user.handle ?? "-",
21063
+ r.sent_at?.slice(0, 10) ?? "-"
21064
+ ])
21065
+ ];
21066
+ console.log(table(rows));
21067
+ console.log(dim(`
21068
+ Accept with: amiko friends accept <friendshipId>`));
21069
+ }
21070
+ }
21071
+ if (showOut) {
21072
+ if (showIn)
21073
+ console.log();
21074
+ console.log(heading(`Outgoing (${outgoing.length})`));
21075
+ if (outgoing.length === 0) {
21076
+ console.log(dim(" none"));
21077
+ } else {
21078
+ const rows = [
21079
+ [dim("FRIENDSHIP"), dim("TO"), dim("HANDLE"), dim("SENT")],
21080
+ ...outgoing.map((r) => [
21081
+ r.friendship_id,
21082
+ r.user.name ?? "-",
21083
+ r.user.handle ?? "-",
21084
+ r.sent_at?.slice(0, 10) ?? "-"
21085
+ ])
21086
+ ];
21087
+ console.log(table(rows));
21088
+ }
21089
+ }
21090
+ }, { json: opts.json });
21091
+ } catch (e) {
21092
+ spinner?.stop();
21093
+ console.error(error(e instanceof Error ? e.message : String(e)));
21094
+ process.exit(1);
21095
+ }
21096
+ });
21097
+ const reports = program2.command("reports").description("Friend matching reports");
21098
+ reports.command("list").description("List friend matching reports").option("--page <n>", "Page number", "1").option("--limit <n>", "Page size (1-50)", "20").option("--json", "Output as JSON").action(async (opts) => {
21099
+ const auth = resolveAuth();
21100
+ const spinner = opts.json ? null : ora("Loading reports...").start();
21101
+ try {
21102
+ const data = await amikoWebFetch(auth, "/api/friends/reports", {
21103
+ query: { page: opts.page, limit: opts.limit }
21104
+ });
21105
+ spinner?.stop();
21106
+ renderOutput(data, (d) => {
21107
+ const items = d.items ?? [];
21108
+ if (items.length === 0) {
21109
+ console.log(dim("No reports."));
21110
+ return;
21111
+ }
21112
+ console.log(heading(`Reports (${items.length}/${d.total ?? items.length})`));
21113
+ const rows = [
21114
+ [
21115
+ dim("ID"),
21116
+ dim("TYPE"),
21117
+ dim("STATUS"),
21118
+ dim("SCORE"),
21119
+ dim("WITH"),
21120
+ dim("CREATED")
21121
+ ],
21122
+ ...items.map((r) => {
21123
+ const other = r.respondent ?? r.initiator;
21124
+ return [
21125
+ r.id,
21126
+ r.report_type ?? "-",
21127
+ r.status ?? "-",
21128
+ r.score_preview != null ? String(r.score_preview) : "-",
21129
+ other?.name ?? other?.handle ?? "-",
21130
+ r.created_at?.slice(0, 10) ?? "-"
21131
+ ];
21132
+ })
21133
+ ];
21134
+ console.log(table(rows));
21135
+ }, { json: opts.json });
21136
+ } catch (e) {
21137
+ spinner?.stop();
21138
+ console.error(error(e instanceof Error ? e.message : String(e)));
21139
+ process.exit(1);
21140
+ }
21141
+ });
21142
+ reports.command("view <id>").description("View a friend matching report").option("--json", "Output as JSON").action(async (id, opts) => {
21143
+ const auth = resolveAuth();
21144
+ const spinner = opts.json ? null : ora("Loading report...").start();
21145
+ try {
21146
+ const data = await amikoWebFetch(auth, `/api/friends/reports/${encodeURIComponent(id)}`);
21147
+ spinner?.stop();
21148
+ renderOutput(data, (d) => {
21149
+ const r = d.report;
21150
+ console.log(heading(`Report ${r.id}`));
21151
+ if (r.report_type)
21152
+ console.log(label("Type", r.report_type));
21153
+ if (r.status)
21154
+ console.log(label("Status", r.status));
21155
+ const other = r.respondent ?? r.initiator;
21156
+ if (other)
21157
+ console.log(label("With", other.name ?? other.handle ?? other.id));
21158
+ if (r.created_at)
21159
+ console.log(label("Created", r.created_at.slice(0, 10)));
21160
+ if (r.teaser_text) {
21161
+ console.log();
21162
+ console.log(r.teaser_text);
21163
+ }
21164
+ if (r.report_json) {
21165
+ console.log();
21166
+ console.log(heading("Report"));
21167
+ console.log(typeof r.report_json === "string" ? r.report_json : JSON.stringify(r.report_json, null, 2));
21168
+ }
21169
+ }, { json: opts.json });
21170
+ } catch (e) {
21171
+ spinner?.stop();
21172
+ console.error(error(e instanceof Error ? e.message : String(e)));
21173
+ process.exit(1);
21174
+ }
21175
+ });
21176
+ program2.command("matches").description("List friend matches").option("--limit <n>", "Max results (1-50)", "10").option("--offset <n>", "Offset", "0").option("--relationship-type <type>", "Filter by relationship type").option("--dimension <dimension>", "Filter by match dimension").option("--json", "Output as JSON").action(async (opts) => {
21177
+ const auth = resolveAuth();
21178
+ const spinner = opts.json ? null : ora("Loading matches...").start();
21179
+ try {
21180
+ const data = await amikoWebFetch(auth, "/api/friends/matches", {
21181
+ query: {
21182
+ limit: opts.limit,
21183
+ offset: opts.offset,
21184
+ relationship_type: opts.relationshipType,
21185
+ dimension: opts.dimension
21186
+ }
21187
+ });
21188
+ spinner?.stop();
21189
+ renderOutput(data, (d) => {
21190
+ const items = d.items ?? [];
21191
+ if (items.length === 0) {
21192
+ console.log(dim("No matches."));
21193
+ return;
21194
+ }
21195
+ console.log(heading(`Matches (${items.length}/${d.total ?? items.length})`));
21196
+ const rows = [
21197
+ [
21198
+ dim("USER"),
21199
+ dim("NAME"),
21200
+ dim("REL"),
21201
+ dim("DIM"),
21202
+ dim("SCORE"),
21203
+ dim("STATUS")
21204
+ ],
21205
+ ...items.map((m) => [
21206
+ m.matched_user_id,
21207
+ m.display_name ?? m.handle ?? "-",
21208
+ m.relationship_type ?? "-",
21209
+ m.match_dimension ?? "-",
21210
+ m.score != null ? String(m.score) : "-",
21211
+ m.friendship_status ?? "-"
21212
+ ])
21213
+ ];
21214
+ console.log(table(rows));
21215
+ if (d.has_more)
21216
+ console.log(dim(`
21217
+ (more available)`));
21218
+ }, { json: opts.json });
21219
+ } catch (e) {
21220
+ spinner?.stop();
21221
+ console.error(error(e instanceof Error ? e.message : String(e)));
21222
+ process.exit(1);
21223
+ }
21224
+ });
21040
21225
  program2.command("remove <friendshipId>").description("Remove a friend").option("--yes", "Skip confirmation").option("--json", "Output as JSON").action(async (friendshipId, opts) => {
21041
21226
  await confirmDestructive({
21042
21227
  action: `Remove friend ${friendshipId}`,
@@ -21057,6 +21242,85 @@ function registerFriendsCommand(program2) {
21057
21242
  });
21058
21243
  }
21059
21244
 
21245
+ // src/commands/users.ts
21246
+ function registerUsersCommand(program2) {
21247
+ program2.command("search <query>").description("Search for users by name or handle").option("--limit <n>", "Max results (1-20)", "10").option("--cursor <cursor>", "Pagination cursor").option("--json", "Output as JSON").action(async (query, opts) => {
21248
+ const auth = resolveAuth();
21249
+ const spinner = opts.json ? null : ora("Searching users...").start();
21250
+ try {
21251
+ const data = await amikoWebFetch(auth, "/api/search", {
21252
+ query: {
21253
+ q: query,
21254
+ type: "people",
21255
+ limit: opts.limit,
21256
+ cursor: opts.cursor
21257
+ }
21258
+ });
21259
+ spinner?.stop();
21260
+ renderOutput(data, (d) => {
21261
+ const items = d.users ?? [];
21262
+ if (items.length === 0) {
21263
+ console.log(dim("No users found."));
21264
+ return;
21265
+ }
21266
+ console.log(heading(`Users (${items.length})`));
21267
+ const rows = [
21268
+ [dim("ID"), dim("NAME"), dim("HANDLE")],
21269
+ ...items.map((u) => [
21270
+ u.id,
21271
+ u.name ?? "-",
21272
+ u.handle ?? "-"
21273
+ ])
21274
+ ];
21275
+ console.log(table(rows));
21276
+ if (d.hasMore && d.nextCursor) {
21277
+ console.log(dim(`
21278
+ Next cursor: ${d.nextCursor}`));
21279
+ }
21280
+ }, { json: opts.json });
21281
+ } catch (e) {
21282
+ spinner?.stop();
21283
+ console.error(error(e instanceof Error ? e.message : String(e)));
21284
+ process.exit(1);
21285
+ }
21286
+ });
21287
+ program2.command("profile <handle>").description("View a user's public profile").option("--json", "Output as JSON").action(async (handle, opts) => {
21288
+ const auth = resolveAuth();
21289
+ const spinner = opts.json ? null : ora("Loading profile...").start();
21290
+ try {
21291
+ const data = await amikoWebFetch(auth, `/api/users/${encodeURIComponent(handle)}`);
21292
+ spinner?.stop();
21293
+ renderOutput(data, (d) => {
21294
+ const u = d.user;
21295
+ console.log(heading(u.name ?? u.handle ?? u.id));
21296
+ console.log(label("ID", u.id));
21297
+ if (u.handle)
21298
+ console.log(label("Handle", u.handle));
21299
+ if (u.created_at)
21300
+ console.log(label("Joined", u.created_at.slice(0, 10)));
21301
+ if (u.last_seen_at)
21302
+ console.log(label("Last seen", u.last_seen_at.slice(0, 10)));
21303
+ if (u.twins && u.twins.length > 0) {
21304
+ console.log(heading(`
21305
+ Twins (${u.twins.length})`));
21306
+ for (const t of u.twins) {
21307
+ console.log(` ${t.name ?? "-"} ${dim(t.handle ?? t.id.slice(0, 8))}`);
21308
+ }
21309
+ }
21310
+ if (Array.isArray(u.mutual_friends) && u.mutual_friends.length > 0) {
21311
+ console.log(label("Mutual friends", String(u.mutual_friends.length)));
21312
+ } else if (typeof u.mutual_friends === "number") {
21313
+ console.log(label("Mutual friends", String(u.mutual_friends)));
21314
+ }
21315
+ }, { json: opts.json });
21316
+ } catch (e) {
21317
+ spinner?.stop();
21318
+ console.error(error(e instanceof Error ? e.message : String(e)));
21319
+ process.exit(1);
21320
+ }
21321
+ });
21322
+ }
21323
+
21060
21324
  // src/commands/feed.ts
21061
21325
  function registerFeedCommand(program2) {
21062
21326
  program2.command("feed").description("Get feed posts").option("--type <for_you|friends>", "Feed type", "friends").option("--hashtag <tag>", "Filter by hashtag").option("--limit <n>", "Max results (default 10, max 100)").option("--cursor <id>", "Pagination cursor").option("--json", "Output as JSON").action(async (opts) => {
@@ -21397,7 +21661,8 @@ var twin = program2.command("twin").description("Update twin identity (name, des
21397
21661
  var docs = program2.command("docs").description("Manage twin RAG documents — list, upload, delete, presign");
21398
21662
  var voice = program2.command("voice").description("Manage twin voice — design, create, clone, reset");
21399
21663
  var avatar = program2.command("avatar").description("Manage twin avatar image");
21400
- var friends = program2.command("friends").description("Manage friendships — list, add, accept, remove");
21664
+ var friends = program2.command("friends").description("Manage friendships — list, requests, add, accept, remove, reports, matches");
21665
+ var users = program2.command("users").description("Search users and view public profiles");
21401
21666
  var post = program2.command("post").description("Create posts and comments on the feed");
21402
21667
  var composio = program2.command("composio").description("Manage Composio app connections");
21403
21668
  registerCreditsCommand(program2);
@@ -21419,6 +21684,7 @@ registerDocsCommand(docs);
21419
21684
  registerVoiceCommand(voice);
21420
21685
  registerAvatarCommand(avatar);
21421
21686
  registerFriendsCommand(friends);
21687
+ registerUsersCommand(users);
21422
21688
  registerFeedCommand(program2);
21423
21689
  registerPostCommand(post);
21424
21690
  registerComposioCommand(composio);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyamiko/amiko-cli",
3
- "version": "0.9.0-beta.12",
3
+ "version": "0.9.0-beta.14",
4
4
  "description": "Amiko CLI — swap tokens, manage credits, bridge cross-chain, and call marketplace agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "scripts": {
10
10
  "build": "bun build src/index.ts --outdir dist --target node --format esm",
11
+ "prepublishOnly": "bun run build",
11
12
  "dev": "bun run src/index.ts",
12
13
  "typecheck": "bun x tsc --noEmit",
13
14
  "test": "bun test"