@chainpatrol/cli 0.9.0 → 0.11.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 (32) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +16 -2
  3. package/dist/{breakdown-63FAOVL7.js → breakdown-MM5GSZKV.js} +1 -1
  4. package/dist/check-GDKUHVQI.js +203 -0
  5. package/dist/{chunk-BJISZ3CY.js → chunk-37KYJWB3.js} +1 -1
  6. package/dist/{chunk-P4L4N5LM.js → chunk-EPKNZRX6.js} +34 -5
  7. package/dist/{chunk-RIKR2WFT.js → chunk-SX3L6NKR.js} +85 -4
  8. package/dist/{chunk-Z76CUWSS.js → chunk-YXRFUYA6.js} +13 -2
  9. package/dist/cli.js +146 -37
  10. package/dist/{completions-D6SOLU2D.js → completions-62OW3B3Y.js} +1 -1
  11. package/dist/{configs-update-2IOSKZH5.js → configs-update-7X7657PB.js} +1 -1
  12. package/dist/{create-EWS3SFCH.js → create-FL4QQTPN.js} +1 -1
  13. package/dist/{drift-Q3VG3XG3.js → drift-JKBHWWFU.js} +1 -1
  14. package/dist/{found-22B7RZT5.js → found-3WI4XQG4.js} +1 -1
  15. package/dist/{healthcheck-C3AIMUJT.js → healthcheck-EVQVPGWW.js} +1 -1
  16. package/dist/{list-IA4CSOIY.js → list-5DN6X3DP.js} +1 -1
  17. package/dist/{list-DNRWKM5O.js → list-BLNIE4GL.js} +1 -1
  18. package/dist/{list-AYHDFSQG.js → list-E5XNR2YG.js} +1 -1
  19. package/dist/list-JPG2ZSR4.js +137 -0
  20. package/dist/{list-HFWSMLGJ.js → list-ULHPOUJV.js} +2 -2
  21. package/dist/{list-SDBLGBVW.js → list-XDGU6SJQ.js} +1 -1
  22. package/dist/{list-json-CEPGVUGF.js → list-json-R2MIXADX.js} +1 -1
  23. package/dist/organization-MJRKWC4Z.js +75 -0
  24. package/dist/{run-AQMJRFGL.js → run-2YZZGZYN.js} +1 -1
  25. package/dist/{run-YTWNQD5X.js → run-5E5EC3MP.js} +1 -1
  26. package/dist/{run-WJGHJPXN.js → run-EUVRC72M.js} +2 -2
  27. package/dist/{setup-skill-DR4KGQMG.js → setup-skill-HAENFIFQ.js} +2 -2
  28. package/dist/{snapshot-C5MZWJTW.js → snapshot-3FUJICJJ.js} +1 -1
  29. package/dist/{summary-NQDZQEOD.js → summary-RVYQUKWV.js} +1 -1
  30. package/dist/{validate-5DVPSXJP.js → validate-UOVKEAJM.js} +1 -1
  31. package/package.json +1 -1
  32. package/dist/check-YZRIAUOK.js +0 -85
@@ -0,0 +1,75 @@
1
+ import {
2
+ printOutput,
3
+ toCsvRows
4
+ } from "./chunk-VFT3TD3E.js";
5
+ import {
6
+ createApiClient
7
+ } from "./chunk-SX3L6NKR.js";
8
+ import "./chunk-EGWK6SRQ.js";
9
+ import "./chunk-TFCNKBRC.js";
10
+ import "./chunk-U73SABXK.js";
11
+
12
+ // src/commands/metrics/organization.ts
13
+ async function runMetricsOrganization(options) {
14
+ const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
15
+ const client = options.apiClient ?? createApiClient();
16
+ const input = {
17
+ organizationSlug: options.org,
18
+ brandSlug: options.brandSlug,
19
+ startDate: options.from,
20
+ endDate: options.to
21
+ };
22
+ const result = await client.getOrganizationMetrics(input);
23
+ const label = options.org ?? "your organization";
24
+ printOutput({
25
+ outputFormat,
26
+ json: result,
27
+ markdown: [
28
+ `# Organization Metrics (${label})`,
29
+ "",
30
+ `- Reports: ${result.metrics.reports}`,
31
+ `- New threats: ${result.metrics.newThreats}`,
32
+ `- Watchlisted threats: ${result.metrics.threatsWatchlisted}`,
33
+ `- Takedowns filed: ${result.metrics.takedownsFiled}`,
34
+ `- Takedowns completed: ${result.metrics.takedownsCompleted}`,
35
+ `- Domain threats: ${result.metrics.domainThreats}`,
36
+ `- Twitter threats: ${result.metrics.twitterThreats}`,
37
+ `- Telegram threats: ${result.metrics.telegramThreats}`,
38
+ `- Other threats: ${result.metrics.otherThreats}`
39
+ ].join("\n"),
40
+ csv: toCsvRows([
41
+ {
42
+ reports: result.metrics.reports,
43
+ newThreats: result.metrics.newThreats,
44
+ threatsWatchlisted: result.metrics.threatsWatchlisted,
45
+ takedownsFiled: result.metrics.takedownsFiled,
46
+ takedownsCompleted: result.metrics.takedownsCompleted,
47
+ domainThreats: result.metrics.domainThreats,
48
+ twitterThreats: result.metrics.twitterThreats,
49
+ telegramThreats: result.metrics.telegramThreats,
50
+ otherThreats: result.metrics.otherThreats
51
+ }
52
+ ]),
53
+ human: () => {
54
+ console.log(`Organization metrics for ${label}`);
55
+ console.log(`Reports: ${result.metrics.reports}`);
56
+ console.log(`New threats: ${result.metrics.newThreats}`);
57
+ console.log(`Watchlisted threats: ${result.metrics.threatsWatchlisted}`);
58
+ console.log(`Takedowns filed: ${result.metrics.takedownsFiled}`);
59
+ console.log(`Takedowns completed: ${result.metrics.takedownsCompleted}`);
60
+ console.log(
61
+ `Threat breakdown: domains=${result.metrics.domainThreats}, twitter=${result.metrics.twitterThreats}, telegram=${result.metrics.telegramThreats}, other=${result.metrics.otherThreats}`
62
+ );
63
+ if (result.blockedByDay.length > 0) {
64
+ console.log("");
65
+ console.log(`Blocked by day (${result.blockedByDay.length} entries):`);
66
+ for (const entry of result.blockedByDay) {
67
+ console.log(` ${entry.date}: ${entry.count}`);
68
+ }
69
+ }
70
+ }
71
+ });
72
+ }
73
+ export {
74
+ runMetricsOrganization
75
+ };
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-RIKR2WFT.js";
11
+ } from "./chunk-SX3L6NKR.js";
12
12
  import "./chunk-EGWK6SRQ.js";
13
13
  import "./chunk-TFCNKBRC.js";
14
14
  import "./chunk-U73SABXK.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-RIKR2WFT.js";
11
+ } from "./chunk-SX3L6NKR.js";
12
12
  import "./chunk-EGWK6SRQ.js";
13
13
  import "./chunk-TFCNKBRC.js";
14
14
  import "./chunk-U73SABXK.js";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  getPresetDefinition,
3
3
  runPreset
4
- } from "./chunk-BJISZ3CY.js";
4
+ } from "./chunk-37KYJWB3.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-RIKR2WFT.js";
10
+ import "./chunk-SX3L6NKR.js";
11
11
  import "./chunk-EGWK6SRQ.js";
12
12
  import "./chunk-TFCNKBRC.js";
13
13
  import "./chunk-U73SABXK.js";
@@ -6,8 +6,8 @@ import {
6
6
  readInstalledSkillVersion,
7
7
  setupSkill,
8
8
  uninstallSkill
9
- } from "./chunk-P4L4N5LM.js";
10
- import "./chunk-Z76CUWSS.js";
9
+ } from "./chunk-EPKNZRX6.js";
10
+ import "./chunk-YXRFUYA6.js";
11
11
  export {
12
12
  getBundledSkillContent,
13
13
  getBundledSkillVersion,
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-RIKR2WFT.js";
11
+ } from "./chunk-SX3L6NKR.js";
12
12
  import "./chunk-EGWK6SRQ.js";
13
13
  import "./chunk-TFCNKBRC.js";
14
14
  import "./chunk-U73SABXK.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VFT3TD3E.js";
5
5
  import {
6
6
  createApiClient
7
- } from "./chunk-RIKR2WFT.js";
7
+ } from "./chunk-SX3L6NKR.js";
8
8
  import "./chunk-EGWK6SRQ.js";
9
9
  import "./chunk-TFCNKBRC.js";
10
10
  import "./chunk-U73SABXK.js";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-RIKR2WFT.js";
11
+ } from "./chunk-SX3L6NKR.js";
12
12
  import "./chunk-EGWK6SRQ.js";
13
13
  import "./chunk-TFCNKBRC.js";
14
14
  import "./chunk-U73SABXK.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": "0.9.0",
5
+ "version": "0.11.0",
6
6
  "license": "UNLICENSED",
7
7
  "homepage": "https://chainpatrol.com/docs/cli",
8
8
  "keywords": [
@@ -1,85 +0,0 @@
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-RIKR2WFT.js";
12
- import "./chunk-EGWK6SRQ.js";
13
- import "./chunk-TFCNKBRC.js";
14
- import "./chunk-U73SABXK.js";
15
-
16
- // src/commands/asset/check.ts
17
- function statusLine(result) {
18
- const watchTag = result.watchStatus ? ` watch=${result.watchStatus}` : "";
19
- const reasonTag = result.reason ? ` reason=${result.reason}` : "";
20
- return `${result.status} (source=${result.source}${reasonTag}${watchTag})`;
21
- }
22
- async function runAssetCheck(options) {
23
- const content = options.content?.trim();
24
- if (!content) {
25
- throw new CliExitError(
26
- "asset check requires an asset. Example: chainpatrol asset check https://example.com",
27
- ExitCode.USAGE
28
- );
29
- }
30
- const outputFormat = options.outputFormat ?? (options.json ? "json" : "human");
31
- const client = options.apiClient ?? createApiClient();
32
- const result = await client.assetCheck({ content });
33
- printOutput({
34
- outputFormat,
35
- json: {
36
- content,
37
- ...result,
38
- explanation: options.explain ? "Asset check aggregates ChainPatrol records and external sources to classify a domain, URL, or crypto address as BLOCKED, ALLOWED, or UNKNOWN." : void 0
39
- },
40
- markdown: [
41
- `# Asset Check: ${content}`,
42
- "",
43
- `- Status: **${result.status}**`,
44
- `- Source: ${result.source}`,
45
- ...result.reason ? [`- Reason: ${result.reason}`] : [],
46
- ...result.watchStatus ? [`- Watch status: ${result.watchStatus}`] : [],
47
- ...result.message ? [`- Message: ${result.message}`] : [],
48
- ...result.code ? [`- Code: ${result.code}`] : [],
49
- "",
50
- "## Per-source results",
51
- "",
52
- ...result.sources.map((entry) => `- ${entry.source}: ${entry.status}`)
53
- ].join("\n"),
54
- csv: toCsvRows(
55
- result.sources.map((entry) => ({
56
- content,
57
- source: entry.source,
58
- status: entry.status
59
- }))
60
- ),
61
- human: () => {
62
- console.log(`${content} -> ${statusLine(result)}`);
63
- if (result.message) {
64
- console.log(`Message: ${result.message}`);
65
- }
66
- if (result.code) {
67
- console.log(`Code: ${result.code}`);
68
- }
69
- if (result.sources.length > 0) {
70
- console.log("Sources:");
71
- for (const entry of result.sources) {
72
- console.log(` - ${entry.source}: ${entry.status}`);
73
- }
74
- }
75
- if (options.explain) {
76
- console.log(
77
- "Status is the aggregated verdict across ChainPatrol and external feeds; see the per-source rows for the underlying signals."
78
- );
79
- }
80
- }
81
- });
82
- }
83
- export {
84
- runAssetCheck
85
- };