@chainpatrol/cli 0.3.3 → 0.3.4

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,18 @@
1
1
  # @chainpatrol/cli
2
2
 
3
+ ## 0.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - e30617f: Update the bundled Claude Code skill to document the `detections healthcheck`,
8
+ `queues snapshot`, `metrics summary | found | breakdown`, and `presets`
9
+ subcommands, plus the `--no-input` / `--no-color` / `--output` / `--quiet`
10
+ global flags. The existing soft / manual signals in the Organization
11
+ HealthCheck Guide are preserved verbatim; each subsection now also points at
12
+ the matching CLI command via a "Run via CLI" note, and a new "Quick Path"
13
+ block lists the commands an agent should reach for first when asked to run
14
+ a health check.
15
+
3
16
  ## 0.3.3
4
17
 
5
18
  ### Patch Changes
@@ -264,6 +264,101 @@ You can also compare with the non-customer set using
264
264
  \`--no-reported-by-customer\` to gauge detection coverage on the same time
265
265
  window.
266
266
 
267
+ ### \`detections healthcheck\` \u2014 Validate enabled detection configs produce recent results
268
+
269
+ Server-side check. The CLI calls the ChainPatrol API; the server fetches each
270
+ enabled detection config for the org, counts results produced in the lookback
271
+ window, and FAILs configs that fall under \`--min-results\` (or whose run
272
+ errored when \`--run\` is set).
273
+
274
+ \`\`\`bash
275
+ chainpatrol --json detections healthcheck --org <slug>
276
+ \`\`\`
277
+
278
+ Flags:
279
+ - \`--source <key>\` only validate one source (e.g. \`twitter_search\`)
280
+ - \`--min-results <n>\` minimum results required in the window to pass
281
+ - \`--lookback-hours <n>\` size of the lookback window
282
+ - \`--run\` ask the server to run each config first, then validate the fresh output
283
+ - \`--include-disabled\` also validate disabled configs
284
+
285
+ What this command covers:
286
+ - Configs that have gone silent (recentResultCount below threshold)
287
+ - Configs that error when run (runOk=false) when \`--run\` is set
288
+
289
+ What it does NOT cover:
290
+ - Reviewing backlog / SLA breaches \u2192 use \`queues snapshot\`
291
+ - Takedown ToDo / In Progress / Cancelled volumes \u2192 use \`queues snapshot\`
292
+ - Spikes or drops in detection volume over time \u2192 use \`metrics breakdown\`
293
+ - Customer-reported gaps \u2192 use \`reports list --reported-by-customer\`
294
+ - Google Safe Browsing submission errors (not yet exposed in CLI)
295
+
296
+ Use it as the first signal in the Detection part of an org healthcheck, then
297
+ fall back to the manual checks in the HealthCheck Guide below for everything
298
+ else.
299
+
300
+ ### \`queues snapshot\` \u2014 Operations review/takedown queue snapshot
301
+
302
+ Server-side aggregation of the operations review queue (pending proposals,
303
+ SLA breaches, age buckets) and the takedown queue (open, in-progress, stale).
304
+
305
+ \`\`\`bash
306
+ chainpatrol --json queues snapshot --org <slug>
307
+ \`\`\`
308
+
309
+ Useful for the **Reviewing** and **Takedowns** sections of the HealthCheck
310
+ Guide. Key signals in the response:
311
+ - \`reviewQueue.totalPendingProposals\` and \`reviewQueue.distinctReports\` \u2014
312
+ backlog size
313
+ - \`reviewQueue.slaBuckets.breached\` \u2014 SLA breaches (treat any breach as a
314
+ finding)
315
+ - \`reviewQueue.ageBuckets.gte168h\` \u2014 proposals older than 7 days (anything
316
+ >14 days from the manual guide should always be in here)
317
+ - \`takedownQueue.totalOpen\` and \`takedownQueue.staleInProgress\` \u2014 open
318
+ and stuck takedowns
319
+
320
+ Use \`--all\` to snapshot every org you have access to instead of a single slug.
321
+
322
+ ### \`metrics summary | found | breakdown\` \u2014 Org metrics for spike/drop analysis
323
+
324
+ \`\`\`bash
325
+ chainpatrol --json metrics summary --org <slug> --this-week
326
+ chainpatrol --json metrics breakdown --org <slug> --by day --this-week
327
+ chainpatrol --json metrics found --org <slug> --from <YYYY-MM-DD> --to <YYYY-MM-DD>
328
+ \`\`\`
329
+
330
+ \`breakdown\` is the one you usually want for healthchecks: it returns a
331
+ time series (by day or week) of reports, new threats, watchlisted threats,
332
+ and takedowns filed/completed. Compare the latest period against a prior
333
+ window to spot the **spike** or **drop** signals described in the manual
334
+ HealthCheck Guide. \`summary\` returns a single window total; \`found\` is
335
+ oriented around when threats were first discovered.
336
+
337
+ ### \`presets list | run\` \u2014 Packaged workflows for common jobs
338
+
339
+ \`\`\`bash
340
+ chainpatrol presets list
341
+ chainpatrol presets run cs-weekly-health --org <slug>
342
+ \`\`\`
343
+
344
+ Use \`presets list\` to discover packaged multi-step workflows. The bundled
345
+ \`cs-weekly-health\` preset runs the standard customer-success weekly health
346
+ sweep; prefer it over hand-rolling the same sequence of commands.
347
+
348
+ ## Headless / agent-mode tips
349
+
350
+ When running these commands from an agent or CI:
351
+
352
+ - Prefer \`--json\` (or \`--output json\`) so output is structured and the
353
+ update-check stderr nudge is suppressed automatically.
354
+ - Pass \`--no-input\` to forbid any interactive prompt (the CLI will error
355
+ out instead of waiting on a TTY).
356
+ - Pass \`--no-color\` or set \`NO_COLOR=1\` if your sink can't render ANSI.
357
+ - Set \`CHAINPATROL_NO_UPDATE_CHECK=1\` to silence the skill/npm freshness
358
+ nudge entirely.
359
+ - For \`login\` specifically, see the headless runbook in the login section
360
+ above \u2014 login is the one command that needs background + tail handling.
361
+
267
362
  ## Checking Auth Status
268
363
 
269
364
  To check if the user is logged in, read the credentials file:
@@ -303,12 +398,16 @@ machine-readable output is never polluted.
303
398
 
304
399
  ## Global Flags
305
400
 
306
- | Flag | Description |
307
- |-------------|--------------------------------------|
308
- | \`--json\` | Machine-readable JSON output |
309
- | \`--org\` | Organization slug (saved for later) |
310
- | \`--help\` | Show help |
311
- | \`--version\` | Show version |
401
+ | Flag | Description |
402
+ |------------------|--------------------------------------------------------|
403
+ | \`--json\` | Machine-readable JSON output (shortcut for \`--output json\`) |
404
+ | \`--output <fmt>\` | Output format: \`human\` (default), \`json\`, \`markdown\`, \`csv\` |
405
+ | \`--quiet\`, \`-q\` | Suppress non-essential output and the update-check nudge |
406
+ | \`--no-color\` | Disable ANSI colors (also respects the \`NO_COLOR\` env var) |
407
+ | \`--no-input\` | Disable interactive prompts (use in scripts and agents) |
408
+ | \`--org <slug>\` | Organization slug (saved as the default for later commands) |
409
+ | \`--help\`, \`-h\` | Show help |
410
+ | \`--version\` | Show version |
312
411
 
313
412
  ## Workflow
314
413
 
@@ -336,7 +435,85 @@ When the user asks for a "health check", "audit", "what's wrong with org X",
336
435
  "review org X's setup", or similar, walk through each section below and surface
337
436
  findings.
338
437
 
339
- In each section there are things you can look for that may be wrong.
438
+ In each section there are things you can look for that may be wrong. Some
439
+ checks have a dedicated CLI command that does most of the work server-side;
440
+ others are soft / qualitative signals that still need you to fetch data with
441
+ \`configs list\` or \`reports list\` and reason about it manually.
442
+
443
+ ### Quick Path: CLI commands that automate parts of this guide
444
+
445
+ Run these first to get cheap, structured signals before falling back to the
446
+ manual checks in each subsection:
447
+
448
+ \`\`\`bash
449
+ # Detection: configs that have gone silent or are erroring
450
+ chainpatrol --json detections healthcheck --org <slug>
451
+
452
+ # Reviewing & Takedowns: backlog, SLA breaches, stuck takedowns
453
+ chainpatrol --json queues snapshot --org <slug>
454
+
455
+ # Spikes / drops in detection volume over time (compare windows)
456
+ chainpatrol --json metrics breakdown --org <slug> --by day --this-week
457
+
458
+ # Customer-reported threats \u2014 gaps in our own detection
459
+ chainpatrol --json reports list --org <slug> --reported-by-customer
460
+
461
+ # What's enabled vs disabled vs not configured for the org
462
+ chainpatrol --json configs list --org <slug>
463
+
464
+ # Packaged weekly customer-success sweep (preferred when it covers the ask)
465
+ chainpatrol presets run cs-weekly-health --org <slug>
466
+ \`\`\`
467
+
468
+ Treat each command's output as one input to the healthcheck. The manual
469
+ checks below still apply \u2014 especially for signals the CLI cannot infer on
470
+ its own (e.g. "lots of Twitter assets are blocked but Twitter Post Search
471
+ is disabled", or "this drop is fine because the config isn't relevant
472
+ to this org").
473
+
474
+ ### Reporting progress while running a healthcheck
475
+
476
+ When the user asks for a healthcheck, narrate each step in real time so they
477
+ can watch the run unfold. Do NOT batch results and dump everything at the
478
+ end. For every check you run (Quick Path CLI command, or a manual signal
479
+ where you're fetching data with \`configs list\` / \`reports list\` to
480
+ reason about):
481
+
482
+ 1. **Before** you call the command, emit ONE short sentence stating what
483
+ you're about to check, including the org slug. Examples:
484
+ - "Running detection config healthcheck for morpho\u2026"
485
+ - "Snapshotting review and takedown queues for morpho\u2026"
486
+ - "Fetching customer-reported reports for morpho to look for detection gaps\u2026"
487
+
488
+ 2. **As soon as** the command returns, emit ONE short result line that
489
+ starts with a status word and ends with a key number or finding:
490
+ - \`DONE\` \u2014 ran cleanly, nothing to flag
491
+ - \`WARN\` \u2014 soft signal worth surfacing (e.g. a borderline backlog,
492
+ mild spike or drop, a config you'd want a human to confirm)
493
+ - \`FAIL\` \u2014 concrete failure that the user should act on
494
+ - Examples:
495
+ - "DONE \u2014 14/14 detection configs passing."
496
+ - "WARN \u2014 23 proposals in the review queue; 4 are older than 7 days."
497
+ - "FAIL \u2014 twitter_post_search returned 0 results in the last 24h with --run."
498
+
499
+ 3. Run **independent** checks in **parallel** (single message, multiple
500
+ Bash tool calls) so progress lines arrive quickly. \`detections
501
+ healthcheck\`, \`queues snapshot\`, \`metrics breakdown\`,
502
+ \`reports list --reported-by-customer\`, and \`configs list\` are all
503
+ independent of each other and safe to fire concurrently. Dependent
504
+ follow-ups (e.g. paginating \`reports list\` with a returned cursor,
505
+ or fetching extra detail on a single failing config) run after the
506
+ first round.
507
+
508
+ 4. After every check is reported, emit a short final **Summary** section:
509
+ - A one-line status per check (\u2713 / \u26A0 / \u2717 + name + key number).
510
+ - A short "Top issues" list of the highest-priority FAIL / WARN
511
+ findings, in priority order, with the concrete next action for each.
512
+
513
+ Keep each progress line to one sentence. The goal is for the user to see
514
+ the healthcheck happening, not to read a wall of text mid-run \u2014 full
515
+ detail belongs in the final Summary or in a follow-up when the user asks
516
+ about a specific finding.
340
517
 
341
518
  ### Detection
342
519
 
@@ -347,18 +524,37 @@ turned off. For example: lots of Twitter assets are on the blocklist, but
347
524
  detection sources like "Twitter / X User Search" or "Twitter Post Search" are
348
525
  disabled. Those should be turned on.
349
526
 
527
+ **Run via CLI:** there is no single command for this \u2014 it's a manual
528
+ correlation. Fetch the org's enabled vs disabled configs with
529
+ \`chainpatrol --json configs list --org <slug>\`, then look at recent reports
530
+ (\`chainpatrol --json reports list --org <slug>\`) and the asset types of any
531
+ blocked items. Flag any asset type where blocked items exist but the matching
532
+ detection source has \`status: "disabled"\` (or appears in the "Not configured"
533
+ group).
534
+
350
535
  #### Spike in Detections
351
536
 
352
537
  A spike in recent detections is worth investigating. It could be a bad config
353
538
  change, or it could be a legitimate new attack push in this area \u2014 useful
354
539
  intel to surface to the security team as a targeted spike.
355
540
 
541
+ **Run via CLI:** \`chainpatrol --json metrics breakdown --org <slug> --by day --this-week\`
542
+ (and a comparison window via \`--from\`/\`--to\`) to see daily detection
543
+ volume. Anything notably above the recent baseline is a spike \u2014 cross-reference
544
+ against recent config changes for that source.
545
+
356
546
  #### Drop in Detections
357
547
 
358
548
  A drop is also worth looking into. It may be a bad config change, or it may
359
549
  mean the config is not really relevant and can be safely turned off (not all
360
550
  default-on configs are relevant to every org).
361
551
 
552
+ **Run via CLI:** the same \`metrics breakdown\` time series catches drops.
553
+ Additionally, \`chainpatrol --json detections healthcheck --org <slug>\`
554
+ fails configs whose \`recentResultCount\` is below \`--min-results\` in the
555
+ \`--lookback-hours\` window \u2014 that's exactly a "this source went silent"
556
+ signal. Use \`--run\` to also catch configs that error when executed.
557
+
362
558
  ### Reviewing
363
559
 
364
560
  #### Pile Up / Backlog of Unreviewed Proposals
@@ -368,6 +564,13 @@ reports, but really the threshold is relative to the average number of
368
564
  confirmed threats per week. Example: if an org only adds 5 blocked threats per
369
565
  week, then a 7-day backlog of even 10 proposals is a really big deal.
370
566
 
567
+ **Run via CLI:** \`chainpatrol --json queues snapshot --org <slug>\` returns
568
+ \`reviewQueue.totalPendingProposals\` and \`reviewQueue.distinctReports\`.
569
+ Compare against the org's typical weekly throughput (use
570
+ \`metrics summary --this-week\` for that baseline) \u2014 a backlog that exceeds
571
+ a week of typical confirmed-threat volume is a finding regardless of the
572
+ absolute number.
573
+
371
574
  #### Really Old Proposals
372
575
 
373
576
  Any proposal waiting for review longer than 14 days is a sign something has
@@ -375,6 +578,12 @@ gone wrong. Even complex investigations rarely take longer than this. Except
375
578
  for rare cases, these should be rejected or approved to prevent a backlog
376
579
  from building.
377
580
 
581
+ **Run via CLI:** \`queues snapshot\` returns \`reviewQueue.ageBuckets.gte168h\`
582
+ (proposals older than 7 days). Anything in that bucket is at least halfway
583
+ to the 14-day threshold; investigate. \`reviewQueue.slaBuckets.breached\`
584
+ captures the strictest SLA breaches separately \u2014 any non-zero value is
585
+ worth raising.
586
+
378
587
  #### Spike in Auto Approved Reports
379
588
 
380
589
  If suddenly a lot of proposals in an org are being approved by automation,
@@ -385,6 +594,12 @@ cases, notify an engineer at ChainPatrol and check any detection configs you
385
594
  adjusted recently, since those may be the cause of spam combined with a weak
386
595
  rule.
387
596
 
597
+ **Run via CLI:** there is no dedicated subcommand for the auto-approval
598
+ rate yet. As a proxy, use \`chainpatrol --json metrics breakdown --org <slug> --by day --this-week\`
599
+ and look for a sudden surge in \`newThreats\` / \`threatsWatchlisted\` that
600
+ isn't matched by a parallel rise in reviewer activity \u2014 that gap usually
601
+ points at automation doing the approving.
602
+
388
603
  ### Blocklisting
389
604
 
390
605
  #### Google Safe Browsing (Coming Soon)
@@ -398,6 +613,10 @@ also take a look at the org's custom detection sources \u2014 it's possible ther
398
613
  are too many false positives landing on the blocklist, indicating issues with
399
614
  detection and reviewing rules.
400
615
 
616
+ **Run via CLI:** not yet \u2014 the CLI does not expose Google Safe Browsing
617
+ submission state today. Until the new public API lands, this remains a
618
+ manual / engineering-team check.
619
+
401
620
  ### Takedowns
402
621
 
403
622
  #### Too Many Takedowns in ToDo
@@ -406,12 +625,22 @@ Can mean a gap in automated takedowns not being implemented for some new area
406
625
  of threats. It can also mean the areas that require manual takedowns are
407
626
  being missed by the takedown team.
408
627
 
628
+ **Run via CLI:** \`chainpatrol --json queues snapshot --org <slug>\` returns
629
+ \`takedownQueue.totalOpen\` and breakdowns by status. A persistently large
630
+ ToDo bucket relative to the org's typical takedown rate (use
631
+ \`metrics summary\` for that baseline) is the finding.
632
+
409
633
  #### Too Many Takedowns In Progress
410
634
 
411
635
  Typically means something is wrong with the submission itself. The takedown
412
636
  may need to be resubmitted, the vendor asked for more evidence, or we may
413
637
  have submitted it in the wrong place.
414
638
 
639
+ **Run via CLI:** \`queues snapshot\` returns \`takedownQueue.staleInProgress\`
640
+ \u2014 takedowns that have sat in In Progress past the expected vendor turnaround.
641
+ Any non-zero value is worth investigating; a growing number across snapshots
642
+ strongly suggests a vendor-side or submission-format problem.
643
+
415
644
  #### Too Many Cancelled Takedowns
416
645
 
417
646
  Takedowns should rarely be cancelled. A cancelled takedown means "we will not
@@ -419,11 +648,21 @@ do this takedown" for some reason. Cases like adding an item to the blocklist
419
648
  when it's already taken down are treated as completed, not cancelled. So even
420
649
  3 cancelled takedowns in a 7-day period is too many.
421
650
 
651
+ **Run via CLI:** no first-class command yet. As an interim signal, use
652
+ \`chainpatrol --json metrics breakdown --org <slug> --by day --this-week\`
653
+ and compare \`takedownsFiled\` vs \`takedownsCompleted\` for a sudden
654
+ divergence \u2014 a widening gap with no In-Progress growth often shows up as
655
+ cancellations.
656
+
422
657
  #### Automated Takedowns Turned Off for Over 30 Days
423
658
 
424
659
  Automated takedowns should be on by default for nearly every organization.
425
660
  Any issue that would make you want to turn off automated takedowns should be
426
661
  resolved within 30 days.
662
+
663
+ **Run via CLI:** not yet exposed in a single command. Check this manually
664
+ with the org's takedown automation settings; the CLI's role here is mostly
665
+ to highlight stale state in \`queues snapshot\` so you know to ask.
427
666
  `;
428
667
  }
429
668
  function getBundledSkillVersion() {
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  getCliVersion,
14
14
  isSkillInstalled,
15
15
  readInstalledSkillVersion
16
- } from "./chunk-R7BPW32M.js";
16
+ } from "./chunk-DOL35U2S.js";
17
17
  import "./chunk-IUZB3DQW.js";
18
18
  import {
19
19
  DateTime
@@ -1032,12 +1032,12 @@ async function main() {
1032
1032
  case "setup":
1033
1033
  case "install":
1034
1034
  case "i": {
1035
- const { setupSkill } = await import("./setup-skill-KKWETU4A.js");
1035
+ const { setupSkill } = await import("./setup-skill-PCUBJJYU.js");
1036
1036
  setupSkill({ json: jsonMode });
1037
1037
  break;
1038
1038
  }
1039
1039
  case "uninstall": {
1040
- const { uninstallSkill } = await import("./setup-skill-KKWETU4A.js");
1040
+ const { uninstallSkill } = await import("./setup-skill-PCUBJJYU.js");
1041
1041
  uninstallSkill({ json: jsonMode });
1042
1042
  break;
1043
1043
  }
@@ -6,7 +6,7 @@ import {
6
6
  readInstalledSkillVersion,
7
7
  setupSkill,
8
8
  uninstallSkill
9
- } from "./chunk-R7BPW32M.js";
9
+ } from "./chunk-DOL35U2S.js";
10
10
  import "./chunk-IUZB3DQW.js";
11
11
  export {
12
12
  getBundledSkillContent,
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.3.3",
5
+ "version": "0.3.4",
6
6
  "license": "UNLICENSED",
7
7
  "homepage": "https://chainpatrol.com/docs/cli",
8
8
  "keywords": [