From e56ba2c29bdf0b389f2730576259b5c50fd382f9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Sep 2026 08:19:05 +0000 Subject: [PATCH 1/5] Forward unknown CLI flags to Electron commandLine Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com> --- gui-js/apps/minsky-electron/src/app/app.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gui-js/apps/minsky-electron/src/app/app.ts b/gui-js/apps/minsky-electron/src/app/app.ts index 42ad6a955..e00e01251 100644 --- a/gui-js/apps/minsky-electron/src/app/app.ts +++ b/gui-js/apps/minsky-electron/src/app/app.ts @@ -225,8 +225,21 @@ export default class App { } break; default: - // pass argument on for an initial model load - if (process.argv[arg][0]!=='-') + if (process.argv[arg][0]==='-') + { + // pass unknown command line flags through to Electron/Chromium + const flag=process.argv[arg].replace(/^-+/, ''); + if (flag.length>0) + { + const splitAt=flag.indexOf('='); + if (splitAt>=0) + app.commandLine.appendSwitch(flag.slice(0, splitAt), flag.slice(splitAt+1)); + else + app.commandLine.appendSwitch(flag); + } + } + else + // pass argument on for an initial model load App.cliArguments.push(process.argv[arg]); break; } From c4fd6f3c3ad1cea319c2c683932f9e386dba23b3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Sep 2026 08:20:05 +0000 Subject: [PATCH 2/5] Preserve -- delimiter when forwarding CLI switches Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com> --- gui-js/apps/minsky-electron/src/app/app.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gui-js/apps/minsky-electron/src/app/app.ts b/gui-js/apps/minsky-electron/src/app/app.ts index e00e01251..9c8122a80 100644 --- a/gui-js/apps/minsky-electron/src/app/app.ts +++ b/gui-js/apps/minsky-electron/src/app/app.ts @@ -207,8 +207,15 @@ export default class App { // when run from npm start, argv[0] is 'electron' if (process.argv[0].slice(-8)!=='electron') + { + let parsePositionalOnly=false; // process CLI options prior to running up any GUI for (var arg in process.argv) { + if (parsePositionalOnly) + { + App.cliArguments.push(process.argv[arg]); + continue; + } switch(process.argv[arg]) { case '--version': { let minskyVersion=backendSync("minsky.minskyVersion"); @@ -224,6 +231,9 @@ export default class App { } } break; + case '--': + parsePositionalOnly=true; + break; default: if (process.argv[arg][0]==='-') { @@ -244,6 +254,7 @@ export default class App { break; } } + } // we pass the Electron.App object and the // Electron.BrowserWindow into this function From 09280c3cac40741ee7fcf65e33105b5022e5f3bf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Sep 2026 08:21:03 +0000 Subject: [PATCH 3/5] Iterate argv values directly in CLI parser Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com> --- gui-js/apps/minsky-electron/src/app/app.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gui-js/apps/minsky-electron/src/app/app.ts b/gui-js/apps/minsky-electron/src/app/app.ts index 9c8122a80..1cac4866f 100644 --- a/gui-js/apps/minsky-electron/src/app/app.ts +++ b/gui-js/apps/minsky-electron/src/app/app.ts @@ -210,13 +210,13 @@ export default class App { { let parsePositionalOnly=false; // process CLI options prior to running up any GUI - for (var arg in process.argv) { + for (const arg of process.argv) { if (parsePositionalOnly) { - App.cliArguments.push(process.argv[arg]); + App.cliArguments.push(arg); continue; } - switch(process.argv[arg]) { + switch(arg) { case '--version': { let minskyVersion=backendSync("minsky.minskyVersion"); if (minskyVersion===version) @@ -235,10 +235,10 @@ export default class App { parsePositionalOnly=true; break; default: - if (process.argv[arg][0]==='-') + if (arg[0]==='-') { // pass unknown command line flags through to Electron/Chromium - const flag=process.argv[arg].replace(/^-+/, ''); + const flag=arg.replace(/^-+/, ''); if (flag.length>0) { const splitAt=flag.indexOf('='); @@ -250,7 +250,7 @@ export default class App { } else // pass argument on for an initial model load - App.cliArguments.push(process.argv[arg]); + App.cliArguments.push(arg); break; } } From 25456d83aedbe9ee318fcceb251e3a89362935fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Sep 2026 08:22:02 +0000 Subject: [PATCH 4/5] Forward only double-dash CLI switches Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com> --- gui-js/apps/minsky-electron/src/app/app.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui-js/apps/minsky-electron/src/app/app.ts b/gui-js/apps/minsky-electron/src/app/app.ts index 1cac4866f..3fe876bdd 100644 --- a/gui-js/apps/minsky-electron/src/app/app.ts +++ b/gui-js/apps/minsky-electron/src/app/app.ts @@ -235,7 +235,7 @@ export default class App { parsePositionalOnly=true; break; default: - if (arg[0]==='-') + if (arg.startsWith('--')) { // pass unknown command line flags through to Electron/Chromium const flag=arg.replace(/^-+/, ''); @@ -248,7 +248,7 @@ export default class App { app.commandLine.appendSwitch(flag); } } - else + else if (arg[0]!=='-') // pass argument on for an initial model load App.cliArguments.push(arg); break; From 8784a64d4bc17743b98a9890a4da42baea8bdf3b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 28 Sep 2026 08:23:17 +0000 Subject: [PATCH 5/5] Parse only user CLI args for startup handling Co-authored-by: highperformancecoder <3075825+highperformancecoder@users.noreply.github.com> --- gui-js/apps/minsky-electron/src/app/app.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gui-js/apps/minsky-electron/src/app/app.ts b/gui-js/apps/minsky-electron/src/app/app.ts index 3fe876bdd..0181dc895 100644 --- a/gui-js/apps/minsky-electron/src/app/app.ts +++ b/gui-js/apps/minsky-electron/src/app/app.ts @@ -28,7 +28,7 @@ export default class App { static application: Electron.App; static BrowserWindow; static directlyClose = false; - static cliArguments=[]; // first argument passed on command line + static cliArguments=[]; // positional arguments passed on command line private static onWindowAllClosed() { App.application.quit(); @@ -66,12 +66,12 @@ export default class App { await App.initMenu(); App.loadMainWindow(); backend('minsky.popFlags'); - if (App.cliArguments.length>1) { - if (!isAbsolute(App.cliArguments[1])) - App.cliArguments[1]=join(initialWorkingDirectory,App.cliArguments[1]); + if (App.cliArguments.length>0) { + if (!isAbsolute(App.cliArguments[0])) + App.cliArguments[0]=join(initialWorkingDirectory,App.cliArguments[0]); try { - await CommandsManager.openNamedFile(App.cliArguments[1]); + await CommandsManager.openNamedFile(App.cliArguments[0]); BookmarkManager.updateBookmarkList(); } catch (err) { @@ -208,9 +208,10 @@ export default class App { // when run from npm start, argv[0] is 'electron' if (process.argv[0].slice(-8)!=='electron') { + const cliArgs=process.argv.slice(1); let parsePositionalOnly=false; // process CLI options prior to running up any GUI - for (const arg of process.argv) { + for (const arg of cliArgs) { if (parsePositionalOnly) { App.cliArguments.push(arg);