0
0
Fork 0
Codesys-MCP-SP21-plus/tests/unit
Karstein Phobic Nyvold Kvistad 9c98e61974 feat(cli): --print-config emits ready-to-paste .mcp.json for every detected install
New flags:
- --print-config: scan installs and emit a JSON block per install with
  derived server names (codesys-sp21-patch5, codesys-sp22-patch1, etc.)
- --sp <n>: filter to one SP family; collapses entry name to 'codesys'
  when exactly one install matches
- --name <name>: override the entry name (only valid with --sp narrowing
  to one)

Side effect: --detect now reuses the same detector and additionally
prints the derived profile name + suggested server entry name per
install, so even users sticking to manual config get the values
without guessing.

Refactored install discovery into src/detect.ts so both --detect and
--print-config share one implementation. New unit test fixture covers
version parsing, missing-exe, dedup, sort order, --sp filter behaviour,
--name override constraints, and verifies the emitted JSON parses back
once // comments are stripped.

The output also surfaces the multi-install caveat from launcher.ts:
the double-spawn guard refuses to start a second CODESYS.exe even on
a different exe path, so only one configured entry can be active at
a time.
2026-04-27 20:22:15 +02:00
..
detect.test.ts feat(cli): --print-config emits ready-to-paste .mcp.json for every detected install 2026-04-27 20:22:15 +02:00
ipc.test.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
launcher.test.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
script-manager.test.ts fix(create_folder): try project.create_folder(name, SV_POU) first; drop ScriptManager cache 2026-04-26 17:16:44 +02:00