protogridctl 0.1.1 → 0.2.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/README.md +2 -1
- package/dist/api.d.ts +12 -56
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +13 -28
- package/dist/api.js.map +1 -1
- package/dist/args.d.ts +46 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +122 -0
- package/dist/args.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +38 -77
- package/dist/cli.js.map +1 -1
- package/dist/clients.d.ts +2 -1
- package/dist/clients.d.ts.map +1 -1
- package/dist/clients.js +44 -10
- package/dist/clients.js.map +1 -1
- package/dist/commands.d.ts +13 -11
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +93 -195
- package/dist/commands.js.map +1 -1
- package/dist/destinations.d.ts +40 -0
- package/dist/destinations.d.ts.map +1 -0
- package/dist/destinations.js +163 -0
- package/dist/destinations.js.map +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +1 -0
- package/dist/files.d.ts +0 -2
- package/dist/files.d.ts.map +1 -1
- package/dist/files.js +1 -3
- package/dist/files.js.map +1 -1
- package/dist/plan.d.ts +47 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +66 -0
- package/dist/plan.js.map +1 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@ Clients: `cursor`, `vscode`, `claude-code`, `claude-desktop`, `gemini`, `codex`,
|
|
|
13
13
|
- Keys and tokens are asked for without echo and written only to your client's config file. Nothing you type is sent to protogrid.
|
|
14
14
|
- Every other entry in the file is kept; the previous file stays as `<file>.bak`. A file with comments is never rewritten.
|
|
15
15
|
- `--scope project` writes the project's file, `--dry-run` shows the change and writes nothing, `remove` takes an entry out.
|
|
16
|
+
- `search --extensions skills` keeps servers that use every MCP extension named (`apps`, `skills`, `tasks`, `events`).
|
|
16
17
|
|
|
17
|
-
Node.js 20 or later
|
|
18
|
+
Node.js 20 or later and no account; its one dependency is protogrid's own [`@protogrid/sdk`](https://www.npmjs.com/package/@protogrid/sdk), which has none. Full guide: [docs.protogrid.dev/guides/install-cli](https://docs.protogrid.dev/guides/install-cli/).
|
|
18
19
|
|
|
19
20
|
MIT licensed.
|
package/dist/api.d.ts
CHANGED
|
@@ -1,63 +1,19 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The registry calls protogridctl makes, through @protogrid/sdk: public data, no account needed (an API key only
|
|
3
|
+
* raises limits). `Api` is the seam the tests fake; the SDK's client is the one real adapter.
|
|
4
|
+
*/
|
|
5
|
+
import { ProtogridClient, type ConnectionResponse, type GateResponse } from "@protogrid/sdk";
|
|
6
|
+
export { ProtogridError } from "@protogrid/sdk";
|
|
7
|
+
export type { ConnectionTarget, Extension, GateRule, GateRules, SearchResult } from "@protogrid/sdk";
|
|
2
8
|
export declare const DEFAULT_API = "https://api.protogrid.dev";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
content_type: "application/json" | "text/plain";
|
|
9
|
-
connection: unknown;
|
|
10
|
-
secrets: {
|
|
11
|
-
name: string;
|
|
12
|
-
where: string;
|
|
13
|
-
}[];
|
|
14
|
-
auth_type?: string;
|
|
15
|
-
human_steps?: string[];
|
|
16
|
-
}
|
|
17
|
-
export interface Gate {
|
|
18
|
-
server: string;
|
|
19
|
-
pass: boolean;
|
|
20
|
-
failed: {
|
|
21
|
-
rule: string;
|
|
22
|
-
detail: string;
|
|
23
|
-
}[];
|
|
24
|
-
quality: {
|
|
25
|
-
score: number | null;
|
|
26
|
-
label: string;
|
|
27
|
-
flags: string[];
|
|
28
|
-
};
|
|
29
|
-
trust: {
|
|
30
|
-
score: number | null;
|
|
31
|
-
flags: string[];
|
|
32
|
-
};
|
|
33
|
-
class: string;
|
|
34
|
-
owner_verified: boolean;
|
|
35
|
-
/** Charges per call: listed with prices in an x402 Bazaar, or declared by the server. */
|
|
36
|
-
payment?: "listed" | "declared" | null;
|
|
37
|
-
}
|
|
38
|
-
export interface SearchResult {
|
|
39
|
-
name: string;
|
|
40
|
-
title?: string | null;
|
|
41
|
-
description?: string | null;
|
|
42
|
-
connection_class?: string;
|
|
43
|
-
quality_score?: number | null;
|
|
44
|
-
quality_flags?: string[];
|
|
45
|
-
owner_verified?: boolean;
|
|
46
|
-
}
|
|
47
|
-
export declare class ApiError extends Error {
|
|
48
|
-
readonly status: number;
|
|
49
|
-
readonly code: string | null;
|
|
50
|
-
constructor(status: number, code: string | null, message: string);
|
|
51
|
-
}
|
|
52
|
-
export interface Api {
|
|
53
|
-
gate(name: string, rules: Record<string, string>): Promise<Gate>;
|
|
54
|
-
connection(name: string, target: string): Promise<Connection>;
|
|
55
|
-
search(q: string, limit: number): Promise<SearchResult[]>;
|
|
56
|
-
}
|
|
9
|
+
/** MCP extensions a server may use: apps (UI views), skills, tasks, events. */
|
|
10
|
+
export declare const EXTENSIONS: readonly ["apps", "skills", "tasks", "events"];
|
|
11
|
+
export type Connection = ConnectionResponse;
|
|
12
|
+
export type Gate = GateResponse;
|
|
13
|
+
export type Api = Pick<ProtogridClient, "gate" | "getConnection" | "search">;
|
|
57
14
|
export declare function createApi(opts: {
|
|
58
15
|
baseUrl?: string | undefined;
|
|
59
16
|
apiKey?: string | undefined;
|
|
60
|
-
fetch?: typeof fetch;
|
|
61
17
|
version: string;
|
|
62
18
|
}): Api;
|
|
63
19
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE7F,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAErG,eAAO,MAAM,WAAW,8BAA8B,CAAC;AAEvD,+EAA+E;AAC/E,eAAO,MAAM,UAAU,gDAAiD,CAAC;AAEzE,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAC5C,MAAM,MAAM,IAAI,GAAG,YAAY,CAAC;AAChC,MAAM,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,eAAe,GAAG,QAAQ,CAAC,CAAC;AAE7E,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,GAAG,CAMnH"}
|
package/dist/api.js
CHANGED
|
@@ -1,32 +1,17 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* The registry calls protogridctl makes, through @protogrid/sdk: public data, no account needed (an API key only
|
|
3
|
+
* raises limits). `Api` is the seam the tests fake; the SDK's client is the one real adapter.
|
|
4
|
+
*/
|
|
5
|
+
import { ProtogridClient } from "@protogrid/sdk";
|
|
6
|
+
export { ProtogridError } from "@protogrid/sdk";
|
|
2
7
|
export const DEFAULT_API = "https://api.protogrid.dev";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
code;
|
|
6
|
-
constructor(status, code, message) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.status = status;
|
|
9
|
-
this.code = code;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
8
|
+
/** MCP extensions a server may use: apps (UI views), skills, tasks, events. */
|
|
9
|
+
export const EXTENSIONS = ["apps", "skills", "tasks", "events"];
|
|
12
10
|
export function createApi(opts) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
headers["x-api-key"] = opts.apiKey;
|
|
19
|
-
const res = await f(`${base}${path}`, { headers });
|
|
20
|
-
const body = (await res.json().catch(() => null));
|
|
21
|
-
if (!res.ok)
|
|
22
|
-
throw new ApiError(res.status, typeof body?.["error"] === "string" ? body["error"] : null, typeof body?.["message"] === "string" ? body["message"] : `HTTP ${res.status}`);
|
|
23
|
-
return body;
|
|
24
|
-
};
|
|
25
|
-
const enc = encodeURIComponent;
|
|
26
|
-
return {
|
|
27
|
-
gate: (name, rules) => get(`/v1/servers/${enc(name)}/gate?${new URLSearchParams(rules)}`),
|
|
28
|
-
connection: (name, target) => get(`/v1/servers/${enc(name)}/connection?target=${enc(target)}`),
|
|
29
|
-
search: async (q, limit) => (await get(`/v1/search?${new URLSearchParams({ q, limit: String(limit) })}`)).results,
|
|
30
|
-
};
|
|
11
|
+
return new ProtogridClient({
|
|
12
|
+
baseUrl: opts.baseUrl ?? DEFAULT_API,
|
|
13
|
+
apiKey: opts.apiKey,
|
|
14
|
+
userAgent: `protogridctl/${opts.version}`,
|
|
15
|
+
});
|
|
31
16
|
}
|
|
32
17
|
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,eAAe,EAA8C,MAAM,gBAAgB,CAAC;AAE7F,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,MAAM,CAAC,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAEvD,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AAMzE,MAAM,UAAU,SAAS,CAAC,IAAoF;IAC5G,OAAO,IAAI,eAAe,CAAC;QACzB,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,WAAW;QACpC,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,SAAS,EAAE,gBAAgB,IAAI,CAAC,OAAO,EAAE;KAC1C,CAAC,CAAC;AACL,CAAC"}
|
package/dist/args.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command line: each command declares its own options and checks their values, so an option another command
|
|
3
|
+
* takes is refused (exit 2) instead of ignored. Pure: argv in, an invocation or a CliError out.
|
|
4
|
+
*/
|
|
5
|
+
import { type ParseArgsConfig } from "node:util";
|
|
6
|
+
import { type Extension } from "./api.js";
|
|
7
|
+
import { type Scope } from "./clients.js";
|
|
8
|
+
import type { AddOptions } from "./commands.js";
|
|
9
|
+
export type Invocation = {
|
|
10
|
+
command: "help";
|
|
11
|
+
code: 0 | 2;
|
|
12
|
+
} | {
|
|
13
|
+
command: "version";
|
|
14
|
+
} | {
|
|
15
|
+
command: "search";
|
|
16
|
+
q: string;
|
|
17
|
+
limit: number;
|
|
18
|
+
extensions: Extension[];
|
|
19
|
+
} | {
|
|
20
|
+
command: "add";
|
|
21
|
+
name: string;
|
|
22
|
+
options: AddOptions;
|
|
23
|
+
} | {
|
|
24
|
+
command: "remove";
|
|
25
|
+
name: string;
|
|
26
|
+
options: {
|
|
27
|
+
client: string;
|
|
28
|
+
scope: Scope;
|
|
29
|
+
dryRun: boolean;
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
command: "clients";
|
|
33
|
+
};
|
|
34
|
+
type Options = NonNullable<ParseArgsConfig["options"]>;
|
|
35
|
+
type Values = Record<string, string | boolean | undefined>;
|
|
36
|
+
interface CommandSpec {
|
|
37
|
+
usage: string;
|
|
38
|
+
options: Options;
|
|
39
|
+
/** The invocation from the command's own positionals and values; throws CliError(…, 2) on a bad value. */
|
|
40
|
+
read(rest: string[], v: Values): Invocation;
|
|
41
|
+
}
|
|
42
|
+
export declare const COMMANDS: Record<"search" | "add" | "remove" | "clients", CommandSpec>;
|
|
43
|
+
export declare function parseInvocation(argv: string[]): Invocation;
|
|
44
|
+
export declare const usageLines: () => string[];
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAW,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,MAAM,MAAM,UAAU,GAClB;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAA;CAAE,GAChC;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GACtB;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,GACxE;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,GACrD;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,GAC/F;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC;AAE3B,KAAK,OAAO,GAAG,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;AACvD,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;AAM3D,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,0GAA0G;IAC1G,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CAC7C;AA4BD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,EAAE,WAAW,CAuDjF,CAAC;AASF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAyB1D;AAED,eAAO,MAAM,UAAU,gBAAwE,CAAC"}
|
package/dist/args.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The command line: each command declares its own options and checks their values, so an option another command
|
|
3
|
+
* takes is refused (exit 2) instead of ignored. Pure: argv in, an invocation or a CliError out.
|
|
4
|
+
*/
|
|
5
|
+
import { parseArgs } from "node:util";
|
|
6
|
+
import { EXTENSIONS } from "./api.js";
|
|
7
|
+
import { CLIENTS } from "./clients.js";
|
|
8
|
+
import { CliError } from "./errors.js";
|
|
9
|
+
const client = { client: { type: "string", short: "c" } };
|
|
10
|
+
const scope = { scope: { type: "string", default: "user" } };
|
|
11
|
+
const dryRun = { "dry-run": { type: "boolean", default: false } };
|
|
12
|
+
const fail = (message) => {
|
|
13
|
+
throw new CliError(message, 2);
|
|
14
|
+
};
|
|
15
|
+
const wholeNumber = (raw, flag, min, max) => {
|
|
16
|
+
const n = Number(raw);
|
|
17
|
+
return Number.isInteger(n) && n >= min && n <= max ? n : fail(`${flag} is a whole number from ${min} to ${max}`);
|
|
18
|
+
};
|
|
19
|
+
const oneName = (rest) => rest.length === 1
|
|
20
|
+
? rest[0]
|
|
21
|
+
: fail("give one server name, such as io.github.owner/server; find one with: protogridctl search <words>");
|
|
22
|
+
const needClient = (v) => typeof v["client"] === "string"
|
|
23
|
+
? v["client"]
|
|
24
|
+
: fail(`--client is required: one of ${CLIENTS.map((c) => c.id).join(", ")}`);
|
|
25
|
+
const readScope = (v) => v["scope"] === "user" || v["scope"] === "project"
|
|
26
|
+
? v["scope"]
|
|
27
|
+
: fail(`--scope is user or project, not "${String(v["scope"])}"`);
|
|
28
|
+
const known = (e) => EXTENSIONS.includes(e);
|
|
29
|
+
export const COMMANDS = {
|
|
30
|
+
search: {
|
|
31
|
+
usage: "search <words...> [--limit N] [--extensions apps,skills,tasks,events]",
|
|
32
|
+
options: { limit: { type: "string", default: "10" }, extensions: { type: "string" } },
|
|
33
|
+
read: (rest, v) => {
|
|
34
|
+
if (rest.length === 0)
|
|
35
|
+
fail("search needs some words, such as: protogridctl search send email");
|
|
36
|
+
const raw = v["extensions"];
|
|
37
|
+
const extensions = typeof raw === "string" ? raw.split(",").map((e) => e.trim()) : [];
|
|
38
|
+
if (typeof raw === "string" && (extensions.length === 0 || !extensions.every(known)))
|
|
39
|
+
fail(`--extensions takes one or more of ${EXTENSIONS.join(", ")}, separated by commas`);
|
|
40
|
+
return {
|
|
41
|
+
command: "search",
|
|
42
|
+
q: rest.join(" "),
|
|
43
|
+
limit: wholeNumber(String(v["limit"]), "--limit", 1, 50),
|
|
44
|
+
extensions: extensions,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
add: {
|
|
49
|
+
usage: "add <server> --client <client> [--scope user|project] [--yes] [--no-prompt] [--min-quality N] [--dry-run]",
|
|
50
|
+
options: {
|
|
51
|
+
...client,
|
|
52
|
+
...scope,
|
|
53
|
+
yes: { type: "boolean", short: "y", default: false },
|
|
54
|
+
"no-prompt": { type: "boolean", default: false },
|
|
55
|
+
"min-quality": { type: "string" },
|
|
56
|
+
...dryRun,
|
|
57
|
+
},
|
|
58
|
+
read: (rest, v) => {
|
|
59
|
+
const min = v["min-quality"];
|
|
60
|
+
const options = {
|
|
61
|
+
client: needClient(v),
|
|
62
|
+
scope: readScope(v),
|
|
63
|
+
yes: v["yes"] === true,
|
|
64
|
+
prompt: v["no-prompt"] !== true,
|
|
65
|
+
minQuality: typeof min === "string" ? wholeNumber(min, "--min-quality", 0, 100) : undefined,
|
|
66
|
+
dryRun: v["dry-run"] === true,
|
|
67
|
+
};
|
|
68
|
+
return { command: "add", name: oneName(rest), options };
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
remove: {
|
|
72
|
+
usage: "remove <server> --client <client> [--scope user|project] [--dry-run]",
|
|
73
|
+
options: { ...client, ...scope, ...dryRun },
|
|
74
|
+
read: (rest, v) => ({
|
|
75
|
+
command: "remove",
|
|
76
|
+
name: oneName(rest),
|
|
77
|
+
options: { client: needClient(v), scope: readScope(v), dryRun: v["dry-run"] === true },
|
|
78
|
+
}),
|
|
79
|
+
},
|
|
80
|
+
clients: {
|
|
81
|
+
usage: "clients",
|
|
82
|
+
options: {},
|
|
83
|
+
read: (rest) => (rest.length > 0 ? fail("clients takes no arguments") : { command: "clients" }),
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
const GLOBAL = { help: { type: "boolean", short: "h" }, version: { type: "boolean", short: "v" } };
|
|
87
|
+
const flags = (o) => Object.entries(o)
|
|
88
|
+
.map(([name, spec]) => `--${name}${spec.short ? ` (-${spec.short})` : ""}`)
|
|
89
|
+
.join(", ");
|
|
90
|
+
export function parseInvocation(argv) {
|
|
91
|
+
const [first, ...after] = argv;
|
|
92
|
+
// Help and version alone, or before anything else.
|
|
93
|
+
if (first === undefined)
|
|
94
|
+
return { command: "help", code: 2 };
|
|
95
|
+
if (first === "-h" || first === "--help")
|
|
96
|
+
return { command: "help", code: 0 };
|
|
97
|
+
if (first === "-v" || first === "--version")
|
|
98
|
+
return { command: "version" };
|
|
99
|
+
if (first.startsWith("-"))
|
|
100
|
+
fail(`start with a command (${Object.keys(COMMANDS).join(", ")}), then its options`);
|
|
101
|
+
const name = first;
|
|
102
|
+
const spec = Object.hasOwn(COMMANDS, name) ? COMMANDS[name] : fail(`unknown command "${first}"`);
|
|
103
|
+
let parsed;
|
|
104
|
+
try {
|
|
105
|
+
parsed = parseArgs({ args: after, allowPositionals: true, strict: true, options: { ...GLOBAL, ...spec.options } });
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
const code = e.code;
|
|
109
|
+
const flag = /'([^']+)'/.exec(e.message)?.[1];
|
|
110
|
+
if (code === "ERR_PARSE_ARGS_UNKNOWN_OPTION")
|
|
111
|
+
fail(`${flag ?? "that option"} does not apply to ${first}; ${first} takes ${flags(spec.options) || "no options"}`);
|
|
112
|
+
fail(e.message);
|
|
113
|
+
}
|
|
114
|
+
const { values, positionals } = parsed;
|
|
115
|
+
if (values.help)
|
|
116
|
+
return { command: "help", code: 0 };
|
|
117
|
+
if (values.version)
|
|
118
|
+
return { command: "version" };
|
|
119
|
+
return spec.read(positionals, values);
|
|
120
|
+
}
|
|
121
|
+
export const usageLines = () => Object.values(COMMANDS).map((c) => ` protogridctl ${c.usage}`);
|
|
122
|
+
//# sourceMappingURL=args.js.map
|
package/dist/args.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAwB,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAkB,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,OAAO,EAAc,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAavC,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAA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C,CAAC;QACzD,IAAI,IAAI,KAAK,+BAA+B;YAC1C,IAAI,CACF,GAAG,IAAI,IAAI,aAAa,sBAAsB,KAAK,KAAK,KAAK,UAAU,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,YAAY,EAAE,CAC7G,CAAC;QACJ,IAAI,CAAE,CAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,MAAO,CAAC;IACxC,IAAI,MAAM,CAAC,IAAI;QAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IACrD,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;IAClD,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAgB,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC"}
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAOA,OAAO,EAA8C,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAOA,OAAO,EAA8C,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AAoBtF,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAsDhF"}
|
package/dist/cli.js
CHANGED
|
@@ -2,19 +2,17 @@
|
|
|
2
2
|
/** protogridctl: find MCP servers in the protogrid registry and add them to an MCP client, checked first. */
|
|
3
3
|
import { spawnSync } from "node:child_process";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
|
-
import { parseArgs } from "node:util";
|
|
6
5
|
import { createApi } from "./api.js";
|
|
6
|
+
import { parseInvocation, usageLines } from "./args.js";
|
|
7
7
|
import { CLIENTS, envFromProcess } from "./clients.js";
|
|
8
8
|
import { add, CliError, listClients, remove, search } from "./commands.js";
|
|
9
9
|
import { terminalPrompter } from "./prompt.js";
|
|
10
|
-
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"))
|
|
10
|
+
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"))
|
|
11
|
+
.version;
|
|
11
12
|
const HELP = `protogridctl ${VERSION}: add MCP servers to your client from the protogrid registry, checked first.
|
|
12
13
|
|
|
13
14
|
Usage:
|
|
14
|
-
|
|
15
|
-
protogridctl add <server> --client <client> [--scope user|project] [--yes] [--no-prompt] [--min-quality N] [--dry-run]
|
|
16
|
-
protogridctl remove <server> --client <client> [--scope user|project] [--dry-run]
|
|
17
|
-
protogridctl clients
|
|
15
|
+
${usageLines().join("\n")}
|
|
18
16
|
|
|
19
17
|
Clients: ${CLIENTS.map((c) => c.id).join(", ")}
|
|
20
18
|
|
|
@@ -25,91 +23,54 @@ to your client's config file; nothing you type is sent to protogrid. The previou
|
|
|
25
23
|
Environment: PROTOGRID_API_URL (default https://api.protogrid.dev), PROTOGRID_API_KEY (optional, raises limits).
|
|
26
24
|
Docs: https://docs.protogrid.dev/guides/install-cli/`;
|
|
27
25
|
export async function main(argv, deps) {
|
|
28
|
-
|
|
26
|
+
const out = deps?.out ?? ((line) => void process.stdout.write(`${line}\n`));
|
|
27
|
+
const err = deps?.err ?? ((line) => void process.stderr.write(`${line}\n`));
|
|
29
28
|
try {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return out(HELP), command || v.help ? 0 : 2;
|
|
56
|
-
const d = {
|
|
57
|
-
api: deps?.api ?? createApi({ baseUrl: process.env["PROTOGRID_API_URL"], apiKey: process.env["PROTOGRID_API_KEY"], version: VERSION }),
|
|
58
|
-
prompter: deps?.prompter ?? terminalPrompter(),
|
|
59
|
-
env: deps?.env ?? envFromProcess(),
|
|
60
|
-
out,
|
|
61
|
-
runClaude: deps?.runClaude ??
|
|
62
|
-
((args) => {
|
|
63
|
-
const r = spawnSync("claude", args, { encoding: "utf8", shell: false });
|
|
64
|
-
return { status: r.status, notFound: r.error?.code === "ENOENT", stderr: r.stderr ?? "" };
|
|
65
|
-
}),
|
|
66
|
-
};
|
|
67
|
-
const scope = v.scope === "project" ? "project" : v.scope === "user" ? "user" : null;
|
|
68
|
-
try {
|
|
69
|
-
if (!scope)
|
|
70
|
-
throw new CliError(`--scope is user or project, not "${v.scope}"`, 2);
|
|
71
|
-
const needClient = () => {
|
|
72
|
-
if (!v.client)
|
|
73
|
-
throw new CliError(`--client is required: one of ${CLIENTS.map((c) => c.id).join(", ")}`, 2);
|
|
74
|
-
return v.client;
|
|
75
|
-
};
|
|
76
|
-
const needName = () => {
|
|
77
|
-
if (rest.length !== 1)
|
|
78
|
-
throw new CliError(`give one server name, such as io.github.owner/server; find one with: protogridctl search <words>`, 2);
|
|
79
|
-
return rest[0];
|
|
29
|
+
const inv = parseInvocation(argv);
|
|
30
|
+
if (inv.command === "version")
|
|
31
|
+
return (out(VERSION), 0);
|
|
32
|
+
if (inv.command === "help")
|
|
33
|
+
return (inv.code === 0 ? out(HELP) : err(HELP), inv.code);
|
|
34
|
+
const d = {
|
|
35
|
+
api: deps?.api ??
|
|
36
|
+
createApi({
|
|
37
|
+
baseUrl: process.env["PROTOGRID_API_URL"],
|
|
38
|
+
apiKey: process.env["PROTOGRID_API_KEY"],
|
|
39
|
+
version: VERSION,
|
|
40
|
+
}),
|
|
41
|
+
prompter: deps?.prompter ?? terminalPrompter(),
|
|
42
|
+
env: deps?.env ?? envFromProcess(),
|
|
43
|
+
out,
|
|
44
|
+
err,
|
|
45
|
+
runClaude: deps?.runClaude ??
|
|
46
|
+
((args) => {
|
|
47
|
+
const r = spawnSync("claude", args, { encoding: "utf8", shell: false });
|
|
48
|
+
return {
|
|
49
|
+
status: r.status,
|
|
50
|
+
notFound: r.error?.code === "ENOENT",
|
|
51
|
+
stderr: r.stderr ?? "",
|
|
52
|
+
};
|
|
53
|
+
}),
|
|
80
54
|
};
|
|
81
|
-
switch (command) {
|
|
82
|
-
case "search":
|
|
83
|
-
|
|
84
|
-
throw new CliError("search needs some words, such as: protogridctl search send email", 2);
|
|
85
|
-
const limit = Number(v.limit);
|
|
86
|
-
if (!Number.isInteger(limit) || limit < 1 || limit > 50)
|
|
87
|
-
throw new CliError("--limit is a whole number from 1 to 50", 2);
|
|
88
|
-
await search(rest.join(" "), limit, d);
|
|
55
|
+
switch (inv.command) {
|
|
56
|
+
case "search":
|
|
57
|
+
await search(inv.q, inv.limit, d, inv.extensions);
|
|
89
58
|
break;
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const min = v["min-quality"];
|
|
93
|
-
const minQuality = min == null ? undefined : Number(min);
|
|
94
|
-
if (minQuality != null && (!Number.isInteger(minQuality) || minQuality < 0 || minQuality > 100))
|
|
95
|
-
throw new CliError("--min-quality is a whole number from 0 to 100", 2);
|
|
96
|
-
await add(needName(), { client: needClient(), scope, yes: v.yes, prompt: !v["no-prompt"], minQuality, dryRun: v["dry-run"] }, d);
|
|
59
|
+
case "add":
|
|
60
|
+
await add(inv.name, inv.options, d);
|
|
97
61
|
break;
|
|
98
|
-
}
|
|
99
62
|
case "remove":
|
|
100
|
-
await remove(
|
|
63
|
+
await remove(inv.name, inv.options, d);
|
|
101
64
|
break;
|
|
102
65
|
case "clients":
|
|
103
66
|
listClients(d);
|
|
104
67
|
break;
|
|
105
|
-
default:
|
|
106
|
-
throw new CliError(`unknown command "${command}"\n\n${HELP}`, 2);
|
|
107
68
|
}
|
|
108
69
|
return 0;
|
|
109
70
|
}
|
|
110
71
|
catch (e) {
|
|
111
72
|
if (e instanceof CliError) {
|
|
112
|
-
|
|
73
|
+
err(`protogridctl: ${e.message}${e.code === 2 ? "\nRun protogridctl --help for the commands and their options." : ""}`);
|
|
113
74
|
return e.code;
|
|
114
75
|
}
|
|
115
76
|
throw e;
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,6GAA6G;AAC7G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,6GAA6G;AAC7G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAa,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAA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AM;QACV,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,QAAQ,EAAE,CAAC;YAC1B,GAAG,CACD,iBAAiB,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,+DAA+D,CAAC,CAAC,CAAC,EAAE,EAAE,CACnH,CAAC;YACF,OAAO,CAAC,CAAC,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AACjF,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;IAC/E,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAC9B,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5B,CAAC,CAAC,EAAE,EAAE;QACJ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAkB,CAAW,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC;QACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/clients.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ConnectionTarget } from "./api.js";
|
|
1
2
|
export type Scope = "user" | "project";
|
|
2
3
|
/** Where the person's files are; injected so tests never touch the real home directory. */
|
|
3
4
|
export interface Env {
|
|
@@ -32,7 +33,7 @@ export interface ClientSpec {
|
|
|
32
33
|
id: string;
|
|
33
34
|
label: string;
|
|
34
35
|
/** The `target` of `GET /v1/servers/{name}/connection`. */
|
|
35
|
-
target:
|
|
36
|
+
target: Exclude<ConnectionTarget, "claude-code-cli">;
|
|
36
37
|
/** Where it goes for each scope, or null when the client has no such scope. */
|
|
37
38
|
locate(env: Env, scope: Scope): Location | null;
|
|
38
39
|
/** Claude Desktop reads only local servers from its file; remote ones are added as connectors in the app. */
|
package/dist/clients.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../src/clients.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../src/clients.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvC,2FAA2F;AAC3F,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,MAAM,MAAM;AAChB,oDAAoD;AAClD,MAAM;AACR,yEAAyE;GACvE,MAAM;AACR,gEAAgE;GAC9D,SAAS;AACX,oDAAoD;GAClD,OAAO,CAAC;AAEZ,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,IAAI,CAAC,EAAE,M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