SPB Git

Repository Public

API_CONTRACT.md 25.9 KB 359 lines markdown

1# SPB Git API contract for the iOS client (server 3.3.0)23Status: design contract written from the audit of `spbgit` 3.2.0 (`src/api/v1.mjs`, `src/server.mjs`,4`src/lib/shield.mjs`, `src/git/repo.mjs`). Section 1 lists what exists and stays unchanged. Section 2 lists the5additions the iOS client needs; they are implemented in the `spbgit` repository (target version 3.3.0) and are6strictly additive: no existing route, field or status code changes, so the website and the `spbgit` CLI keep working.78Base URL: `https://git.spboucher.ai`. All JSON is UTF-8. Dates are ISO 8601 strings. Errors use the existing9envelope `{"error": {"code": "<snake_case>", "message": "<human text>"}}` with a coherent HTTP status.1011## 1. Existing routes (3.2.0, unchanged)1213| Route | Notes |14|---|---|15| `GET /healthz` | status, version, repos, shield mode, features |16| `GET /api/v1/repos` | `{repos: [Overview]}`, every repository, about 780 KB uncompressed for 286 repositories |17| `GET /api/v1/repos/:name` | one `Overview` |18| `GET /api/v1/repos/:name/languages` | `{languages, totalBytes}` |19| `GET /api/v1/repos/:name/commits?ref&page` | `{ref, sha, page, hasNext, commits: [CommitSummary]}` |20| `GET /api/v1/repos/:name/tree?ref&path` | one directory level, strong ETag |21| `GET /api/v1/repos/:name/releases` | tags with binary assets |22| `GET /api/v1/stats` | site totals, streaks |23| `GET /api/v1/search?q&scope&repo&limit` | scopes `all, repos, files, commits, branches, readmes` |24| `GET /raw/:repo/<ref>/<path>` | raw bytes, streamed |25| `GET /archive/:repo/<ref>.zip|.tar.gz` | snapshot archive, rate limited |26| `GET /feed.atom` | Atom feed of pushes |27| `POST /api/v1/repos`, `PATCH`/`DELETE /api/v1/repos/:name` | token required |28| `POST`/`GET /api/v1/tokens`, `DELETE /api/v1/tokens/:id` | token required |29| `PUT`/`DELETE /api/v1/repos/:name/releases/:tag/assets/:asset` | token required |30| `GET /api/v1/whoami` | token check |31| `GET`/`POST /api/v1/admin/shield` | token required |32| `GET /pass/challenge`, `POST /pass/redeem` | proof-of-work visitor pass (cookie `spb_pass`) |3334`Overview` fields: `name, description, topics[], homepage, pinned, created, research, researchDetected,35defaultBranch, head, stamp, empty, lastPush, commitCount, branchCount, tagCount, sizeBytes, languages[{name, bytes,36percent, color}], languageBytes, topLanguage, license, licensePath, spark{counts[26], max, total, path, area, lastX,37lastY}, cloneUrl, url, computedAt, cloneCount`.3839`CommitSummary` fields: `sha, shortSha, authorName, authorEmail, date, subject, body, filesChanged, additions,40deletions`.4142## 2. Additions (3.3.0)4344General rules for every new route:4546- Validation with zod; repository names through `isValidRepoName`, paths through `isValidTreePath`, refs resolved47  with `resolveRef` only. No user string ever reaches a shell: `execFile`/`spawn` with argument arrays, and `--`48  before paths. Reject refs or paths starting with `-`.49- Pagination: `page` (1-based) and `perPage` (default 30, max 100). Responses carry `page, perPage, hasNext` and,50  when cheap, `total`. Exception (as built): `GET /repos/:name/commits` keeps its 3.2.0 default of 40 per page and51  only returns `perPage` when the parameter is sent.52- Caching: `ETag` on every GET (strong when keyed by a commit SHA, weak otherwise) with `304` support;53  `Cache-Control: public, max-age=31536000, immutable` when the request pins a full SHA, `public, max-age=60`54  otherwise. Authenticated responses: `private, no-store`.55- Expensive results are computed server-side and cached with the existing `Cache` (`cache.remember`, validated by56  `refStamp`), never per request.57- Shield: new read routes are classified like their existing siblings (`deep`). As built: `readme`, `blob`,58  `blob/lines`, `commits/:sha`, `commits/:sha/diff`, `compare`, `graph`, per-repository `metrics` and59  `metrics/compare` are `deep`; `meta`, `openapi.json`, `collections`, `activity`, global `metrics`, `branches` and60  `tags` are `api` (never refused by the shield). A request carrying a valid token is61  exempt from the shield budgets. The iOS client solves the visitor-pass proof of work natively and sends the62  cookie, exactly like a browser.63- Body limit for JSON writes: 6 MiB. Per-route rate limits on writes (30/min) and on search (existing).6465### 2.1 Discovery6667`GET /api/v1/meta` →68`{name, version, apiVersion: 1, publicUrl, owner: {name, username}, features: {ai, research, codeSearch, writes,69push}, limits: {perPageMax, blobInlineBytes, blobLinesMax, diffLinesBudget, commitActionsMax, commitBytesMax},70shield: {mode, powBits}}`7172`GET /api/v1/openapi.json` → OpenAPI 3.1 document covering every `/api/v1` route (existing and new).7374`GET /.well-known/apple-app-site-association` (and `/apple-app-site-association`) → `application/json`:75`{"applinks": {"details": [{"appIDs": ["3YM54G49SN.ai.spboucher.git"], "components": [{"/": "/api/*",76"exclude": true}, {"/": "/assets/*", "exclude": true}, {"/": "/raw/*", "exclude": true}, {"/": "/archive/*",77"exclude": true}, {"/": "/releases/*", "exclude": true}, {"/": "/badge/*", "exclude": true}, {"/": "/og/*",78"exclude": true}, {"/": "/pass/*", "exclude": true}, {"/": "/about/*", "exclude": true}, {"/": "/*"}]}]},79"webcredentials": {"apps": ["3YM54G49SN.ai.spboucher.git"]}}`. Must be registered before `/:repo`, classified80`open` by the shield, no redirect, no auth.8182`GET /about/ios`, `GET /about/ios/privacy`, `GET /about/ios/support` → HTML pages (site layout) with the app83presentation, the privacy policy and the support information (English and French on the same page).8485### 2.2 Repository list8687`GET /api/v1/repos` gains optional query parameters; without any, the response is byte-compatible with 3.2.0.8889- `compact=1`: drops `spark.path`, `spark.area`, `spark.lastX`, `spark.lastY`, `stamp`.90- `q`, `language`, `topic`, `collection`, `sort` (`name|activity|created|size|commits`), `order` (`asc|desc`),91  `page`, `perPage`: server-side filtering; when `page` is present the response adds `page, perPage, hasNext,92  total`.93- Each overview gains `fileCount` (tracked files at HEAD), `releaseCount` (tags with at least one asset),94  `collections: [id]`.9596`GET /api/v1/collections` → `{collections: [{id, title: {en, fr}, symbol, count, repos: [name]}]}`.97Collections are derived from real metadata (topics, top language, name prefixes, research flag): `ios-apps,98macos-apps, ai, research, working-papers, quant-finance, infrastructure, maclustr, web-apps, orix, zyquo,99dev-tools`. Rules live in one module (`src/lib/collections.mjs`) and are documented on `/about/metrics`. A100collection with no repository is returned with `count: 0`.101102### 2.3 Repository content103104`GET /api/v1/repos/:name/readme?ref` → `{path, ref, sha, size, markdown, truncated}` (raw text; above 1 MiB the105first mebibyte is returned with `truncated: true`; `404 no_readme`).106107`GET /api/v1/repos/:name/blob?ref&path` →108`{repo, ref, sha, path, name, oid, size, mode, binary, mime, language, lineCount|null, inline: bool, content|null,109rawUrl, lastCommit: CommitSummary|null}` (`rawUrl` is pinned to the commit; `mode` is the git file mode). `content` (UTF-8 text) is present only when the blob is text and110`size <= limits.blobInlineBytes` (1 MiB). Otherwise `inline: false` and the client pages with:111112`GET /api/v1/repos/:name/blob/lines?ref&path&start&count` → `{sha, path, start, count, totalLines|null, eof,113lines: [string]}`. `start` is 1-based (default 1), `count <= limits.blobLinesMax` (2000, default 500); `count` in the114response is the number of lines returned and `totalLines` is known only when `eof` is true. Streams the blob and stops reading115as soon as the window is filled; lines longer than 4000 characters are cut with a trailing `…`. Refused116(`413 too_large`) above 64 MiB and for binary blobs (`415 binary`).117118`GET /raw/...` gains `Range` support (single range, `206`, `Accept-Ranges: bytes`) for media playback.119120`GET /api/v1/repos/:name/branches` → `{defaultBranch, branches: [{name, sha, date, subject, authorName, ahead,121behind, isDefault}]}` (ahead/behind against the default branch).122123`GET /api/v1/repos/:name/tags` → `{tags: [{name, sha, target, date, subject, annotated, taggerName|null,124message|null, assetCount}]}`. `sha` is the commit the tag leads to; `target` is the object the ref points at (the125tag object of an annotated tag, the commit otherwise).126127`GET /api/v1/repos/:name/commits` gains `perPage`, `path` (history of one file or directory), `author`, `since`,128`until`, `q` (message grep, fixed string, case-insensitive). Each `CommitSummary` gains `parents: [sha]`.129130`GET /api/v1/repos/:name/commits/:sha` →131`{...CommitSummary, committerName, committerEmail, commitDate, parents: [{sha, shortSha, subject}], refs:132[string], branches: [string] (branches containing the commit, max 20), stats: {files, additions, deletions},133files: [{path, oldPath|null, status: "added|modified|deleted|renamed|copied|typechange", additions, deletions,134binary}], filesTruncated}`. At most 3000 files are listed. Because `refs` and `branches` change with every push,135this response is cached 60 s even when `:sha` is a full id (weak ETag); the diff route below is immutable.136137`GET /api/v1/repos/:name/commits/:sha/diff?path&context&full` →138`{sha, base|null, truncated, lineBudget, files: [{path, oldPath, status, binary, additions, deletions,139truncated, hunks: [{header, oldStart, oldLines, newStart, newLines, lines: [{t: " |+|-", o: int|null, n:140int|null, s: string}]}]}]}`. First parent as base (root commit: empty tree). `path` restricts to one file;141`context` 0–20 (default 3); budget `limits.diffLinesBudget` (1500 lines) unless `full=1` (hard cap 20 000).142As built: when the budget is spent the stream stops, so the file being read has `truncated: true` (its143`additions`/`deletions` then count only the lines returned) and the files after it are absent; take the full file144list and exact counts from the commit route and ask for one file with `path`. A line may carry `noNewline: true`.145As observed by the iOS client on 3.3.0: with `path=<new path>` a renamed file comes back as `status: "added"` with146its whole content (git cannot pair a rename inside a path-restricted diff); the rename and its real counts are only147in the unrestricted diff (`full=1` when it is beyond the budget) and in the commit route. `/compare` returns no148hunks. `/releases` lists every tag, with `assets: []` for tags without files. In `/tags`, `sha` is the commit and149`target` the tag object of an annotated tag.150151`GET /api/v1/repos/:name/compare?base&head` → `{base, head, mergeBase, ahead, behind, commits: [CommitSummary]152(max 100), commitsTruncated, files: [...same as commit files], filesTruncated, stats}` (`files` is the change153from the merge base to `head`).154155`GET /api/v1/repos/:name/graph?limit&page` → `{commits: [{sha, shortSha, parents: [sha], subject, authorName,156date, refs: [{name, type: "branch|tag|head"}]}], hasNext, page, limit}` in `--date-order` over all branches and tags (limit157default 200, max 500). Lane layout is computed by the client.158159### 2.4 Metrics160161Every metric has a written definition, returned in `definitions` and listed on `/about/metrics`.162163`GET /api/v1/metrics` → global, cached (recomputed when any repository stamp changes, at most once per 5 min).164As built: between two rebuilds the previous aggregate is served; while the very first aggregate is being computed165(cache empty) the route answers `503 warming_up` with `Retry-After`, which the client must handle:166167```168{ computedAt, timezone: "America/Toronto",169  totals: { repos, commits, languages, activeDays, branches, tags, releases, sizeBytes, files, codeBytes,170            commitsToday, commitsThisWeek, commitsThisMonth, commitsThisYear,171            streak, longestStreak, bestDay: {date, commits} },172  daily:   [{date, commits}]            // every day from the first commit to today (zeros included)173  weekly:  [{week: "2026-W49", start, commits}],174  monthly: [{month: "2026-12", commits, additions, deletions, newRepos, activeRepos}],175  yearly:  [{year, commits}],176  weekday: [7 ints, Monday first], hour: [24 ints],     // author local time of each commit177  languages: [{name, color, bytes, percent, repos}],178  extensions: [{ext, files, bytes}] (top 40),179  repoGrowth: [{month, total}],          // cumulative repositories by creation month180  sizes: [{name, sizeBytes, codeBytes, files, commits}],   // every repository181  topRepos: {last30Days: [{name, commits}], last365Days: [...], allTime: [...]} (top 15),182  collections: [{id, repos, commits, commitsLast30Days}],183  research: [{month, commits, repos}],   // repositories in collections research + working-papers184  apple: [{month, commits, repos}],      // repositories in collections ios-apps + macos-apps185  definitions: {...} }186```187188Commits are counted on the default branch of each repository, merges included, deduplicated by SHA inside one189repository only. `sizeBytes` is the on-disk size of the bare repository (packed history); `codeBytes` is the sum190of blob sizes at HEAD classified as source by the language detector, excluding vendored, generated, binary and191build paths (`node_modules/`, `vendor/`, `Pods/`, `dist/`, `build/`, `.build/`, `DerivedData/`, lock files,192minified files, `*.pb.*`, images, archives, fonts, PDFs). The two are never mixed in one chart.193194`GET /api/v1/repos/:name/metrics` → per repository, cached by HEAD:195196```197{ head, computedAt, commits, authors: [{name, commits}], firstCommit, lastCommit,198  daily: [{date, commits}] (last 371 days), weekly (all time), monthly: [{month, commits, additions, deletions}],199  weekday[7], hour[24], files, codeBytes, sizeBytes, lines: {code, total, byLanguage: [{name, lines, files}]},200  extensions: [{ext, files, bytes}], languages, hotPaths: [{path, changes}], largestFiles: [{path, size}] }201```202203Line counts read text blobs at HEAD under 1 MiB each, capped at 20 000 files and 256 MiB read in total; when a cap204is hit the response says `lines.partial: true`. Vendored, generated and binary paths are not read (`lines.total`205excludes them too). The response also carries `timezone`, `lines.files`, `statsPartial` (true when the line206statistics of the history could not be computed in time: `additions`/`deletions` are then zero) and `definitions`.207208`GET /api/v1/metrics/compare?repos=a,b,c` (2 to 6 names) → `{repos: [{name, monthly, commits, codeBytes,209sizeBytes, files, languages, firstCommit, lastCommit}]}`.210211### 2.5 Activity212213`GET /api/v1/activity?page&perPage&repo&type&since&until&language&collection` →214`{events: [{id, type: "push|branch_created|branch_deleted|tag_created|tag_deleted|repo_created|release_asset",215repo, ref, refType, sha, commits, at, subject|null, authorName|null, readmeChanged: bool|null}], page, perPage,216hasNext}`. Source: `data/activity.jsonl` (5 800 push records today: `{repo, ref, refType, deleted, commits, sha,217at}`) read backwards in a bounded way, enriched with the head commit subject (cached). From 3.3.0 on, the218post-receive handler also records whether a ref was created and whether the push touched a README, and repo219creation and release uploads append their own events. Events for repositories that no longer exist are dropped.220As built: at most the last 8 MiB of the file are read per request (about 60 000 events); `release_asset` events221carry an extra `asset` field; `readmeChanged` is `null` for records written before 3.3.0, for tags and deletions.222223### 2.6 Search224225`GET /api/v1/search` gains:226227- `scope=code`: content search with `git grep -I -n -F` (or `-E` when `regex=1`, `-w` when `word=1`, `-i` unless228  `case=1`) at the default branch HEAD. With `repo`, one repository; without, repositories are searched in229  order of last push under a global budget (time 2.5 s, max 40 repositories per request, concurrency 4) and the230  response carries `partial: true` and `cursor` to continue. Results: `code: [{repo, ref, sha, path, line, column,231  preview, language}]`, limit 50, at most 5 matches per file; the response also has `searched` (repositories232  searched by this request). `scope=all` does not run a code search. An invalid regular expression answers233  `400 invalid_pattern`.234- `scope=tags`, and tags included in `all`.235- `lang=<Language>` filter for `repos`, `files`, `code`; `exact=1` for whole-string match on names.236- `suggest=1`: fast prefix suggestions `{suggestions: [{type, repo, text}], ready}` from the in-memory index only (no237  git process), for instant completion. `type` is `repo|topic|branch|tag|file`; `ready: false` means the index is238  still being built (first request after a start or a push) and the list may be empty: ask again.239- Every hit that points into a file carries `path` and `line` so the client can open the code viewer on it.240241### 2.7 Authentication and owner mode242243Tokens keep the `spbgit_<id>_<secret>` format. Records gain `scopes: [string]` and `expiresAt|null`. A record244without `scopes` (existing bootstrap token) is treated as `["*"]`. Scopes: `repo:write` (metadata, contents,245branches, tags, releases), `repo:admin` (create and delete repositories), `tokens` (list, create, revoke),246`admin` (audit log, shield, admin overview). An expired token answers `401 token_expired`; a missing scope247answers `403 insufficient_scope`.248249- `POST /api/v1/tokens` accepts `{label, scopes?, expiresInDays?}`; a token can only grant scopes its creator250  holds. Without `scopes` the new token inherits its creator's scopes.251- `GET /api/v1/tokens` lists `{id, label, created, lastUsed, scopes, expiresAt, current: bool}`.252- `GET /api/v1/whoami` adds `scopes, expiresAt, username`.253- `GET /api/v1/admin/overview` → `{version, uptimeSeconds, memory, cache, disk: {gitRootBytes, freeBytes}, shield,254  tokens: {count}, clones: {total, last30Days}, repos, trash: [{name, deletedAt}]}`.255- `GET /api/v1/admin/audit?page&perPage` → `{entries: [{at, tokenId, tokenLabel, ip, action, repo|null, detail}]}`256  from the new append-only `data/audit.jsonl`. Every authenticated write appends one entry (no secret, no file257  content). As built each entry also has `status` (HTTP status of the write, refused writes included) and the258  response has `page, perPage, hasNext`.259260### 2.8 Git writes (owner)261262All require a token with the listed scope, append an audit entry, bust the repository caches, append an263activity event and run the same bookkeeping as a push. They operate on the bare repository with plumbing264(`hash-object -w --stdin`, a temporary `GIT_INDEX_FILE`, `read-tree`, `update-index --cacheinfo`, `write-tree`,265`commit-tree`, `update-ref <ref> <new> <old>`), never a shell, never a working tree. `update-ref` is given the266expected old value, so a concurrent push makes the write fail instead of being overwritten.267268`POST /api/v1/repos/:name/commits` (`repo:write`) body:269270```271{ branch, expectedHead, message, author?: {name, email},272  actions: [{action: "create|update|delete|move", path, previousPath?, content?, contentBase64?,273             expectedOid?, executable?}] }274```275276- `expectedHead` is mandatory (`null` only for an empty repository). If the branch tip differs:277  `409 head_moved` with `{error, currentHead}`.278- `create` fails with `409 path_exists` if the path exists; `update`, `delete`, `move` fail with `404279  path_not_found` if it does not; `expectedOid` (blob id the editor loaded) mismatch gives `409 blob_changed`.280  Other refusals as built: `409 path_conflict` (a parent of the path is a file), `400 is_directory`,281  `400 no_changes` (the tree is unchanged), `400 unsupported_entry` (symbolic link or submodule),282  `404 branch_not_found`, `400 invalid_branch`, `400 invalid_path`, `413 too_large`. The first commit of an empty283  repository must target its default branch. `.gitmodules` cannot be written.284- Limits: 50 actions, 5 MiB of content in total, message 1 to 5 000 characters. Paths validated (no `..`, no285  leading `/`, no `.git` component, no control characters).286- Author and committer default to the configured owner. Response `201 {commit: CommitSummary, branch, previousHead}`.287288`POST /api/v1/repos/:name/branches` `{name, from}` (`repo:write`) → `201 {name, sha}`; `409 already_exists`;289`409 ref_conflict` when the name collides with an existing branch path (`a` versus `a/b`).290`DELETE /api/v1/repos/:name/branches/:branch?expectedSha=` (`repo:write`) → `200 {deleted, sha}`: refuses the291default branch (`400 default_branch`) and a moved tip (`409 head_moved`). `expectedSha` (full 40-character id) is292mandatory; the branch name may contain slashes, raw or encoded as `%2F`.293`POST /api/v1/repos/:name/tags` `{name, sha, message?}` (annotated when `message` is given) → `201 {name, sha,294target, annotated}`; `sha` is 4 to 40 hexadecimal characters.295`DELETE /api/v1/repos/:name/tags/:tag?expectedSha=` → `200 {deleted, sha, target}`; `expectedSha` is mandatory and296may be the commit the tag leads to or the tag object.297`DELETE /api/v1/repos/:name` keeps its behaviour (soft delete, 30 days in the trash) and additionally accepts298`X-Confirm-Name`; when the header is present and differs from `:name` the request is refused (`400299confirmation_mismatch`).300301As observed by the iOS client on 3.3.0 (owner routes, read from the server code and a local instance):302303- `POST /api/v1/tokens` answers `201 {token, id, label, created, lastUsed, scopes, expiresAt}`: the record304  with the secret next to it. `scopes` accepts `*`; `expiresInDays` is 1 to 3650. A token cannot grant a scope305  its creator lacks (`403 insufficient_scope`, message `cannot grant scopes the current token lacks: …`).306  `DELETE /api/v1/tokens/:id` answers `{revoked}`.307- `403 insufficient_scope` carries the scope in its message only (`This token lacks the scope repo:admin.`).308- `PATCH /api/v1/repos/:name` is strict (an unknown field, `name` included, is refused) and also accepts309  `defaultBranch` (`400 unknown_branch` when it does not exist). `POST /api/v1/repos` accepts `defaultBranch`310  (default `main`) and names matching `^[a-z0-9][a-z0-9._-]{0,63}$`; topics match `^[a-z0-9][a-z0-9-]{0,34}$`,311  at most 10; description at most 350 characters; homepage empty or a URL of at most 300 characters.312- `DELETE /api/v1/repos/:name` answers `{deleted, recoverable, note}`.313- `409 blob_changed` carries `path` and `currentOid`, and no `currentHead`. `409 head_moved` carries314  `currentHead` for commits, branch deletions and tag deletions.315- Audit entries: `detail` is a JSON object (`{branch, commit, actions, bytes, paths}` for a commit,316  `{refused: "<code>"}` for a refused Git write, `{}` otherwise), and a write refused before its handler ran is317  recorded with the route as action (`POST /api/v1/tokens`, status 403). The log has no server-side filter.318- `GET /api/v1/admin/overview`: `shield` is `{mode: normal|attack, forced: on|off|auto, since, powBits}`.319  `POST /api/v1/admin/shield {mode: on|off|auto}` answers the same object. The server evaluates its mode at320  most every five seconds: a switch made within a few seconds of another one is stored at once but reported321  later, so the client reads the overview again for a few seconds before it calls a switch unconfirmed.322  Both shield routes are open without a token to requests coming from the server's own machine, and a switch323  of the shield is not recorded in the audit log.324- Release assets: `PUT …/releases/:tag/assets/:asset` takes the raw bytes (`application/octet-stream`, up to325  4 GiB) and answers `201 {name, size, sha256, tag, url}`; `400 unknown_tag` when the tag does not exist; names326  match `^[A-Za-z0-9][A-Za-z0-9._-]{0,120}$`. `DELETE` answers `{deleted, tag}`.327- Public reads made right after a write are fresh on the server (its caches are busted by the write), but carry328  `Cache-Control: public, max-age=60`: a client with an HTTP cache must bypass it to read its own write.329330### 2.9 Push notifications (proprietary, optional)331332`POST /api/v1/devices` `{deviceToken, environment: "sandbox|production", repos: [name] | "*", locale}` → `201333{id}`; `DELETE /api/v1/devices/:deviceToken`. No account: the device token is the identity. Stored in334`data/devices.json` (token, environment, followed repositories, locale, dates; nothing else). `deviceToken` is 64335to 200 hexadecimal characters; `repos` holds at most 400 names; `DELETE` answers `200 {deleted: true}` whether or336not the token was registered; `503 registry_full` above 5000 devices. When `SPBGIT_APNS_KEY_FILE`,337`SPBGIT_APNS_KEY_ID`, `SPBGIT_APNS_TEAM_ID` are set, a push to a followed repository sends one APNs alert338(HTTP/2, ES256 JWT, topic `ai.spboucher.git`), coalesced per repository per minute; tokens rejected with `410`,339or with `400 BadDeviceToken` / `DeviceTokenNotForTopic`, are deleted. The payload carries `repo, ref, refType, sha`340next to `aps` (alert title = repository name, body localized in English or French, `thread-id` = repository). Without the key the routes answer `501 push_disabled` and `meta.features.push` is `false`; the app341then relies on background refresh and local notifications only.342343## 3. As observed by the offline and platform features (2026-12-02, server 3.3.0)344345- `/.well-known/apple-app-site-association` is live and matches section 2.1 byte for byte.346- `POST /api/v1/devices` and `DELETE /api/v1/devices/:token` answer `501 {"error":{"code":"push_disabled"}}`;347  `meta.features.push` is `false`. The client maps `501` to `APIError.unsupported` and stays on local notifications.348- `tree` has no recursive form: an offline download lists one directory per request. `tree` and `blob` pinned to a349  full SHA answer `Cache-Control: immutable` with a strong ETag, and `sha` equals the requested id.350- `blob.content` of a text file hashes to `blob.oid` as a git blob (`SHA-1("blob <size>\0" + content)`), and351  `size` is its UTF-8 byte count: that is the integrity check of offline copies.352- Web pages exist for `/:repo`, `tree`, `blob`, `commit/:sha`, `commits[/:ref]`, `branches`, `tags`, `releases`,353  `insights` and `/search?q=&repo=`. There is none for a file history, a diff alone, a comparison, the graph or a354  collection: the app addresses those with query parameters on the nearest page, which the website ignores355  (`commits/<ref>?path=`, `commit/<sha>?view=diff&path=`, `branches?base=&head=`, `commits?view=graph`,356  `/?collection=<id>`).357- Widgets read `/api/v1/metrics` (`totals.repos`, `commits`, `commitsToday`, `streak`, `longestStreak`, `daily`),358  `/api/v1/stats` as a fallback (no daily figure), `/api/v1/activity?perPage=1&type=push` and `/api/v1/repos/:name`.359
Files main
Menu

Theme