Skip to content

Use opencode headless #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kujtimiihoxha opened this issue Apr 25, 2025 · 9 comments
Open

Use opencode headless #61

kujtimiihoxha opened this issue Apr 25, 2025 · 9 comments

Comments

@kujtimiihoxha
Copy link
Collaborator

Make it possible for opencode to expose some kind of API e.x stdio or rest so you could build dedicated plugins for editors but still use opencode for all the LLM stuff.

@adamdottv
Copy link
Contributor

i'd personally love to use this headless for a project i've considered, would think stdio isn't a rich enough API for what i'd want to do, but not sure what's best

@kujtimiihoxha
Copy link
Collaborator Author

I also need to support events to make it work, so it might have to be sse

@kujtimiihoxha
Copy link
Collaborator Author

Well we could also add websocket or a way to pull stuff...

@shreyassanthu77
Copy link
Contributor

shreyassanthu77 commented Apr 25, 2025

oooo I love this idea!!!!

maybe seperate the transport and make it like lsp or how nvim remote plugins work? (So like json rpc api over whatever transport you want)

eidt: or maybe just expose a go (or a c compatible) public api and let the consumer figure out how to use it??

@radutopala
Copy link

Some more ideas

@kujtimiihoxha
Copy link
Collaborator Author

@radutopala thanks for the PR, I am thinking along the lines of stdio/see or some similar thing to LSP servers for json RPC events and messages.

Basically since I build the architecture of opencode around services and events adding this layer should not be difficult, basically the RPC server would accept commands and relay that to the services just like the TUI does currently, and than on service events we would send events through that same RPC connection similar to LSP events...

@kujtimiihoxha
Copy link
Collaborator Author

This way you can build a full on UI if you want ontop of opencode, even something like a neovim plugin or vscode extention

@ezynda3
Copy link

ezynda3 commented May 2, 2025

I still think running with a one-off prompt is super useful as it allows you to create agentic workflows or scripts for repetative tasks. For example you could have a prompt like

Update the version number in the following files
VERSION.md
version.go
...

Then just have a script that calls opencode $PROMPT or something similar.

@ezynda3
Copy link

ezynda3 commented May 2, 2025

Here is how Claude Code does it. Might be better to use a -p flag for this https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#use-claude-as-a-unix-style-utility

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

No branches or pull requests

5 participants