**Motivations:** - Clone or load repos under /home/ncantu/code with AnythingLLM workspace ensure/create from the editor **Root causes:** - N/A (new capability) **Correctifs:** - N/A **Evolutions:** - services/repos-devtools-server: POST /repos-clone, GET /repos-list, POST /repos-load (Bearer REPOS_DEVTOOLS_TOKEN) - Extension: Webview panel, slash commands, workspaceEnsure + POST /api/v1/workspace/new - Docs: feature note and index links **Pages affectées:** - services/repos-devtools-server/* - extensions/anythingllm-workspaces/* - docs/README.md - docs/features/repos-devtools-server-and-dev-panel.md - docs/features/anythingllm-vscode-extension.md
65 lines
3.6 KiB
Markdown
65 lines
3.6 KiB
Markdown
# AnythingLLM Workspaces (VS Code / Cursor extension)
|
||
|
||
Extension for the **AnythingLLM developer API**, optional **local repos API** (`repos-devtools-server`), and a **dev tools panel** for slash-style commands.
|
||
|
||
## Prerequisites
|
||
|
||
- AnythingLLM reachable at your public base URL (e.g. `https://ia.enso.4nkweb.com/anythingllm`).
|
||
- An **API key** created in AnythingLLM: **Settings → API Keys**.
|
||
|
||
**Do not** use the **nginx Bearer secret** for `/ollama/` (see `deploy/nginx/README-ia-enso.md`). That value is only for the Ollama reverse proxy. AnythingLLM validates API keys against its **own** database; a wrong secret yields `403` with `{"error":"No valid api key found."}`.
|
||
|
||
For **clone / repos-list / repos-load**, run **`services/repos-devtools-server`** on the host that owns the clone root (e.g. `192.168.1.164` with `REPOS_DEVTOOLS_ROOT=/home/ncantu/code`). The extension calls this API over HTTP (default `http://127.0.0.1:37140` when your editor runs on that same host or via port-forward).
|
||
|
||
## Configuration
|
||
|
||
| Setting | Description |
|
||
|--------|-------------|
|
||
| `anythingllm.baseUrl` | Base URL without trailing slash (default matches `deploy/nginx/README-ia-enso.md`). |
|
||
| `anythingllm.apiKey` | Secret from AnythingLLM **Settings → API Keys** (optional leading `Bearer ` is stripped). Use **User** settings. |
|
||
| `anythingllm.reposApiBaseUrl` | `repos-devtools-server` base URL (no trailing slash), default `http://127.0.0.1:37140`. |
|
||
| `anythingllm.reposApiToken` | Same value as `REPOS_DEVTOOLS_TOKEN` on the server. **User** settings. |
|
||
|
||
## Commands (palette)
|
||
|
||
- **AnythingLLM: List workspaces** — `GET /api/v1/workspaces`, then open the chosen workspace in the browser.
|
||
- **AnythingLLM: Open web UI** — Opens the AnythingLLM base URL.
|
||
- **AnythingLLM: Dev tools panel** — Webview: enter commands, **Run**, read JSON/text **Response**.
|
||
|
||
## Dev tools panel — command lines
|
||
|
||
One command per line:
|
||
|
||
| Line | Behaviour |
|
||
|------|-----------|
|
||
| `/repos-clone <git-url>` | `POST /repos-clone` — clone into `REPOS_DEVTOOLS_ROOT`, branch **`test`** (override with JSON only via API, not this line). |
|
||
| `/repos-clone-sync <url>` | Clone + ensure AnythingLLM workspace named like the repo folder + **Open folder** + open workspace in browser. |
|
||
| `repos-list` or `/repos-list` | `GET /repos-list` — cloned git directories under the root. |
|
||
| `/repos-load <name>` | Verify repo folder + **Open folder** in the editor. |
|
||
| `/repos-load-sync <name>` | Open folder + ensure workspace + browser. |
|
||
| `/workspace-load <name>` | Ensure workspace exists (`GET /workspaces` then `POST /workspace/new` if missing) + browser. |
|
||
| `help` | Short built-in help text. |
|
||
|
||
**Workspace matching:** name or slug must equal the folder/repo name you use (exact string match on `name` or `slug` from AnythingLLM). New workspaces are created with `POST /api/v1/workspace/new` and `{ "name": "<name>" }`.
|
||
|
||
**AnythingLLM “user”:** the developer API uses the **API key**; per-user workspace ownership follows AnythingLLM’s own multi-user rules — this extension does not impersonate a browser session.
|
||
|
||
## Ollama
|
||
|
||
This extension does not call Ollama. For `https://ia.enso.4nkweb.com/ollama/v1`, use Cursor model settings and the nginx Bearer (see `deploy/nginx/README-ia-enso.md`).
|
||
|
||
## Build
|
||
|
||
```bash
|
||
cd extensions/anythingllm-workspaces
|
||
npm install
|
||
npm run compile
|
||
```
|
||
|
||
Load the folder in VS Code / Cursor with **Run Extension** or install the packaged `.vsix` after `vsce package`.
|
||
|
||
## API reference
|
||
|
||
- AnythingLLM: `server/endpoints/api/workspace/index.js` (e.g. `GET /v1/workspaces`, `POST /v1/workspace/new` under `/api`).
|
||
- Local repos: `services/repos-devtools-server/README.md`.
|