This is the source code for the bulk of PearAI's functionality.
- Get started
- Run the tests
- Run it locally
- Open a PR and add acknowledge your contribution
- Other Commands
Pre-requisite: you have installed [git][install-git], [node][install-node] and [yarn][install-yarn].
Windows users need use [wsl][install-wsl] for local development, otherwise you should have no issues.
- Fork the repository and create your branch from main.
- Clone your fork.
- Install dependencies in repository root:
yarn
- Build the extension in repository root:
yarn build-all
The project uses [TypeScript][typescript], [Vitest][vitest] for the tests and [Prettier][prettier] for the formatting.
You can run tests with pnpm test
To run them in watch mode, use: pnpm test-watch
.
The extension can be run in two ways:
Interally within the main PearAI application (which is a VSCode fork): https://github.com/trypear/pearai/
Externally as an extension: https://github.com/trypear/pearai-extension/
This guide is for running it externally. For running it internally, you will need to clone pearai and visit Contributing to pearai
You can use [VS Code's built-in debugger][vscode-debug-extension] on the project to try out your local extension.
To build the project, press F5
. It should run the run - app/vscode
task.
You can also use: command+shift+P
-> Debug: Select and Start Runnning
-> run - app/vscode
.
This will:
- Build the project
- Open a new "Extension Development Host" VS Code window, with your local code overriding your "PearAI" extension
It's handy to test your changes in integration with VS Code API.
- [VS Code Extension API documentation][vscode-extension-docs] is a good start
- [OpenAI API documentation][openai-docs] is also useful if you plan to change the prompts
Style formatting is managed by [Prettier][prettier]. It runs as a pre-commit hook, so you shouldn't have to worry about it.
You can open a Pull-Request at any time. It can even be a draft if you need to ask for guidance and help. Actually, we'd be pretty happy to assist you going in the best direction!
Once everything is ready, open a Pull-Request (if it's not already done) and ask for a review. We'll do our best to review it asap.
- You can find a brief introduction to the architecture of this extension [here][architecture-doc].
- Lint:
pnpm nx lint --skip-nx-cache
- Package:
pnpm nx run vscode:package