Skip to content

feat: add stdin support to providers, use stdin for OpenCodeProvider …#146

Open
letieu wants to merge 1 commit intoThePrimeagen:masterfrom
letieu:feat/provider-stdin
Open

feat: add stdin support to providers, use stdin for OpenCodeProvider …#146
letieu wants to merge 1 commit intoThePrimeagen:masterfrom
letieu:feat/provider-stdin

Conversation

@letieu
Copy link

@letieu letieu commented Mar 2, 2026

Pass query via stdin instead of a CLI positional arg in OpenCodeProvider to avoid shell argument size limits.

BaseProvider gains a _build_stdin hook (returns nil by default) that subclasses can override; make_request now forwards the result to vim.system's stdin option.

This is error:

Error in BufWriteCmd Autocommands for "<buffer=3>":                                                                                                                                                                              
Lua callback: vim/_system.lua:0: E2BIG: argument list too long                                                                                                                                                                   
stack traceback:                                                                                                                                                                                                                 
        [C]: in function 'error'                                                                                                                                                                                                 
        vim/_system.lua: in function ''                                                                                                                                                                                          
        vim/_system.lua: in function 'system'                                                                                                                                                                                    
        /home/tieu/.local/share/nvim/lazy/99/lua/99/providers.lua:76: in function 'make_request'                                                                                                                                 
        /home/tieu/.local/share/nvim/lazy/99/lua/99/prompt.lua:300: in function 'start_request'         

Note

Medium Risk
Touches request execution for all providers by wiring optional stdin into vim.system, which could affect provider invocation if stdin/args expectations differ. Change is small and covered by updated unit tests for OpenCodeProvider.

Overview
Adds a new optional BaseProvider:_build_stdin() hook (default nil) and updates BaseProvider:make_request() to pass the returned value into vim.system as stdin.

Updates OpenCodeProvider to remove the query from its command args and instead provide it via _build_stdin, with accompanying test updates to assert the new behavior.

Written by Cursor Bugbot for commit a5687d3. This will update automatically on new commits. Configure here.

…query

Pass query via stdin instead of a CLI positional arg in OpenCodeProvider
to avoid shell argument size limits. BaseProvider gains a _build_stdin
hook (returns nil by default) that subclasses can override; make_request
now forwards the result to vim.system's stdin option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant