Update .gitignore and README.md for CODESYS MCP project. Added entries to .gitignore for VSIX files and VS Code settings. Expanded README to include architecture, components, deployment instructions, and details about the Cursor extension.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python
|
||||
"""Create a new CODESYS project via ScriptEngine."""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
|
||||
from _common import emit, load_payload
|
||||
|
||||
|
||||
def main():
|
||||
payload = load_payload()
|
||||
project_name = payload.get("project_name")
|
||||
output_dir = payload.get("output_dir")
|
||||
template = payload.get("template", "standard")
|
||||
overwrite = bool(payload.get("overwrite", False))
|
||||
|
||||
if not project_name or not output_dir:
|
||||
raise ValueError("project_name and output_dir are required.")
|
||||
|
||||
project_path = os.path.join(output_dir, "{0}.project".format(project_name))
|
||||
if os.path.exists(project_path) and not overwrite:
|
||||
raise RuntimeError("Project already exists: {0}".format(project_path))
|
||||
if not os.path.exists(output_dir):
|
||||
os.makedirs(output_dir)
|
||||
|
||||
if "projects" not in globals():
|
||||
raise RuntimeError(
|
||||
"CODESYS ScriptEngine globals not found. "
|
||||
"Run this script through CODESYS.exe --runscript."
|
||||
)
|
||||
|
||||
if projects.primary:
|
||||
projects.primary.close()
|
||||
|
||||
if os.path.exists(project_path) and overwrite:
|
||||
os.remove(project_path)
|
||||
|
||||
proj = projects.create(project_path, primary=True)
|
||||
proj.save()
|
||||
proj.close()
|
||||
|
||||
emit(
|
||||
{
|
||||
"ok": True,
|
||||
"action": "create_project",
|
||||
"project_name": project_name,
|
||||
"template": template,
|
||||
"project_path": project_path,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user