waveterm/pkg/wshrpc
Copilot b2f3129aa0
Add wsh debugterm (#2947)
`wsh debugterm` currently decodes terminal bytes sourced from backend
block files. This extends it with a stdin-driven path so FE-emitted
payloads like `["...", "..."]` can be decoded directly without requiring
block lookup/RPC in that mode.

- **CLI surface**
  - Added new mode: `--mode stdin`
  - Updated mode help text to: `hex`, `decode`, `stdin`
  - Centralized mode validation via `getDebugTermMode()`

- **Execution path split**
  - Added mode-aware pre-run (`debugTermPreRun`):
    - `stdin` mode: skips RPC setup
    - `hex`/`decode`: keeps existing RPC setup behavior
  - `stdin` mode now:
    - reads all stdin
    - parses JSON as `[]string`
    - concatenates entries and runs existing decode formatter

- **Parsing support**
  - Added `parseDebugTermStdinData([]byte) ([]byte, error)`
  - Error messaging explicitly requires a JSON array of strings

- **Tests**
  - Added focused coverage for:
    - valid stdin JSON array parsing + decoded output
    - invalid stdin JSON input

```go
stdinData, _ := io.ReadAll(WrappedStdin)
termData, err := parseDebugTermStdinData(stdinData) // expects []string JSON
if err != nil { return err }
WriteStdout("%s", formatDebugTermDecode(termData))
```

<!-- START COPILOT CODING AGENT TIPS -->
---

 Let Copilot coding agent [set things up for
you](https://github.com/wavetermdev/waveterm/issues/new?title=+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
Co-authored-by: sawka <mike@commandline.dev>
2026-02-27 10:24:26 -08:00
..
wshclient Add wsh debugterm (#2947) 2026-02-27 10:24:26 -08:00
wshremote Refine RemoteFileMultiInfoCommand semantics: dedup inputs, per-path stat errors, and cancellation (#2935) 2026-02-25 12:52:50 -08:00
wshserver Add wsh debugterm (#2947) 2026-02-27 10:24:26 -08:00
wshrpcmeta.go Happy new year! (#1684) 2025-01-04 20:56:57 -08:00
wshrpctypes.go Add wsh debugterm (#2947) 2026-02-27 10:24:26 -08:00
wshrpctypes_builder.go rpc streaming primitives (#2759) 2026-01-08 16:14:56 -08:00
wshrpctypes_const.go new job manager / framework for creating persistent remove sessions (#2779) 2026-01-21 16:54:18 -08:00
wshrpctypes_file.go Refine RemoteFileMultiInfoCommand semantics: dedup inputs, per-path stat errors, and cancellation (#2935) 2026-02-25 12:52:50 -08:00