Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/popular-ravens-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"overide": major
---

This change removes all other platform support besides OpenAI, as well as some code refactoring.
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
- [Community](#community)
- [License](#license)


## Key Features

- **IDE Agnostic**: Works with any IDE or text editor
- **AI-Powered Code Generation**: Uses OpenAI, DeepSeek, or Groq APIs
- **AI-Powered Code Generation**: Uses OpenAI API
- **Live File Monitoring**: Continuously monitors files for code generation prompts
- **Simple Prompting Syntax**: Uses intuitive `//> <//` patterns for code generation

Expand All @@ -44,18 +43,12 @@ For more installation options, see our [installation guide](https://github.com/O

### Adding API Key

Configure your AI platform credentials:
Configure your OpenAI credentials:

```bash
overide config --global
```

Select an active platform if you've configured multiple:

```bash
overide config --select-active
```

### Configure a Project

Configure Overide in your project directory:
Expand Down Expand Up @@ -85,7 +78,7 @@ Overide will generate and insert code:
```javascript
//- 'Hello, World!' Function
function helloWorld() {
console.log("Hello, World!");
console.log("Hello, World!");
}
//> Accept the changes (y/n): -//
```
Expand All @@ -96,8 +89,8 @@ Configure Overide using `oi-config.json`:

```json
{
"name": "project name",
"ignore": ["node_modules", "*.test.js"]
"name": "project name",
"ignore": ["node_modules", "*.test.js"]
}
```

Expand Down
50 changes: 12 additions & 38 deletions assets/prompt.structure.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,14 @@
{
"openai": {
"systemMessage": "Your task is to provide accurate and efficient code completions and respond in VALID JSON.",
"context": "Below is the current code context:",
"format": "```[\n{\n \"find\": [lines to find],\n \"replace\": [lines to replace]\n},\n{\n \"find\": [lines to find],\n \"replace\": [lines to replace]\n}\n]\n```",
"instructions": [
"Do not include comments explaining the changes.",
"Make sure that the structure of the file is maintained. Imports, Global Variables and should be placed at the top of the file below other imports or global variables.",
"Make sure that the {lines in find} accounts for empty spaces and empty lines in the existing code.",
"Include tabs and spaces in the replace lines to PROPERLY INDENT according to existing code.",
"Use the following JSON format to respond:"
]
},
"deepseek": {
"systemMessage": "You are a coding assistant API specialized in generating accurate and efficient code completions and responding in valid JSON.",
"context": "Below is the current code context:",
"format": "[\n{\n \"find\": [lines to find],\n \"replace\": [lines to replace]\n},\n{\n \"find\": [lines to find],\n \"replace\": [lines to replace]\n}\n]\n",
"instructions": [
"Do not include comments explaining the changes.",
"Please provide the entire code block that should be replaced, and the entire new code block as the replacement, as list of lines.",
"Return the JSON inside a markdown block quote using triple backticks (```).",
"If code to be replaced is separated by even ONE OR MORE empty line then return multiple {find, replace} structures in a list",
"Include proper indentation in code.",
"Use the following JSON format to respond:"
]
},
"groq": {
"systemMessage": "You are a coding assistant API specialized in generating accurate and efficient code completions and responding in valid JSON while following the instructions STRICTLY.",
"context": "Below is the current code context:",
"format": "[\n{\n \"find\": [lines to find],\n \"replace\": [lines to replace]\n},\n{\n \"find\": [lines to find],\n \"replace\": [lines to replace]\n}\n]\n",
"instructions": [
"Do not include comments explaining the changes.",
"Please provide the entire code block that should be replaced, and the entire new code block as the replacement, as list of lines.",
"Return the VALID JSON inside a markdown block quote using triple backticks (```).",
"If code to be replaced is separated by even ONE OR MORE empty line then return multiple {find, replace} structures in a list",
"Include proper indentation in code.",
"Use the following JSON format to respond:"
]
}
"openai": {
"systemMessage": "Your task is to provide accurate and efficient code completions and respond in VALID JSON.",
"context": "Below is the current code context:",
"format": "```[\n{\n \"find\": [lines to find],\n \"replace\": [lines to replace]\n},\n{\n \"find\": [lines to find],\n \"replace\": [lines to replace]\n}\n]\n```",
"instructions": [
"Do not include comments explaining the changes.",
"Make sure that the structure of the file is maintained. Imports, Global Variables and should be placed at the top of the file below other imports or global variables.",
"Make sure that the {lines in find} accounts for empty spaces and empty lines in the existing code.",
"Include tabs and spaces in the replace lines to PROPERLY INDENT according to existing code.",
"Use the following JSON format to respond:"
]
}
}
33 changes: 16 additions & 17 deletions src/commands/command.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ import utilParser from '../utilis/util.parser';

/**
* The `Config` class is responsible for handling both global and local configurations
* for the `overide` CLI application. It manages configuration settings for different platforms
* (like OpenAI and DeepSeek) and allows users to select an active platform, update config
* details, and manage ignored files and project-specific settings.
* for the `overide` CLI application. It manages configuration settings for OpenAI
* and allows users to update config details, and manage ignored files and project-specific settings.
*
* Responsibilities:
* - Prompt the user for platform-specific configuration details.
* - Prompt the user for OpenAI configuration details.
* - Manage global configuration, including setting the active platform and updating platform settings.
* - Handle local configuration updates, including project name and ignored files.
* - Ensure that required directories and configuration files exist.
Expand All @@ -37,7 +36,7 @@ class Config extends OiCommand {
// Define supported platforms and their respective configuration prompts
this.platforms = supportedPlatforms;

// Configuration questions for each platform (OpenAI, DeepSeek, Groq)
// Configuration questions for OpenAI
this.platformQuestions = platformQuestions;
}

Expand Down Expand Up @@ -109,31 +108,31 @@ class Config extends OiCommand {
}

async handleEmbeddingEnable(): Promise<void> {
// Check if OpenAi platform details are available.
// Check if OpenAI platform details are available.
const activePlatform = CommandHelper.getActiveServiceDetails(true);
if (!activePlatform) {
console.warn(
'Overide supports embeddings over OpenAI\nEnabling this will incure additional cost'
'Overide supports embeddings over OpenAI\nEnabling this will incur additional cost'
);
// Ask for open ai platform details.
// Ask for OpenAI platform details.
const answers = await this.promptPlatformConfig('openai');

// Check if a global config file already exists, if not initialize an empty config
const existingConfig = CommandHelper.configExists(true)
? await CommandHelper.readConfigFileData(true)
? CommandHelper.readConfigFileData(true)
: {};

// Merge the new platform configuration with the existing config
const updatedConfig = {
...existingConfig,
['openai']: {
...answers,
isActive: Object.keys(existingConfig as GlobalConfig).length === 0 ? true : false // Set isActive for first platform
isActive: true // OpenAI is always active for embeddings
}
};

// Save the updated global configuration
await CommandHelper.writeConfigFileData(true, updatedConfig);
CommandHelper.writeConfigFileData(true, updatedConfig);
}

// Set the embeddings flag to true.
Expand Down Expand Up @@ -179,7 +178,7 @@ class Config extends OiCommand {
}

// Read the existing global configuration file
const existingConfig = (await CommandHelper.readConfigFileData(true)) as GlobalConfig;
const existingConfig = CommandHelper.readConfigFileData(true) as GlobalConfig;

// Get a list of available platforms from the existing configuration
const activePlatforms = Object.keys(existingConfig);
Expand Down Expand Up @@ -209,7 +208,7 @@ class Config extends OiCommand {
});

// Save the updated configuration back to the global config file
await CommandHelper.writeConfigFileData(true, updatedConfig);
CommandHelper.writeConfigFileData(true, updatedConfig);
console.log(`Successfully updated the active platform to: ${selectedPlatform}`);
}

Expand Down Expand Up @@ -246,7 +245,7 @@ class Config extends OiCommand {

// Check if a global config file already exists, if not initialize an empty config
const existingConfig = CommandHelper.configExists(true)
? await CommandHelper.readConfigFileData(true)
? CommandHelper.readConfigFileData(true)
: {};

// Merge the new platform configuration with the existing config
Expand All @@ -259,7 +258,7 @@ class Config extends OiCommand {
};

// Save the updated global configuration
await CommandHelper.writeConfigFileData(true, updatedConfig);
CommandHelper.writeConfigFileData(true, updatedConfig);

console.log('Run `overide config global -a | --set-active` to select active platform');
}
Expand All @@ -285,7 +284,7 @@ class Config extends OiCommand {
}

// Read the local configuration
const config: LocalConfig = (await CommandHelper.readConfigFileData()) as LocalConfig;
const config: LocalConfig = CommandHelper.readConfigFileData() as LocalConfig;

// Update the list of ignored files if provided in options
if (options.ignore) {
Expand Down Expand Up @@ -315,7 +314,7 @@ class Config extends OiCommand {
}

// Save the updated local configuration
await CommandHelper.writeConfigFileData(false, config);
CommandHelper.writeConfigFileData(false, config);
console.log('Local config updated successfully.');
}
}
Expand Down
14 changes: 4 additions & 10 deletions src/models/model.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ export interface GlobalConfig {
}

export interface GlobalPlatformInfo {
apiKey?: string; // Optional, as Ollama does not require an API key
baseUrl?: string; // Optional, as not all platforms may have a baseUrl
orgId?: string; // Optional, specific to platforms like OpenAI
apiKey?: string;
orgId?: string;
isActive: boolean;
}

Expand All @@ -21,16 +20,11 @@ export interface ActivePlatformDetails {
platformConfig: GlobalPlatformInfo;
}

export const supportedPlatforms = ['OpenAI', 'DeepSeek', 'Groq'];
export const supportedPlatforms = ['OpenAI'];

export const platformQuestions = {
openai: [
{ type: 'input', name: 'apiKey', message: 'Enter your API key:' },
{ type: 'input', name: 'orgId', message: 'Enter your Organization ID:' }
],
deepseek: [
{ type: 'input', name: 'apiKey', message: 'Enter your API key:' },
{ type: 'input', name: 'baseUrl', message: 'Enter the BaseUrl to use:' }
],
groq: [{ type: 'input', name: 'apiKey', message: 'Enter your Groq API key:' }]
]
};
17 changes: 1 addition & 16 deletions src/models/model.request.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ResponseFormatJSONSchema } from 'openai/resources';
import { ChatCompletionMessageParam as OpenAIChatCompletionMessageParam } from 'openai/resources/chat/completions';
import { ChatCompletionMessageParam as GroqChatCompletionMessageParam } from 'groq-sdk/resources/chat/completions';
import { ActivePlatformDetails } from './model.config';

export interface GeneralRequestObject {
platform: ActivePlatformDetails;
metadata: OpenAiRequestObject | DeepSeekRequestObject | GroqRequestObject;
metadata: OpenAiRequestObject;
}

export interface OpenAiRequestObject {
Expand All @@ -19,17 +18,3 @@ export interface OpenAiRequestObject {
frequency_penalty?: number;
response_format: ResponseFormatJSONSchema;
}

export interface DeepSeekRequestObject {
model: string;
messages: OpenAIChatCompletionMessageParam[];
}

export interface GroqRequestObject {
model: string;
messages: GroqChatCompletionMessageParam[];
temperature?: number;
max_tokens?: number;
top_p?: number;
stream?: boolean;
}
Loading