Skip to content

feat(cli): NDJSON stdin protocol, list subcommands, modularize run.ts#11597

Merged
cte merged 2 commits intomainfrom
feat/cli-stdin-ndjson-list-subcommands
Feb 19, 2026
Merged

feat(cli): NDJSON stdin protocol, list subcommands, modularize run.ts#11597
cte merged 2 commits intomainfrom
feat/cli-stdin-ndjson-list-subcommands

Conversation

@cte
Copy link
Collaborator

@cte cte commented Feb 19, 2026

Summary

  • NDJSON stdin protocol: Overhaul stdin prompt stream from raw text lines to a structured command protocol (start, message, cancel, ping, shutdown) with requestId correlation, ack/done/error lifecycle events, and queue telemetry
  • List subcommands: Add list commands, list modes, and list models for programmatic discovery of available resources (JSON and text output formats)
  • Modularize run.ts: Extract ~500 lines of stdin stream logic into stdin-stream.ts, reducing run.ts from 917 to ~330 lines. Extract shared isRecord type guard into lib/utils/guards.ts
  • JsonEventEmitter enhancements: Add emitControl() and emitQueue() methods, requestIdProvider for automatic correlation, and schema/protocol/capabilities metadata for init events

Files changed

File Change
src/commands/cli/stdin-stream.ts New — NDJSON parsing, queue helpers, stream orchestrator
src/commands/cli/list.ts New — list subcommands with generic requestFromExtension<T> helper
src/lib/utils/guards.ts New — shared isRecord type guard
src/commands/cli/run.ts Shrink — replaced inline stdin logic with runStdinStreamMode() call
src/agent/json-event-emitter.ts Enhanced — control/queue event emission, requestId injection
src/types/json-events.ts Extended — control/queue event types, new fields
src/commands/cli/index.ts Export list module
src/index.ts Register list subcommands with Commander
scripts/test-stdin-stream.ts Updated to use NDJSON commands

Tests added

  • parse-stdin-command.test.ts — 19 tests for NDJSON command parsing (valid commands, error cases)
  • json-event-emitter-control.test.ts — 8 tests for control event emission and requestId injection
  • list.test.ts — 6 tests for parseFormat utility
  • guards.test.ts — 5 tests for isRecord type guard

Test plan

  • pnpm lint passes (0 warnings)
  • pnpm check-types passes
  • pnpm test passes (438 tests, 0 failures)
  • Manual testing with scripts/test-stdin-stream.ts against a running provider

🤖 Generated with Claude Code

Start a new Roo Code Cloud session on this branch

…e run.ts

Overhaul the stdin prompt stream from raw text lines to a structured NDJSON
command protocol (start/message/cancel/ping/shutdown) with requestId
correlation, ack/done/error lifecycle events, and queue telemetry. Add list
subcommands (commands, modes, models) for programmatic discovery. Extract
stdin stream logic from run.ts into stdin-stream.ts and add shared isRecord
guard utility. Includes unit tests for all new modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. Enhancement New feature or request labels Feb 19, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cte cte merged commit ffec9ac into main Feb 19, 2026
14 of 16 checks passed
@cte cte deleted the feat/cli-stdin-ndjson-list-subcommands branch February 19, 2026 08:04
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments