Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

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

Merged
cte merged 2 commits into
mainfrom
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 into
mainfrom
feat/cli-stdin-ndjson-list-subcommands

Conversation

@cte

@ctecte commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

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

FileChange
src/commands/cli/stdin-stream.tsNew — NDJSON parsing, queue helpers, stream orchestrator
src/commands/cli/list.tsNew — list subcommands with generic requestFromExtension<T> helper
src/lib/utils/guards.tsNew — shared isRecord type guard
src/commands/cli/run.tsShrink — replaced inline stdin logic with runStdinStreamMode() call
src/agent/json-event-emitter.tsEnhanced — control/queue event emission, requestId injection
src/types/json-events.tsExtended — control/queue event types, new fields
src/commands/cli/index.tsExport list module
src/index.tsRegister list subcommands with Commander
scripts/test-stdin-stream.tsUpdated 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>
@dosubotdosubotBot 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 mainFeb 19, 2026
14 of 16 checks passed
@cte
cte deleted the feat/cli-stdin-ndjson-list-subcommands branch February 19, 2026 08:04
@github-actionsgithub-actionsBot mentioned this pull request Feb 19, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

EnhancementNew feature or requestsize:XXLThis PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@cte