✨ Add ws-cli editor commands for editor-state IPC#16
Merged
Conversation
a95d898 to
58ebc5f
Compare
New `editor` group talks to the workspace VS Code extension over the internal IPC socket, mirroring `clip paste`: - `editor list` / `diagnostics [--uri]` / `selection` — styled output (tables / key-value via internals/styles) like the `show`/`info` family; `--raw` emits the verbatim JSON response. - `editor open <file>` — `--reuse-window` (default) / `--new-window`, `--preview`, `--selection LINE:COL[-LINE:COL]`. The whole group hard-blocks under SSH (`env.IsSSHSession()`): the socket is reachable but there is no editor surface to act on. Golden fixtures under `internals/editor/testdata` pin the cross-repo JSON contract. Extract `config.Bootstrap()` shared by the root and editor pre-run hooks. This is the consumer half — the extension routes ship separately, so the commands report a friendly "workspace editor" error until then.
58ebc5f to
81fa487
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
ws-cli editorcommand group that talks to the workspace VS Codeextension over the internal IPC socket (
$WS__INTERNAL_IPC_SOCKET),mirroring the existing
clip paste→GET /clipboardpattern.editor listGET /editorseditor diagnostics [--uri]GET /diagnosticseditor selectionGET /selection(204 → empty)editor open <file>POST /openeditor openflags:--reuse-window(default) /--new-window(-n,mutually exclusive),
--preview,--selection LINE:COL[-LINE:COL](1-based).Notes
editorgroup hard-blocks under SSH(
env.IsSSHSession()). The socket is reachable from an SSH shell, butthere is no editor surface (the browser VS Code) to act on.
internals/editor/testdata/*.jsonpin the request/response JSON shapes. The Go test decodes them with
DisallowUnknownFieldsso a drift fails fast.config.Bootstrap()shared by the root and editorPersistentPreRunEhooks (cobra runs only the nearest one).WS__INTERNAL_IPC_SOCKETenv var.Scope / sequencing
This is the consumer half of a two-repo change. The matching
extension routes (
workspace/src/ws-extension/lib/editor.js), theopen/opennshim rewire, and the live round-trip test ship in aseparate
workspacePR that pins this binary. Until that lands, the newcommands report a friendly "workspace editor" error.
Tests
go build/go vet/gofmtclean. New unit tests (real unix-socketstub) cover request shape, JSON passthrough, 204, non-2xx + server-down
errors, the
--new-windowbody, the contract fixtures, the SSHshort-circuit, and
--selectionparsing.