**Motivations:** - Document user systemd and keep secrets out of git **Root causes:** - N/A **Correctifs:** - N/A **Evolutions:** - .env gitignored; systemd/user template and README **Pages affectées:** - services/repos-devtools-server/.gitignore - services/repos-devtools-server/README.md - services/repos-devtools-server/systemd/user/*
48 lines
1.7 KiB
Markdown
48 lines
1.7 KiB
Markdown
# repos-devtools-server
|
|
|
|
Local HTTP API bound to **`127.0.0.1`** for git operations under **`REPOS_DEVTOOLS_ROOT`** (default `/home/ncantu/code`).
|
|
|
|
## Environment
|
|
|
|
| Variable | Required | Description |
|
|
|----------|----------|-------------|
|
|
| `REPOS_DEVTOOLS_TOKEN` | yes | Shared secret; clients send `Authorization: Bearer <token>`. |
|
|
| `REPOS_DEVTOOLS_ROOT` | no | Absolute root for clones (default `/home/ncantu/code`). |
|
|
| `REPOS_DEVTOOLS_HOST` | no | Bind address (default `127.0.0.1`). |
|
|
| `REPOS_DEVTOOLS_PORT` | no | Port (default `37140`). |
|
|
|
|
## Endpoints
|
|
|
|
- `POST /repos-clone` — JSON `{ "url": "<git url>", "branch": "test" }` (`branch` optional, default `test`).
|
|
- `GET /repos-list` — Lists immediate subdirectories of the root that contain `.git`.
|
|
- `POST /repos-load` — JSON `{ "name": "<folder name>" }` — Verifies the repo exists; returns absolute `path`.
|
|
|
|
All endpoints require `Authorization: Bearer <REPOS_DEVTOOLS_TOKEN>`.
|
|
|
|
## Run
|
|
|
|
### One-off (foreground)
|
|
|
|
```bash
|
|
cd services/repos-devtools-server
|
|
npm install
|
|
npm run build
|
|
# Create .env (gitignored) with REPOS_DEVTOOLS_TOKEN=... and REPOS_DEVTOOLS_ROOT=/home/ncantu/code
|
|
set -a && source .env && set +a && node dist/server.js
|
|
```
|
|
|
|
### systemd (user)
|
|
|
|
Copy `systemd/user/repos-devtools-server.service` to `~/.config/systemd/user/`, create `.env` beside this README, then:
|
|
|
|
```bash
|
|
systemctl --user daemon-reload
|
|
systemctl --user enable --now repos-devtools-server.service
|
|
```
|
|
|
|
Use the same token in the VS Code / Cursor setting **`anythingllm.reposApiToken`**.
|
|
|
|
## Integration
|
|
|
|
The **AnythingLLM Workspaces** extension command **AnythingLLM: Dev tools panel** calls this API and the AnythingLLM HTTP API for workspace create/list.
|