@hunyed15/codecgc 0.2.6 → 0.2.8

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.
@@ -57,13 +57,19 @@ try {
57
57
  reason = 'CodeCGC: shared paths require split-first routing. Use /cgc to split into backend/frontend steps.';
58
58
  }
59
59
 
60
- console.log(JSON.stringify({
60
+ var response = {
61
61
  decision: 'deny',
62
62
  reason: reason
63
- }));
64
- } catch {
65
- process.exit(0);
63
+ };
64
+ console.log(JSON.stringify(response));
65
+ } catch (err) {
66
+ // On any error, allow the operation (fail-open for safety)
67
+ // Log error to stderr for debugging, but don't block the operation
68
+ if (err && err.message) {
69
+ console.error('edit-guard.js error:', err.message);
70
+ }
66
71
  }
72
+ process.exit(0);
67
73
 
68
74
  // ── Helpers ──
69
75
 
@@ -8,6 +8,7 @@ import json
8
8
  import os
9
9
  import queue
10
10
  import subprocess
11
+ import sys
11
12
  import threading
12
13
  import time
13
14
  import uuid
@@ -212,6 +213,18 @@ def run_shell_command(cmd: list[str], timeout_seconds: int = DEFAULT_CODEX_TIMEO
212
213
  codex_path = shutil.which('codex') or cmd[0]
213
214
  popen_cmd[0] = codex_path
214
215
 
216
+ # Ensure Codex CLI inherits the same Python environment as this MCP server
217
+ # This is critical for Python 3.11+ syntax compatibility (e.g., except*)
218
+ env = os.environ.copy()
219
+ python_executable = sys.executable
220
+ if python_executable:
221
+ # Add Python executable directory to PATH so Codex CLI uses the same Python
222
+ python_dir = os.path.dirname(python_executable)
223
+ if python_dir:
224
+ env['PATH'] = python_dir + os.pathsep + env.get('PATH', '')
225
+ # Set PYTHON environment variable as a hint for tools that respect it
226
+ env['PYTHON'] = python_executable
227
+
215
228
  process = subprocess.Popen(
216
229
  popen_cmd,
217
230
  shell=False,
@@ -220,6 +233,7 @@ def run_shell_command(cmd: list[str], timeout_seconds: int = DEFAULT_CODEX_TIMEO
220
233
  stderr=subprocess.STDOUT,
221
234
  universal_newlines=True,
222
235
  encoding='utf-8',
236
+ env=env,
223
237
  )
224
238
 
225
239
  output_queue: queue.Queue[str | None] = queue.Queue()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunyed15/codecgc",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Claude-hosted multi-model workflow product shell for CodeCGC.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",