Skip to content

feat: add streaming support for commit suggestions#114

Open
404-Page-Found wants to merge 2 commits into
mainfrom
5-add-streaming-suggestion-output
Open

feat: add streaming support for commit suggestions#114
404-Page-Found wants to merge 2 commits into
mainfrom
5-add-streaming-suggestion-output

Conversation

@404-Page-Found
Copy link
Copy Markdown
Contributor

Summary

Add streaming suggestion output so commit messages appear incrementally as they arrive from the LLM, rather than waiting for the full response.

Changes

  • Add optional \completeStream\ method to the \Provider\ interface for backward compatibility
  • Implement SSE streaming in \OpenAICompatibleProvider\ (parses \data:\ chunks from /chat/completions)
  • Implement SSE streaming in \AnthropicProvider\ (parses \content_block_delta\ events from /messages)
  • Add \generateSuggestionsStream\ async generator in \src/llm/client.ts\
  • Add --stream\ flag to \commit-echo suggest\ for progressive terminal output
  • Non-streaming mode remains the default for full backward compatibility
  • Cohere provider deferred (streaming API differs)

Motivation

  • Generation can take 5-15 seconds for large diffs with no visible progress
  • Streaming is supported by most major LLM providers (OpenAI, Anthropic, Google, etc.)
  • Improves user experience and perceived performance

Testing

  • All 82 existing tests pass
  • Build compiles cleanly with no errors
  • --stream\ flag appears in \suggest --help\ output

Closes #5

@404-Page-Found 404-Page-Found added the enhancement New feature or request label Jun 4, 2026
@404-Page-Found 404-Page-Found linked an issue Jun 4, 2026 that may be closed by this pull request
…ssues

- Wrap streaming for-await in try/catch with user-friendly error message
- Remove redundant truncateDiff call in streaming branch (already done inside generateSuggestionsStream)
- Consolidate duplicate parseSuggestions/truncateDiff imports into single line
- Use const instead of let for never-reassigned model variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add streaming suggestion output

1 participant