@geoly-ai/social-hub-cli 0.2.5 → 0.2.7
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/CHANGELOG.md +24 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +12 -2
- package/dist/client.js.map +1 -1
- package/dist/cmd-manifest.json +8 -2
- package/dist/context-state.test.d.ts +2 -0
- package/dist/context-state.test.d.ts.map +1 -0
- package/dist/context-state.test.js +51 -0
- package/dist/context-state.test.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +423 -298
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/manifest.json +1 -1
- package/skills/social-hub-accounts/SKILL.md +2 -2
- package/skills/social-hub-intelligence/SKILL.md +64 -2
- package/skills/social-hub-shared/SKILL.md +3 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { getSocialHubHealth, } from "@geoly-ai/social-hub-sdk";
|
|
4
|
-
import { getBaseUrl, requireClient } from "./client.js";
|
|
4
|
+
import { getBaseUrl, requireClient, resolveTeamId } from "./client.js";
|
|
5
5
|
import { registerAccountsExtensions, registerAuthAndConfig, registerAuthzEvaluate, registerPermissionsExplain, registerRedditExtensions, listRedditSnapshotsPaginated, redditAggregateQueryParams, } from "./register-extensions.js";
|
|
6
6
|
import { registerAdminCommands } from "./register-admin.js";
|
|
7
7
|
import { assertApplyOrDryRun } from "./dry-run.js";
|
|
@@ -47,7 +47,7 @@ program
|
|
|
47
47
|
const events = program.command("events").description("互动事件");
|
|
48
48
|
events
|
|
49
49
|
.command("append")
|
|
50
|
-
.
|
|
50
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
51
51
|
.requiredOption("--type <type>", "事件类型,如 comment")
|
|
52
52
|
.option("--external-ref <ref>", "幂等键(也可放在 payload.externalRef / event_id)")
|
|
53
53
|
.option("--account <uuid>", "socialAccountId")
|
|
@@ -66,7 +66,7 @@ events
|
|
|
66
66
|
console.error("Invalid --payload JSON");
|
|
67
67
|
process.exit(1);
|
|
68
68
|
}
|
|
69
|
-
const res = await requireClient().appendEvent(opts.team, {
|
|
69
|
+
const res = await requireClient().appendEvent(resolveTeamId(opts.team), {
|
|
70
70
|
type: opts.type,
|
|
71
71
|
brandId: opts.brand,
|
|
72
72
|
externalRef: opts.externalRef ??
|
|
@@ -103,16 +103,16 @@ events
|
|
|
103
103
|
});
|
|
104
104
|
events
|
|
105
105
|
.command("list")
|
|
106
|
-
.
|
|
106
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
107
107
|
.option("-n, --limit <n>", "条数", "20")
|
|
108
108
|
.action(async (opts) => {
|
|
109
|
-
const res = await requireClient().listEvents(opts.team, Number(opts.limit));
|
|
109
|
+
const res = await requireClient().listEvents(resolveTeamId(opts.team), Number(opts.limit));
|
|
110
110
|
console.log(JSON.stringify(res, null, 2));
|
|
111
111
|
});
|
|
112
112
|
events
|
|
113
113
|
.command("batch")
|
|
114
114
|
.description("POST /events/batch")
|
|
115
|
-
.
|
|
115
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
116
116
|
.requiredOption("-j, --json <json>", '{ "events": [ ... ] }')
|
|
117
117
|
.action(async (opts) => {
|
|
118
118
|
let body;
|
|
@@ -123,13 +123,13 @@ events
|
|
|
123
123
|
console.error("Invalid -j / --json");
|
|
124
124
|
process.exit(1);
|
|
125
125
|
}
|
|
126
|
-
const res = await requireClient().appendEventsBatch(opts.team, body);
|
|
126
|
+
const res = await requireClient().appendEventsBatch(resolveTeamId(opts.team), body);
|
|
127
127
|
console.log(JSON.stringify(res, null, 2));
|
|
128
128
|
});
|
|
129
129
|
events
|
|
130
130
|
.command("import-openclaw-history")
|
|
131
131
|
.description("POST /interaction-history/import — OpenClaw v1 JSON 幂等入库")
|
|
132
|
-
.
|
|
132
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
133
133
|
.requiredOption("-f, --file <path>", "interaction-history.json 路径")
|
|
134
134
|
.option("--dry-run", "只校验 schema/slot/幂等,不写库")
|
|
135
135
|
.option("--no-auto-mark", "关闭 auto_metrics 阈值补 mark")
|
|
@@ -144,7 +144,7 @@ events
|
|
|
144
144
|
console.error("Invalid JSON file");
|
|
145
145
|
process.exit(1);
|
|
146
146
|
}
|
|
147
|
-
const res = await requireClient().importInteractionHistory(opts.team, {
|
|
147
|
+
const res = await requireClient().importInteractionHistory(resolveTeamId(opts.team), {
|
|
148
148
|
...parsed,
|
|
149
149
|
sourceFile: opts.file,
|
|
150
150
|
dryRun: Boolean(opts.dryRun),
|
|
@@ -155,14 +155,14 @@ events
|
|
|
155
155
|
const styleMarks = program.command("style-marks").description("风格反馈标记");
|
|
156
156
|
styleMarks
|
|
157
157
|
.command("list")
|
|
158
|
-
.
|
|
158
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
159
159
|
.option("--account <uuid>", "socialAccountId")
|
|
160
160
|
.option("--extract-status <st>", "pending | extracted | rejected | skipped | failed")
|
|
161
161
|
.option("--approved <bool>", "true | false")
|
|
162
162
|
.option("-n, --limit <n>", "limit", "50")
|
|
163
163
|
.option("--offset <n>", "offset", "0")
|
|
164
164
|
.action(async (opts) => {
|
|
165
|
-
const res = await requireClient().listStyleMarks(opts.team, {
|
|
165
|
+
const res = await requireClient().listStyleMarks(resolveTeamId(opts.team), {
|
|
166
166
|
socialAccountId: opts.account,
|
|
167
167
|
extractStatus: opts.extractStatus,
|
|
168
168
|
approved: opts.approved === undefined ? undefined : opts.approved === "true",
|
|
@@ -173,11 +173,11 @@ styleMarks
|
|
|
173
173
|
});
|
|
174
174
|
styleMarks
|
|
175
175
|
.command("approve")
|
|
176
|
-
.
|
|
176
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
177
177
|
.requiredOption("--id <styleMarkId>", "Style mark UUID")
|
|
178
178
|
.option("--note <text>", "Reviewer note")
|
|
179
179
|
.action(async (opts) => {
|
|
180
|
-
const res = await requireClient().patchStyleMark(opts.team, opts.id, {
|
|
180
|
+
const res = await requireClient().patchStyleMark(resolveTeamId(opts.team), opts.id, {
|
|
181
181
|
approved: true,
|
|
182
182
|
extractStatus: "pending",
|
|
183
183
|
note: opts.note,
|
|
@@ -186,11 +186,11 @@ styleMarks
|
|
|
186
186
|
});
|
|
187
187
|
styleMarks
|
|
188
188
|
.command("reject")
|
|
189
|
-
.
|
|
189
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
190
190
|
.requiredOption("--id <styleMarkId>", "Style mark UUID")
|
|
191
191
|
.option("--note <text>", "Reviewer note")
|
|
192
192
|
.action(async (opts) => {
|
|
193
|
-
const res = await requireClient().patchStyleMark(opts.team, opts.id, {
|
|
193
|
+
const res = await requireClient().patchStyleMark(resolveTeamId(opts.team), opts.id, {
|
|
194
194
|
approved: false,
|
|
195
195
|
extractStatus: "rejected",
|
|
196
196
|
note: opts.note,
|
|
@@ -199,11 +199,11 @@ styleMarks
|
|
|
199
199
|
});
|
|
200
200
|
styleMarks
|
|
201
201
|
.command("extract")
|
|
202
|
-
.
|
|
202
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
203
203
|
.requiredOption("--id <styleMarkId>", "Style mark UUID")
|
|
204
204
|
.option("--dry-run", "只预览提取结果")
|
|
205
205
|
.action(async (opts) => {
|
|
206
|
-
const res = await requireClient().extractStyleMark(opts.team, opts.id, {
|
|
206
|
+
const res = await requireClient().extractStyleMark(resolveTeamId(opts.team), opts.id, {
|
|
207
207
|
dryRun: Boolean(opts.dryRun),
|
|
208
208
|
});
|
|
209
209
|
console.log(JSON.stringify(res, null, 2));
|
|
@@ -211,7 +211,7 @@ styleMarks
|
|
|
211
211
|
styleMarks
|
|
212
212
|
.command("set")
|
|
213
213
|
.description("PUT /events/external/:eventExternalRef/style-mark (idempotent upsert)")
|
|
214
|
-
.
|
|
214
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
215
215
|
.requiredOption("--event-ref <ref>", "event externalRef")
|
|
216
216
|
.requiredOption("-j, --json <json>", "body JSON")
|
|
217
217
|
.action(async (opts) => {
|
|
@@ -223,13 +223,13 @@ styleMarks
|
|
|
223
223
|
console.error("Invalid -j / --json");
|
|
224
224
|
process.exit(1);
|
|
225
225
|
}
|
|
226
|
-
const res = await requireClient().upsertEventStyleMarkByExternalRef(opts.team, opts.eventRef, body);
|
|
226
|
+
const res = await requireClient().upsertEventStyleMarkByExternalRef(resolveTeamId(opts.team), opts.eventRef, body);
|
|
227
227
|
console.log(JSON.stringify(res, null, 2));
|
|
228
228
|
});
|
|
229
229
|
styleMarks
|
|
230
230
|
.command("create")
|
|
231
231
|
.description("POST /style-marks(直接创建;事件可不存在,eventExternalRef 必填)")
|
|
232
|
-
.
|
|
232
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
233
233
|
.requiredOption("-j, --json <json>", "{ eventExternalRef, markExternalRef?, socialAccountId?, approved?, reasonTags?, styleTags?, note? }")
|
|
234
234
|
.action(async (opts) => {
|
|
235
235
|
let body;
|
|
@@ -240,18 +240,18 @@ styleMarks
|
|
|
240
240
|
console.error("Invalid -j / --json");
|
|
241
241
|
process.exit(1);
|
|
242
242
|
}
|
|
243
|
-
const res = await requireClient().createStyleMark(opts.team, body);
|
|
243
|
+
const res = await requireClient().createStyleMark(resolveTeamId(opts.team), body);
|
|
244
244
|
console.log(JSON.stringify(res, null, 2));
|
|
245
245
|
});
|
|
246
246
|
const curator = program.command("curator").description("风格沉淀 curator");
|
|
247
247
|
curator
|
|
248
248
|
.command("run")
|
|
249
|
-
.
|
|
249
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
250
250
|
.requiredOption("--account <ref>", "账号 UUID 或 handle/slot")
|
|
251
251
|
.option("--dry-run", "只预览")
|
|
252
252
|
.option("-n, --limit <n>", "最多处理 pending marks", "50")
|
|
253
253
|
.action(async (opts) => {
|
|
254
|
-
const res = await requireClient().runStyleCurator(opts.team, opts.account, {
|
|
254
|
+
const res = await requireClient().runStyleCurator(resolveTeamId(opts.team), opts.account, {
|
|
255
255
|
dryRun: Boolean(opts.dryRun),
|
|
256
256
|
limit: Number(opts.limit),
|
|
257
257
|
});
|
|
@@ -262,14 +262,14 @@ const dashboard = program.command("dashboard").description("运营总览");
|
|
|
262
262
|
dashboard
|
|
263
263
|
.command("summary")
|
|
264
264
|
.description("GET /dashboard/summary")
|
|
265
|
-
.
|
|
265
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
266
266
|
.option("--from <iso>", "from ISO 日期")
|
|
267
267
|
.option("--to <iso>", "to ISO 日期")
|
|
268
268
|
.option("--trend-days <n>", "interactionTrendDays: 7 | 14 | 30")
|
|
269
269
|
.option("--campaign <uuid>", "campaignId 过滤")
|
|
270
270
|
.option("--brand <uuid>", "brandId 过滤")
|
|
271
271
|
.action(async (opts) => {
|
|
272
|
-
const res = await requireClient().getDashboardSummary(opts.team, {
|
|
272
|
+
const res = await requireClient().getDashboardSummary(resolveTeamId(opts.team), {
|
|
273
273
|
from: opts.from,
|
|
274
274
|
to: opts.to,
|
|
275
275
|
interactionTrendDays: opts.trendDays
|
|
@@ -285,7 +285,7 @@ const calendar = program.command("calendar").description("发布日历条目");
|
|
|
285
285
|
calendar
|
|
286
286
|
.command("list")
|
|
287
287
|
.description("GET /calendar-entries")
|
|
288
|
-
.
|
|
288
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
289
289
|
.option("--brand <uuid>", "brandId 过滤(推荐)")
|
|
290
290
|
.option("--campaign <uuid>", "campaignId 过滤(legacy)")
|
|
291
291
|
.option("--status <st>", "scheduled | running | succeeded | …")
|
|
@@ -293,7 +293,7 @@ calendar
|
|
|
293
293
|
.option("--to <iso>", "to 时间 ISO")
|
|
294
294
|
.option("-n, --limit <n>", "limit", "50")
|
|
295
295
|
.action(async (opts) => {
|
|
296
|
-
const res = await requireClient().listCalendarEntries(opts.team, {
|
|
296
|
+
const res = await requireClient().listCalendarEntries(resolveTeamId(opts.team), {
|
|
297
297
|
brandId: opts.brand,
|
|
298
298
|
campaignId: opts.campaign,
|
|
299
299
|
status: opts.status,
|
|
@@ -306,7 +306,7 @@ calendar
|
|
|
306
306
|
calendar
|
|
307
307
|
.command("patch")
|
|
308
308
|
.description("PATCH /calendar-entries/:id(--body 为 JSON)")
|
|
309
|
-
.
|
|
309
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
310
310
|
.requiredOption("-e, --entry <entryId>", "Calendar entry UUID")
|
|
311
311
|
.requiredOption("--body <json>", '例如 {"status":"succeeded","permalink":"https://www.reddit.com/..."}')
|
|
312
312
|
.action(async (opts) => {
|
|
@@ -318,7 +318,7 @@ calendar
|
|
|
318
318
|
console.error("Invalid --body JSON");
|
|
319
319
|
process.exit(1);
|
|
320
320
|
}
|
|
321
|
-
const res = await requireClient().updateCalendarEntry(opts.team, opts.entry, body);
|
|
321
|
+
const res = await requireClient().updateCalendarEntry(resolveTeamId(opts.team), opts.entry, body);
|
|
322
322
|
console.log(JSON.stringify(res, null, 2));
|
|
323
323
|
});
|
|
324
324
|
// --- reddit ---
|
|
@@ -327,7 +327,7 @@ registerRedditExtensions(reddit);
|
|
|
327
327
|
reddit
|
|
328
328
|
.command("list")
|
|
329
329
|
.description("GET /reddit-post-snapshots")
|
|
330
|
-
.
|
|
330
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
331
331
|
.option("--brand <uuid>", "system-level brandId")
|
|
332
332
|
.option("--entry <uuid>", "calendarEntryId")
|
|
333
333
|
.option("--ops-status <st>", "opsStatus filter (normal|risk|deleted|abnormal|unknown)")
|
|
@@ -344,7 +344,7 @@ reddit
|
|
|
344
344
|
.option("--aggregate", "aggregate across all visible teams (session auth)")
|
|
345
345
|
.option("--scope-team <uuid>", "narrow aggregated scope to one team")
|
|
346
346
|
.action(async (opts) => {
|
|
347
|
-
const res = await listRedditSnapshotsPaginated(opts.team, {
|
|
347
|
+
const res = await listRedditSnapshotsPaginated(resolveTeamId(opts.team), {
|
|
348
348
|
limit: Number(opts.limit),
|
|
349
349
|
offset: opts.offset !== undefined ? Number(opts.offset) : undefined,
|
|
350
350
|
brandId: opts.brand,
|
|
@@ -364,7 +364,7 @@ reddit
|
|
|
364
364
|
reddit
|
|
365
365
|
.command("create-snapshot")
|
|
366
366
|
.description("POST /reddit-post-snapshots(手工补录)")
|
|
367
|
-
.
|
|
367
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
368
368
|
.requiredOption("-j, --json <json>", '{"permalink":"...","subreddit":"...","score":0,"commentsCount":0,"brandNote":null,"negativeFeedback":null,"repostType":"none","firstRepostLink":null,"secondRepostLink":null}')
|
|
369
369
|
.action(async (opts) => {
|
|
370
370
|
let body;
|
|
@@ -375,7 +375,7 @@ reddit
|
|
|
375
375
|
console.error("Invalid -j / --json");
|
|
376
376
|
process.exit(1);
|
|
377
377
|
}
|
|
378
|
-
const res = await requireClient().createRedditPostSnapshot(opts.team, body);
|
|
378
|
+
const res = await requireClient().createRedditPostSnapshot(resolveTeamId(opts.team), body);
|
|
379
379
|
console.log(JSON.stringify(res, null, 2));
|
|
380
380
|
});
|
|
381
381
|
// --- jobs ---
|
|
@@ -383,11 +383,11 @@ const jobs = program.command("jobs").description("调度任务(scheduled jobs
|
|
|
383
383
|
jobs
|
|
384
384
|
.command("list")
|
|
385
385
|
.description("GET /scheduled-jobs")
|
|
386
|
-
.
|
|
386
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
387
387
|
.option("--status <st>", "scheduled | running | …")
|
|
388
388
|
.option("-n, --limit <n>", "limit", "50")
|
|
389
389
|
.action(async (opts) => {
|
|
390
|
-
const res = await requireClient().listScheduledJobs(opts.team, {
|
|
390
|
+
const res = await requireClient().listScheduledJobs(resolveTeamId(opts.team), {
|
|
391
391
|
limit: Number(opts.limit),
|
|
392
392
|
status: opts.status,
|
|
393
393
|
});
|
|
@@ -396,16 +396,16 @@ jobs
|
|
|
396
396
|
jobs
|
|
397
397
|
.command("summary")
|
|
398
398
|
.description("GET /scheduled-jobs/automation-summary")
|
|
399
|
-
.
|
|
399
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
400
400
|
.option("--hours <n>", "时间窗口(小时)", "24")
|
|
401
401
|
.action(async (opts) => {
|
|
402
|
-
const res = await requireClient().getScheduledJobsAutomationSummary(opts.team, Number(opts.hours));
|
|
402
|
+
const res = await requireClient().getScheduledJobsAutomationSummary(resolveTeamId(opts.team), Number(opts.hours));
|
|
403
403
|
console.log(JSON.stringify(res, null, 2));
|
|
404
404
|
});
|
|
405
405
|
jobs
|
|
406
406
|
.command("create")
|
|
407
407
|
.description("POST /scheduled-jobs(--json 为完整 body)")
|
|
408
|
-
.
|
|
408
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
409
409
|
.requiredOption("-j, --json <json>", "createScheduledJobBody JSON")
|
|
410
410
|
.action(async (opts) => {
|
|
411
411
|
let body;
|
|
@@ -416,13 +416,13 @@ jobs
|
|
|
416
416
|
console.error("Invalid -j / --json");
|
|
417
417
|
process.exit(1);
|
|
418
418
|
}
|
|
419
|
-
const res = await requireClient().createScheduledJob(opts.team, body);
|
|
419
|
+
const res = await requireClient().createScheduledJob(resolveTeamId(opts.team), body);
|
|
420
420
|
console.log(JSON.stringify(res, null, 2));
|
|
421
421
|
});
|
|
422
422
|
jobs
|
|
423
423
|
.command("batch")
|
|
424
424
|
.description("POST /scheduled-jobs/batch")
|
|
425
|
-
.
|
|
425
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
426
426
|
.requiredOption("-j, --json <json>", '{ "jobs": [ ... ] }')
|
|
427
427
|
.action(async (opts) => {
|
|
428
428
|
let body;
|
|
@@ -433,25 +433,25 @@ jobs
|
|
|
433
433
|
console.error("Invalid -j / --json");
|
|
434
434
|
process.exit(1);
|
|
435
435
|
}
|
|
436
|
-
const res = await requireClient().createScheduledJobsBatch(opts.team, body);
|
|
436
|
+
const res = await requireClient().createScheduledJobsBatch(resolveTeamId(opts.team), body);
|
|
437
437
|
console.log(JSON.stringify(res, null, 2));
|
|
438
438
|
});
|
|
439
439
|
jobs
|
|
440
440
|
.command("retry")
|
|
441
441
|
.description("POST /scheduled-jobs/:id/retry")
|
|
442
|
-
.
|
|
442
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
443
443
|
.requiredOption("-i, --id <jobId>", "Job UUID")
|
|
444
444
|
.action(async (opts) => {
|
|
445
|
-
const res = await requireClient().retryScheduledJob(opts.team, opts.id);
|
|
445
|
+
const res = await requireClient().retryScheduledJob(resolveTeamId(opts.team), opts.id);
|
|
446
446
|
console.log(JSON.stringify(res, null, 2));
|
|
447
447
|
});
|
|
448
448
|
jobs
|
|
449
449
|
.command("cancel")
|
|
450
450
|
.description("POST /scheduled-jobs/:id/cancel")
|
|
451
|
-
.
|
|
451
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
452
452
|
.requiredOption("-i, --id <jobId>", "Job UUID")
|
|
453
453
|
.action(async (opts) => {
|
|
454
|
-
const res = await requireClient().cancelScheduledJob(opts.team, opts.id);
|
|
454
|
+
const res = await requireClient().cancelScheduledJob(resolveTeamId(opts.team), opts.id);
|
|
455
455
|
console.log(JSON.stringify(res, null, 2));
|
|
456
456
|
});
|
|
457
457
|
// --- drafts & reports ---
|
|
@@ -461,7 +461,7 @@ const content = program
|
|
|
461
461
|
content
|
|
462
462
|
.command("review")
|
|
463
463
|
.description("POST /content-review — 评论发布前独立 LLM 复审+优化(层③);degraded 时降级本地自审")
|
|
464
|
-
.
|
|
464
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
465
465
|
.requiredOption("-j, --json <json>", "{ accountId, draft, commentType, thread:{subreddit,postTitle,...}, rewrite?, stage?, attempt? }")
|
|
466
466
|
.action(async (opts) => {
|
|
467
467
|
let body;
|
|
@@ -472,13 +472,13 @@ content
|
|
|
472
472
|
console.error("Invalid -j / --json");
|
|
473
473
|
process.exit(1);
|
|
474
474
|
}
|
|
475
|
-
const res = await requireClient().contentReview(opts.team, body);
|
|
475
|
+
const res = await requireClient().contentReview(resolveTeamId(opts.team), body);
|
|
476
476
|
console.log(JSON.stringify(res, null, 2));
|
|
477
477
|
});
|
|
478
478
|
content
|
|
479
479
|
.command("post-review")
|
|
480
480
|
.description("POST /post-review — 帖子(title+body)发布前独立 LLM 审核(七维,独立模型 key);仅审帖子正文,评论审核用 content review")
|
|
481
|
-
.
|
|
481
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
482
482
|
.requiredOption("-j, --json <json>", "{ accountId, title, body, subreddit, subredditRules?, rewrite?, stage?, attempt? }")
|
|
483
483
|
.action(async (opts) => {
|
|
484
484
|
let body;
|
|
@@ -489,19 +489,19 @@ content
|
|
|
489
489
|
console.error("Invalid -j / --json");
|
|
490
490
|
process.exit(1);
|
|
491
491
|
}
|
|
492
|
-
const res = await requireClient().postReview(opts.team, body);
|
|
492
|
+
const res = await requireClient().postReview(resolveTeamId(opts.team), body);
|
|
493
493
|
console.log(JSON.stringify(res, null, 2));
|
|
494
494
|
});
|
|
495
495
|
const drafts = program.command("drafts").description("内容草稿");
|
|
496
496
|
drafts
|
|
497
497
|
.command("list")
|
|
498
498
|
.description("GET /content-drafts")
|
|
499
|
-
.
|
|
499
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
500
500
|
.option("--brand <uuid>", "brandId 过滤(推荐)")
|
|
501
501
|
.option("--campaign <uuid>", "campaignId 过滤(legacy)")
|
|
502
502
|
.option("-n, --limit <n>", "limit", "50")
|
|
503
503
|
.action(async (opts) => {
|
|
504
|
-
const res = await requireClient().listContentDrafts(opts.team, {
|
|
504
|
+
const res = await requireClient().listContentDrafts(resolveTeamId(opts.team), {
|
|
505
505
|
limit: Number(opts.limit),
|
|
506
506
|
brandId: opts.brand,
|
|
507
507
|
campaignId: opts.campaign,
|
|
@@ -512,11 +512,11 @@ const reports = program.command("reports").description("报告库");
|
|
|
512
512
|
reports
|
|
513
513
|
.command("list")
|
|
514
514
|
.description("GET /reports")
|
|
515
|
-
.
|
|
515
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
516
516
|
.option("-n, --limit <n>", "limit", "50")
|
|
517
517
|
.option("--type <t>", "reddit-post-snapshot | account-status-snapshot | campaign-digest | agent-run-summary | style-curation-report | quota-violation-report | content-weekly")
|
|
518
518
|
.action(async (opts) => {
|
|
519
|
-
const res = await requireClient().listReports(opts.team, {
|
|
519
|
+
const res = await requireClient().listReports(resolveTeamId(opts.team), {
|
|
520
520
|
limit: Number(opts.limit),
|
|
521
521
|
reportType: opts.type,
|
|
522
522
|
});
|
|
@@ -525,7 +525,7 @@ reports
|
|
|
525
525
|
reports
|
|
526
526
|
.command("ingest")
|
|
527
527
|
.description("POST /reports/ingest")
|
|
528
|
-
.
|
|
528
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
529
529
|
.requiredOption("-j, --json <json>", "{ reportType, source, traceId? }")
|
|
530
530
|
.action(async (opts) => {
|
|
531
531
|
let body;
|
|
@@ -536,7 +536,7 @@ reports
|
|
|
536
536
|
console.error("Invalid -j / --json");
|
|
537
537
|
process.exit(1);
|
|
538
538
|
}
|
|
539
|
-
const res = await requireClient().ingestReport(opts.team, {
|
|
539
|
+
const res = await requireClient().ingestReport(resolveTeamId(opts.team), {
|
|
540
540
|
reportType: body.reportType,
|
|
541
541
|
source: body.source,
|
|
542
542
|
traceId: body.traceId,
|
|
@@ -549,7 +549,7 @@ registerAccountsExtensions(accounts);
|
|
|
549
549
|
accounts
|
|
550
550
|
.command("list")
|
|
551
551
|
.description("GET /accounts")
|
|
552
|
-
.
|
|
552
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
553
553
|
.option("--status <st>", "warming | active | …")
|
|
554
554
|
.option("--platform <p>", "平台")
|
|
555
555
|
.option("--brand <uuid>", "brandId 过滤(推荐)")
|
|
@@ -558,7 +558,7 @@ accounts
|
|
|
558
558
|
.option("--category <cat>", "人设分类")
|
|
559
559
|
.option("-n, --limit <n>", "limit", "50")
|
|
560
560
|
.action(async (opts) => {
|
|
561
|
-
const res = await requireClient().listAccounts(opts.team, {
|
|
561
|
+
const res = await requireClient().listAccounts(resolveTeamId(opts.team), {
|
|
562
562
|
limit: Number(opts.limit),
|
|
563
563
|
status: opts.status,
|
|
564
564
|
platform: opts.platform,
|
|
@@ -572,7 +572,7 @@ accounts
|
|
|
572
572
|
accounts
|
|
573
573
|
.command("create")
|
|
574
574
|
.description("POST /accounts")
|
|
575
|
-
.
|
|
575
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
576
576
|
.requiredOption("-j, --json <json>", "createAccount body JSON")
|
|
577
577
|
.action(async (opts) => {
|
|
578
578
|
let body;
|
|
@@ -583,7 +583,7 @@ accounts
|
|
|
583
583
|
console.error("Invalid -j / --json");
|
|
584
584
|
process.exit(1);
|
|
585
585
|
}
|
|
586
|
-
const res = await requireClient().createAccount(opts.team, body);
|
|
586
|
+
const res = await requireClient().createAccount(resolveTeamId(opts.team), body);
|
|
587
587
|
console.log(JSON.stringify(res, null, 2));
|
|
588
588
|
});
|
|
589
589
|
// --- brands & campaigns ---
|
|
@@ -635,14 +635,14 @@ brands
|
|
|
635
635
|
brands
|
|
636
636
|
.command("list")
|
|
637
637
|
.description("GET /teams/:teamId/brands (compat)")
|
|
638
|
-
.
|
|
638
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
639
639
|
.action(async (opts) => {
|
|
640
|
-
const res = await requireClient().listBrands(opts.team);
|
|
640
|
+
const res = await requireClient().listBrands(resolveTeamId(opts.team));
|
|
641
641
|
console.log(JSON.stringify(res, null, 2));
|
|
642
642
|
});
|
|
643
643
|
brands
|
|
644
644
|
.command("create")
|
|
645
|
-
.
|
|
645
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
646
646
|
.requiredOption("-j, --json <json>", "{ name, slug? }")
|
|
647
647
|
.action(async (opts) => {
|
|
648
648
|
let body;
|
|
@@ -653,7 +653,7 @@ brands
|
|
|
653
653
|
console.error("Invalid -j / --json");
|
|
654
654
|
process.exit(1);
|
|
655
655
|
}
|
|
656
|
-
const res = await requireClient().createBrand(opts.team, {
|
|
656
|
+
const res = await requireClient().createBrand(resolveTeamId(opts.team), {
|
|
657
657
|
name: String(body.name ?? ""),
|
|
658
658
|
slug: body.slug,
|
|
659
659
|
});
|
|
@@ -662,7 +662,7 @@ brands
|
|
|
662
662
|
brands
|
|
663
663
|
.command("update")
|
|
664
664
|
.description("PATCH /brands/:id")
|
|
665
|
-
.
|
|
665
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
666
666
|
.requiredOption("-b, --brand <brandId>", "Brand UUID")
|
|
667
667
|
.requiredOption("-j, --json <json>", "update body")
|
|
668
668
|
.action(async (opts) => {
|
|
@@ -674,7 +674,7 @@ brands
|
|
|
674
674
|
console.error("Invalid -j / --json");
|
|
675
675
|
process.exit(1);
|
|
676
676
|
}
|
|
677
|
-
const res = await requireClient().updateBrand(opts.team, opts.brand, body);
|
|
677
|
+
const res = await requireClient().updateBrand(resolveTeamId(opts.team), opts.brand, body);
|
|
678
678
|
console.log(JSON.stringify(res, null, 2));
|
|
679
679
|
});
|
|
680
680
|
const personas = program.command("personas").description("系统级人设库");
|
|
@@ -850,10 +850,10 @@ const campaigns = program
|
|
|
850
850
|
campaigns
|
|
851
851
|
.command("list")
|
|
852
852
|
.description("LEGACY list campaigns")
|
|
853
|
-
.
|
|
853
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
854
854
|
.option("--brand <uuid>", "brandId")
|
|
855
855
|
.action(async (opts) => {
|
|
856
|
-
const res = await requireClient().listCampaigns(opts.team, {
|
|
856
|
+
const res = await requireClient().listCampaigns(resolveTeamId(opts.team), {
|
|
857
857
|
brandId: opts.brand,
|
|
858
858
|
});
|
|
859
859
|
console.log(JSON.stringify(res, null, 2));
|
|
@@ -861,7 +861,7 @@ campaigns
|
|
|
861
861
|
campaigns
|
|
862
862
|
.command("create")
|
|
863
863
|
.description("LEGACY create campaign(新流程不要作为品牌入口)")
|
|
864
|
-
.
|
|
864
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
865
865
|
.requiredOption("-j, --json <json>", "{ brandId, name, startsAt?, endsAt? }")
|
|
866
866
|
.action(async (opts) => {
|
|
867
867
|
let body;
|
|
@@ -872,19 +872,19 @@ campaigns
|
|
|
872
872
|
console.error("Invalid -j / --json");
|
|
873
873
|
process.exit(1);
|
|
874
874
|
}
|
|
875
|
-
const res = await requireClient().createCampaign(opts.team, body);
|
|
875
|
+
const res = await requireClient().createCampaign(resolveTeamId(opts.team), body);
|
|
876
876
|
console.log(JSON.stringify(res, null, 2));
|
|
877
877
|
});
|
|
878
878
|
// --- publishing plans ---
|
|
879
879
|
const plans = program.command("plans").description("发布计划");
|
|
880
880
|
plans
|
|
881
881
|
.command("list")
|
|
882
|
-
.
|
|
882
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
883
883
|
.option("--brand <uuid>", "brandId 过滤(推荐)")
|
|
884
884
|
.option("--campaign <uuid>", "campaignId 过滤(legacy)")
|
|
885
885
|
.option("--status <status>", "派生状态过滤(scheduled/running/succeeded/failed/cancelled;无 entries 的计划保留存储值 draft/exported)")
|
|
886
886
|
.action(async (opts) => {
|
|
887
|
-
const res = await requireClient().listPublishingPlans(opts.team, {
|
|
887
|
+
const res = await requireClient().listPublishingPlans(resolveTeamId(opts.team), {
|
|
888
888
|
brandId: opts.brand,
|
|
889
889
|
campaignId: opts.campaign,
|
|
890
890
|
status: opts.status,
|
|
@@ -894,7 +894,7 @@ plans
|
|
|
894
894
|
plans
|
|
895
895
|
.command("create")
|
|
896
896
|
.description("POST /publishing-plans(body 需含 entries 等)")
|
|
897
|
-
.
|
|
897
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
898
898
|
.requiredOption("-j, --json <json>", "createPublishingPlanBody JSON")
|
|
899
899
|
.action(async (opts) => {
|
|
900
900
|
let body;
|
|
@@ -905,21 +905,21 @@ plans
|
|
|
905
905
|
console.error("Invalid -j / --json");
|
|
906
906
|
process.exit(1);
|
|
907
907
|
}
|
|
908
|
-
const res = await requireClient().createPublishingPlan(opts.team, body);
|
|
908
|
+
const res = await requireClient().createPublishingPlan(resolveTeamId(opts.team), body);
|
|
909
909
|
console.log(JSON.stringify(res, null, 2));
|
|
910
910
|
});
|
|
911
911
|
// --- audit & permissions & graph ---
|
|
912
912
|
const audit = program.command("audit").description("审计日志");
|
|
913
913
|
audit
|
|
914
914
|
.command("list")
|
|
915
|
-
.
|
|
915
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
916
916
|
.option("-n, --limit <n>", "limit", "50")
|
|
917
917
|
.option("--type <t>", "事件 type 前缀")
|
|
918
918
|
.option("--actor <a>", "user | agent | cron")
|
|
919
919
|
.option("--result <r>", "succeeded | failed | skipped")
|
|
920
920
|
.option("--account <uuid>", "socialAccountId")
|
|
921
921
|
.action(async (opts) => {
|
|
922
|
-
const res = await requireClient().listAuditLogs(opts.team, {
|
|
922
|
+
const res = await requireClient().listAuditLogs(resolveTeamId(opts.team), {
|
|
923
923
|
limit: Number(opts.limit),
|
|
924
924
|
type: opts.type,
|
|
925
925
|
actor: opts.actor,
|
|
@@ -934,9 +934,9 @@ const permissionsCmd = program
|
|
|
934
934
|
permissionsCmd
|
|
935
935
|
.command("matrix")
|
|
936
936
|
.description("GET /permissions-matrix(原 social-hub permissions)")
|
|
937
|
-
.
|
|
937
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
938
938
|
.action(async (opts) => {
|
|
939
|
-
const res = await requireClient().getPermissionsMatrix(opts.team);
|
|
939
|
+
const res = await requireClient().getPermissionsMatrix(resolveTeamId(opts.team));
|
|
940
940
|
console.log(JSON.stringify(res, null, 2));
|
|
941
941
|
});
|
|
942
942
|
registerPermissionsExplain(permissionsCmd);
|
|
@@ -944,12 +944,12 @@ const graph = program.command("graph").description("账号图谱");
|
|
|
944
944
|
graph
|
|
945
945
|
.command("list")
|
|
946
946
|
.description("GET /account-graph")
|
|
947
|
-
.
|
|
947
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
948
948
|
.option("--account <uuid>", "socialAccountId")
|
|
949
949
|
.option("--edge <type>", "edgeType")
|
|
950
950
|
.option("-n, --limit <n>", "limit", "100")
|
|
951
951
|
.action(async (opts) => {
|
|
952
|
-
const res = await requireClient().listAccountGraphEdges(opts.team, {
|
|
952
|
+
const res = await requireClient().listAccountGraphEdges(resolveTeamId(opts.team), {
|
|
953
953
|
limit: Number(opts.limit),
|
|
954
954
|
socialAccountId: opts.account,
|
|
955
955
|
edgeType: opts.edge,
|
|
@@ -984,18 +984,18 @@ graph
|
|
|
984
984
|
console.log(JSON.stringify({ dryRun, teams: results.length, results }, null, 2));
|
|
985
985
|
return;
|
|
986
986
|
}
|
|
987
|
-
if (!opts.team) {
|
|
987
|
+
if (!resolveTeamId(opts.team)) {
|
|
988
988
|
console.error("Provide -t <teamId> or --all");
|
|
989
989
|
process.exit(1);
|
|
990
990
|
}
|
|
991
|
-
const res = await client.runEntityGraphProjection(opts.team, { dryRun });
|
|
991
|
+
const res = await client.runEntityGraphProjection(resolveTeamId(opts.team), { dryRun });
|
|
992
992
|
console.log(JSON.stringify(res, null, 2));
|
|
993
993
|
});
|
|
994
994
|
// --- drafts extended ---
|
|
995
995
|
drafts
|
|
996
996
|
.command("create")
|
|
997
997
|
.description("POST /content-drafts")
|
|
998
|
-
.
|
|
998
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
999
999
|
.requiredOption("-j, --json <json>", "{ brandId, title, body, campaignId? }")
|
|
1000
1000
|
.action(async (opts) => {
|
|
1001
1001
|
let body;
|
|
@@ -1006,7 +1006,7 @@ drafts
|
|
|
1006
1006
|
console.error("Invalid -j / --json");
|
|
1007
1007
|
process.exit(1);
|
|
1008
1008
|
}
|
|
1009
|
-
const res = await requireClient().createContentDraft(opts.team, body);
|
|
1009
|
+
const res = await requireClient().createContentDraft(resolveTeamId(opts.team), body);
|
|
1010
1010
|
console.log(JSON.stringify(res, null, 2));
|
|
1011
1011
|
});
|
|
1012
1012
|
// --- compliance ---
|
|
@@ -1014,12 +1014,12 @@ const compliance = program.command("compliance").description("合规 / 风控");
|
|
|
1014
1014
|
compliance
|
|
1015
1015
|
.command("sanctions-list")
|
|
1016
1016
|
.description("GET /subreddit-sanctions")
|
|
1017
|
-
.
|
|
1017
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1018
1018
|
.option("--account <uuid>", "socialAccountId")
|
|
1019
1019
|
.option("--sub <name>", "subreddit")
|
|
1020
1020
|
.option("-n, --limit <n>", "limit", "50")
|
|
1021
1021
|
.action(async (opts) => {
|
|
1022
|
-
const res = await requireClient().listSubredditSanctions(opts.team, {
|
|
1022
|
+
const res = await requireClient().listSubredditSanctions(resolveTeamId(opts.team), {
|
|
1023
1023
|
limit: Number(opts.limit),
|
|
1024
1024
|
socialAccountId: opts.account,
|
|
1025
1025
|
subreddit: opts.sub,
|
|
@@ -1029,7 +1029,7 @@ compliance
|
|
|
1029
1029
|
compliance
|
|
1030
1030
|
.command("sanctions-create")
|
|
1031
1031
|
.description("POST /subreddit-sanctions")
|
|
1032
|
-
.
|
|
1032
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1033
1033
|
.requiredOption("-j, --json <json>", "body JSON")
|
|
1034
1034
|
.action(async (opts) => {
|
|
1035
1035
|
let body;
|
|
@@ -1040,13 +1040,13 @@ compliance
|
|
|
1040
1040
|
console.error("Invalid -j / --json");
|
|
1041
1041
|
process.exit(1);
|
|
1042
1042
|
}
|
|
1043
|
-
const res = await requireClient().createSubredditSanction(opts.team, body);
|
|
1043
|
+
const res = await requireClient().createSubredditSanction(resolveTeamId(opts.team), body);
|
|
1044
1044
|
console.log(JSON.stringify(res, null, 2));
|
|
1045
1045
|
});
|
|
1046
1046
|
compliance
|
|
1047
1047
|
.command("sanctions-update")
|
|
1048
1048
|
.description("PATCH /subreddit-sanctions/:id")
|
|
1049
|
-
.
|
|
1049
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1050
1050
|
.requiredOption("--id <uuid>", "sanction id")
|
|
1051
1051
|
.requiredOption("-j, --json <json>", "body JSON")
|
|
1052
1052
|
.action(async (opts) => {
|
|
@@ -1058,40 +1058,40 @@ compliance
|
|
|
1058
1058
|
console.error("Invalid -j / --json");
|
|
1059
1059
|
process.exit(1);
|
|
1060
1060
|
}
|
|
1061
|
-
const res = await requireClient().updateSubredditSanction(opts.team, opts.id, body);
|
|
1061
|
+
const res = await requireClient().updateSubredditSanction(resolveTeamId(opts.team), opts.id, body);
|
|
1062
1062
|
console.log(JSON.stringify(res, null, 2));
|
|
1063
1063
|
});
|
|
1064
1064
|
compliance
|
|
1065
1065
|
.command("sanctions-delete")
|
|
1066
1066
|
.description("DELETE /subreddit-sanctions/:id")
|
|
1067
|
-
.
|
|
1067
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1068
1068
|
.requiredOption("--id <uuid>", "sanction id")
|
|
1069
1069
|
.action(async (opts) => {
|
|
1070
|
-
const res = await requireClient().deleteSubredditSanction(opts.team, opts.id);
|
|
1070
|
+
const res = await requireClient().deleteSubredditSanction(resolveTeamId(opts.team), opts.id);
|
|
1071
1071
|
console.log(JSON.stringify(res, null, 2));
|
|
1072
1072
|
});
|
|
1073
1073
|
compliance
|
|
1074
1074
|
.command("risk-list")
|
|
1075
1075
|
.description("GET /account-risk-profiles")
|
|
1076
|
-
.
|
|
1076
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1077
1077
|
.option("-n, --limit <n>", "limit", "100")
|
|
1078
1078
|
.action(async (opts) => {
|
|
1079
|
-
const res = await requireClient().listAccountRiskProfiles(opts.team, Number(opts.limit));
|
|
1079
|
+
const res = await requireClient().listAccountRiskProfiles(resolveTeamId(opts.team), Number(opts.limit));
|
|
1080
1080
|
console.log(JSON.stringify(res, null, 2));
|
|
1081
1081
|
});
|
|
1082
1082
|
compliance
|
|
1083
1083
|
.command("risk-get")
|
|
1084
1084
|
.description("GET /social-accounts/:id/risk-profile")
|
|
1085
|
-
.
|
|
1085
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1086
1086
|
.requiredOption("-a, --account <uuid>", "socialAccountId")
|
|
1087
1087
|
.action(async (opts) => {
|
|
1088
|
-
const res = await requireClient().getAccountRiskProfile(opts.team, opts.account);
|
|
1088
|
+
const res = await requireClient().getAccountRiskProfile(resolveTeamId(opts.team), opts.account);
|
|
1089
1089
|
console.log(JSON.stringify(res, null, 2));
|
|
1090
1090
|
});
|
|
1091
1091
|
compliance
|
|
1092
1092
|
.command("risk-put")
|
|
1093
1093
|
.description("PUT /social-accounts/:id/risk-profile")
|
|
1094
|
-
.
|
|
1094
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1095
1095
|
.requiredOption("-a, --account <uuid>", "socialAccountId")
|
|
1096
1096
|
.requiredOption("-j, --json <json>", "body")
|
|
1097
1097
|
.action(async (opts) => {
|
|
@@ -1103,16 +1103,16 @@ compliance
|
|
|
1103
1103
|
console.error("Invalid -j / --json");
|
|
1104
1104
|
process.exit(1);
|
|
1105
1105
|
}
|
|
1106
|
-
const res = await requireClient().upsertAccountRiskProfile(opts.team, opts.account, body);
|
|
1106
|
+
const res = await requireClient().upsertAccountRiskProfile(resolveTeamId(opts.team), opts.account, body);
|
|
1107
1107
|
console.log(JSON.stringify(res, null, 2));
|
|
1108
1108
|
});
|
|
1109
1109
|
compliance
|
|
1110
1110
|
.command("rule-caches-list")
|
|
1111
1111
|
.description("GET /subreddit-rule-caches")
|
|
1112
|
-
.
|
|
1112
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1113
1113
|
.option("--include-expired", "include expired caches")
|
|
1114
1114
|
.action(async (opts) => {
|
|
1115
|
-
const res = await requireClient().listSubredditRuleCaches(opts.team, {
|
|
1115
|
+
const res = await requireClient().listSubredditRuleCaches(resolveTeamId(opts.team), {
|
|
1116
1116
|
includeExpired: Boolean(opts.includeExpired),
|
|
1117
1117
|
});
|
|
1118
1118
|
console.log(JSON.stringify(res, null, 2));
|
|
@@ -1120,12 +1120,12 @@ compliance
|
|
|
1120
1120
|
compliance
|
|
1121
1121
|
.command("rule-caches-upsert")
|
|
1122
1122
|
.description("PUT /subreddit-rule-caches/:subreddit")
|
|
1123
|
-
.
|
|
1123
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1124
1124
|
.requiredOption("--sub <name>", "subreddit name")
|
|
1125
1125
|
.requiredOption("-j, --json <json>", "{ rulesMarkdown, sourceUrl?, expiresInDays? }")
|
|
1126
1126
|
.action(async (opts) => {
|
|
1127
1127
|
const body = JSON.parse(opts.json);
|
|
1128
|
-
const res = await requireClient().upsertSubredditRuleCache(opts.team, opts.sub, body);
|
|
1128
|
+
const res = await requireClient().upsertSubredditRuleCache(resolveTeamId(opts.team), opts.sub, body);
|
|
1129
1129
|
console.log(JSON.stringify(res, null, 2));
|
|
1130
1130
|
});
|
|
1131
1131
|
compliance
|
|
@@ -1135,7 +1135,7 @@ compliance
|
|
|
1135
1135
|
.option("--kind <kind>", "blocklist kind", "bot_bouncer")
|
|
1136
1136
|
.option("--include-expired", "include expired entries")
|
|
1137
1137
|
.action(async (opts) => {
|
|
1138
|
-
if (opts.team) {
|
|
1138
|
+
if (resolveTeamId(opts.team)) {
|
|
1139
1139
|
console.error("[deprecated] -t/--team is ignored for blocklists (system-level); omit on next release.");
|
|
1140
1140
|
}
|
|
1141
1141
|
const res = await requireClient().listSystemSubredditBlocklists({
|
|
@@ -1152,7 +1152,7 @@ compliance
|
|
|
1152
1152
|
.option("--kind <kind>", "blocklist kind", "bot_bouncer")
|
|
1153
1153
|
.option("-j, --json <json>", "optional { reason, source, expiresInDays }", "{}")
|
|
1154
1154
|
.action(async (opts) => {
|
|
1155
|
-
if (opts.team) {
|
|
1155
|
+
if (resolveTeamId(opts.team)) {
|
|
1156
1156
|
console.error("[deprecated] -t/--team is ignored for blocklists (system-level); omit on next release.");
|
|
1157
1157
|
}
|
|
1158
1158
|
let extra = {};
|
|
@@ -1176,7 +1176,7 @@ compliance
|
|
|
1176
1176
|
.requiredOption("--sub <name>", "subreddit name")
|
|
1177
1177
|
.option("--kind <kind>", "blocklist kind", "bot_bouncer")
|
|
1178
1178
|
.action(async (opts) => {
|
|
1179
|
-
if (opts.team) {
|
|
1179
|
+
if (resolveTeamId(opts.team)) {
|
|
1180
1180
|
console.error("[deprecated] -t/--team is ignored for blocklists (system-level); omit on next release.");
|
|
1181
1181
|
}
|
|
1182
1182
|
const res = await requireClient().deleteSystemSubredditBlocklist(opts.sub, {
|
|
@@ -1191,22 +1191,22 @@ const openclawIngest = program
|
|
|
1191
1191
|
openclawIngest
|
|
1192
1192
|
.command("status")
|
|
1193
1193
|
.description("GET /openclaw-ingest/runs/:runId")
|
|
1194
|
-
.
|
|
1194
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1195
1195
|
.requiredOption("--run <runId>", "Ingest run UUID")
|
|
1196
1196
|
.action(async (opts) => {
|
|
1197
|
-
const res = await requireClient().getOpenClawIngestRun(opts.team, opts.run);
|
|
1197
|
+
const res = await requireClient().getOpenClawIngestRun(resolveTeamId(opts.team), opts.run);
|
|
1198
1198
|
console.log(JSON.stringify(res, null, 2));
|
|
1199
1199
|
});
|
|
1200
1200
|
openclawIngest
|
|
1201
1201
|
.command("runs")
|
|
1202
1202
|
.description("GET /openclaw-ingest/runs")
|
|
1203
|
-
.
|
|
1203
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1204
1204
|
.option("--status <status>", "queued | running | succeeded | failed | partial")
|
|
1205
1205
|
.option("--mode <mode>", "dry-run | apply")
|
|
1206
1206
|
.option("-n, --limit <n>", "page size (max 200)", "50")
|
|
1207
1207
|
.option("--offset <n>", "offset", "0")
|
|
1208
1208
|
.action(async (opts) => {
|
|
1209
|
-
const res = await requireClient().listOpenClawIngestRuns(opts.team, {
|
|
1209
|
+
const res = await requireClient().listOpenClawIngestRuns(resolveTeamId(opts.team), {
|
|
1210
1210
|
status: opts.status,
|
|
1211
1211
|
mode: opts.mode,
|
|
1212
1212
|
limit: Number(opts.limit),
|
|
@@ -1229,7 +1229,7 @@ openclawIngest
|
|
|
1229
1229
|
.option("--op-report-file <path>", "op report file (repeatable)", collect, [])
|
|
1230
1230
|
.option("-j, --json <json>", "advanced body override JSON")
|
|
1231
1231
|
.action(async (opts) => {
|
|
1232
|
-
if (!opts.team) {
|
|
1232
|
+
if (!resolveTeamId(opts.team)) {
|
|
1233
1233
|
console.error("Missing required option -t / --team (or use: openclaw-ingest status)");
|
|
1234
1234
|
process.exit(1);
|
|
1235
1235
|
}
|
|
@@ -1271,7 +1271,7 @@ openclawIngest
|
|
|
1271
1271
|
if (Object.keys(sourcePaths).length > 0) {
|
|
1272
1272
|
body.sourcePaths = sourcePaths;
|
|
1273
1273
|
}
|
|
1274
|
-
const res = await requireClient().triggerOpenClawIngest(opts.team, body);
|
|
1274
|
+
const res = await requireClient().triggerOpenClawIngest(resolveTeamId(opts.team), body);
|
|
1275
1275
|
console.log(JSON.stringify(res, null, 2));
|
|
1276
1276
|
});
|
|
1277
1277
|
function collect(value, previous) {
|
|
@@ -1283,10 +1283,10 @@ function collect(value, previous) {
|
|
|
1283
1283
|
accounts
|
|
1284
1284
|
.command("get")
|
|
1285
1285
|
.description("GET /accounts/:id")
|
|
1286
|
-
.
|
|
1286
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1287
1287
|
.requiredOption("--account <uuid>", "Account UUID")
|
|
1288
1288
|
.action(async (opts) => {
|
|
1289
|
-
const res = await requireClient().getAccount(opts.team, opts.account);
|
|
1289
|
+
const res = await requireClient().getAccount(resolveTeamId(opts.team), opts.account);
|
|
1290
1290
|
console.log(JSON.stringify(res, null, 2));
|
|
1291
1291
|
});
|
|
1292
1292
|
// 这些字段不在 social_accounts 核心表上,各自是独立资源面;放进 accounts update
|
|
@@ -1314,7 +1314,7 @@ export function detectMisplacedAccountFields(body) {
|
|
|
1314
1314
|
accounts
|
|
1315
1315
|
.command("update")
|
|
1316
1316
|
.description("PATCH /accounts/:id — 更新 handle/status/karma/accountAgeDays 等核心字段。安全时段/时区/风险级别请用 `compliance risk-put`;浏览器环境请用 `browser-envs`")
|
|
1317
|
-
.
|
|
1317
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1318
1318
|
.requiredOption("--account <uuid>", "Account UUID")
|
|
1319
1319
|
.requiredOption("-j, --json <json>", "{ handle?, profileUrl?, status?, externalId?, externalRef?, personaId?, karma?, accountAgeDays?, registeredAt?, workflowStage?, metricsSource?, metricsUpdatedAt?, credentialsRef?, primaryProducts? }")
|
|
1320
1320
|
.action(async (opts) => {
|
|
@@ -1324,7 +1324,7 @@ accounts
|
|
|
1324
1324
|
console.error(misplaced);
|
|
1325
1325
|
process.exit(1);
|
|
1326
1326
|
}
|
|
1327
|
-
const res = await requireClient().updateAccount(opts.team, opts.account, body);
|
|
1327
|
+
const res = await requireClient().updateAccount(resolveTeamId(opts.team), opts.account, body);
|
|
1328
1328
|
console.log(JSON.stringify(res, null, 2));
|
|
1329
1329
|
});
|
|
1330
1330
|
accounts
|
|
@@ -1334,7 +1334,7 @@ accounts
|
|
|
1334
1334
|
.requiredOption("--account <uuid>", "Account UUID")
|
|
1335
1335
|
.requiredOption("--to <teamId>", "目标 Team UUID")
|
|
1336
1336
|
.action(async (opts) => {
|
|
1337
|
-
const res = await requireClient().reassignAccount(opts.team, opts.account, {
|
|
1337
|
+
const res = await requireClient().reassignAccount(resolveTeamId(opts.team), opts.account, {
|
|
1338
1338
|
toTeamId: opts.to,
|
|
1339
1339
|
});
|
|
1340
1340
|
console.log(JSON.stringify(res, null, 2));
|
|
@@ -1345,7 +1345,7 @@ accounts
|
|
|
1345
1345
|
accounts
|
|
1346
1346
|
.command("sync")
|
|
1347
1347
|
.description("账号数据多面一次性同步(core/riskProfile/guardrails/brandBindings/personas/affinities/browserEnvironments);逐面写、汇总报告、任一失败退出码非零。core 仅核心账号字段——安全时段/时区/风险级别放 riskProfile 面,浏览器环境放 browserEnvironments 面")
|
|
1348
|
-
.
|
|
1348
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1349
1349
|
.requiredOption("--account <uuid>", "Account UUID")
|
|
1350
1350
|
.requiredOption("-j, --json <json>", "{ core?, riskProfile?, guardrails?, brandBindings?: (uuid|{brandId})[], personas?: (md|{markdown})[], affinities?: {subreddit,...}[], browserEnvironments?: {browserProvider,environmentId,...}[] }")
|
|
1351
1351
|
.action(async (opts) => {
|
|
@@ -1358,7 +1358,7 @@ accounts
|
|
|
1358
1358
|
process.exit(1);
|
|
1359
1359
|
}
|
|
1360
1360
|
const client = requireClient();
|
|
1361
|
-
const team = opts.team;
|
|
1361
|
+
const team = resolveTeamId(opts.team);
|
|
1362
1362
|
const account = opts.account;
|
|
1363
1363
|
const results = [];
|
|
1364
1364
|
const run = async (face, target, fn) => {
|
|
@@ -1483,59 +1483,59 @@ accounts
|
|
|
1483
1483
|
campaigns
|
|
1484
1484
|
.command("get")
|
|
1485
1485
|
.description("GET /campaigns/:id")
|
|
1486
|
-
.
|
|
1486
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1487
1487
|
.requiredOption("--campaign <uuid>", "Campaign UUID")
|
|
1488
1488
|
.action(async (opts) => {
|
|
1489
|
-
const res = await requireClient().getCampaign(opts.team, opts.campaign);
|
|
1489
|
+
const res = await requireClient().getCampaign(resolveTeamId(opts.team), opts.campaign);
|
|
1490
1490
|
console.log(JSON.stringify(res, null, 2));
|
|
1491
1491
|
});
|
|
1492
1492
|
campaigns
|
|
1493
1493
|
.command("update")
|
|
1494
1494
|
.description("PATCH /campaigns/:id")
|
|
1495
|
-
.
|
|
1495
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1496
1496
|
.requiredOption("--campaign <uuid>", "Campaign UUID")
|
|
1497
1497
|
.requiredOption("-j, --json <json>", "{ name?, startsAt?, endsAt? }")
|
|
1498
1498
|
.action(async (opts) => {
|
|
1499
1499
|
const body = JSON.parse(opts.json);
|
|
1500
|
-
const res = await requireClient().updateCampaign(opts.team, opts.campaign, body);
|
|
1500
|
+
const res = await requireClient().updateCampaign(resolveTeamId(opts.team), opts.campaign, body);
|
|
1501
1501
|
console.log(JSON.stringify(res, null, 2));
|
|
1502
1502
|
});
|
|
1503
1503
|
drafts
|
|
1504
1504
|
.command("get")
|
|
1505
1505
|
.description("GET /content-drafts/:id")
|
|
1506
|
-
.
|
|
1506
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1507
1507
|
.requiredOption("--draft <uuid>", "Draft UUID")
|
|
1508
1508
|
.action(async (opts) => {
|
|
1509
|
-
const res = await requireClient().getContentDraft(opts.team, opts.draft);
|
|
1509
|
+
const res = await requireClient().getContentDraft(resolveTeamId(opts.team), opts.draft);
|
|
1510
1510
|
console.log(JSON.stringify(res, null, 2));
|
|
1511
1511
|
});
|
|
1512
1512
|
drafts
|
|
1513
1513
|
.command("update")
|
|
1514
1514
|
.description("PATCH /content-drafts/:id")
|
|
1515
|
-
.
|
|
1515
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1516
1516
|
.requiredOption("--draft <uuid>", "Draft UUID")
|
|
1517
1517
|
.requiredOption("-j, --json <json>", "{ title?, body?, status?, expectedVersion? }(传 expectedVersion 开乐观并发,版本不匹配→409)")
|
|
1518
1518
|
.action(async (opts) => {
|
|
1519
1519
|
const body = JSON.parse(opts.json);
|
|
1520
|
-
const res = await requireClient().updateContentDraft(opts.team, opts.draft, body);
|
|
1520
|
+
const res = await requireClient().updateContentDraft(resolveTeamId(opts.team), opts.draft, body);
|
|
1521
1521
|
console.log(JSON.stringify(res, null, 2));
|
|
1522
1522
|
});
|
|
1523
1523
|
drafts
|
|
1524
1524
|
.command("delete")
|
|
1525
1525
|
.description("DELETE /content-drafts/:id")
|
|
1526
|
-
.
|
|
1526
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1527
1527
|
.requiredOption("--draft <uuid>", "Draft UUID")
|
|
1528
1528
|
.action(async (opts) => {
|
|
1529
|
-
await requireClient().deleteContentDraft(opts.team, opts.draft);
|
|
1529
|
+
await requireClient().deleteContentDraft(resolveTeamId(opts.team), opts.draft);
|
|
1530
1530
|
console.log("OK");
|
|
1531
1531
|
});
|
|
1532
1532
|
plans
|
|
1533
1533
|
.command("cancel")
|
|
1534
1534
|
.description("DELETE /publishing-plans/:id(取消)")
|
|
1535
|
-
.
|
|
1535
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1536
1536
|
.requiredOption("--plan <uuid>", "Plan UUID")
|
|
1537
1537
|
.action(async (opts) => {
|
|
1538
|
-
await requireClient().cancelPublishingPlan(opts.team, opts.plan);
|
|
1538
|
+
await requireClient().cancelPublishingPlan(resolveTeamId(opts.team), opts.plan);
|
|
1539
1539
|
console.log("OK");
|
|
1540
1540
|
});
|
|
1541
1541
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -1561,7 +1561,7 @@ agentTeams
|
|
|
1561
1561
|
agentTeams
|
|
1562
1562
|
.command("workspace-docs")
|
|
1563
1563
|
.description("GET /v1/agent-teams/:teamId/workspace-documents")
|
|
1564
|
-
.
|
|
1564
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1565
1565
|
.option("--kind <kind>", "file|daily_report|weekly_report|ops_record")
|
|
1566
1566
|
.option("-n, --limit <n>", "limit", "50")
|
|
1567
1567
|
.action(async (opts) => {
|
|
@@ -1569,9 +1569,9 @@ agentTeams
|
|
|
1569
1569
|
command: "agent-teams workspace-docs",
|
|
1570
1570
|
resource: "agentTeam",
|
|
1571
1571
|
action: "read",
|
|
1572
|
-
teamId: opts.team,
|
|
1572
|
+
teamId: resolveTeamId(opts.team),
|
|
1573
1573
|
}, async () => {
|
|
1574
|
-
const res = await requireClient().listWorkspaceDocuments(opts.team, {
|
|
1574
|
+
const res = await requireClient().listWorkspaceDocuments(resolveTeamId(opts.team), {
|
|
1575
1575
|
kind: opts.kind,
|
|
1576
1576
|
limit: Number(opts.limit),
|
|
1577
1577
|
});
|
|
@@ -1587,11 +1587,11 @@ const migrationWorkspaceDocs = migration
|
|
|
1587
1587
|
migrationWorkspaceDocs
|
|
1588
1588
|
.command("list")
|
|
1589
1589
|
.description("List workspace documents")
|
|
1590
|
-
.
|
|
1590
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1591
1591
|
.option("--kind <kind>", "document kind filter")
|
|
1592
1592
|
.option("-n, --limit <n>", "limit", "50")
|
|
1593
1593
|
.action(async (opts) => {
|
|
1594
|
-
const res = await requireClient().listWorkspaceDocuments(opts.team, {
|
|
1594
|
+
const res = await requireClient().listWorkspaceDocuments(resolveTeamId(opts.team), {
|
|
1595
1595
|
kind: opts.kind,
|
|
1596
1596
|
limit: Number(opts.limit),
|
|
1597
1597
|
});
|
|
@@ -1600,10 +1600,10 @@ migrationWorkspaceDocs
|
|
|
1600
1600
|
migrationWorkspaceDocs
|
|
1601
1601
|
.command("refs")
|
|
1602
1602
|
.description("GET workspace document parsed refs")
|
|
1603
|
-
.
|
|
1603
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1604
1604
|
.requiredOption("--doc <documentId>", "Workspace document UUID")
|
|
1605
1605
|
.action(async (opts) => {
|
|
1606
|
-
const res = await requireClient().listWorkspaceDocumentRefs(opts.team, opts.doc);
|
|
1606
|
+
const res = await requireClient().listWorkspaceDocumentRefs(resolveTeamId(opts.team), opts.doc);
|
|
1607
1607
|
console.log(JSON.stringify(res, null, 2));
|
|
1608
1608
|
});
|
|
1609
1609
|
agentTeams
|
|
@@ -1636,7 +1636,7 @@ agentTeams
|
|
|
1636
1636
|
agentTeams
|
|
1637
1637
|
.command("update")
|
|
1638
1638
|
.description("PATCH /v1/agent-teams/:teamId — 更新团队(admin only)")
|
|
1639
|
-
.
|
|
1639
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1640
1640
|
.requiredOption("-j, --json <json>", "{ slug?, name? }")
|
|
1641
1641
|
.option("--dry-run", "预览", false)
|
|
1642
1642
|
.option("--apply", "执行写入", false)
|
|
@@ -1645,24 +1645,24 @@ agentTeams
|
|
|
1645
1645
|
command: "agent-teams update",
|
|
1646
1646
|
resource: "agentTeam",
|
|
1647
1647
|
action: "update",
|
|
1648
|
-
teamId: opts.team,
|
|
1648
|
+
teamId: resolveTeamId(opts.team),
|
|
1649
1649
|
}, async () => {
|
|
1650
1650
|
const body = JSON.parse(opts.json);
|
|
1651
1651
|
if (!assertApplyOrDryRun(opts, {
|
|
1652
1652
|
command: "agent-teams update",
|
|
1653
1653
|
danger: "admin",
|
|
1654
|
-
summary: { teamId: opts.team, ...body },
|
|
1654
|
+
summary: { teamId: resolveTeamId(opts.team), ...body },
|
|
1655
1655
|
})) {
|
|
1656
1656
|
return;
|
|
1657
1657
|
}
|
|
1658
|
-
const res = await requireClient().updateTeam(opts.team, body);
|
|
1658
|
+
const res = await requireClient().updateTeam(resolveTeamId(opts.team), body);
|
|
1659
1659
|
console.log(JSON.stringify(res, null, 2));
|
|
1660
1660
|
});
|
|
1661
1661
|
});
|
|
1662
1662
|
agentTeams
|
|
1663
1663
|
.command("add-member")
|
|
1664
1664
|
.description("POST /v1/agent-teams/:teamId/members — 添加成员(admin only)")
|
|
1665
|
-
.
|
|
1665
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1666
1666
|
.requiredOption("--user <userId>", "User UUID")
|
|
1667
1667
|
.requiredOption("--role <role>", "admin|manager|supervisor|senior|internal|client")
|
|
1668
1668
|
.option("--dry-run", "预览", false)
|
|
@@ -1672,20 +1672,20 @@ agentTeams
|
|
|
1672
1672
|
command: "agent-teams add-member",
|
|
1673
1673
|
resource: "agentTeam",
|
|
1674
1674
|
action: "update",
|
|
1675
|
-
teamId: opts.team,
|
|
1675
|
+
teamId: resolveTeamId(opts.team),
|
|
1676
1676
|
}, async () => {
|
|
1677
1677
|
if (!assertApplyOrDryRun(opts, {
|
|
1678
1678
|
command: "agent-teams add-member",
|
|
1679
1679
|
danger: "admin",
|
|
1680
1680
|
summary: {
|
|
1681
|
-
teamId: opts.team,
|
|
1681
|
+
teamId: resolveTeamId(opts.team),
|
|
1682
1682
|
userId: opts.user,
|
|
1683
1683
|
role: opts.role,
|
|
1684
1684
|
},
|
|
1685
1685
|
})) {
|
|
1686
1686
|
return;
|
|
1687
1687
|
}
|
|
1688
|
-
const res = await requireClient().addTeamMember(opts.team, {
|
|
1688
|
+
const res = await requireClient().addTeamMember(resolveTeamId(opts.team), {
|
|
1689
1689
|
userId: opts.user,
|
|
1690
1690
|
role: opts.role,
|
|
1691
1691
|
});
|
|
@@ -1699,14 +1699,14 @@ const pools = program
|
|
|
1699
1699
|
pools
|
|
1700
1700
|
.command("catalog-list")
|
|
1701
1701
|
.description("GET .../subreddit-pools/catalog")
|
|
1702
|
-
.
|
|
1702
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1703
1703
|
.option("--status <s>", "active|paused|archived")
|
|
1704
1704
|
.option("--industry-key <key>", "industryKey filter")
|
|
1705
1705
|
.option("--pool-kind <kind>", "pet|common|industry|brand|other")
|
|
1706
1706
|
.option("-n, --limit <n>", "limit", "50")
|
|
1707
1707
|
.option("--offset <n>", "offset", "0")
|
|
1708
1708
|
.action(async (opts) => {
|
|
1709
|
-
const res = await requireClient().listSubredditPoolsCatalog(opts.team, {
|
|
1709
|
+
const res = await requireClient().listSubredditPoolsCatalog(resolveTeamId(opts.team), {
|
|
1710
1710
|
status: opts.status,
|
|
1711
1711
|
industryKey: opts.industryKey,
|
|
1712
1712
|
poolKind: opts.poolKind,
|
|
@@ -1718,43 +1718,43 @@ pools
|
|
|
1718
1718
|
pools
|
|
1719
1719
|
.command("catalog-create")
|
|
1720
1720
|
.description("POST .../subreddit-pools/catalog")
|
|
1721
|
-
.
|
|
1721
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1722
1722
|
.requiredOption("-j, --json <json>", "pool catalog body")
|
|
1723
1723
|
.action(async (opts) => {
|
|
1724
1724
|
const body = JSON.parse(opts.json);
|
|
1725
|
-
const res = await requireClient().createSubredditPool(opts.team, body);
|
|
1725
|
+
const res = await requireClient().createSubredditPool(resolveTeamId(opts.team), body);
|
|
1726
1726
|
console.log(JSON.stringify(res, null, 2));
|
|
1727
1727
|
});
|
|
1728
1728
|
pools
|
|
1729
1729
|
.command("catalog-update")
|
|
1730
1730
|
.description("PATCH .../subreddit-pools/catalog/:poolId")
|
|
1731
|
-
.
|
|
1731
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1732
1732
|
.requiredOption("--id <uuid>", "Pool UUID")
|
|
1733
1733
|
.requiredOption("-j, --json <json>", "update body")
|
|
1734
1734
|
.action(async (opts) => {
|
|
1735
1735
|
const body = JSON.parse(opts.json);
|
|
1736
|
-
const res = await requireClient().updateSubredditPool(opts.team, opts.id, body);
|
|
1736
|
+
const res = await requireClient().updateSubredditPool(resolveTeamId(opts.team), opts.id, body);
|
|
1737
1737
|
console.log(JSON.stringify(res, null, 2));
|
|
1738
1738
|
});
|
|
1739
1739
|
pools
|
|
1740
1740
|
.command("catalog-delete")
|
|
1741
1741
|
.description("DELETE .../subreddit-pools/catalog/:poolId (archive)")
|
|
1742
|
-
.
|
|
1742
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1743
1743
|
.requiredOption("--id <uuid>", "Pool UUID")
|
|
1744
1744
|
.action(async (opts) => {
|
|
1745
|
-
const res = await requireClient().deleteSubredditPool(opts.team, opts.id);
|
|
1745
|
+
const res = await requireClient().deleteSubredditPool(resolveTeamId(opts.team), opts.id);
|
|
1746
1746
|
console.log(JSON.stringify(res, null, 2));
|
|
1747
1747
|
});
|
|
1748
1748
|
pools
|
|
1749
1749
|
.command("aliases-list")
|
|
1750
1750
|
.description("GET .../subreddit-pools/aliases")
|
|
1751
|
-
.
|
|
1751
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1752
1752
|
.option("--alias-ref <ref>", "aliasRef filter")
|
|
1753
1753
|
.option("--industry-key <key>", "industryKey filter")
|
|
1754
1754
|
.option("-n, --limit <n>", "limit", "50")
|
|
1755
1755
|
.option("--offset <n>", "offset", "0")
|
|
1756
1756
|
.action(async (opts) => {
|
|
1757
|
-
const res = await requireClient().listPoolAliases(opts.team, {
|
|
1757
|
+
const res = await requireClient().listPoolAliases(resolveTeamId(opts.team), {
|
|
1758
1758
|
aliasRef: opts.aliasRef,
|
|
1759
1759
|
industryKey: opts.industryKey,
|
|
1760
1760
|
limit: Number(opts.limit),
|
|
@@ -1765,43 +1765,43 @@ pools
|
|
|
1765
1765
|
pools
|
|
1766
1766
|
.command("aliases-create")
|
|
1767
1767
|
.description("POST .../subreddit-pools/aliases")
|
|
1768
|
-
.
|
|
1768
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1769
1769
|
.requiredOption("-j, --json <json>", "alias body")
|
|
1770
1770
|
.action(async (opts) => {
|
|
1771
1771
|
const body = JSON.parse(opts.json);
|
|
1772
|
-
const res = await requireClient().createPoolAlias(opts.team, body);
|
|
1772
|
+
const res = await requireClient().createPoolAlias(resolveTeamId(opts.team), body);
|
|
1773
1773
|
console.log(JSON.stringify(res, null, 2));
|
|
1774
1774
|
});
|
|
1775
1775
|
pools
|
|
1776
1776
|
.command("aliases-update")
|
|
1777
1777
|
.description("PATCH .../subreddit-pools/aliases/:aliasId")
|
|
1778
|
-
.
|
|
1778
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1779
1779
|
.requiredOption("--id <uuid>", "Alias UUID")
|
|
1780
1780
|
.requiredOption("-j, --json <json>", "update body")
|
|
1781
1781
|
.action(async (opts) => {
|
|
1782
1782
|
const body = JSON.parse(opts.json);
|
|
1783
|
-
const res = await requireClient().updatePoolAlias(opts.team, opts.id, body);
|
|
1783
|
+
const res = await requireClient().updatePoolAlias(resolveTeamId(opts.team), opts.id, body);
|
|
1784
1784
|
console.log(JSON.stringify(res, null, 2));
|
|
1785
1785
|
});
|
|
1786
1786
|
pools
|
|
1787
1787
|
.command("aliases-delete")
|
|
1788
1788
|
.description("DELETE .../subreddit-pools/aliases/:aliasId (archive)")
|
|
1789
|
-
.
|
|
1789
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1790
1790
|
.requiredOption("--id <uuid>", "Alias UUID")
|
|
1791
1791
|
.action(async (opts) => {
|
|
1792
|
-
const res = await requireClient().deletePoolAlias(opts.team, opts.id);
|
|
1792
|
+
const res = await requireClient().deletePoolAlias(resolveTeamId(opts.team), opts.id);
|
|
1793
1793
|
console.log(JSON.stringify(res, null, 2));
|
|
1794
1794
|
});
|
|
1795
1795
|
pools
|
|
1796
1796
|
.command("tier-rules-list")
|
|
1797
1797
|
.description("GET .../subreddit-pools/tier-rules")
|
|
1798
|
-
.
|
|
1798
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1799
1799
|
.option("--tier <tier>", "S0|S1|S2|S3")
|
|
1800
1800
|
.option("--enabled <bool>", "true|false")
|
|
1801
1801
|
.option("-n, --limit <n>", "limit", "50")
|
|
1802
1802
|
.option("--offset <n>", "offset", "0")
|
|
1803
1803
|
.action(async (opts) => {
|
|
1804
|
-
const res = await requireClient().listSubredditPoolTierRules(opts.team, {
|
|
1804
|
+
const res = await requireClient().listSubredditPoolTierRules(resolveTeamId(opts.team), {
|
|
1805
1805
|
tier: opts.tier,
|
|
1806
1806
|
enabled: opts.enabled === undefined
|
|
1807
1807
|
? undefined
|
|
@@ -1814,31 +1814,31 @@ pools
|
|
|
1814
1814
|
pools
|
|
1815
1815
|
.command("tier-rules-create")
|
|
1816
1816
|
.description("POST .../subreddit-pools/tier-rules")
|
|
1817
|
-
.
|
|
1817
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1818
1818
|
.requiredOption("-j, --json <json>", "tier rule body")
|
|
1819
1819
|
.action(async (opts) => {
|
|
1820
1820
|
const body = JSON.parse(opts.json);
|
|
1821
|
-
const res = await requireClient().createSubredditPoolTierRule(opts.team, body);
|
|
1821
|
+
const res = await requireClient().createSubredditPoolTierRule(resolveTeamId(opts.team), body);
|
|
1822
1822
|
console.log(JSON.stringify(res, null, 2));
|
|
1823
1823
|
});
|
|
1824
1824
|
pools
|
|
1825
1825
|
.command("tier-rules-update")
|
|
1826
1826
|
.description("PATCH .../subreddit-pools/tier-rules/:ruleId")
|
|
1827
|
-
.
|
|
1827
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1828
1828
|
.requiredOption("--id <uuid>", "Rule UUID")
|
|
1829
1829
|
.requiredOption("-j, --json <json>", "update body")
|
|
1830
1830
|
.action(async (opts) => {
|
|
1831
1831
|
const body = JSON.parse(opts.json);
|
|
1832
|
-
const res = await requireClient().updateSubredditPoolTierRule(opts.team, opts.id, body);
|
|
1832
|
+
const res = await requireClient().updateSubredditPoolTierRule(resolveTeamId(opts.team), opts.id, body);
|
|
1833
1833
|
console.log(JSON.stringify(res, null, 2));
|
|
1834
1834
|
});
|
|
1835
1835
|
pools
|
|
1836
1836
|
.command("tier-rules-delete")
|
|
1837
1837
|
.description("DELETE .../subreddit-pools/tier-rules/:ruleId")
|
|
1838
|
-
.
|
|
1838
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1839
1839
|
.requiredOption("--id <uuid>", "Rule UUID")
|
|
1840
1840
|
.action(async (opts) => {
|
|
1841
|
-
const res = await requireClient().deleteSubredditPoolTierRule(opts.team, opts.id);
|
|
1841
|
+
const res = await requireClient().deleteSubredditPoolTierRule(resolveTeamId(opts.team), opts.id);
|
|
1842
1842
|
console.log(JSON.stringify(res, null, 2));
|
|
1843
1843
|
});
|
|
1844
1844
|
const intel = program
|
|
@@ -1847,14 +1847,134 @@ const intel = program
|
|
|
1847
1847
|
intel
|
|
1848
1848
|
.command("industry-pools-list")
|
|
1849
1849
|
.description("GET .../subreddit-intelligence/industry-pools")
|
|
1850
|
-
.
|
|
1850
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1851
1851
|
.option("-n, --limit <n>", "limit", "50")
|
|
1852
1852
|
.action(async (opts) => {
|
|
1853
|
-
const res = await requireClient().listIndustryPools(opts.team, {
|
|
1853
|
+
const res = await requireClient().listIndustryPools(resolveTeamId(opts.team), {
|
|
1854
1854
|
limit: Number(opts.limit),
|
|
1855
1855
|
});
|
|
1856
1856
|
console.log(JSON.stringify(res, null, 2));
|
|
1857
1857
|
});
|
|
1858
|
+
intel
|
|
1859
|
+
.command("handoff-create")
|
|
1860
|
+
.description("POST /v1/system/subreddit-intelligence/handoffs(阶段产物固化;缺 requiredFields 返回 readyForNextSkill=false 不拒收)")
|
|
1861
|
+
.requiredOption("--phase <phase>", "research|compliance|planning|writing|delivery|monthly_iteration")
|
|
1862
|
+
.requiredOption("-j, --json <json>", "阶段产物 payload(顶层字段按 phase 校验)")
|
|
1863
|
+
.option("--run-id <id>", "关联 run 追溯 id")
|
|
1864
|
+
.action(async (opts) => {
|
|
1865
|
+
const res = await requireClient().createSopHandoff({
|
|
1866
|
+
phase: opts.phase,
|
|
1867
|
+
payload: JSON.parse(opts.json),
|
|
1868
|
+
...(opts.runId ? { runId: opts.runId } : {}),
|
|
1869
|
+
});
|
|
1870
|
+
console.log(JSON.stringify(res, null, 2));
|
|
1871
|
+
});
|
|
1872
|
+
intel
|
|
1873
|
+
.command("handoffs-list")
|
|
1874
|
+
.description("GET /v1/system/subreddit-intelligence/handoffs")
|
|
1875
|
+
.option("--phase <phase>", "按阶段过滤")
|
|
1876
|
+
.option("--run-id <id>", "按 run 过滤")
|
|
1877
|
+
.option("--ready-only", "只要 readyForNextSkill=true 的")
|
|
1878
|
+
.option("-n, --limit <n>", "limit", "20")
|
|
1879
|
+
.option("--offset <n>", "offset", "0")
|
|
1880
|
+
.action(async (opts) => {
|
|
1881
|
+
const res = await requireClient().listSopHandoffs({
|
|
1882
|
+
phase: opts.phase,
|
|
1883
|
+
runId: opts.runId,
|
|
1884
|
+
readyOnly: Boolean(opts.readyOnly),
|
|
1885
|
+
limit: Number(opts.limit),
|
|
1886
|
+
offset: Number(opts.offset),
|
|
1887
|
+
});
|
|
1888
|
+
console.log(JSON.stringify(res, null, 2));
|
|
1889
|
+
});
|
|
1890
|
+
intel
|
|
1891
|
+
.command("coverage")
|
|
1892
|
+
.description("GET /v1/system/subreddit-intelligence/coverage(纯读覆盖率评估:posts/comments/subreddits/evidence 各维 available vs required)")
|
|
1893
|
+
.option("--brand-keywords <list>", "品牌词,逗号分隔")
|
|
1894
|
+
.option("--competitor-keywords <list>", "竞品词,逗号分隔")
|
|
1895
|
+
.option("--subreddits <list>", "板块,逗号分隔")
|
|
1896
|
+
.option("--time-window <w>", "day|week|month", "week")
|
|
1897
|
+
.option("--evidence-types <list>", "证据类型,逗号分隔")
|
|
1898
|
+
.option("--min-posts <n>", "最小帖子数", "30")
|
|
1899
|
+
.option("--min-subreddits <n>", "最小板块数", "3")
|
|
1900
|
+
.option("--need-comments", "要求评论覆盖")
|
|
1901
|
+
.option("--min-comments <n>", "最小评论数")
|
|
1902
|
+
.option("--need-rules-evidence", "要求版规证据(与 --evidence-types 并集)")
|
|
1903
|
+
.option("--freshness-hours <n>", "数据最大年龄(小时,与窗口取更紧)")
|
|
1904
|
+
.action(async (opts) => {
|
|
1905
|
+
const csv = (v) => v
|
|
1906
|
+
? String(v)
|
|
1907
|
+
.split(",")
|
|
1908
|
+
.map((s) => s.trim())
|
|
1909
|
+
.filter(Boolean)
|
|
1910
|
+
: undefined;
|
|
1911
|
+
const res = await requireClient().getVocCoverage({
|
|
1912
|
+
brandKeywords: csv(opts.brandKeywords),
|
|
1913
|
+
competitorKeywords: csv(opts.competitorKeywords),
|
|
1914
|
+
subreddits: csv(opts.subreddits),
|
|
1915
|
+
timeWindow: opts.timeWindow,
|
|
1916
|
+
evidenceTypes: csv(opts.evidenceTypes),
|
|
1917
|
+
minPosts: Number(opts.minPosts),
|
|
1918
|
+
minSubreddits: Number(opts.minSubreddits),
|
|
1919
|
+
needComments: Boolean(opts.needComments),
|
|
1920
|
+
...(opts.minComments ? { minComments: Number(opts.minComments) } : {}),
|
|
1921
|
+
needRulesEvidence: Boolean(opts.needRulesEvidence),
|
|
1922
|
+
...(opts.freshnessHours
|
|
1923
|
+
? { freshnessHours: Number(opts.freshnessHours) }
|
|
1924
|
+
: {}),
|
|
1925
|
+
});
|
|
1926
|
+
console.log(JSON.stringify(res, null, 2));
|
|
1927
|
+
});
|
|
1928
|
+
intel
|
|
1929
|
+
.command("evidence-list")
|
|
1930
|
+
.description("GET /v1/system/subreddit-intelligence/evidence(证据列表)")
|
|
1931
|
+
.option("--subreddit <name>", "板块名(r/ 前缀可省)")
|
|
1932
|
+
.option("--type <evidenceType>", "about|rules|wiki|submit_text|pinned|flair|page_signals|installed_apps")
|
|
1933
|
+
.option("--status <status>", "available|not_visible|failed")
|
|
1934
|
+
.option("--fresh-only", "只要未过期的 available 证据")
|
|
1935
|
+
.option("-n, --limit <n>", "limit", "50")
|
|
1936
|
+
.option("--offset <n>", "offset", "0")
|
|
1937
|
+
.action(async (opts) => {
|
|
1938
|
+
const res = await requireClient().listSubredditEvidence({
|
|
1939
|
+
subreddit: opts.subreddit,
|
|
1940
|
+
evidenceType: opts.type,
|
|
1941
|
+
status: opts.status,
|
|
1942
|
+
freshOnly: Boolean(opts.freshOnly),
|
|
1943
|
+
limit: Number(opts.limit),
|
|
1944
|
+
offset: Number(opts.offset),
|
|
1945
|
+
});
|
|
1946
|
+
console.log(JSON.stringify(res, null, 2));
|
|
1947
|
+
});
|
|
1948
|
+
intel
|
|
1949
|
+
.command("evidence-status")
|
|
1950
|
+
.description("GET /v1/system/subreddit-intelligence/evidence/status(8 类证据状态面板:status/needsAcquisition/freshUntil/最近失败原因)")
|
|
1951
|
+
.requiredOption("--subreddit <name>", "板块名")
|
|
1952
|
+
.action(async (opts) => {
|
|
1953
|
+
const res = await requireClient().getSubredditEvidenceStatus(opts.subreddit);
|
|
1954
|
+
console.log(JSON.stringify(res, null, 2));
|
|
1955
|
+
});
|
|
1956
|
+
intel
|
|
1957
|
+
.command("evidence-fetch")
|
|
1958
|
+
.description("POST /v1/system/subreddit-intelligence/evidence/fetch(派发采集;同指纹活跃 run 复用)")
|
|
1959
|
+
.requiredOption("--subreddits <list>", "逗号分隔板块列表(≤20)")
|
|
1960
|
+
.option("--types <list>", "逗号分隔证据类型;缺省 8 类全采")
|
|
1961
|
+
.action(async (opts) => {
|
|
1962
|
+
const res = await requireClient().dispatchSubredditEvidenceFetch({
|
|
1963
|
+
subreddits: String(opts.subreddits)
|
|
1964
|
+
.split(",")
|
|
1965
|
+
.map((s) => s.trim())
|
|
1966
|
+
.filter(Boolean),
|
|
1967
|
+
...(opts.types
|
|
1968
|
+
? {
|
|
1969
|
+
evidenceTypes: String(opts.types)
|
|
1970
|
+
.split(",")
|
|
1971
|
+
.map((s) => s.trim())
|
|
1972
|
+
.filter(Boolean),
|
|
1973
|
+
}
|
|
1974
|
+
: {}),
|
|
1975
|
+
});
|
|
1976
|
+
console.log(JSON.stringify(res, null, 2));
|
|
1977
|
+
});
|
|
1858
1978
|
intel
|
|
1859
1979
|
.command("watchlists-list")
|
|
1860
1980
|
.description("GET .../subreddit-intelligence/watchlists")
|
|
@@ -1965,23 +2085,23 @@ intel
|
|
|
1965
2085
|
intel
|
|
1966
2086
|
.command("dispatch")
|
|
1967
2087
|
.description("POST .../subreddit-intelligence/hot-posts/dispatch-task")
|
|
1968
|
-
.
|
|
2088
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1969
2089
|
.requiredOption("-j, --json <json>", "{ hotPostId, socialAccountId, action, runAt? }")
|
|
1970
2090
|
.action(async (opts) => {
|
|
1971
2091
|
const body = JSON.parse(opts.json);
|
|
1972
|
-
const res = await requireClient().dispatchTaskFromHotPost(opts.team, body);
|
|
2092
|
+
const res = await requireClient().dispatchTaskFromHotPost(resolveTeamId(opts.team), body);
|
|
1973
2093
|
console.log(JSON.stringify(res, null, 2));
|
|
1974
2094
|
});
|
|
1975
2095
|
intel
|
|
1976
2096
|
.command("tier-rules-list")
|
|
1977
2097
|
.description("GET .../subreddit-intelligence/tier-rules")
|
|
1978
|
-
.
|
|
2098
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1979
2099
|
.option("--tier <tier>", "tier filter")
|
|
1980
2100
|
.option("--enabled <bool>", "true|false")
|
|
1981
2101
|
.option("-n, --limit <n>", "limit", "50")
|
|
1982
2102
|
.option("--offset <n>", "offset", "0")
|
|
1983
2103
|
.action(async (opts) => {
|
|
1984
|
-
const res = await requireClient().listTierRules(opts.team, {
|
|
2104
|
+
const res = await requireClient().listTierRules(resolveTeamId(opts.team), {
|
|
1985
2105
|
tier: opts.tier,
|
|
1986
2106
|
enabled: opts.enabled === undefined
|
|
1987
2107
|
? undefined
|
|
@@ -1994,31 +2114,31 @@ intel
|
|
|
1994
2114
|
intel
|
|
1995
2115
|
.command("tier-rules-create")
|
|
1996
2116
|
.description("POST .../subreddit-intelligence/tier-rules")
|
|
1997
|
-
.
|
|
2117
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
1998
2118
|
.requiredOption("-j, --json <json>", "tier rule body")
|
|
1999
2119
|
.action(async (opts) => {
|
|
2000
2120
|
const body = JSON.parse(opts.json);
|
|
2001
|
-
const res = await requireClient().createTierRule(opts.team, body);
|
|
2121
|
+
const res = await requireClient().createTierRule(resolveTeamId(opts.team), body);
|
|
2002
2122
|
console.log(JSON.stringify(res, null, 2));
|
|
2003
2123
|
});
|
|
2004
2124
|
intel
|
|
2005
2125
|
.command("tier-rules-update")
|
|
2006
2126
|
.description("PATCH .../subreddit-intelligence/tier-rules/:id")
|
|
2007
|
-
.
|
|
2127
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2008
2128
|
.requiredOption("--id <uuid>", "Tier rule UUID")
|
|
2009
2129
|
.requiredOption("-j, --json <json>", "update body")
|
|
2010
2130
|
.action(async (opts) => {
|
|
2011
2131
|
const body = JSON.parse(opts.json);
|
|
2012
|
-
const res = await requireClient().updateTierRule(opts.team, opts.id, body);
|
|
2132
|
+
const res = await requireClient().updateTierRule(resolveTeamId(opts.team), opts.id, body);
|
|
2013
2133
|
console.log(JSON.stringify(res, null, 2));
|
|
2014
2134
|
});
|
|
2015
2135
|
intel
|
|
2016
2136
|
.command("tier-rules-delete")
|
|
2017
2137
|
.description("DELETE .../subreddit-intelligence/tier-rules/:id")
|
|
2018
|
-
.
|
|
2138
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2019
2139
|
.requiredOption("--id <uuid>", "Tier rule UUID")
|
|
2020
2140
|
.action(async (opts) => {
|
|
2021
|
-
const res = await requireClient().deleteTierRule(opts.team, opts.id);
|
|
2141
|
+
const res = await requireClient().deleteTierRule(resolveTeamId(opts.team), opts.id);
|
|
2022
2142
|
console.log(JSON.stringify(res, null, 2));
|
|
2023
2143
|
});
|
|
2024
2144
|
intel
|
|
@@ -2206,15 +2326,15 @@ const usersCmd = program.command("users").description("团队成员管理");
|
|
|
2206
2326
|
usersCmd
|
|
2207
2327
|
.command("list")
|
|
2208
2328
|
.description("GET /users")
|
|
2209
|
-
.
|
|
2329
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2210
2330
|
.action(async (opts) => {
|
|
2211
2331
|
await withPermissionGate({
|
|
2212
2332
|
command: "users list",
|
|
2213
2333
|
resource: "systemMember",
|
|
2214
2334
|
action: "list",
|
|
2215
|
-
teamId: opts.team,
|
|
2335
|
+
teamId: resolveTeamId(opts.team),
|
|
2216
2336
|
}, async () => {
|
|
2217
|
-
const res = await requireClient().listUsers(opts.team);
|
|
2337
|
+
const res = await requireClient().listUsers(resolveTeamId(opts.team));
|
|
2218
2338
|
console.log(JSON.stringify(res, null, 2));
|
|
2219
2339
|
});
|
|
2220
2340
|
});
|
|
@@ -2234,17 +2354,17 @@ usersCmd
|
|
|
2234
2354
|
usersCmd
|
|
2235
2355
|
.command("create")
|
|
2236
2356
|
.description("POST /users")
|
|
2237
|
-
.
|
|
2357
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2238
2358
|
.requiredOption("-j, --json <json>", "{ email, password, role? }")
|
|
2239
2359
|
.action(async (opts) => {
|
|
2240
2360
|
await withPermissionGate({
|
|
2241
2361
|
command: "users create",
|
|
2242
2362
|
resource: "systemMember",
|
|
2243
2363
|
action: "create",
|
|
2244
|
-
teamId: opts.team,
|
|
2364
|
+
teamId: resolveTeamId(opts.team),
|
|
2245
2365
|
}, async () => {
|
|
2246
2366
|
const body = JSON.parse(opts.json);
|
|
2247
|
-
const res = await requireClient().createUser(opts.team, body);
|
|
2367
|
+
const res = await requireClient().createUser(resolveTeamId(opts.team), body);
|
|
2248
2368
|
console.log(JSON.stringify(res, null, 2));
|
|
2249
2369
|
});
|
|
2250
2370
|
});
|
|
@@ -2342,16 +2462,16 @@ brandMembersCmd
|
|
|
2342
2462
|
brandMembersCmd
|
|
2343
2463
|
.command("list")
|
|
2344
2464
|
.description("GET /teams/:teamId/brand-members (compat)")
|
|
2345
|
-
.
|
|
2465
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2346
2466
|
.option("--user <uuid>", "userId 过滤")
|
|
2347
2467
|
.action(async (opts) => {
|
|
2348
2468
|
await withPermissionGate({
|
|
2349
2469
|
command: "brand-members list",
|
|
2350
2470
|
resource: "brandMember",
|
|
2351
2471
|
action: "list",
|
|
2352
|
-
teamId: opts.team,
|
|
2472
|
+
teamId: resolveTeamId(opts.team),
|
|
2353
2473
|
}, async () => {
|
|
2354
|
-
const res = await requireClient().listBrandMembers(opts.team, {
|
|
2474
|
+
const res = await requireClient().listBrandMembers(resolveTeamId(opts.team), {
|
|
2355
2475
|
userId: opts.user,
|
|
2356
2476
|
});
|
|
2357
2477
|
console.log(JSON.stringify(res, null, 2));
|
|
@@ -2360,7 +2480,7 @@ brandMembersCmd
|
|
|
2360
2480
|
brandMembersCmd
|
|
2361
2481
|
.command("create")
|
|
2362
2482
|
.description("POST /brand-members")
|
|
2363
|
-
.
|
|
2483
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2364
2484
|
.requiredOption("-j, --json <json>", "{ brandId, userId, role? }")
|
|
2365
2485
|
.option("--dry-run", "预览", false)
|
|
2366
2486
|
.option("--apply", "执行写入", false)
|
|
@@ -2369,17 +2489,17 @@ brandMembersCmd
|
|
|
2369
2489
|
command: "brand-members create",
|
|
2370
2490
|
resource: "brandMember",
|
|
2371
2491
|
action: "create",
|
|
2372
|
-
teamId: opts.team,
|
|
2492
|
+
teamId: resolveTeamId(opts.team),
|
|
2373
2493
|
}, async () => {
|
|
2374
2494
|
const body = JSON.parse(opts.json);
|
|
2375
2495
|
if (!assertApplyOrDryRun(opts, {
|
|
2376
2496
|
command: "brand-members create",
|
|
2377
2497
|
danger: "write",
|
|
2378
|
-
summary: { teamId: opts.team, ...body },
|
|
2498
|
+
summary: { teamId: resolveTeamId(opts.team), ...body },
|
|
2379
2499
|
})) {
|
|
2380
2500
|
return;
|
|
2381
2501
|
}
|
|
2382
|
-
const res = await requireClient().createBrandMember(opts.team, body);
|
|
2502
|
+
const res = await requireClient().createBrandMember(resolveTeamId(opts.team), body);
|
|
2383
2503
|
console.log(JSON.stringify(res, null, 2));
|
|
2384
2504
|
});
|
|
2385
2505
|
});
|
|
@@ -2390,11 +2510,11 @@ const notifChannels = program
|
|
|
2390
2510
|
notifChannels
|
|
2391
2511
|
.command("list")
|
|
2392
2512
|
.description("GET /notification-channels")
|
|
2393
|
-
.
|
|
2513
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2394
2514
|
.option("--brand <uuid>", "brandId 过滤(推荐)")
|
|
2395
2515
|
.option("--campaign <uuid>", "campaignId 过滤(legacy)")
|
|
2396
2516
|
.action(async (opts) => {
|
|
2397
|
-
const res = await requireClient().listNotificationChannels(opts.team, {
|
|
2517
|
+
const res = await requireClient().listNotificationChannels(resolveTeamId(opts.team), {
|
|
2398
2518
|
brandId: opts.brand,
|
|
2399
2519
|
campaignId: opts.campaign,
|
|
2400
2520
|
});
|
|
@@ -2403,40 +2523,40 @@ notifChannels
|
|
|
2403
2523
|
notifChannels
|
|
2404
2524
|
.command("create")
|
|
2405
2525
|
.description("POST /notification-channels")
|
|
2406
|
-
.
|
|
2526
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2407
2527
|
.requiredOption("-j, --json <json>", "{ provider, externalId, minRole?, brandId?, campaignId? }")
|
|
2408
2528
|
.action(async (opts) => {
|
|
2409
2529
|
const body = JSON.parse(opts.json);
|
|
2410
|
-
const res = await requireClient().createNotificationChannel(opts.team, body);
|
|
2530
|
+
const res = await requireClient().createNotificationChannel(resolveTeamId(opts.team), body);
|
|
2411
2531
|
console.log(JSON.stringify(res, null, 2));
|
|
2412
2532
|
});
|
|
2413
2533
|
notifChannels
|
|
2414
2534
|
.command("update")
|
|
2415
2535
|
.description("PATCH /notification-channels/:id")
|
|
2416
|
-
.
|
|
2536
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2417
2537
|
.requiredOption("--channel <uuid>", "Channel UUID")
|
|
2418
2538
|
.requiredOption("-j, --json <json>", "update body")
|
|
2419
2539
|
.action(async (opts) => {
|
|
2420
2540
|
const body = JSON.parse(opts.json);
|
|
2421
|
-
const res = await requireClient().updateNotificationChannel(opts.team, opts.channel, body);
|
|
2541
|
+
const res = await requireClient().updateNotificationChannel(resolveTeamId(opts.team), opts.channel, body);
|
|
2422
2542
|
console.log(JSON.stringify(res, null, 2));
|
|
2423
2543
|
});
|
|
2424
2544
|
notifChannels
|
|
2425
2545
|
.command("delete")
|
|
2426
2546
|
.description("DELETE /notification-channels/:id")
|
|
2427
|
-
.
|
|
2547
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2428
2548
|
.requiredOption("--channel <uuid>", "Channel UUID")
|
|
2429
2549
|
.action(async (opts) => {
|
|
2430
|
-
await requireClient().deleteNotificationChannel(opts.team, opts.channel);
|
|
2550
|
+
await requireClient().deleteNotificationChannel(resolveTeamId(opts.team), opts.channel);
|
|
2431
2551
|
console.log("OK");
|
|
2432
2552
|
});
|
|
2433
2553
|
notifChannels
|
|
2434
2554
|
.command("test")
|
|
2435
2555
|
.description("POST /notification-channels/:id/test")
|
|
2436
|
-
.
|
|
2556
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2437
2557
|
.requiredOption("--channel <uuid>", "Channel UUID")
|
|
2438
2558
|
.action(async (opts) => {
|
|
2439
|
-
const res = await requireClient().testNotificationChannel(opts.team, opts.channel);
|
|
2559
|
+
const res = await requireClient().testNotificationChannel(resolveTeamId(opts.team), opts.channel);
|
|
2440
2560
|
console.log(JSON.stringify(res, null, 2));
|
|
2441
2561
|
});
|
|
2442
2562
|
// --- api-keys ---
|
|
@@ -2444,16 +2564,16 @@ const apiKeys = program.command("api-keys").description("API Key 管理");
|
|
|
2444
2564
|
apiKeys
|
|
2445
2565
|
.command("list")
|
|
2446
2566
|
.description("GET /api-keys")
|
|
2447
|
-
.
|
|
2567
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2448
2568
|
.option("-n, --limit <n>", "limit", "50")
|
|
2449
2569
|
.action(async (opts) => {
|
|
2450
2570
|
await withPermissionGate({
|
|
2451
2571
|
command: "api-keys list",
|
|
2452
2572
|
resource: "apiKey",
|
|
2453
2573
|
action: "list",
|
|
2454
|
-
teamId: opts.team,
|
|
2574
|
+
teamId: resolveTeamId(opts.team),
|
|
2455
2575
|
}, async () => {
|
|
2456
|
-
const res = await requireClient().listApiKeys(opts.team, {
|
|
2576
|
+
const res = await requireClient().listApiKeys(resolveTeamId(opts.team), {
|
|
2457
2577
|
limit: Number(opts.limit),
|
|
2458
2578
|
});
|
|
2459
2579
|
console.log(JSON.stringify(res, null, 2));
|
|
@@ -2462,7 +2582,7 @@ apiKeys
|
|
|
2462
2582
|
apiKeys
|
|
2463
2583
|
.command("create")
|
|
2464
2584
|
.description("POST /api-keys")
|
|
2465
|
-
.
|
|
2585
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2466
2586
|
.requiredOption("-j, --json <json>", "{ name, role, visibleCampaignIds? }")
|
|
2467
2587
|
.option("--dry-run", "预览", false)
|
|
2468
2588
|
.option("--apply", "执行写入", false)
|
|
@@ -2471,24 +2591,24 @@ apiKeys
|
|
|
2471
2591
|
command: "api-keys create",
|
|
2472
2592
|
resource: "apiKey",
|
|
2473
2593
|
action: "create",
|
|
2474
|
-
teamId: opts.team,
|
|
2594
|
+
teamId: resolveTeamId(opts.team),
|
|
2475
2595
|
}, async () => {
|
|
2476
2596
|
const body = JSON.parse(opts.json);
|
|
2477
2597
|
if (!assertApplyOrDryRun(opts, {
|
|
2478
2598
|
command: "api-keys create",
|
|
2479
2599
|
danger: "secret",
|
|
2480
|
-
summary: { teamId: opts.team, ...body },
|
|
2600
|
+
summary: { teamId: resolveTeamId(opts.team), ...body },
|
|
2481
2601
|
})) {
|
|
2482
2602
|
return;
|
|
2483
2603
|
}
|
|
2484
|
-
const res = await requireClient().createApiKey(opts.team, body);
|
|
2604
|
+
const res = await requireClient().createApiKey(resolveTeamId(opts.team), body);
|
|
2485
2605
|
console.log(JSON.stringify(res, null, 2));
|
|
2486
2606
|
});
|
|
2487
2607
|
});
|
|
2488
2608
|
apiKeys
|
|
2489
2609
|
.command("delete")
|
|
2490
2610
|
.description("DELETE /api-keys/:id")
|
|
2491
|
-
.
|
|
2611
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2492
2612
|
.requiredOption("--key <uuid>", "API Key UUID")
|
|
2493
2613
|
.option("--dry-run", "预览", false)
|
|
2494
2614
|
.option("--apply", "执行写入", false)
|
|
@@ -2497,23 +2617,23 @@ apiKeys
|
|
|
2497
2617
|
command: "api-keys delete",
|
|
2498
2618
|
resource: "apiKey",
|
|
2499
2619
|
action: "delete",
|
|
2500
|
-
teamId: opts.team,
|
|
2620
|
+
teamId: resolveTeamId(opts.team),
|
|
2501
2621
|
}, async () => {
|
|
2502
2622
|
if (!assertApplyOrDryRun(opts, {
|
|
2503
2623
|
command: "api-keys delete",
|
|
2504
2624
|
danger: "delete",
|
|
2505
|
-
summary: { teamId: opts.team, keyId: opts.key },
|
|
2625
|
+
summary: { teamId: resolveTeamId(opts.team), keyId: opts.key },
|
|
2506
2626
|
})) {
|
|
2507
2627
|
return;
|
|
2508
2628
|
}
|
|
2509
|
-
await requireClient().deleteApiKey(opts.team, opts.key);
|
|
2629
|
+
await requireClient().deleteApiKey(resolveTeamId(opts.team), opts.key);
|
|
2510
2630
|
console.log("OK");
|
|
2511
2631
|
});
|
|
2512
2632
|
});
|
|
2513
2633
|
apiKeys
|
|
2514
2634
|
.command("rotate")
|
|
2515
2635
|
.description("POST /api-keys/:id/rotate")
|
|
2516
|
-
.
|
|
2636
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2517
2637
|
.requiredOption("--key <uuid>", "API Key UUID")
|
|
2518
2638
|
.option("--dry-run", "预览", false)
|
|
2519
2639
|
.option("--apply", "执行写入", false)
|
|
@@ -2522,23 +2642,23 @@ apiKeys
|
|
|
2522
2642
|
command: "api-keys rotate",
|
|
2523
2643
|
resource: "apiKey",
|
|
2524
2644
|
action: "update",
|
|
2525
|
-
teamId: opts.team,
|
|
2645
|
+
teamId: resolveTeamId(opts.team),
|
|
2526
2646
|
}, async () => {
|
|
2527
2647
|
if (!assertApplyOrDryRun(opts, {
|
|
2528
2648
|
command: "api-keys rotate",
|
|
2529
2649
|
danger: "secret",
|
|
2530
|
-
summary: { teamId: opts.team, keyId: opts.key },
|
|
2650
|
+
summary: { teamId: resolveTeamId(opts.team), keyId: opts.key },
|
|
2531
2651
|
})) {
|
|
2532
2652
|
return;
|
|
2533
2653
|
}
|
|
2534
|
-
const res = await requireClient().rotateApiKey(opts.team, opts.key);
|
|
2654
|
+
const res = await requireClient().rotateApiKey(resolveTeamId(opts.team), opts.key);
|
|
2535
2655
|
console.log(JSON.stringify(res, null, 2));
|
|
2536
2656
|
});
|
|
2537
2657
|
});
|
|
2538
2658
|
apiKeys
|
|
2539
2659
|
.command("batch-revoke")
|
|
2540
2660
|
.description("POST /api-keys/batch/revoke")
|
|
2541
|
-
.
|
|
2661
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2542
2662
|
.requiredOption("-j, --json <json>", '{ "apiKeyIds": ["uuid1","uuid2"] }')
|
|
2543
2663
|
.option("--dry-run", "预览", false)
|
|
2544
2664
|
.option("--apply", "执行写入", false)
|
|
@@ -2547,25 +2667,25 @@ apiKeys
|
|
|
2547
2667
|
command: "api-keys batch-revoke",
|
|
2548
2668
|
resource: "apiKey",
|
|
2549
2669
|
action: "delete",
|
|
2550
|
-
teamId: opts.team,
|
|
2670
|
+
teamId: resolveTeamId(opts.team),
|
|
2551
2671
|
}, async () => {
|
|
2552
2672
|
const body = JSON.parse(opts.json);
|
|
2553
2673
|
const apiKeyIds = body.apiKeyIds ?? body.ids ?? [];
|
|
2554
2674
|
if (!assertApplyOrDryRun(opts, {
|
|
2555
2675
|
command: "api-keys batch-revoke",
|
|
2556
2676
|
danger: "delete",
|
|
2557
|
-
summary: { teamId: opts.team, apiKeyIds },
|
|
2677
|
+
summary: { teamId: resolveTeamId(opts.team), apiKeyIds },
|
|
2558
2678
|
})) {
|
|
2559
2679
|
return;
|
|
2560
2680
|
}
|
|
2561
|
-
const res = await requireClient().batchRevokeApiKeys(opts.team, apiKeyIds);
|
|
2681
|
+
const res = await requireClient().batchRevokeApiKeys(resolveTeamId(opts.team), apiKeyIds);
|
|
2562
2682
|
console.log(JSON.stringify(res, null, 2));
|
|
2563
2683
|
});
|
|
2564
2684
|
});
|
|
2565
2685
|
apiKeys
|
|
2566
2686
|
.command("batch-rotate")
|
|
2567
2687
|
.description("POST /api-keys/batch/rotate")
|
|
2568
|
-
.
|
|
2688
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2569
2689
|
.requiredOption("-j, --json <json>", '{ "apiKeyIds": ["uuid1","uuid2"] }')
|
|
2570
2690
|
.option("--dry-run", "预览", false)
|
|
2571
2691
|
.option("--apply", "执行写入", false)
|
|
@@ -2574,18 +2694,18 @@ apiKeys
|
|
|
2574
2694
|
command: "api-keys batch-rotate",
|
|
2575
2695
|
resource: "apiKey",
|
|
2576
2696
|
action: "update",
|
|
2577
|
-
teamId: opts.team,
|
|
2697
|
+
teamId: resolveTeamId(opts.team),
|
|
2578
2698
|
}, async () => {
|
|
2579
2699
|
const body = JSON.parse(opts.json);
|
|
2580
2700
|
const apiKeyIds = body.apiKeyIds ?? body.ids ?? [];
|
|
2581
2701
|
if (!assertApplyOrDryRun(opts, {
|
|
2582
2702
|
command: "api-keys batch-rotate",
|
|
2583
2703
|
danger: "secret",
|
|
2584
|
-
summary: { teamId: opts.team, apiKeyIds },
|
|
2704
|
+
summary: { teamId: resolveTeamId(opts.team), apiKeyIds },
|
|
2585
2705
|
})) {
|
|
2586
2706
|
return;
|
|
2587
2707
|
}
|
|
2588
|
-
const res = await requireClient().batchRotateApiKeys(opts.team, apiKeyIds);
|
|
2708
|
+
const res = await requireClient().batchRotateApiKeys(resolveTeamId(opts.team), apiKeyIds);
|
|
2589
2709
|
console.log(JSON.stringify(res, null, 2));
|
|
2590
2710
|
});
|
|
2591
2711
|
});
|
|
@@ -2595,7 +2715,7 @@ apiKeys
|
|
|
2595
2715
|
events
|
|
2596
2716
|
.command("export-csv")
|
|
2597
2717
|
.description("GET /events/export.csv(输出 CSV 到 stdout)")
|
|
2598
|
-
.
|
|
2718
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2599
2719
|
.option("--type <type>", "事件 type 过滤")
|
|
2600
2720
|
.option("--actor <actor>", "user|agent|cron")
|
|
2601
2721
|
.option("--result <result>", "succeeded|failed|skipped")
|
|
@@ -2605,7 +2725,7 @@ events
|
|
|
2605
2725
|
.option("--to <iso>", "createdTo ISO 时间")
|
|
2606
2726
|
.option("-n, --limit <n>", "limit", "1000")
|
|
2607
2727
|
.action(async (opts) => {
|
|
2608
|
-
const csv = await requireClient().exportEventsCsv(opts.team, {
|
|
2728
|
+
const csv = await requireClient().exportEventsCsv(resolveTeamId(opts.team), {
|
|
2609
2729
|
type: opts.type,
|
|
2610
2730
|
actor: opts.actor,
|
|
2611
2731
|
result: opts.result,
|
|
@@ -2619,49 +2739,49 @@ events
|
|
|
2619
2739
|
reports
|
|
2620
2740
|
.command("create")
|
|
2621
2741
|
.description("POST /reports(直写入库,非队列 ingest)")
|
|
2622
|
-
.
|
|
2742
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2623
2743
|
.requiredOption("-j, --json <json>", "{ reportType, title, source, contentMarkdown, summary?, campaignId?, traceId? }")
|
|
2624
2744
|
.action(async (opts) => {
|
|
2625
2745
|
const body = JSON.parse(opts.json);
|
|
2626
|
-
const res = await requireClient().createReport(opts.team, body);
|
|
2746
|
+
const res = await requireClient().createReport(resolveTeamId(opts.team), body);
|
|
2627
2747
|
console.log(JSON.stringify(res, null, 2));
|
|
2628
2748
|
});
|
|
2629
2749
|
jobs
|
|
2630
2750
|
.command("agent-status")
|
|
2631
2751
|
.description("POST /scheduled-jobs/:id/agent-status(Agent 回写任务状态)")
|
|
2632
|
-
.
|
|
2752
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2633
2753
|
.requiredOption("-i, --id <jobId>", "Job UUID")
|
|
2634
2754
|
.requiredOption("-j, --json <json>", '{ "status": "running"|"succeeded"|"failed", "lastError"?, "payload"? }')
|
|
2635
2755
|
.action(async (opts) => {
|
|
2636
2756
|
const body = JSON.parse(opts.json);
|
|
2637
|
-
const res = await requireClient().updateJobAgentStatus(opts.team, opts.id, body);
|
|
2757
|
+
const res = await requireClient().updateJobAgentStatus(resolveTeamId(opts.team), opts.id, body);
|
|
2638
2758
|
console.log(JSON.stringify(res, null, 2));
|
|
2639
2759
|
});
|
|
2640
2760
|
program
|
|
2641
2761
|
.command("permissions-update")
|
|
2642
2762
|
.description("PATCH /permissions-matrix(更新权限矩阵,admin only)")
|
|
2643
|
-
.
|
|
2763
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2644
2764
|
.requiredOption("-j, --json <json>", "权限矩阵更新 body")
|
|
2645
2765
|
.action(async (opts) => {
|
|
2646
2766
|
await withPermissionGate({
|
|
2647
2767
|
command: "permissions-update",
|
|
2648
2768
|
resource: "permissionMatrix",
|
|
2649
2769
|
action: "update",
|
|
2650
|
-
teamId: opts.team,
|
|
2770
|
+
teamId: resolveTeamId(opts.team),
|
|
2651
2771
|
}, async () => {
|
|
2652
2772
|
const body = JSON.parse(opts.json);
|
|
2653
|
-
const res = await requireClient().updatePermissionsMatrix(opts.team, body);
|
|
2773
|
+
const res = await requireClient().updatePermissionsMatrix(resolveTeamId(opts.team), body);
|
|
2654
2774
|
console.log(JSON.stringify(res, null, 2));
|
|
2655
2775
|
});
|
|
2656
2776
|
});
|
|
2657
2777
|
graph
|
|
2658
2778
|
.command("drilldown")
|
|
2659
2779
|
.description("GET /account-graph/drilldown(账号追溯)")
|
|
2660
|
-
.
|
|
2780
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2661
2781
|
.requiredOption("--account <uuid>", "socialAccountId")
|
|
2662
2782
|
.option("-n, --limit <n>", "limit", "20")
|
|
2663
2783
|
.action(async (opts) => {
|
|
2664
|
-
const res = await requireClient().getAccountGraphDrilldown(opts.team, {
|
|
2784
|
+
const res = await requireClient().getAccountGraphDrilldown(resolveTeamId(opts.team), {
|
|
2665
2785
|
socialAccountId: opts.account,
|
|
2666
2786
|
limit: Number(opts.limit),
|
|
2667
2787
|
});
|
|
@@ -2670,7 +2790,7 @@ graph
|
|
|
2670
2790
|
graph
|
|
2671
2791
|
.command("v2-ego")
|
|
2672
2792
|
.description("GET /graph/v2/ego")
|
|
2673
|
-
.
|
|
2793
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2674
2794
|
.option("--node-id <uuid>", "graph nodeId")
|
|
2675
2795
|
.option("--node-ref <id>", "nodeRefId (e.g. account UUID)")
|
|
2676
2796
|
.option("--node-type <type>", "account|team|campaign")
|
|
@@ -2678,7 +2798,7 @@ graph
|
|
|
2678
2798
|
.option("--edge-kind <kind>", "edgeKind filter")
|
|
2679
2799
|
.option("-n, --limit <n>", "limit", "100")
|
|
2680
2800
|
.action(async (opts) => {
|
|
2681
|
-
const res = await requireClient().getGraphV2Ego(opts.team, {
|
|
2801
|
+
const res = await requireClient().getGraphV2Ego(resolveTeamId(opts.team), {
|
|
2682
2802
|
nodeId: opts.nodeId,
|
|
2683
2803
|
nodeRefId: opts.nodeRef,
|
|
2684
2804
|
nodeType: opts.nodeType,
|
|
@@ -2691,7 +2811,7 @@ graph
|
|
|
2691
2811
|
graph
|
|
2692
2812
|
.command("v2-timeline")
|
|
2693
2813
|
.description("GET /graph/v2/timeline")
|
|
2694
|
-
.
|
|
2814
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2695
2815
|
.option("--node-id <uuid>", "graph nodeId")
|
|
2696
2816
|
.option("--node-ref <id>", "nodeRefId")
|
|
2697
2817
|
.option("--node-type <type>", "account|team|campaign")
|
|
@@ -2699,7 +2819,7 @@ graph
|
|
|
2699
2819
|
.option("--to <iso>", "to ISO time")
|
|
2700
2820
|
.option("-n, --limit <n>", "limit", "100")
|
|
2701
2821
|
.action(async (opts) => {
|
|
2702
|
-
const res = await requireClient().getGraphV2Timeline(opts.team, {
|
|
2822
|
+
const res = await requireClient().getGraphV2Timeline(resolveTeamId(opts.team), {
|
|
2703
2823
|
nodeId: opts.nodeId,
|
|
2704
2824
|
nodeRefId: opts.nodeRef,
|
|
2705
2825
|
nodeType: opts.nodeType,
|
|
@@ -2712,16 +2832,16 @@ graph
|
|
|
2712
2832
|
graph
|
|
2713
2833
|
.command("v2-explain")
|
|
2714
2834
|
.description("GET /graph/v2/explain/:edgeId")
|
|
2715
|
-
.
|
|
2835
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2716
2836
|
.requiredOption("--edge-id <id>", "edge UUID")
|
|
2717
2837
|
.action(async (opts) => {
|
|
2718
|
-
const res = await requireClient().getGraphV2Explain(opts.team, opts.edgeId);
|
|
2838
|
+
const res = await requireClient().getGraphV2Explain(resolveTeamId(opts.team), opts.edgeId);
|
|
2719
2839
|
console.log(JSON.stringify(res, null, 2));
|
|
2720
2840
|
});
|
|
2721
2841
|
graph
|
|
2722
2842
|
.command("v2-path")
|
|
2723
2843
|
.description("GET /graph/v2/path")
|
|
2724
|
-
.
|
|
2844
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2725
2845
|
.option("--source-id <uuid>", "source nodeId")
|
|
2726
2846
|
.option("--source-ref <id>", "source nodeRefId")
|
|
2727
2847
|
.option("--source-type <type>", "source nodeType")
|
|
@@ -2731,7 +2851,7 @@ graph
|
|
|
2731
2851
|
.option("--max-depth <n>", "maxDepth", "4")
|
|
2732
2852
|
.option("-n, --limit <n>", "limit", "50")
|
|
2733
2853
|
.action(async (opts) => {
|
|
2734
|
-
const res = await requireClient().getGraphV2Path(opts.team, {
|
|
2854
|
+
const res = await requireClient().getGraphV2Path(resolveTeamId(opts.team), {
|
|
2735
2855
|
sourceNodeId: opts.sourceId,
|
|
2736
2856
|
sourceNodeRefId: opts.sourceRef,
|
|
2737
2857
|
sourceNodeType: opts.sourceType,
|
|
@@ -2746,13 +2866,13 @@ graph
|
|
|
2746
2866
|
graph
|
|
2747
2867
|
.command("v2-clusters")
|
|
2748
2868
|
.description("GET /graph/v2/clusters")
|
|
2749
|
-
.
|
|
2869
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2750
2870
|
.option("--scope-ref <id>", "scopeNodeRefId")
|
|
2751
2871
|
.option("--scope-type <type>", "scopeNodeType", "account")
|
|
2752
2872
|
.option("--min-risk <n>", "minRiskScore", "60")
|
|
2753
2873
|
.option("-n, --limit <n>", "limit", "100")
|
|
2754
2874
|
.action(async (opts) => {
|
|
2755
|
-
const res = await requireClient().getGraphV2Clusters(opts.team, {
|
|
2875
|
+
const res = await requireClient().getGraphV2Clusters(resolveTeamId(opts.team), {
|
|
2756
2876
|
scopeNodeRefId: opts.scopeRef,
|
|
2757
2877
|
scopeNodeType: opts.scopeType,
|
|
2758
2878
|
minRiskScore: Number(opts.minRisk),
|
|
@@ -2763,12 +2883,12 @@ graph
|
|
|
2763
2883
|
graph
|
|
2764
2884
|
.command("v2-impact")
|
|
2765
2885
|
.description("GET /graph/v2/impact")
|
|
2766
|
-
.
|
|
2886
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2767
2887
|
.option("--campaign-ref <id>", "campaignNodeRefId")
|
|
2768
2888
|
.option("--min-reuse <n>", "minReuseCount", "2")
|
|
2769
2889
|
.option("-n, --limit <n>", "limit", "100")
|
|
2770
2890
|
.action(async (opts) => {
|
|
2771
|
-
const res = await requireClient().getGraphV2Impact(opts.team, {
|
|
2891
|
+
const res = await requireClient().getGraphV2Impact(resolveTeamId(opts.team), {
|
|
2772
2892
|
campaignNodeRefId: opts.campaignRef,
|
|
2773
2893
|
minReuseCount: Number(opts.minReuse),
|
|
2774
2894
|
limit: Number(opts.limit),
|
|
@@ -2782,7 +2902,7 @@ graph
|
|
|
2782
2902
|
events
|
|
2783
2903
|
.command("list-full")
|
|
2784
2904
|
.description("GET /events(含全部过滤参数)")
|
|
2785
|
-
.
|
|
2905
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2786
2906
|
.option("--type <type>", "事件 type")
|
|
2787
2907
|
.option("--actor <actor>", "user|agent|cron")
|
|
2788
2908
|
.option("--result <result>", "succeeded|failed|skipped")
|
|
@@ -2791,7 +2911,7 @@ events
|
|
|
2791
2911
|
.option("--to <iso>", "createdTo ISO 时间")
|
|
2792
2912
|
.option("-n, --limit <n>", "limit", "100")
|
|
2793
2913
|
.action(async (opts) => {
|
|
2794
|
-
const res = await requireClient().listEventsFiltered(opts.team, {
|
|
2914
|
+
const res = await requireClient().listEventsFiltered(resolveTeamId(opts.team), {
|
|
2795
2915
|
brandId: opts.brand,
|
|
2796
2916
|
type: opts.type,
|
|
2797
2917
|
actor: opts.actor,
|
|
@@ -2806,7 +2926,7 @@ events
|
|
|
2806
2926
|
calendar
|
|
2807
2927
|
.command("list-full")
|
|
2808
2928
|
.description("GET /calendar-entries(含全部过滤参数)")
|
|
2809
|
-
.
|
|
2929
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2810
2930
|
.option("--campaign <uuid>", "campaignId")
|
|
2811
2931
|
.option("--plan <uuid>", "publishingPlanId")
|
|
2812
2932
|
.option("--account <uuid>", "socialAccountId")
|
|
@@ -2815,7 +2935,7 @@ calendar
|
|
|
2815
2935
|
.option("--to <iso>", "to ISO 时间")
|
|
2816
2936
|
.option("-n, --limit <n>", "limit", "50")
|
|
2817
2937
|
.action(async (opts) => {
|
|
2818
|
-
const res = await requireClient().listCalendarEntries(opts.team, {
|
|
2938
|
+
const res = await requireClient().listCalendarEntries(resolveTeamId(opts.team), {
|
|
2819
2939
|
campaignId: opts.campaign,
|
|
2820
2940
|
publishingPlanId: opts.plan,
|
|
2821
2941
|
socialAccountId: opts.account,
|
|
@@ -2829,14 +2949,14 @@ calendar
|
|
|
2829
2949
|
jobs
|
|
2830
2950
|
.command("list-full")
|
|
2831
2951
|
.description("GET /scheduled-jobs(含全部过滤参数)")
|
|
2832
|
-
.
|
|
2952
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2833
2953
|
.option("--status <st>", "scheduled|running|…")
|
|
2834
2954
|
.option("--account <uuid>", "socialAccountId")
|
|
2835
2955
|
.option("--from <iso>", "from ISO 时间")
|
|
2836
2956
|
.option("--to <iso>", "to ISO 时间")
|
|
2837
2957
|
.option("-n, --limit <n>", "limit", "50")
|
|
2838
2958
|
.action(async (opts) => {
|
|
2839
|
-
const res = await requireClient().listScheduledJobs(opts.team, {
|
|
2959
|
+
const res = await requireClient().listScheduledJobs(resolveTeamId(opts.team), {
|
|
2840
2960
|
status: opts.status,
|
|
2841
2961
|
socialAccountId: opts.account,
|
|
2842
2962
|
from: opts.from,
|
|
@@ -2848,7 +2968,7 @@ jobs
|
|
|
2848
2968
|
reddit
|
|
2849
2969
|
.command("list-full")
|
|
2850
2970
|
.description("GET /reddit-post-snapshots(含全部过滤参数)")
|
|
2851
|
-
.
|
|
2971
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2852
2972
|
.option("--brand <uuid>", "system-level brandId")
|
|
2853
2973
|
.option("--entry <uuid>", "calendarEntryId")
|
|
2854
2974
|
.option("--account <uuid>", "socialAccountId")
|
|
@@ -2866,7 +2986,7 @@ reddit
|
|
|
2866
2986
|
.option("--aggregate", "aggregate across all visible teams (session auth)")
|
|
2867
2987
|
.option("--scope-team <uuid>", "narrow aggregated scope to one team")
|
|
2868
2988
|
.action(async (opts) => {
|
|
2869
|
-
const res = await listRedditSnapshotsPaginated(opts.team, {
|
|
2989
|
+
const res = await listRedditSnapshotsPaginated(resolveTeamId(opts.team), {
|
|
2870
2990
|
brandId: opts.brand,
|
|
2871
2991
|
calendarEntryId: opts.entry,
|
|
2872
2992
|
socialAccountId: opts.account,
|
|
@@ -2919,7 +3039,9 @@ session
|
|
|
2919
3039
|
.description("POST /v1/session/active-team")
|
|
2920
3040
|
.requiredOption("--team <teamId>", "Team UUID")
|
|
2921
3041
|
.action(async (opts) => {
|
|
2922
|
-
const res = await requireClient().sessionActiveTeam({
|
|
3042
|
+
const res = await requireClient().sessionActiveTeam({
|
|
3043
|
+
teamId: resolveTeamId(opts.team),
|
|
3044
|
+
});
|
|
2923
3045
|
console.log(JSON.stringify(res, null, 2));
|
|
2924
3046
|
});
|
|
2925
3047
|
session
|
|
@@ -2932,7 +3054,7 @@ session
|
|
|
2932
3054
|
const res = await requireClient().sessionSetPassword({
|
|
2933
3055
|
email: opts.email,
|
|
2934
3056
|
password: opts.password,
|
|
2935
|
-
teamId: opts.team,
|
|
3057
|
+
teamId: resolveTeamId(opts.team),
|
|
2936
3058
|
});
|
|
2937
3059
|
console.log(JSON.stringify(res, null, 2));
|
|
2938
3060
|
});
|
|
@@ -2949,24 +3071,24 @@ const browserEnvs = accounts.command("browser-envs").description("浏览器环
|
|
|
2949
3071
|
browserEnvs
|
|
2950
3072
|
.command("list-team")
|
|
2951
3073
|
.description("GET /browser-environments(Team 全量)")
|
|
2952
|
-
.
|
|
3074
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2953
3075
|
.action(async (opts) => {
|
|
2954
|
-
const res = await requireClient().listTeamBrowserEnvironments(opts.team);
|
|
3076
|
+
const res = await requireClient().listTeamBrowserEnvironments(resolveTeamId(opts.team));
|
|
2955
3077
|
console.log(JSON.stringify(res, null, 2));
|
|
2956
3078
|
});
|
|
2957
3079
|
browserEnvs
|
|
2958
3080
|
.command("list")
|
|
2959
3081
|
.description("GET /accounts/:accountId/browser-environments")
|
|
2960
|
-
.
|
|
3082
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2961
3083
|
.requiredOption("-a, --account <accountId>", "Account UUID")
|
|
2962
3084
|
.action(async (opts) => {
|
|
2963
|
-
const res = await requireClient().listAccountBrowserEnvironments(opts.team, opts.account);
|
|
3085
|
+
const res = await requireClient().listAccountBrowserEnvironments(resolveTeamId(opts.team), opts.account);
|
|
2964
3086
|
console.log(JSON.stringify(res, null, 2));
|
|
2965
3087
|
});
|
|
2966
3088
|
browserEnvs
|
|
2967
3089
|
.command("create")
|
|
2968
3090
|
.description("POST /accounts/:accountId/browser-environments")
|
|
2969
|
-
.
|
|
3091
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2970
3092
|
.requiredOption("-a, --account <accountId>", "Account UUID")
|
|
2971
3093
|
.option("-j, --json <json>", "env body JSON", "{}")
|
|
2972
3094
|
.action(async (opts) => {
|
|
@@ -2978,13 +3100,13 @@ browserEnvs
|
|
|
2978
3100
|
console.error("Invalid -j / --json");
|
|
2979
3101
|
process.exit(1);
|
|
2980
3102
|
}
|
|
2981
|
-
const res = await requireClient().createBrowserEnvironment(opts.team, opts.account, body);
|
|
3103
|
+
const res = await requireClient().createBrowserEnvironment(resolveTeamId(opts.team), opts.account, body);
|
|
2982
3104
|
console.log(JSON.stringify(res, null, 2));
|
|
2983
3105
|
});
|
|
2984
3106
|
browserEnvs
|
|
2985
3107
|
.command("update")
|
|
2986
3108
|
.description("PATCH /browser-environments/:envId")
|
|
2987
|
-
.
|
|
3109
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
2988
3110
|
.requiredOption("-e, --env <envId>", "Browser environment UUID")
|
|
2989
3111
|
.option("-j, --json <json>", "update body JSON", "{}")
|
|
2990
3112
|
.action(async (opts) => {
|
|
@@ -2992,7 +3114,7 @@ browserEnvs
|
|
|
2992
3114
|
command: "accounts browser-envs update",
|
|
2993
3115
|
resource: "browserEnvironment",
|
|
2994
3116
|
action: "update",
|
|
2995
|
-
teamId: opts.team,
|
|
3117
|
+
teamId: resolveTeamId(opts.team),
|
|
2996
3118
|
}, async () => {
|
|
2997
3119
|
let body = {};
|
|
2998
3120
|
try {
|
|
@@ -3002,18 +3124,18 @@ browserEnvs
|
|
|
3002
3124
|
console.error("Invalid -j / --json");
|
|
3003
3125
|
process.exit(1);
|
|
3004
3126
|
}
|
|
3005
|
-
const res = await requireClient().updateBrowserEnvironment(opts.team, opts.env, body);
|
|
3127
|
+
const res = await requireClient().updateBrowserEnvironment(resolveTeamId(opts.team), opts.env, body);
|
|
3006
3128
|
console.log(JSON.stringify(res, null, 2));
|
|
3007
3129
|
});
|
|
3008
3130
|
});
|
|
3009
3131
|
browserEnvs
|
|
3010
3132
|
.command("bind")
|
|
3011
3133
|
.description("PATCH /browser-environments/:envId(绑定/换绑账号;--account none 解绑)")
|
|
3012
|
-
.
|
|
3134
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3013
3135
|
.requiredOption("-e, --env <envId>", "Browser environment UUID")
|
|
3014
3136
|
.requiredOption("-a, --account <uuid|none>", "目标账号 UUID,none=解绑")
|
|
3015
3137
|
.action(async (opts) => {
|
|
3016
|
-
const res = await requireClient().updateBrowserEnvironment(opts.team, opts.env, {
|
|
3138
|
+
const res = await requireClient().updateBrowserEnvironment(resolveTeamId(opts.team), opts.env, {
|
|
3017
3139
|
socialAccountId: opts.account === "none" ? null : opts.account,
|
|
3018
3140
|
});
|
|
3019
3141
|
console.log(JSON.stringify(res, null, 2));
|
|
@@ -3024,37 +3146,37 @@ const browserEnvTelemetry = browserEnvs
|
|
|
3024
3146
|
browserEnvTelemetry
|
|
3025
3147
|
.command("append")
|
|
3026
3148
|
.description("POST /browser-environments/:envId/telemetry-events")
|
|
3027
|
-
.
|
|
3149
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3028
3150
|
.requiredOption("-e, --env <envId>", "Browser environment UUID")
|
|
3029
3151
|
.requiredOption("-j, --json <json>", "telemetry event body JSON")
|
|
3030
3152
|
.action(async (opts) => {
|
|
3031
3153
|
const body = JSON.parse(opts.json);
|
|
3032
|
-
const res = await requireClient().appendBrowserEnvironmentTelemetryEvent(opts.team, opts.env, body);
|
|
3154
|
+
const res = await requireClient().appendBrowserEnvironmentTelemetryEvent(resolveTeamId(opts.team), opts.env, body);
|
|
3033
3155
|
console.log(JSON.stringify(res, null, 2));
|
|
3034
3156
|
});
|
|
3035
3157
|
browserEnvTelemetry
|
|
3036
3158
|
.command("list")
|
|
3037
3159
|
.description("GET /browser-environments/:envId/telemetry-events")
|
|
3038
|
-
.
|
|
3160
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3039
3161
|
.requiredOption("-e, --env <envId>", "Browser environment UUID")
|
|
3040
3162
|
.option("-n, --limit <n>", "limit", "100")
|
|
3041
3163
|
.action(async (opts) => {
|
|
3042
|
-
const res = await requireClient().listBrowserEnvironmentTelemetryEvents(opts.team, opts.env, { limit: Number(opts.limit) });
|
|
3164
|
+
const res = await requireClient().listBrowserEnvironmentTelemetryEvents(resolveTeamId(opts.team), opts.env, { limit: Number(opts.limit) });
|
|
3043
3165
|
console.log(JSON.stringify(res, null, 2));
|
|
3044
3166
|
});
|
|
3045
3167
|
accounts
|
|
3046
3168
|
.command("guardrails-get")
|
|
3047
3169
|
.description("GET /accounts/:accountId/guardrails(互动配额/护栏)")
|
|
3048
|
-
.
|
|
3170
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3049
3171
|
.requiredOption("-a, --account <ref>", "Account UUID or handle")
|
|
3050
3172
|
.action(async (opts) => {
|
|
3051
|
-
const res = await requireClient().getAccountGuardrails(opts.team, opts.account);
|
|
3173
|
+
const res = await requireClient().getAccountGuardrails(resolveTeamId(opts.team), opts.account);
|
|
3052
3174
|
console.log(JSON.stringify(res, null, 2));
|
|
3053
3175
|
});
|
|
3054
3176
|
accounts
|
|
3055
3177
|
.command("guardrails-set")
|
|
3056
3178
|
.description("PUT /accounts/:accountId/guardrails(payload 浅合并;阶段晋升写回)")
|
|
3057
|
-
.
|
|
3179
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3058
3180
|
.requiredOption("-a, --account <ref>", "Account UUID or handle")
|
|
3059
3181
|
.requiredOption("-j, --json <json>", "{ stage?, payload?: { likeMin, likeMax, commentMin, commentMax, quota?, ... }, syncSource? }")
|
|
3060
3182
|
.action(async (opts) => {
|
|
@@ -3066,7 +3188,7 @@ accounts
|
|
|
3066
3188
|
console.error("Invalid -j / --json");
|
|
3067
3189
|
process.exit(1);
|
|
3068
3190
|
}
|
|
3069
|
-
const res = await requireClient().upsertAccountGuardrails(opts.team, opts.account, body);
|
|
3191
|
+
const res = await requireClient().upsertAccountGuardrails(resolveTeamId(opts.team), opts.account, body);
|
|
3070
3192
|
console.log(JSON.stringify(res, null, 2));
|
|
3071
3193
|
});
|
|
3072
3194
|
const accountAffinities = accounts
|
|
@@ -3075,32 +3197,32 @@ const accountAffinities = accounts
|
|
|
3075
3197
|
accountAffinities
|
|
3076
3198
|
.command("list")
|
|
3077
3199
|
.description("GET /accounts/:accountId/subreddit-affinities")
|
|
3078
|
-
.
|
|
3200
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3079
3201
|
.requiredOption("-a, --account <ref>", "Account UUID or slot")
|
|
3080
3202
|
.action(async (opts) => {
|
|
3081
|
-
const res = await requireClient().listAccountSubredditAffinities(opts.team, opts.account);
|
|
3203
|
+
const res = await requireClient().listAccountSubredditAffinities(resolveTeamId(opts.team), opts.account);
|
|
3082
3204
|
console.log(JSON.stringify(res, null, 2));
|
|
3083
3205
|
});
|
|
3084
3206
|
accountAffinities
|
|
3085
3207
|
.command("upsert")
|
|
3086
3208
|
.description("PUT /accounts/:accountId/subreddit-affinities/:subreddit")
|
|
3087
|
-
.
|
|
3209
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3088
3210
|
.requiredOption("-a, --account <ref>", "Account UUID or slot")
|
|
3089
3211
|
.requiredOption("--subreddit <name>", "Subreddit name")
|
|
3090
3212
|
.requiredOption("-j, --json <json>", "affinity body JSON")
|
|
3091
3213
|
.action(async (opts) => {
|
|
3092
3214
|
const body = JSON.parse(opts.json);
|
|
3093
|
-
const res = await requireClient().upsertAccountSubredditAffinity(opts.team, opts.account, opts.subreddit, body);
|
|
3215
|
+
const res = await requireClient().upsertAccountSubredditAffinity(resolveTeamId(opts.team), opts.account, opts.subreddit, body);
|
|
3094
3216
|
console.log(JSON.stringify(res, null, 2));
|
|
3095
3217
|
});
|
|
3096
3218
|
accountAffinities
|
|
3097
3219
|
.command("recompute")
|
|
3098
3220
|
.description("Enqueue affinity recompute worker job")
|
|
3099
|
-
.
|
|
3221
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3100
3222
|
.requiredOption("-a, --account <uuid>", "Account UUID")
|
|
3101
3223
|
.option("--dry-run", "dry run only", false)
|
|
3102
3224
|
.action(async (opts) => {
|
|
3103
|
-
const res = await requireClient().triggerOpenClawRuntimeMaintenance(opts.team, {
|
|
3225
|
+
const res = await requireClient().triggerOpenClawRuntimeMaintenance(resolveTeamId(opts.team), {
|
|
3104
3226
|
jobType: "affinity-recompute",
|
|
3105
3227
|
socialAccountId: opts.account,
|
|
3106
3228
|
dryRun: Boolean(opts.dryRun),
|
|
@@ -3112,20 +3234,20 @@ const accountPersonas = accounts.command("personas").description("账号人设")
|
|
|
3112
3234
|
accountPersonas
|
|
3113
3235
|
.command("list")
|
|
3114
3236
|
.description("GET /accounts/:accountId/personas")
|
|
3115
|
-
.
|
|
3237
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3116
3238
|
.requiredOption("-a, --account <accountId>", "Account UUID")
|
|
3117
3239
|
.action(async (opts) => {
|
|
3118
|
-
const res = await requireClient().listAccountPersonas(opts.team, opts.account);
|
|
3240
|
+
const res = await requireClient().listAccountPersonas(resolveTeamId(opts.team), opts.account);
|
|
3119
3241
|
console.log(JSON.stringify(res, null, 2));
|
|
3120
3242
|
});
|
|
3121
3243
|
accountPersonas
|
|
3122
3244
|
.command("create")
|
|
3123
3245
|
.description("POST /accounts/:accountId/personas")
|
|
3124
|
-
.
|
|
3246
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3125
3247
|
.requiredOption("-a, --account <accountId>", "Account UUID")
|
|
3126
3248
|
.requiredOption("--markdown <text>", "人设 Markdown 文本")
|
|
3127
3249
|
.action(async (opts) => {
|
|
3128
|
-
const res = await requireClient().createAccountPersona(opts.team, opts.account, { markdown: opts.markdown });
|
|
3250
|
+
const res = await requireClient().createAccountPersona(resolveTeamId(opts.team), opts.account, { markdown: opts.markdown });
|
|
3129
3251
|
console.log(JSON.stringify(res, null, 2));
|
|
3130
3252
|
});
|
|
3131
3253
|
// --- campaigns accounts ---
|
|
@@ -3135,21 +3257,21 @@ const campaignAccounts = campaigns
|
|
|
3135
3257
|
campaignAccounts
|
|
3136
3258
|
.command("list")
|
|
3137
3259
|
.description("LEGACY GET /campaigns/:campaignId/accounts")
|
|
3138
|
-
.
|
|
3260
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3139
3261
|
.requiredOption("-c, --campaign <campaignId>", "Campaign UUID")
|
|
3140
3262
|
.action(async (opts) => {
|
|
3141
|
-
const res = await requireClient().listCampaignAccounts(opts.team, opts.campaign);
|
|
3263
|
+
const res = await requireClient().listCampaignAccounts(resolveTeamId(opts.team), opts.campaign);
|
|
3142
3264
|
console.log(JSON.stringify(res, null, 2));
|
|
3143
3265
|
});
|
|
3144
3266
|
campaignAccounts
|
|
3145
3267
|
.command("assign")
|
|
3146
3268
|
.description("LEGACY POST /campaigns/:campaignId/accounts")
|
|
3147
|
-
.
|
|
3269
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3148
3270
|
.requiredOption("-c, --campaign <campaignId>", "Campaign UUID")
|
|
3149
3271
|
.requiredOption("-a, --account <socialAccountId>", "社交账号 UUID")
|
|
3150
3272
|
.option("--visibility <v>", "public | private | internal")
|
|
3151
3273
|
.action(async (opts) => {
|
|
3152
|
-
const res = await requireClient().assignCampaignAccount(opts.team, opts.campaign, {
|
|
3274
|
+
const res = await requireClient().assignCampaignAccount(resolveTeamId(opts.team), opts.campaign, {
|
|
3153
3275
|
socialAccountId: opts.account,
|
|
3154
3276
|
visibility: opts.visibility,
|
|
3155
3277
|
});
|
|
@@ -3158,18 +3280,18 @@ campaignAccounts
|
|
|
3158
3280
|
campaignAccounts
|
|
3159
3281
|
.command("remove")
|
|
3160
3282
|
.description("LEGACY DELETE /campaigns/:campaignId/accounts/:socialAccountId")
|
|
3161
|
-
.
|
|
3283
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3162
3284
|
.requiredOption("-c, --campaign <campaignId>", "Campaign UUID")
|
|
3163
3285
|
.requiredOption("-a, --account <socialAccountId>", "社交账号 UUID")
|
|
3164
3286
|
.action(async (opts) => {
|
|
3165
|
-
const res = await requireClient().removeCampaignAccount(opts.team, opts.campaign, opts.account);
|
|
3287
|
+
const res = await requireClient().removeCampaignAccount(resolveTeamId(opts.team), opts.campaign, opts.account);
|
|
3166
3288
|
console.log(JSON.stringify(res, null, 2));
|
|
3167
3289
|
});
|
|
3168
3290
|
// --- brand-members remove ---
|
|
3169
3291
|
brandMembersCmd
|
|
3170
3292
|
.command("remove")
|
|
3171
3293
|
.description("DELETE /brand-members/:memberId")
|
|
3172
|
-
.
|
|
3294
|
+
.option("-t, --team <teamId>", "Team UUID(缺省用当前 context)")
|
|
3173
3295
|
.requiredOption("-m, --member <memberId>", "BrandMember UUID")
|
|
3174
3296
|
.option("--dry-run", "预览", false)
|
|
3175
3297
|
.option("--apply", "执行写入", false)
|
|
@@ -3178,16 +3300,19 @@ brandMembersCmd
|
|
|
3178
3300
|
command: "brand-members remove",
|
|
3179
3301
|
resource: "brandMember",
|
|
3180
3302
|
action: "delete",
|
|
3181
|
-
teamId: opts.team,
|
|
3303
|
+
teamId: resolveTeamId(opts.team),
|
|
3182
3304
|
}, async () => {
|
|
3183
3305
|
if (!assertApplyOrDryRun(opts, {
|
|
3184
3306
|
command: "brand-members remove",
|
|
3185
3307
|
danger: "delete",
|
|
3186
|
-
summary: {
|
|
3308
|
+
summary: {
|
|
3309
|
+
teamId: resolveTeamId(opts.team),
|
|
3310
|
+
memberId: opts.member,
|
|
3311
|
+
},
|
|
3187
3312
|
})) {
|
|
3188
3313
|
return;
|
|
3189
3314
|
}
|
|
3190
|
-
const res = await requireClient().deleteBrandMember(opts.team, opts.member);
|
|
3315
|
+
const res = await requireClient().deleteBrandMember(resolveTeamId(opts.team), opts.member);
|
|
3191
3316
|
console.log(JSON.stringify(res, null, 2));
|
|
3192
3317
|
});
|
|
3193
3318
|
});
|