Nicolas Cantu 69ab265560 feat: initial RAG sync with .4nkaiignore (extension 0.3, server 0.2)
**Motivations:**
- Seed AnythingLLM workspace from cloned repo using gitignore-style filters

**Root causes:**
- N/A

**Correctifs:**
- N/A

**Evolutions:**
- Template 4nkaiignore.default; server copies after clone; extension uploads via POST /api/v1/document/upload
- New commands /workspace-sync; settings initialSync*; dependency ignore

**Pages affectées:**
- extensions/anythingllm-workspaces/*
- services/repos-devtools-server/*
- docs/features/initial-rag-sync-4nkaiignore.md
2026-03-24 22:36:37 +01:00

3.6 KiB
Raw Blame History

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, AnythingLLMs 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 workspacesGET /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 <url> Clone (branch test) → ensure workspace → initial RAG upload (if enabled) → open folder → browser.
/repos-load-sync <name> Open folder → ensure workspace → initial RAG upload → browser.
/workspace-sync <name> Resolve repo under REPOS_DEVTOOLS_ROOT → ensure workspace → initial RAG upload (no folder open).
/workspace-load <name> 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 Cursors model URL for /ollama/v1 separately.

Build

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