Browse Source

Refactor exports

Saoud Rizwan 1 năm trước cách đây
mục cha
commit
0914c069af
3 tập tin đã thay đổi với 22 bổ sung22 xóa
  1. 18 18
      src/exports/README.md
  2. 1 1
      src/exports/cline.d.ts
  3. 3 3
      src/exports/index.ts

+ 18 - 18
src/exports/README.md

@@ -1,46 +1,46 @@
-# Claude Dev API
+# Cline API
 
-The Claude Dev extension exposes an API that can be used by other extensions. To use this API in your extension:
+The Cline extension exposes an API that can be used by other extensions. To use this API in your extension:
 
-1. Copy `src/extension-api/claude-dev.d.ts` to your extension's source directory.
-2. Include `claude-dev.d.ts` in your extension's compilation.
+1. Copy `src/extension-api/cline.d.ts` to your extension's source directory.
+2. Include `cline.d.ts` in your extension's compilation.
 3. Get access to the API with the following code:
 
     ```ts
-    const claudeDevExtension = vscode.extensions.getExtension<ClaudeDevAPI>("saoudrizwan.claude-dev")
+    const clineExtension = vscode.extensions.getExtension<ClineAPI>("saoudrizwan.claude-dev")
 
-    if (!claudeDevExtension?.isActive) {
-    	throw new Error("Claude Dev extension is not activated")
+    if (!clineExtension?.isActive) {
+    	throw new Error("Cline extension is not activated")
     }
 
-    const claudeDev = claudeDevExtension.exports
+    const cline = clineExtension.exports
 
-    if (claudeDev) {
+    if (cline) {
     	// Now you can use the API
 
     	// Set custom instructions
-    	await claudeDev.setCustomInstructions("Talk like a pirate")
+    	await cline.setCustomInstructions("Talk like a pirate")
 
     	// Get custom instructions
-    	const instructions = await claudeDev.getCustomInstructions()
+    	const instructions = await cline.getCustomInstructions()
     	console.log("Current custom instructions:", instructions)
 
     	// Start a new task with an initial message
-    	await claudeDev.startNewTask("Hello, Claude! Let's make a new project...")
+    	await cline.startNewTask("Hello, Claude! Let's make a new project...")
 
     	// Start a new task with an initial message and images
-    	await claudeDev.startNewTask("Use this design language", ["data:image/webp;base64,..."])
+    	await cline.startNewTask("Use this design language", ["data:image/webp;base64,..."])
 
     	// Send a message to the current task
-    	await claudeDev.sendMessage("Can you fix the @problems?")
+    	await cline.sendMessage("Can you fix the @problems?")
 
     	// Simulate pressing the primary button in the chat interface (e.g. 'Save' or 'Proceed While Running')
-    	await claudeDev.pressPrimaryButton()
+    	await cline.pressPrimaryButton()
 
     	// Simulate pressing the secondary button in the chat interface (e.g. 'Reject')
-    	await claudeDev.pressSecondaryButton()
+    	await cline.pressSecondaryButton()
     } else {
-    	console.error("Claude Dev API is not available")
+    	console.error("Cline API is not available")
     }
     ```
 
@@ -52,4 +52,4 @@ The Claude Dev extension exposes an API that can be used by other extensions. To
     ]
     ```
 
-For detailed information on the available methods and their usage, refer to the `claude-dev.d.ts` file.
+For detailed information on the available methods and their usage, refer to the `cline.d.ts` file.

+ 1 - 1
src/exports/claude-dev.d.ts → src/exports/cline.d.ts

@@ -1,4 +1,4 @@
-export interface ClaudeDevAPI {
+export interface ClineAPI {
 	/**
 	 * Sets the custom instructions in the global storage.
 	 * @param value The custom instructions to be saved.

+ 3 - 3
src/exports/index.ts

@@ -1,9 +1,9 @@
 import * as vscode from "vscode"
 import { ClineProvider } from "../core/webview/ClineProvider"
-import { ClaudeDevAPI } from "./claude-dev"
+import { ClineAPI } from "./cline"
 
-export function createClaudeDevAPI(outputChannel: vscode.OutputChannel, sidebarProvider: ClineProvider): ClaudeDevAPI {
-	const api: ClaudeDevAPI = {
+export function createClineAPI(outputChannel: vscode.OutputChannel, sidebarProvider: ClineProvider): ClineAPI {
+	const api: ClineAPI = {
 		setCustomInstructions: async (value: string) => {
 			await sidebarProvider.updateCustomInstructions(value)
 			outputChannel.appendLine("Custom instructions set")