diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 623615d..c2639a4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,12 +3,12 @@ name: CI # Triggers the workflow on all pushes or pull requests on any branch on: push: - branches: - - '**' + branches: + - "**" pull_request: - branches: - - '**' - + branches: + - "**" + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: build: @@ -16,7 +16,11 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-latest, ubuntu-latest,windows-latest] # Define the operating systems for the matrix + os: [ + macos-latest, + ubuntu-latest, + windows-latest, + ] # Define the operating systems for the matrix steps: # Checkout code @@ -36,7 +40,7 @@ jobs: - name: Run build run: npm run package - # Generate .vsix package for the extension + # Generate .vsix package for the extension - name: Generate .vsix package if: runner.os == 'Linux' run: | @@ -45,11 +49,11 @@ jobs: # Upload VSIX artifact - name: Upload VSIX artifact - if: runner.os == 'Linux' + if: runner.os == 'Linux' uses: actions/upload-artifact@v4 with: - name: vscode-granite-vsix-${{ runner.os }}-${{ github.run_id }} # Unique name with OS and run ID - path: "./vscode-granite-*.vsix" + name: vscode-paver-vsix-${{ runner.os }}-${{ github.run_id }} # Unique name with OS and run ID + path: "./vscode-paver-*.vsix" ## Run tests - name: Run Tests diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b421e97..edf695d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -62,7 +62,7 @@ jobs: - name: Set Up NodeJS uses: actions/setup-node@v4 with: - node-version: '20' + node-version: "20" # Run install dependencies - name: Install dependencies @@ -89,17 +89,17 @@ jobs: title: "${{ env.EXT_VERSION }}" draft: true files: | - vscode-granite-*.vsix + vscode-paver-*.vsix - name: Publish to VS Code Marketplace if: ${{ github.event_name == 'schedule' || inputs.publishToMarketPlace == 'true' || inputs.publishPreRelease == 'true' }} run: | - npx @vscode/vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-granite-${{ env.EXT_VERSION }}.vsix + npx @vscode/vsce publish -p ${{ secrets.VSCODE_MARKETPLACE_TOKEN }} --packagePath vscode-paver-${{ env.EXT_VERSION }}.vsix - name: Publish to OpenVSX Registry if: ${{ github.event_name == 'schedule' || inputs.publishToOVSX == 'true' || inputs.publishPreRelease == 'true' }} run: | - npx ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-granite-${{ env.EXT_VERSION }}.vsix + npx ovsx publish -p ${{ secrets.OVSX_MARKETPLACE_TOKEN }} --packagePath vscode-paver-${{ env.EXT_VERSION }}.vsix post-release-job: if: ${{ inputs.publishToMarketPlace == 'true' && inputs.publishToOVSX == 'true' && inputs.EXTENSION_TAG == 'main' }} @@ -111,11 +111,11 @@ jobs: - name: Set Up NodeJS uses: actions/setup-node@v4 with: - node-version: '20' + node-version: "20" - name: Upversion for Development run: | tag=`npm version --no-git-tag-version patch` git config --global user.email "redhat-developer-bot@users.noreply.github.com" git config --global user.name "redhat-developer-bot" git commit -am "Upversion to ${tag#v}" - git push origin \ No newline at end of file + git push origin diff --git a/.vscode/launch.json b/.vscode/launch.json index 673caa1..842c819 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -18,7 +18,7 @@ "preLaunchTask": "${defaultBuildTask}", "env": { "REDHAT_TELEMETRY_ENABLED": "true", - "GRANITE_EXT_DEV_MODE": "true" + "PAVER_EXT_DEV_MODE": "true" } }, { @@ -35,7 +35,7 @@ "env": { "REDHAT_TELEMETRY_ENABLED": "false", "MOCK_OLLAMA": "true", - "GRANITE_EXT_DEV_MODE": "true" + "PAVER_EXT_DEV_MODE": "true" } } ] diff --git a/.vscodeignore b/.vscodeignore index a85da67..8c513ef 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -12,6 +12,9 @@ out/test/** # Ignore source code src/** +# Ignore images from README, as the github repo images will be referenced instead +media/** + # Ignore all webview-ui files except the build directory webviews/src/** webviews/public/** @@ -35,4 +38,5 @@ esbuild.js node_modules/** out/** DCO -.github/** \ No newline at end of file +.github/** +releng/** \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c4bacc..de95c35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,10 @@ # Change Log -All notable changes to the "vscode-granite" extension will be documented in this file. +All notable changes to the `Paver` extension will be documented in this file. -Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file. +Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how +to structure this file. ## [Unreleased] -- Initial release \ No newline at end of file +- Initial release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fd570c0..ccc375d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,27 +1,36 @@ # How to Contribute -Contributions are essential for keeping this extension great. We try to keep it as easy as possible to contribute changes and we are open to suggestions for making it even easier. There are only a few guidelines that we need contributors to follow. +Contributions are essential for keeping this extension great. We try to keep it +as easy as possible to contribute changes and we are open to suggestions for +making it even easier. There are only a few guidelines that we need contributors +to follow. ## Development ### Installation Prerequisites: - * latest [Visual Studio Code](https://code.visualstudio.com/) - * [Node.js](https://nodejs.org/) v20.0.0 or higher - * optional: [gh](https://cli.github.com/) to manage pull requests. +- latest [Visual Studio Code](https://code.visualstudio.com/) +- [Node.js](https://nodejs.org/) v20.0.0 or higher +- optional: [gh](https://cli.github.com/) to manage pull requests. ### Steps + 1. Fork and clone this repository 2. Change to the directory: + ```bash - $ cd vscode-granite +$ cd vscode-paver ``` + 3. Install the NPM dependencies: + ```bash - $ npm run install:ci +$ npm run install:ci ``` -This will install the dependencies for the extension and its [webview(s)](https://code.visualstudio.com/api/extension-guides/webview) + +This will install the dependencies for the extension and its +[webview(s)](https://code.visualstudio.com/api/extension-guides/webview) 4. To run the extension, open the Debugging tab in VSCode. @@ -30,14 +39,15 @@ This will install the dependencies for the extension and its [webview(s)](https: ### Build the extension You can package the extension as a *.vsix archive: - ```bash - $ npx @vscode/vsce package - ``` -It will generate a vscode-granite-``.vsix +```bash +$ npx @vscode/vsce package +``` -You can then install it in VS Code by following these [instructions](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix). +It will generate a vscode-paver-``.vsix +You can then install it in VS Code by following these +[instructions](https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix). ## Contribute changes @@ -51,12 +61,13 @@ Try to follow this workflow to contribute changes: 6. Open a pull request with a detailed description of your changes With regards to git history, please: + - keep the git history linear, no merge commits. - ensure PRs are squashed before merging, to keep changes atomic. ### Certificate of Origin -By contributing to this project you agree to the Developer Certificate of -Origin (DCO). This document was created by the Linux Kernel community and is a -simple statement that you, as a contributor, have the legal right to make the -contribution. See the [DCO](DCO) file for details. \ No newline at end of file +By contributing to this project you agree to the Developer Certificate of Origin +(DCO). This document was created by the Linux Kernel community and is a simple +statement that you, as a contributor, have the legal right to make the +contribution. See the [DCO](DCO) file for details. diff --git a/README.md b/README.md index 87cc555..0d003c7 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,25 @@ -# Granite Code Assistant +# Paver -`Granite Code Assistant` simplifies the setup of the [Continue extension](https://marketplace.visualstudio.com/items?itemName=Continue.continue) to integrate [IBM](https://www.ibm.com/)'s [Granite code models](https://github.com/ibm-granite/granite-code-models), as your code assistant in Visual Studio Code, using [Ollama](https://ollama.com/) as the runtime environment. +`Paver` simplifies the setup of the +[Continue extension](https://marketplace.visualstudio.com/items?itemName=Continue.continue) +to integrate [IBM](https://www.ibm.com/)'s +[Granite code models](https://github.com/ibm-granite/granite-code-models), as +your code assistant in Visual Studio Code, using [Ollama](https://ollama.com/) +as the runtime environment. -By leveraging Granite code models and open-source components such as Ollama and Continue, you can write, generate, explain, or document code with full control over your data, ensuring it stays private and secure on your machine. +By leveraging Granite code models and open-source components such as Ollama and +Continue, you can write, generate, explain, or document code with full control +over your data, ensuring it stays private and secure on your machine. ## Getting Started -This project features an intuitive UI, designed to simplify the installation and management of Ollama and Granite Code models. The first time the extension starts, a setup wizard is automatically launched to guide you through the installation process. +This project features an intuitive UI, designed to simplify the installation and +management of Ollama and Granite Code models. The first time the extension +starts, a setup wizard is automatically launched to guide you through the +installation process. -You can later open the setup wizard anytime from the command palette by executing the *"Granite: Setup Granite Code as code assistant"* command. +You can later open the setup wizard anytime from the command palette by +executing the _"Paver: Setup Granite Code as code assistant"_ command. ### Installation Prerequisites @@ -18,51 +29,79 @@ You can later open the setup wizard anytime from the command palette by executin ### Step 1: Install the Extension -Open Visual Studio Code, navigate to the Extensions tab on the left sidebar, select "vscode-granite," and click "install." +Open Visual Studio Code, navigate to the Extensions tab on the left sidebar, +select "Paver," and click "install." -The [Continue.dev](https://continue.dev/) extension will be automatically added as a dependency, if not already installed. If you installed `Granite Code Assistant` manually, you may need to also install the Continue extension separately. +The [Continue.dev](https://continue.dev/) extension will be automatically added +as a dependency, if not already installed. If you installed `Paver` manually, +you may need to also install the Continue extension separately. ### Step 2: Install Ollama -Once the extension is running, the setup wizard will prompt you to install Ollama. +Once the extension is running, the setup wizard will prompt you to install +Ollama. The following Ollama installation options are available : -1. **Install with Homebrew:** If Homebrew is detected on your machine (Mac/Linux). +1. **Install with Homebrew:** If Homebrew is detected on your machine + (Mac/Linux). 2. **Install with Script:** Available on Linux. -3. **Install Manually:** Supported on all platforms. If you choose this option, you will be redirected to the official [Ollama download page](https://ollama.com/download) to complete the installation. +3. **Install automatically:** Available on Windows, will perform a silent + installation using sensible defaults. +4. **Install Manually:** Supported on all platforms. If you choose this option, + you will be redirected to the official + [Ollama download page](https://ollama.com/download) to complete the + installation. -Once Ollama is installed, the page will refresh automatically. Depending on the security settings of your plateform, you may need to start Ollama manually the first time. +Once Ollama is installed, the page will refresh automatically. Depending on the +security settings of your plateform, you may need to start Ollama manually the +first time. ![installollama](media/installollama.gif) ### Step 3: Install Granite Models -Select the Granite model(s) you wish to install and follow the on-screen instructions to complete the setup. +Select the Granite model(s) you wish to install and follow the on-screen +instructions to complete the setup. ![installmodels](media/installmodels.gif) -After the models are pulled into Ollama, Continue will be configured automatically to use them, and the Continue chat view will open, allowing you to interact with the models via the UI or tab completion. +After the models are pulled into Ollama, Continue will be configured +automatically to use them, and the Continue chat view will open, allowing you to +interact with the models via the UI or tab completion. ## About the Stack ### IBM Granite Code Models -The Granite Code models are optimized for enterprise software development workflows, performing well across various coding tasks (e.g., code generation, fixing, and explanation). They are versatile "all-around" code models. +The Granite Code models are optimized for enterprise software development +workflows, performing well across various coding tasks (e.g., code generation, +fixing, and explanation). They are versatile "all-around" code models. -Granite Code comes in various sizes to fit your workstation's resources. Generally, larger models yield better results but require more disk space, memory, and processing power. +Granite Code comes in various sizes to fit your workstation's resources. +Generally, larger models yield better results but require more disk space, +memory, and processing power. **Recommendation:** Use Model Size 8B for chat and 8B for tab code completion. -For more details, refer to [Granite Code Models](https://github.com/ibm-granite/granite-code-models). +For more details, refer to +[Granite Code Models](https://github.com/ibm-granite/granite-code-models). ### Ollama -Many corporations have privacy regulations that prohibit sending internal code or data to third-party services. Running LLMs locally allows you to sidestep these restrictions and ensures no sensitive information is sent to a remote service. Ollama is one of the simplest and most popular open-source solutions for running LLMs locally. +Many corporations have privacy regulations that prohibit sending internal code +or data to third-party services. Running LLMs locally allows you to sidestep +these restrictions and ensures no sensitive information is sent to a remote +service. Ollama is one of the simplest and most popular open-source solutions +for running LLMs locally. ### Continue.dev -[Continue](https://docs.continue.dev) is the leading open-source AI code assistant. You can connect any models and contexts to build custom autocomplete and chat experiences inside [VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension). +[Continue](https://docs.continue.dev) is the leading open-source AI code +assistant. You can connect any models and contexts to build custom autocomplete +and chat experiences inside +[VS Code](https://marketplace.visualstudio.com/items?itemName=Continue.continue) +and [JetBrains](https://plugins.jetbrains.com/plugin/22707-continue-extension). - Easily understand code sections - Tab to autocomplete code suggestions @@ -70,16 +109,26 @@ Many corporations have privacy regulations that prohibit sending internal code o - Ask questions about your codebase - Quickly use documentation as context -For more details, refer to [continue.dev](https://github.com/continuedev/continue). - +For more details, refer to +[continue.dev](https://github.com/continuedev/continue). ### How to Contribute to this Project? - - Please check our [Guidelines](https://github.com/redhat-developer/vscode-granite/blob/main/CONTRIBUTING.md) to contribute to our project. + +Please check our +[Guidelines](https://github.com/redhat-developer/vscode-paver/blob/main/CONTRIBUTING.md) +to contribute to our project. + ### License -This project is licensed under Apache 2.0. See [LICENSE](LICENSE) for more information. +This project is licensed under Apache 2.0. See [LICENSE](LICENSE) for more +information. ### Telemetry -With your approval, the vscode-granite extension collects anonymous [usage data](USAGE_DATA.md) and sends it to Red Hat servers to help improve our products and services. Read our [privacy statement](https://developers.redhat.com/article/tool-data-collection) to learn more. This extension respects the `redhat.telemetry.enabled` setting, which you can learn more about at [Red Hat Telemetry](https://github.com/redhat-developer/vscode-redhat-telemetry#how-to-disable-telemetry-reporting). \ No newline at end of file +With your approval, the Paver extension collects anonymous +[usage data](USAGE_DATA.md) and sends it to Red Hat servers to help improve our +products and services. Read our +[privacy statement](https://developers.redhat.com/article/tool-data-collection) +to learn more. This extension respects the `redhat.telemetry.enabled` setting, +which you can learn more about at +[Red Hat Telemetry](https://github.com/redhat-developer/vscode-redhat-telemetry#how-to-disable-telemetry-reporting). diff --git a/USAGE_DATA.md b/USAGE_DATA.md index c0600a2..ba4bf91 100644 --- a/USAGE_DATA.md +++ b/USAGE_DATA.md @@ -1,16 +1,18 @@ # Data collection -vscode-granite has opt-in telemetry collection, provided by [vscode-redhat-telemetry](https://github.com/redhat-developer/vscode-redhat-telemetry). +Paver has opt-in telemetry collection, provided by +[vscode-redhat-telemetry](https://github.com/redhat-developer/vscode-redhat-telemetry). -## What's included in the vscode-granite telemetry data +## What's included in the Paver telemetry data -Anonymous data is collected and sent to Red Hat servers to help improve our products and services, including: +Anonymous data is collected and sent to Red Hat servers to help improve our +products and services, including: - * Model Information from the Setup wizard: - * Chat model name - * Tab Completion model name - * Embeddings model name - * Error message in case of an error +- Model Information from the Setup wizard: + - Chat model name + - Tab Completion model name + - Embeddings model name +- Error message in case of an error ## What's included in the general telemetry data @@ -20,5 +22,9 @@ for information on what data it collects. ## How to opt in or out -Use the `redhat.telemetry.enabled` setting in order to enable or disable telemetry collection. -Note that this extension abides by Visual Studio Code's telemetry level: if `telemetry.telemetryLevel` is set to off, then no telemetry events will be sent to Red Hat, even if `redhat.telemetry.enabled` is set to true. If `telemetry.telemetryLevel` is set to `error` or `crash`, only events containing an error or errors property will be sent to Red Hat. \ No newline at end of file +Use the `redhat.telemetry.enabled` setting in order to enable or disable +telemetry collection. Note that this extension abides by Visual Studio Code's +telemetry level: if `telemetry.telemetryLevel` is set to off, then no telemetry +events will be sent to Red Hat, even if `redhat.telemetry.enabled` is set to +true. If `telemetry.telemetryLevel` is set to `error` or `crash`, only events +containing an error or errors property will be sent to Red Hat. diff --git a/media/installmodels.gif b/media/installmodels.gif index e661245..dc2e3b2 100644 Binary files a/media/installmodels.gif and b/media/installmodels.gif differ diff --git a/media/installollama.gif b/media/installollama.gif index 5ac52d7..727f09c 100644 Binary files a/media/installollama.gif and b/media/installollama.gif differ diff --git a/package-lock.json b/package-lock.json index 01fe255..7f979d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "vscode-granite", + "name": "vscode-paver", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "vscode-granite", + "name": "vscode-paver", "version": "0.1.0", "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 7516529..dc5ca17 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "vscode-granite", - "displayName": "Granite Code Assistant", + "name": "vscode-paver", + "displayName": "Paver", "description": "Use IBM Granite Code LLM as your Code Assistant", "publisher": "redhat", "version": "0.1.0", @@ -10,7 +10,7 @@ "vscode": "^1.88.0" }, "repository": { - "url": "https://github.com/redhat-developer/vscode-granite" + "url": "https://github.com/redhat-developer/vscode-paver" }, "main": "./dist/extension.js", "categories": [ @@ -40,8 +40,8 @@ }, "commands": [ { - "command": "vscode-granite.setup", - "category": "Granite", + "command": "paver.setup", + "category": "Paver", "title": "Setup Granite Code as code assistant" } ] diff --git a/src/commons/constants.ts b/src/commons/constants.ts index 68e299e..291eec1 100644 --- a/src/commons/constants.ts +++ b/src/commons/constants.ts @@ -1,4 +1,4 @@ -export const EXTENSION_ID = 'redhat.vscode-granite'; -export const isDevMode = process.env.GRANITE_EXT_DEV_MODE === 'true'; +export const EXTENSION_ID = 'redhat.vscode-paver'; +export const isDevMode = process.env.PAVER_EXT_DEV_MODE === 'true'; export const DOWNLOADABLE_MODELS = ['nomic-embed-text:latest', 'granite-code:3b', 'granite-code:8b', 'granite-code:20b', 'granite-code:34b']; diff --git a/src/extension.ts b/src/extension.ts index b622b52..d0acd3e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -5,8 +5,8 @@ import { Telemetry } from "./telemetry"; export async function activate(context: ExtensionContext) { await Telemetry.initialize(context); - const setupGraniteCmd = commands.registerCommand("vscode-granite.setup", async () => { - await Telemetry.send("granite.commands.setup"); + const setupGraniteCmd = commands.registerCommand("paver.setup", async () => { + await Telemetry.send("paver.commands.setup"); SetupGranitePage.render(context); }); context.subscriptions.push(setupGraniteCmd); @@ -14,6 +14,6 @@ export async function activate(context: ExtensionContext) { if (!hasRunBefore || isDevMode) { await context.globalState.update('hasRunSetup', true); - return commands.executeCommand('vscode-granite.setup'); + return commands.executeCommand('paver.setup'); } } \ No newline at end of file diff --git a/src/panels/setupGranitePage.ts b/src/panels/setupGranitePage.ts index 3dc8f50..7e0f80a 100644 --- a/src/panels/setupGranitePage.ts +++ b/src/panels/setupGranitePage.ts @@ -349,7 +349,7 @@ export class SetupGranitePage { } await this.server.installModel(model, reportProgress); this.publishStatus(webview); - await Telemetry.send("granite.setup.model.install", { model }); + await Telemetry.send("paver.setup.model.install", { model }); } } @@ -360,7 +360,7 @@ export class SetupGranitePage { embeddingsModel ); console.log("Granite Code AI-Assistant setup complete"); - await Telemetry.send("granite.setup.success", { + await Telemetry.send("paver.setup.success", { chatModelId: chatModel ?? 'none', tabModelId: tabModel ?? 'none', embeddingsModelId: embeddingsModel ?? 'none', @@ -371,7 +371,7 @@ export class SetupGranitePage { return; } // Generic error handling for all errors - await Telemetry.send("granite.setup.error", { + await Telemetry.send("paver.setup.error", { error: error?.message ?? 'unknown error', chatModelId: chatModel ?? 'none', tabModelId: tabModel ?? 'none', diff --git a/src/telemetry/index.ts b/src/telemetry/index.ts index 34a6695..d083211 100644 --- a/src/telemetry/index.ts +++ b/src/telemetry/index.ts @@ -15,7 +15,9 @@ export namespace Telemetry { } export async function send(eventName: string, properties?: { [key: string]: any }): Promise { - console.log(`Sending event: ${eventName} with properties: ${JSON.stringify(properties)}`); + const props = properties ? `with properties: ${JSON.stringify(properties)}` : ''; + console.log(`Sending event: ${eventName} ${props}`); return await telemetryService?.send({ name: eventName, properties }); } + } diff --git a/webviews/src/App.tsx b/webviews/src/App.tsx index fc5b8dc..bc65684 100644 --- a/webviews/src/App.tsx +++ b/webviews/src/App.tsx @@ -198,8 +198,7 @@ function App() {

Run IBM Granite Code models effortlessly with - Ollama and - Continue. + Ollama and Continue. Granite will help you write, generate, explain or document code, while your data stays secure and private on your own machine.

@@ -277,7 +276,7 @@ function App() {

To reopen this wizard, open the command palette and run: -

Granite: Setup Granite Code as code assistant

. +

Paver: Setup Granite Code as code assistant

.