codesysultra 1.0.7 → 1.0.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.
@@ -5,16 +5,16 @@ import inspect
5
5
 
6
6
  def get_codesys_system_api():
7
7
  try:
8
- print "\\n=== CODESYS Script Engine System API ===\\n"
8
+ print("\n=== CODESYS Script Engine System API ===\n")
9
9
 
10
- print "=== Script Engine Modules ==="
11
- print "scriptengine module:"
10
+ print("=== Script Engine Modules ===")
11
+ print("scriptengine module:")
12
12
  for name in dir(script_engine):
13
13
  if not name.startswith('_'):
14
14
  try:
15
15
  obj = getattr(script_engine, name)
16
16
  obj_type = type(obj).__name__
17
- print " %s (%s)" % (name, obj_type)
17
+ print(" {} ({})".format(name, obj_type))
18
18
 
19
19
  if inspect.isclass(obj):
20
20
  try:
@@ -23,28 +23,26 @@ def get_codesys_system_api():
23
23
  if not m.startswith('_') and callable(getattr(obj, m)):
24
24
  methods.append(m)
25
25
  if methods:
26
- print " Available methods:"
26
+ print(" Available methods:")
27
27
  for method in sorted(methods)[:20]:
28
- print " - %s" % method
28
+ print(" - {}".format(method))
29
29
  if len(methods) > 20:
30
- print " ... and %d more" % (len(methods) - 20)
30
+ print(" ... and {} more".format(len(methods) - 20))
31
31
  except Exception as e:
32
- print " Error listing methods: %s" % e
32
+ print(" Error listing methods: {}".format(e))
33
33
  except Exception as e:
34
- print " Error: %s" % e
35
- except Exception as e:
36
- print " Error: %s" % e
34
+ print(" Error: {}".format(e))
37
35
 
38
- print "\\n=== Script Engine Functions ==="
36
+ print("\n=== Script Engine Functions ===")
39
37
  script_functions = []
40
38
  for name in dir(script_engine):
41
39
  if not name.startswith('_') and callable(getattr(script_engine, name)):
42
40
  script_functions.append(name)
43
41
 
44
42
  for func in sorted(script_functions):
45
- print " - %s()" % func
43
+ print(" - {}()".format(func))
46
44
 
47
- print "\\n=== Available Enums ==="
45
+ print("\n=== Available Enums ===")
48
46
  try:
49
47
  enums = []
50
48
  for name in dir(script_engine):
@@ -53,7 +51,7 @@ def get_codesys_system_api():
53
51
  enums.append((name, obj))
54
52
 
55
53
  for enum_name, enum_obj in sorted(enums):
56
- print "\\n%s:" % enum_name
54
+ print("\n{}:".format(enum_name))
57
55
  try:
58
56
  members = []
59
57
  for name in dir(enum_obj):
@@ -62,25 +60,25 @@ def get_codesys_system_api():
62
60
  for member_name in sorted(members):
63
61
  try:
64
62
  member_value = getattr(enum_obj, member_name)
65
- print " %s = %s" % (member_name, member_value)
63
+ print(" {} = {}".format(member_name, member_value))
66
64
  except Exception as e:
67
- print " Error: %s" % e
65
+ print(" Error: {}".format(e))
68
66
  except Exception as e:
69
- print " Error: %s" % e
67
+ print(" Error: {}".format(e))
70
68
  except Exception as e:
71
- print " Error: %s" % e
69
+ print(" Error: {}".format(e))
72
70
 
73
- print "\\n=== Project Management ==="
74
- print "script_engine.projects module functions:"
71
+ print("\n=== Project Management ===")
72
+ print("script_engine.projects module functions:")
75
73
  project_functions = []
76
74
  for name in dir(script_engine.projects):
77
75
  if not name.startswith('_') and callable(getattr(script_engine.projects, name)):
78
76
  project_functions.append(name)
79
77
 
80
78
  for func in sorted(project_functions):
81
- print " - %s()" % func
79
+ print(" - {}()".format(func))
82
80
 
83
- print "\\n=== POU Types ==="
81
+ print("\n=== POU Types ===")
84
82
  try:
85
83
  pou_types = []
86
84
  for name in dir(script_engine):
@@ -89,7 +87,7 @@ def get_codesys_system_api():
89
87
  pou_types.append((name, obj))
90
88
 
91
89
  for type_name, type_obj in pou_types:
92
- print " %s:" % type_name
90
+ print(" {}:".format(type_name))
93
91
  try:
94
92
  values = []
95
93
  for name in dir(type_obj):
@@ -98,15 +96,15 @@ def get_codesys_system_api():
98
96
  for value_name in sorted(values):
99
97
  try:
100
98
  value_value = getattr(type_obj, value_name)
101
- print " %s = %s" % (value_name, value_value)
99
+ print(" {} = {}".format(value_name, value_value))
102
100
  except Exception as e:
103
- print " Error: %s" % e
101
+ print(" Error: {}".format(e))
104
102
  except Exception as e:
105
- print " Error: %s" % e
103
+ print(" Error: {}".format(e))
106
104
  except Exception as e:
107
- print " Error: %s" % e
105
+ print(" Error: {}".format(e))
108
106
 
109
- print "\\n=== Implementation Languages ==="
107
+ print("\n=== Implementation Languages ===")
110
108
  try:
111
109
  impl_langs = []
112
110
  for name in dir(script_engine):
@@ -115,7 +113,7 @@ def get_codesys_system_api():
115
113
  impl_langs.append((name, obj))
116
114
 
117
115
  for lang_name, lang_obj in impl_langs:
118
- print " %s:" % lang_name
116
+ print(" {}:".format(lang_name))
119
117
  try:
120
118
  values = []
121
119
  for name in dir(lang_obj):
@@ -124,46 +122,46 @@ def get_codesys_system_api():
124
122
  for value_name in sorted(values):
125
123
  try:
126
124
  value_value = getattr(lang_obj, value_name)
127
- print " %s = %s" % (value_name, value_value)
125
+ print(" {} = {}".format(value_name, value_value))
128
126
  except Exception as e:
129
- print " Error: %s" % e
127
+ print(" Error: {}".format(e))
130
128
  except Exception as e:
131
- print " Error: %s" % e
129
+ print(" Error: {}".format(e))
132
130
  except Exception as e:
133
- print " Error: %s" % e
131
+ print(" Error: {}".format(e))
134
132
 
135
- print "\\n=== Version Info ==="
133
+ print("\n=== Version Info ===")
136
134
  try:
137
135
  version = getattr(script_engine, '__version__', 'Unknown')
138
- print " Script Engine Version: %s" % version
136
+ print(" Script Engine Version: {}".format(version))
139
137
  except Exception as e:
140
- print " Error getting version: %s" % e
138
+ print(" Error getting version: {}".format(e))
141
139
 
142
- print "\\n=== API Usage Examples ==="
143
- print "Example 1: Open a project"
144
- print " project = script_engine.projects.open('C:/Projects/MyProject.project')"
145
- print ""
146
- print "Example 2: Create a POU"
147
- print " parent = project.get_children()[0]"
148
- print " pou = parent.create_pou(name='MyPOU', type=script_engine.PouType.Program)"
149
- print ""
150
- print "Example 3: Get project structure"
151
- print " def analyze(obj, indent=0):"
152
- print " print ' ' * indent + obj.get_name()"
153
- print " if hasattr(obj, 'get_children'):"
154
- print " for child in obj.get_children():"
155
- print " analyze(child, indent+1)"
156
- print " analyze(project)"
140
+ print("\n=== API Usage Examples ===")
141
+ print("Example 1: Open a project")
142
+ print(" project = script_engine.projects.open('C:/Projects/MyProject.project')")
143
+ print("")
144
+ print("Example 2: Create a POU")
145
+ print(" parent = project.get_children()[0]")
146
+ print(" pou = parent.create_pou(name='MyPOU', type=script_engine.PouType.Program)")
147
+ print("")
148
+ print("Example 3: Get project structure")
149
+ print(" def analyze(obj, indent=0):")
150
+ print(" print(' ' * indent + obj.get_name())")
151
+ print(" if hasattr(obj, 'get_children'):")
152
+ print(" for child in obj.get_children():")
153
+ print(" analyze(child, indent+1)")
154
+ print(" analyze(project)")
157
155
 
158
- print "\\n=== Analysis Complete ==="
159
- print "SCRIPT_SUCCESS: CODESYS system API retrieved successfully."
156
+ print("\n=== Analysis Complete ===")
157
+ print("SCRIPT_SUCCESS: CODESYS system API retrieved successfully.")
160
158
  sys.exit(0)
161
159
 
162
160
  except Exception as e:
163
161
  detailed_error = traceback.format_exc()
164
- error_message = "Error retrieving CODESYS system API: %s\\n%s" % (e, detailed_error)
165
- print error_message
166
- print "SCRIPT_ERROR: %s" % error_message
162
+ error_message = "Error retrieving CODESYS system API: {}\n{}".format(e, detailed_error)
163
+ print(error_message)
164
+ print("SCRIPT_ERROR: {}".format(error_message))
167
165
  sys.exit(1)
168
166
 
169
167
  if __name__ == "__main__":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codesysultra",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Model Context Protocol (MCP) server for CODESYS automation platform",
5
5
  "main": "dist/server.js",
6
6
  "bin": {
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="utf-16"?>
2
+ <Single xml:space="preserve" Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
3
+ <Single Name="Name" Type="string">&lt;MachineProjectRoot&gt;</Single>
4
+ <Dictionary Type="System.Collections.Hashtable" Name="SubKeys" />
5
+ <Dictionary Type="System.Collections.Hashtable" Name="Values" />
6
+ </Single>
@@ -0,0 +1,73 @@
1
+ <?xml version="1.0" encoding="utf-16"?>
2
+ <Single xml:space="preserve" Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
3
+ <Single Name="Name" Type="string">&lt;UserProjectRoot&gt;</Single>
4
+ <Dictionary Type="System.Collections.Hashtable" Name="SubKeys">
5
+ <Entry>
6
+ <Key>
7
+ <Single Type="string">{4F76D0CF-5F2B-4f90-B443-B3FED105365A}</Single>
8
+ </Key>
9
+ <Value>
10
+ <Single Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
11
+ <Single Name="Name" Type="string">{4F76D0CF-5F2B-4f90-B443-B3FED105365A}</Single>
12
+ <Dictionary Type="System.Collections.Hashtable" Name="SubKeys" />
13
+ <Dictionary Type="System.Collections.Hashtable" Name="Values" />
14
+ </Single>
15
+ </Value>
16
+ </Entry>
17
+ <Entry>
18
+ <Key>
19
+ <Single Type="string">{79968A73-AAAA-46E3-B71D-DD238D1A198A}</Single>
20
+ </Key>
21
+ <Value>
22
+ <Single Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
23
+ <Single Name="Name" Type="string">{79968A73-AAAA-46E3-B71D-DD238D1A198A}</Single>
24
+ <Dictionary Type="System.Collections.Hashtable" Name="SubKeys" />
25
+ <Dictionary Type="System.Collections.Hashtable" Name="Values">
26
+ <Entry>
27
+ <Key>
28
+ <Single Type="string">DefaultLocalizationCulture</Single>
29
+ </Key>
30
+ <Value>
31
+ <Single Type="string"></Single>
32
+ </Value>
33
+ </Entry>
34
+ </Dictionary>
35
+ </Single>
36
+ </Value>
37
+ </Entry>
38
+ <Entry>
39
+ <Key>
40
+ <Single Type="string">{B431F4F6-68E9-4767-9143-6471A69719A9}</Single>
41
+ </Key>
42
+ <Value>
43
+ <Single Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
44
+ <Single Name="Name" Type="string">{B431F4F6-68E9-4767-9143-6471A69719A9}</Single>
45
+ <Dictionary Type="System.Collections.Hashtable" Name="SubKeys" />
46
+ <Dictionary Type="System.Collections.Hashtable" Name="Values">
47
+ <Entry>
48
+ <Key>
49
+ <Single Type="string">ActiveApplicationGuid</Single>
50
+ </Key>
51
+ <Value>
52
+ <Single Type="string">{26f81cb7-7a7b-4e0d-b781-333c7c0256f9}</Single>
53
+ </Value>
54
+ </Entry>
55
+ </Dictionary>
56
+ </Single>
57
+ </Value>
58
+ </Entry>
59
+ <Entry>
60
+ <Key>
61
+ <Single Type="string">{E958CDB5-7DE4-41af-8650-09D402301787}</Single>
62
+ </Key>
63
+ <Value>
64
+ <Single Type="{54dd0eac-a6d8-46f2-8c27-2f43c7e49861}" Method="IArchivable">
65
+ <Single Name="Name" Type="string">{E958CDB5-7DE4-41af-8650-09D402301787}</Single>
66
+ <Dictionary Type="System.Collections.Hashtable" Name="SubKeys" />
67
+ <Dictionary Type="System.Collections.Hashtable" Name="Values" />
68
+ </Single>
69
+ </Value>
70
+ </Entry>
71
+ </Dictionary>
72
+ <Dictionary Type="System.Collections.Hashtable" Name="Values" />
73
+ </Single>
Binary file