From 9553516b734187c601c224c63cd32a8c6ee96b79 Mon Sep 17 00:00:00 2001 From: Suyash Srijan Date: Mon, 9 Mar 2026 13:48:50 +0000 Subject: [PATCH] Use launcher script for jsonrpc import fix --- proxy-server/bin/xcode-copilot-server.mjs | 7 +++++++ proxy-server/eslint.config.js | 2 +- proxy-server/package-lock.json | 4 ++-- proxy-server/package.json | 5 +++-- proxy-server/src/index.ts | 1 - 5 files changed, 13 insertions(+), 6 deletions(-) create mode 100755 proxy-server/bin/xcode-copilot-server.mjs diff --git a/proxy-server/bin/xcode-copilot-server.mjs b/proxy-server/bin/xcode-copilot-server.mjs new file mode 100755 index 0000000..d6de8e2 --- /dev/null +++ b/proxy-server/bin/xcode-copilot-server.mjs @@ -0,0 +1,7 @@ +#!/usr/bin/env node + +// Register the ESM resolution hook before loading the main entry point. +// This must happen via dynamic import() so the hook is active when +// @github/copilot-sdk's static imports are resolved. +import "../dist/fix-jsonrpc-import.js"; +await import("../dist/index.js"); diff --git a/proxy-server/eslint.config.js b/proxy-server/eslint.config.js index dabcdcd..1411557 100644 --- a/proxy-server/eslint.config.js +++ b/proxy-server/eslint.config.js @@ -28,6 +28,6 @@ export default defineConfig( }, }, { - ignores: ["dist/", "node_modules/", "scripts/", "config.json5", "eslint.config.js", "vitest.config.ts"], + ignores: ["bin/", "dist/", "node_modules/", "scripts/", "config.json5", "eslint.config.js", "vitest.config.ts"], }, ); diff --git a/proxy-server/package-lock.json b/proxy-server/package-lock.json index c8a27a9..e2a9323 100644 --- a/proxy-server/package-lock.json +++ b/proxy-server/package-lock.json @@ -1,12 +1,12 @@ { "name": "xcode-copilot-server", - "version": "4.0.2", + "version": "4.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "xcode-copilot-server", - "version": "4.0.2", + "version": "4.0.3", "license": "MIT", "dependencies": { "commander": "14.0.3", diff --git a/proxy-server/package.json b/proxy-server/package.json index 00cf327..c9db9cb 100644 --- a/proxy-server/package.json +++ b/proxy-server/package.json @@ -1,6 +1,6 @@ { "name": "xcode-copilot-server", - "version": "4.0.3", + "version": "4.0.4", "description": "OpenAI-compatible proxy API server for Xcode, powered by GitHub Copilot", "type": "module", "license": "MIT", @@ -12,9 +12,10 @@ "node": "25.6.0" }, "bin": { - "xcode-copilot-server": "dist/index.js" + "xcode-copilot-server": "bin/xcode-copilot-server.mjs" }, "files": [ + "bin/", "dist/", "config.json5" ], diff --git a/proxy-server/src/index.ts b/proxy-server/src/index.ts index fbc8837..d57f757 100644 --- a/proxy-server/src/index.ts +++ b/proxy-server/src/index.ts @@ -1,5 +1,4 @@ #!/usr/bin/env node -import "./fix-jsonrpc-import.js"; import { join, dirname } from "node:path"; import { readFile } from "node:fs/promises"; import { z } from "zod";