# Orchis Foundry A self-hosted code platform (git hosting, pull requests, per-user BYO-model supply-chain scanning). This instance: https://foundry.orchis.ai ## API - Base URL: https://foundry.orchis.ai/v1 - Auth: send `Authorization: Bearer orc_pat_…` (create a token in the UI under Developer settings → Tokens, or `POST /v1/me/tokens`). - Machine-readable spec: https://foundry.orchis.ai/v1/openapi.json (OpenAPI 3.1) ## LLM-friendly endpoints - `GET /v1/repos/{owner}/{repo}/pack?ref=&maxBytes=` — the whole repo as one markdown document, ready to paste into a model. - `GET /v1/repos/{owner}/{repo}/pulls/{num}/pack` — a pull request (description + commits + diff + comments) as one document. - `GET /v1/repos/{owner}/{repo}/tree?ref=&path=`, `/blob?path=`, `/raw?path=`, `/readme` — structured read access. ## Writing code - `POST /v1/repos/{owner}/{repo}/commits {branch, baseSha?, message, changes:[{path, content|delete}]}` commits edits (needs write access). - `GET /v1/repos/{owner}/{repo}/blame?ref=&path=` returns per-line authorship; `GET .../outline?ref=&path=` returns structural symbols. - AI-proposed changes go through a human gate: `POST .../proposals {title, patch}` then a reviewer accepts via `POST .../proposals/{id}/accept`. - `POST .../commits/draft-message` generates a Conventional-Commits message from a diff. ## Working with a PR - List: `GET /v1/repos/{owner}/{repo}/pulls?state=open` ; detail: `.../pulls/{num}` ; diff: `.../pulls/{num}/files`. - Open: `POST /v1/repos/{owner}/{repo}/pulls {title,head,base,body}`. - Comment / review / merge: `POST .../pulls/{num}/{comments,reviews,merge}`. - In-app model help (uses your configured model): `POST .../pulls/{num}/{summarize,explain,draft-description}`. ## Git - Clone/push over HTTPS: `git clone https://foundry.orchis.ai/{owner}/{repo}.git` (Basic auth: handle + PAT). - Or SSH on port 2222 with a registered key.