@chainpatrol/cli 1.9.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.
- package/CHANGELOG.md +34 -0
- package/dist/{breakdown-2HAZ2MX5.js → breakdown-BLCYJP7O.js} +4 -3
- package/dist/{check-5LJI7N5I.js → check-2IFMTAIU.js} +4 -3
- package/dist/chunk-4QZ7KD2Y.js +18 -0
- package/dist/{chunk-GGBG2R63.js → chunk-BSWGLZDK.js} +1 -1
- package/dist/{chunk-FPCN4SNK.js → chunk-CABRZEYB.js} +1 -1
- package/dist/chunk-K4RAUZSD.js +32 -0
- package/dist/{chunk-322AVMUH.js → chunk-NSRQ62C4.js} +3 -16
- package/dist/chunk-OKIUEBUK.js +61 -0
- package/dist/{chunk-EGWK6SRQ.js → chunk-ORAY4KMA.js} +1 -1
- package/dist/{chunk-LE5ZOOUI.js → chunk-TGIVCSKT.js} +6 -62
- package/dist/cli.js +85 -53
- package/dist/{config-Z3TASRME.js → config-IKTL6KVW.js} +3 -1
- package/dist/{configs-update-N7ZIWWKQ.js → configs-update-XUN4X4T2.js} +4 -3
- package/dist/{create-4ZJ7DXHX.js → create-ILSWAUVI.js} +4 -3
- package/dist/{drift-BGWNH6QE.js → drift-DPYW7LYN.js} +4 -3
- package/dist/{found-QOARB5G2.js → found-YLTMVPBZ.js} +4 -3
- package/dist/{get-ON5JOCV7.js → get-NDEY54AO.js} +4 -3
- package/dist/{healthcheck-34LQTSVZ.js → healthcheck-SYZQ2ILK.js} +4 -3
- package/dist/{list-AG6LWNMN.js → list-2H2CV3JJ.js} +4 -3
- package/dist/{list-MHOHKFXT.js → list-4THJBDSU.js} +8 -4
- package/dist/{list-JG5ARDTR.js → list-FUQK3TIN.js} +5 -4
- package/dist/{list-UXYGISAK.js → list-GTN2HNGZ.js} +4 -3
- package/dist/{list-DJFIKDY6.js → list-H4RCDI6Q.js} +4 -3
- package/dist/{list-PAJBOVN2.js → list-LWB5JQAY.js} +4 -3
- package/dist/{list-6CAKS43I.js → list-PV5GY2DY.js} +4 -3
- package/dist/{list-W6CF25ZS.js → list-Q5K4RMM4.js} +4 -3
- package/dist/{list-UPY6PHY4.js → list-RUIQIVEA.js} +4 -3
- package/dist/{list-5TKOWBC4.js → list-VHDU3XMN.js} +4 -3
- package/dist/{list-SJFJT4V3.js → list-WYC4ZP7X.js} +4 -3
- package/dist/{list-IVFZGLKN.js → list-YFBZVQWK.js} +4 -3
- package/dist/{list-json-ZR3XOQPJ.js → list-json-B4X74BTZ.js} +4 -3
- package/dist/{login-2NRI3ECY.js → login-H2G6RBLL.js} +3 -3
- package/dist/{login-json-HOCNSQQ7.js → login-json-5DVIMAO2.js} +3 -3
- package/dist/{login-plain-6ZJF5KA7.js → login-plain-PUWGRRYT.js} +3 -3
- package/dist/{logout-T6Q4IVPU.js → logout-332KFFNS.js} +2 -2
- package/dist/{logout-json-ACXBI6PN.js → logout-json-VMGXQQS2.js} +2 -2
- package/dist/mcp-ITEWOAOR.js +46 -0
- package/dist/{organization-SSCPM7XN.js → organization-KANXTARX.js} +4 -3
- package/dist/{review-7A7WV73T.js → review-5J3EQRCB.js} +4 -3
- package/dist/{run-LZZOV4HG.js → run-FDZWPY4W.js} +4 -3
- package/dist/{run-AIYPHWFJ.js → run-JBQ43OW6.js} +4 -3
- package/dist/{run-YP4O5VXZ.js → run-XWM67MBV.js} +5 -4
- package/dist/{search-OGGKNPUJ.js → search-A75YUJFI.js} +4 -3
- package/dist/{search-IWS42COG.js → search-DRTTZJJP.js} +4 -3
- package/dist/{setup-skill-ESJ4HIKR.js → setup-skill-TVJJD6NC.js} +2 -1
- package/dist/{snapshot-TLSOPK7C.js → snapshot-2IT4KG4F.js} +4 -3
- package/dist/{summary-XA3PVJIW.js → summary-A24TNQNR.js} +4 -3
- package/dist/{takedown-time-ARGVSPL6.js → takedown-time-HB3J2FTZ.js} +4 -3
- package/dist/{takedown-time-trend-LL3ZCCSD.js → takedown-time-trend-KYPA3W3U.js} +4 -3
- package/dist/{validate-WB5367QN.js → validate-FOZCI7HX.js} +4 -3
- package/dist/{whoami-YE3V6I65.js → whoami-DSXNLG3B.js} +4 -3
- package/package.json +4 -2
- package/dist/chunk-U73SABXK.js +0 -46
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
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
|
+
|
|
24
|
+
## 1.10.0
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- f65141b: Allow listing inactive organizations: `orgs list --subscription-status INACTIVE` (and the `subscriptionStatus` filter on `/user/orgs` and `/organization/metrics`) now accepts `INACTIVE`. Unfiltered calls are unchanged and still return only the live statuses.
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [38025fe]
|
|
33
|
+
- Updated dependencies [f65141b]
|
|
34
|
+
- Updated dependencies [d6124a4]
|
|
35
|
+
- @chainpatrol/sdk@1.10.0
|
|
36
|
+
|
|
3
37
|
## 1.9.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
|
@@ -7,10 +7,11 @@ import {
|
|
|
7
7
|
} from "./chunk-VFT3TD3E.js";
|
|
8
8
|
import {
|
|
9
9
|
createApiClient
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NSRQ62C4.js";
|
|
11
|
+
import "./chunk-4QZ7KD2Y.js";
|
|
11
12
|
import "./chunk-TFCNKBRC.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
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-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
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
|
+
};
|
|
@@ -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
|
-
|
|
3
|
-
} from "./chunk-
|
|
2
|
+
createCliCredentialProvider
|
|
3
|
+
} from "./chunk-4QZ7KD2Y.js";
|
|
4
4
|
import {
|
|
5
5
|
getConfig
|
|
6
|
-
} from "./chunk-
|
|
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,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
|
|
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 =
|
|
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 &&
|
|
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,
|