https://github.com/dmitriz/copilot-optimizer
Experimenting with GitHub Copilot Workspace to optimize developer workflow
https://github.com/dmitriz/copilot-optimizer
Last synced: 5 months ago
JSON representation
Experimenting with GitHub Copilot Workspace to optimize developer workflow
- Host: GitHub
- URL: https://github.com/dmitriz/copilot-optimizer
- Owner: dmitriz
- Created: 2025-05-09T05:12:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-03T14:41:03.000Z (about 1 year ago)
- Last Synced: 2025-09-01T18:48:11.217Z (10 months ago)
- Language: JavaScript
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Copilot Optimizer
## Overview
The Copilot Optimizer is a Visual Studio Code extension that integrates with GitHub Copilot Agent Mode to control the automatic approval of terminal commands. The extension registers a custom tool using the `vscode.languageModels.createTool` API to intercept terminal commands and evaluate whether they are safe to approve based on a whitelist of allowed patterns.
## Installation
1. Clone the repository:
```sh
git clone https://github.com/dmitriz/copilot-optimizer.git
```
2. Navigate to the extension directory:
```sh
cd copilot-optimizer
```
3. Install the dependencies:
```sh
npm install
```
4. Open the extension directory in Visual Studio Code:
```sh
code .
```
5. Press `F5` to start debugging the extension.
## Usage
To use the extension:
1. Activate the extension by running the "Copilot Optimizer" command from the Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
2. Open a terminal and start using GitHub Copilot Agent Mode
3. When Copilot suggests terminal commands, the extension will automatically:
- Approve commands that match the whitelist patterns
- Defer other commands for your manual review
You can verify the extension is working by checking the output panel for logs showing command evaluations.
## Configuration
The whitelist patterns are stored in a separate configuration file called `whitelist.js`. The file exports an array of allowed command patterns using glob-like patterns such as 'npm install *', 'mkdir*', etc.
### Example `whitelist.js`
```js
module.exports = [
'npm install *',
'mkdir *',
'git clone *',
//'rm -rf *', // VERY DANGEROUS - DO NOT UNCOMMENT UNLESS YOU KNOW WHAT YOU ARE DOING
'touch *',
'echo *',
'cp *',
'mv *',
'ls *',
'cat *'
];
```
You can modify the `whitelist.js` file to add or remove command patterns as needed.