@codesys/mcp-toolkit 1.4.2 → 1.4.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.
- package/CHANGELOG.md +12 -0
- package/dist/scripts/create_project.py +24 -8
- package/dist/scripts/start_session.py +21 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.4.4] - 2025-05-02
|
|
9
|
+
### Fixed
|
|
10
|
+
- Fixed "unexpected token 'C'" error in create_project script
|
|
11
|
+
- Improved Windows path handling in create_project.py with better logging and error detection
|
|
12
|
+
- Added additional debugging output for raw string path processing
|
|
13
|
+
|
|
14
|
+
## [1.4.3] - 2025-05-02
|
|
15
|
+
### Fixed
|
|
16
|
+
- Fixed "Cannot import name redirect_stdout" error in session script execution
|
|
17
|
+
- Replaced contextlib.redirect_stdout/redirect_stderr with direct sys.stdout/stderr assignment for IronPython 2.7 compatibility
|
|
18
|
+
- Improved StringIO import handling for better Python 2/3 compatibility
|
|
19
|
+
|
|
8
20
|
## [1.4.2] - 2025-05-02
|
|
9
21
|
### Fixed
|
|
10
22
|
- Enhanced session communication with better logging and debugging
|
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
import sys, scriptengine as script_engine, os, shutil, time, traceback
|
|
2
|
-
# Placeholders -
|
|
3
|
-
#
|
|
2
|
+
# Placeholders for paths - note that these might be prefixed with r' for raw strings
|
|
3
|
+
# from the TypeScript/Node.js side due to Windows path handling
|
|
4
4
|
TEMPLATE_PROJECT_PATH_RAW = '{TEMPLATE_PROJECT_PATH}' # Path to Standard.project
|
|
5
5
|
PROJECT_FILE_PATH_RAW = '{PROJECT_FILE_PATH}' # Path for the new project (Target Path)
|
|
6
6
|
|
|
7
|
-
# Process
|
|
7
|
+
# Process paths that might be Python raw strings (r'path')
|
|
8
8
|
def extract_path(path_str):
|
|
9
|
-
if
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
# Check if path starts with r' prefix and ends with ' (raw string notation)
|
|
10
|
+
if isinstance(path_str, str):
|
|
11
|
+
if path_str.startswith("r'") and path_str.endswith("'"):
|
|
12
|
+
try:
|
|
13
|
+
# Extract the content between r' and '
|
|
14
|
+
return path_str[2:-1]
|
|
15
|
+
except Exception as e:
|
|
16
|
+
print("DEBUG: Error extracting raw string content: %s" % e)
|
|
17
|
+
return path_str
|
|
12
18
|
return path_str
|
|
13
19
|
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
# Process template path and project file path
|
|
21
|
+
try:
|
|
22
|
+
TEMPLATE_PROJECT_PATH = extract_path(TEMPLATE_PROJECT_PATH_RAW)
|
|
23
|
+
PROJECT_FILE_PATH = extract_path(PROJECT_FILE_PATH_RAW)
|
|
24
|
+
print("DEBUG: Processed paths:")
|
|
25
|
+
print("DEBUG: TEMPLATE_PROJECT_PATH_RAW: %s" % TEMPLATE_PROJECT_PATH_RAW)
|
|
26
|
+
print("DEBUG: TEMPLATE_PROJECT_PATH (processed): %s" % TEMPLATE_PROJECT_PATH)
|
|
27
|
+
print("DEBUG: PROJECT_FILE_PATH_RAW: %s" % PROJECT_FILE_PATH_RAW)
|
|
28
|
+
print("DEBUG: PROJECT_FILE_PATH (processed): %s" % PROJECT_FILE_PATH)
|
|
29
|
+
except Exception as path_proc_err:
|
|
30
|
+
print("CRITICAL: Error processing path variables: %s" % path_proc_err)
|
|
31
|
+
traceback.print_exc()
|
|
16
32
|
|
|
17
33
|
print("DEBUG: Processed TEMPLATE_PROJECT_PATH: %s" % TEMPLATE_PROJECT_PATH)
|
|
18
34
|
print("DEBUG: Processed PROJECT_FILE_PATH: %s" % PROJECT_FILE_PATH)
|
|
@@ -236,16 +236,31 @@ def execute_command(command_data):
|
|
|
236
236
|
# This allows us to isolate the script execution somewhat
|
|
237
237
|
local_globals = globals().copy()
|
|
238
238
|
|
|
239
|
-
# Capture output by
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
# Capture output by temporarily replacing stdout/stderr
|
|
240
|
+
# Use custom approach compatible with IronPython 2.7
|
|
241
|
+
try:
|
|
242
|
+
import StringIO as io_module # Python 2.x
|
|
243
|
+
except ImportError:
|
|
244
|
+
import io as io_module # Python 3.x
|
|
245
|
+
|
|
246
|
+
stdout_buffer = io_module.StringIO()
|
|
247
|
+
stderr_buffer = io_module.StringIO()
|
|
242
248
|
|
|
243
|
-
|
|
244
|
-
|
|
249
|
+
# Save original stdout and stderr
|
|
250
|
+
old_stdout = sys.stdout
|
|
251
|
+
old_stderr = sys.stderr
|
|
245
252
|
|
|
246
|
-
with
|
|
253
|
+
# Replace with our buffers
|
|
254
|
+
sys.stdout = stdout_buffer
|
|
255
|
+
sys.stderr = stderr_buffer
|
|
256
|
+
|
|
257
|
+
try:
|
|
247
258
|
# Execute the script
|
|
248
259
|
exec(script, local_globals)
|
|
260
|
+
finally:
|
|
261
|
+
# Restore original stdout and stderr
|
|
262
|
+
sys.stdout = old_stdout
|
|
263
|
+
sys.stderr = old_stderr
|
|
249
264
|
|
|
250
265
|
# Get the captured output
|
|
251
266
|
stdout_output = stdout_buffer.getvalue()
|