opentool 0.0.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 OpenTool
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,208 @@
1
+ # OpenTool
2
+
3
+ [![npm version](https://badge.fury.io/js/opentool.svg)](https://badge.fury.io/js/opentool)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ 🔗 **[opentool.dev](https://opentool.dev)** | 📖 **[Documentation](https://opentool.dev/docs)** | 🚀 **[Get Started](https://opentool.dev/get-started)**
7
+
8
+ A TypeScript framework for building serverless MCP (Model Context Protocol) tools that automatically deploy to AWS Lambda using [OpenPond](https://openpond.ai) hosting.
9
+
10
+ ## Features
11
+
12
+ - 🚀 **Serverless-first**: Tools automatically deploy to AWS Lambda
13
+ - 🔧 **Type-safe**: Full TypeScript support with Zod schema validation
14
+ - 🛠️ **CLI Tools**: Build, develop, and validate your tools
15
+ - 📦 **MCP Compatible**: Works with any MCP client
16
+ - 🔍 **Automatic Detection**: Detected by OpenPond hosting platform
17
+ - 🌍 **Local Development**: Test your tools locally before deployment
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install opentool
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ### 1. Create a new project
28
+
29
+ ```bash
30
+ mkdir my-opentool-project
31
+ cd my-opentool-project
32
+ npm init -y
33
+ npm install opentool
34
+ ```
35
+
36
+ ### 2. Create your first tool
37
+
38
+ Create a `tools/` directory and add your first tool:
39
+
40
+ ```typescript
41
+ // tools/greet.ts
42
+ import { z } from "zod";
43
+
44
+ export const schema = z.object({
45
+ name: z.string().describe("The name of the user to greet"),
46
+ });
47
+
48
+ export async function TOOL({ name }: z.infer<typeof schema>) {
49
+ return `Hello, ${name}! 👋`;
50
+ }
51
+ ```
52
+
53
+ ### 3. Test locally
54
+
55
+ ```bash
56
+ # Validate your tools
57
+ npx opentool validate
58
+
59
+ # Start development server
60
+ npx opentool dev
61
+ ```
62
+
63
+ ### 4. Build for deployment
64
+
65
+ ```bash
66
+ # Build tools for Lambda deployment
67
+ npx opentool build
68
+ ```
69
+
70
+ ### 5. Deploy to OpenPond
71
+
72
+ Create an account on [OpenPond](https://openpond.ai) and create a new project.
73
+
74
+ Add your project to the OpenPond project and connect it to your GitHub repository.
75
+
76
+ OpenPond will automatically detect the `opentool` dependency and deploy your tools to AWS Lambda using the UI.
77
+
78
+ ## CLI Commands
79
+
80
+ ### Build
81
+
82
+ Build your tools for deployment:
83
+
84
+ ```bash
85
+ npx opentool build [options]
86
+
87
+ Options:
88
+ -i, --input <dir> Input directory containing tools (default: "tools")
89
+ -o, --output <dir> Output directory for built tools (default: "dist")
90
+ --name <name> Server name (default: "opentool-server")
91
+ --version <version> Server version (default: "1.0.0")
92
+ ```
93
+
94
+ ### Development Server
95
+
96
+ Start a local development server:
97
+
98
+ ```bash
99
+ npx opentool dev [options]
100
+
101
+ Options:
102
+ -i, --input <dir> Input directory containing tools (default: "tools")
103
+ --watch Watch for file changes (default: false)
104
+ ```
105
+
106
+ ### Validate
107
+
108
+ Validate your tools:
109
+
110
+ ```bash
111
+ npx opentool validate [options]
112
+
113
+ Options:
114
+ -i, --input <dir> Input directory containing tools (default: "tools")
115
+ ```
116
+
117
+ ## Tool Definition
118
+
119
+ Each tool is defined by exporting three things:
120
+
121
+ 1. **schema**: Zod schema for input validation
122
+ 2. **metadata**: Tool information and MCP annotations
123
+ 3. **TOOL**: Async function that implements the tool logic
124
+
125
+ ```typescript
126
+ import { z } from "zod";
127
+
128
+ // Define the input schema
129
+ export const schema = z.object({
130
+ // Define your parameters here
131
+ });
132
+
133
+ // Define tool metadata
134
+ export const metadata = {
135
+ name: "my-tool",
136
+ description: "What this tool does",
137
+ annotations: {
138
+ title: "Tool Title",
139
+ readOnlyHint: true,
140
+ destructiveHint: false,
141
+ idempotentHint: true,
142
+ openWorldHint: false,
143
+ },
144
+ };
145
+
146
+ // Implement the tool
147
+ export async function TOOL(params: z.infer<typeof schema>) {
148
+ // Implement your tool logic here
149
+ // Just return a string - it will be wrapped in MCP format automatically
150
+ return "Tool response";
151
+ }
152
+ ```
153
+
154
+ ## Error Handling
155
+
156
+ Simply throw errors in your TOOL function - they will be automatically converted to MCP error responses:
157
+
158
+ ```typescript
159
+ export async function TOOL(params: z.infer<typeof schema>) {
160
+ if (someCondition) {
161
+ throw new Error("Something went wrong");
162
+ }
163
+ return "Success";
164
+ }
165
+ ```
166
+
167
+ ## Local Development
168
+
169
+ The development server runs your tools locally using the MCP protocol over stdio. You can:
170
+
171
+ 1. Test individual tools
172
+ 2. Validate schemas
173
+ 3. Check tool responses
174
+ 4. Debug issues before deployment
175
+
176
+ ## Deployment
177
+
178
+ When you push a project with `opentool` dependency to GitHub and connect it to OpenPond:
179
+
180
+ 1. **Detection**: OpenPond detects the `opentool` package
181
+ 2. **Routing**: Project is routed to AWS Lambda deployment
182
+ 3. **Build**: Tools are built using `npx opentool build`
183
+ 4. **Deploy**: Lambda function is created with Function URLs
184
+ 5. **Ready**: Your tools are available as serverless MCP servers!
185
+
186
+ ## Examples
187
+
188
+ See the `examples/` directory for complete examples including:
189
+
190
+ - Basic greeting tool
191
+ - Calculator tool
192
+ - HTTP client tool
193
+ - File processing tool
194
+
195
+ ## Contributing
196
+
197
+ We welcome contributions! Please see our [Contributing Guide](https://github.com/openpond/opentool/blob/master/CONTRIBUTING.md) for details.
198
+
199
+ ## Community
200
+
201
+ - 🌐 **Website**: [opentool.dev](https://opentool.dev)
202
+ - 📖 **Documentation**: [opentool.dev/docs](https://opentool.dev/docs)
203
+ - 🐛 **Issues**: [GitHub Issues](https://github.com/openpond/opentool/issues)
204
+ - 💬 **Discussions**: [GitHub Discussions](https://github.com/openpond/opentool/discussions)
205
+
206
+ ## License
207
+
208
+ MIT © [OpenTool](https://opentool.dev)
@@ -0,0 +1,8 @@
1
+ export interface BuildOptions {
2
+ input: string;
3
+ output: string;
4
+ name?: string;
5
+ version?: string;
6
+ }
7
+ export declare function buildCommand(options: BuildOptions): Promise<void>;
8
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA6CvE"}
@@ -0,0 +1,368 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.buildCommand = buildCommand;
37
+ const fs = __importStar(require("fs"));
38
+ const path = __importStar(require("path"));
39
+ const types_1 = require("../types");
40
+ // Register ts-node for TypeScript file execution
41
+ try {
42
+ require("ts-node/register");
43
+ }
44
+ catch {
45
+ // ts-node not available, continue without it
46
+ }
47
+ async function buildCommand(options) {
48
+ console.log("🔨 Building OpenTool project...");
49
+ const config = {
50
+ toolsDir: path.resolve(options.input),
51
+ outputDir: path.resolve(options.output),
52
+ serverName: options.name || "opentool-server",
53
+ serverVersion: options.version || "1.0.0",
54
+ };
55
+ try {
56
+ // Validate tools directory exists
57
+ if (!fs.existsSync(config.toolsDir)) {
58
+ throw new Error(`Tools directory not found: ${config.toolsDir}`);
59
+ }
60
+ // Load and validate tools
61
+ const tools = await loadTools(config.toolsDir);
62
+ console.log(`📦 Found ${tools.length} tools`);
63
+ // Create output directory
64
+ if (!fs.existsSync(config.outputDir)) {
65
+ fs.mkdirSync(config.outputDir, { recursive: true });
66
+ }
67
+ // Generate server index
68
+ await generateServerIndex(tools, config);
69
+ // Copy tools to output directory
70
+ await copyTools(config.toolsDir, config.outputDir, tools);
71
+ console.log("✅ Build completed successfully!");
72
+ console.log(`📁 Output directory: ${config.outputDir}`);
73
+ console.log("📄 Generated files:");
74
+ console.log(" 📟 mcp-server.js - Stdio MCP server");
75
+ console.log(" 🔗 lambda-handler.js - AWS Lambda handler");
76
+ console.log(` 📂 tools/ - ${tools.length} tool files`);
77
+ console.log("\\n🧪 Test your MCP server:");
78
+ console.log(` echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | node ${config.outputDir}/mcp-server.js`);
79
+ }
80
+ catch (error) {
81
+ console.error("❌ Build failed:", error);
82
+ process.exit(1);
83
+ }
84
+ }
85
+ async function loadTools(toolsDir) {
86
+ const tools = [];
87
+ const files = fs.readdirSync(toolsDir);
88
+ for (const file of files) {
89
+ if (file.endsWith(".ts") || file.endsWith(".js")) {
90
+ const toolPath = path.join(toolsDir, file);
91
+ try {
92
+ let toolModule;
93
+ if (file.endsWith(".ts")) {
94
+ // For TypeScript files, use dynamic import with ts-node
95
+ delete require.cache[require.resolve(toolPath)];
96
+ toolModule = await Promise.resolve(`${toolPath}`).then(s => __importStar(require(s)));
97
+ }
98
+ else {
99
+ // For JavaScript files, use require
100
+ delete require.cache[require.resolve(toolPath)];
101
+ toolModule = require(toolPath);
102
+ }
103
+ // Check for required exports (schema and TOOL function, metadata is optional)
104
+ if (toolModule.TOOL && toolModule.schema) {
105
+ let completeMetadata = null;
106
+ const baseName = file.replace(/\.(ts|js)$/, "");
107
+ // Only create metadata if user provided some metadata
108
+ if (toolModule.metadata) {
109
+ const partialMetadata = toolModule.metadata;
110
+ completeMetadata = (0, types_1.createToolMetadata)(partialMetadata, file);
111
+ }
112
+ const tool = {
113
+ schema: toolModule.schema,
114
+ metadata: completeMetadata,
115
+ filename: baseName,
116
+ handler: async (params) => {
117
+ const result = await toolModule.TOOL(params);
118
+ // Handle both string and object returns
119
+ if (typeof result === "string") {
120
+ return {
121
+ content: [{ type: "text", text: result }],
122
+ isError: false,
123
+ };
124
+ }
125
+ return result;
126
+ },
127
+ };
128
+ tools.push(tool);
129
+ const toolName = completeMetadata?.name || file.replace(/\.(ts|js)$/, "");
130
+ const toolDesc = completeMetadata?.description || `${toolName} tool`;
131
+ console.log(` ✓ ${toolName} - ${toolDesc}`);
132
+ }
133
+ else {
134
+ console.warn(` ⚠ ${file} - Invalid tool format. Must export: schema and TOOL function (metadata is optional)`);
135
+ }
136
+ }
137
+ catch (error) {
138
+ console.warn(` ❌ ${file} - Failed to load: ${error}`);
139
+ }
140
+ }
141
+ }
142
+ return tools;
143
+ }
144
+ async function generateServerIndex(tools, config) {
145
+ // Generate MCP server for stdio transport
146
+ await generateMcpServer(tools, config);
147
+ // Generate Lambda handler with AWS adapter
148
+ await generateLambdaHandler(config);
149
+ }
150
+ async function generateMcpServer(tools, config) {
151
+ const mcpServerCode = `#!/usr/bin/env node
152
+ // Auto-generated MCP server with stdio transport
153
+ const { Server } = require('@modelcontextprotocol/sdk/server/index.js');
154
+ const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
155
+ const { CallToolRequestSchema, ListToolsRequestSchema } = require('@modelcontextprotocol/sdk/types.js');
156
+
157
+ // Import tools
158
+ ${tools
159
+ .map((tool, index) => `const tool${index} = require('./tools/${tool.filename}.js');`)
160
+ .join("\n")}
161
+
162
+ const tools = [
163
+ ${tools
164
+ .map((_, index) => ` {
165
+ schema: tool${index}.schema,
166
+ metadata: tool${index}.metadata,
167
+ handler: tool${index}.TOOL
168
+ },`)
169
+ .join("\n")}
170
+ ];
171
+
172
+ // Create MCP server
173
+ const server = new Server(
174
+ {
175
+ name: '${config.serverName}',
176
+ version: '${config.serverVersion}',
177
+ },
178
+ {
179
+ capabilities: {
180
+ tools: {},
181
+ },
182
+ }
183
+ );
184
+
185
+ // Register list tools handler
186
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({
187
+ tools: tools.map((tool, index) => {
188
+ // Convert Zod schema to JSON Schema format using proper library
189
+ let inputSchema = { type: 'object' };
190
+ const toolName = tool.metadata?.name || tool.filename;
191
+
192
+ try {
193
+ const { zodToJsonSchema } = require('zod-to-json-schema');
194
+ inputSchema = zodToJsonSchema(tool.schema, {
195
+ name: \`\${toolName}Schema\`,
196
+ target: 'jsonSchema7',
197
+ definitions: {}
198
+ });
199
+ } catch (error) {
200
+ console.warn(\`Failed to convert schema for tool \${toolName}:\`, error);
201
+ // Fallback to basic object schema
202
+ inputSchema = { type: 'object' };
203
+ }
204
+
205
+ const toolDef = {
206
+ name: toolName,
207
+ description: tool.metadata?.description || \`Tool \${index}\`,
208
+ inputSchema
209
+ };
210
+
211
+ // Add annotations if they exist
212
+ if (tool.metadata?.annotations) {
213
+ toolDef.annotations = tool.metadata.annotations;
214
+ }
215
+
216
+ return toolDef;
217
+ }),
218
+ }));
219
+
220
+ // Register call tool handler
221
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
222
+ const tool = tools.find(t => {
223
+ const toolName = t.metadata?.name || t.filename;
224
+ return toolName === request.params.name;
225
+ });
226
+ if (!tool) {
227
+ throw new Error(\`Tool \${request.params.name} not found\`);
228
+ }
229
+
230
+ try {
231
+ const validatedParams = tool.schema.parse(request.params.arguments);
232
+ const result = await tool.handler(validatedParams);
233
+
234
+ // Handle both string and object responses
235
+ if (typeof result === 'string') {
236
+ return {
237
+ content: [{ type: 'text', text: result }],
238
+ isError: false,
239
+ };
240
+ } else if (result && typeof result === 'object' && result.content) {
241
+ return {
242
+ content: result.content,
243
+ isError: result.isError || false,
244
+ };
245
+ } else {
246
+ // Fallback for any other response type
247
+ return {
248
+ content: [{ type: 'text', text: String(result) }],
249
+ isError: false,
250
+ };
251
+ }
252
+ } catch (error) {
253
+ return {
254
+ content: [{ type: 'text', text: \`Error: \${error.message || error}\` }],
255
+ isError: true,
256
+ };
257
+ }
258
+ });
259
+
260
+ // Start server with stdio transport
261
+ async function main() {
262
+ const transport = new StdioServerTransport();
263
+ await server.connect(transport);
264
+ }
265
+
266
+ if (require.main === module) {
267
+ main().catch(console.error);
268
+ }
269
+
270
+ module.exports = { server, tools };
271
+ `;
272
+ const mcpServerPath = path.join(config.outputDir, "mcp-server.js");
273
+ fs.writeFileSync(mcpServerPath, mcpServerCode);
274
+ // Make executable
275
+ fs.chmodSync(mcpServerPath, 0o755);
276
+ }
277
+ async function generateLambdaHandler(config) {
278
+ const lambdaHandlerCode = `// Auto-generated AWS Lambda handler
279
+ // Uses AWS MCP adapter to run stdio MCP server
280
+
281
+ const serverParams = {
282
+ command: 'node',
283
+ args: ['mcp-server.js'],
284
+ };
285
+
286
+ exports.handler = async (event, context) => {
287
+ // Dynamically import ES module into CommonJS Lambda function
288
+ const { stdioServerAdapter } = await import(
289
+ '@aws/run-mcp-servers-with-aws-lambda'
290
+ );
291
+
292
+ return await stdioServerAdapter(serverParams, event, context);
293
+ };
294
+ `;
295
+ const lambdaHandlerPath = path.join(config.outputDir, "lambda-handler.js");
296
+ fs.writeFileSync(lambdaHandlerPath, lambdaHandlerCode);
297
+ }
298
+ async function copyTools(sourceDir, outputDir, tools) {
299
+ const toolsOutputDir = path.join(outputDir, "tools");
300
+ if (!fs.existsSync(toolsOutputDir)) {
301
+ fs.mkdirSync(toolsOutputDir, { recursive: true });
302
+ }
303
+ // Create a map of filenames to their generated metadata using tool.filename as source of truth
304
+ const toolMetadataMap = new Map();
305
+ tools.forEach((tool) => {
306
+ if (tool.metadata) {
307
+ // Use the filename with extensions for mapping
308
+ const tsFile = `${tool.filename}.ts`;
309
+ const jsFile = `${tool.filename}.js`;
310
+ toolMetadataMap.set(tsFile, tool.metadata);
311
+ toolMetadataMap.set(jsFile, tool.metadata);
312
+ }
313
+ });
314
+ const files = fs.readdirSync(sourceDir);
315
+ for (const file of files) {
316
+ if (file.endsWith(".ts") || file.endsWith(".js")) {
317
+ const sourcePath = path.join(sourceDir, file);
318
+ if (file.endsWith(".ts")) {
319
+ // For TypeScript files, compile to JavaScript
320
+ const outputPath = path.join(toolsOutputDir, file.replace(".ts", ".js"));
321
+ const generatedMetadata = toolMetadataMap.get(file);
322
+ await compileTypeScriptFile(sourcePath, outputPath, generatedMetadata);
323
+ }
324
+ else {
325
+ // For JavaScript files, copy directly
326
+ const outputPath = path.join(toolsOutputDir, file);
327
+ fs.copyFileSync(sourcePath, outputPath);
328
+ }
329
+ }
330
+ }
331
+ }
332
+ async function compileTypeScriptFile(sourcePath, outputPath, metadata) {
333
+ const { exec } = require("child_process");
334
+ const { promisify } = require("util");
335
+ const execAsync = promisify(exec);
336
+ try {
337
+ // Create a temporary directory for compilation
338
+ const tempDir = path.join(path.dirname(outputPath), "temp_compile");
339
+ if (!fs.existsSync(tempDir)) {
340
+ fs.mkdirSync(tempDir, { recursive: true });
341
+ }
342
+ // Copy the TypeScript file to temp directory
343
+ const tempSourcePath = path.join(tempDir, path.basename(sourcePath));
344
+ fs.copyFileSync(sourcePath, tempSourcePath);
345
+ // Use TypeScript compiler to compile single file
346
+ await execAsync(`npx tsc ${tempSourcePath} --outDir ${tempDir} --target es2020 --module commonjs --esModuleInterop --skipLibCheck --moduleResolution node`);
347
+ // Move the compiled file to the correct location and inject metadata if needed
348
+ const compiledPath = path.join(tempDir, path.basename(sourcePath).replace(".ts", ".js"));
349
+ if (fs.existsSync(compiledPath)) {
350
+ let jsContent = fs.readFileSync(compiledPath, "utf8");
351
+ // Only inject metadata if the user originally provided some metadata
352
+ if (metadata && !jsContent.includes("exports.metadata")) {
353
+ // Add metadata export to the compiled JavaScript
354
+ const metadataExport = `\nexports.metadata = ${JSON.stringify(metadata, null, 2)};\n`;
355
+ jsContent += metadataExport;
356
+ }
357
+ fs.writeFileSync(outputPath, jsContent);
358
+ }
359
+ // Clean up temp directory
360
+ fs.rmSync(tempDir, { recursive: true, force: true });
361
+ }
362
+ catch (error) {
363
+ console.warn(`Failed to compile ${sourcePath}:`, error);
364
+ // Fallback: copy the TypeScript file as-is
365
+ fs.copyFileSync(sourcePath, outputPath.replace(".js", ".ts"));
366
+ }
367
+ }
368
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,oCA6CC;AApED,uCAAyB;AACzB,2CAA6B;AAC7B,oCAKkB;AAElB,iDAAiD;AACjD,IAAI,CAAC;IACH,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC9B,CAAC;AAAC,MAAM,CAAC;IACP,6CAA6C;AAC/C,CAAC;AASM,KAAK,UAAU,YAAY,CAAC,OAAqB;IACtD,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;IAE/C,MAAM,MAAM,GAAgB;QAC1B,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;QACrC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC;QACvC,UAAU,EAAE,OAAO,CAAC,IAAI,IAAI,iBAAiB;QAC7C,aAAa,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO;KAC1C,CAAC;IAEF,IAAI,CAAC;QACH,kCAAkC;QAClC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,8BAA8B,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACnE,CAAC;QAED,0BAA0B;QAC1B,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/C,OAAO,CAAC,GAAG,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AE,CAAC;YAChC,IAAI,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YAEtD,qEAAqE;YACrE,IAAI,QAAQ,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBACxD,iDAAiD;gBACjD,MAAM,cAAc,GAAG,wBAAwB,IAAI,CAAC,SAAS,CAC3D,QAAQ,EACR,IAAI,EACJ,CAAC,CACF,KAAK,CAAC;gBACP,SAAS,IAAI,cAAc,CAAC;YAC9B,CAAC;YAED,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;QAC1C,CAAC;QAED,0BAA0B;QAC1B,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,qBAAqB,UAAU,GAAG,EAAE,KAAK,CAAC,CAAC;QACxD,2CAA2C;QAC3C,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface DevOptions {
2
+ input: string;
3
+ watch: boolean;
4
+ }
5
+ export declare function devCommand(options: DevOptions): Promise<void>;
6
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/cli/dev.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CnE"}