0
0
Fork 0

feat: enable --approve-edits gate by default

Modifying MCP tools (set_pou_code, create_pou, rename, delete, etc.)
now route through the phobiCS-tui y/n diff gate by default. The CLI
flag flips form: --approve-edits → --no-approve-edits (opt-out).

Bumps to 0.9.2.

Why: gating writes-by-default makes set_pou_code/create_pou changes
auditable in the TUI before they hit the binary .project file.

Existing configs passing --approve-edits explicitly continue to work
(commander accepts both forms when option is defined as --no-X);
configs that want the old ungated behavior add --no-approve-edits.
This commit is contained in:
Karstein Phobic Nyvold Kvistad 2026-04-29 19:25:58 +02:00
parent b0dadbd5e8
commit 26e9941b70
2 changed files with 4 additions and 6 deletions

View file

@ -1,6 +1,6 @@
{
"name": "codesys-mcp-sp21-plus",
"version": "0.9.1",
"version": "0.9.2",
"description": "Codesys-MCP-SP21+ -- fork of luke-harriman/Codesys-MCP carrying CODESYS V3.5 SP22 Patch 1 fixes (and forward-compat with later SPs): script-engine API drift, online/runtime tool auto-login, dual-SHA release classifier, set_pou_code omitted-decl wipe fix, add_library managed-overload, etc. MCP server for CODESYS with persistent UI instance and file-based IPC.",
"main": "dist/server.js",
"bin": {

View file

@ -57,7 +57,7 @@ program
.option('--fallback-headless', 'Fall back to headless if persistent fails', true)
.option('--keep-alive', 'Keep CODESYS running after server stops', false)
.option('--auto-mirror', 'Re-run mirror_export after every modifying tool so an external editor watching <projectDir>/mcp-mirror/ sees changes live', false)
.option('--approve-edits', 'Gate modifying MCP tools behind a phobiCS-tui y/n diff prompt', false)
.option('--no-approve-edits', 'Disable the phobiCS-tui y/n diff gate on modifying tools (default: gate ENABLED)')
.option('--live-values', 'Pump runtime values for the selected POU into tui-live-values.json so phobiCS-tui can overlay them inline. Requires the runtime to be online; failures are silent.', false)
.option('--live-values-interval <ms>', 'Poll interval for --live-values in ms. Default 500. Clamped to [100, 60000].', '500')
.option('--timeout <ms>', 'Default command timeout in ms', '60000')
@ -210,7 +210,7 @@ if (opts.sshVersion) {
debug: opts.debug || false,
mode: (opts.mode === 'headless' ? 'headless' : 'persistent') as ExecutionMode,
autoMirror: opts.autoMirror || false,
approveEdits: opts.approveEdits || false,
approveEdits: opts.approveEdits !== false,
liveValues: opts.liveValues || false,
liveValuesIntervalMs: clampInterval(opts.liveValuesInterval),
};
@ -223,9 +223,7 @@ if (opts.sshVersion) {
if (config.autoMirror) {
process.stderr.write(` Auto-mirror: ENABLED (mirror_export runs after every edit)\n`);
}
if (config.approveEdits) {
process.stderr.write(` Approve edits: ENABLED (modifying tools will prompt via phobiCS-tui)\n`);
}
process.stderr.write(` Approve edits: ${config.approveEdits ? 'ENABLED (modifying tools will prompt via phobiCS-tui)' : 'disabled'}\n`);
if (config.liveValues) {
process.stderr.write(` Live values: ENABLED (poll ${config.liveValuesIntervalMs ?? 500}ms; writes tui-live-values.json)\n`);
}