# AnythingLLM Workspaces (VS Code / Cursor) AnythingLLM **developer API** (workspaces, documents), optional **repos-devtools-server**, **Dev tools** webview, and **initial RAG upload** after clone/load using **`.4nkaiignore`** (same syntax as `.gitignore`). ## Requirements - AnythingLLM with **API key** (**Settings → API Keys**). Do **not** use the nginx Bearer for `/ollama/` here. - **`repos-devtools-server`** on the host that owns clones (default `http://127.0.0.1:37140`). - For **document upload**, AnythingLLM’s **document processor (collector)** must be online; otherwise `POST /api/v1/document/upload` returns an error. ## Configuration | Key | Description | |-----|-------------| | `anythingllm.baseUrl` | AnythingLLM public URL (no trailing `/`). | | `anythingllm.apiKey` | API key. **User** settings. | | `anythingllm.reposApiBaseUrl` | repos-devtools-server URL. | | `anythingllm.reposApiToken` | Same as `REPOS_DEVTOOLS_TOKEN`. | | `anythingllm.initialSyncAfterClone` | Default **on**: after `/repos-clone-sync`, `/repos-load-sync`, and `/workspace-sync`, upload filtered files. Set to `false` to disable. | | `anythingllm.initialSyncMaxFiles` | Max files per run (default `400`). | | `anythingllm.initialSyncMaxFileBytes` | Max bytes per file (default `5242880`). | ## Commands (palette) - **AnythingLLM: List workspaces** — `GET /api/v1/workspaces`, open one in the browser. - **AnythingLLM: Open web UI** - **AnythingLLM: Dev tools panel** — webview for scripted commands. ## `.4nkaiignore` - **Template (reference):** `templates/4nkaiignore.default` in this extension (and the same file under `services/repos-devtools-server/templates/` for the clone server). - **At repo root:** the file must be named **`.4nkaiignore`**. - **After `git clone` via the server:** if `.4nkaiignore` is missing, the server copies the template into the new repo (`fourNkAiIgnoreTemplateWrote` in the JSON response). - **Before upload:** the extension creates `.4nkaiignore` from the bundled template only if it is still missing (e.g. repo cloned outside the server). Filtering uses the **`ignore`** package (gitignore semantics). The extension always applies baseline rules (e.g. `.git/`, `node_modules/`) in addition to `.4nkaiignore`. ## Dev tools — command lines | Line | Behaviour | |------|-----------| | `/repos-clone-sync ` | Clone (branch `test`) → ensure workspace → **initial RAG upload** (if enabled) → open folder → browser. | | `/repos-load-sync ` | Open folder → ensure workspace → **initial RAG upload** → browser. | | `/workspace-sync ` | Resolve repo under `REPOS_DEVTOOLS_ROOT` → ensure workspace → **initial RAG upload** (no folder open). | | `/workspace-load ` | Ensure workspace → browser only (no file upload). | | Other lines | See `help` in the panel. | Upload uses **`POST /api/v1/document/upload`** with multipart field **`file`** and **`addToWorkspaces`** set to the workspace **slug**. Relative paths are flattened to a safe single-segment filename (`dir__file.ts`) to reduce name collisions. **JSON field `workspaceCreatedByApi`:** `true` only if this run called `POST /api/v1/workspace/new`; `false` if the workspace already existed. ## Ollama Not used by this extension. Configure Cursor’s model URL for `/ollama/v1` separately. ## Build ```bash cd extensions/anythingllm-workspaces npm install npm run compile ``` ## References - AnythingLLM document API: `POST /v1/document/upload` under `/api` (Mintplex-Labs anything-llm `server/endpoints/api/document/index.js`). - Local server: `services/repos-devtools-server/README.md`. ## License MIT