diff --git a/cli/setup.py b/cli/setup.py index 7b82b43..4fefa77 100644 --- a/cli/setup.py +++ b/cli/setup.py @@ -6,7 +6,7 @@ setup( name="magic-commit", - version="0.5.0", + version="0.5.1", packages=find_packages(), include_package_data=True, # This line is needed to include non-code files package_data={ diff --git a/vscode/magic-commit/README.md b/vscode/magic-commit/README.md index ceab8db..47b543e 100644 --- a/vscode/magic-commit/README.md +++ b/vscode/magic-commit/README.md @@ -1,65 +1,3 @@ -# magic-commit README +# Magic Commit! -This is the README for your extension "magic-commit". After writing up a brief description, we recommend including the following sections. - -## Features - -Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. - -For example if there is an image subfolder under your extension project workspace: - -\!\[feature X\]\(images/feature-x.png\) - -> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. - -## Requirements - -If you have any requirements or dependencies, add a section describing those and how to install and configure them. - -## Extension Settings - -Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. - -For example: - -This extension contributes the following settings: - -* `myExtension.enable`: Enable/disable this extension. -* `myExtension.thing`: Set to `blah` to do something. - -## Known Issues - -Calling out known issues can help limit users opening duplicate issues against your extension. - -## Release Notes - -Users appreciate release notes as you update your extension. - -### 1.0.0 - -Initial release of ... - -### 1.0.1 - -Fixed issue #. - -### 1.1.0 - -Added features X, Y, and Z. - ---- - -## Working with Markdown - -You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: - -* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux) -* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux) -* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets - -## For more information - -* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) -* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) - -**Enjoy!** +This is the VSCode directory for `magic-commit`. It contains the VSCode extension that allows you to run `magic-commit` from within VSCode. \ No newline at end of file diff --git a/vscode/magic-commit/extension.js b/vscode/magic-commit/extension.js index a90e106..137e7b1 100644 --- a/vscode/magic-commit/extension.js +++ b/vscode/magic-commit/extension.js @@ -1,6 +1,7 @@ // The module 'vscode' contains the VS Code extensibility API // Import the module and reference it with the alias vscode in your code below const vscode = require('vscode'); +const { exec } = require('child_process'); // This method is called when your extension is activated // Your extension is activated the very first time the command is executed @@ -9,22 +10,21 @@ const vscode = require('vscode'); * @param {vscode.ExtensionContext} context */ function activate(context) { - - // Use the console to output diagnostic information (console.log) and errors (console.error) - // This line of code will only be executed once when your extension is activated - console.log('Congratulations, your extension "magic-commit" is now active!'); - - // The command has been defined in the package.json file - // Now provide the implementation of the command with registerCommand - // The commandId parameter must match the command field in package.json - let disposable = vscode.commands.registerCommand('magic-commit.helloWorld', function () { - // The code you place here will be executed every time your command is executed - - // Display a message box to the user - vscode.window.showInformationMessage('Hello World from magic-commit!'); - }); - - context.subscriptions.push(disposable); + let disposable = vscode.commands.registerCommand('extension.magicCommit', () => { + // Assuming magic-commit is in the system PATH + exec('magic-commit --no-load', (error, stdout, stderr) => { + if (error) { + vscode.window.showErrorMessage(`Error: ${stderr}`); + return; + } + const gitInputBox = vscode.window.createInputBox(); + gitInputBox.value = stdout; + gitInputBox.placeholder = 'Commit message'; + gitInputBox.show(); + }); + }); + + context.subscriptions.push(disposable); } // This method is called when your extension is deactivated diff --git a/vscode/magic-commit/magic-commit-0.0.1.vsix b/vscode/magic-commit/magic-commit-0.0.1.vsix new file mode 100644 index 0000000..5efa3f5 Binary files /dev/null and b/vscode/magic-commit/magic-commit-0.0.1.vsix differ diff --git a/vscode/magic-commit/magic-commit-0.0.2.vsix b/vscode/magic-commit/magic-commit-0.0.2.vsix new file mode 100644 index 0000000..a24675b Binary files /dev/null and b/vscode/magic-commit/magic-commit-0.0.2.vsix differ diff --git a/vscode/magic-commit/magic-commit-0.0.3.vsix b/vscode/magic-commit/magic-commit-0.0.3.vsix new file mode 100644 index 0000000..2a696db Binary files /dev/null and b/vscode/magic-commit/magic-commit-0.0.3.vsix differ diff --git a/vscode/magic-commit/package.json b/vscode/magic-commit/package.json index 454fa3d..b67af16 100644 --- a/vscode/magic-commit/package.json +++ b/vscode/magic-commit/package.json @@ -2,20 +2,28 @@ "name": "magic-commit", "displayName": "magic-commit", "description": "Generate commit messages with AI", - "version": "0.0.1", + "version": "0.0.3", "engines": { "vscode": "^1.84.0" }, "categories": [ "Other" ], - "activationEvents": [], + "activationEvents": [ + "onView:git" + ], "main": "./extension.js", "contributes": { "commands": [{ - "command": "magic-commit.helloWorld", - "title": "Hello World" - }] + "command": "extension.magicCommit", + "title": "✨ 🍰" + }], + "menus": { + "scm/title": [{ + "command": "extension.magicCommit", + "group": "navigation" + }] + } }, "scripts": { "lint": "eslint .",