# LexAI for VS Code — Install & Deploy

## Installable package (already built)

| Item | Value |
| --- | --- |
| File | `packages/vscode/lexai-vscode-1.0.0.vsix` |
| Extension id | `JuanKibin.lexai-vscode` |
| Rebuild | from repo root: `npm run vscode:package` |

---

## A. Install on your machine (sideload)

### VS Code

1. Rebuild if needed: `npm run vscode:package` (repo root).
2. Open VS Code → **Extensions** (`Ctrl+Shift+X`).
3. `…` menu (top of Extensions) → **Install from VSIX…**
4. Pick `packages/vscode/lexai-vscode-1.0.0.vsix`.
5. Reload when prompted.
6. **LexAI: Open Settings** → set provider + API key.

### Cursor

Same flow: **Extensions → … → Install from VSIX…** → select the `.vsix`.

### CLI (optional)

```powershell
# VS Code
code --install-extension packages\vscode\lexai-vscode-1.0.0.vsix

# Cursor (if `cursor` CLI is on PATH)
cursor --install-extension packages\vscode\lexai-vscode-1.0.0.vsix
```

### Share with teammates

Send them the `.vsix` file (email, Drive, Slack, release artifact). They use **Install from VSIX…** — no Marketplace account required.

---

## B. Publish to the Visual Studio Marketplace (public)

So anyone can install via search: “LexAI”.

### 1. Create a publisher

1. Go to [https://marketplace.visualstudio.com/manage](https://marketplace.visualstudio.com/manage)  
   (sign in with a Microsoft account).
2. Create a **publisher** whose id matches `package.json` → `"publisher": "JuanKibin"`.  
   - The Marketplace publisher id must be exactly `JuanKibin` (case-sensitive).
3. Under the publisher, create a **Personal Access Token** (Azure DevOps):
   - Organization: all accessible / the one tied to Marketplace
   - Scopes: **Marketplace → Manage**
   - Copy the token once.

### 2. Login & publish

```powershell
cd packages\vscode
npx vsce login JuanKibin
# paste the PAT when prompted

npm run package
npx vsce publish
# or: npx vsce publish patch   # bumps 1.0.0 → 1.0.1 and publishes
```

`"private"` is `false` so Marketplace publish is allowed.

### 3. After publish

- Listing: `https://marketplace.visualstudio.com/items?itemName=JuanKibin.lexai-vscode`
- Users install from Extensions search, or:

```powershell
code --install-extension JuanKibin.lexai-vscode
```

### 4. Version bumps

Edit `version` in `packages/vscode/package.json` (or use `vsce publish patch|minor|major`), rebuild/package, publish again. Keep README/DEPLOY in sync with the version you ship.

---

## C. Optional: Open VSX (Cursor / VSCodium catalogs)

Some editors prefer [Open VSX](https://open-vsx.org/) instead of (or in addition to) the Microsoft Marketplace.

1. Create an account at [https://open-vsx.org](https://open-vsx.org).
2. Create an access token in your profile.
3. Publish:

```powershell
cd packages\vscode
npm run package
npx ovsx publish lexai-vscode-1.0.0.vsix -p <OPEN_VSX_TOKEN>
```

(`npx ovsx` uses the `ovsx` CLI; install once with `npm i -D ovsx` if you prefer.)

---

## D. Checklist before a public release

- [ ] Manual smoke: Code Assist + one writing action + API key in Secret Storage  
- [ ] `npm run vscode:typecheck` and `npm run vscode:package` succeed  
- [ ] Publisher id is yours and matches `package.json`  
- [ ] `"private": false` for Marketplace  
- [ ] Add `"repository"` URL in `package.json` when the repo is public (clears the vsce warning)  
- [ ] Confirm LICENSE is correct for your org  

---

## Quick reference

| Goal | Command / action |
| --- | --- |
| Build `.vsix` | `npm run vscode:package` (repo root) |
| Install locally | Extensions → Install from VSIX… |
| Publish Marketplace | `npx vsce login JuanKibin` then `npx vsce publish` |
| Publish Open VSX | `npx ovsx publish <file.vsix> -p <token>` |
