@codesys/mcp-toolkit 1.1.4 → 1.1.5

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/dist/bin.js CHANGED
@@ -8,11 +8,45 @@
8
8
  * This is the entry point for the MCP toolkit when invoked as a command-line tool.
9
9
  * It handles argument parsing and passes configuration to server.ts via function parameters.
10
10
  */
11
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ var desc = Object.getOwnPropertyDescriptor(m, k);
14
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
15
+ desc = { enumerable: true, get: function() { return m[k]; } };
16
+ }
17
+ Object.defineProperty(o, k2, desc);
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || (function () {
28
+ var ownKeys = function(o) {
29
+ ownKeys = Object.getOwnPropertyNames || function (o) {
30
+ var ar = [];
31
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
32
+ return ar;
33
+ };
34
+ return ownKeys(o);
35
+ };
36
+ return function (mod) {
37
+ if (mod && mod.__esModule) return mod;
38
+ var result = {};
39
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
40
+ __setModuleDefault(result, mod);
41
+ return result;
42
+ };
43
+ })();
11
44
  Object.defineProperty(exports, "__esModule", { value: true });
12
45
  // Use Commander for initial parsing
13
46
  const commander_1 = require("commander");
14
47
  // Import the server setup function
15
48
  const server_js_1 = require("./server.js"); // Adjust path if needed
49
+ const path = __importStar(require("path")); // Import path module
16
50
  console.error(">>> BIN.TS Starting <<<");
17
51
  // Define version from package.json
18
52
  // Use import assertion for JSON in ES modules if possible, otherwise require is okay for CommonJS
@@ -35,9 +69,12 @@ commander_1.program
35
69
  .option('-f, --codesys-profile <profile>', // Changed alias to 'f' to avoid conflict if you add other '-p' options
36
70
  'CODESYS profile name (overrides CODESYS_PROFILE env var)', process.env.CODESYS_PROFILE || 'CODESYS V3.5 SP21' // Default AFTER reading env var
37
71
  )
38
- // Add workspace option if needed, defaults to cwd
39
72
  .option('-w, --workspace <dir>', 'Workspace directory for relative project paths', process.cwd() // Default to current working directory
40
73
  )
74
+ // Add option for the CODESYS scripts directory
75
+ .option('-s, --codesys-scripts-dir <dir>', 'Directory containing CODESYS Python scripts (e.g., listener_script.py)',
76
+ // Default to a 'codesys_scripts' directory relative to the bin.ts file
77
+ path.join(__dirname, '..', 'codesys_scripts'))
41
78
  .parse(process.argv); // Parse the arguments
42
79
  const options = commander_1.program.opts();
43
80
  // --- Log the options Commander parsed ---
@@ -47,6 +84,7 @@ console.error(`BIN.TS Options: ${JSON.stringify(options)}`);
47
84
  console.error(` CODESYS Path Used: ${options.codesysPath}`);
48
85
  console.error(` CODESYS Profile Used: ${options.codesysProfile}`);
49
86
  console.error(` Workspace Used: ${options.workspace}`);
87
+ console.error(` CODESYS Scripts Dir Used: ${options.codesysScriptsDir}`); // Log the new option
50
88
  console.error(` Node.js: ${process.version}`);
51
89
  console.error(`========================================`);
52
90
  // --- End Logging ---
@@ -54,7 +92,8 @@ console.error(`========================================`);
54
92
  const serverConfig = {
55
93
  codesysPath: options.codesysPath.trim(),
56
94
  profileName: options.codesysProfile.trim(),
57
- workspaceDir: options.workspace.trim() // Pass workspace dir
95
+ workspaceDir: options.workspace.trim(), // Pass workspace dir
96
+ codesysScriptsDir: options.codesysScriptsDir.trim() // Pass the scripts directory
58
97
  };
59
98
  // --- End Prepare Config ---
60
99
  // --- Call the server setup function ---