@chainpatrol/cli 1.14.0 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/{breakdown-BLCYJP7O.js → breakdown-5GXBOZBZ.js} +1 -1
  3. package/dist/{check-2IFMTAIU.js → check-OQISBUEC.js} +1 -1
  4. package/dist/{chunk-CABRZEYB.js → chunk-EZGE4YJG.js} +1 -1
  5. package/dist/{chunk-NSRQ62C4.js → chunk-LM7R7JUX.js} +2 -0
  6. package/dist/cli.js +107 -43
  7. package/dist/{configs-update-XUN4X4T2.js → configs-update-5Y47BRAV.js} +1 -1
  8. package/dist/{create-ILSWAUVI.js → create-G4XGWIVM.js} +1 -1
  9. package/dist/{drift-DPYW7LYN.js → drift-FRZEQXYK.js} +1 -1
  10. package/dist/{found-YLTMVPBZ.js → found-WZFO7ZP5.js} +1 -1
  11. package/dist/{get-OFLQ5BXP.js → get-7WRWHCX2.js} +1 -1
  12. package/dist/{healthcheck-SYZQ2ILK.js → healthcheck-STFYE55C.js} +1 -1
  13. package/dist/{list-WYC4ZP7X.js → list-2KCPCEPO.js} +1 -1
  14. package/dist/{list-4THJBDSU.js → list-6HRKMH4L.js} +1 -1
  15. package/dist/{list-VHDU3XMN.js → list-7I4ANMXJ.js} +1 -1
  16. package/dist/{list-GTN2HNGZ.js → list-B227P3DE.js} +1 -1
  17. package/dist/{list-FUQK3TIN.js → list-GHM6Z5KK.js} +2 -2
  18. package/dist/{list-LWB5JQAY.js → list-KNBID2DJ.js} +1 -1
  19. package/dist/{list-2H2CV3JJ.js → list-MHONLKMX.js} +1 -1
  20. package/dist/list-PTXXL5IW.js +87 -0
  21. package/dist/{list-Q5K4RMM4.js → list-RWFAVAAI.js} +1 -1
  22. package/dist/{list-PV5GY2DY.js → list-S3TP5EEA.js} +1 -1
  23. package/dist/{list-RUIQIVEA.js → list-SO34HIJK.js} +25 -6
  24. package/dist/{list-3HCKDPIK.js → list-UVTOWO3R.js} +2 -2
  25. package/dist/{list-H4RCDI6Q.js → list-YAEK7G6Q.js} +50 -4
  26. package/dist/{list-json-B4X74BTZ.js → list-json-RZCY7FWL.js} +1 -1
  27. package/dist/{organization-KANXTARX.js → organization-33CRAMP2.js} +1 -1
  28. package/dist/{review-5J3EQRCB.js → review-YT6TH6TS.js} +1 -1
  29. package/dist/{run-FDZWPY4W.js → run-QTRTOOHA.js} +1 -1
  30. package/dist/{run-XWM67MBV.js → run-TZOVF7YE.js} +2 -2
  31. package/dist/{run-JBQ43OW6.js → run-YQERI2GH.js} +1 -1
  32. package/dist/{search-A75YUJFI.js → search-5EJCY3VV.js} +1 -1
  33. package/dist/{search-DRTTZJJP.js → search-GXPWTIPY.js} +1 -1
  34. package/dist/{snapshot-2IT4KG4F.js → snapshot-SCLXRXLX.js} +1 -1
  35. package/dist/{summary-A24TNQNR.js → summary-Y5JITMCT.js} +1 -1
  36. package/dist/{takedown-time-HB3J2FTZ.js → takedown-time-C7FIZTOO.js} +1 -1
  37. package/dist/{takedown-time-trend-KYPA3W3U.js → takedown-time-trend-SAMO7JAZ.js} +1 -1
  38. package/dist/{time-to-detection-5L7ECKYU.js → time-to-detection-VO7BCUCK.js} +1 -1
  39. package/dist/{validate-FOZCI7HX.js → validate-SUTLVGAV.js} +1 -1
  40. package/dist/{whoami-DSXNLG3B.js → whoami-KVIYPM23.js} +1 -1
  41. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,62 @@
1
1
  # @chainpatrol/cli
2
2
 
3
+ ## 1.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 620519c: List brands for a chosen organization.
8
+
9
+ - **SDK**: `listOrganizationBrands` accepts an optional `{ slug }`. User sessions and user-scoped API keys use it to pick an organization; organization-scoped API keys can still call it with no arguments. The bundled CLI skill now documents `--org` for `brands list`.
10
+ - **CLI**: `chainpatrol brands list` takes `--org <slug>` (falling back to the saved default org), so staff and members can read any brand's included and excluded terms from a `chainpatrol login` session.
11
+ - **MCP**: the `GET /organization/brands` tool gains the optional `slug` input.
12
+
13
+ `GET /organization/brands` in the private `@chainpatrol/external-trpc` and `@chainpatrol/validation` packages now accepts `slug`, authorized the same way as `/organization/watchlist`.
14
+
15
+ - 866a445: Close detection-evaluation gaps found while evaluating detections through the public API.
16
+
17
+ - **SDK**: `listDetections` accepts `excludeDeleted`, which leaves soft-deleted detections out (the endpoint returns them by default). It cannot be combined with `onlyDeleted`. The bundled CLI skill's "Evaluating Detections" guidance is corrected:
18
+ - only the unfiltered watchlist total equals `threatsWatchlisted`;
19
+ - `metrics summary` reports the last 3 months unless given dates;
20
+ - count distinct `asset.id` for domains;
21
+ - bucket by first detection rather than a date window;
22
+ - add the score-scale caveat.
23
+ - **CLI**: `detections list` gains `--exclude-deleted`. `threats list` now explains that it needs `CHAINPATROL_API_KEY` when run with a login session, instead of failing with a bare "Valid API key required".
24
+ - **MCP**: the `detection_evaluation` prompt adds the same guidance:
25
+ - distinct assets vs detections;
26
+ - first-detection bucketing;
27
+ - `metrics_summary` dates apply only when both are set;
28
+ - watchlist total vs `threatsWatchlisted`;
29
+ - retired source keys;
30
+ - the score-scale caveat.
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [620519c]
35
+ - Updated dependencies [866a445]
36
+ - @chainpatrol/sdk@1.15.0
37
+ - @chainpatrol/mcp@1.13.1
38
+
39
+ ## 1.15.0
40
+
41
+ ### Minor Changes
42
+
43
+ - ab80828: Support the new public API detection, threat and watchlist options.
44
+
45
+ - **SDK**: `listDetections` accepts `blockStatus`, `minScore`, `maxScore` and `includeTotal`, and returns `total` and `asset.pendingStatus`. `listThreats` accepts `includePending` and returns `pendingStatus`. New `listOrganizationWatchlist` for `GET /organization/watchlist`.
46
+ - **CLI**: `detections list` gains `--block-status`, `--min-score`, `--max-score` and `--include-total`, and shows pending blocks as `PENDING_BLOCKED`. `threats list` gains `--include-pending`. New `orgs watchlist list`.
47
+ - **MCP**: new `detection_evaluation` prompt that answers the usual evaluation questions (confirmed threats, domain detections, watchlist, detections above a score) with counts rather than samples.
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [5011c77]
52
+ - Updated dependencies [b09ce6c]
53
+ - Updated dependencies [75f8fb4]
54
+ - Updated dependencies [4ff67a0]
55
+ - Updated dependencies [662216d]
56
+ - Updated dependencies [ab80828]
57
+ - @chainpatrol/mcp@1.13.0
58
+ - @chainpatrol/sdk@1.14.0
59
+
3
60
  ## 1.14.0
4
61
 
5
62
  ### Minor Changes
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VFT3TD3E.js";
8
8
  import {
9
9
  createApiClient
10
- } from "./chunk-NSRQ62C4.js";
10
+ } from "./chunk-LM7R7JUX.js";
11
11
  import "./chunk-4QZ7KD2Y.js";
12
12
  import "./chunk-TFCNKBRC.js";
13
13
  import "./chunk-ORAY4KMA.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import {
13
13
  DateTime
14
14
  } from "./chunk-TFCNKBRC.js";
@@ -8,6 +8,7 @@ import {
8
8
  // src/lib/api-client.ts
9
9
  import { ChainPatrolApiClient } from "@chainpatrol/sdk/api";
10
10
  import {
11
+ DETECTION_BLOCK_STATUS_FILTERS,
11
12
  DETECTION_CONFIDENCE_LEVELS,
12
13
  DETECTION_REPORTED_FILTERS,
13
14
  LIVENESS_FILTER_VALUES,
@@ -40,6 +41,7 @@ function createApiClient(options) {
40
41
 
41
42
  export {
42
43
  createApiClient,
44
+ DETECTION_BLOCK_STATUS_FILTERS,
43
45
  DETECTION_CONFIDENCE_LEVELS,
44
46
  DETECTION_REPORTED_FILTERS,
45
47
  LIVENESS_FILTER_VALUES,
package/dist/cli.js CHANGED
@@ -203,6 +203,11 @@ var HELP = {
203
203
  "--reported <list> Comma list: reported|not_reported",
204
204
  "--country-code <list> Comma list of 2-letter ISO country codes (e.g. US,GB)",
205
205
  "--only-deleted Return only soft-deleted detections. Without this flag the endpoint returns both deleted and non-deleted (existing public-API behavior).",
206
+ "--exclude-deleted Leave soft-deleted detections out, so totals match the app. Cannot be combined with --only-deleted",
207
+ "--block-status <list> Comma list: blocked|pending. Both = every confirmed threat, including pending blocks for orgs without active protection",
208
+ "--min-score <n> Only detections with raw score >= n (0-1). Use instead of --confidence for a fixed cut-off",
209
+ "--max-score <n> Only detections with raw score <= n (0-1)",
210
+ "--include-total Also print how many detections match across all pages",
206
211
  "--from <iso> Start date (ISO 8601)",
207
212
  "--to <iso> End date (ISO 8601)"
208
213
  ],
@@ -210,7 +215,9 @@ var HELP = {
210
215
  "chainpatrol detections list --org acme --confidence medium,high",
211
216
  "chainpatrol detections list --org acme --source twitter --liveness ALIVE",
212
217
  "chainpatrol detections list --org acme --reported not_reported --watchlist ENABLED",
213
- "chainpatrol detections list --org acme --brand 12,34 --country-code US,GB"
218
+ "chainpatrol detections list --org acme --brand 12,34 --country-code US,GB",
219
+ "chainpatrol detections list --org acme --min-score 0.8 --include-total",
220
+ "chainpatrol detections list --org acme --block-status blocked,pending --include-total"
214
221
  ]
215
222
  },
216
223
  "detections healthcheck": {
@@ -513,7 +520,7 @@ var HELP = {
513
520
  ]
514
521
  },
515
522
  "threats list": {
516
- description: "List threats blocked by ChainPatrol. Org is derived from your API key. Defaults to the last 1 day. Use --from and --to to widen the window.",
523
+ description: "List threats blocked by ChainPatrol. Org is derived from your API key, so this needs CHAINPATROL_API_KEY (a login session is rejected). Defaults to the last 1 day. Use --from and --to to widen the window.",
517
524
  usage: "chainpatrol threats list [filters]",
518
525
  options: [
519
526
  "--query <text> Search threat content (substring)",
@@ -523,10 +530,12 @@ var HELP = {
523
530
  "--sort-by <key> Sort key (e.g. blockedAt)",
524
531
  "--sort-direction <dir> asc|desc",
525
532
  "--per-page <n> Page size 1-100 (default 10)",
526
- "--next-page <cursor> Cursor returned from a previous response"
533
+ "--next-page <cursor> Cursor returned from a previous response",
534
+ "--include-pending Also list threats confirmed while protection is not active (Pending Blocked)"
527
535
  ],
528
536
  examples: [
529
537
  "chainpatrol threats list --from 2026-05-01 --asset-type URL",
538
+ "chainpatrol threats list --from 2020-01-01 --include-pending",
530
539
  "CHAINPATROL_API_KEY=... chainpatrol threats list --json"
531
540
  ]
532
541
  },
@@ -580,11 +589,12 @@ var HELP = {
580
589
  },
581
590
  orgs: {
582
591
  description: "List organizations, their assets, and asset groups. Top-level `orgs list` lists organizations accessible to you; `orgs get <slug>` returns details for a single accessible org; the nested subcommands operate on the org tied to your API key.",
583
- usage: "chainpatrol orgs <list|get <slug>|assets list|asset-groups list>",
592
+ usage: "chainpatrol orgs <list|get <slug>|assets list|watchlist list|asset-groups list>",
584
593
  examples: [
585
594
  "chainpatrol orgs list",
586
595
  "chainpatrol orgs get acme",
587
596
  "chainpatrol orgs assets list --asset-type URL",
597
+ "chainpatrol orgs watchlist list --include-total",
588
598
  "chainpatrol orgs asset-groups list"
589
599
  ]
590
600
  },
@@ -610,6 +620,28 @@ var HELP = {
610
620
  "chainpatrol orgs assets list --group-id 12 --per-page 250 --output csv"
611
621
  ]
612
622
  },
623
+ "orgs watchlist": {
624
+ description: "List the assets ChainPatrol is watching for your organization.",
625
+ usage: "chainpatrol orgs watchlist list [filters]"
626
+ },
627
+ "orgs watchlist list": {
628
+ description: "List watchlisted assets: ones your organization reported that were not blocked (dead, parked, not enough evidence, ...) and are re-scanned so they can be blocked later. Same set the threatsWatchlisted metric counts. Pass --org <slug> or omit it to use the org tied to your API key.",
629
+ usage: "chainpatrol orgs watchlist list [filters]",
630
+ options: [
631
+ "--org <slug> Organization slug (omit for org-scoped API keys)",
632
+ "--asset-type <type> Filter by asset type (URL, TWITTER, ...)",
633
+ "--query <text> Search asset content (substring)",
634
+ "--from <iso> Only assets your org reported at or after this time",
635
+ "--to <iso> Only assets your org reported at or before this time",
636
+ "--include-total Also print the total number of watchlisted assets",
637
+ "--per-page <n> Page size 1-1000 (default 100; --limit also accepted)",
638
+ "--next-page <cursor> Cursor returned from a previous response"
639
+ ],
640
+ examples: [
641
+ "chainpatrol orgs watchlist list --include-total",
642
+ "chainpatrol orgs watchlist list --org acme --asset-type URL --output csv"
643
+ ]
644
+ },
613
645
  "orgs asset-groups": {
614
646
  description: "List asset groups in your organization.",
615
647
  usage: "chainpatrol orgs asset-groups list"
@@ -1075,6 +1107,12 @@ ${getTopLevelHelp()}
1075
1107
  reported: { type: "string" },
1076
1108
  countryCode: { type: "string" },
1077
1109
  onlyDeleted: { type: "boolean", default: false },
1110
+ excludeDeleted: { type: "boolean", default: false },
1111
+ blockStatus: { type: "string" },
1112
+ minScore: { type: "number" },
1113
+ maxScore: { type: "number" },
1114
+ includeTotal: { type: "boolean", default: false },
1115
+ includePending: { type: "boolean", default: false },
1078
1116
  assignee: { type: "string" },
1079
1117
  startedFrom: { type: "string" },
1080
1118
  startedTo: { type: "string" },
@@ -1222,12 +1260,12 @@ function parseAttachmentUrls() {
1222
1260
  }
1223
1261
  async function handleConfigsList(org) {
1224
1262
  if (jsonMode) {
1225
- const { listConfigsJson } = await import("./list-json-B4X74BTZ.js");
1263
+ const { listConfigsJson } = await import("./list-json-RZCY7FWL.js");
1226
1264
  await listConfigsJson({ org });
1227
1265
  return;
1228
1266
  }
1229
1267
  const { render } = await import("ink");
1230
- const { default: ConfigsList } = await import("./list-PV5GY2DY.js");
1268
+ const { default: ConfigsList } = await import("./list-S3TP5EEA.js");
1231
1269
  const { default: React } = await import("react");
1232
1270
  render(React.createElement(ConfigsList, { org }));
1233
1271
  }
@@ -1327,7 +1365,7 @@ async function main() {
1327
1365
  const positionals = cli.input.slice(2);
1328
1366
  const flagAssets = parseAssetInputs();
1329
1367
  const contents = [...positionals, ...flagAssets];
1330
- const { runAssetCheck } = await import("./check-2IFMTAIU.js");
1368
+ const { runAssetCheck } = await import("./check-OQISBUEC.js");
1331
1369
  await runAssetCheck({
1332
1370
  contents,
1333
1371
  json: jsonMode,
@@ -1337,7 +1375,7 @@ async function main() {
1337
1375
  break;
1338
1376
  }
1339
1377
  if (subcommand === "list") {
1340
- const { runAssetList } = await import("./list-GTN2HNGZ.js");
1378
+ const { runAssetList } = await import("./list-B227P3DE.js");
1341
1379
  await runAssetList({
1342
1380
  type: cli.flags.type ?? cli.flags.assetType,
1343
1381
  status: cli.flags.assetStatus ?? cli.flags.status,
@@ -1362,7 +1400,7 @@ async function main() {
1362
1400
  }
1363
1401
  return n;
1364
1402
  });
1365
- const { runAssetSearch } = await import("./search-DRTTZJJP.js");
1403
+ const { runAssetSearch } = await import("./search-GXPWTIPY.js");
1366
1404
  await runAssetSearch({
1367
1405
  contents: contents.length > 0 ? contents : void 0,
1368
1406
  ids: ids.length > 0 ? ids : void 0,
@@ -1387,7 +1425,7 @@ async function main() {
1387
1425
  case "detections": {
1388
1426
  const org = await resolveOrg();
1389
1427
  if (subcommand === "healthcheck") {
1390
- const { runDetectionsHealthcheck } = await import("./healthcheck-SYZQ2ILK.js");
1428
+ const { runDetectionsHealthcheck } = await import("./healthcheck-STFYE55C.js");
1391
1429
  await runDetectionsHealthcheck({
1392
1430
  org,
1393
1431
  source: cli.flags.source,
@@ -1402,7 +1440,7 @@ async function main() {
1402
1440
  break;
1403
1441
  }
1404
1442
  if (subcommand === "validate") {
1405
- const { runDetectionsValidate } = await import("./validate-FOZCI7HX.js");
1443
+ const { runDetectionsValidate } = await import("./validate-SUTLVGAV.js");
1406
1444
  await runDetectionsValidate({
1407
1445
  org,
1408
1446
  source: cli.flags.source,
@@ -1417,7 +1455,7 @@ async function main() {
1417
1455
  break;
1418
1456
  }
1419
1457
  if (subcommand === "drift") {
1420
- const { runDetectionsDrift } = await import("./drift-DPYW7LYN.js");
1458
+ const { runDetectionsDrift } = await import("./drift-FRZEQXYK.js");
1421
1459
  await runDetectionsDrift({
1422
1460
  org,
1423
1461
  source: cli.flags.source,
@@ -1431,7 +1469,7 @@ async function main() {
1431
1469
  break;
1432
1470
  }
1433
1471
  if (subcommand === "run") {
1434
- const { runDetectionsRun } = await import("./run-FDZWPY4W.js");
1472
+ const { runDetectionsRun } = await import("./run-QTRTOOHA.js");
1435
1473
  await runDetectionsRun({
1436
1474
  org,
1437
1475
  configId: cli.flags.configId,
@@ -1445,7 +1483,7 @@ async function main() {
1445
1483
  break;
1446
1484
  }
1447
1485
  if (subcommand === "list") {
1448
- const { runDetectionsList } = await import("./list-H4RCDI6Q.js");
1486
+ const { runDetectionsList } = await import("./list-YAEK7G6Q.js");
1449
1487
  await runDetectionsList({
1450
1488
  org,
1451
1489
  cursor: cli.flags.cursor,
@@ -1463,6 +1501,11 @@ async function main() {
1463
1501
  reported: parseCsvList(cli.flags.reported),
1464
1502
  countryCodes: parseCsvList(cli.flags.countryCode),
1465
1503
  onlyDeleted: cli.flags.onlyDeleted,
1504
+ excludeDeleted: cli.flags.excludeDeleted,
1505
+ blockStatus: parseCsvList(cli.flags.blockStatus),
1506
+ minScore: cli.flags.minScore,
1507
+ maxScore: cli.flags.maxScore,
1508
+ includeTotal: cli.flags.includeTotal,
1466
1509
  json: jsonMode,
1467
1510
  outputFormat: cliContext.outputFormat
1468
1511
  });
@@ -1474,7 +1517,7 @@ async function main() {
1474
1517
  break;
1475
1518
  }
1476
1519
  if (action === "run") {
1477
- const { runDetectionsRun } = await import("./run-FDZWPY4W.js");
1520
+ const { runDetectionsRun } = await import("./run-QTRTOOHA.js");
1478
1521
  await runDetectionsRun({
1479
1522
  org,
1480
1523
  configId: cli.flags.configId,
@@ -1492,7 +1535,7 @@ async function main() {
1492
1535
  throw new Error("detections configs update requires --config-id");
1493
1536
  }
1494
1537
  const configPatch = getConfigPatchFromSetFlags();
1495
- const { runDetectionsConfigsUpdate } = await import("./configs-update-XUN4X4T2.js");
1538
+ const { runDetectionsConfigsUpdate } = await import("./configs-update-5Y47BRAV.js");
1496
1539
  await runDetectionsConfigsUpdate({
1497
1540
  org,
1498
1541
  configId: cli.flags.configId,
@@ -1528,7 +1571,7 @@ async function main() {
1528
1571
  const slugs = parseCsvList(cli.flags.slugs);
1529
1572
  const allMyOrgs = cli.flags.allMyOrgs;
1530
1573
  const org2 = slugs && slugs.length > 0 || allMyOrgs ? void 0 : await tryResolveOrg();
1531
- const { runMetricsOrganization } = await import("./organization-KANXTARX.js");
1574
+ const { runMetricsOrganization } = await import("./organization-33CRAMP2.js");
1532
1575
  await runMetricsOrganization({
1533
1576
  org: org2,
1534
1577
  slugs,
@@ -1547,7 +1590,7 @@ async function main() {
1547
1590
  }
1548
1591
  const org = await resolveOrg();
1549
1592
  if (subcommand === "summary") {
1550
- const { runMetricsSummary } = await import("./summary-A24TNQNR.js");
1593
+ const { runMetricsSummary } = await import("./summary-Y5JITMCT.js");
1551
1594
  await runMetricsSummary({
1552
1595
  org,
1553
1596
  from: cli.flags.from,
@@ -1560,7 +1603,7 @@ async function main() {
1560
1603
  break;
1561
1604
  }
1562
1605
  if (subcommand === "found") {
1563
- const { runMetricsFound } = await import("./found-YLTMVPBZ.js");
1606
+ const { runMetricsFound } = await import("./found-WZFO7ZP5.js");
1564
1607
  await runMetricsFound({
1565
1608
  org,
1566
1609
  from: cli.flags.from,
@@ -1573,7 +1616,7 @@ async function main() {
1573
1616
  break;
1574
1617
  }
1575
1618
  if (subcommand === "takedown-time" || subcommand === "takedownTime") {
1576
- const { runMetricsTakedownTime } = await import("./takedown-time-HB3J2FTZ.js");
1619
+ const { runMetricsTakedownTime } = await import("./takedown-time-C7FIZTOO.js");
1577
1620
  await runMetricsTakedownTime({
1578
1621
  org,
1579
1622
  from: cli.flags.from,
@@ -1586,7 +1629,7 @@ async function main() {
1586
1629
  break;
1587
1630
  }
1588
1631
  if (subcommand === "time-to-detection" || subcommand === "timeToDetection") {
1589
- const { runMetricsTimeToDetection } = await import("./time-to-detection-5L7ECKYU.js");
1632
+ const { runMetricsTimeToDetection } = await import("./time-to-detection-VO7BCUCK.js");
1590
1633
  await runMetricsTimeToDetection({
1591
1634
  org,
1592
1635
  from: cli.flags.from,
@@ -1599,7 +1642,7 @@ async function main() {
1599
1642
  break;
1600
1643
  }
1601
1644
  if (subcommand === "takedown-time-trend" || subcommand === "takedownTimeTrend") {
1602
- const { runMetricsTakedownTimeTrend } = await import("./takedown-time-trend-KYPA3W3U.js");
1645
+ const { runMetricsTakedownTimeTrend } = await import("./takedown-time-trend-SAMO7JAZ.js");
1603
1646
  await runMetricsTakedownTimeTrend({
1604
1647
  org,
1605
1648
  months: cli.flags.months,
@@ -1615,7 +1658,7 @@ async function main() {
1615
1658
  if (!by || !["day", "type", "brand"].includes(by)) {
1616
1659
  throw new Error("metrics breakdown requires --by <day|type|brand>");
1617
1660
  }
1618
- const { runMetricsBreakdown } = await import("./breakdown-BLCYJP7O.js");
1661
+ const { runMetricsBreakdown } = await import("./breakdown-5GXBOZBZ.js");
1619
1662
  await runMetricsBreakdown({
1620
1663
  org,
1621
1664
  by,
@@ -1644,7 +1687,7 @@ async function main() {
1644
1687
  case "reports": {
1645
1688
  if (subcommand === "list") {
1646
1689
  const org = await resolveOrg();
1647
- const { runReportsList } = await import("./list-2H2CV3JJ.js");
1690
+ const { runReportsList } = await import("./list-MHONLKMX.js");
1648
1691
  await runReportsList({
1649
1692
  org,
1650
1693
  limit: cli.flags.limit,
@@ -1675,7 +1718,7 @@ async function main() {
1675
1718
  }
1676
1719
  if (subcommand === "create") {
1677
1720
  const org = await tryResolveOrg();
1678
- const { runReportsCreate } = await import("./create-ILSWAUVI.js");
1721
+ const { runReportsCreate } = await import("./create-G4XGWIVM.js");
1679
1722
  await runReportsCreate({
1680
1723
  org,
1681
1724
  title: cli.flags.title,
@@ -1697,7 +1740,7 @@ async function main() {
1697
1740
  const positionals = cli.input.slice(2);
1698
1741
  const flagAssets = parseAssetInputs();
1699
1742
  const assetContents = [...positionals, ...flagAssets];
1700
- const { runReportsSearch } = await import("./search-A75YUJFI.js");
1743
+ const { runReportsSearch } = await import("./search-5EJCY3VV.js");
1701
1744
  await runReportsSearch({
1702
1745
  assetContents,
1703
1746
  org,
@@ -1717,7 +1760,7 @@ async function main() {
1717
1760
  if (subcommand === "review") {
1718
1761
  const org = await tryResolveOrg();
1719
1762
  const positionalProposalId = cli.input[2];
1720
- const { runProposalsReview } = await import("./review-5J3EQRCB.js");
1763
+ const { runProposalsReview } = await import("./review-YT6TH6TS.js");
1721
1764
  await runProposalsReview({
1722
1765
  org,
1723
1766
  proposalId: cli.flags.proposalId ?? (positionalProposalId ? Number(positionalProposalId) : void 0),
@@ -1744,7 +1787,7 @@ async function main() {
1744
1787
  }
1745
1788
  case "threats": {
1746
1789
  if (subcommand === "list") {
1747
- const { runThreatsList } = await import("./list-RUIQIVEA.js");
1790
+ const { runThreatsList } = await import("./list-SO34HIJK.js");
1748
1791
  await runThreatsList({
1749
1792
  query: cli.flags.query,
1750
1793
  from: cli.flags.from,
@@ -1754,6 +1797,7 @@ async function main() {
1754
1797
  sortDirection: cli.flags.sortDirection,
1755
1798
  perPage: cli.flags.perPage ?? cli.flags.limit,
1756
1799
  nextPage: cli.flags.nextPage,
1800
+ includePending: cli.flags.includePending,
1757
1801
  json: jsonMode,
1758
1802
  outputFormat: cliContext.outputFormat
1759
1803
  });
@@ -1767,7 +1811,7 @@ async function main() {
1767
1811
  case "takedowns": {
1768
1812
  if (subcommand === "list") {
1769
1813
  const org = await tryResolveOrg();
1770
- const { runTakedownsList } = await import("./list-LWB5JQAY.js");
1814
+ const { runTakedownsList } = await import("./list-KNBID2DJ.js");
1771
1815
  await runTakedownsList({
1772
1816
  org,
1773
1817
  query: cli.flags.query,
@@ -1798,7 +1842,7 @@ async function main() {
1798
1842
  }
1799
1843
  case "queues": {
1800
1844
  if (subcommand === "snapshot") {
1801
- const { runQueuesSnapshot } = await import("./snapshot-2IT4KG4F.js");
1845
+ const { runQueuesSnapshot } = await import("./snapshot-SCLXRXLX.js");
1802
1846
  await runQueuesSnapshot({
1803
1847
  org: cli.flags.org,
1804
1848
  all: cli.flags.all,
@@ -1816,7 +1860,7 @@ async function main() {
1816
1860
  }
1817
1861
  case "orgs": {
1818
1862
  if (subcommand === "list") {
1819
- const { runOrgsList } = await import("./list-4THJBDSU.js");
1863
+ const { runOrgsList } = await import("./list-6HRKMH4L.js");
1820
1864
  await runOrgsList({
1821
1865
  query: cli.flags.query,
1822
1866
  subscriptionStatus: cli.flags.subscriptionStatus,
@@ -1838,7 +1882,7 @@ async function main() {
1838
1882
  if (subcommand === "get") {
1839
1883
  const positionalSlug = action;
1840
1884
  const slug = positionalSlug ?? await tryResolveOrg();
1841
- const { runOrgsGet } = await import("./get-OFLQ5BXP.js");
1885
+ const { runOrgsGet } = await import("./get-7WRWHCX2.js");
1842
1886
  await runOrgsGet({
1843
1887
  slug,
1844
1888
  json: jsonMode,
@@ -1848,7 +1892,7 @@ async function main() {
1848
1892
  }
1849
1893
  if (subcommand === "assets") {
1850
1894
  if (action === "list") {
1851
- const { runOrgsAssetsList } = await import("./list-VHDU3XMN.js");
1895
+ const { runOrgsAssetsList } = await import("./list-7I4ANMXJ.js");
1852
1896
  await runOrgsAssetsList({
1853
1897
  // Optional: organization-scoped API keys resolve the org from the
1854
1898
  // key, so only pass a slug when one is actually available.
@@ -1865,9 +1909,28 @@ async function main() {
1865
1909
  }
1866
1910
  throw new Error("Usage: chainpatrol orgs assets list [filters]");
1867
1911
  }
1912
+ if (subcommand === "watchlist") {
1913
+ if (action === "list") {
1914
+ const { runOrgsWatchlistList } = await import("./list-PTXXL5IW.js");
1915
+ await runOrgsWatchlistList({
1916
+ slug: await tryResolveOrg(),
1917
+ assetType: cli.flags.assetType ?? cli.flags.type,
1918
+ query: cli.flags.query ?? cli.flags.search,
1919
+ from: cli.flags.from,
1920
+ to: cli.flags.to,
1921
+ includeTotal: cli.flags.includeTotal,
1922
+ perPage: cli.flags.perPage ?? cli.flags.limit,
1923
+ nextPage: cli.flags.nextPage,
1924
+ json: jsonMode,
1925
+ outputFormat: cliContext.outputFormat
1926
+ });
1927
+ break;
1928
+ }
1929
+ throw new Error("Usage: chainpatrol orgs watchlist list [filters]");
1930
+ }
1868
1931
  if (subcommand === "asset-groups") {
1869
1932
  if (action === "list") {
1870
- const { runOrgsAssetGroupsList } = await import("./list-WYC4ZP7X.js");
1933
+ const { runOrgsAssetGroupsList } = await import("./list-2KCPCEPO.js");
1871
1934
  await runOrgsAssetGroupsList({
1872
1935
  json: jsonMode,
1873
1936
  outputFormat: cliContext.outputFormat
@@ -1876,9 +1939,9 @@ async function main() {
1876
1939
  }
1877
1940
  throw new Error("Usage: chainpatrol orgs asset-groups list");
1878
1941
  }
1879
- const hint = subcommand ? suggest(subcommand, ["list", "get", "assets", "asset-groups"]) : null;
1942
+ const hint = subcommand ? suggest(subcommand, ["list", "get", "assets", "watchlist", "asset-groups"]) : null;
1880
1943
  throw new Error(
1881
- subcommand ? `Unknown subcommand: orgs ${subcommand}${hint ? `. Did you mean "orgs ${hint}"?` : ""}` : "Usage: chainpatrol orgs <list|get <slug>|assets list|asset-groups list> [filters]"
1944
+ subcommand ? `Unknown subcommand: orgs ${subcommand}${hint ? `. Did you mean "orgs ${hint}"?` : ""}` : "Usage: chainpatrol orgs <list|get <slug>|assets list|watchlist list|asset-groups list> [filters]"
1882
1945
  );
1883
1946
  }
1884
1947
  case "brands": {
@@ -1889,8 +1952,9 @@ async function main() {
1889
1952
  "brands list --type must be ORGANIZATION, INDIVIDUAL, or PRODUCT (case-insensitive)."
1890
1953
  );
1891
1954
  }
1892
- const { runBrandsList } = await import("./list-3HCKDPIK.js");
1955
+ const { runBrandsList } = await import("./list-UVTOWO3R.js");
1893
1956
  await runBrandsList({
1957
+ slug: await tryResolveOrg(),
1894
1958
  type: rawType,
1895
1959
  json: jsonMode,
1896
1960
  outputFormat: cliContext.outputFormat
@@ -1899,7 +1963,7 @@ async function main() {
1899
1963
  }
1900
1964
  const hint = subcommand ? suggest(subcommand, ["list"]) : null;
1901
1965
  throw new Error(
1902
- subcommand ? `Unknown subcommand: brands ${subcommand}${hint ? `. Did you mean "brands ${hint}"?` : ""}` : "Usage: chainpatrol brands list [--type ORGANIZATION|INDIVIDUAL|PRODUCT]"
1966
+ subcommand ? `Unknown subcommand: brands ${subcommand}${hint ? `. Did you mean "brands ${hint}"?` : ""}` : "Usage: chainpatrol brands list [--org <slug>] [--type ORGANIZATION|INDIVIDUAL|PRODUCT]"
1903
1967
  );
1904
1968
  }
1905
1969
  case "mcp": {
@@ -1910,7 +1974,7 @@ async function main() {
1910
1974
  break;
1911
1975
  }
1912
1976
  case "whoami": {
1913
- const { runWhoami } = await import("./whoami-DSXNLG3B.js");
1977
+ const { runWhoami } = await import("./whoami-KVIYPM23.js");
1914
1978
  await runWhoami({
1915
1979
  json: jsonMode,
1916
1980
  outputFormat: cliContext.outputFormat
@@ -1919,7 +1983,7 @@ async function main() {
1919
1983
  }
1920
1984
  case "healthchecks": {
1921
1985
  if (subcommand === "list") {
1922
- const { runHealthchecksList } = await import("./list-Q5K4RMM4.js");
1986
+ const { runHealthchecksList } = await import("./list-RWFAVAAI.js");
1923
1987
  await runHealthchecksList({
1924
1988
  json: jsonMode,
1925
1989
  outputFormat: cliContext.outputFormat
@@ -1933,7 +1997,7 @@ async function main() {
1933
1997
  thresholds.minResults = cli.flags.minResults;
1934
1998
  if (cli.flags.lookbackHours !== void 0)
1935
1999
  thresholds.lookbackHours = cli.flags.lookbackHours;
1936
- const { runHealthchecksRun } = await import("./run-JBQ43OW6.js");
2000
+ const { runHealthchecksRun } = await import("./run-YQERI2GH.js");
1937
2001
  await runHealthchecksRun({
1938
2002
  org,
1939
2003
  id: action,
@@ -1951,7 +2015,7 @@ async function main() {
1951
2015
  }
1952
2016
  case "presets": {
1953
2017
  if (subcommand === "list") {
1954
- const { runPresetsList } = await import("./list-FUQK3TIN.js");
2018
+ const { runPresetsList } = await import("./list-GHM6Z5KK.js");
1955
2019
  await runPresetsList({ outputFormat: cliContext.outputFormat });
1956
2020
  break;
1957
2021
  }
@@ -1962,7 +2026,7 @@ async function main() {
1962
2026
  );
1963
2027
  }
1964
2028
  const org = await resolveOrg();
1965
- const { runPresetsRun } = await import("./run-XWM67MBV.js");
2029
+ const { runPresetsRun } = await import("./run-TZOVF7YE.js");
1966
2030
  await runPresetsRun({
1967
2031
  presetId: action,
1968
2032
  org,
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VFT3TD3E.js";
8
8
  import {
9
9
  createApiClient
10
- } from "./chunk-NSRQ62C4.js";
10
+ } from "./chunk-LM7R7JUX.js";
11
11
  import "./chunk-4QZ7KD2Y.js";
12
12
  import "./chunk-ORAY4KMA.js";
13
13
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VFT3TD3E.js";
8
8
  import {
9
9
  createApiClient
10
- } from "./chunk-NSRQ62C4.js";
10
+ } from "./chunk-LM7R7JUX.js";
11
11
  import "./chunk-4QZ7KD2Y.js";
12
12
  import "./chunk-TFCNKBRC.js";
13
13
  import "./chunk-ORAY4KMA.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VFT3TD3E.js";
5
5
  import {
6
6
  createApiClient
7
- } from "./chunk-NSRQ62C4.js";
7
+ } from "./chunk-LM7R7JUX.js";
8
8
  import "./chunk-4QZ7KD2Y.js";
9
9
  import "./chunk-ORAY4KMA.js";
10
10
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  PRESETS
3
- } from "./chunk-CABRZEYB.js";
3
+ } from "./chunk-EZGE4YJG.js";
4
4
  import "./chunk-E2LAMILJ.js";
5
5
  import {
6
6
  printOutput,
7
7
  toCsvRows
8
8
  } from "./chunk-VFT3TD3E.js";
9
- import "./chunk-NSRQ62C4.js";
9
+ import "./chunk-LM7R7JUX.js";
10
10
  import "./chunk-4QZ7KD2Y.js";
11
11
  import "./chunk-TFCNKBRC.js";
12
12
  import "./chunk-ORAY4KMA.js";
@@ -11,7 +11,7 @@ import {
11
11
  TAKEDOWN_SORT_KEYS,
12
12
  TAKEDOWN_STATUSES,
13
13
  createApiClient
14
- } from "./chunk-NSRQ62C4.js";
14
+ } from "./chunk-LM7R7JUX.js";
15
15
  import "./chunk-4QZ7KD2Y.js";
16
16
  import "./chunk-ORAY4KMA.js";
17
17
  import "./chunk-K4RAUZSD.js";
@@ -10,7 +10,7 @@ import {
10
10
  REPORT_REVIEW_DECISIONS,
11
11
  REPORT_STATUSES,
12
12
  createApiClient
13
- } from "./chunk-NSRQ62C4.js";
13
+ } from "./chunk-LM7R7JUX.js";
14
14
  import "./chunk-4QZ7KD2Y.js";
15
15
  import "./chunk-ORAY4KMA.js";
16
16
  import "./chunk-K4RAUZSD.js";
@@ -0,0 +1,87 @@
1
+ import {
2
+ CliExitError,
3
+ ExitCode
4
+ } from "./chunk-E2LAMILJ.js";
5
+ import {
6
+ printOutput,
7
+ toCsvRows
8
+ } from "./chunk-VFT3TD3E.js";
9
+ import {
10
+ createApiClient
11
+ } from "./chunk-LM7R7JUX.js";
12
+ import "./chunk-4QZ7KD2Y.js";
13
+ import "./chunk-ORAY4KMA.js";
14
+ import "./chunk-K4RAUZSD.js";
15
+
16
+ // src/commands/orgs/watchlist/list.ts
17
+ function toRow(item) {
18
+ return {
19
+ id: item.id,
20
+ content: item.content,
21
+ type: item.type,
22
+ status: item.status,
23
+ pendingStatus: item.pendingStatus ?? "",
24
+ livenessStatus: item.livenessStatus,
25
+ reason: item.reason ?? "",
26
+ watchlistedAt: item.watchlistedAt ?? "",
27
+ firstReportedAt: item.firstReportedAt,
28
+ lastScanAt: item.lastScanAt ?? ""
29
+ };
30
+ }
31
+ async function runOrgsWatchlistList(options) {
32
+ const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
33
+ const perPage = options.perPage;
34
+ if (perPage !== void 0 && (perPage < 1 || perPage > 1e3)) {
35
+ throw new CliExitError(
36
+ "orgs watchlist list requires --per-page between 1 and 1000.",
37
+ ExitCode.USAGE
38
+ );
39
+ }
40
+ const client = options.apiClient ?? createApiClient();
41
+ const input = {
42
+ slug: options.slug,
43
+ assetType: options.assetType ? options.assetType.toUpperCase() : void 0,
44
+ query: options.query,
45
+ reportedSince: options.from,
46
+ reportedUntil: options.to,
47
+ includeTotal: options.includeTotal || void 0,
48
+ perPage,
49
+ nextPage: options.nextPage
50
+ };
51
+ const result = await client.listOrganizationWatchlist(input);
52
+ const rows = result.watchlist.map(toRow);
53
+ const describe = (row) => `#${row.id} ${row.content} (${row.type}) ${row.livenessStatus} reason=${row.reason || "-"} watchlisted=${row.watchlistedAt || "-"} lastScan=${row.lastScanAt || "-"}`;
54
+ printOutput({
55
+ outputFormat,
56
+ json: result,
57
+ markdown: [
58
+ "# Organization watchlist",
59
+ "",
60
+ `- Returned: ${result.watchlist.length}`,
61
+ ...result.total !== void 0 ? [`- Total watchlisted: ${result.total}`] : [],
62
+ `- Next page cursor: ${result.next_page ?? "none"}`,
63
+ "",
64
+ ...rows.map((row) => `- ${describe(row)}`)
65
+ ].join("\n"),
66
+ csv: toCsvRows(rows),
67
+ human: () => {
68
+ if (result.total !== void 0) {
69
+ console.log(`Total watchlisted: ${result.total}`);
70
+ }
71
+ if (result.watchlist.length === 0) {
72
+ console.log("No watchlisted assets found.");
73
+ return;
74
+ }
75
+ console.log(`Organization watchlist \u2014 returned ${result.watchlist.length}`);
76
+ for (const row of rows) {
77
+ console.log(describe(row));
78
+ }
79
+ if (result.next_page) {
80
+ console.log(`Next page cursor: ${result.next_page}`);
81
+ }
82
+ }
83
+ });
84
+ }
85
+ export {
86
+ runOrgsWatchlistList
87
+ };
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VFT3TD3E.js";
5
5
  import {
6
6
  createApiClient
7
- } from "./chunk-NSRQ62C4.js";
7
+ } from "./chunk-LM7R7JUX.js";
8
8
  import "./chunk-4QZ7KD2Y.js";
9
9
  import "./chunk-ORAY4KMA.js";
10
10
  import "./chunk-K4RAUZSD.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-JCMWDZYY.js";
5
5
  import {
6
6
  createApiClient
7
- } from "./chunk-NSRQ62C4.js";
7
+ } from "./chunk-LM7R7JUX.js";
8
8
  import "./chunk-4QZ7KD2Y.js";
9
9
  import {
10
10
  AuthCorruptedError,
@@ -8,20 +8,25 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
15
15
 
16
16
  // src/commands/threats/list.ts
17
+ var API_KEY_REQUIRED_MESSAGE = "Valid API key required";
17
18
  function toRow(threat) {
18
19
  return {
19
20
  id: threat.id,
20
21
  content: threat.content,
21
22
  type: threat.type,
22
- blockedAt: threat.blockedAt
23
+ blockedAt: threat.blockedAt,
24
+ pendingStatus: threat.pendingStatus ?? ""
23
25
  };
24
26
  }
27
+ function pendingSuffix(row) {
28
+ return row.pendingStatus === "BLOCKED" ? " (pending: protection not active)" : "";
29
+ }
25
30
  async function runThreatsList(options) {
26
31
  const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
27
32
  const perPage = options.perPage;
@@ -51,9 +56,21 @@ async function runThreatsList(options) {
51
56
  }
52
57
  ] : void 0,
53
58
  perPage,
54
- nextPage: options.nextPage
59
+ nextPage: options.nextPage,
60
+ includePending: options.includePending || void 0
55
61
  };
56
- const result = await client.listThreats(input);
62
+ let result;
63
+ try {
64
+ result = await client.listThreats(input);
65
+ } catch (err) {
66
+ if (err instanceof Error && err.message === API_KEY_REQUIRED_MESSAGE) {
67
+ throw new CliExitError(
68
+ "threats list needs an organization API key: set CHAINPATROL_API_KEY. With a login session, count confirmed threats with `chainpatrol detections list --org <slug> --block-status blocked,pending --include-total`.",
69
+ ExitCode.AUTH
70
+ );
71
+ }
72
+ throw err;
73
+ }
57
74
  const rows = result.threats.map(toRow);
58
75
  printOutput({
59
76
  outputFormat,
@@ -65,7 +82,7 @@ async function runThreatsList(options) {
65
82
  `- Next page cursor: ${result.next_page ?? "none"}`,
66
83
  "",
67
84
  ...rows.map(
68
- (row) => `- #${row.id} (${row.type}) ${row.content} \u2014 blocked=${row.blockedAt}`
85
+ (row) => `- #${row.id} (${row.type}) ${row.content} \u2014 blocked=${row.blockedAt}${pendingSuffix(row)}`
69
86
  )
70
87
  ].join("\n"),
71
88
  csv: toCsvRows(rows),
@@ -76,7 +93,9 @@ async function runThreatsList(options) {
76
93
  }
77
94
  console.log(`Threats \u2014 returned ${result.threats.length}`);
78
95
  for (const row of rows) {
79
- console.log(`#${row.id} (${row.type}) ${row.content} \u2014 blocked=${row.blockedAt}`);
96
+ console.log(
97
+ `#${row.id} (${row.type}) ${row.content} \u2014 blocked=${row.blockedAt}${pendingSuffix(row)}`
98
+ );
80
99
  }
81
100
  if (result.next_page) {
82
101
  console.log(`Next page cursor: ${result.next_page}`);
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VFT3TD3E.js";
5
5
  import {
6
6
  createApiClient
7
- } from "./chunk-NSRQ62C4.js";
7
+ } from "./chunk-LM7R7JUX.js";
8
8
  import "./chunk-4QZ7KD2Y.js";
9
9
  import "./chunk-ORAY4KMA.js";
10
10
  import "./chunk-K4RAUZSD.js";
@@ -47,7 +47,7 @@ function toRow(brand) {
47
47
  async function runBrandsList(options) {
48
48
  const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
49
49
  const client = options.apiClient ?? createApiClient();
50
- const result = await client.listOrganizationBrands();
50
+ const result = await client.listOrganizationBrands({ slug: options.slug });
51
51
  const brands = options.type ? result.brands.filter((brand) => brand.type === options.type) : result.brands;
52
52
  const rows = brands.map(toRow);
53
53
  printOutput({
@@ -7,12 +7,13 @@ import {
7
7
  toCsvRows
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
+ DETECTION_BLOCK_STATUS_FILTERS,
10
11
  DETECTION_CONFIDENCE_LEVELS,
11
12
  DETECTION_REPORTED_FILTERS,
12
13
  LIVENESS_FILTER_VALUES,
13
14
  WATCHLIST_FILTER_VALUES,
14
15
  createApiClient
15
- } from "./chunk-NSRQ62C4.js";
16
+ } from "./chunk-LM7R7JUX.js";
16
17
  import "./chunk-4QZ7KD2Y.js";
17
18
  import "./chunk-ORAY4KMA.js";
18
19
  import "./chunk-K4RAUZSD.js";
@@ -22,6 +23,17 @@ var CONFIDENCE_SET = new Set(DETECTION_CONFIDENCE_LEVELS);
22
23
  var REPORTED_SET = new Set(DETECTION_REPORTED_FILTERS);
23
24
  var LIVENESS_SET = new Set(LIVENESS_FILTER_VALUES);
24
25
  var WATCHLIST_SET = new Set(WATCHLIST_FILTER_VALUES);
26
+ var BLOCK_STATUS_SET = new Set(DETECTION_BLOCK_STATUS_FILTERS);
27
+ function validateScore(value, flagName) {
28
+ if (value === void 0) return void 0;
29
+ if (!Number.isFinite(value) || value < 0 || value > 1) {
30
+ throw new CliExitError(
31
+ `--${flagName} must be a raw score between 0 and 1 (e.g. 0.8), got ${value}.`,
32
+ ExitCode.USAGE
33
+ );
34
+ }
35
+ return value;
36
+ }
25
37
  function validateEnumList(values, validSet, flagName, transform = (v) => v) {
26
38
  if (!values || values.length === 0) return void 0;
27
39
  const normalized = values.map(transform);
@@ -41,14 +53,19 @@ function toRow(detection) {
41
53
  id: detection.id,
42
54
  source: detection.source,
43
55
  confidence: detection.confidence,
56
+ score: detection.score,
44
57
  reportStatus: detection.reportStatus,
45
58
  threatContent: detection.threatContent,
46
59
  assetContent: detection.asset.content,
47
60
  assetType: detection.asset.type,
48
61
  assetStatus: detection.asset.status,
62
+ assetPendingStatus: detection.asset.pendingStatus ?? "",
49
63
  createdAt: detection.createdAt
50
64
  };
51
65
  }
66
+ function displayStatus(row) {
67
+ return row.assetPendingStatus === "BLOCKED" ? "PENDING_BLOCKED" : row.assetStatus;
68
+ }
52
69
  async function runDetectionsList(options) {
53
70
  const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
54
71
  const limit = options.limit;
@@ -82,6 +99,26 @@ async function runDetectionsList(options) {
82
99
  "watchlist",
83
100
  (v) => v.toUpperCase()
84
101
  );
102
+ const blockStatus = validateEnumList(
103
+ options.blockStatus,
104
+ BLOCK_STATUS_SET,
105
+ "block-status",
106
+ (v) => v.toLowerCase()
107
+ );
108
+ const minScore = validateScore(options.minScore, "min-score");
109
+ const maxScore = validateScore(options.maxScore, "max-score");
110
+ if (minScore !== void 0 && maxScore !== void 0 && minScore > maxScore) {
111
+ throw new CliExitError(
112
+ "--min-score must not be greater than --max-score.",
113
+ ExitCode.USAGE
114
+ );
115
+ }
116
+ if (options.onlyDeleted && options.excludeDeleted) {
117
+ throw new CliExitError(
118
+ "--only-deleted and --exclude-deleted cannot be used together.",
119
+ ExitCode.USAGE
120
+ );
121
+ }
85
122
  const countryCodes = options.countryCodes?.length ? options.countryCodes.map((code) => code.toUpperCase()) : void 0;
86
123
  if (countryCodes?.some((code) => code.length !== 2)) {
87
124
  throw new CliExitError(
@@ -106,7 +143,12 @@ async function runDetectionsList(options) {
106
143
  watchlist,
107
144
  reported,
108
145
  countryCodes,
109
- onlyDeleted: options.onlyDeleted
146
+ onlyDeleted: options.onlyDeleted,
147
+ excludeDeleted: options.excludeDeleted || void 0,
148
+ blockStatus,
149
+ minScore,
150
+ maxScore,
151
+ includeTotal: options.includeTotal || void 0
110
152
  };
111
153
  const result = await client.listDetections(input);
112
154
  const rows = result.detections.map(toRow);
@@ -117,14 +159,18 @@ async function runDetectionsList(options) {
117
159
  `# Detections (${options.org})`,
118
160
  "",
119
161
  `- Returned: ${result.detections.length}`,
162
+ ...result.total !== void 0 ? [`- Total matching: ${result.total}`] : [],
120
163
  `- Next cursor: ${result.nextCursor ?? "none"}`,
121
164
  "",
122
165
  ...rows.map(
123
- (row) => `- #${row.id} [${row.confidence}] ${row.source} \u2192 ${row.assetContent} (${row.assetType}) ${row.assetStatus} reported=${row.reportStatus} created=${row.createdAt}`
166
+ (row) => `- #${row.id} [${row.confidence} ${row.score}] ${row.source} \u2192 ${row.assetContent} (${row.assetType}) ${displayStatus(row)} reported=${row.reportStatus} created=${row.createdAt}`
124
167
  )
125
168
  ].join("\n"),
126
169
  csv: toCsvRows(rows),
127
170
  human: () => {
171
+ if (result.total !== void 0) {
172
+ console.log(`Total matching: ${result.total}`);
173
+ }
128
174
  if (result.detections.length === 0) {
129
175
  console.log("No detections found.");
130
176
  return;
@@ -132,7 +178,7 @@ async function runDetectionsList(options) {
132
178
  console.log(`Detections for ${options.org} \u2014 returned ${result.detections.length}`);
133
179
  for (const row of rows) {
134
180
  console.log(
135
- `#${row.id} [${row.confidence}] ${row.source} \u2192 ${row.assetContent} (${row.assetType}/${row.assetStatus}) ${row.reportStatus} ${row.createdAt}`
181
+ `#${row.id} [${row.confidence} ${row.score}] ${row.source} \u2192 ${row.assetContent} (${row.assetType}/${displayStatus(row)}) ${row.reportStatus} ${row.createdAt}`
136
182
  );
137
183
  }
138
184
  if (result.nextCursor !== void 0) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-NSRQ62C4.js";
3
+ } from "./chunk-LM7R7JUX.js";
4
4
  import "./chunk-4QZ7KD2Y.js";
5
5
  import "./chunk-ORAY4KMA.js";
6
6
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  ORGANIZATION_METRICS_INCLUDE_FIELDS,
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-TFCNKBRC.js";
14
14
  import "./chunk-ORAY4KMA.js";
@@ -10,7 +10,7 @@ import {
10
10
  PROPOSAL_REJECT_REASONS,
11
11
  PROPOSAL_WATCHLIST_REASONS,
12
12
  createApiClient
13
- } from "./chunk-NSRQ62C4.js";
13
+ } from "./chunk-LM7R7JUX.js";
14
14
  import "./chunk-4QZ7KD2Y.js";
15
15
  import "./chunk-ORAY4KMA.js";
16
16
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  getPresetDefinition,
3
3
  runPreset
4
- } from "./chunk-CABRZEYB.js";
4
+ } from "./chunk-EZGE4YJG.js";
5
5
  import {
6
6
  CliExitError,
7
7
  ExitCode
8
8
  } from "./chunk-E2LAMILJ.js";
9
9
  import "./chunk-VFT3TD3E.js";
10
- import "./chunk-NSRQ62C4.js";
10
+ import "./chunk-LM7R7JUX.js";
11
11
  import "./chunk-4QZ7KD2Y.js";
12
12
  import "./chunk-TFCNKBRC.js";
13
13
  import "./chunk-ORAY4KMA.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VFT3TD3E.js";
8
8
  import {
9
9
  createApiClient
10
- } from "./chunk-NSRQ62C4.js";
10
+ } from "./chunk-LM7R7JUX.js";
11
11
  import "./chunk-4QZ7KD2Y.js";
12
12
  import "./chunk-TFCNKBRC.js";
13
13
  import "./chunk-ORAY4KMA.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VFT3TD3E.js";
8
8
  import {
9
9
  createApiClient
10
- } from "./chunk-NSRQ62C4.js";
10
+ } from "./chunk-LM7R7JUX.js";
11
11
  import "./chunk-4QZ7KD2Y.js";
12
12
  import "./chunk-TFCNKBRC.js";
13
13
  import "./chunk-ORAY4KMA.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VFT3TD3E.js";
5
5
  import {
6
6
  createApiClient
7
- } from "./chunk-NSRQ62C4.js";
7
+ } from "./chunk-LM7R7JUX.js";
8
8
  import "./chunk-4QZ7KD2Y.js";
9
9
  import "./chunk-ORAY4KMA.js";
10
10
  import "./chunk-K4RAUZSD.js";
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-VFT3TD3E.js";
8
8
  import {
9
9
  createApiClient
10
- } from "./chunk-NSRQ62C4.js";
10
+ } from "./chunk-LM7R7JUX.js";
11
11
  import "./chunk-4QZ7KD2Y.js";
12
12
  import "./chunk-TFCNKBRC.js";
13
13
  import "./chunk-ORAY4KMA.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-NSRQ62C4.js";
11
+ } from "./chunk-LM7R7JUX.js";
12
12
  import "./chunk-4QZ7KD2Y.js";
13
13
  import "./chunk-ORAY4KMA.js";
14
14
  import "./chunk-K4RAUZSD.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-VFT3TD3E.js";
4
4
  import {
5
5
  createApiClient
6
- } from "./chunk-NSRQ62C4.js";
6
+ } from "./chunk-LM7R7JUX.js";
7
7
  import "./chunk-4QZ7KD2Y.js";
8
8
  import "./chunk-ORAY4KMA.js";
9
9
  import "./chunk-K4RAUZSD.js";
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@chainpatrol/cli",
3
3
  "description": "The official ChainPatrol CLI — terminal interface for threat detection",
4
4
  "author": "Umar Ahmed <umar@chainpatrol.io>",
5
- "version": "1.14.0",
5
+ "version": "1.16.0",
6
6
  "license": "UNLICENSED",
7
7
  "homepage": "https://chainpatrol.com/docs/cli",
8
8
  "keywords": [
@@ -33,8 +33,8 @@
33
33
  "lint": "npx oxlint ."
34
34
  },
35
35
  "dependencies": {
36
- "@chainpatrol/mcp": "1.12.1",
37
- "@chainpatrol/sdk": "1.13.0",
36
+ "@chainpatrol/mcp": "1.13.1",
37
+ "@chainpatrol/sdk": "1.15.0",
38
38
  "@modelcontextprotocol/sdk": "^1.30.0",
39
39
  "ink": "^7.0.1",
40
40
  "meow": "^14.1.0",