Commit Graph

113 Commits

Author SHA1 Message Date
Kit Langton 4aa2a47ee2 test(cli): tier-A read-only command smoke tests
Adds smoke tests for the seven read-only commands that share the
run-shaped lifecycle:

  - mcp list
  - providers list
  - models
  - agent list
  - session list
  - stats
  - db path

Each test asserts only that the command exits 0 and produces sane
output in the harness's isolated env. They're not behavioral tests —
they're the cheapest possible signal that the dependency-layer wiring
(config load, DB init, server boot, provider resolution) doesn't crash
for the broad class of "no inputs, no side effects" commands. A
regression in any shared layer will fail one or more of these tests.

Pushes behavioral coverage of the CLI surface from ~14% to ~50%.

Findings while wiring assertions:

  - \`providers list\` reflects credentials + env vars, not
    config-injected static providers. The assertion verifies the
    section headers ("Credentials" / "Environment") to lock in the
    output shape.
  - \`db path\` returns SQLite's \`:memory:\` under harness isolation
    (no on-disk pollution between tests). The assertion accepts either
    \`:memory:\` or a real path.

7/7 pass in ~7s; full CLI suite stays green at 331/331.
2026-05-18 21:23:55 -04:00
Kit Langton af1e67d850 test(cli): stabilize acp --help snapshot against random home path length
yargs wraps the \`[string] [default: "..."]\` clause based on the
pre-normalized default value's character length, so a different random
tmpdir width produces a different leading-whitespace count on the
wrapped continuation line. After normalizing the path to \`<HOME>\` we
were left with a one-space drift between runs.

Collapse the wrap-dependent whitespace immediately before the clause
so the snapshot is byte-stable regardless of home path length.

Verified by deleting the .snap and regenerating across 3 runs.
2026-05-18 21:22:59 -04:00
Kit Langton 13e68a5892 refactor(test/lib): simplify cli-process helpers per Effect idioms
Applied review findings from the simplify pass:

1. Extract fromBunStream(name, get) and forkStderrDrain(stream, into)
   helpers — 4 duplicated Stream.fromReadableStream call sites collapse
   to one factory, and the identical stderr drain across serve/acp is
   now a single helper. Error messages now include the underlying cause
   instead of swallowing it.

2. acp.send awaits proc.stdin.write's backpressure promise. The bare
   Effect.sync was discarding the Promise<number> form, which can
   reorder ndjson lines under pipe-buffer-full conditions and corrupt
   framing.

3. acp.close drops the try/catch around proc.stdin.end() — idempotent
   in Bun, the bare catch only masked future regressions.

4. Effect.ignore on stream drains is now Effect.ignore({ log: true })
   so a real protocol or decode error surfaces in test debug output
   instead of disappearing silently.

5. Help-snapshots replaces the manual failures[] accumulator + continue
   with Effect.partition. Same behavior, no mutable state, declarative.

324/324 CLI tests stay green; typecheck clean.
2026-05-18 21:11:29 -04:00
Kit Langton 8db5e421ab test(cli): help-text snapshots for every CLI command
One test file. Spawns `opencode <cmd> --help` for every documented
command + key subcommand (35 in total) in parallel under concurrency:8,
snapshots the stderr output (yargs writes --help to stderr, not stdout).

Snapshots are normalized — the tmpdir prefix that bleeds through
`acp --cwd`'s default is rewritten to `<HOME>` so test runs in
different sandboxes stay stable. macOS `/private` realpath form and
the unresolved `os.tmpdir()` form both covered.

Pinned snapshots catch flag removals, renames, reordering, and exit-code
regressions across the entire user-facing CLI surface in one place.
Diff in the .snap file is the surface-change report.

Excluded: `opencode completion --help` is a yargs built-in that emits
top-level help and exits 1; not a real opencode command.

~6s wall-clock thanks to parallel spawns.
2026-05-18 21:11:29 -04:00
Kit Langton 29cf700361 test(cli): subprocess integration tests for opencode acp
Adds the second long-lived-command builder to the cli-process harness:
`opencode.acp(opts)` spawns the real CLI in JSON-RPC-over-stdio mode
and returns a duplex handle (`send`/`receive`/`close`/`exited`) scoped
to the test's lifetime. Stdin EOF triggers a clean shutdown; the scope
finalizer also falls back to SIGTERM after 2s for a hung child.

ACP frames each JSON-RPC message as one ndjson line on stdout. The
builder forks a scope-bound `Stream.fromReadableStream` + `splitLines`
pipeline that feeds parsed responses into a `Queue.unbounded`, so tests
can `yield* acp.receive` without worrying about backpressure or framing.

Two smoke tests:
- `initialize` round-trip — sends the protocol handshake from the ACP
  README and asserts the response advertises the same protocolVersion
  and a non-empty agentCapabilities block.
- Clean shutdown on stdin EOF — proves the scope finalizer's stdin.end()
  triggers a graceful exit, not a SIGTERM-fallback exit.
2026-05-18 21:10:06 -04:00
Kit Langton ebb672ac39 test(cli): subprocess integration tests for opencode serve (#28263) 2026-05-19 00:55:58 +00:00
Kit Langton 7b8a1037a0 refactor(test/lib): generalize run-process harness into cli-process (#28253) 2026-05-18 19:16:10 -04:00
Kit Langton 0f3d168fdd test(cli): subprocess integration test harness + regression suite for opencode run (#28230) 2026-05-18 18:32:20 -04:00
Kit Langton 896ad7b884 Speed up targeted opencode tests
Reduce avoidable setup costs in slow opencode tests while preserving reviewed coverage and recording the benchmark evidence for follow-up test-suite work.
2026-05-18 16:18:29 +00:00
Sebastian 6e4db5666a upgrade opentui to 0.2.14 (#28090) 2026-05-18 13:44:08 +02:00
opencode-agent[bot] c813927bb6 chore: generate 2026-05-18 11:07:52 +00:00
Simon Klee 5970c12d90 run: replay session history on interactive resume (#26880) 2026-05-18 13:06:27 +02:00
Sebastian f97e115ee2 dialog prompt submit keybind + opentui event sink (#27945) 2026-05-18 00:23:19 +02:00
Sebastian cc9c0b15c7 Revert "add dialog prompt submit keybind (#27807)" (#27815) 2026-05-16 04:44:32 +02:00
Kit Langton f3b0d3d7ac fix(tui): dedupe consecutive prompt history entries (#27816) 2026-05-16 02:36:35 +00:00
Sebastian d441e931f9 add dialog prompt submit keybind (#27807) 2026-05-16 03:11:46 +02:00
opencode-agent[bot] d6b23fd8f6 chore: generate 2026-05-16 00:44:10 +00:00
Kit Langton 5911bd532d fix(tui): show config error details on startup (#27803) 2026-05-15 20:42:56 -04:00
Sebastian 0f31fd631b Fix multiline mentions (#27649) 2026-05-15 23:04:20 +02:00
Shoubhit Dash 0c9cfe923f refactor(instance): remove legacy runtime fallback (#27757) 2026-05-15 23:05:44 +05:30
Shoubhit Dash be6e7b309e refactor(provider): type init errors (#27484) 2026-05-14 14:48:58 +05:30
Kit Langton 55e0af1405 fix(provider): type model not found errors (#27334) 2026-05-13 22:23:09 +00:00
opencode-agent[bot] 9fe912439b chore: generate 2026-05-13 05:41:29 +00:00
Shoubhit Dash dd46fddf22 test(cli): cover config json diagnostics (#27257) 2026-05-13 05:40:12 +00:00
Shoubhit Dash 367665dba2 fix(cli): render tagged config errors (#27256) 2026-05-13 11:01:18 +05:30
Sebastian d6367853ae Add TUI notifications and attention sounds (disabled by default) (#26980) 2026-05-13 03:26:25 +02:00
Kit Langton 72ce24c200 test: migrate effect cmd ALS test (#27173) 2026-05-12 23:48:17 +00:00
Kit Langton 3974520742 Migrate UI cancel error to tagged error (#27112) 2026-05-12 18:09:00 +00:00
Simon Klee 8f05bbfaa6 prompt: fix cursor math for wide characters (#27017)
String.length counts code points, not display columns, so CJK
characters and emoji that occupy two terminal cells caused
misaligned cursors, broken mention triggers, and incorrect
history restoration offsets.

Use Bun.stringWidth for now, we need an alternative for this.

Fix #26716
Close #26922
2026-05-12 11:45:28 +02:00
opencode-agent[bot] 5cc84800dc chore: generate 2026-05-12 03:43:40 +00:00
James Long 2b432d9e03 fix(tui): scope events by project (#26936) 2026-05-11 23:42:04 -04:00
Kit Langton 74aa735e6a fix(tui): guard prompt submit against concurrent invocation (#26972) 2026-05-12 01:35:28 +00:00
Kit Langton a5c35bf182 Avoid bootstrapping server plugins from TUI plugin runtime (#26938) 2026-05-11 17:32:16 -04:00
Sebastian 5654dd2aad restore managed textarea keymap handling (#26771) 2026-05-11 01:45:59 +02:00
Kit Langton 67b9c9c027 Source HTTP API ID path patterns (#26623) 2026-05-09 22:58:47 -04:00
opencode-agent[bot] 818b56dbd0 chore: generate 2026-05-09 22:47:54 +00:00
Kit Langton 29b5b24787 fix(tui): aggregate bootstrap request failures
TUI bootstrap now reports all parallel fetch failures together instead of losing sibling failures after the first rejection.
2026-05-09 18:46:52 -04:00
Kit Langton 6c2dfd2f52 fix(tui): guard messages.data in session.sync against undefined (#26566)
Co-authored-by: Developer <temp@example.com>
2026-05-09 19:58:03 +00:00
Sebastian a0fc27e424 flatten to keybind compatible config (#26421) 2026-05-09 01:29:13 +02:00
Shoubhit Dash 40d5ea1cf1 feat(core): add scout agent for repo research (#24149)
Co-authored-by: Dax Raad <d@ironbay.co>
2026-05-08 20:20:08 +00:00
opencode-agent[bot] 9e7f7bf8e4 chore: generate 2026-05-08 17:46:57 +00:00
Simon Klee 4d43d584fe cli/run: switch to global event stream (#26383) 2026-05-08 19:44:31 +02:00
James Long c818c9dcb6 feat(core): allow external workspace creation (#26212) 2026-05-08 11:09:12 -04:00
Sebastian 19da27e1cb internal which-key plugin, inactive by default (#26337) 2026-05-08 13:55:49 +02:00
opencode-agent[bot] ac7a885ae9 chore: generate 2026-05-08 10:18:22 +00:00
Simon Klee 7f2b5ee8c2 feat(opencode): add interactive split-footer mode to run (#23557) 2026-05-08 12:17:14 +02:00
Sebastian 98f5e6e713 introduce opentui keymap as sole key/cmd engine (#26053) 2026-05-07 20:35:31 +02:00
James Long 3c4b4d5faf feat(core): copy file changes when warping (#26190) 2026-05-07 10:24:17 -04:00
Shoubhit Dash 95280ebec9 fix(tui): restore custom provider in /connect (#26168) 2026-05-07 17:05:35 +05:30
James Long 2abc4507b2 fix(tui): filter only connected workspaces in dialog; add warp synthetic message (#25915) 2026-05-06 10:25:42 -04:00