@insforge/mcp 1.2.4-deployment.2 → 1.2.4-deployment.4

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.
@@ -7,6 +7,8 @@ import { promises as fs } from "fs";
7
7
  import { exec } from "child_process";
8
8
  import { promisify } from "util";
9
9
  import { tmpdir } from "os";
10
+ import { createWriteStream } from "fs";
11
+ import archiver from "archiver";
10
12
 
11
13
  // src/shared/response-handler.ts
12
14
  async function handleApiResponse(response) {
@@ -2037,17 +2039,44 @@ To: Your current project directory
2037
2039
  const createResult = await handleApiResponse(createResponse);
2038
2040
  const { id: deploymentId, uploadUrl, uploadFields } = createResult;
2039
2041
  const zipPath = `${tmpdir()}/deployment-${deploymentId}.zip`;
2040
- const excludePatterns = [
2041
- "node_modules/*",
2042
- ".git/*",
2043
- ".next/*",
2044
- "dist/*",
2045
- ".env.local",
2046
- ".DS_Store"
2047
- ];
2048
- const excludeArgs = excludePatterns.map((p) => `-x "${p}"`).join(" ");
2049
- await execAsync(`cd "${sourceDirectory}" && zip -r "${zipPath}" . ${excludeArgs}`);
2050
- const zipBuffer = await fs.readFile(zipPath);
2042
+ await new Promise((resolve, reject) => {
2043
+ const output = createWriteStream(zipPath);
2044
+ const archive = archiver("zip", { zlib: { level: 9 } });
2045
+ archive.on("error", (err) => reject(err));
2046
+ output.on("error", (err) => reject(err));
2047
+ output.on("close", () => resolve());
2048
+ archive.pipe(output);
2049
+ archive.glob("**/*", {
2050
+ cwd: sourceDirectory,
2051
+ ignore: [
2052
+ "node_modules/**",
2053
+ ".git/**",
2054
+ ".next/**",
2055
+ "dist/**",
2056
+ ".env.local",
2057
+ ".DS_Store"
2058
+ ],
2059
+ dot: true
2060
+ // Include dotfiles like .env
2061
+ });
2062
+ archive.finalize();
2063
+ });
2064
+ const zipBuffer = await (async () => {
2065
+ const maxRetries = 3;
2066
+ for (let attempt = 0; attempt < maxRetries; attempt++) {
2067
+ try {
2068
+ return await fs.readFile(zipPath);
2069
+ } catch (err) {
2070
+ const isEBUSY = err instanceof Error && "code" in err && err.code === "EBUSY";
2071
+ if (isEBUSY && attempt < maxRetries - 1) {
2072
+ await new Promise((r) => setTimeout(r, 100 * (attempt + 1)));
2073
+ continue;
2074
+ }
2075
+ throw err;
2076
+ }
2077
+ }
2078
+ throw new Error("Failed to read zip file after retries");
2079
+ })();
2051
2080
  const uploadFormData = new FormData();
2052
2081
  for (const [key, value] of Object.entries(uploadFields)) {
2053
2082
  uploadFormData.append(key, value);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  registerInsforgeTools
4
- } from "./chunk-CMGN6RVN.js";
4
+ } from "./chunk-YDPBWOQA.js";
5
5
 
6
6
  // src/http/server.ts
7
7
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  registerInsforgeTools
4
- } from "./chunk-CMGN6RVN.js";
4
+ } from "./chunk-YDPBWOQA.js";
5
5
 
6
6
  // src/stdio/index.ts
7
7
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insforge/mcp",
3
- "version": "1.2.4-deployment.2",
3
+ "version": "1.2.4-deployment.4",
4
4
  "description": "MCP (Model Context Protocol) server for Insforge backend-as-a-service",
5
5
  "mcpName": "io.github.InsForge/insforge-mcp",
6
6
  "type": "module",
@@ -39,6 +39,7 @@
39
39
  "@insforge/shared-schemas": "1.1.37-deployment.1",
40
40
  "@modelcontextprotocol/sdk": "^1.15.1",
41
41
  "@types/express": "^5.0.3",
42
+ "archiver": "^7.0.1",
42
43
  "commander": "^14.0.0",
43
44
  "express": "^5.1.0",
44
45
  "form-data": "^4.0.4",
@@ -46,6 +47,7 @@
46
47
  "zod": "^3.23.8"
47
48
  },
48
49
  "devDependencies": {
50
+ "@types/archiver": "^7.0.0",
49
51
  "@types/node": "^20.10.5",
50
52
  "rimraf": "^5.0.5",
51
53
  "tsup": "^8.5.0",