Files
LexAI/packages/vscode/README.md
john kevin asprec 2c00d2e431
Some checks failed
CI — Test & Build / Test & Build (pull_request) Has been cancelled
Preview — PR Build Check / PR Preview Build (pull_request) Has been cancelled
feat(cli): add initial CLI implementation with argument parsing and prompt handling
- Created package.json and package-lock.json for CLI package.
- Implemented argument parsing in args.ts to handle various flags and commands.
- Developed main CLI logic in cli.ts to execute commands and handle errors.
- Added configuration loading from a JSON file in config.ts, with environment variable support.
- Implemented prompt resolution and provider interaction in prompt.ts.
- Added usage documentation for the CLI.
- Configured TypeScript settings in tsconfig.json for the CLI package.
- Updated README in vscode package to reflect the new CLI functionality.
- Refactored root tsconfig.json to streamline project structure.
2026-08-13 19:19:42 +08:00

105 lines
4.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# LexAI for VS Code / Cursor
Part of the [LexAI monorepo](../../README.md) (`packages/vscode`). Twin of the [Chrome extension](../chrome/README.md) and [CLI Prompt Builder](../cli/README.md).
**Bring your own LLM key.** LexAI helps you write and work with code in VS Code / Cursor — no LexAI account, no subscription, no LexAI servers.
Select text or code → run an action or ask in **Code Assist****Accept** / **Regenerate** / **Discard** in the editor.
---
## Also available for Chrome
Use the same LexAI writing assistant on any webpage:
**[LexAI — AI Writing Assistant (Chrome Web Store)](https://chromewebstore.google.com/detail/bagpcheidbkfgijnnmolnkgagibbjfnk)**
On the web: select text → Fix / Rephrase / Shorten / Expand / Explain / Make Prompt → Replace or Copy. Same BYO-key idea as this VS Code extension.
---
## All features (VS Code / Cursor)
### Code Assist (workspace-aware)
- Select code → **Code Assist** → type what you want in an **inline prompt** above the selection (Copilot-style zone), then **Ask LexAI**.
- Examples: explain, refactor, add error handling, rewrite for clarity, review a function.
- LexAI gathers **workspace context**: selected code, surrounding lines, import/require targets, and symbol definitions from **other files** (via the language server).
- Result opens in the suggestion zone with Accept / Regenerate / Discard.
- Available from CodeLens, editor context menu, Command Palette, and the Activity Bar sidebar.
### Writing actions
| Action | What it does |
| --- | --- |
| **Fix Grammar** | Correct spelling, grammar, and punctuation |
| **Rephrase** | Make text clearer / more professional |
| **Shorten** | Cut fluff while keeping the message |
| **Expand** | Add detail, context, and supporting points |
| **Explain** | Break down complex text into plain language |
| **Make Prompt** | Turn a rough idea into a structured AI prompt |
### Prompt Builder (Make Prompt)
- Structural **patterns** (auto, zero-shot, role, few-shot, and more)
- **Persona** presets, including custom persona text
- Preferred **output format**
- Optional **model override** for Make Prompt only
- Adjust in Settings, or via **inline option chips** in the suggestion zone (click a chip to regenerate)
### Writing styles
Apply to Fix / Rephrase / Shorten / Expand / Explain:
**Default · Formal · Casual · Academic · Creative · Concise**
Change in Settings or via option chips in the suggestion zone.
### Where you can start an action
- **CodeLens** — select ≥10 characters; click **LexAI** on the first selected line to expand actions in place (Code Assist + writing actions)
- **Editor context menu** — right-click selection → **LexAI** submenu
- **Gutter / line-number context** — LexAI submenu when a selection is active
- **Command Palette** — `LexAI: Fix Grammar`, Rephrase, Shorten, Expand, Explain, Make Prompt, Code Assist, Show Actions, …
- **Activity Bar sidebar** — LexAI icon → Workspace panel: paste or type text, pick an action (including Code Assist), run, **Copy** or reuse as input; **Insert selection** pulls from the editor
- **Status bar** — **✓ LexAI** ready · **⟳ LexAI** processing · **⚠ LexAI** not ready (click opens Settings)
### Suggestion UI
- **In-editor zone** (default) — comment widget above the selection with Accept / Regenerate / Discard and option chips
- **Side panel** — optional suggestion panel
- Setting `lexai.suggestionUi`: `zone` | `panel` | `both`
- `lexai.previewBeforeReplace` — preview before replacing the selection (default on)
- `lexai.askOptionsBeforeGenerate` — optional Quick Picks for style / Prompt Builder before each run
### Settings & account-free setup
- **LexAI: Open Settings** — branded settings UI for provider, model, writing style, Prompt Builder, and API key
- **LexAI: Set API Key** / **Clear API Key**
- **LexAI: Show Configuration Status**
- Providers: **OpenAI · Anthropic · Groq · OpenRouter**
- API key stored in **VS Code Secret Storage** (not plain settings)
- Non-secret prefs use `lexai.*` settings
---
## Quick start
1. Install this extension (Marketplace, Open VSX, or **Install from VSIX**).
2. Command Palette → **LexAI: Open Settings** → provider, model, API key.
3. Select text or code → click **LexAI** on the line → pick an action or **Code Assist**.
4. Review in the suggestion zone → Accept to replace the selection (or Copy from the sidebar / panel).
Install / publish details: [DEPLOY.md](./DEPLOY.md).
---
## Privacy
- No LexAI backend and no LexAI telemetry.
- API key lives in the editors Secret Storage.
- Your text is sent only to the LLM provider you configure.
---
## Links
| | |
| --- | --- |
| **Chrome extension** | [Chrome Web Store](https://chromewebstore.google.com/detail/bagpcheidbkfgijnnmolnkgagibbjfnk) |
| **Source** | [LexAI repository](https://git.juankibin.space/kibin/LexAI) |
| **Publisher** | JuanKibin |