-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Rename ClineAPI to RooCodeAPI and improve types #1546
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| export { handleUri } from "./handleUri" | ||
| export { registerCommands } from "./registerCommands" | ||
| export { registerCodeActions } from "./registerCodeActions" | ||
| export { createRooCodeAPI } from "./createRooCodeAPI" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,51 @@ | ||
| # Cline API | ||
| # Roo Code API | ||
|
|
||
| The Cline extension exposes an API that can be used by other extensions. To use this API in your extension: | ||
| The Roo Code extension exposes an API that can be used by other extensions. To use this API in your extension: | ||
|
|
||
| 1. Copy `src/extension-api/cline.d.ts` to your extension's source directory. | ||
| 2. Include `cline.d.ts` in your extension's compilation. | ||
| 1. Copy `src/extension-api/roo-code.d.ts` to your extension's source directory. | ||
| 2. Include `roo-code.d.ts` in your extension's compilation. | ||
| 3. Get access to the API with the following code: | ||
|
|
||
| ```ts | ||
| const clineExtension = vscode.extensions.getExtension<ClineAPI>("rooveterinaryinc.roo-cline") | ||
| ```typescript | ||
| const extension = vscode.extensions.getExtension<RooCodeAPI>("rooveterinaryinc.roo-cline") | ||
|
|
||
| if (!clineExtension?.isActive) { | ||
| throw new Error("Cline extension is not activated") | ||
| } | ||
| if (!extension?.isActive) { | ||
| throw new Error("Extension is not activated") | ||
| } | ||
|
|
||
| const cline = clineExtension.exports | ||
| const api = extension.exports | ||
|
|
||
| if (cline) { | ||
| // Now you can use the API | ||
| if (!api) { | ||
| throw new Error("API is not available") | ||
| } | ||
|
|
||
| // Set custom instructions | ||
| await cline.setCustomInstructions("Talk like a pirate") | ||
| // Set custom instructions. | ||
| await api.setCustomInstructions("Talk like a pirate") | ||
|
|
||
| // Get custom instructions | ||
| const instructions = await cline.getCustomInstructions() | ||
| console.log("Current custom instructions:", instructions) | ||
| // Get custom instructions. | ||
| const instructions = await api.getCustomInstructions() | ||
| console.log("Current custom instructions:", instructions) | ||
|
|
||
| // Start a new task with an initial message | ||
| await cline.startNewTask("Hello, Cline! Let's make a new project...") | ||
| // Start a new task with an initial message. | ||
| await api.startNewTask("Hello, Roo Code API! Let's make a new project...") | ||
|
|
||
| // Start a new task with an initial message and images | ||
| await cline.startNewTask("Use this design language", ["data:image/webp;base64,..."]) | ||
| // Start a new task with an initial message and images. | ||
| await api.startNewTask("Use this design language", ["data:image/webp;base64,..."]) | ||
|
|
||
| // Send a message to the current task | ||
| await cline.sendMessage("Can you fix the @problems?") | ||
| // Send a message to the current task. | ||
| await api.sendMessage("Can you fix the @problems?") | ||
|
|
||
| // Simulate pressing the primary button in the chat interface (e.g. 'Save' or 'Proceed While Running') | ||
| await cline.pressPrimaryButton() | ||
| // Simulate pressing the primary button in the chat interface (e.g. 'Save' or 'Proceed While Running'). | ||
| await api.pressPrimaryButton() | ||
|
|
||
| // Simulate pressing the secondary button in the chat interface (e.g. 'Reject') | ||
| await cline.pressSecondaryButton() | ||
| } else { | ||
| console.error("Cline API is not available") | ||
| } | ||
| ``` | ||
| // Simulate pressing the secondary button in the chat interface (e.g. 'Reject'). | ||
| await api.pressSecondaryButton() | ||
| ``` | ||
|
|
||
| **Note:** To ensure that the `rooveterinaryinc.roo-cline` extension is activated before your extension, add it to the `extensionDependencies` in your `package.json`: | ||
| **NOTE:** To ensure that the `rooveterinaryinc.roo-cline` extension is activated before your extension, add it to the `extensionDependencies` in your `package.json`: | ||
|
|
||
| ```json | ||
| "extensionDependencies": [ | ||
| "rooveterinaryinc.roo-cline" | ||
| ] | ||
| ``` | ||
| ```json | ||
| "extensionDependencies": ["rooveterinaryinc.roo-cline"] | ||
| ``` | ||
|
|
||
| For detailed information on the available methods and their usage, refer to the `cline.d.ts` file. | ||
| For detailed information on the available methods and their usage, refer to the `roo-code.d.ts` file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.