UNPKG

cline-sdk

Version:

Comprehensive SDK for Cline - AI-powered development assistant with database integration, execution modes, and custom functions

60 lines 2.07 kB
"use strict"; /** * Supabase Read Tool - Reads files from Supabase Storage * Alternative to local file storage */ Object.defineProperty(exports, "__esModule", { value: true }); exports.SupabaseReadTool = void 0; const supabase_storage_1 = require("../storage/supabase-storage"); class SupabaseReadTool { constructor(supabaseConfig) { this.storage = new supabase_storage_1.SupabaseStorage(supabaseConfig); } async execute(input) { try { const { file_path } = input; // Check if file exists first const exists = await this.storage.fileExists(file_path); if (!exists) { return { success: false, message: `File not found in Supabase Storage: ${file_path}`, file_path, }; } const result = await this.storage.readFile(file_path); return { success: result.success, content: result.content, message: result.message, file_path: result.file_path, url: this.storage.getPublicUrl(file_path), }; } catch (error) { return { success: false, message: `Failed to read file from Supabase: ${error instanceof Error ? error.message : "Unknown error"}`, file_path: input.file_path, }; } } getDefinition() { return { name: "Read", description: "Read the contents of a file from Supabase Storage", inputSchema: { type: "object", properties: { file_path: { type: "string", description: "The path of the file to read from Supabase Storage", }, }, required: ["file_path"], }, }; } } exports.SupabaseReadTool = SupabaseReadTool; //# sourceMappingURL=supabase-read-tool.js.map