@chainpatrol/cli 1.10.0 → 1.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 (54) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{breakdown-2HAZ2MX5.js → breakdown-BLCYJP7O.js} +4 -3
  3. package/dist/{check-5LJI7N5I.js → check-2IFMTAIU.js} +4 -3
  4. package/dist/chunk-4QZ7KD2Y.js +18 -0
  5. package/dist/{chunk-GGBG2R63.js → chunk-BSWGLZDK.js} +1 -1
  6. package/dist/{chunk-FPCN4SNK.js → chunk-CABRZEYB.js} +1 -1
  7. package/dist/chunk-K4RAUZSD.js +32 -0
  8. package/dist/{chunk-322AVMUH.js → chunk-NSRQ62C4.js} +3 -16
  9. package/dist/chunk-OKIUEBUK.js +61 -0
  10. package/dist/{chunk-EGWK6SRQ.js → chunk-ORAY4KMA.js} +1 -1
  11. package/dist/{chunk-LE5ZOOUI.js → chunk-TGIVCSKT.js} +6 -62
  12. package/dist/cli.js +81 -50
  13. package/dist/{config-Z3TASRME.js → config-IKTL6KVW.js} +3 -1
  14. package/dist/{configs-update-N7ZIWWKQ.js → configs-update-XUN4X4T2.js} +4 -3
  15. package/dist/{create-4ZJ7DXHX.js → create-ILSWAUVI.js} +4 -3
  16. package/dist/{drift-BGWNH6QE.js → drift-DPYW7LYN.js} +4 -3
  17. package/dist/{found-QOARB5G2.js → found-YLTMVPBZ.js} +4 -3
  18. package/dist/{get-ON5JOCV7.js → get-NDEY54AO.js} +4 -3
  19. package/dist/{healthcheck-34LQTSVZ.js → healthcheck-SYZQ2ILK.js} +4 -3
  20. package/dist/{list-AG6LWNMN.js → list-2H2CV3JJ.js} +4 -3
  21. package/dist/{list-XV3G2AX6.js → list-4THJBDSU.js} +4 -3
  22. package/dist/{list-JG5ARDTR.js → list-FUQK3TIN.js} +5 -4
  23. package/dist/{list-UXYGISAK.js → list-GTN2HNGZ.js} +4 -3
  24. package/dist/{list-DJFIKDY6.js → list-H4RCDI6Q.js} +4 -3
  25. package/dist/{list-PAJBOVN2.js → list-LWB5JQAY.js} +4 -3
  26. package/dist/{list-6CAKS43I.js → list-PV5GY2DY.js} +4 -3
  27. package/dist/{list-W6CF25ZS.js → list-Q5K4RMM4.js} +4 -3
  28. package/dist/{list-UPY6PHY4.js → list-RUIQIVEA.js} +4 -3
  29. package/dist/{list-5TKOWBC4.js → list-VHDU3XMN.js} +4 -3
  30. package/dist/{list-SJFJT4V3.js → list-WYC4ZP7X.js} +4 -3
  31. package/dist/{list-IVFZGLKN.js → list-YFBZVQWK.js} +4 -3
  32. package/dist/{list-json-ZR3XOQPJ.js → list-json-B4X74BTZ.js} +4 -3
  33. package/dist/{login-2NRI3ECY.js → login-H2G6RBLL.js} +3 -3
  34. package/dist/{login-json-HOCNSQQ7.js → login-json-5DVIMAO2.js} +3 -3
  35. package/dist/{login-plain-6ZJF5KA7.js → login-plain-PUWGRRYT.js} +3 -3
  36. package/dist/{logout-T6Q4IVPU.js → logout-332KFFNS.js} +2 -2
  37. package/dist/{logout-json-ACXBI6PN.js → logout-json-VMGXQQS2.js} +2 -2
  38. package/dist/mcp-ITEWOAOR.js +46 -0
  39. package/dist/{organization-SSCPM7XN.js → organization-KANXTARX.js} +4 -3
  40. package/dist/{review-7A7WV73T.js → review-5J3EQRCB.js} +4 -3
  41. package/dist/{run-LZZOV4HG.js → run-FDZWPY4W.js} +4 -3
  42. package/dist/{run-AIYPHWFJ.js → run-JBQ43OW6.js} +4 -3
  43. package/dist/{run-YP4O5VXZ.js → run-XWM67MBV.js} +5 -4
  44. package/dist/{search-OGGKNPUJ.js → search-A75YUJFI.js} +4 -3
  45. package/dist/{search-IWS42COG.js → search-DRTTZJJP.js} +4 -3
  46. package/dist/{setup-skill-ESJ4HIKR.js → setup-skill-TVJJD6NC.js} +2 -1
  47. package/dist/{snapshot-TLSOPK7C.js → snapshot-2IT4KG4F.js} +4 -3
  48. package/dist/{summary-XA3PVJIW.js → summary-A24TNQNR.js} +4 -3
  49. package/dist/{takedown-time-ARGVSPL6.js → takedown-time-HB3J2FTZ.js} +4 -3
  50. package/dist/{takedown-time-trend-LL3ZCCSD.js → takedown-time-trend-KYPA3W3U.js} +4 -3
  51. package/dist/{validate-WB5367QN.js → validate-FOZCI7HX.js} +4 -3
  52. package/dist/{whoami-YE3V6I65.js → whoami-DSXNLG3B.js} +4 -3
  53. package/package.json +3 -1
  54. package/dist/chunk-U73SABXK.js +0 -46
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @chainpatrol/cli
2
2
 
3
+ ## 1.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 8d8861e: Add `@chainpatrol/mcp`, an MCP server exposing every public API operation as a
8
+ tool, and a `chainpatrol mcp` command that serves it over stdio.
9
+
10
+ The tool surface is generated from the external API router rather than written
11
+ by hand, so agents reach the same capabilities the API exposes. Large value
12
+ lists and long explanatory prose are served as MCP resources instead of being
13
+ inlined in every schema, and workflow guides (organization healthcheck, trend
14
+ search, weekly customer-success sweep) ship as MCP prompts.
15
+
16
+ Point an MCP client at `chainpatrol mcp` after `chainpatrol login`, or set
17
+ `CHAINPATROL_API_KEY` for a service account.
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [8d8861e]
22
+ - @chainpatrol/mcp@1.10.0
23
+
3
24
  ## 1.10.0
4
25
 
5
26
  ### Minor Changes
@@ -7,10 +7,11 @@ import {
7
7
  } from "./chunk-VFT3TD3E.js";
8
8
  import {
9
9
  createApiClient
10
- } from "./chunk-322AVMUH.js";
10
+ } from "./chunk-NSRQ62C4.js";
11
+ import "./chunk-4QZ7KD2Y.js";
11
12
  import "./chunk-TFCNKBRC.js";
12
- import "./chunk-EGWK6SRQ.js";
13
- import "./chunk-U73SABXK.js";
13
+ import "./chunk-ORAY4KMA.js";
14
+ import "./chunk-K4RAUZSD.js";
14
15
 
15
16
  // src/commands/metrics/breakdown.ts
16
17
  async function runMetricsBreakdown(options) {
@@ -8,9 +8,10 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-322AVMUH.js";
12
- import "./chunk-EGWK6SRQ.js";
13
- import "./chunk-U73SABXK.js";
11
+ } from "./chunk-NSRQ62C4.js";
12
+ import "./chunk-4QZ7KD2Y.js";
13
+ import "./chunk-ORAY4KMA.js";
14
+ import "./chunk-K4RAUZSD.js";
14
15
 
15
16
  // src/commands/asset/check.ts
16
17
  var DEFAULT_CONCURRENCY = 10;
@@ -0,0 +1,18 @@
1
+ import {
2
+ getValidCredentials
3
+ } from "./chunk-ORAY4KMA.js";
4
+
5
+ // src/lib/credential-provider.ts
6
+ function createCliCredentialProvider() {
7
+ return () => {
8
+ const envKey = process.env.CHAINPATROL_API_KEY;
9
+ if (envKey && envKey.trim().length > 0) {
10
+ return { kind: "api-key", value: envKey.trim() };
11
+ }
12
+ return { kind: "bearer", value: getValidCredentials().accessToken };
13
+ };
14
+ }
15
+
16
+ export {
17
+ createCliCredentialProvider
18
+ };
@@ -9,7 +9,7 @@ import {
9
9
  pollForToken,
10
10
  requestDeviceCode,
11
11
  storeCredentials
12
- } from "./chunk-EGWK6SRQ.js";
12
+ } from "./chunk-ORAY4KMA.js";
13
13
 
14
14
  // src/lib/login-flow.ts
15
15
  async function runLoginFlow(emit) {
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-VFT3TD3E.js";
9
9
  import {
10
10
  createApiClient
11
- } from "./chunk-322AVMUH.js";
11
+ } from "./chunk-NSRQ62C4.js";
12
12
  import {
13
13
  DateTime
14
14
  } from "./chunk-TFCNKBRC.js";
@@ -0,0 +1,32 @@
1
+ // src/lib/config.ts
2
+ import { writeFileSync, mkdirSync } from "fs";
3
+ import { join } from "path";
4
+ import {
5
+ configDir,
6
+ readStoredConfig,
7
+ resolveApiUrl
8
+ } from "@chainpatrol/mcp/config";
9
+ function getConfigDir() {
10
+ return configDir();
11
+ }
12
+ function getStoredConfig() {
13
+ return readStoredConfig();
14
+ }
15
+ function getConfig() {
16
+ const stored = getStoredConfig();
17
+ return { ...stored, apiUrl: resolveApiUrl(stored) };
18
+ }
19
+ function saveConfig(config) {
20
+ const dir = getConfigDir();
21
+ mkdirSync(dir, { recursive: true });
22
+ writeFileSync(join(dir, "config.json"), JSON.stringify(config, null, 2), {
23
+ mode: 420
24
+ });
25
+ }
26
+
27
+ export {
28
+ getConfigDir,
29
+ getStoredConfig,
30
+ getConfig,
31
+ saveConfig
32
+ };
@@ -1,25 +1,12 @@
1
1
  import {
2
- getValidCredentials
3
- } from "./chunk-EGWK6SRQ.js";
2
+ createCliCredentialProvider
3
+ } from "./chunk-4QZ7KD2Y.js";
4
4
  import {
5
5
  getConfig
6
- } from "./chunk-U73SABXK.js";
6
+ } from "./chunk-K4RAUZSD.js";
7
7
 
8
8
  // src/lib/api-client.ts
9
9
  import { ChainPatrolApiClient } from "@chainpatrol/sdk/api";
10
-
11
- // src/lib/credential-provider.ts
12
- function createCliCredentialProvider() {
13
- return () => {
14
- const envKey = process.env.CHAINPATROL_API_KEY;
15
- if (envKey && envKey.trim().length > 0) {
16
- return { kind: "api-key", value: envKey.trim() };
17
- }
18
- return { kind: "bearer", value: getValidCredentials().accessToken };
19
- };
20
- }
21
-
22
- // src/lib/api-client.ts
23
10
  import {
24
11
  DETECTION_CONFIDENCE_LEVELS,
25
12
  DETECTION_REPORTED_FILTERS,
@@ -0,0 +1,61 @@
1
+ // src/lib/version.ts
2
+ import { readFileSync } from "fs";
3
+ import { dirname, resolve } from "path";
4
+ import { fileURLToPath } from "url";
5
+ var PACKAGE_NAME = "@chainpatrol/cli";
6
+ var cached;
7
+ function getCliVersion() {
8
+ if (cached !== void 0) return cached;
9
+ cached = resolveCliVersion();
10
+ return cached;
11
+ }
12
+ function resolveCliVersion() {
13
+ try {
14
+ const here = dirname(fileURLToPath(import.meta.url));
15
+ const candidates = [
16
+ resolve(here, "..", "package.json"),
17
+ resolve(here, "..", "..", "package.json")
18
+ ];
19
+ for (const candidate of candidates) {
20
+ const version = tryReadVersion(candidate);
21
+ if (version) return version;
22
+ }
23
+ } catch {
24
+ }
25
+ return "0.0.0";
26
+ }
27
+ function tryReadVersion(path) {
28
+ try {
29
+ const raw = readFileSync(path, "utf-8");
30
+ const pkg = JSON.parse(raw);
31
+ if (pkg.name === PACKAGE_NAME && typeof pkg.version === "string") {
32
+ return pkg.version;
33
+ }
34
+ } catch {
35
+ }
36
+ return void 0;
37
+ }
38
+ function compareVersions(a, b) {
39
+ const parsed = (value) => {
40
+ const hyphenIndex = value.indexOf("-");
41
+ const main = hyphenIndex >= 0 ? value.slice(0, hyphenIndex) : value;
42
+ const pre = hyphenIndex >= 0 ? value.slice(hyphenIndex + 1) : "";
43
+ const parts = main.split(".").map((n) => Number.parseInt(n, 10) || 0);
44
+ while (parts.length < 3) parts.push(0);
45
+ return { parts, pre };
46
+ };
47
+ const va = parsed(a);
48
+ const vb = parsed(b);
49
+ for (let i = 0; i < 3; i += 1) {
50
+ if (va.parts[i] !== vb.parts[i]) return va.parts[i] - vb.parts[i];
51
+ }
52
+ if (va.pre === vb.pre) return 0;
53
+ if (va.pre === "") return 1;
54
+ if (vb.pre === "") return -1;
55
+ return va.pre < vb.pre ? -1 : 1;
56
+ }
57
+
58
+ export {
59
+ getCliVersion,
60
+ compareVersions
61
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getConfig,
3
3
  getConfigDir
4
- } from "./chunk-U73SABXK.js";
4
+ } from "./chunk-K4RAUZSD.js";
5
5
 
6
6
  // src/lib/auth.ts
7
7
  import {
@@ -1,10 +1,13 @@
1
+ import {
2
+ getCliVersion
3
+ } from "./chunk-OKIUEBUK.js";
1
4
  import {
2
5
  installCompletions,
3
6
  uninstallCompletions
4
7
  } from "./chunk-TI2HK3NM.js";
5
8
 
6
9
  // src/commands/setup-skill.ts
7
- import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, existsSync as existsSync2, readFileSync as readFileSync3, rmSync } from "fs";
10
+ import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, existsSync as existsSync2, readFileSync as readFileSync2, rmSync } from "fs";
8
11
  import { join as join2 } from "path";
9
12
  import { homedir as homedir2 } from "os";
10
13
  import { buildSkillContent, parseSkillVersion } from "@chainpatrol/sdk/skill";
@@ -122,63 +125,6 @@ function unregisterHookFromSettings() {
122
125
  return true;
123
126
  }
124
127
 
125
- // src/lib/version.ts
126
- import { readFileSync as readFileSync2 } from "fs";
127
- import { dirname as dirname2, resolve } from "path";
128
- import { fileURLToPath } from "url";
129
- var PACKAGE_NAME = "@chainpatrol/cli";
130
- var cached;
131
- function getCliVersion() {
132
- if (cached !== void 0) return cached;
133
- cached = resolveCliVersion();
134
- return cached;
135
- }
136
- function resolveCliVersion() {
137
- try {
138
- const here = dirname2(fileURLToPath(import.meta.url));
139
- const candidates = [
140
- resolve(here, "..", "package.json"),
141
- resolve(here, "..", "..", "package.json")
142
- ];
143
- for (const candidate of candidates) {
144
- const version = tryReadVersion(candidate);
145
- if (version) return version;
146
- }
147
- } catch {
148
- }
149
- return "0.0.0";
150
- }
151
- function tryReadVersion(path) {
152
- try {
153
- const raw = readFileSync2(path, "utf-8");
154
- const pkg = JSON.parse(raw);
155
- if (pkg.name === PACKAGE_NAME && typeof pkg.version === "string") {
156
- return pkg.version;
157
- }
158
- } catch {
159
- }
160
- return void 0;
161
- }
162
- function compareVersions(a, b) {
163
- const parsed = (value) => {
164
- const hyphenIndex = value.indexOf("-");
165
- const main = hyphenIndex >= 0 ? value.slice(0, hyphenIndex) : value;
166
- const pre = hyphenIndex >= 0 ? value.slice(hyphenIndex + 1) : "";
167
- const parts = main.split(".").map((n) => Number.parseInt(n, 10) || 0);
168
- while (parts.length < 3) parts.push(0);
169
- return { parts, pre };
170
- };
171
- const va = parsed(a);
172
- const vb = parsed(b);
173
- for (let i = 0; i < 3; i += 1) {
174
- if (va.parts[i] !== vb.parts[i]) return va.parts[i] - vb.parts[i];
175
- }
176
- if (va.pre === vb.pre) return 0;
177
- if (va.pre === "") return 1;
178
- if (vb.pre === "") return -1;
179
- return va.pre < vb.pre ? -1 : 1;
180
- }
181
-
182
128
  // src/commands/setup-skill.ts
183
129
  var SKILL_DIR = join2(homedir2(), ".claude", "skills", "chainpatrol");
184
130
  var SKILL_FILE = join2(SKILL_DIR, "SKILL.md");
@@ -191,7 +137,7 @@ function getBundledSkillContent() {
191
137
  function readInstalledSkillVersion() {
192
138
  if (!existsSync2(SKILL_FILE)) return void 0;
193
139
  try {
194
- const raw = readFileSync3(SKILL_FILE, "utf-8");
140
+ const raw = readFileSync2(SKILL_FILE, "utf-8");
195
141
  return parseSkillVersion(raw);
196
142
  } catch {
197
143
  return void 0;
@@ -214,7 +160,7 @@ var LOGO = `
214
160
  function setupSkill(options) {
215
161
  const skillContent = buildSkillContent(getCliVersion());
216
162
  const skillAlreadyExists = existsSync2(SKILL_FILE);
217
- const skillUpToDate = skillAlreadyExists && readFileSync3(SKILL_FILE, "utf-8") === skillContent;
163
+ const skillUpToDate = skillAlreadyExists && readFileSync2(SKILL_FILE, "utf-8") === skillContent;
218
164
  let skillStatus;
219
165
  if (!skillAlreadyExists) {
220
166
  mkdirSync2(SKILL_DIR, { recursive: true });
@@ -305,8 +251,6 @@ function uninstallSkill(options) {
305
251
  }
306
252
 
307
253
  export {
308
- getCliVersion,
309
- compareVersions,
310
254
  getBundledSkillVersion,
311
255
  getBundledSkillContent,
312
256
  readInstalledSkillVersion,