@intelligentelectron/pcb-lens 1.3.0 → 1.4.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 +19 -1
- package/README.md +113 -63
- package/dist/cli/args.d.ts +16 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +29 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/commands.d.ts +7 -1
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +47 -12
- package/dist/cli/commands.js.map +1 -1
- package/dist/cli/query.d.ts +68 -0
- package/dist/cli/query.d.ts.map +1 -0
- package/dist/cli/query.js +213 -0
- package/dist/cli/query.js.map +1 -0
- package/dist/cli/skill.d.ts +18 -0
- package/dist/cli/skill.d.ts.map +1 -0
- package/dist/cli/skill.js +127 -0
- package/dist/cli/skill.js.map +1 -0
- package/dist/cli/updater.d.ts +10 -2
- package/dist/cli/updater.d.ts.map +1 -1
- package/dist/cli/updater.js +31 -19
- package/dist/cli/updater.js.map +1 -1
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.d.ts.map +1 -1
- package/dist/cli/version.js +1 -0
- package/dist/cli/version.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +6 -13
- package/dist/server.js.map +1 -1
- package/dist/tools/export-cadence-constraints.d.ts +5 -2
- package/dist/tools/export-cadence-constraints.d.ts.map +1 -1
- package/dist/tools/export-cadence-constraints.js +14 -17
- package/dist/tools/export-cadence-constraints.js.map +1 -1
- package/dist/tools/export-cadence-ipc2581.d.ts +9 -2
- package/dist/tools/export-cadence-ipc2581.d.ts.map +1 -1
- package/dist/tools/export-cadence-ipc2581.js +18 -21
- package/dist/tools/export-cadence-ipc2581.js.map +1 -1
- package/dist/tools/get-constraints.d.ts +5 -2
- package/dist/tools/get-constraints.d.ts.map +1 -1
- package/dist/tools/get-constraints.js +14 -17
- package/dist/tools/get-constraints.js.map +1 -1
- package/dist/tools/get-pcb-component.d.ts +9 -2
- package/dist/tools/get-pcb-component.d.ts.map +1 -1
- package/dist/tools/get-pcb-component.js +16 -20
- package/dist/tools/get-pcb-component.js.map +1 -1
- package/dist/tools/get-pcb-metadata.d.ts +4 -2
- package/dist/tools/get-pcb-metadata.d.ts.map +1 -1
- package/dist/tools/get-pcb-metadata.js +11 -13
- package/dist/tools/get-pcb-metadata.js.map +1 -1
- package/dist/tools/get-pcb-net.d.ts +9 -2
- package/dist/tools/get-pcb-net.d.ts.map +1 -1
- package/dist/tools/get-pcb-net.js +18 -20
- package/dist/tools/get-pcb-net.js.map +1 -1
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +20 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +15 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +7 -0
- package/dist/tools/registry.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The query command line: every registry tool as a subcommand under its MCP
|
|
3
|
+
* name, with flags named as its schema's arguments, which the MCP server
|
|
4
|
+
* registers too.
|
|
5
|
+
*
|
|
6
|
+
* pcb-lens get_pcb_net board.xml --pattern '^DDR_D'
|
|
7
|
+
* pcb-lens get_constraints --file board.brd --section BrdStackup
|
|
8
|
+
*
|
|
9
|
+
* The flags are built from each tool's schema, so the command line takes the
|
|
10
|
+
* same arguments as the MCP tool and applies the same defaults. A string or
|
|
11
|
+
* number flag takes the next token or `=value`; a value starting with a dash
|
|
12
|
+
* needs `=`. A boolean flag alone means true, and takes `true` or `false` after
|
|
13
|
+
* it or after `=`. An array flag repeats. The file the tool reads (`file` or
|
|
14
|
+
* `board`) may also come first, as a positional argument.
|
|
15
|
+
*
|
|
16
|
+
* The result is the tool's JSON on stdout, indented on a terminal and compact
|
|
17
|
+
* otherwise. A result with an `error` field exits 1; a usage error prints to
|
|
18
|
+
* stderr with the tool's usage line and exits 2.
|
|
19
|
+
*/
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
import { BINARY_NAME } from "./version.js";
|
|
22
|
+
import { TOOLS, findTool } from "../tools/index.js";
|
|
23
|
+
import { isErrorResult } from "../tools/lib/types.js";
|
|
24
|
+
/** A tool's flags, in its schema's order, from the schema's input JSON Schema. */
|
|
25
|
+
export const flagsOf = (tool) => {
|
|
26
|
+
const schema = z.toJSONSchema(z.object(tool.inputSchema), { io: "input" });
|
|
27
|
+
const required = new Set(schema.required ?? []);
|
|
28
|
+
return Object.entries(schema.properties ?? {}).map(([name, property]) => ({
|
|
29
|
+
name,
|
|
30
|
+
kind: property.type === "array"
|
|
31
|
+
? "array"
|
|
32
|
+
: property.type === "boolean"
|
|
33
|
+
? "boolean"
|
|
34
|
+
: property.type === "integer" || property.type === "number"
|
|
35
|
+
? "number"
|
|
36
|
+
: "string",
|
|
37
|
+
required: required.has(name),
|
|
38
|
+
...(property.description !== undefined ? { description: property.description } : {}),
|
|
39
|
+
...(property.default !== undefined ? { default: property.default } : {}),
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
/** The argument naming the file a tool reads, which may come first without its flag. */
|
|
43
|
+
export const positionalOf = (tool) => ["file", "board"].find((name) => name in tool.inputSchema);
|
|
44
|
+
const BOOLEAN_WORDS = { true: true, false: false };
|
|
45
|
+
/** A number in the form a person types: an optional sign, digits, an optional fraction. */
|
|
46
|
+
const NUMBER = /^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i;
|
|
47
|
+
/**
|
|
48
|
+
* Parse the tokens after a tool's name. Errors name the flag and say how to
|
|
49
|
+
* write it; they are usage errors, and nothing runs.
|
|
50
|
+
*/
|
|
51
|
+
export const parseQueryArgs = (tool, tokens) => {
|
|
52
|
+
if (tokens.some((token) => token === "--help" || token === "-h"))
|
|
53
|
+
return { kind: "help" };
|
|
54
|
+
const flags = new Map(flagsOf(tool).map((flag) => [flag.name, flag]));
|
|
55
|
+
const positional = positionalOf(tool);
|
|
56
|
+
const args = {};
|
|
57
|
+
const usage = (message) => ({ kind: "usage", message });
|
|
58
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
59
|
+
const token = tokens[i];
|
|
60
|
+
if (!token.startsWith("-") || token === "-") {
|
|
61
|
+
// The one positional argument is the file, and only in first place.
|
|
62
|
+
if (i === 0 && positional) {
|
|
63
|
+
args[positional] = token;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
return usage(positional
|
|
67
|
+
? `Unexpected argument '${token}'. Only --${positional} may be given without a flag, and only first.`
|
|
68
|
+
: `Unexpected argument '${token}'. ${tool.name} takes only flags.`);
|
|
69
|
+
}
|
|
70
|
+
if (!token.startsWith("--")) {
|
|
71
|
+
return usage(`Unknown flag '${token}'. Flags are spelled --name, as the tool's arguments are.`);
|
|
72
|
+
}
|
|
73
|
+
const equals = token.indexOf("=");
|
|
74
|
+
const name = token.slice(2, equals === -1 ? undefined : equals);
|
|
75
|
+
const inline = equals === -1 ? undefined : token.slice(equals + 1);
|
|
76
|
+
const flag = flags.get(name);
|
|
77
|
+
if (!flag) {
|
|
78
|
+
const suggestion = flags.has(name.replace(/-/g, "_"))
|
|
79
|
+
? ` Did you mean --${name.replace(/-/g, "_")}?`
|
|
80
|
+
: "";
|
|
81
|
+
return usage(`Unknown flag '--${name}'.${suggestion}`);
|
|
82
|
+
}
|
|
83
|
+
if (flag.kind !== "array" && name in args) {
|
|
84
|
+
return usage(name === positional
|
|
85
|
+
? `The ${name} is given twice. Give it first or as --${name}, once.`
|
|
86
|
+
: `--${name} is given twice. Only an array flag repeats.`);
|
|
87
|
+
}
|
|
88
|
+
// The flag's text: after `=`, or the next token when the kind takes one.
|
|
89
|
+
let text = inline;
|
|
90
|
+
if (text === undefined) {
|
|
91
|
+
const next = tokens[i + 1];
|
|
92
|
+
if (flag.kind === "boolean") {
|
|
93
|
+
if (next !== undefined && next in BOOLEAN_WORDS) {
|
|
94
|
+
args[name] = BOOLEAN_WORDS[next];
|
|
95
|
+
i++;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
args[name] = true;
|
|
99
|
+
}
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (next === undefined)
|
|
103
|
+
return usage(`--${name} needs a value.`);
|
|
104
|
+
if (next.startsWith("-")) {
|
|
105
|
+
return usage(`--${name} needs a value, and '${next}' starts with a dash. Write --${name}=${next} for a value that does.`);
|
|
106
|
+
}
|
|
107
|
+
text = next;
|
|
108
|
+
i++;
|
|
109
|
+
}
|
|
110
|
+
switch (flag.kind) {
|
|
111
|
+
case "boolean":
|
|
112
|
+
if (!(text in BOOLEAN_WORDS))
|
|
113
|
+
return usage(`--${name} takes true or false, not '${text}'.`);
|
|
114
|
+
args[name] = BOOLEAN_WORDS[text];
|
|
115
|
+
break;
|
|
116
|
+
case "number":
|
|
117
|
+
if (!NUMBER.test(text))
|
|
118
|
+
return usage(`--${name} takes a number, not '${text}'.`);
|
|
119
|
+
args[name] = Number(text);
|
|
120
|
+
break;
|
|
121
|
+
case "array":
|
|
122
|
+
args[name] = [...(args[name] ?? []), text];
|
|
123
|
+
break;
|
|
124
|
+
default:
|
|
125
|
+
args[name] = text;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return { kind: "run", args };
|
|
129
|
+
};
|
|
130
|
+
// =============================================================================
|
|
131
|
+
// Help
|
|
132
|
+
// =============================================================================
|
|
133
|
+
const placeholder = (flag) => flag.kind === "boolean" ? "" : flag.kind === "number" ? " <number>" : " <text>";
|
|
134
|
+
/** One line naming the tool and its flags, required ones bare and the rest in brackets. */
|
|
135
|
+
export const usageLine = (tool) => {
|
|
136
|
+
const positional = positionalOf(tool);
|
|
137
|
+
const parts = [`${BINARY_NAME} ${tool.name}`];
|
|
138
|
+
if (positional)
|
|
139
|
+
parts.push(`<${positional}>`);
|
|
140
|
+
for (const flag of flagsOf(tool)) {
|
|
141
|
+
if (flag.name === positional)
|
|
142
|
+
continue;
|
|
143
|
+
const text = `--${flag.name}${placeholder(flag)}${flag.kind === "array" ? " ..." : ""}`;
|
|
144
|
+
parts.push(flag.required ? text : `[${text}]`);
|
|
145
|
+
}
|
|
146
|
+
return parts.join(" ");
|
|
147
|
+
};
|
|
148
|
+
/** A tool's description and every flag, from the registry. */
|
|
149
|
+
export const toolHelp = (tool) => {
|
|
150
|
+
const lines = [`Usage: ${usageLine(tool)}`, "", tool.description, "", "Flags:"];
|
|
151
|
+
for (const flag of flagsOf(tool)) {
|
|
152
|
+
const notes = [];
|
|
153
|
+
if (flag.required)
|
|
154
|
+
notes.push("required");
|
|
155
|
+
if (flag.kind === "array")
|
|
156
|
+
notes.push("repeat for more than one");
|
|
157
|
+
if (flag.kind === "boolean")
|
|
158
|
+
notes.push("alone means true");
|
|
159
|
+
if (flag.default !== undefined)
|
|
160
|
+
notes.push(`default ${JSON.stringify(flag.default)}`);
|
|
161
|
+
if (flag.name === positionalOf(tool))
|
|
162
|
+
notes.push("may be given first, without the flag");
|
|
163
|
+
lines.push(` --${flag.name}${placeholder(flag)}`);
|
|
164
|
+
if (flag.description)
|
|
165
|
+
lines.push(` ${flag.description}`);
|
|
166
|
+
if (notes.length > 0)
|
|
167
|
+
lines.push(` (${notes.join("; ")})`);
|
|
168
|
+
}
|
|
169
|
+
lines.push("", "Prints the result as JSON on stdout. Exits 1 when the result has an error field,", "2 on a usage error.");
|
|
170
|
+
return lines.join("\n");
|
|
171
|
+
};
|
|
172
|
+
/** The tools `--help` prints. */
|
|
173
|
+
export const toolList = () => TOOLS.map((tool) => ` ${tool.name.padEnd(30)}${tool.title}`).join("\n");
|
|
174
|
+
/** Run a tool's command line. */
|
|
175
|
+
export const runQuery = async (tool, tokens, options) => {
|
|
176
|
+
const parsed = parseQueryArgs(tool, tokens);
|
|
177
|
+
if (parsed.kind === "help")
|
|
178
|
+
return { exitCode: 0, stdout: toolHelp(tool) };
|
|
179
|
+
const usageError = (message) => ({
|
|
180
|
+
exitCode: 2,
|
|
181
|
+
stderr: `error: ${message}\nusage: ${usageLine(tool)}\nRun '${BINARY_NAME} ${tool.name} --help' for every flag.`,
|
|
182
|
+
errorMessage: message,
|
|
183
|
+
});
|
|
184
|
+
if (parsed.kind === "usage")
|
|
185
|
+
return usageError(parsed.message);
|
|
186
|
+
const checked = z.object(tool.inputSchema).safeParse(parsed.args);
|
|
187
|
+
if (!checked.success) {
|
|
188
|
+
return usageError(checked.error.issues
|
|
189
|
+
.map((issue) => {
|
|
190
|
+
const at = issue.path.length > 0 ? `--${issue.path.join(".")}: ` : "";
|
|
191
|
+
return issue.code === "invalid_type" && issue.input === undefined
|
|
192
|
+
? `${at}required`
|
|
193
|
+
: `${at}${issue.message}`;
|
|
194
|
+
})
|
|
195
|
+
.join("; "));
|
|
196
|
+
}
|
|
197
|
+
let result;
|
|
198
|
+
try {
|
|
199
|
+
result = await tool.run(checked.data);
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
result = { error: error instanceof Error ? error.message : String(error) };
|
|
203
|
+
}
|
|
204
|
+
const json = options.isTTY ? JSON.stringify(result, null, 2) : JSON.stringify(result);
|
|
205
|
+
return {
|
|
206
|
+
exitCode: isErrorResult(result) ? 1 : 0,
|
|
207
|
+
stdout: json,
|
|
208
|
+
...(isErrorResult(result) ? { errorMessage: result.error } : {}),
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
/** The registry tool a command-line word names, if any. */
|
|
212
|
+
export const toolNamed = (word) => word === undefined ? undefined : findTool(word);
|
|
213
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/cli/query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;A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CAAC;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACtF,OAAO;QACL,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACvC,MAAM,EAAE,IAAI;QACZ,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC;AACJ,CAAC,CAAC;AAEF,2DAA2D;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAwB,EAAiC,EAAE,CACnF,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent skill for the query command line, rendered from the tool registry.
|
|
3
|
+
*
|
|
4
|
+
* The skill follows the Agent Skills specification (agentskills.io): one
|
|
5
|
+
* `SKILL.md` with the command line's usage and every tool's description and
|
|
6
|
+
* flags, which an agent reads before running a tool. It is this module's
|
|
7
|
+
* output, written by `npm run gen:skill`. A test compares it with the
|
|
8
|
+
* committed file, so a change to a tool's description or arguments fails until
|
|
9
|
+
* the skill is regenerated, and the skill never describes a tool other than the
|
|
10
|
+
* one that runs.
|
|
11
|
+
*/
|
|
12
|
+
/** The skill's directory, from the repository root. */
|
|
13
|
+
export declare const SKILL_DIR = "plugins/pcb-lens/skills/pcb-lens";
|
|
14
|
+
/** Where the generated skill lives, from the repository root. */
|
|
15
|
+
export declare const SKILL_PATH = "plugins/pcb-lens/skills/pcb-lens/SKILL.md";
|
|
16
|
+
/** The skill's Markdown. */
|
|
17
|
+
export declare const renderSkill: () => string;
|
|
18
|
+
//# sourceMappingURL=skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../src/cli/skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,uDAAuD;AACvD,eAAO,MAAM,SAAS,qCAAqC,CAAC;AAE5D,iEAAiE;AACjE,eAAO,MAAM,UAAU,8CAA0B,CAAC;AAoClD,4BAA4B;AAC5B,eAAO,MAAM,WAAW,QAAO,MA4E9B,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent skill for the query command line, rendered from the tool registry.
|
|
3
|
+
*
|
|
4
|
+
* The skill follows the Agent Skills specification (agentskills.io): one
|
|
5
|
+
* `SKILL.md` with the command line's usage and every tool's description and
|
|
6
|
+
* flags, which an agent reads before running a tool. It is this module's
|
|
7
|
+
* output, written by `npm run gen:skill`. A test compares it with the
|
|
8
|
+
* committed file, so a change to a tool's description or arguments fails until
|
|
9
|
+
* the skill is regenerated, and the skill never describes a tool other than the
|
|
10
|
+
* one that runs.
|
|
11
|
+
*/
|
|
12
|
+
import { GITHUB_REPO, NPM_PACKAGE } from "./version.js";
|
|
13
|
+
import { TOOLS } from "../tools/index.js";
|
|
14
|
+
import { flagsOf, positionalOf } from "./query.js";
|
|
15
|
+
/** The skill's directory, from the repository root. */
|
|
16
|
+
export const SKILL_DIR = "plugins/pcb-lens/skills/pcb-lens";
|
|
17
|
+
/** Where the generated skill lives, from the repository root. */
|
|
18
|
+
export const SKILL_PATH = `${SKILL_DIR}/SKILL.md`;
|
|
19
|
+
const GENERATED = "<!-- Generated by `npm run gen:skill` from the tool registry in src/tools/index.ts. Edit the tools, not this file. -->";
|
|
20
|
+
const SKILL_DESCRIPTION = "Query PCB layouts from the shell with the pcb-lens command line: IPC-2581 XML from any EDA " +
|
|
21
|
+
"tool, and Cadence Allegro .brd boards and Constraint Manager .dcf/.tcfx files for design " +
|
|
22
|
+
"rules. Gives the layer stackup, component placement and pads, net routing (trace widths, " +
|
|
23
|
+
"lengths, vias), and the constraint sets, net classes, diff pairs and match groups. Use when " +
|
|
24
|
+
"reviewing a PCB layout and no pcb-lens MCP server is connected, as in a sandbox or container.";
|
|
25
|
+
/**
|
|
26
|
+
* The skill's frontmatter: the Agent Skills fields, and only those, so every
|
|
27
|
+
* host reads it. Each value is written as a JSON string, which is a YAML
|
|
28
|
+
* double-quoted scalar, because a plain one cannot hold the `: ` the
|
|
29
|
+
* description does and strict YAML readers (gh skill) refuse it.
|
|
30
|
+
*/
|
|
31
|
+
const FRONTMATTER = {
|
|
32
|
+
name: "pcb-lens",
|
|
33
|
+
description: SKILL_DESCRIPTION,
|
|
34
|
+
license: "Apache-2.0",
|
|
35
|
+
compatibility: "Requires a shell and the pcb-lens command line (the standalone binary, or Node.js 24+ for npx).",
|
|
36
|
+
};
|
|
37
|
+
const flagLine = (flag, positional) => {
|
|
38
|
+
const kind = flag.kind === "boolean" ? "true or false; alone means true" : flag.kind;
|
|
39
|
+
const notes = [kind];
|
|
40
|
+
if (flag.required)
|
|
41
|
+
notes.unshift("required");
|
|
42
|
+
if (flag.default !== undefined)
|
|
43
|
+
notes.push(`default ${JSON.stringify(flag.default)}`);
|
|
44
|
+
if (flag.name === positional)
|
|
45
|
+
notes.push("may be the first argument");
|
|
46
|
+
const description = flag.description ? ` ${flag.description}.`.replace(/\.\.$/, ".") : "";
|
|
47
|
+
return `- \`--${flag.name}\` (${notes.join("; ")}).${description}`;
|
|
48
|
+
};
|
|
49
|
+
/** The skill's Markdown. */
|
|
50
|
+
export const renderSkill = () => {
|
|
51
|
+
const lines = [
|
|
52
|
+
"---",
|
|
53
|
+
...Object.entries(FRONTMATTER).map(([key, value]) => `${key}: ${JSON.stringify(value)}`),
|
|
54
|
+
"---",
|
|
55
|
+
"",
|
|
56
|
+
GENERATED,
|
|
57
|
+
"",
|
|
58
|
+
"# PCB Lens command line",
|
|
59
|
+
"",
|
|
60
|
+
"`pcb-lens` answers the same queries as the pcb-lens MCP server, one shell command each. When that MCP server is connected, use its tools instead.",
|
|
61
|
+
"",
|
|
62
|
+
"## Install",
|
|
63
|
+
"",
|
|
64
|
+
"Check for it with `pcb-lens --version`. If it is missing, either install the standalone binary:",
|
|
65
|
+
"",
|
|
66
|
+
"```bash",
|
|
67
|
+
`curl -fsSL https://raw.githubusercontent.com/${GITHUB_REPO}/main/install.sh | bash`,
|
|
68
|
+
"```",
|
|
69
|
+
"",
|
|
70
|
+
"or run it through npm without installing, writing `npx -y " +
|
|
71
|
+
NPM_PACKAGE +
|
|
72
|
+
"` wherever this guide writes `pcb-lens`.",
|
|
73
|
+
"",
|
|
74
|
+
"## Usage",
|
|
75
|
+
"",
|
|
76
|
+
"```bash",
|
|
77
|
+
"pcb-lens <tool> [file] --flag value ...",
|
|
78
|
+
"pcb-lens <tool> --help # the tool's description and every flag",
|
|
79
|
+
"pcb-lens --help # every tool",
|
|
80
|
+
"```",
|
|
81
|
+
"",
|
|
82
|
+
"- The tool is its name below, in snake_case. Flags are its arguments, spelled exactly.",
|
|
83
|
+
"- The file the tool reads may be the first argument, or its flag (`--file`, or `--board` on the export tools).",
|
|
84
|
+
"- A flag takes the next word, or `--flag=value`. A value that starts with a dash needs `=`: `--pattern=-12V`.",
|
|
85
|
+
"- Quote regex patterns for the shell: `--pattern '^VCC'`.",
|
|
86
|
+
"",
|
|
87
|
+
"## Output and exit codes",
|
|
88
|
+
"",
|
|
89
|
+
"The result is the tool's JSON on stdout: indented in a terminal, one compact line otherwise, so pipe it to `jq` when it is long.",
|
|
90
|
+
"",
|
|
91
|
+
"| Exit | Meaning |",
|
|
92
|
+
"|------|---------|",
|
|
93
|
+
"| 0 | The result answers the query |",
|
|
94
|
+
"| 1 | The result has an `error` field: a missing file, no match, an invalid pattern |",
|
|
95
|
+
"| 2 | Usage error: an unknown or missing flag, or a value of the wrong kind. The message and a usage line are on stderr |",
|
|
96
|
+
"",
|
|
97
|
+
"## Workflow",
|
|
98
|
+
"",
|
|
99
|
+
"1. `get_pcb_metadata` on an IPC-2581 file gives the layer stackup, units and size of the design.",
|
|
100
|
+
"2. `get_pcb_component` looks up one component by exact refdes; `get_pcb_net` traces nets by regex.",
|
|
101
|
+
"3. `get_constraints` on a .brd, .dcf or .tcfx file gives the design rules: without `--section` an overview of the sections, with it the objects of one section.",
|
|
102
|
+
"4. On Windows with Cadence installed, `export_cadence_ipc2581` turns a .brd into the IPC-2581 file the first two steps read.",
|
|
103
|
+
"",
|
|
104
|
+
"```bash",
|
|
105
|
+
"pcb-lens get_pcb_metadata board.xml",
|
|
106
|
+
"pcb-lens get_pcb_net board.xml --pattern '^DDR_D[0-7]$'",
|
|
107
|
+
"pcb-lens get_constraints board.brd --section BrdPhysicalCSet",
|
|
108
|
+
"```",
|
|
109
|
+
"",
|
|
110
|
+
"## Conventions",
|
|
111
|
+
"",
|
|
112
|
+
"- Lengths, coordinates and trace widths from the IPC-2581 tools are in microns, whatever the file's own unit; rotation is in degrees counterclockwise",
|
|
113
|
+
"- A constraint section's `units` field names the unit of its lengths",
|
|
114
|
+
"- Read layout files only through these commands, not by parsing them yourself, and never run `pcb-lens update` or `pcb-lens uninstall`: they replace or remove the binary",
|
|
115
|
+
"",
|
|
116
|
+
"## Tools",
|
|
117
|
+
"",
|
|
118
|
+
"Each description is the MCP tool's own.",
|
|
119
|
+
];
|
|
120
|
+
for (const tool of TOOLS) {
|
|
121
|
+
const positional = positionalOf(tool);
|
|
122
|
+
lines.push("", `### ${tool.name}`, "", tool.description, "");
|
|
123
|
+
lines.push(...flagsOf(tool).map((flag) => flagLine(flag, positional)));
|
|
124
|
+
}
|
|
125
|
+
return `${lines.join("\n")}\n`;
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../../src/cli/skill.ts"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zD,8DAA8D;QAC9D,KAAK;QACL,EAAE;QACF,gBAAgB;QAChB,EAAE;QACF,uJAAuJ;QACvJ,sEAAsE;QACtE,2KAA2K;QAC3K,EAAE;QACF,UAAU;QACV,EAAE;QACF,yCAAyC;KAC1C,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACtC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC7D,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC,CAAC"}
|
package/dist/cli/updater.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ export interface UpdateResult {
|
|
|
23
23
|
* npm installs run from node_modules, not as compiled binaries.
|
|
24
24
|
*/
|
|
25
25
|
export declare const isNpmInstall: () => boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Get the platform-specific binary name. A Mac gets the binary for its CPU, so
|
|
28
|
+
* an x64 binary running under Rosetta updates itself to the native arm64 one.
|
|
29
|
+
*/
|
|
30
|
+
export declare const getPlatformBinaryName: (platform?: NodeJS.Platform, arch?: string, appleSilicon?: () => boolean) => string;
|
|
26
31
|
/**
|
|
27
32
|
* Check if an update is available.
|
|
28
33
|
*/
|
|
@@ -32,9 +37,12 @@ export declare const checkForUpdate: () => Promise<UpdateCheckResult>;
|
|
|
32
37
|
*/
|
|
33
38
|
export declare const performUpdate: (downloadUrl: string, newVersion: string) => Promise<UpdateResult>;
|
|
34
39
|
/**
|
|
35
|
-
* Re-execute the current process with the same arguments
|
|
40
|
+
* Re-execute the current process with the same arguments: the updated binary
|
|
41
|
+
* runs as a child on this process's stdio, and this process exits with the
|
|
42
|
+
* child's code. The promise never settles, so the caller waits here and never
|
|
43
|
+
* goes on to serve beside the child.
|
|
36
44
|
*/
|
|
37
|
-
export declare const reexec: () => never
|
|
45
|
+
export declare const reexec: () => Promise<never>;
|
|
38
46
|
/**
|
|
39
47
|
* Check for updates and apply if available.
|
|
40
48
|
* This is the main entry point for auto-updates on startup.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../src/cli/updater.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyBH,iCAAiC;AACjC,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qCAAqC;AACrC,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,OAG/B,CAAC;
|
|
1
|
+
{"version":3,"file":"updater.d.ts","sourceRoot":"","sources":["../../src/cli/updater.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyBH,iCAAiC;AACjC,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qCAAqC;AACrC,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAO,OAG/B,CAAC;AAkBF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,WAAU,MAAM,CAAC,QAA2B,EAC5C,OAAM,MAAqB,EAC3B,eAAc,MAAM,OAA2B,KAC9C,MAYF,CAAC;AAsDF;;GAEG;AACH,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,iBAAiB,CA8BhE,CAAC;AAiEF;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,aAAa,MAAM,EACnB,YAAY,MAAM,KACjB,OAAO,CAAC,YAAY,CAmEtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,MAAM,QAAO,OAAO,CAAC,KAAK,CAYnC,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,UAAU,QAAa,OAAO,CAAC,OAAO,CAmClD,CAAC"}
|
package/dist/cli/updater.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { createWriteStream, chmodSync, renameSync, unlinkSync, existsSync, readdirSync, } from "node:fs";
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
8
|
import { join, dirname, basename } from "node:path";
|
|
9
|
-
import { spawn } from "node:child_process";
|
|
9
|
+
import { execFileSync, spawn } from "node:child_process";
|
|
10
10
|
import { VERSION, GITHUB_REPO, BINARY_NAME } from "./version.js";
|
|
11
11
|
import { getCurrentExecutablePath, isCompiledBinary } from "./executable.js";
|
|
12
12
|
/**
|
|
@@ -18,13 +18,30 @@ export const isNpmInstall = () => {
|
|
|
18
18
|
return scriptPath?.includes("node_modules") ?? false;
|
|
19
19
|
};
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Whether this Mac has an Apple Silicon CPU. `hw.optional.arm64` reports the
|
|
22
|
+
* hardware, so it stays true when this process is an x64 binary under Rosetta;
|
|
23
|
+
* an Intel Mac has no such key, and `-i` makes sysctl print nothing for it.
|
|
22
24
|
*/
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
const isAppleSiliconMac = () => {
|
|
26
|
+
try {
|
|
27
|
+
const output = execFileSync("/usr/sbin/sysctl", ["-in", "hw.optional.arm64"], {
|
|
28
|
+
encoding: "utf8",
|
|
29
|
+
});
|
|
30
|
+
return output.trim() === "1";
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return process.arch === "arm64";
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Get the platform-specific binary name. A Mac gets the binary for its CPU, so
|
|
38
|
+
* an x64 binary running under Rosetta updates itself to the native arm64 one.
|
|
39
|
+
*/
|
|
40
|
+
export const getPlatformBinaryName = (platform = process.platform, arch = process.arch, appleSilicon = isAppleSiliconMac) => {
|
|
26
41
|
if (platform === "darwin") {
|
|
27
|
-
return
|
|
42
|
+
return arch === "arm64" || appleSilicon()
|
|
43
|
+
? `${BINARY_NAME}-darwin-arm64`
|
|
44
|
+
: `${BINARY_NAME}-darwin-x64`;
|
|
28
45
|
}
|
|
29
46
|
else if (platform === "linux") {
|
|
30
47
|
return arch === "arm64" ? `${BINARY_NAME}-linux-arm64` : `${BINARY_NAME}-linux-x64`;
|
|
@@ -238,28 +255,23 @@ export const performUpdate = async (downloadUrl, newVersion) => {
|
|
|
238
255
|
}
|
|
239
256
|
};
|
|
240
257
|
/**
|
|
241
|
-
* Re-execute the current process with the same arguments
|
|
258
|
+
* Re-execute the current process with the same arguments: the updated binary
|
|
259
|
+
* runs as a child on this process's stdio, and this process exits with the
|
|
260
|
+
* child's code. The promise never settles, so the caller waits here and never
|
|
261
|
+
* goes on to serve beside the child.
|
|
242
262
|
*/
|
|
243
|
-
export const reexec = () => {
|
|
244
|
-
const
|
|
245
|
-
const args = process.argv.slice(2);
|
|
246
|
-
// Spawn the new process
|
|
247
|
-
const child = spawn(execPath, args, {
|
|
263
|
+
export const reexec = () => new Promise(() => {
|
|
264
|
+
const child = spawn(getCurrentExecutablePath(), process.argv.slice(2), {
|
|
248
265
|
stdio: "inherit",
|
|
249
|
-
detached: false,
|
|
250
266
|
});
|
|
251
|
-
// Exit this process when child exits
|
|
252
267
|
child.on("exit", (code) => {
|
|
253
|
-
process.exit(code ??
|
|
268
|
+
process.exit(code ?? 1);
|
|
254
269
|
});
|
|
255
270
|
child.on("error", (err) => {
|
|
256
271
|
console.error("Failed to restart:", err.message);
|
|
257
272
|
process.exit(1);
|
|
258
273
|
});
|
|
259
|
-
|
|
260
|
-
// TypeScript needs the never return type satisfied
|
|
261
|
-
throw new Error("Process should have been replaced");
|
|
262
|
-
};
|
|
274
|
+
});
|
|
263
275
|
/**
|
|
264
276
|
* Check for updates and apply if available.
|
|
265
277
|
* This is the main entry point for auto-updates on startup.
|
package/dist/cli/updater.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updater.js","sourceRoot":"","sources":["../../src/cli/updater.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"updater.js","sourceRoot":"","sources":["../../src/cli/updater.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,GAC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sB,EAAE;IACrD,wEAAwE;IACxE,+DAA+D;IAC/D,IAAI,CAAC,gBAAgB,EAAE,EAAE,CAAC;QACxB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6DAA6D;IAC7D,IAAI,YAAY,EAAE,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,cAAc,EAAE,CAAC;IAErC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,0CAA0C;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,eAAe,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QACzE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,+DAA+D;IAC/D,OAAO,CAAC,KAAK,CAAC,4BAA4B,OAAO,OAAO,KAAK,CAAC,aAAa,KAAK,CAAC,CAAC;IAElF,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;IAE3E,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,6BAA6B,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC3D,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
package/dist/cli/version.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ export declare const VERSION: string;
|
|
|
7
7
|
export declare const GITHUB_REPO = "IntelligentElectron/pcb-lens";
|
|
8
8
|
/** Binary name for the compiled executable. */
|
|
9
9
|
export declare const BINARY_NAME = "pcb-lens";
|
|
10
|
+
export declare const NPM_PACKAGE = "@intelligentelectron/pcb-lens";
|
|
10
11
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/cli/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,qCAAqC;AACrC,eAAO,MAAM,OAAO,QAahB,CAAC;AAEL,8CAA8C;AAC9C,eAAO,MAAM,WAAW,iCAAiC,CAAC;AAE1D,+CAA+C;AAC/C,eAAO,MAAM,WAAW,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/cli/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,qCAAqC;AACrC,eAAO,MAAM,OAAO,QAahB,CAAC;AAEL,8CAA8C;AAC9C,eAAO,MAAM,WAAW,iCAAiC,CAAC;AAE1D,+CAA+C;AAC/C,eAAO,MAAM,WAAW,aAAa,CAAC;AACtC,eAAO,MAAM,WAAW,kCAAkC,CAAC"}
|
package/dist/cli/version.js
CHANGED
|
@@ -22,4 +22,5 @@ export const VERSION = (() => {
|
|
|
22
22
|
export const GITHUB_REPO = "IntelligentElectron/pcb-lens";
|
|
23
23
|
/** Binary name for the compiled executable. */
|
|
24
24
|
export const BINARY_NAME = "pcb-lens";
|
|
25
|
+
export const NPM_PACKAGE = "@intelligentelectron/pcb-lens";
|
|
25
26
|
//# sourceMappingURL=version.js.map
|
package/dist/cli/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/cli/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,qCAAqC;AACrC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE;IAC3B,4CAA4C;IAC5C,IAAI,OAAO,aAAa,KAAK,WAAW,EAAE,CAAC;QACzC,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,sCAAsC;IACtC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAC;QACjE,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,WAAW,CAAC;IACrB,CAAC;AACH,CAAC,CAAC,EAAE,CAAC;AAEL,8CAA8C;AAC9C,MAAM,CAAC,MAAM,WAAW,GAAG,8BAA8B,CAAC;AAE1D,+CAA+C;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/cli/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAK5C,qCAAqC;AACrC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAG,EAAE;IAC3B,4CAA4C;IAC5C,IAAI,OAAO,aAAa,KAAK,WAAW,EAAE,CAAC;QACzC,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,sCAAsC;IACtC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAwB,CAAC;QACjE,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,WAAW,CAAC;IACrB,CAAC;AACH,CAAC,CAAC,EAAE,CAAC;AAEL,8CAA8C;AAC9C,MAAM,CAAC,MAAM,WAAW,GAAG,8BAA8B,CAAC;AAE1D,+CAA+C;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,+BAA+B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
* Run with: npx tsx src/index.ts
|
|
6
6
|
* Or after build: node dist/index.js
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* Commands (each also accepted as a flag, `update` and `--update` alike):
|
|
9
|
+
* version, -v Print version and exit
|
|
10
|
+
* help, -h Show help
|
|
11
|
+
* update|upgrade Check for and install updates
|
|
12
|
+
* uninstall Remove binary and PATH entries
|
|
13
|
+
* export-telemetry Export telemetry data as a zip file
|
|
14
|
+
* <tool> [file] --flag value ... Run an MCP tool, printing its JSON result
|
|
13
15
|
*/
|
|
14
16
|
export {};
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;GAaG"}
|