| author | Jesse Armand <jesse@jessearmand.com> | 2026-09-27 10:46:31 +0800 |
|---|---|---|
| committer | Jesse Armand <jesse@jessearmand.com> | 2026-09-27 10:46:31 +0800 |
| commit | 9ec69932279c8d709a6ccdb92a9cb9414cec3372 (patch) | |
| tree | 3c1c9febe8ceb4c0421401ac7df6add00888b219 | |
| parent | 62b9901de8af34c4cdce3b19a71ab57045d72aa6 (diff) | |
| download | dgit-9ec6993227.tar.gz zip | |
docs: add dgit-repo-management agent skill
Document repository management on a dgit host for coding agents:
push-to-create vs private-by-default, host/credential setup, the
dgit-repo CLI and its safety rails, raw HTTP admin fallbacks, and
operational gotchas. The canonical copy lives in .agents/skills;
.claude/skills is a symlink to it so both agent runtimes share one
source.
Diffstat
| .agents/skills/dgit-repo-management/SKILL.md (new) | +100 | -0 |
| .claude/skills (new) | +1 | -0 |
2 files changed, 101 insertions(+), 0 deletions(-)
diff --git a/.agents/skills/dgit-repo-management/SKILL.md b/.agents/skills/dgit-repo-management/SKILL.md @@ -0,0 +1,100 @@ +--- +name: dgit-repo-management +description: Manage git repositories on a dgit host (create, push, configure, inspect, gc, delete, list). Use when an agent needs to set up or administer repositories served by dgit / durable-git, whether through the dgit-repo CLI or the raw HTTP admin endpoints. +--- + +# Managing repositories on a dgit host + +dgit is a git server where each repository is a Cloudflare Durable Object. +Key behaviors that differ from GitHub-style hosts: + +- **Push-to-create.** Pushing to a name that does not exist creates the + repository — and it is **public** on arrival. +- **Private-by-default requires pre-registration.** To keep a repository + private from the first push, register it with `private: true` before + pushing (`dgit-repo create`, or a `PUT /<repo>/config`). +- **Reads of public repositories are open.** Pushes, admin operations, and + everything on a private repository require the token. + +## Setup + +The host and credentials come from the environment, not flags: + +1. Host: `$DGIT_HOST`, else `git config --global dgit.host <host>`. +2. Auth: a git credential helper must hold the token for + `https://<host>` (username is arbitrary; the password is the + `GIT_TOKEN`). Both `git push` and `dgit-repo` resolve credentials the + same way, via `git credential fill`. + +If neither is configured, report the blocker to the user — do not guess +hosts or tokens. + +## Preferred: the dgit-repo CLI + +`scripts/dgit-repo` in this repository wraps every admin endpoint. It +needs `bash`, `curl`, `jq`, and `git`. + +```sh +scripts/dgit-repo create NAME [--public] [-d DESC] [-s SECTION] [-o OWNER] +scripts/dgit-repo config NAME [--private|--public] [-d DESC] [-s SECTION] [-o OWNER] +scripts/dgit-repo show NAME +scripts/dgit-repo gc NAME +scripts/dgit-repo delete NAME [--yes] +scripts/dgit-repo list +``` + +Safety rails worth knowing (they surface as errors, not prompts): + +- `create` refuses a name that already exists; it cannot silently flip an + existing repository private-to-public or back. +- `config` refuses a name that does not exist, so a typo cannot create a + stray repository. +- `delete` asks to type the repository name unless `--yes` is passed. + Deletion is irreversible — never add `--yes` without an explicit user + request to delete. + +## Typical workflows + +New private repository, then first push: + +```sh +dgit-repo create myrepo -d "One-line description" -s tools +git remote add origin https://<host>/myrepo.git +git push -u origin main +``` + +New public repository: same, plus `--public`. + +Publish an already-pushed repository (it was created public by a push): + +```sh +dgit-repo config myrepo --private # or --public, -d, -s, -o +``` + +## Raw HTTP fallback + +Without the CLI, the same operations are plain authenticated HTTP +(-u x:$GIT_TOKEN; config bodies are JSON): + +```sh +curl -X PUT -u x:$GIT_TOKEN -H 'content-type: application/json' \ + -d '{"description":"...","section":"tools","private":true}' \ + https://<host>/myrepo/config +curl -X POST -u x:$GIT_TOKEN https://<host>/myrepo/gc +curl -X DELETE -u x:$GIT_TOKEN https://<host>/myrepo +curl -s https://<host>/api/repos # public index (no auth) +``` + +The JSON content API (`/<repo>/api/refs|log|commit|tree|blob|diff`) is +read-only and gated like the repository's pages; see `docs/api.md`. + +## Gotchas + +- A name must match `[A-Za-z0-9][A-Za-z0-9._-]*`; `api`, `info`, and a + few protocol paths are reserved. +- Failed authentications are rate-limited per IP (10 failures per + minute): after several 401s, wait instead of retrying in a loop. +- Unreachable objects are pruned automatically after forced updates and + ref deletions; `gc` is only needed manually after large rewrites. +- Repository metadata changes can lag a few seconds in per-isolate + caches; do not treat a stale index listing as a failed update. diff --git a/.claude/skills b/.claude/skills @@ -0,0 +1,1 @@ +../.agents/skills |