0
0
Fork 0
Codesys-MCP-SP21-plus/src/scripts
Karstein Phobic Nyvold Kvistad 5cbd540fde bump_project_version: resume from GVL when Project Information missing
Previously, when a project had no Project Information node (e.g. one
created from the Standard template via create_project), the bump
flow read pi.version as None, the seed-check fired, and every call
re-seeded to 1.0.0.0 -- subsequent revision/minor/major bumps were
no-ops because the script never saw the actual current version.

Surfaced on MCPTest2 today: bumping revision after editing PLC_PRG
returned '1.0.0.0' instead of '1.0.1.0' because the seed kept firing.

Fix: when Project Information is missing, fall back to reading the
existing _MCP_PROJECT_VERSION.sVersion via the textual_declaration
of the GVL we ourselves maintain. So the source-of-truth chain is:

  pi.version (when Project Information exists)
    -> falls back to GVL.sVersion (when Project Information missing
                                    but the GVL has been written
                                    by a prior bump)
    -> falls back to seed at 1.0.0.0 (true first-run, no GVL yet)

Implementation: read_version_from_gvl(primary_project) walks the
active Application's children for the named GVL and parses the
sVersion := '...' literal out of its textual_declaration with a
4-part regex. Returns None if the GVL doesn't exist OR its decl
doesn't match the expected shape; caller treats None as "no prior
version, seed". Soft-fails on any access exception (the bump is
the primary outcome, this is just resume-from-state).

This is the kind of "every arising problem fixed at the fork, not
worked around in one-offs" hygiene the user called out.
2026-04-26 00:53:10 +02:00
..
add_library.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
bump_project_version.py bump_project_version: resume from GVL when Project Information missing 2026-04-26 00:53:10 +02:00
check_status.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
compile_project.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
connect_to_device.py feat(connect_to_device): add loginWaitSeconds for credential dialog 2026-04-25 18:31:56 +02:00
create_dut.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
create_folder.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
create_gvl.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
create_method.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
create_pou.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
create_project.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
create_property.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
delete_object.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
disconnect_from_device.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
download_to_device.py fix(download_to_device): port login() probe + loginWaitSeconds from connect 2026-04-25 18:40:26 +02:00
ensure_online_connection.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
ensure_project_open.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
find_object_by_path.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
get_all_pou_code.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
get_application_state.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
get_compile_messages.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
get_pou_code.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
get_project_structure.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
git_branch_set_upstream_to.py fix(git_*): persist binding/state with project.save() after every mutating op 2026-04-25 20:46:57 +02:00
git_commit.py fix(git_*): persist binding/state with project.save() after every mutating op 2026-04-25 20:46:57 +02:00
git_init.py fix(git_*): persist binding/state with project.save() after every mutating op 2026-04-25 20:46:57 +02:00
git_push.py fix(git_*): persist binding/state with project.save() after every mutating op 2026-04-25 20:46:57 +02:00
git_remote_add.py fix(git_*): persist binding/state with project.save() after every mutating op 2026-04-25 20:46:57 +02:00
git_status.py feat(git_*): hard-stop with clear PDE-subscription message on HasGitLicense 2026-04-25 19:25:58 +02:00
list_project_libraries.py list_project_libraries: capture + render project version + IDE + devices 2026-04-26 00:12:06 +02:00
mirror_export.py feat(mirror_export): switch mirror file extension to .st 2026-04-25 22:59:25 +02:00
open_project.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
read_running_version_online.py feat(read_running_version_online): read _MCP_PROJECT_VERSION from running PLC 2026-04-26 00:33:22 +02:00
read_variable.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
rename_object.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
save_project.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
set_pou_code.py Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
start_stop_application.py Add 17 new MCP tools for v0.4.0: compiler diagnostics, project authoring, runtime monitoring, library management 2026-02-08 21:05:12 +10:00
watcher.py fix(watcher): use ASCII-only comments/log strings (IronPython 2.7 syntax error) 2026-04-25 15:10:21 +02:00
write_variable.py fix(write_variable): use SP22 prepare-then-write API as primary path 2026-04-25 18:37:38 +02:00