@slashfi/agents-sdk 0.21.0 → 0.22.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/src/pack.ts ADDED
@@ -0,0 +1,395 @@
1
+ /**
2
+ * ADK Pack
3
+ *
4
+ * Generates a publishable npm package from an agent.json file.
5
+ *
6
+ * Input: agent.json (SerializedAgentDefinition)
7
+ * Output: ready-to-publish directory with:
8
+ * - package.json
9
+ * - agent.json (copy)
10
+ * - meta.json (version metadata + diff)
11
+ * - index.js + index.d.ts (typed export)
12
+ */
13
+
14
+ import { spawnSync } from "node:child_process";
15
+ import { createHash } from "node:crypto";
16
+ import {
17
+ existsSync,
18
+ mkdirSync,
19
+ readFileSync,
20
+ writeFileSync,
21
+ } from "node:fs";
22
+ import { resolve } from "node:path";
23
+ import { parseJsonc } from "./jsonc.js";
24
+ import type { SerializedAgentDefinition } from "./serialized.js";
25
+
26
+ // ============================================
27
+ // Types
28
+ // ============================================
29
+
30
+ export interface PackOptions {
31
+ /** Path to agent.json */
32
+ agentFile: string;
33
+ /** Output directory (default: ./dist) */
34
+ outDir?: string;
35
+ /** npm scope (default: @agentdef) */
36
+ scope?: string;
37
+ /** Previous version's agent.json path for diff (optional) */
38
+ previousAgentFile?: string;
39
+ }
40
+
41
+ export interface PackResult {
42
+ packageDir: string;
43
+ packageName: string;
44
+ version: string;
45
+ hash: string;
46
+ meta: VersionMeta;
47
+ }
48
+
49
+ export interface VersionMeta {
50
+ hash: string;
51
+ serverVersion: string;
52
+ npmPackage?: string;
53
+ toolCount: number;
54
+ sizeBytes: number;
55
+ generatedAt: string;
56
+ sdkVersion: string;
57
+ changes?: VersionChanges;
58
+ }
59
+
60
+ export interface VersionChanges {
61
+ previousHash?: string;
62
+ toolsAdded: string[];
63
+ toolsRemoved: string[];
64
+ toolsModified: string[];
65
+ schemaChanges: string[];
66
+ }
67
+
68
+ // ============================================
69
+ // Hash
70
+ // ============================================
71
+
72
+ function contentHash(content: string): string {
73
+ return createHash("sha256").update(content).digest("hex").slice(0, 8);
74
+ }
75
+
76
+ // ============================================
77
+ // Diff
78
+ // ============================================
79
+
80
+ function diffDefinitions(
81
+ current: SerializedAgentDefinition,
82
+ previous: SerializedAgentDefinition,
83
+ previousRawContent: string,
84
+ ): VersionChanges {
85
+ const prevToolNames = new Set(previous.tools.map((t) => t.name));
86
+ const currToolNames = new Set(current.tools.map((t) => t.name));
87
+
88
+ const toolsAdded = current.tools
89
+ .filter((t) => !prevToolNames.has(t.name))
90
+ .map((t) => t.name);
91
+ const toolsRemoved = previous.tools
92
+ .filter((t) => !currToolNames.has(t.name))
93
+ .map((t) => t.name);
94
+
95
+ // Find modified tools (same name, different schema)
96
+ const toolsModified: string[] = [];
97
+ const schemaChanges: string[] = [];
98
+ const prevToolMap = new Map(previous.tools.map((t) => [t.name, t]));
99
+
100
+ for (const tool of current.tools) {
101
+ const prev = prevToolMap.get(tool.name);
102
+ if (!prev) continue;
103
+ const currSchema = JSON.stringify(tool.inputSchema);
104
+ const prevSchema = JSON.stringify(prev.inputSchema);
105
+ if (currSchema !== prevSchema) {
106
+ toolsModified.push(tool.name);
107
+ // Generate human-readable schema change description
108
+ const currProps = Object.keys(
109
+ ((tool.inputSchema as Record<string, unknown>).properties as Record<
110
+ string,
111
+ unknown
112
+ >) || {},
113
+ );
114
+ const prevProps = Object.keys(
115
+ ((prev.inputSchema as Record<string, unknown>).properties as Record<
116
+ string,
117
+ unknown
118
+ >) || {},
119
+ );
120
+ const added = currProps.filter((p) => !prevProps.includes(p));
121
+ const removed = prevProps.filter((p) => !currProps.includes(p));
122
+ if (added.length > 0) {
123
+ schemaChanges.push(
124
+ `${tool.name}: added properties: ${added.join(", ")}`,
125
+ );
126
+ }
127
+ if (removed.length > 0) {
128
+ schemaChanges.push(
129
+ `${tool.name}: removed properties: ${removed.join(", ")}`,
130
+ );
131
+ }
132
+ if (added.length === 0 && removed.length === 0) {
133
+ schemaChanges.push(`${tool.name}: schema modified`);
134
+ }
135
+ }
136
+ }
137
+
138
+ return {
139
+ previousHash: contentHash(previousRawContent),
140
+ toolsAdded,
141
+ toolsRemoved,
142
+ toolsModified,
143
+ schemaChanges,
144
+ };
145
+ }
146
+
147
+ // ============================================
148
+ // Pack
149
+ // ============================================
150
+
151
+ export function pack(options: PackOptions): PackResult {
152
+ const { agentFile, outDir = "./dist", scope = "@agentdef" } = options;
153
+
154
+ // Read agent.json
155
+ const agentPath = resolve(agentFile);
156
+ if (!existsSync(agentPath)) {
157
+ throw new Error(`agent.json not found: ${agentPath}`);
158
+ }
159
+ const agentContent = readFileSync(agentPath, "utf-8");
160
+ const definition = parseJsonc(agentContent) as SerializedAgentDefinition;
161
+
162
+ // Compute hash + version
163
+ const hash = contentHash(agentContent);
164
+ const version = `${definition.version || "1.0.0"}`;
165
+ const packageName = `${scope}/${definition.path}`;
166
+
167
+ // Create output directory
168
+ const packageDir = resolve(outDir, definition.path);
169
+ mkdirSync(packageDir, { recursive: true });
170
+
171
+ // Generate meta.json
172
+ const meta: VersionMeta = {
173
+ hash,
174
+ serverVersion:
175
+ definition.serverInfo?.version || definition.version || "1.0.0",
176
+ npmPackage: definition.serverSource,
177
+ toolCount: definition.tools.length,
178
+ sizeBytes: Buffer.byteLength(agentContent, "utf-8"),
179
+ generatedAt: definition.generatedAt || new Date().toISOString(),
180
+ sdkVersion: definition.sdkVersion || "0.21.0",
181
+ };
182
+
183
+ // Diff against previous if provided
184
+ if (options.previousAgentFile) {
185
+ const prevPath = resolve(options.previousAgentFile);
186
+ if (existsSync(prevPath)) {
187
+ const prevContent = readFileSync(prevPath, "utf-8");
188
+ const prevDef = parseJsonc(prevContent) as SerializedAgentDefinition;
189
+ meta.changes = diffDefinitions(definition, prevDef, prevContent);
190
+ }
191
+ }
192
+
193
+ // Write agent.json
194
+ writeFileSync(resolve(packageDir, "agent.json"), agentContent);
195
+
196
+ // Write meta.json
197
+ writeFileSync(
198
+ resolve(packageDir, "meta.json"),
199
+ `${JSON.stringify(meta, null, 2)}\n`,
200
+ );
201
+
202
+ // Write package.json
203
+ const pkg = {
204
+ name: packageName,
205
+ version,
206
+ description:
207
+ definition.description || `Agent definition for ${definition.name}`,
208
+ type: "module",
209
+ main: "index.js",
210
+ types: "index.d.ts",
211
+ exports: {
212
+ ".": {
213
+ import: "./index.js",
214
+ types: "./index.d.ts",
215
+ },
216
+ "./agent.json": "./agent.json",
217
+ "./meta.json": "./meta.json",
218
+ },
219
+ files: ["index.js", "index.d.ts", "agent.json", "meta.json"],
220
+ peerDependencies: {
221
+ "@slashfi/agents-sdk": ">=0.21.0",
222
+ },
223
+ keywords: ["agent", "mcp", "agentdef", definition.path],
224
+ license: "MIT",
225
+ repository: {
226
+ type: "git",
227
+ url: "https://github.com/slashfi/agents-sdk",
228
+ },
229
+ };
230
+ writeFileSync(
231
+ resolve(packageDir, "package.json"),
232
+ `${JSON.stringify(pkg, null, 2)}\n`,
233
+ );
234
+
235
+ // Write index.js
236
+ writeFileSync(
237
+ resolve(packageDir, "index.js"),
238
+ [
239
+ 'import { readFileSync } from "node:fs";',
240
+ 'import { fileURLToPath } from "node:url";',
241
+ 'import { dirname, resolve } from "node:path";',
242
+ "",
243
+ "const __dirname = dirname(fileURLToPath(import.meta.url));",
244
+ 'const definition = JSON.parse(readFileSync(resolve(__dirname, "agent.json"), "utf-8"));',
245
+ "export default definition;",
246
+ "export { definition };",
247
+ "",
248
+ ].join("\n"),
249
+ );
250
+
251
+ // Write index.d.ts
252
+ writeFileSync(
253
+ resolve(packageDir, "index.d.ts"),
254
+ [
255
+ 'import type { SerializedAgentDefinition } from "@slashfi/agents-sdk";',
256
+ "",
257
+ "declare const definition: SerializedAgentDefinition;",
258
+ "export default definition;",
259
+ "export { definition };",
260
+ "",
261
+ ].join("\n"),
262
+ );
263
+
264
+ return { packageDir, packageName, version, hash, meta };
265
+ }
266
+
267
+ // ============================================
268
+ // Publish
269
+ // ============================================
270
+
271
+ export interface PublishOptions extends PackOptions {
272
+ /** Dry run (don't actually publish) */
273
+ dryRun?: boolean;
274
+ /** npm tag (default: latest) */
275
+ tag?: string;
276
+ /** npm access level */
277
+ access?: "public" | "restricted";
278
+ /** npm registry URL */
279
+ registry?: string;
280
+ }
281
+
282
+ /**
283
+ * Compare semver: returns true if `a` is older than `b`.
284
+ */
285
+ function isOlderVersion(a: string, b: string): boolean {
286
+ const pa = a.split(".").map(Number);
287
+ const pb = b.split(".").map(Number);
288
+ for (let i = 0; i < 3; i++) {
289
+ if ((pa[i] || 0) < (pb[i] || 0)) return true;
290
+ if ((pa[i] || 0) > (pb[i] || 0)) return false;
291
+ }
292
+ return false; // equal
293
+ }
294
+
295
+ export function publish(options: PublishOptions): PackResult {
296
+ const result = pack(options);
297
+
298
+ // Check if this version already exists in the registry
299
+ const registryArgs = options.registry ? ["--registry", options.registry] : [];
300
+ const viewProc = spawnSync(
301
+ "npm",
302
+ ["view", `${result.packageName}`, "versions", "--json", ...registryArgs],
303
+ { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] },
304
+ );
305
+
306
+ if (viewProc.status === 0 && viewProc.stdout) {
307
+ try {
308
+ const raw = JSON.parse(viewProc.stdout);
309
+ const existing: string[] = Array.isArray(raw) ? raw : [raw];
310
+
311
+ // E409 prevention: version already exists
312
+ if (existing.includes(result.version)) {
313
+ const versions = existing.join(", ");
314
+ throw new Error(
315
+ `\x1b[31m\u2717 ${result.packageName}@${result.version} already exists in registry\x1b[0m\n\n Published versions: ${versions}\n Hint: bump the version in agent.json, or use --tag to publish a pre-release`,
316
+ );
317
+ }
318
+
319
+ // Out-of-order protection: warn if publishing older than latest
320
+ const latestViewProc = spawnSync(
321
+ "npm",
322
+ ["view", `${result.packageName}`, "dist-tags.latest", ...registryArgs],
323
+ { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] },
324
+ );
325
+ if (latestViewProc.status === 0 && latestViewProc.stdout) {
326
+ const latest = latestViewProc.stdout.trim();
327
+ if (latest && !options.tag && isOlderVersion(result.version, latest)) {
328
+ console.warn(
329
+ `\x1b[33m\u26A0 Warning: publishing ${result.version} which is older than latest (${latest})\x1b[0m`,
330
+ );
331
+ console.warn(
332
+ ` This will move the "latest" tag from ${latest} to ${result.version}.`,
333
+ );
334
+ console.warn(
335
+ " Use --tag <name> to publish without affecting latest.",
336
+ );
337
+ throw new Error(
338
+ `Refusing to clobber latest tag. Use --tag <name> to publish ${result.version} alongside ${latest}.`,
339
+ );
340
+ }
341
+ }
342
+ } catch (e) {
343
+ if (e instanceof Error && e.message.includes("already exists")) throw e;
344
+ if (e instanceof Error && e.message.includes("Refusing to clobber"))
345
+ throw e;
346
+ // JSON parse error or other issue — continue with publish
347
+ }
348
+ }
349
+
350
+ const npmArgs = ["publish", result.packageDir];
351
+ npmArgs.push("--access", options.access || "public");
352
+ if (options.tag) npmArgs.push("--tag", options.tag);
353
+ if (options.dryRun) npmArgs.push("--dry-run");
354
+ if (options.registry) npmArgs.push("--registry", options.registry);
355
+
356
+ console.log(
357
+ `Publishing ${result.packageName}@${result.version} (hash: ${result.hash})`,
358
+ );
359
+ const proc = spawnSync("npm", npmArgs, {
360
+ stdio: ["pipe", "pipe", "pipe"],
361
+ encoding: "utf-8",
362
+ });
363
+
364
+ if (proc.status !== 0) {
365
+ const stderr = proc.stderr || "";
366
+ // Extract npm log path for debug hint
367
+ const logMatch = stderr.match(/complete log[^:]*:\s*(.+\.log)/i);
368
+ const logHint = logMatch
369
+ ? `\n Debug: cat ${logMatch[1].trim()} | tail -40`
370
+ : "";
371
+ // Parse npm error for better messages
372
+ if (stderr.includes("E409") || stderr.includes("already present")) {
373
+ throw new Error(
374
+ `\x1b[31m\u2717 ${result.packageName}@${result.version} already exists in registry\x1b[0m\n\n` +
375
+ ` Hint: bump the version in agent.json, or use --tag to publish a pre-release${logHint}`,
376
+ );
377
+ }
378
+ if (stderr.includes("E401") || stderr.includes("authentication")) {
379
+ throw new Error(
380
+ `\x1b[31m\u2717 Authentication failed\x1b[0m\n\n Run: npm login --scope=@agentdef\n Or set NPM_TOKEN in your environment${logHint}`,
381
+ );
382
+ }
383
+ if (stderr.includes("E403") || stderr.includes("Forbidden")) {
384
+ throw new Error(
385
+ `\x1b[31m\u2717 Permission denied publishing ${result.packageName}\x1b[0m\n\n Make sure you have publish access to the @agentdef scope.\n Run: npm access ls-packages @agentdef${logHint}`,
386
+ );
387
+ }
388
+ // Fallback: show raw error
389
+ throw new Error(
390
+ `npm publish failed (exit ${proc.status}):${logHint}\n${stderr}`,
391
+ );
392
+ }
393
+
394
+ return result;
395
+ }
package/dist/cli.d.ts DELETED
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env bun
2
- /**
3
- * agents-sdk CLI
4
- *
5
- * Unified command-line interface for the agents SDK.
6
- *
7
- * Commands:
8
- * codegen - Generate agent definitions from an MCP server
9
- * use - Execute a tool on a codegenned agent
10
- *
11
- * @example
12
- * ```bash
13
- * # Generate from MCP server
14
- * agents-sdk codegen --server 'npx @mcp/notion' --name notion --out ./agents/@notion
15
- *
16
- * # Use a tool
17
- * agents-sdk use notion search_pages '{"query": "hello"}'
18
- *
19
- * # List tools on a codegenned agent
20
- * agents-sdk use notion --list
21
- * ```
22
- */
23
- export {};
24
- //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;GAoBG"}
package/dist/cli.js DELETED
@@ -1,234 +0,0 @@
1
- #!/usr/bin/env bun
2
- /**
3
- * agents-sdk CLI
4
- *
5
- * Unified command-line interface for the agents SDK.
6
- *
7
- * Commands:
8
- * codegen - Generate agent definitions from an MCP server
9
- * use - Execute a tool on a codegenned agent
10
- *
11
- * @example
12
- * ```bash
13
- * # Generate from MCP server
14
- * agents-sdk codegen --server 'npx @mcp/notion' --name notion --out ./agents/@notion
15
- *
16
- * # Use a tool
17
- * agents-sdk use notion search_pages '{"query": "hello"}'
18
- *
19
- * # List tools on a codegenned agent
20
- * agents-sdk use notion --list
21
- * ```
22
- */
23
- import { resolve, join } from "node:path";
24
- import { existsSync, readdirSync } from "node:fs";
25
- import { codegen, useAgent, listAgentTools } from "./codegen.js";
26
- const args = process.argv.slice(2);
27
- const command = args[0];
28
- // ============================================
29
- // Helpers
30
- // ============================================
31
- function parseFlag(args, flag) {
32
- const idx = args.indexOf(flag);
33
- if (idx === -1 || idx + 1 >= args.length)
34
- return undefined;
35
- return args[idx + 1];
36
- }
37
- function hasFlag(args, flag) {
38
- return args.includes(flag);
39
- }
40
- /** Default directory for codegenned agents */
41
- function getAgentsDir() {
42
- return resolve(process.env.AGENTS_SDK_DIR ?? "./agents");
43
- }
44
- /** Find an agent directory by name */
45
- function findAgentDir(name) {
46
- const agentsDir = getAgentsDir();
47
- // Try exact path first
48
- const exactPath = resolve(name);
49
- if (existsSync(join(exactPath, ".codegen-manifest.json"))) {
50
- return exactPath;
51
- }
52
- // Try under agents dir with @ prefix
53
- const withAt = join(agentsDir, `@${name}`);
54
- if (existsSync(join(withAt, ".codegen-manifest.json"))) {
55
- return withAt;
56
- }
57
- // Try under agents dir without @ prefix
58
- const withoutAt = join(agentsDir, name);
59
- if (existsSync(join(withoutAt, ".codegen-manifest.json"))) {
60
- return withoutAt;
61
- }
62
- return null;
63
- }
64
- function printUsage() {
65
- console.log(`agents-sdk - SDK for building AI agents
66
-
67
- Usage:
68
- agents-sdk codegen [options] Generate agent from MCP server
69
- agents-sdk use <agent> [options] Execute a tool on a generated agent
70
- agents-sdk list List all generated agents
71
-
72
- Codegen options:
73
- --server <source> MCP server (command string or URL)
74
- --name <name> Agent name (default: derived from server)
75
- --out <dir> Output directory (default: ./agents/@<name>)
76
- --path <path> Agent path override
77
- --no-cli Skip CLI generation
78
- --no-types Skip TypeScript interface generation
79
- --visibility <level> Agent visibility (public|internal|private)
80
-
81
- Use options:
82
- agents-sdk use <agent> <tool> [params_json]
83
- agents-sdk use <agent> --list List tools on the agent
84
-
85
- Examples:
86
- agents-sdk codegen --server 'npx @mcp/notion' --name notion
87
- agents-sdk use notion search_pages '{"query": "hello"}'
88
- agents-sdk use notion --list
89
- `);
90
- }
91
- // ============================================
92
- // Commands
93
- // ============================================
94
- async function runCodegen(args) {
95
- const server = parseFlag(args, "--server");
96
- const name = parseFlag(args, "--name");
97
- const outDir = parseFlag(args, "--out");
98
- const agentPath = parseFlag(args, "--path");
99
- const visibility = parseFlag(args, "--visibility");
100
- const noCli = hasFlag(args, "--no-cli");
101
- const noTypes = hasFlag(args, "--no-types");
102
- if (!server) {
103
- console.error("Error: --server is required.\n" +
104
- " Example: agents-sdk codegen --server 'npx @mcp/notion' --name notion");
105
- process.exit(1);
106
- }
107
- const resolvedOutDir = outDir ??
108
- join(getAgentsDir(), `@${(name ?? "mcp-agent").toLowerCase().replace(/[^a-z0-9-]/g, "-")}`);
109
- console.log(`Connecting to MCP server: ${server}`);
110
- console.log(`Output: ${resolvedOutDir}\n`);
111
- try {
112
- const result = await codegen({
113
- server,
114
- outDir: resolvedOutDir,
115
- agentPath,
116
- name,
117
- cli: !noCli,
118
- types: !noTypes,
119
- visibility,
120
- });
121
- console.log(`\x1b[32m\u2713\x1b[0m Generated ${result.toolCount} tools from ${result.serverInfo.name ?? "MCP server"}`);
122
- console.log(`\nFiles:`);
123
- for (const f of result.files) {
124
- console.log(` ${f}`);
125
- }
126
- console.log(`\nUse: agents-sdk use ${name ?? result.serverInfo.name ?? "<agent>"} --list`);
127
- }
128
- catch (err) {
129
- console.error(`\x1b[31mError:\x1b[0m ${err instanceof Error ? err.message : String(err)}`);
130
- process.exit(1);
131
- }
132
- }
133
- async function runUse(args) {
134
- const agentName = args[1];
135
- if (!agentName) {
136
- console.error("Error: agent name required.\n" +
137
- " Example: agents-sdk use notion search_pages '{...}'");
138
- process.exit(1);
139
- }
140
- const agentDir = findAgentDir(agentName);
141
- if (!agentDir) {
142
- console.error(`Error: No generated agent '${agentName}' found.\n` +
143
- ` Looked in: ${getAgentsDir()}\n` +
144
- ` Run: agents-sdk codegen --server '...' --name ${agentName}`);
145
- process.exit(1);
146
- }
147
- // --list: show available tools
148
- if (hasFlag(args, "--list")) {
149
- const tools = listAgentTools(agentDir);
150
- console.log(`Tools for ${agentName}:\n`);
151
- for (const t of tools) {
152
- console.log(` ${t.name.padEnd(30)} ${t.description ?? ""}`);
153
- }
154
- return;
155
- }
156
- const toolName = args[2];
157
- if (!toolName) {
158
- console.error(`Error: tool name required.\n` +
159
- ` Example: agents-sdk use ${agentName} <tool> [params]\n` +
160
- ` List tools: agents-sdk use ${agentName} --list`);
161
- process.exit(1);
162
- }
163
- const paramsStr = args[3];
164
- const params = paramsStr ? JSON.parse(paramsStr) : {};
165
- try {
166
- const result = await useAgent({
167
- agentDir,
168
- tool: toolName,
169
- params,
170
- });
171
- console.log(JSON.stringify(result, null, 2));
172
- }
173
- catch (err) {
174
- console.error(`\x1b[31mError:\x1b[0m ${err instanceof Error ? err.message : String(err)}`);
175
- process.exit(1);
176
- }
177
- }
178
- function runList() {
179
- const agentsDir = getAgentsDir();
180
- if (!existsSync(agentsDir)) {
181
- console.log("No generated agents found.");
182
- return;
183
- }
184
- const entries = readdirSync(agentsDir);
185
- const agents = [];
186
- for (const entry of entries) {
187
- const manifestPath = join(agentsDir, entry, ".codegen-manifest.json");
188
- if (existsSync(manifestPath)) {
189
- try {
190
- const manifest = JSON.parse(require("node:fs").readFileSync(manifestPath, "utf-8"));
191
- agents.push({
192
- name: manifest.agentPath,
193
- tools: manifest.tools.length,
194
- server: manifest.serverInfo.name,
195
- });
196
- }
197
- catch {
198
- agents.push({ name: entry, tools: 0 });
199
- }
200
- }
201
- }
202
- if (agents.length === 0) {
203
- console.log("No generated agents found.");
204
- return;
205
- }
206
- console.log("Generated agents:\n");
207
- for (const a of agents) {
208
- console.log(` ${a.name.padEnd(25)} ${String(a.tools).padEnd(5)} tools${a.server ? ` (${a.server})` : ""}`);
209
- }
210
- }
211
- // ============================================
212
- // Main
213
- // ============================================
214
- switch (command) {
215
- case "codegen":
216
- await runCodegen(args);
217
- break;
218
- case "use":
219
- await runUse(args);
220
- break;
221
- case "list":
222
- runList();
223
- break;
224
- case "--help":
225
- case "-h":
226
- case undefined:
227
- printUsage();
228
- break;
229
- default:
230
- console.error(`Unknown command: ${command}`);
231
- printUsage();
232
- process.exit(1);
233
- }
234
- //# sourceMappingURL=cli.js.map
package/dist/cli.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGjE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAExB,+CAA+C;AAC/C,UAAU;AACV,+CAA+C;AAE/C,SAAS,SAAS,CAAC,IAAc,EAAE,IAAY;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,GAAG,KAAK,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC3D,OAAO,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,OAAO,CAAC,IAAc,EAAE,IAAY;IAC3C,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,8CAA8C;AAC9C,SAAS,YAAY;IACnB,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,I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