UNPKG

@graphikartistry/cursor-doc-automation

Version:

Cursor IDE extension for autonomous documentation and ticket management

102 lines 3.84 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.FuelixClient = void 0; exports.generateFuelixCompletion = generateFuelixCompletion; exports.generateFuelixPromptCompletion = generateFuelixPromptCompletion; const axios_1 = __importDefault(require("axios")); const dotenv_1 = __importDefault(require("dotenv")); dotenv_1.default.config(); const fuelixClient = axios_1.default.create({ baseURL: process.env.FUELIX_API_URL, headers: { 'Authorization': `Bearer ${process.env.FUELIX_API_KEY}`, 'Accept': 'application/json', 'Content-Type': 'application/json', }, }); async function generateFuelixCompletion(messages, model = 'gpt-4o-mini-2024-07-18') { const response = await fuelixClient.post('/chat/completions', { model, messages, }); return response.data.choices[0].message.content; } async function generateFuelixPromptCompletion(prompt) { const response = await fuelixClient.post('/completions', { model: process.env.FUELIX_MODEL_NAME, prompt, }); return response.data.choices[0].message.content; } class FuelixClient { constructor() { this.client = axios_1.default.create({ baseURL: process.env.FUELIX_API_URL, headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${process.env.FUELIX_API_KEY}` } }); } async analyzeChanges(diff) { try { const response = await this.client.post('/completions', { model: process.env.FUELIX_MODEL_NAME, prompt: `Analyze the following code changes and generate technical documentation:\n\n${diff}`, max_tokens: 500 }); return response.data.choices[0].text; } catch (error) { console.error('Error analyzing changes:', error); throw error; } } async generateTechnicalDetails(analysis) { try { const response = await this.client.post('/completions', { model: process.env.FUELIX_MODEL_NAME, prompt: `Based on the following analysis, provide detailed technical information about the implementation:\n\n${analysis}`, max_tokens: 300 }); return response.data.choices[0].text; } catch (error) { console.error('Error generating technical details:', error); throw error; } } async identifyRelatedComponents(analysis) { try { const response = await this.client.post('/completions', { model: process.env.FUELIX_MODEL_NAME, prompt: `Identify and list the related components affected by these changes:\n\n${analysis}`, max_tokens: 200 }); return response.data.choices[0].text; } catch (error) { console.error('Error identifying related components:', error); throw error; } } async generateAdditionalNotes(analysis) { try { const response = await this.client.post('/completions', { model: process.env.FUELIX_MODEL_NAME, prompt: `Generate any additional notes or considerations based on these changes:\n\n${analysis}`, max_tokens: 200 }); return response.data.choices[0].text; } catch (error) { console.error('Error generating additional notes:', error); throw error; } } } exports.FuelixClient = FuelixClient; //# sourceMappingURL=fuelixClient.js.map