Commit 8e2c1f7
committed
feat(0.3.0): HTTP transport + OpenAPI via huma; auth guard for non-loopback
Adds a REST surface alongside the unix socket. One daemon serves both; the
repo's own locks serialize concurrent mutations across transports.
internal/api/http.go (huma v2 + humago adapter)
- Typed Input/Output structs → OpenAPI 3.1 spec at /openapi.json + interactive
docs at /docs, both always in sync with the running code.
- 12 endpoints (head/log/branches/show/diff/commit/checkout/delete/tags
get+set/tournament/gc). Streaming exec stays socket-only (SSE follow-up).
- isLoopback(): bare ":PORT" treated as non-loopback (Go binds all
interfaces) so the no-token guard does the safer thing. Unit test pins
the rule.
- bearerAuth: /v1/* requires Authorization: Bearer <AGENTENV_HTTP_TOKEN>;
/openapi.json + /docs stay open for discoverability. Unit-tested.
cmdDaemon takes --http :PORT (or AGENTENV_HTTP), opens the HTTP listener in a
goroutine. AGENTENV_HTTP_TOKEN required for any non-loopback bind, checked at
startup (won't quietly expose itself).
examples/http_client.sh: curl walkthrough.
README + examples/README + CHANGELOG updated to call out the new transport,
the discoverability of /docs, and the headline use case (curl/Postman/SDK
generation, all without a socket library).1 parent 7d113c2 commit 8e2c1f7
13 files changed
Lines changed: 1718 additions & 6 deletions
File tree
- docs
- examples
- internal
- api
- cli
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
10 | 31 | | |
11 | 32 | | |
12 | 33 | | |
| |||
18 | 39 | | |
19 | 40 | | |
20 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
21 | 45 | | |
22 | 46 | | |
23 | 47 | | |
| |||
200 | 224 | | |
201 | 225 | | |
202 | 226 | | |
| 227 | + | |
203 | 228 | | |
204 | 229 | | |
205 | 230 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
| |||
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
177 | 208 | | |
178 | 209 | | |
179 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
| |||
0 commit comments