Skip to content
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

Improve example providers #148

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

toolmantim
Copy link
Collaborator

@toolmantim toolmantim commented Jun 13, 2024

Updates the Hello World provider with an example of how to do mentions, and adds a simple JSON API example too

Fixes https://linear.app/sourcegraph/issue/CODY-2438/update-the-examples-on-openctxorg-to-show-mentions

@toolmantim toolmantim requested review from kilyinov and a team June 13, 2024 10:39
@toolmantim
Copy link
Collaborator Author

Ah, will update tests…

Copy link
Member

@keegancsmith keegancsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

1. `pnpm install`
1. `pnpm -C provider/hello-world bundle --watch` to automatically recompile on changes
1. Run `echo file://$(pwd)/provider/hello-world/dist/bundle.js` and use that URL in your OpenCtx instead of `"https://openctx.org/npm/@openctx/provider-hello-world"`
1. Reload your OpenCtx client
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we mention testing with the cli as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's a good idea, will do. It's pretty hard to develop a provider without the cli tbh

@PriNova
Copy link

PriNova commented Jun 20, 2024

I would love to see a working example for a provider implemented as a standalone vs code extension (or similar) communicating with Cody over http.
I wrote a vs code extension where I implemented a http server over localhost:1234 as endpoint and used that in the Cody settings as OpenCTX provider.
Then I implemented the server.on('request', ...) function and as response the custom implemented Provider from the @openctx/provider npm (similar to your example above). In Cody the handshake works, but Cody does not show this custom provider. Badly, all other providers disappear (except 'Repository' and 'Current File')

Thank you.

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.

3 participants