markdown · 21891 bytes Raw Blame History

Changelog

All notable changes to shithub are documented here. This project follows Keep a Changelog conventions and Semantic Versioning.

Pre-1.0 versioning: minor versions may break the API. The stability contract begins at v1.0.0; until then, expect changes between minor releases.

Unreleased

Added

  • REST API contract (S50 §0). GET /api/v1/meta returns the server's version stamp and a list of feature capability strings for client-side feature detection. Every /api/v1/* response now carries X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, and (when PAT-authenticated) X-OAuth-Scopes. The 403 scope-reject response also carries X-Accepted-OAuth-Scopes. Operators tune the API rate-limit budgets via ratelimit.api.authed_per_hour / ratelimit.api.anon_per_hour (defaults: 5000 / 60).
  • Pagination helper internal/web/handlers/api/apipage — emits canonical RFC 8288 Link headers (first/prev/next/last) with absolute URLs rooted at the configured public base URL.
  • REST: user emails (S50 §1). GET /api/v1/user/emails lists the authenticated user's emails. Optional ?verified=true|false filter. Scope: user:read.
  • REST: user SSH keys (S50 §1). GET/POST /api/v1/user/keys and GET/DELETE /api/v1/user/keys/{id} expose CRUD for git authentication keys. Signing keys are tracked separately by a new kind column on user_ssh_keys and remain on the HTML surface for now. Scopes: user:read for GETs, user:write for mutations.
  • Capabilities: user-emails, ssh-keys added to /api/v1/meta response.
  • REST: repos core (S50 §2). GET /api/v1/user/repos, GET /api/v1/users/{username}/repos, GET /api/v1/orgs/{org}/repos, GET /api/v1/repos/{owner}/{repo}, POST /api/v1/user/repos, POST /api/v1/orgs/{org}/repos, PATCH /api/v1/repos/{owner}/{repo} (description, has_issues, has_pulls, archived, visibility), and DELETE /api/v1/repos/{owner}/{repo} (soft-delete). Visibility-aware listing: a user's /users/{u}/repos shows private rows only to that user; an org's /orgs/{o}/repos shows private rows only to members. Single-repo GETs 404 for callers who can't see the row (no existence leak).
  • Capability: repos added to /api/v1/meta.
  • REST: issues + comments + lock (S50 §3). GET /api/v1/repos/{o}/{r}/issues (with ?state= filter and Link:-header pagination), GET /api/v1/repos/{o}/{r}/issues/{number}, POST /api/v1/repos/{o}/{r}/issues, PATCH /api/v1/repos/{o}/{r}/issues/{number} (title/body author-gated, state/state_reason policy-gated), GET / POST /api/v1/repos/{o}/{r}/issues/{number}/comments, PATCH / DELETE /api/v1/repos/{o}/{r}/issues/comments/{cid}, PUT / DELETE /api/v1/repos/{o}/{r}/issues/{number}/lock.
  • REST: repo labels (S50 §3). GET / POST /api/v1/repos/{o}/{r}/labels and GET / PATCH / DELETE /api/v1/repos/{o}/{r}/labels/{name}.
  • Capabilities: issues, labels added to /api/v1/meta.
  • REST: milestones + assignees (S50 §3 follow-up). Full CRUD for /api/v1/repos/{o}/{r}/milestones (with ?state= filter on list and live open_issues/closed_issues counters on every response), plus GET /api/v1/repos/{o}/{r}/assignees (repo owner + collaborators eligible for issue assignment). Scope: repo:read on GETs, repo:write on mutations. Mutations gate on ActionIssueLabel.
  • Issue PATCH extensions. PATCH /api/v1/repos/{o}/{r}/issues/{n} now accepts labels, assignees, and milestone fields with GitHub-style full-replace semantics. Each gates on its own policy action (ActionIssueLabel / ActionIssueAssign) so a caller missing one capability gets a clean 403 rather than a partial update. Unknown label names or assignee usernames → 422; cross-repo milestone ids → 422.
  • Capabilities: milestones, assignees added to /api/v1/meta.
  • Reach: internal/web/handlers/api.resolveAPIRepo now resolves both user-owner and org-owner repos — check-runs and every later batch implicitly gain org-repo support.

Added (internal)

  • REST: pull requests core (S50 §4). GET /api/v1/repos/{o}/{r}/pulls with ?state= and ?draft= filters, GET /api/v1/repos/{o}/{r}/pulls/{number}, POST /api/v1/repos/{o}/{r}/pulls, PATCH /api/v1/repos/{o}/{r}/pulls/{number} (title/body author-gated, state via ActionPullClose, draft→ready author-only), GET /api/v1/repos/{o}/{r}/pulls/{number}/commits, GET /api/v1/repos/{o}/{r}/pulls/{number}/files, PUT /api/v1/repos/{o}/{r}/pulls/{number}/merge (honoring the repo's default merge method and the optional sha head guard). Reviews + comments + reviewers + update-branch + auto-merge land in a follow-up.
  • Capability: pulls added to /api/v1/meta.
  • REST: PR reviews + inline comments + requested reviewers (S50 §4b). GET / POST /api/v1/repos/{o}/{r}/pulls/{number}/reviews (events APPROVE / REQUEST_CHANGES / COMMENT, with pending-draft attachment on submit), GET / POST /api/v1/repos/{o}/{r}/pulls/{number}/comments (inline review comments with file_path / side / position anchoring, pending drafts, in_reply_to_id threading), and GET / POST / DELETE /api/v1/repos/{o}/{r}/pulls/{number}/requested_reviewers (by user_id or username).
  • Capability: pr-reviews added to /api/v1/meta.
  • REST: search (S50 §5). GET /api/v1/search/repositories, GET /api/v1/search/issues?type=issue|pr, and GET /api/v1/search/code over the existing FTS corpus. Canonical gh-shaped envelope { total_count, incomplete_results, items } with Link: pagination. Anonymous callers allowed (visibility filter inside the search package narrows to public). ?q= honors the existing operator vocabulary (repo:, is:, state:, author:, phrase). The search/commits and search/users endpoints, plus the sort=/order= knobs, are deferred to follow-ups.
  • Capability: search added to /api/v1/meta.
  • REST: orgs (S50 §7). GET /api/v1/user/orgs (self), GET /api/v1/users/{username}/orgs (public; shithub has no hidden membership distinction in v1), GET /api/v1/orgs/{org} (single fetch; 404 for soft-deleted), GET /api/v1/orgs/{org}/members. Scope: user:read.
  • Capability: orgs added to /api/v1/meta.
  • REST: repo webhooks (S50 §8). Full CRUD over a repo's webhook subscriptions: GET/POST /api/v1/repos/{o}/{r}/hooks, GET/PATCH/DELETE /api/v1/repos/{o}/{r}/hooks/{id}. Deliveries read-side: GET /api/v1/repos/{o}/{r}/hooks/{id}/deliveries (paginated; Link: headers) and GET /api/v1/repos/{o}/{r}/hooks/{id}/deliveries/{did} (full transcript). POST .../deliveries/{did}/redeliver re-enqueues. Scope: repo:write; role floor: settings:general. Webhook secrets are write-only — set on create, rotated via PATCH's secret field, never echoed back. Create-time SSRF gate rejects loopback / private / disallowed-port targets so misconfigurations surface synchronously instead of as silent delivery failures.
  • Capability: webhooks added to /api/v1/meta.
  • REST: branches + tags (S50 §9). Read-only ref enumeration: GET /api/v1/repos/{o}/{r}/branches (paginated; each entry carries protected reflecting the longest-prefix match against the configured branch-protection rules, plus is_default), GET /api/v1/repos/{o}/{r}/branches/{name} (slashes in branch names accepted verbatim or URL-encoded), and GET /api/v1/repos/{o}/{r}/tags (paginated). Scope: repo:read. Empty / uninitialised repos return [] rather than 404.
  • Capabilities: branches, tags added to /api/v1/meta.
  • REST: repo collaborators (S50 §10). GET /api/v1/repos/{o}/{r}/collaborators (list), GET .../collaborators/{username} (204 membership probe), GET .../collaborators/{username}/permission (permission level — "none" when not a collaborator), PUT .../collaborators/{username} (add / upgrade, body {"role": "..."} accepting both shithub names and gh-style aliases pull/push), DELETE .../collaborators/{username} (remove). Scope: repo:read on GETs, repo:write on mutations; mutations layer ActionRepoAdmin on top. Refuses (422) to enrol the repo owner.
  • Capability: collaborators added to /api/v1/meta.
  • REST: commits (S50 §11). Read-only git history surface: GET /api/v1/repos/{o}/{r}/commits (paginated; honours ?sha=, ?path=, ?author=, ?since=, ?until=) and GET /api/v1/repos/{o}/{r}/commits/{sha} (full commit detail with committer/parents/tree + per-file status and additions/deletions, plus a rollup stats object). Backed by internal/repos/git.Log / git.GetCommit — the response stays in lock-step with the bare repository. Scope: repo:read. Empty repos return []; the single-commit GET accepts any unambiguous SHA prefix.
  • Capability: commits added to /api/v1/meta.
  • REST: repo contents (S50 §12). GET /api/v1/repos/{o}/{r}/contents/{path}[?ref=] returns either a directory listing (dirs first, then files alphabetically) or a single file with base64-encoded content, encoding, size, and a binary flag (UTF-8 validity check). Files over 1 MiB come back as truncated: true with empty content — clients fall through to the raw download path. Scope: repo:read. Empty /contents path returns the repo root.
  • Capability: contents added to /api/v1/meta.
  • REST: forks (S50 §13). GET /api/v1/repos/{o}/{r}/forks (paginated; per-row visibility filter so private forks of public repos only surface to authorized viewers) and POST /api/v1/repos/{o}/{r}/forks (fork into the authenticated user's namespace; optional name/visibility body). Reuses the existing internal/repos/fork orchestrator and enqueues the on-disk clone via the repo:fork_clone worker, so the response returns immediately with init_status: "init_pending". Org-target forks land in a follow-up.
  • Capability: forks added to /api/v1/meta.
  • REST: notifications (S50 §14). User-scoped inbox surface: GET /api/v1/notifications (defaults to unread only; ?all=true includes read; paginated with Link: headers), GET /api/v1/notifications/threads/{id} (single fetch with existence-leak-safe cross-user 404), PATCH /api/v1/notifications/threads/{id} (mark read/unread — empty body / unread:false → read; unread:true flips back), and PUT /api/v1/notifications (mark all read). Scopes: user:read on GETs, user:write on mutations. All routes are implicitly scoped to the authenticated user.
  • Capability: notifications added to /api/v1/meta.
  • REST: watching / subscriptions (S50 §15). Per-repo watch-level management mirroring GitHub's /repos/{o}/{r}/subscription shape: GET .../subscribers (paginated watcher list excluding ignore and suspended users), GET .../subscription (viewer's level + explicit flag distinguishing the implicit participating default from an explicit choice), PUT .../subscription (set all / participating / ignore), and DELETE .../subscription (revert to implicit). Reuses internal/social.SetWatch / UnsetWatch and socialdb.ListWatchersForRepo. Scope: repo:read on GETs, user:write on mutations.
  • Capability: watching added to /api/v1/meta.
  • REST: events / activity (S50 §16). Read-only activity feed over domain_events: GET /api/v1/repos/{o}/{r}/events (paginated; returns every event for the repo, gated by ActionRepoRead) and GET /api/v1/users/{username}/events (paginated; only public=true rows — matches gh, which never surfaces private-repo activity on a user feed). Scope: repo:read / user:read. Reuses the existing socialdb.ListEventsForRepo and socialdb.ListPublicEventsForActor queries.
  • Capability: events added to /api/v1/meta.
  • REST: followers / following (S50 §17). GET /api/v1/users/{username}/followers and GET /api/v1/users/{username}/following (both paginated; Link: headers), plus the authenticated-user-scoped GET /api/v1/user/following/{target} (204/404 membership probe matching gh), PUT /api/v1/user/following/{target} (follow), and DELETE (unfollow). Self-follow returns 422. Reuses internal/social.FollowUser / UnfollowUser so the follow rate-limit and followed_user domain event stay in one place. Org-follow variants remain on the HTML surface.
  • Capability: followers added to /api/v1/meta.
  • REST: actions workflow runs (S50 §18). Read-only access to the Actions run history: GET /api/v1/repos/{o}/{r}/actions/runs (paginated; filterable by workflow_file, head_ref, actor, event, status, conclusion), GET /api/v1/repos/{o}/{r}/actions/runs/{run_id} (single run; existence-leak-safe cross-repo 404), and GET /api/v1/repos/{o}/{r}/actions/runs/{run_id}/jobs (job-index-ordered jobs list with needs_jobs graph). Reuses the existing actionsdb.ListWorkflowRunsForRepo / GetWorkflowRunByID / ListJobsForRun queries. Scope: repo:read. Lifecycle controls (cancel / rerun / approve) remain on the actions-lifecycle routes; this surface is read-only.
  • Capability: actions-runs added to /api/v1/meta.
  • REST: stargazers + starred lists (S50 §19). GET /api/v1/repos/{owner}/{repo}/stargazers paginates the users who starred a repo (scope: repo:read); private-repo lists are gated by ActionRepoRead. GET /api/v1/users/{username}/starred paginates the repos a user has starred (scope: user:read); cross-user views post-filter private repos the caller can't see. Both endpoints emit standard Link: pagination headers and recency-sort by starred_at DESC. The S26 caller-self star routes (/api/v1/user/starred and /api/v1/user/starred/{o}/{r}) are unchanged.
  • Capability: stargazers added to /api/v1/meta.
  • REST: issue events / timeline (S50 §20). GET /api/v1/repos/{owner}/{repo}/issues/{number}/events returns the issue's recorded timeline (every closed / reopened / labeled / unlabeled / milestoned / demilestoned / locked / unlocked / referenced / merged / push event), with actor_username LEFT-joined and the raw event meta payload preserved verbatim. Paginated with the standard Link: headers, sorted oldest-first. Scope: repo:read.
  • Capability: issue-events added to /api/v1/meta.
  • Device-code login (S50 §1, RFC 8628). POST /login/device/code issues a fresh authorization grant for a non-browser client (CLI / TV / IoT). POST /login/oauth/access_token polls for the user's approval and, on success, mints a PAT bound to the requested scopes. The browser-facing verification page is served at GET /login/device (CSRF-protected). The matching CLI endpoints are CSRF-exempt. client_id is enforced against an allowlist (default: shithub-cli); requested scopes go through the standard pat.ValidScope filter so unknown scopes fail cleanly with invalid_scope. The minted PAT is disclosed exactly once — subsequent exchanges of the same device_code return invalid_grant even after successful approval. RFC 8628 §3.5 error semantics (authorization_pending, slow_down, access_denied, expired_token) are honored.
  • Capability: device-code added to /api/v1/meta.
  • REST: actions workflows + workflow_dispatch (S50 §13 part 1). GET /api/v1/repos/{o}/{r}/actions/workflows lists the workflows discovered in .shithub/workflows/ at the repo's default-branch HEAD (or ?ref=); GET .../workflows/{id_or_file} fetches a single workflow by basename, full path, or a deterministic 64-bit hash of the path. POST .../workflows/{file}/dispatches triggers workflow_dispatch with optional ref and a typed inputs map (choice / boolean / string with required/default enforcement, same semantics as the HTML "Run workflow" button). Workflow_dispatch input validation now lives in a shared internal/actions/dispatch package consumed by both the REST and HTML surfaces. Enable/disable knobs are deferred to a follow-up (needs a new workflow_disabled table); every listed workflow is reported as state: "active" for now.
  • Capability: actions-workflows added to /api/v1/meta.
  • REST: actions lifecycle + artifacts + job logs (S50 §13 part 2). New migration 0064_workflow_disabled adds a per-workflow disable knob; trigger.Enqueue now consults it and short-circuits matching events for disabled workflows. The list endpoint surfaces this as "state": "disabled". REST additions: PUT /api/v1/repos/{o}/{r}/actions/workflows/{file}/enable and .../disable, DELETE /api/v1/repos/{o}/{r}/actions/runs/{run_id} (cascades through jobs/steps/log-chunks/artifacts; object-store cleanup is async best-effort), GET /api/v1/repos/{o}/{r}/actions/runs/{run_id}/artifacts + GET .../actions/artifacts/{aid} + GET .../actions/artifacts/{aid}/zip (streams from object store) + DELETE .../actions/artifacts/{aid}, GET /api/v1/repos/{o}/{r}/actions/jobs/{job_id}/logs (assembled transcript with ##[group]/##[endgroup] step markers).
  • Capabilities: actions-artifacts, actions-job-logs added to /api/v1/meta.
  • REST: actions secrets + variables (S50 §13 part 3). New internal/auth/sealbox package owns the server's X25519 keypair and exposes NaCl SealedBox decode. Clients fetch the public key via GET /api/v1/repos/{o}/{r}/actions/secrets/public-key (and the org analog), encrypt the secret value with crypto_box_seal, and PUT the base64 ciphertext + key_id. Server validates key_id, decrypts in memory, then re-encrypts with the shared storage AEAD for at-rest persistence — plaintext never reaches postgres. Secrets CRUD: GET .../secrets, GET .../secrets/{name}, PUT .../secrets/{name}, DELETE .../secrets/{name}. Variables CRUD (plaintext, ${{ vars.NAME }} namespace): GET/POST .../variables, GET/PATCH/DELETE .../variables/{name}. Both surfaces have repo- and org-scoped variants. Operator setup: SHITHUB_ACTIONS__SECRETS__BOX_PRIVATE_KEY_B64 carries the X25519 private key (32 bytes base64); unset means auto-generated-per-process with a loud warning at startup, which is dev-only behavior.
  • Capabilities: actions-secrets, actions-variables added to /api/v1/meta.

Added (internal)

  • issues.Edit orchestrator wraps UpdateIssueTitleBody with markdown re-render + cross-reference re-indexing. Used by the new PATCH-issue endpoint; available for the HTML edit flow when it lands.

Changed

  • JSON error envelope on /api/v1/*. 401 and 403 responses now emit {"error": "..."} with Content-Type: application/json (previously text/plain). Existing 4xx/5xx responses from the handler bodies are unchanged.

0.1.0 — TBD (operator fills in cutover date)

The first public release of shithub. Pre-1.0: there is no backward-compatibility promise yet. Migrations are forward-only; schema may change between minor versions.

Initial public surface

  • Identity — signup, email verification, password reset, TOTP 2FA + recovery codes, SSH keys, scoped PATs, sessions with per-account epoch invalidation.
  • Repositories — create, fork, archive, transfer, soft-delete with grace, rename with redirects, visibility toggles, branch protection, default-branch swap, topics, README/license/ .gitignore templates.
  • Git — bare repos on disk; HTTPS smart-HTTP push/pull; pre/post-receive hook integration.
  • Code browsing — tree, blob (chroma syntax highlighting), raw, blame, commit history, individual commit views, branch/tag listings, compare views, file finder.
  • Issues + PRs — full CRUD; reviews; required-reviewer enforcement; status-check gates; three merge methods.
  • Social — stars, watches, forks, /explore, stargazer/ watcher lists.
  • Search — code, repo, user, issue.
  • Notifications — in-app inbox, email fan-out, one-click unsubscribe.
  • Orgs + teams — roles, invitations, one-level nesting, max-of-sources policy.
  • Webhooks — HMAC-signed delivery, exponential backoff, auto-disable, SSRF defense, redelivery UI.
  • Observability — structured logs, Prometheus metrics, optional OTel tracing, Sentry-protocol error reporting.
  • Operations — Ansible playbook, systemd units, Caddy edge, WireGuard mesh for monitoring, Postgres WAL archive + daily logical backups to Spaces, cross-region DR, restore drill.
  • Public landing page on / for anonymous viewers; signed-in viewers get a quick-link dashboard.
  • Lightweight status page at docs.<host>/status.html.
  • Cutover artifacts under deploy/cutover/.
  • Public docs site built with mdBook.
  • Operator runbooks for incidents, backups, restore, upgrade, rollback, rotate-secrets, rotate-keys, regenerate-akc, drain-workers, read-only-mode, day-one.
  • a11y tooling (pa11y + axe) and k6 load-test scenarios.
  • THIRD_PARTY_NOTICES.md with a CI-verified generator.

Known gaps at v0.1.0

  • SSH git transport (HTTPS only)
  • Actions / CI runner
  • Packages, Releases, Pages, Projects, Gists
  • GraphQL API (only a small REST surface today)
  • Activity feed UI

These are all on the post-MVP roadmap.

View source
1 # Changelog
2
3 All notable changes to shithub are documented here. This project
4 follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
5 conventions and [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
7 Pre-1.0 versioning: minor versions may break the API. The
8 stability contract begins at v1.0.0; until then, expect changes
9 between minor releases.
10
11 ## [Unreleased]
12
13 ### Added
14
15 - **REST API contract (S50 §0).** `GET /api/v1/meta` returns the
16 server's version stamp and a list of feature capability strings
17 for client-side feature detection. Every `/api/v1/*` response
18 now carries `X-RateLimit-Limit`, `X-RateLimit-Remaining`,
19 `X-RateLimit-Reset`, and (when PAT-authenticated) `X-OAuth-Scopes`.
20 The 403 scope-reject response also carries
21 `X-Accepted-OAuth-Scopes`. Operators tune the API rate-limit
22 budgets via `ratelimit.api.authed_per_hour` /
23 `ratelimit.api.anon_per_hour` (defaults: 5000 / 60).
24 - **Pagination helper** `internal/web/handlers/api/apipage`
25 emits canonical RFC 8288 Link headers (`first`/`prev`/`next`/`last`)
26 with absolute URLs rooted at the configured public base URL.
27 - **REST: user emails (S50 §1).** `GET /api/v1/user/emails` lists
28 the authenticated user's emails. Optional `?verified=true|false`
29 filter. Scope: `user:read`.
30 - **REST: user SSH keys (S50 §1).** `GET/POST /api/v1/user/keys`
31 and `GET/DELETE /api/v1/user/keys/{id}` expose CRUD for git
32 authentication keys. Signing keys are tracked separately by a
33 new `kind` column on `user_ssh_keys` and remain on the HTML
34 surface for now. Scopes: `user:read` for GETs, `user:write` for
35 mutations.
36 - **Capabilities:** `user-emails`, `ssh-keys` added to
37 `/api/v1/meta` response.
38 - **REST: repos core (S50 §2).**
39 `GET /api/v1/user/repos`, `GET /api/v1/users/{username}/repos`,
40 `GET /api/v1/orgs/{org}/repos`,
41 `GET /api/v1/repos/{owner}/{repo}`,
42 `POST /api/v1/user/repos`,
43 `POST /api/v1/orgs/{org}/repos`,
44 `PATCH /api/v1/repos/{owner}/{repo}` (description, has_issues,
45 has_pulls, archived, visibility), and
46 `DELETE /api/v1/repos/{owner}/{repo}` (soft-delete).
47 Visibility-aware listing: a user's `/users/{u}/repos` shows
48 private rows only to that user; an org's `/orgs/{o}/repos`
49 shows private rows only to members. Single-repo GETs `404`
50 for callers who can't see the row (no existence leak).
51 - **Capability:** `repos` added to `/api/v1/meta`.
52 - **REST: issues + comments + lock (S50 §3).**
53 `GET /api/v1/repos/{o}/{r}/issues` (with `?state=` filter and
54 `Link:`-header pagination),
55 `GET /api/v1/repos/{o}/{r}/issues/{number}`,
56 `POST /api/v1/repos/{o}/{r}/issues`,
57 `PATCH /api/v1/repos/{o}/{r}/issues/{number}` (title/body
58 author-gated, state/state_reason policy-gated),
59 `GET / POST /api/v1/repos/{o}/{r}/issues/{number}/comments`,
60 `PATCH / DELETE /api/v1/repos/{o}/{r}/issues/comments/{cid}`,
61 `PUT / DELETE /api/v1/repos/{o}/{r}/issues/{number}/lock`.
62 - **REST: repo labels (S50 §3).**
63 `GET / POST /api/v1/repos/{o}/{r}/labels` and
64 `GET / PATCH / DELETE /api/v1/repos/{o}/{r}/labels/{name}`.
65 - **Capabilities:** `issues`, `labels` added to `/api/v1/meta`.
66 - **REST: milestones + assignees (S50 §3 follow-up).** Full CRUD
67 for `/api/v1/repos/{o}/{r}/milestones` (with `?state=` filter
68 on list and live `open_issues`/`closed_issues` counters on
69 every response), plus `GET /api/v1/repos/{o}/{r}/assignees`
70 (repo owner + collaborators eligible for issue assignment).
71 Scope: `repo:read` on GETs, `repo:write` on mutations.
72 Mutations gate on `ActionIssueLabel`.
73 - **Issue PATCH extensions.** `PATCH /api/v1/repos/{o}/{r}/issues/{n}`
74 now accepts `labels`, `assignees`, and `milestone` fields with
75 GitHub-style full-replace semantics. Each gates on its own
76 policy action (`ActionIssueLabel` / `ActionIssueAssign`) so a
77 caller missing one capability gets a clean 403 rather than a
78 partial update. Unknown label names or assignee usernames →
79 422; cross-repo milestone ids → 422.
80 - **Capabilities:** `milestones`, `assignees` added to
81 `/api/v1/meta`.
82 - **Reach:** `internal/web/handlers/api.resolveAPIRepo` now
83 resolves both user-owner and org-owner repos — check-runs and
84 every later batch implicitly gain org-repo support.
85
86 ### Added (internal)
87
88 - **REST: pull requests core (S50 §4).**
89 `GET /api/v1/repos/{o}/{r}/pulls` with `?state=` and `?draft=`
90 filters,
91 `GET /api/v1/repos/{o}/{r}/pulls/{number}`,
92 `POST /api/v1/repos/{o}/{r}/pulls`,
93 `PATCH /api/v1/repos/{o}/{r}/pulls/{number}` (title/body
94 author-gated, state via `ActionPullClose`, draft→ready
95 author-only),
96 `GET /api/v1/repos/{o}/{r}/pulls/{number}/commits`,
97 `GET /api/v1/repos/{o}/{r}/pulls/{number}/files`,
98 `PUT /api/v1/repos/{o}/{r}/pulls/{number}/merge` (honoring
99 the repo's default merge method and the optional `sha`
100 head guard). Reviews + comments + reviewers + update-branch +
101 auto-merge land in a follow-up.
102 - **Capability:** `pulls` added to `/api/v1/meta`.
103 - **REST: PR reviews + inline comments + requested reviewers (S50 §4b).**
104 `GET / POST /api/v1/repos/{o}/{r}/pulls/{number}/reviews`
105 (events `APPROVE` / `REQUEST_CHANGES` / `COMMENT`, with
106 pending-draft attachment on submit),
107 `GET / POST /api/v1/repos/{o}/{r}/pulls/{number}/comments`
108 (inline review comments with file_path / side / position
109 anchoring, `pending` drafts, `in_reply_to_id` threading), and
110 `GET / POST / DELETE /api/v1/repos/{o}/{r}/pulls/{number}/requested_reviewers`
111 (by `user_id` or `username`).
112 - **Capability:** `pr-reviews` added to `/api/v1/meta`.
113 - **REST: search (S50 §5).** `GET /api/v1/search/repositories`,
114 `GET /api/v1/search/issues?type=issue|pr`, and
115 `GET /api/v1/search/code` over the existing FTS corpus.
116 Canonical gh-shaped envelope `{ total_count,
117 incomplete_results, items }` with `Link:` pagination.
118 Anonymous callers allowed (visibility filter inside the search
119 package narrows to public). `?q=` honors the existing operator
120 vocabulary (`repo:`, `is:`, `state:`, `author:`, phrase). The
121 `search/commits` and `search/users` endpoints, plus the
122 `sort=`/`order=` knobs, are deferred to follow-ups.
123 - **Capability:** `search` added to `/api/v1/meta`.
124 - **REST: orgs (S50 §7).** `GET /api/v1/user/orgs` (self),
125 `GET /api/v1/users/{username}/orgs` (public; shithub has no
126 hidden membership distinction in v1),
127 `GET /api/v1/orgs/{org}` (single fetch; 404 for soft-deleted),
128 `GET /api/v1/orgs/{org}/members`. Scope: `user:read`.
129 - **Capability:** `orgs` added to `/api/v1/meta`.
130 - **REST: repo webhooks (S50 §8).** Full CRUD over a repo's
131 webhook subscriptions: `GET/POST /api/v1/repos/{o}/{r}/hooks`,
132 `GET/PATCH/DELETE /api/v1/repos/{o}/{r}/hooks/{id}`. Deliveries
133 read-side: `GET /api/v1/repos/{o}/{r}/hooks/{id}/deliveries`
134 (paginated; `Link:` headers) and
135 `GET /api/v1/repos/{o}/{r}/hooks/{id}/deliveries/{did}` (full
136 transcript). `POST .../deliveries/{did}/redeliver` re-enqueues.
137 Scope: `repo:write`; role floor: settings:general. Webhook
138 secrets are write-only — set on create, rotated via PATCH's
139 `secret` field, never echoed back. Create-time SSRF gate
140 rejects loopback / private / disallowed-port targets so
141 misconfigurations surface synchronously instead of as silent
142 delivery failures.
143 - **Capability:** `webhooks` added to `/api/v1/meta`.
144 - **REST: branches + tags (S50 §9).** Read-only ref enumeration:
145 `GET /api/v1/repos/{o}/{r}/branches` (paginated; each entry
146 carries `protected` reflecting the longest-prefix match against
147 the configured branch-protection rules, plus `is_default`),
148 `GET /api/v1/repos/{o}/{r}/branches/{name}` (slashes in branch
149 names accepted verbatim or URL-encoded), and
150 `GET /api/v1/repos/{o}/{r}/tags` (paginated). Scope: `repo:read`.
151 Empty / uninitialised repos return `[]` rather than `404`.
152 - **Capabilities:** `branches`, `tags` added to `/api/v1/meta`.
153 - **REST: repo collaborators (S50 §10).**
154 `GET /api/v1/repos/{o}/{r}/collaborators` (list),
155 `GET .../collaborators/{username}` (204 membership probe),
156 `GET .../collaborators/{username}/permission` (permission
157 level — `"none"` when not a collaborator),
158 `PUT .../collaborators/{username}` (add / upgrade, body
159 `{"role": "..."}` accepting both shithub names and gh-style
160 aliases `pull`/`push`),
161 `DELETE .../collaborators/{username}` (remove). Scope:
162 `repo:read` on GETs, `repo:write` on mutations; mutations
163 layer `ActionRepoAdmin` on top. Refuses (422) to enrol the
164 repo owner.
165 - **Capability:** `collaborators` added to `/api/v1/meta`.
166 - **REST: commits (S50 §11).** Read-only git history surface:
167 `GET /api/v1/repos/{o}/{r}/commits` (paginated; honours
168 `?sha=`, `?path=`, `?author=`, `?since=`, `?until=`) and
169 `GET /api/v1/repos/{o}/{r}/commits/{sha}` (full commit detail
170 with committer/parents/tree + per-file `status` and
171 `additions`/`deletions`, plus a rollup `stats` object). Backed
172 by `internal/repos/git.Log` / `git.GetCommit` — the response
173 stays in lock-step with the bare repository. Scope:
174 `repo:read`. Empty repos return `[]`; the single-commit GET
175 accepts any unambiguous SHA prefix.
176 - **Capability:** `commits` added to `/api/v1/meta`.
177 - **REST: repo contents (S50 §12).**
178 `GET /api/v1/repos/{o}/{r}/contents/{path}[?ref=]` returns
179 either a directory listing (dirs first, then files
180 alphabetically) or a single file with base64-encoded
181 `content`, `encoding`, `size`, and a `binary` flag (UTF-8
182 validity check). Files over 1 MiB come back as
183 `truncated: true` with empty content — clients fall through
184 to the raw download path. Scope: `repo:read`. Empty `/contents`
185 path returns the repo root.
186 - **Capability:** `contents` added to `/api/v1/meta`.
187 - **REST: forks (S50 §13).**
188 `GET /api/v1/repos/{o}/{r}/forks` (paginated; per-row
189 visibility filter so private forks of public repos only
190 surface to authorized viewers) and
191 `POST /api/v1/repos/{o}/{r}/forks` (fork into the
192 authenticated user's namespace; optional `name`/`visibility`
193 body). Reuses the existing `internal/repos/fork` orchestrator
194 and enqueues the on-disk clone via the
195 `repo:fork_clone` worker, so the response returns
196 immediately with `init_status: "init_pending"`. Org-target
197 forks land in a follow-up.
198 - **Capability:** `forks` added to `/api/v1/meta`.
199 - **REST: notifications (S50 §14).** User-scoped inbox surface:
200 `GET /api/v1/notifications` (defaults to unread only;
201 `?all=true` includes read; paginated with `Link:` headers),
202 `GET /api/v1/notifications/threads/{id}` (single fetch with
203 existence-leak-safe cross-user 404),
204 `PATCH /api/v1/notifications/threads/{id}` (mark read/unread
205 — empty body / `unread:false` → read; `unread:true` flips
206 back), and `PUT /api/v1/notifications` (mark all read).
207 Scopes: `user:read` on GETs, `user:write` on mutations. All
208 routes are implicitly scoped to the authenticated user.
209 - **Capability:** `notifications` added to `/api/v1/meta`.
210 - **REST: watching / subscriptions (S50 §15).** Per-repo
211 watch-level management mirroring GitHub's
212 `/repos/{o}/{r}/subscription` shape:
213 `GET .../subscribers` (paginated watcher list excluding
214 `ignore` and suspended users), `GET .../subscription`
215 (viewer's level + `explicit` flag distinguishing the
216 implicit `participating` default from an explicit choice),
217 `PUT .../subscription` (set `all` / `participating` /
218 `ignore`), and `DELETE .../subscription` (revert to implicit).
219 Reuses `internal/social.SetWatch` / `UnsetWatch` and
220 `socialdb.ListWatchersForRepo`. Scope: `repo:read` on GETs,
221 `user:write` on mutations.
222 - **Capability:** `watching` added to `/api/v1/meta`.
223 - **REST: events / activity (S50 §16).** Read-only activity feed
224 over `domain_events`: `GET /api/v1/repos/{o}/{r}/events`
225 (paginated; returns every event for the repo, gated by
226 `ActionRepoRead`) and `GET /api/v1/users/{username}/events`
227 (paginated; only `public=true` rows — matches gh, which never
228 surfaces private-repo activity on a user feed). Scope:
229 `repo:read` / `user:read`. Reuses the existing
230 `socialdb.ListEventsForRepo` and
231 `socialdb.ListPublicEventsForActor` queries.
232 - **Capability:** `events` added to `/api/v1/meta`.
233 - **REST: followers / following (S50 §17).**
234 `GET /api/v1/users/{username}/followers` and
235 `GET /api/v1/users/{username}/following` (both paginated;
236 `Link:` headers), plus the authenticated-user-scoped
237 `GET /api/v1/user/following/{target}` (204/404 membership
238 probe matching gh), `PUT /api/v1/user/following/{target}`
239 (follow), and `DELETE` (unfollow). Self-follow returns 422.
240 Reuses `internal/social.FollowUser` / `UnfollowUser` so the
241 follow rate-limit and `followed_user` domain event stay in
242 one place. Org-follow variants remain on the HTML surface.
243 - **Capability:** `followers` added to `/api/v1/meta`.
244 - **REST: actions workflow runs (S50 §18).** Read-only access to
245 the Actions run history:
246 `GET /api/v1/repos/{o}/{r}/actions/runs` (paginated; filterable
247 by `workflow_file`, `head_ref`, `actor`, `event`, `status`,
248 `conclusion`),
249 `GET /api/v1/repos/{o}/{r}/actions/runs/{run_id}` (single
250 run; existence-leak-safe cross-repo 404), and
251 `GET /api/v1/repos/{o}/{r}/actions/runs/{run_id}/jobs`
252 (job-index-ordered jobs list with `needs_jobs` graph). Reuses
253 the existing `actionsdb.ListWorkflowRunsForRepo` /
254 `GetWorkflowRunByID` / `ListJobsForRun` queries. Scope:
255 `repo:read`. Lifecycle controls (cancel / rerun / approve)
256 remain on the actions-lifecycle routes; this surface is
257 read-only.
258 - **Capability:** `actions-runs` added to `/api/v1/meta`.
259 - **REST: stargazers + starred lists (S50 §19).**
260 `GET /api/v1/repos/{owner}/{repo}/stargazers` paginates the users
261 who starred a repo (scope: `repo:read`); private-repo lists are
262 gated by `ActionRepoRead`. `GET /api/v1/users/{username}/starred`
263 paginates the repos a user has starred (scope: `user:read`);
264 cross-user views post-filter private repos the caller can't see.
265 Both endpoints emit standard `Link:` pagination headers and
266 recency-sort by `starred_at DESC`. The S26 caller-self star
267 routes (`/api/v1/user/starred` and `/api/v1/user/starred/{o}/{r}`)
268 are unchanged.
269 - **Capability:** `stargazers` added to `/api/v1/meta`.
270 - **REST: issue events / timeline (S50 §20).**
271 `GET /api/v1/repos/{owner}/{repo}/issues/{number}/events` returns
272 the issue's recorded timeline (every `closed` / `reopened` /
273 `labeled` / `unlabeled` / `milestoned` / `demilestoned` /
274 `locked` / `unlocked` / `referenced` / merged / push event), with
275 `actor_username` LEFT-joined and the raw event `meta` payload
276 preserved verbatim. Paginated with the standard `Link:` headers,
277 sorted oldest-first. Scope: `repo:read`.
278 - **Capability:** `issue-events` added to `/api/v1/meta`.
279 - **Device-code login (S50 §1, RFC 8628).**
280 `POST /login/device/code` issues a fresh authorization grant for
281 a non-browser client (CLI / TV / IoT). `POST /login/oauth/access_token`
282 polls for the user's approval and, on success, mints a PAT bound
283 to the requested scopes. The browser-facing verification page is
284 served at `GET /login/device` (CSRF-protected). The matching CLI
285 endpoints are CSRF-exempt. `client_id` is enforced against an
286 allowlist (default: `shithub-cli`); requested scopes go through
287 the standard `pat.ValidScope` filter so unknown scopes fail
288 cleanly with `invalid_scope`. The minted PAT is disclosed exactly
289 once — subsequent exchanges of the same `device_code` return
290 `invalid_grant` even after successful approval. RFC 8628 §3.5
291 error semantics (`authorization_pending`, `slow_down`,
292 `access_denied`, `expired_token`) are honored.
293 - **Capability:** `device-code` added to `/api/v1/meta`.
294 - **REST: actions workflows + workflow_dispatch (S50 §13 part 1).**
295 `GET /api/v1/repos/{o}/{r}/actions/workflows` lists the workflows
296 discovered in `.shithub/workflows/` at the repo's default-branch
297 HEAD (or `?ref=`); `GET .../workflows/{id_or_file}` fetches a
298 single workflow by basename, full path, or a deterministic
299 64-bit hash of the path. `POST .../workflows/{file}/dispatches`
300 triggers `workflow_dispatch` with optional `ref` and a typed
301 `inputs` map (choice / boolean / string with required/default
302 enforcement, same semantics as the HTML "Run workflow" button).
303 Workflow_dispatch input validation now lives in a shared
304 `internal/actions/dispatch` package consumed by both the REST
305 and HTML surfaces. Enable/disable knobs are deferred to a
306 follow-up (needs a new `workflow_disabled` table); every listed
307 workflow is reported as `state: "active"` for now.
308 - **Capability:** `actions-workflows` added to `/api/v1/meta`.
309 - **REST: actions lifecycle + artifacts + job logs (S50 §13 part 2).**
310 New migration `0064_workflow_disabled` adds a per-workflow
311 disable knob; `trigger.Enqueue` now consults it and short-circuits
312 matching events for disabled workflows. The list endpoint surfaces
313 this as `"state": "disabled"`. REST additions:
314 `PUT /api/v1/repos/{o}/{r}/actions/workflows/{file}/enable` and
315 `.../disable`,
316 `DELETE /api/v1/repos/{o}/{r}/actions/runs/{run_id}` (cascades
317 through jobs/steps/log-chunks/artifacts; object-store cleanup is
318 async best-effort),
319 `GET /api/v1/repos/{o}/{r}/actions/runs/{run_id}/artifacts` +
320 `GET .../actions/artifacts/{aid}` +
321 `GET .../actions/artifacts/{aid}/zip` (streams from object store) +
322 `DELETE .../actions/artifacts/{aid}`,
323 `GET /api/v1/repos/{o}/{r}/actions/jobs/{job_id}/logs` (assembled
324 transcript with `##[group]`/`##[endgroup]` step markers).
325 - **Capabilities:** `actions-artifacts`, `actions-job-logs` added to
326 `/api/v1/meta`.
327 - **REST: actions secrets + variables (S50 §13 part 3).**
328 New `internal/auth/sealbox` package owns the server's X25519
329 keypair and exposes NaCl `SealedBox` decode. Clients fetch the
330 public key via
331 `GET /api/v1/repos/{o}/{r}/actions/secrets/public-key` (and the
332 org analog), encrypt the secret value with `crypto_box_seal`, and
333 PUT the base64 ciphertext + key_id. Server validates key_id,
334 decrypts in memory, then re-encrypts with the shared storage
335 AEAD for at-rest persistence — plaintext never reaches postgres.
336 Secrets CRUD: `GET .../secrets`, `GET .../secrets/{name}`,
337 `PUT .../secrets/{name}`, `DELETE .../secrets/{name}`. Variables
338 CRUD (plaintext, `${{ vars.NAME }}` namespace): `GET/POST
339 .../variables`, `GET/PATCH/DELETE .../variables/{name}`. Both
340 surfaces have repo- and org-scoped variants. Operator setup:
341 `SHITHUB_ACTIONS__SECRETS__BOX_PRIVATE_KEY_B64` carries the
342 X25519 private key (32 bytes base64); unset means
343 auto-generated-per-process with a loud warning at startup, which
344 is dev-only behavior.
345 - **Capabilities:** `actions-secrets`, `actions-variables` added to
346 `/api/v1/meta`.
347
348 ### Added (internal)
349
350 - `issues.Edit` orchestrator wraps `UpdateIssueTitleBody` with
351 markdown re-render + cross-reference re-indexing. Used by the
352 new PATCH-issue endpoint; available for the HTML edit flow when
353 it lands.
354
355 ### Changed
356
357 - **JSON error envelope on `/api/v1/*`.** `401` and `403`
358 responses now emit `{"error": "..."}` with
359 `Content-Type: application/json` (previously `text/plain`).
360 Existing `4xx`/`5xx` responses from the handler bodies are
361 unchanged.
362
363 ## [0.1.0] — TBD (operator fills in cutover date)
364
365 The first public release of shithub. Pre-1.0: there is no
366 backward-compatibility promise yet. Migrations are forward-only;
367 schema may change between minor versions.
368
369 ### Initial public surface
370
371 - **Identity** — signup, email verification, password reset, TOTP
372 2FA + recovery codes, SSH keys, scoped PATs, sessions with
373 per-account epoch invalidation.
374 - **Repositories** — create, fork, archive, transfer, soft-delete
375 with grace, rename with redirects, visibility toggles, branch
376 protection, default-branch swap, topics, README/license/
377 .gitignore templates.
378 - **Git** — bare repos on disk; HTTPS smart-HTTP push/pull;
379 pre/post-receive hook integration.
380 - **Code browsing** — tree, blob (chroma syntax highlighting),
381 raw, blame, commit history, individual commit views, branch/tag
382 listings, compare views, file finder.
383 - **Issues + PRs** — full CRUD; reviews; required-reviewer
384 enforcement; status-check gates; three merge methods.
385 - **Social** — stars, watches, forks, `/explore`, stargazer/
386 watcher lists.
387 - **Search** — code, repo, user, issue.
388 - **Notifications** — in-app inbox, email fan-out, one-click
389 unsubscribe.
390 - **Orgs + teams** — roles, invitations, one-level nesting,
391 max-of-sources policy.
392 - **Webhooks** — HMAC-signed delivery, exponential backoff,
393 auto-disable, SSRF defense, redelivery UI.
394 - **Observability** — structured logs, Prometheus metrics,
395 optional OTel tracing, Sentry-protocol error reporting.
396 - **Operations** — Ansible playbook, systemd units, Caddy edge,
397 WireGuard mesh for monitoring, Postgres WAL archive + daily
398 logical backups to Spaces, cross-region DR, restore drill.
399 - **Public landing page** on `/` for anonymous viewers; signed-in
400 viewers get a quick-link dashboard.
401 - **Lightweight status page** at `docs.<host>/status.html`.
402 - **Cutover artifacts** under `deploy/cutover/`.
403 - **Public docs site** built with mdBook.
404 - **Operator runbooks** for incidents, backups, restore, upgrade,
405 rollback, rotate-secrets, rotate-keys, regenerate-akc,
406 drain-workers, read-only-mode, day-one.
407 - **a11y tooling** (pa11y + axe) and **k6 load-test scenarios**.
408 - **THIRD_PARTY_NOTICES.md** with a CI-verified generator.
409
410 ### Known gaps at v0.1.0
411
412 - SSH git transport (HTTPS only)
413 - Actions / CI runner
414 - Packages, Releases, Pages, Projects, Gists
415 - GraphQL API (only a small REST surface today)
416 - Activity feed UI
417
418 These are all on the post-MVP roadmap.
419
420 [Unreleased]: https://shithub.sh/shithub/shithub/compare/v0.1.0...trunk
421 [0.1.0]: https://shithub.sh/shithub/shithub/releases/tag/v0.1.0