@fulldivevr/workcord-cli 1.0.0 → 1.1.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 (81) hide show
  1. package/README.md +88 -30
  2. package/dist/auth.js +38 -4
  3. package/dist/cli.js +3 -1
  4. package/dist/client.js +21 -12
  5. package/dist/commands/auth.js +33 -14
  6. package/dist/commands/challenges.js +2 -7
  7. package/dist/commands/custom-agents.js +3 -8
  8. package/dist/commands/dm.js +2 -3
  9. package/dist/commands/health.js +29 -0
  10. package/dist/commands/messages.js +8 -21
  11. package/dist/commands/room-agents.js +2 -7
  12. package/dist/commands/rooms.js +24 -31
  13. package/dist/commands/users.js +4 -9
  14. package/dist/commands/whoami.js +24 -7
  15. package/dist/config.js +34 -0
  16. package/dist/generated/commands/activity.js +3 -6
  17. package/dist/generated/commands/ai.js +3 -6
  18. package/dist/generated/commands/ambassador.js +3 -6
  19. package/dist/generated/commands/apple-iap.js +4 -9
  20. package/dist/generated/commands/attribution.js +6 -15
  21. package/dist/generated/commands/auth.js +9 -24
  22. package/dist/generated/commands/challenges.js +13 -36
  23. package/dist/generated/commands/clips.js +3 -6
  24. package/dist/generated/commands/contact-match.js +7 -18
  25. package/dist/generated/commands/content-crawler.js +2 -3
  26. package/dist/generated/commands/custom-agents.js +22 -63
  27. package/dist/generated/commands/desktop-releases.js +5 -12
  28. package/dist/generated/commands/discover.js +9 -24
  29. package/dist/generated/commands/dm.js +10 -27
  30. package/dist/generated/commands/drafts.js +3 -6
  31. package/dist/generated/commands/embed.js +3 -6
  32. package/dist/generated/commands/explore.js +2 -3
  33. package/dist/generated/commands/feed.js +4 -9
  34. package/dist/generated/commands/feedback.js +2 -3
  35. package/dist/generated/commands/gamification.js +3 -6
  36. package/dist/generated/commands/google-play-iap.js +4 -9
  37. package/dist/generated/commands/internal.js +9 -24
  38. package/dist/generated/commands/interview.js +4 -9
  39. package/dist/generated/commands/invite-redirect.js +2 -3
  40. package/dist/generated/commands/jesuscord-admin.js +3 -6
  41. package/dist/generated/commands/join.js +2 -3
  42. package/dist/generated/commands/kits.js +7 -18
  43. package/dist/generated/commands/meetings.js +6 -15
  44. package/dist/generated/commands/message-folders.js +5 -12
  45. package/dist/generated/commands/messages.js +17 -48
  46. package/dist/generated/commands/one-emulator.js +2 -3
  47. package/dist/generated/commands/pdf-export.js +2 -3
  48. package/dist/generated/commands/pin-folders.js +5 -12
  49. package/dist/generated/commands/pinned-messages.js +4 -9
  50. package/dist/generated/commands/polls.js +6 -15
  51. package/dist/generated/commands/premium-feeds.js +2 -3
  52. package/dist/generated/commands/processors.js +2 -3
  53. package/dist/generated/commands/questions.js +3 -6
  54. package/dist/generated/commands/referrals.js +2 -3
  55. package/dist/generated/commands/reports.js +2 -3
  56. package/dist/generated/commands/room-a2-a.js +6 -15
  57. package/dist/generated/commands/room-agents.js +13 -36
  58. package/dist/generated/commands/room-invites.js +9 -24
  59. package/dist/generated/commands/room-owned-agent.js +3 -6
  60. package/dist/generated/commands/room-page.js +2 -3
  61. package/dist/generated/commands/rooms.js +45 -132
  62. package/dist/generated/commands/saved-messages.js +4 -9
  63. package/dist/generated/commands/saved-stories.js +7 -18
  64. package/dist/generated/commands/search.js +2 -3
  65. package/dist/generated/commands/shadow-home-agent.js +3 -6
  66. package/dist/generated/commands/shadow.js +5 -12
  67. package/dist/generated/commands/share-cards.js +4 -9
  68. package/dist/generated/commands/share.js +2 -3
  69. package/dist/generated/commands/sponsors.js +2 -3
  70. package/dist/generated/commands/stories.js +12 -33
  71. package/dist/generated/commands/story-by-id.js +2 -3
  72. package/dist/generated/commands/submissions.js +4 -9
  73. package/dist/generated/commands/subscriptions.js +8 -21
  74. package/dist/generated/commands/tips.js +3 -6
  75. package/dist/generated/commands/users.js +16 -45
  76. package/dist/generated/commands/voice-token.js +2 -3
  77. package/dist/generated/commands/well-known.js +3 -6
  78. package/dist/generated/commands/wrapped.js +2 -3
  79. package/dist/generated/index.js +0 -2
  80. package/package.json +3 -2
  81. package/dist/generated/commands/health.js +0 -32
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "discover", "Discover operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("tags")
8
9
  .description("GET /api/v1/discover/tags")
9
10
  .action(async (opts) => {
10
- const { as } = program.opts();
11
- if (!as)
12
- throw new Error("--as <userId> is required");
11
+ const as = actingUserId(program);
13
12
  const path = `/api/v1/discover/tags`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -28,9 +27,7 @@ export function register(program) {
28
27
  .option("--limit <value>", "string")
29
28
  .option("--page <value>", "string")
30
29
  .action(async (opts) => {
31
- const { as } = program.opts();
32
- if (!as)
33
- throw new Error("--as <userId> is required");
30
+ const as = actingUserId(program);
34
31
  const path = `/api/v1/discover/rooms`;
35
32
  const query = {};
36
33
  {
@@ -82,9 +79,7 @@ export function register(program) {
82
79
  .command("trending-rooms")
83
80
  .description("GET /api/v1/discover/rooms/trending")
84
81
  .action(async (opts) => {
85
- const { as } = program.opts();
86
- if (!as)
87
- throw new Error("--as <userId> is required");
82
+ const as = actingUserId(program);
88
83
  const path = `/api/v1/discover/rooms/trending`;
89
84
  const data = await call({ method: "GET", path, asUserId: as });
90
85
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -96,9 +91,7 @@ export function register(program) {
96
91
  .description("GET /api/v1/discover/rooms/by-slug/{slug}")
97
92
  .requiredOption("--slug <value>", "slug (path param)")
98
93
  .action(async (opts) => {
99
- const { as } = program.opts();
100
- if (!as)
101
- throw new Error("--as <userId> is required");
94
+ const as = actingUserId(program);
102
95
  const path = `/api/v1/discover/rooms/by-slug/${encodeURIComponent(opts.slug)}`;
103
96
  const data = await call({ method: "GET", path, asUserId: as });
104
97
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -110,9 +103,7 @@ export function register(program) {
110
103
  .description("GET /api/v1/discover/stories/trending")
111
104
  .option("--limit <value>", "string")
112
105
  .action(async (opts) => {
113
- const { as } = program.opts();
114
- if (!as)
115
- throw new Error("--as <userId> is required");
106
+ const as = actingUserId(program);
116
107
  const path = `/api/v1/discover/stories/trending`;
117
108
  const query = {};
118
109
  {
@@ -137,9 +128,7 @@ export function register(program) {
137
128
  .option("--limit <value>", "string")
138
129
  .option("--page <value>", "string")
139
130
  .action(async (opts) => {
140
- const { as } = program.opts();
141
- if (!as)
142
- throw new Error("--as <userId> is required");
131
+ const as = actingUserId(program);
143
132
  const path = `/api/v1/discover/rooms/enriched`;
144
133
  const query = {};
145
134
  {
@@ -192,9 +181,7 @@ export function register(program) {
192
181
  .description("GET /api/v1/discover/challenges/active")
193
182
  .option("--limit <value>", "string")
194
183
  .action(async (opts) => {
195
- const { as } = program.opts();
196
- if (!as)
197
- throw new Error("--as <userId> is required");
184
+ const as = actingUserId(program);
198
185
  const path = `/api/v1/discover/challenges/active`;
199
186
  const query = {};
200
187
  {
@@ -213,9 +200,7 @@ export function register(program) {
213
200
  .option("--cursor <value>", "string")
214
201
  .option("--limit <value>", "string")
215
202
  .action(async (opts) => {
216
- const { as } = program.opts();
217
- if (!as)
218
- throw new Error("--as <userId> is required");
203
+ const as = actingUserId(program);
219
204
  const path = `/api/v1/discover/templates`;
220
205
  const query = {};
221
206
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "dm", "Dm operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("POST /api/v1/dm/start")
9
10
  .option("--body <json>", "request body as JSON (no schema available)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/dm/start`;
15
14
  const body = opts.body ? JSON.parse(opts.body) : undefined;
16
15
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -23,9 +22,7 @@ export function register(program) {
23
22
  .description("POST /api/v1/dm/start-agent")
24
23
  .option("--body <json>", "request body as JSON (no schema available)")
25
24
  .action(async (opts) => {
26
- const { as } = program.opts();
27
- if (!as)
28
- throw new Error("--as <userId> is required");
25
+ const as = actingUserId(program);
29
26
  const path = `/api/v1/dm/start-agent`;
30
27
  const body = opts.body ? JSON.parse(opts.body) : undefined;
31
28
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -40,9 +37,7 @@ export function register(program) {
40
37
  .option("--limit <value>", "string")
41
38
  .option("--include-shadow <value>", "string")
42
39
  .action(async (opts) => {
43
- const { as } = program.opts();
44
- if (!as)
45
- throw new Error("--as <userId> is required");
40
+ const as = actingUserId(program);
46
41
  const path = `/api/v1/dm`;
47
42
  const query = {};
48
43
  {
@@ -71,9 +66,7 @@ export function register(program) {
71
66
  .requiredOption("--user-id <value>", "userId (path param)")
72
67
  .option("--body <json>", "request body as JSON (no schema available)")
73
68
  .action(async (opts) => {
74
- const { as } = program.opts();
75
- if (!as)
76
- throw new Error("--as <userId> is required");
69
+ const as = actingUserId(program);
77
70
  const path = `/api/v1/dm/block/${encodeURIComponent(opts.userId)}`;
78
71
  const body = opts.body ? JSON.parse(opts.body) : undefined;
79
72
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -86,9 +79,7 @@ export function register(program) {
86
79
  .description("DELETE /api/v1/dm/block/{userId}")
87
80
  .requiredOption("--user-id <value>", "userId (path param)")
88
81
  .action(async (opts) => {
89
- const { as } = program.opts();
90
- if (!as)
91
- throw new Error("--as <userId> is required");
82
+ const as = actingUserId(program);
92
83
  const path = `/api/v1/dm/block/${encodeURIComponent(opts.userId)}`;
93
84
  const data = await call({ method: "DELETE", path, asUserId: as });
94
85
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -99,9 +90,7 @@ export function register(program) {
99
90
  .command("list-blocked-users")
100
91
  .description("GET /api/v1/dm/blocked")
101
92
  .action(async (opts) => {
102
- const { as } = program.opts();
103
- if (!as)
104
- throw new Error("--as <userId> is required");
93
+ const as = actingUserId(program);
105
94
  const path = `/api/v1/dm/blocked`;
106
95
  const data = await call({ method: "GET", path, asUserId: as });
107
96
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -113,9 +102,7 @@ export function register(program) {
113
102
  .description("GET /api/v1/dm/check-block/{userId}")
114
103
  .requiredOption("--user-id <value>", "userId (path param)")
115
104
  .action(async (opts) => {
116
- const { as } = program.opts();
117
- if (!as)
118
- throw new Error("--as <userId> is required");
105
+ const as = actingUserId(program);
119
106
  const path = `/api/v1/dm/check-block/${encodeURIComponent(opts.userId)}`;
120
107
  const data = await call({ method: "GET", path, asUserId: as });
121
108
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -128,9 +115,7 @@ export function register(program) {
128
115
  .requiredOption("--room-id <value>", "roomId (path param)")
129
116
  .option("--body <json>", "request body as JSON (no schema available)")
130
117
  .action(async (opts) => {
131
- const { as } = program.opts();
132
- if (!as)
133
- throw new Error("--as <userId> is required");
118
+ const as = actingUserId(program);
134
119
  const path = `/api/v1/dm/rooms/${encodeURIComponent(opts.roomId)}/clear`;
135
120
  const body = opts.body ? JSON.parse(opts.body) : undefined;
136
121
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -143,9 +128,7 @@ export function register(program) {
143
128
  .description("DELETE /api/v1/dm/rooms/{roomId}")
144
129
  .requiredOption("--room-id <value>", "roomId (path param)")
145
130
  .action(async (opts) => {
146
- const { as } = program.opts();
147
- if (!as)
148
- throw new Error("--as <userId> is required");
131
+ const as = actingUserId(program);
149
132
  const path = `/api/v1/dm/rooms/${encodeURIComponent(opts.roomId)}`;
150
133
  const data = await call({ method: "DELETE", path, asUserId: as });
151
134
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "drafts", "Drafts operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /api/v1/drafts")
9
10
  .option("--room-id <value>", "string")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/drafts`;
15
14
  const query = {};
16
15
  {
@@ -28,9 +27,7 @@ export function register(program) {
28
27
  .description("PATCH /api/v1/drafts")
29
28
  .option("--body <json>", "request body as JSON (no schema available)")
30
29
  .action(async (opts) => {
31
- const { as } = program.opts();
32
- if (!as)
33
- throw new Error("--as <userId> is required");
30
+ const as = actingUserId(program);
34
31
  const path = `/api/v1/drafts`;
35
32
  const body = opts.body ? JSON.parse(opts.body) : undefined;
36
33
  const data = await call({ method: "PATCH", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "embed", "Embed operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /embed/{storyId}")
9
10
  .requiredOption("--story-id <value>", "storyId (path param)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/embed/${encodeURIComponent(opts.storyId)}`;
15
14
  const data = await call({ method: "GET", path, asUserId: as });
16
15
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -22,9 +21,7 @@ export function register(program) {
22
21
  .description("GET /embed/{storyId}/snippet")
23
22
  .requiredOption("--story-id <value>", "storyId (path param)")
24
23
  .action(async (opts) => {
25
- const { as } = program.opts();
26
- if (!as)
27
- throw new Error("--as <userId> is required");
24
+ const as = actingUserId(program);
28
25
  const path = `/embed/${encodeURIComponent(opts.storyId)}/snippet`;
29
26
  const data = await call({ method: "GET", path, asUserId: as });
30
27
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "explore", "Explore operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("explore-page")
8
9
  .description("GET /explore")
9
10
  .action(async (opts) => {
10
- const { as } = program.opts();
11
- if (!as)
12
- throw new Error("--as <userId> is required");
11
+ const as = actingUserId(program);
13
12
  const path = `/explore`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "feed", "Feed operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .option("--cursor <value>", "string")
10
11
  .option("--limit <value>", "string")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/api/v1/users/me/feed`;
16
15
  const query = {};
17
16
  {
@@ -34,9 +33,7 @@ export function register(program) {
34
33
  .description("GET /api/v1/users/me/feed/suggestions")
35
34
  .option("--limit <value>", "string")
36
35
  .action(async (opts) => {
37
- const { as } = program.opts();
38
- if (!as)
39
- throw new Error("--as <userId> is required");
36
+ const as = actingUserId(program);
40
37
  const path = `/api/v1/users/me/feed/suggestions`;
41
38
  const query = {};
42
39
  {
@@ -54,9 +51,7 @@ export function register(program) {
54
51
  .description("POST /api/v1/users/me/feed/dismiss")
55
52
  .option("--body <json>", "request body as JSON (no schema available)")
56
53
  .action(async (opts) => {
57
- const { as } = program.opts();
58
- if (!as)
59
- throw new Error("--as <userId> is required");
54
+ const as = actingUserId(program);
60
55
  const path = `/api/v1/users/me/feed/dismiss`;
61
56
  const body = opts.body ? JSON.parse(opts.body) : undefined;
62
57
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "feedback", "Feedback operations");
@@ -11,9 +12,7 @@ export function register(program) {
11
12
  .option("--screenshot <value>", "string")
12
13
  .option("--rating <n>", "number")
13
14
  .action(async (opts) => {
14
- const { as } = program.opts();
15
- if (!as)
16
- throw new Error("--as <userId> is required");
15
+ const as = actingUserId(program);
17
16
  const path = `/api/v1/feedback`;
18
17
  const body = {};
19
18
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "gamification", "Gamification operations");
@@ -7,9 +8,7 @@ export function register(program) {
7
8
  .command("my-impact")
8
9
  .description("GET /api/v1/users/me/impact")
9
10
  .action(async (opts) => {
10
- const { as } = program.opts();
11
- if (!as)
12
- throw new Error("--as <userId> is required");
11
+ const as = actingUserId(program);
13
12
  const path = `/api/v1/users/me/impact`;
14
13
  const data = await call({ method: "GET", path, asUserId: as });
15
14
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -21,9 +20,7 @@ export function register(program) {
21
20
  .description("GET /api/v1/users/{userId}/impact")
22
21
  .requiredOption("--user-id <value>", "userId (path param)")
23
22
  .action(async (opts) => {
24
- const { as } = program.opts();
25
- if (!as)
26
- throw new Error("--as <userId> is required");
23
+ const as = actingUserId(program);
27
24
  const path = `/api/v1/users/${encodeURIComponent(opts.userId)}/impact`;
28
25
  const data = await call({ method: "GET", path, asUserId: as });
29
26
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "google-play-iap", "GooglePlayIap operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .requiredOption("--purchase-token <value>", "string")
10
11
  .requiredOption("--product-id <value>", "string")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/api/v1/subscriptions/google/verify`;
16
15
  const body = {};
17
16
  {
@@ -35,9 +34,7 @@ export function register(program) {
35
34
  .requiredOption("--purchase-token <value>", "string")
36
35
  .requiredOption("--product-id <value>", "string")
37
36
  .action(async (opts) => {
38
- const { as } = program.opts();
39
- if (!as)
40
- throw new Error("--as <userId> is required");
37
+ const as = actingUserId(program);
41
38
  const path = `/api/v1/subscriptions/google/restore`;
42
39
  const body = {};
43
40
  {
@@ -60,9 +57,7 @@ export function register(program) {
60
57
  .description("POST /api/v1/webhooks/google-play")
61
58
  .option("--body <json>", "request body as JSON (no schema available)")
62
59
  .action(async (opts) => {
63
- const { as } = program.opts();
64
- if (!as)
65
- throw new Error("--as <userId> is required");
60
+ const as = actingUserId(program);
66
61
  const path = `/api/v1/webhooks/google-play`;
67
62
  const body = opts.body ? JSON.parse(opts.body) : undefined;
68
63
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "internal", "Internal operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .requiredOption("--room-id <value>", "roomId (path param)")
10
11
  .option("--body <json>", "request body as JSON (no schema available)")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/api/v1/internal/rooms/${encodeURIComponent(opts.roomId)}/emit-message`;
16
15
  const body = opts.body ? JSON.parse(opts.body) : undefined;
17
16
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -24,9 +23,7 @@ export function register(program) {
24
23
  .description("POST /api/v1/internal/voice/dispatch")
25
24
  .option("--body <json>", "request body as JSON (no schema available)")
26
25
  .action(async (opts) => {
27
- const { as } = program.opts();
28
- if (!as)
29
- throw new Error("--as <userId> is required");
26
+ const as = actingUserId(program);
30
27
  const path = `/api/v1/internal/voice/dispatch`;
31
28
  const body = opts.body ? JSON.parse(opts.body) : undefined;
32
29
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -42,9 +39,7 @@ export function register(program) {
42
39
  .option("--limit <json>", " (JSON)")
43
40
  .option("--q <json>", " (JSON)")
44
41
  .action(async (opts) => {
45
- const { as } = program.opts();
46
- if (!as)
47
- throw new Error("--as <userId> is required");
42
+ const as = actingUserId(program);
48
43
  const path = `/api/v1/internal/users`;
49
44
  const query = {};
50
45
  {
@@ -78,9 +73,7 @@ export function register(program) {
78
73
  .requiredOption("--user-id <value>", "userId (path param)")
79
74
  .option("--body <json>", "request body as JSON (no schema available)")
80
75
  .action(async (opts) => {
81
- const { as } = program.opts();
82
- if (!as)
83
- throw new Error("--as <userId> is required");
76
+ const as = actingUserId(program);
84
77
  const path = `/api/v1/internal/users/${encodeURIComponent(opts.userId)}/tier`;
85
78
  const body = opts.body ? JSON.parse(opts.body) : undefined;
86
79
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -94,9 +87,7 @@ export function register(program) {
94
87
  .option("--limit <json>", " (JSON)")
95
88
  .option("--q <json>", " (JSON)")
96
89
  .action(async (opts) => {
97
- const { as } = program.opts();
98
- if (!as)
99
- throw new Error("--as <userId> is required");
90
+ const as = actingUserId(program);
100
91
  const path = `/api/v1/internal/email-auth/allowlist`;
101
92
  const query = {};
102
93
  {
@@ -119,9 +110,7 @@ export function register(program) {
119
110
  .description("POST /api/v1/internal/email-auth/allowlist")
120
111
  .option("--body <json>", "request body as JSON (no schema available)")
121
112
  .action(async (opts) => {
122
- const { as } = program.opts();
123
- if (!as)
124
- throw new Error("--as <userId> is required");
113
+ const as = actingUserId(program);
125
114
  const path = `/api/v1/internal/email-auth/allowlist`;
126
115
  const body = opts.body ? JSON.parse(opts.body) : undefined;
127
116
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -135,9 +124,7 @@ export function register(program) {
135
124
  .requiredOption("--email <value>", "email (path param)")
136
125
  .option("--body <json>", "request body as JSON (no schema available)")
137
126
  .action(async (opts) => {
138
- const { as } = program.opts();
139
- if (!as)
140
- throw new Error("--as <userId> is required");
127
+ const as = actingUserId(program);
141
128
  const path = `/api/v1/internal/email-auth/allowlist/${encodeURIComponent(opts.email)}`;
142
129
  const body = opts.body ? JSON.parse(opts.body) : undefined;
143
130
  const data = await call({ method: "PATCH", path, asUserId: as, body });
@@ -150,9 +137,7 @@ export function register(program) {
150
137
  .description("DELETE /api/v1/internal/email-auth/allowlist/{email}")
151
138
  .requiredOption("--email <value>", "email (path param)")
152
139
  .action(async (opts) => {
153
- const { as } = program.opts();
154
- if (!as)
155
- throw new Error("--as <userId> is required");
140
+ const as = actingUserId(program);
156
141
  const path = `/api/v1/internal/email-auth/allowlist/${encodeURIComponent(opts.email)}`;
157
142
  const data = await call({ method: "DELETE", path, asUserId: as });
158
143
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,6 +1,7 @@
1
1
  // Auto-generated. Do not edit by hand. Regenerate via `npm run generate`.
2
2
  import { Option } from "commander";
3
3
  import { call } from "../../client.js";
4
+ import { actingUserId } from "../../auth.js";
4
5
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
5
6
  export function register(program) {
6
7
  const group = getOrCreateGroup(program, "interview", "Interview operations");
@@ -11,9 +12,7 @@ export function register(program) {
11
12
  .addOption(new Option("--mode <value>", "string, enum").choices(["room", "agent"]).makeOptionMandatory())
12
13
  .option("--seed <value>", "string, ≤10000 chars")
13
14
  .action(async (opts) => {
14
- const { as } = program.opts();
15
- if (!as)
16
- throw new Error("--as <userId> is required");
15
+ const as = actingUserId(program);
17
16
  const path = `/api/v1/assistant/interview/start`;
18
17
  const body = {};
19
18
  {
@@ -37,9 +36,7 @@ export function register(program) {
37
36
  .requiredOption("--session-id <value>", "sessionId (path param)")
38
37
  .requiredOption("--message <value>", "string, ≤10000 chars")
39
38
  .action(async (opts) => {
40
- const { as } = program.opts();
41
- if (!as)
42
- throw new Error("--as <userId> is required");
39
+ const as = actingUserId(program);
43
40
  const path = `/api/v1/assistant/interview/${encodeURIComponent(opts.sessionId)}/reply`;
44
41
  const body = {};
45
42
  {
@@ -58,9 +55,7 @@ export function register(program) {
58
55
  .requiredOption("--session-id <value>", "sessionId (path param)")
59
56
  .requiredOption("--proposal <json>", " (JSON)")
60
57
  .action(async (opts) => {
61
- const { as } = program.opts();
62
- if (!as)
63
- throw new Error("--as <userId> is required");
58
+ const as = actingUserId(program);
64
59
  const path = `/api/v1/assistant/interview/${encodeURIComponent(opts.sessionId)}/confirm`;
65
60
  const body = {};
66
61
  {
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "invite-redirect", "InviteRedirect operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("GET /c/{inviteCode}")
9
10
  .requiredOption("--invite-code <value>", "inviteCode (path param)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/c/${encodeURIComponent(opts.inviteCode)}`;
15
14
  const data = await call({ method: "GET", path, asUserId: as });
16
15
  process.stdout.write(JSON.stringify(data) + "\n");
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "jesuscord-admin", "JesuscordAdmin operations");
@@ -8,9 +9,7 @@ export function register(program) {
8
9
  .description("POST /api/v1/admin/jesuscord/setup")
9
10
  .option("--body <json>", "request body as JSON (no schema available)")
10
11
  .action(async (opts) => {
11
- const { as } = program.opts();
12
- if (!as)
13
- throw new Error("--as <userId> is required");
12
+ const as = actingUserId(program);
14
13
  const path = `/api/v1/admin/jesuscord/setup`;
15
14
  const body = opts.body ? JSON.parse(opts.body) : undefined;
16
15
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -23,9 +22,7 @@ export function register(program) {
23
22
  .description("POST /api/v1/admin/jesuscord/cleanup")
24
23
  .option("--body <json>", "request body as JSON (no schema available)")
25
24
  .action(async (opts) => {
26
- const { as } = program.opts();
27
- if (!as)
28
- throw new Error("--as <userId> is required");
25
+ const as = actingUserId(program);
29
26
  const path = `/api/v1/admin/jesuscord/cleanup`;
30
27
  const body = opts.body ? JSON.parse(opts.body) : undefined;
31
28
  const data = await call({ method: "POST", path, asUserId: as, body });
@@ -1,4 +1,5 @@
1
1
  import { call } from "../../client.js";
2
+ import { actingUserId } from "../../auth.js";
2
3
  import { getOrCreateGroup, hasSubcommand } from "../_helpers.js";
3
4
  export function register(program) {
4
5
  const group = getOrCreateGroup(program, "join", "Join operations");
@@ -9,9 +10,7 @@ export function register(program) {
9
10
  .requiredOption("--code <value>", "code (path param)")
10
11
  .option("--ref <json>", " (JSON)")
11
12
  .action(async (opts) => {
12
- const { as } = program.opts();
13
- if (!as)
14
- throw new Error("--as <userId> is required");
13
+ const as = actingUserId(program);
15
14
  const path = `/join/${encodeURIComponent(opts.code)}`;
16
15
  const query = {};
17
16
  {