Skip to content

Commit 0d52e7d

Browse files
authored
refactor: extract CLI execution into cliExec module with improved UX (#875)
Consolidate all Coder CLI invocations (version, speedtest, ping, terminal spawning) into a dedicated module, replacing the scattered helpers that previously lived across commands and utility files. Key improvements: - CLI errors now surface stderr to the user instead of the raw exec message which includes the full command line and arguments. - Speed test and ping can be launched from the sidebar on any workspace, not just the one currently connected. - Speed test duration input is validated before submission. - Binary resolution tries a local lookup before falling back to a network fetch, making repeat commands faster when the binary is already cached. - Shared workspace-picker logic is deduplicated across commands.
1 parent d998ac2 commit 0d52e7d

17 files changed

+680
-461
lines changed

package.json

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -259,12 +259,6 @@
259259
"when": "!coder.authenticated && coder.loaded"
260260
}
261261
],
262-
"submenus": [
263-
{
264-
"id": "coder.diagnostics",
265-
"label": "Diagnostics"
266-
}
267-
],
268262
"commands": [
269263
{
270264
"command": "coder.login",
@@ -327,7 +321,7 @@
327321
},
328322
{
329323
"command": "coder.speedTest",
330-
"title": "Run Speed Test",
324+
"title": "Speed Test Workspace",
331325
"category": "Coder"
332326
},
333327
{
@@ -379,6 +373,14 @@
379373
"command": "coder.pingWorkspace",
380374
"title": "Ping Workspace",
381375
"category": "Coder"
376+
},
377+
{
378+
"command": "coder.speedTest:views",
379+
"title": "Speed Test"
380+
},
381+
{
382+
"command": "coder.pingWorkspace:views",
383+
"title": "Ping"
382384
}
383385
],
384386
"menus": {
@@ -401,7 +403,7 @@
401403
},
402404
{
403405
"command": "coder.speedTest",
404-
"when": "coder.workspace.connected"
406+
"when": "coder.authenticated"
405407
},
406408
{
407409
"command": "coder.navigateToWorkspace",
@@ -415,6 +417,14 @@
415417
"command": "coder.pingWorkspace",
416418
"when": "coder.authenticated"
417419
},
420+
{
421+
"command": "coder.speedTest:views",
422+
"when": "false"
423+
},
424+
{
425+
"command": "coder.pingWorkspace:views",
426+
"when": "false"
427+
},
418428
{
419429
"command": "coder.workspace.update",
420430
"when": "coder.workspace.updatable"
@@ -523,14 +533,14 @@
523533
"group": "inline"
524534
},
525535
{
526-
"submenu": "coder.diagnostics",
536+
"command": "coder.pingWorkspace:views",
527537
"when": "coder.authenticated && viewItem =~ /\\+running/",
528538
"group": "navigation"
529-
}
530-
],
531-
"coder.diagnostics": [
539+
},
532540
{
533-
"command": "coder.pingWorkspace"
541+
"command": "coder.speedTest:views",
542+
"when": "coder.authenticated && viewItem =~ /\\+running/",
543+
"group": "navigation"
534544
}
535545
],
536546
"statusBar/remoteIndicator": [

0 commit comments

Comments
 (0)