-
Notifications
You must be signed in to change notification settings - Fork 24
Wigya/fix default doc page #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Fryingpannn
merged 2 commits into
trypear:main
from
amajewski505:wigya/fix-default-doc-page
Sep 9, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,75 @@ | ||
| --- | ||
| id: index | ||
| slug: / | ||
| title: ⚙️ Core Features | ||
| description: PearAI is the open-source AI code editor to speed up your development | ||
| keywords: [core-features, intro, pearai, continue, cursor, autopilot, chatgpt] | ||
| --- | ||
|
|
||
| This index page should automatically redirect to [/docs/core-features](./core-features.md) | ||
| # ⚙️ Core Features | ||
|
|
||
| - `CMD+I` - Inline code editing: PearAI will make changes to your current file and display diffs. | ||
|
|
||
| - `CMD+L` - New chat (if you have code selected, it also adds it to the chat). | ||
| - `CMD+SHIFT+L` - Append to current chat. | ||
|
|
||
| - **Address sign (@) commands** | ||
|
|
||
| - `@filename/foldername`, `@docs` - Add files, folders or documentation. You can also choose to add your own documentation links by scrolling all the way down and clicking “Add Docs”. | ||
| - Type `@codebase` to automatically retrieve the most relevant snippets from your codebase. Read more about indexing and retrieval here. You can also press `CMD/CTRL+ENTER` instead to directly use codebase context. | ||
| - Type `@code` to reference specific functions or classes from throughout your project. | ||
| - Type `@terminal` to reference the contents of your IDE's terminal. | ||
| - Type `@diff` to reference all of the changes you've made to your current branch. This is useful if you want to summarize what you've done or ask for a general review of your work before committing. | ||
| - Type `@problems` to reference problems in the current file. | ||
|
|
||
| - **Slash commands** | ||
|
|
||
| - `/commit` - Generates a commit message for all your current changes. | ||
| - `/cmd` - Generate a CLI command and paste it in the terminal directly. | ||
| - `/edit` - Bring code to your chat with `CMD+L` or `CMD+SHIFT+L` (`CTRL` for Windows), then add `/edit` with the changes you want to generate code with diffs. | ||
| - `/comment` - Works just like `/edit` but adds comments to your code | ||
| - `/test` - Works just like `/edit` but makes unit tests for highlighted or provided code. | ||
|
|
||
| Quick terminal debug: Use `CMD+SHIFT+R` to add the last terminal text to your chat. | ||
|
|
||
| - **Custom slash commands** | ||
|
|
||
| There are two primary ways to add custom slash commands: | ||
|
|
||
| 1. **Natural Language Prompts:** | ||
|
|
||
| You can add custom slash commands by adding to the customCommands property in config.json. | ||
|
|
||
| - `name`: Command name invoked with `/name`. | ||
| - `description`: Brief description shown in the dropdown menu. | ||
| - `prompt`: A templated prompt sent to the Language Learning Model (LLM). | ||
|
|
||
| Ideal for reusing prompts frequently. For example, creating a command to check code for mistakes with a predefined prompt. | ||
|
|
||
| 2. **Custom Functions:** | ||
|
|
||
| To create a custom function for slash commands, use `config.ts` instead of `config.json`. Push a new `SlashCommand` object to the `slashCommands` list, specifying the "name" (used to invoke the command), "description" (appears in the dropdown menu), and "run" (an async generator function that yields strings to be displayed in the UI). Allows for more advanced functionality, such as generating a commit message based on code changes, by writing custom TypeScript code. | ||
|
|
||
| ```ts title="~/.pearai/config.ts" | ||
| export function modifyConfig(config: Config): Config { | ||
| config.slashCommands?.push({ | ||
| name: "commit", | ||
| description: "Write a commit message", | ||
| run: async function* (sdk) { | ||
| const diff = await sdk.ide.getDiff(); | ||
| for await (const message of sdk.llm.streamComplete( | ||
| `${diff}\n\nWrite a commit message for the above changes. Use no more than 20 tokens to give a brief description in the imperative mood (e.g. 'Add feature' not 'Added feature'):`, | ||
| { | ||
| maxTokens: 20, | ||
| }, | ||
| )) { | ||
| yield message; | ||
| } | ||
| }, | ||
| }); | ||
| return config; | ||
| } | ||
| ``` | ||
|
|
||
| This flexibility enables you to create powerful and reusable custom commands tailored to your specific workflow needs. | ||
|
|
||
| If you'd also like to have tab autocomplete feature within PearAI, follow [this](https://trypear.ai/docs/tab-autocomplete). | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.