@chainpatrol/cli 1.15.0 → 1.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @chainpatrol/cli
|
|
2
2
|
|
|
3
|
+
## 1.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [ec240cc]
|
|
8
|
+
- @chainpatrol/mcp@1.13.2
|
|
9
|
+
|
|
10
|
+
## 1.16.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 620519c: List brands for a chosen organization.
|
|
15
|
+
|
|
16
|
+
- **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`.
|
|
17
|
+
- **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.
|
|
18
|
+
- **MCP**: the `GET /organization/brands` tool gains the optional `slug` input.
|
|
19
|
+
|
|
20
|
+
`GET /organization/brands` in the private `@chainpatrol/external-trpc` and `@chainpatrol/validation` packages now accepts `slug`, authorized the same way as `/organization/watchlist`.
|
|
21
|
+
|
|
22
|
+
- 866a445: Close detection-evaluation gaps found while evaluating detections through the public API.
|
|
23
|
+
|
|
24
|
+
- **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:
|
|
25
|
+
- only the unfiltered watchlist total equals `threatsWatchlisted`;
|
|
26
|
+
- `metrics summary` reports the last 3 months unless given dates;
|
|
27
|
+
- count distinct `asset.id` for domains;
|
|
28
|
+
- bucket by first detection rather than a date window;
|
|
29
|
+
- add the score-scale caveat.
|
|
30
|
+
- **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".
|
|
31
|
+
- **MCP**: the `detection_evaluation` prompt adds the same guidance:
|
|
32
|
+
- distinct assets vs detections;
|
|
33
|
+
- first-detection bucketing;
|
|
34
|
+
- `metrics_summary` dates apply only when both are set;
|
|
35
|
+
- watchlist total vs `threatsWatchlisted`;
|
|
36
|
+
- retired source keys;
|
|
37
|
+
- the score-scale caveat.
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Updated dependencies [620519c]
|
|
42
|
+
- Updated dependencies [866a445]
|
|
43
|
+
- @chainpatrol/sdk@1.15.0
|
|
44
|
+
- @chainpatrol/mcp@1.13.1
|
|
45
|
+
|
|
3
46
|
## 1.15.0
|
|
4
47
|
|
|
5
48
|
### Minor Changes
|
package/dist/cli.js
CHANGED
|
@@ -203,6 +203,7 @@ 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",
|
|
206
207
|
"--block-status <list> Comma list: blocked|pending. Both = every confirmed threat, including pending blocks for orgs without active protection",
|
|
207
208
|
"--min-score <n> Only detections with raw score >= n (0-1). Use instead of --confidence for a fixed cut-off",
|
|
208
209
|
"--max-score <n> Only detections with raw score <= n (0-1)",
|
|
@@ -519,7 +520,7 @@ var HELP = {
|
|
|
519
520
|
]
|
|
520
521
|
},
|
|
521
522
|
"threats list": {
|
|
522
|
-
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.",
|
|
523
524
|
usage: "chainpatrol threats list [filters]",
|
|
524
525
|
options: [
|
|
525
526
|
"--query <text> Search threat content (substring)",
|
|
@@ -1106,6 +1107,7 @@ ${getTopLevelHelp()}
|
|
|
1106
1107
|
reported: { type: "string" },
|
|
1107
1108
|
countryCode: { type: "string" },
|
|
1108
1109
|
onlyDeleted: { type: "boolean", default: false },
|
|
1110
|
+
excludeDeleted: { type: "boolean", default: false },
|
|
1109
1111
|
blockStatus: { type: "string" },
|
|
1110
1112
|
minScore: { type: "number" },
|
|
1111
1113
|
maxScore: { type: "number" },
|
|
@@ -1481,7 +1483,7 @@ async function main() {
|
|
|
1481
1483
|
break;
|
|
1482
1484
|
}
|
|
1483
1485
|
if (subcommand === "list") {
|
|
1484
|
-
const { runDetectionsList } = await import("./list-
|
|
1486
|
+
const { runDetectionsList } = await import("./list-YAEK7G6Q.js");
|
|
1485
1487
|
await runDetectionsList({
|
|
1486
1488
|
org,
|
|
1487
1489
|
cursor: cli.flags.cursor,
|
|
@@ -1499,6 +1501,7 @@ async function main() {
|
|
|
1499
1501
|
reported: parseCsvList(cli.flags.reported),
|
|
1500
1502
|
countryCodes: parseCsvList(cli.flags.countryCode),
|
|
1501
1503
|
onlyDeleted: cli.flags.onlyDeleted,
|
|
1504
|
+
excludeDeleted: cli.flags.excludeDeleted,
|
|
1502
1505
|
blockStatus: parseCsvList(cli.flags.blockStatus),
|
|
1503
1506
|
minScore: cli.flags.minScore,
|
|
1504
1507
|
maxScore: cli.flags.maxScore,
|
|
@@ -1784,7 +1787,7 @@ async function main() {
|
|
|
1784
1787
|
}
|
|
1785
1788
|
case "threats": {
|
|
1786
1789
|
if (subcommand === "list") {
|
|
1787
|
-
const { runThreatsList } = await import("./list-
|
|
1790
|
+
const { runThreatsList } = await import("./list-SO34HIJK.js");
|
|
1788
1791
|
await runThreatsList({
|
|
1789
1792
|
query: cli.flags.query,
|
|
1790
1793
|
from: cli.flags.from,
|
|
@@ -1949,8 +1952,9 @@ async function main() {
|
|
|
1949
1952
|
"brands list --type must be ORGANIZATION, INDIVIDUAL, or PRODUCT (case-insensitive)."
|
|
1950
1953
|
);
|
|
1951
1954
|
}
|
|
1952
|
-
const { runBrandsList } = await import("./list-
|
|
1955
|
+
const { runBrandsList } = await import("./list-UVTOWO3R.js");
|
|
1953
1956
|
await runBrandsList({
|
|
1957
|
+
slug: await tryResolveOrg(),
|
|
1954
1958
|
type: rawType,
|
|
1955
1959
|
json: jsonMode,
|
|
1956
1960
|
outputFormat: cliContext.outputFormat
|
|
@@ -1959,7 +1963,7 @@ async function main() {
|
|
|
1959
1963
|
}
|
|
1960
1964
|
const hint = subcommand ? suggest(subcommand, ["list"]) : null;
|
|
1961
1965
|
throw new Error(
|
|
1962
|
-
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]"
|
|
1963
1967
|
);
|
|
1964
1968
|
}
|
|
1965
1969
|
case "mcp": {
|
|
@@ -14,6 +14,7 @@ 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,
|
|
@@ -58,7 +59,18 @@ async function runThreatsList(options) {
|
|
|
58
59
|
nextPage: options.nextPage,
|
|
59
60
|
includePending: options.includePending || void 0
|
|
60
61
|
};
|
|
61
|
-
|
|
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
|
+
}
|
|
62
74
|
const rows = result.threats.map(toRow);
|
|
63
75
|
printOutput({
|
|
64
76
|
outputFormat,
|
|
@@ -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({
|
|
@@ -113,6 +113,12 @@ async function runDetectionsList(options) {
|
|
|
113
113
|
ExitCode.USAGE
|
|
114
114
|
);
|
|
115
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
|
+
}
|
|
116
122
|
const countryCodes = options.countryCodes?.length ? options.countryCodes.map((code) => code.toUpperCase()) : void 0;
|
|
117
123
|
if (countryCodes?.some((code) => code.length !== 2)) {
|
|
118
124
|
throw new CliExitError(
|
|
@@ -138,6 +144,7 @@ async function runDetectionsList(options) {
|
|
|
138
144
|
reported,
|
|
139
145
|
countryCodes,
|
|
140
146
|
onlyDeleted: options.onlyDeleted,
|
|
147
|
+
excludeDeleted: options.excludeDeleted || void 0,
|
|
141
148
|
blockStatus,
|
|
142
149
|
minScore,
|
|
143
150
|
maxScore,
|
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.
|
|
5
|
+
"version": "1.16.1",
|
|
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.13.
|
|
37
|
-
"@chainpatrol/sdk": "1.
|
|
36
|
+
"@chainpatrol/mcp": "1.13.2",
|
|
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",
|