@vulcan-energy/mcp-helper 0.1.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/README.md +154 -0
- package/dist/bin/vulcan-mcp-helper.d.ts +9 -0
- package/dist/bin/vulcan-mcp-helper.d.ts.map +1 -0
- package/dist/bin/vulcan-mcp-helper.js +58 -0
- package/dist/bin/vulcan-mcp-helper.js.map +1 -0
- package/dist/src/engine/filesystem.d.ts +30 -0
- package/dist/src/engine/filesystem.d.ts.map +1 -0
- package/dist/src/engine/filesystem.js +61 -0
- package/dist/src/engine/filesystem.js.map +1 -0
- package/dist/src/engine/wasm.d.ts +23 -0
- package/dist/src/engine/wasm.d.ts.map +1 -0
- package/dist/src/engine/wasm.js +333 -0
- package/dist/src/engine/wasm.js.map +1 -0
- package/dist/src/engine/workspace.d.ts +23 -0
- package/dist/src/engine/workspace.d.ts.map +1 -0
- package/dist/src/engine/workspace.js +82 -0
- package/dist/src/engine/workspace.js.map +1 -0
- package/dist/src/server.d.ts +8 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/server.js +166 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/tools/calculateMetrics.d.ts +31 -0
- package/dist/src/tools/calculateMetrics.d.ts.map +1 -0
- package/dist/src/tools/calculateMetrics.js +347 -0
- package/dist/src/tools/calculateMetrics.js.map +1 -0
- package/dist/src/tools/createBatchConfig.d.ts +25 -0
- package/dist/src/tools/createBatchConfig.d.ts.map +1 -0
- package/dist/src/tools/createBatchConfig.js +128 -0
- package/dist/src/tools/createBatchConfig.js.map +1 -0
- package/dist/src/tools/getBatchStatus.d.ts +23 -0
- package/dist/src/tools/getBatchStatus.d.ts.map +1 -0
- package/dist/src/tools/getBatchStatus.js +194 -0
- package/dist/src/tools/getBatchStatus.js.map +1 -0
- package/dist/src/tools/index.d.ts +67 -0
- package/dist/src/tools/index.d.ts.map +1 -0
- package/dist/src/tools/index.js +361 -0
- package/dist/src/tools/index.js.map +1 -0
- package/dist/src/tools/listBatchModels.d.ts +25 -0
- package/dist/src/tools/listBatchModels.d.ts.map +1 -0
- package/dist/src/tools/listBatchModels.js +86 -0
- package/dist/src/tools/listBatchModels.js.map +1 -0
- package/dist/src/tools/listCsvColumns.d.ts +27 -0
- package/dist/src/tools/listCsvColumns.d.ts.map +1 -0
- package/dist/src/tools/listCsvColumns.js +93 -0
- package/dist/src/tools/listCsvColumns.js.map +1 -0
- package/dist/src/tools/listParameters.d.ts +25 -0
- package/dist/src/tools/listParameters.d.ts.map +1 -0
- package/dist/src/tools/listParameters.js +64 -0
- package/dist/src/tools/listParameters.js.map +1 -0
- package/dist/src/tools/runBatch.d.ts +19 -0
- package/dist/src/tools/runBatch.d.ts.map +1 -0
- package/dist/src/tools/runBatch.js +90 -0
- package/dist/src/tools/runBatch.js.map +1 -0
- package/dist/src/tools/saveParameter.d.ts +23 -0
- package/dist/src/tools/saveParameter.d.ts.map +1 -0
- package/dist/src/tools/saveParameter.js +87 -0
- package/dist/src/tools/saveParameter.js.map +1 -0
- package/dist/src/tools/viewParameter.d.ts +18 -0
- package/dist/src/tools/viewParameter.d.ts.map +1 -0
- package/dist/src/tools/viewParameter.js +51 -0
- package/dist/src/tools/viewParameter.js.map +1 -0
- package/dist/src/utils/batchConfig.d.ts +32 -0
- package/dist/src/utils/batchConfig.d.ts.map +1 -0
- package/dist/src/utils/batchConfig.js +130 -0
- package/dist/src/utils/batchConfig.js.map +1 -0
- package/dist/src/utils/fileLoader.d.ts +21 -0
- package/dist/src/utils/fileLoader.d.ts.map +1 -0
- package/dist/src/utils/fileLoader.js +86 -0
- package/dist/src/utils/fileLoader.js.map +1 -0
- package/package.json +47 -0
- package/wasm/snippets/wasm-bindgen-rayon-38edf6e439f6d70d/src/workerHelpers.no-bundler.js +77 -0
- package/wasm/wasm_version.json +8 -0
- package/wasm/wasm_wrapper.js +1190 -0
- package/wasm/wasm_wrapper_bg.wasm +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Vulcan MCP Server
|
|
2
|
+
|
|
3
|
+
A Model Context Protocol (MCP) server that exposes Vulcan's core functionality for integration with Cursor and other MCP clients.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This MCP server provides access to Vulcan's parameter management, batch configuration, and simulation capabilities via stdio **or** Streamable HTTP (JSON-RPC over HTTP).
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Node.js (v18 or later)
|
|
12
|
+
- A Vulcan workspace with FSA (File System Access) mode enabled
|
|
13
|
+
- A valid `vulcan-mcp-config.json` file (generated from Vulcan → Integrations → MCP)
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### Local Development
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
cd vulcan-mcp-server
|
|
21
|
+
npm install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Production Distribution
|
|
25
|
+
|
|
26
|
+
The server will be distributed via Vulcan website (behind authentication) for end users.
|
|
27
|
+
|
|
28
|
+
## Configuration
|
|
29
|
+
|
|
30
|
+
The server requires a config file at `{workspace}/vulcan-mcp-config.json`:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"workspace": "/absolute/path/to/workspace",
|
|
35
|
+
"user_id": "supabase-user-id"
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Generate this file from Vulcan → Integrations → MCP after:
|
|
40
|
+
1. Logging into Vulcan
|
|
41
|
+
2. Selecting a workspace in FSA (Folder) mode
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
### Command Line
|
|
46
|
+
|
|
47
|
+
#### Stdio mode (original)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
node index.js --config /path/to/vulcan-mcp-config.json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### HTTP mode (recommended for Cursor)
|
|
54
|
+
|
|
55
|
+
**Using npm (easiest):**
|
|
56
|
+
```bash
|
|
57
|
+
cd vulcan-mcp-server
|
|
58
|
+
npm start
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Or manually:**
|
|
62
|
+
```bash
|
|
63
|
+
# default port 4000 (override with --http-port or MCP_HTTP_PORT)
|
|
64
|
+
node index.js --http-port 4000 --config ../vulcan-mcp-config.json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Cursor Configuration
|
|
68
|
+
|
|
69
|
+
#### HTTP transport (recommended)
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"vulcan": {
|
|
75
|
+
"url": "http://127.0.0.1:4000/mcp"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
#### Stdio transport (legacy)
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"mcpServers": {
|
|
86
|
+
"vulcan": {
|
|
87
|
+
"command": "node",
|
|
88
|
+
"args": ["/absolute/path/to/vulcan-mcp-server/index.js", "--config", "/absolute/path/to/workspace/vulcan-mcp-config.json"]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Available Tools
|
|
95
|
+
|
|
96
|
+
### `vulcan_list_parameters`
|
|
97
|
+
|
|
98
|
+
List available parameter categories and their JSON snippets.
|
|
99
|
+
|
|
100
|
+
**Arguments:**
|
|
101
|
+
- `category` (optional): Filter by category name
|
|
102
|
+
|
|
103
|
+
**Returns:**
|
|
104
|
+
- Catalog structure with categories and parameters
|
|
105
|
+
- Total counts
|
|
106
|
+
|
|
107
|
+
### Metrics Tool Notes
|
|
108
|
+
|
|
109
|
+
- `vulcan_calculate_metrics` supports comparator-based metrics (`sumIf`, `averageIf`, `countIf`) and compliance metrics (e.g., `dwelling_emission_rate|compliance`).
|
|
110
|
+
- Cost metrics are temporarily blocked in MCP until tariff data plumbing lands—requests containing cost metrics will return an actionable error.
|
|
111
|
+
- Results now include each metric’s `id`, `name`, `column`, and `function`, matching what you send from Cursor.
|
|
112
|
+
|
|
113
|
+
## Development
|
|
114
|
+
|
|
115
|
+
### Testing Locally
|
|
116
|
+
|
|
117
|
+
1. Create a test config file:
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"workspace": "/path/to/your/workspace",
|
|
121
|
+
"user_id": "test-user-id"
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
2. Test the server (stdio mode):
|
|
126
|
+
```bash
|
|
127
|
+
node index.js --config test-config.json
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
3. Send test requests via stdin (newline-delimited JSON-RPC):
|
|
131
|
+
```json
|
|
132
|
+
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}
|
|
133
|
+
{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}
|
|
134
|
+
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"vulcan_list_parameters","arguments":{}}}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Logging & Diagnostics
|
|
138
|
+
|
|
139
|
+
- All WASM `console.log` output is redirected to **stderr** so MCP stdout carries only JSON-RPC. This prevents Cursor’s “model returned error” dialog that appears when stdout is polluted.
|
|
140
|
+
- When debugging, tail stderr (or pipe it to a file) to see WASM initialization and metrics parsing logs.
|
|
141
|
+
|
|
142
|
+
## Architecture
|
|
143
|
+
|
|
144
|
+
- **Node.js**: Single runtime, cross-platform
|
|
145
|
+
- **WASM**: Uses existing WASM bundle from `web/pkg/` (for validation, batch execution, metrics)
|
|
146
|
+
- **File Operations**: Node.js `fs` module for workspace file access
|
|
147
|
+
- **Protocol**: MCP via stdio (newline-delimited JSON-RPC) or Streamable HTTP (`POST /mcp`)
|
|
148
|
+
|
|
149
|
+
## Future Enhancements
|
|
150
|
+
|
|
151
|
+
- Additional tools: `vulcan_view_parameter`, `vulcan_save_parameter`, `vulcan_create_batch_config`, `vulcan_run_batch`, `vulcan_get_batch_status`, `vulcan_calculate_metrics`
|
|
152
|
+
- WASM integration for validation and batch execution
|
|
153
|
+
- Enhanced error handling and logging
|
|
154
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vulcan-mcp-helper.d.ts","sourceRoot":"","sources":["../../bin/vulcan-mcp-helper.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* CLI entry point for vulcan-mcp-helper
|
|
4
|
+
*
|
|
5
|
+
* Thin wrapper that parses --config and --port arguments,
|
|
6
|
+
* then imports and calls startServer() from src/server.ts
|
|
7
|
+
*/
|
|
8
|
+
import { startServer } from '../src/server.js';
|
|
9
|
+
function parseArgs() {
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
const result = {};
|
|
12
|
+
for (let i = 0; i < args.length; i++) {
|
|
13
|
+
if (args[i] === '--config' && i + 1 < args.length) {
|
|
14
|
+
result.configPath = args[i + 1];
|
|
15
|
+
i++; // Skip next arg
|
|
16
|
+
}
|
|
17
|
+
else if (args[i] === '--port' && i + 1 < args.length) {
|
|
18
|
+
const port = parseInt(args[i + 1], 10);
|
|
19
|
+
if (isNaN(port) || port < 1 || port > 65535) {
|
|
20
|
+
console.error(`Invalid port: ${args[i + 1]}`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
result.port = port;
|
|
24
|
+
i++; // Skip next arg
|
|
25
|
+
}
|
|
26
|
+
else if (args[i] === '--help' || args[i] === '-h') {
|
|
27
|
+
console.log(`
|
|
28
|
+
Usage: vulcan-mcp-helper [--config <path>] [--port <port>]
|
|
29
|
+
|
|
30
|
+
Options:
|
|
31
|
+
--config <path> Path to vulcan-mcp-config.json (default: ./vulcan-mcp-config.json)
|
|
32
|
+
--port <port> Port to listen on (default: 5000)
|
|
33
|
+
--help, -h Show this help message
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
vulcan-mcp-helper
|
|
37
|
+
vulcan-mcp-helper --config /path/to/vulcan-mcp-config.json
|
|
38
|
+
vulcan-mcp-helper --port 5000
|
|
39
|
+
vulcan-mcp-helper --config ./config.json --port 5000
|
|
40
|
+
`);
|
|
41
|
+
process.exit(0);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
async function main() {
|
|
47
|
+
try {
|
|
48
|
+
const { configPath, port } = parseArgs();
|
|
49
|
+
await startServer(configPath, port);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
const err = error;
|
|
53
|
+
console.error(`Error: ${err.message}`);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
main();
|
|
58
|
+
//# sourceMappingURL=vulcan-mcp-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vulcan-mcp-helper.js","sourceRoot":"","sources":["../../bin/vulcan-mcp-helper.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,SAAS,SAAS;IAChB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,MAAM,GAA2C,EAAE,CAAC;IAE1D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,UAAU,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YAClD,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAChC,CAAC,EAAE,CAAC,CAAC,gBAAgB;QACvB,CAAC;aAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;YACvD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,KAAK,EAAE,CAAC;gBAC5C,OAAO,CAAC,KAAK,CAAC,iBAAiB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;gBAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;YACD,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;YACnB,CAAC,EAAE,CAAC,CAAC,gBAAgB;QACvB,CAAC;aAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YACpD,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;CAajB,CAAC,CAAC;YACG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,CAAC;QACzC,MAAM,WAAW,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,KAAc,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QACvC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File system access helpers for workspace operations
|
|
3
|
+
* These are thin wrappers around Node.js fs operations
|
|
4
|
+
* that work with FSA (real filesystem) workspaces only
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Check if a path exists
|
|
8
|
+
*/
|
|
9
|
+
export declare function pathExists(filePath: string): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Read a file as text
|
|
12
|
+
*/
|
|
13
|
+
export declare function readFileText(filePath: string): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Write a file (creates parent directories if needed)
|
|
16
|
+
*/
|
|
17
|
+
export declare function writeFileText(filePath: string, content: string): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* List directory contents
|
|
20
|
+
*/
|
|
21
|
+
export declare function listDirectory(dirPath: string): Promise<string[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a path is a directory
|
|
24
|
+
*/
|
|
25
|
+
export declare function isDirectory(dirPath: string): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve a path relative to a workspace root
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveWorkspacePath(workspaceRoot: string, relativePath: string): string;
|
|
30
|
+
//# sourceMappingURL=filesystem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../../src/engine/filesystem.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AAEH;;GAEG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEpE;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIpF;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEtE;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAKxF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
/**
|
|
4
|
+
* File system access helpers for workspace operations
|
|
5
|
+
* These are thin wrappers around Node.js fs operations
|
|
6
|
+
* that work with FSA (real filesystem) workspaces only
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Check if a path exists
|
|
10
|
+
*/
|
|
11
|
+
export async function pathExists(filePath) {
|
|
12
|
+
try {
|
|
13
|
+
await fs.access(filePath);
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Read a file as text
|
|
22
|
+
*/
|
|
23
|
+
export async function readFileText(filePath) {
|
|
24
|
+
return await fs.readFile(filePath, 'utf-8');
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Write a file (creates parent directories if needed)
|
|
28
|
+
*/
|
|
29
|
+
export async function writeFileText(filePath, content) {
|
|
30
|
+
const dir = path.dirname(filePath);
|
|
31
|
+
await fs.mkdir(dir, { recursive: true });
|
|
32
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* List directory contents
|
|
36
|
+
*/
|
|
37
|
+
export async function listDirectory(dirPath) {
|
|
38
|
+
return await fs.readdir(dirPath);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check if a path is a directory
|
|
42
|
+
*/
|
|
43
|
+
export async function isDirectory(dirPath) {
|
|
44
|
+
try {
|
|
45
|
+
const stat = await fs.stat(dirPath);
|
|
46
|
+
return stat.isDirectory();
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve a path relative to a workspace root
|
|
54
|
+
*/
|
|
55
|
+
export function resolveWorkspacePath(workspaceRoot, relativePath) {
|
|
56
|
+
if (path.isAbsolute(relativePath)) {
|
|
57
|
+
return relativePath;
|
|
58
|
+
}
|
|
59
|
+
return path.resolve(workspaceRoot, relativePath);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=filesystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filesystem.js","sourceRoot":"","sources":["../../../src/engine/filesystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,QAAgB;IAC/C,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IACjD,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB,EAAE,OAAe;IACnE,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,OAAO,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAe;IAC/C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,aAAqB,EAAE,YAAoB;IAC9E,IAAI,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAClC,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WASM module type (from wasm-pack generated bindings)
|
|
3
|
+
* We use a loose type here since the exact shape depends on the generated bindings
|
|
4
|
+
*/
|
|
5
|
+
interface WasmModule {
|
|
6
|
+
initSync?: (options: {
|
|
7
|
+
module: Buffer | Uint8Array;
|
|
8
|
+
}) => void;
|
|
9
|
+
setup_panic_hook?: () => void;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export declare function initWasm(): Promise<WasmModule>;
|
|
13
|
+
/**
|
|
14
|
+
* Get initialized WASM module (throws if not initialized)
|
|
15
|
+
*/
|
|
16
|
+
export declare function getWasmModule(): WasmModule;
|
|
17
|
+
/**
|
|
18
|
+
* Set the current workspace for file system bridge functions
|
|
19
|
+
* This should be called before each WASM operation that uses file I/O
|
|
20
|
+
*/
|
|
21
|
+
export declare function setWorkspace(workspace: string): void;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=wasm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../../../src/engine/wasm.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,UAAU,UAAU;IAClB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAAA;KAAE,KAAK,IAAI,CAAC;IAC9D,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AA6KD,wBAAsB,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC,CAqLpD;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAK1C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEpD"}
|