@zabaca/zbc 0.20.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/apps/walgit/CONTEXT.md +37 -0
- package/templates/apps/walgit/README.md +193 -4
- package/templates/apps/walgit/e2e/harness.ts +2 -2
- package/templates/apps/walgit/e2e/scenarios.ts +302 -2
- package/templates/apps/walgit/package.json +5 -1
- package/templates/apps/walgit/registry.json +1 -1
- package/templates/apps/walgit/shared/browse.ts +733 -0
- package/templates/apps/walgit/shared/capabilities.ts +17 -0
- package/templates/apps/walgit/shared/container-env.ts +9 -0
- package/templates/apps/walgit/shared/landing.ts +8 -27
- package/templates/apps/walgit/shared/llms.ts +41 -0
- package/templates/apps/walgit/shared/mcp.ts +286 -0
- package/templates/apps/walgit/shared/policy.ts +21 -0
- package/templates/apps/walgit/shared/pooled.ts +31 -0
- package/templates/apps/walgit/shared/protocol.ts +140 -0
- package/templates/apps/walgit/shared/repo-list.ts +478 -0
- package/templates/apps/walgit/shared/store.ts +307 -0
- package/templates/apps/walgit/shared/telemetry.ts +79 -6
- package/templates/apps/walgit/shared/wal-index.ts +249 -0
- package/templates/apps/walgit/shared/web.ts +46 -0
- package/templates/apps/walgit/src/announce-main.ts +1 -1
- package/templates/apps/walgit/src/announce.ts +1 -1
- package/templates/apps/walgit/src/append-only.ts +5 -8
- package/templates/apps/walgit/src/browse.ts +230 -0
- package/templates/apps/walgit/src/cache.ts +4 -4
- package/templates/apps/walgit/src/compact.ts +6 -12
- package/templates/apps/walgit/src/delete-repo.ts +4 -3
- package/templates/apps/walgit/src/expire.ts +3 -3
- package/templates/apps/walgit/src/gc.ts +4 -3
- package/templates/apps/walgit/src/git.ts +127 -10
- package/templates/apps/walgit/src/hook-main.ts +1 -1
- package/templates/apps/walgit/src/http.ts +386 -3
- package/templates/apps/walgit/src/limits.ts +1 -1
- package/templates/apps/walgit/src/materialize.bench.ts +4 -10
- package/templates/apps/walgit/src/materialize.ts +11 -4
- package/templates/apps/walgit/src/orphans.ts +3 -3
- package/templates/apps/walgit/src/pending.ts +1 -1
- package/templates/apps/walgit/src/private.ts +1 -1
- package/templates/apps/walgit/src/proposals.ts +3 -3
- package/templates/apps/walgit/src/push-cert.ts +10 -1
- package/templates/apps/walgit/src/push.ts +11 -9
- package/templates/apps/walgit/src/reconcile.ts +4 -3
- package/templates/apps/walgit/src/server.ts +29 -2
- package/templates/apps/walgit/src/signers.ts +9 -3
- package/templates/apps/walgit/src/store-env.ts +8 -21
- package/templates/apps/walgit/src/store.ts +12 -241
- package/templates/apps/walgit/src/sync.ts +2 -2
- package/templates/apps/walgit/src/usage.ts +4 -18
- package/templates/apps/walgit/src/verify.ts +2 -2
- package/templates/apps/walgit/src/wal-index.ts +20 -239
- package/templates/apps/walgit/worker/index.ts +278 -1
- package/templates/apps/walgit/worker/mcp.ts +281 -0
- /package/templates/apps/walgit/{src → shared}/keys.ts +0 -0
- /package/templates/apps/walgit/{src → shared}/ulid.ts +0 -0
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
],
|
|
18
18
|
"signupUrl": "https://dash.cloudflare.com/sign-up",
|
|
19
19
|
"tokenUrl": "https://dash.cloudflare.com/profile/api-tokens",
|
|
20
|
-
"instructions": "STATUS: the front door and the push path are deployable — a Cloudflare Worker proxying to a Durable-Object-bound Container that serves git smart-HTTP, with every push persisted to the write-ahead log in object storage before it is acknowledged and linearized by compare-and-swap on index.json. The bare repos on the container's filesystem are a cache, reconciled against the log on every access and materialized from it when the objects a ref needs are absent. A repo whose cache is gone is rebuilt from the log on first access — not disaster recovery but the normal path, since the container sleeps when idle and its disk is wiped completely on every restart. The log is compacted in the background: once a repo accumulates WALGIT_COMPACTION_THRESHOLD (default 50) un-superseded entries, a post-receive hook hands a detached process a `git repack -adf` whose single pack is published as one WAL entry under a per-repo lease, so a cold restore replays one entry however many pushes the repo has taken. Superseded entries and the packs rejected pushes leave behind are deleted only after WALGIT_GC_GRACE_MS (default one hour), never immediately — a restore that read index.json a moment before a compaction is still downloading what that compaction superseded, and deleting it out from under that restore fails silently. Both knobs are optional environment variables, not secrets.\n\nTRANSPORT: smart-HTTP only. walgit used to also serve SSH, which needed raw inbound TCP and is why it ran on Fly (docs/adr/0006 in the zbc repository); no Cloudflare product delivers raw inbound TCP, so the SSH transport was removed rather than kept on a second host. Clients send the token as the Basic-auth password: `git clone https://walgit:$TOKEN@<worker-host>/myrepo.git`. A repository is created on first push to a name nobody has used.\n\nDEPLOYMENT: through the `cloudflare` module. `wrangler deploy` builds the container image from this package's Dockerfile, so Docker must be running at apply time and the account must be on a Workers Paid plan with Containers enabled. Set `immediateContainerRollout: true` on the instance — wrangler's gradual rollout never drains a single always-warm container, so a redeployed image otherwise never takes effect until it idle-sleeps. That flag covers the IMAGE only; a deploy that changes only forwarded env vars produces no new container version to roll, and the container reads its environment once at start — so the Durable Object fingerprints the environment it would boot with, keeps it in DO storage, and destroys the running container the first time the two differ (reconcileEnv in worker/index.ts). Changing a var therefore costs one container restart on the next request and takes effect immediately. CLOUDFLARE_API_TOKEN needs Workers Scripts: Edit and Containers: Edit. Trap when tearing one down: `wrangler delete` on the Worker does NOT delete its container application — that needs a separate `wrangler containers delete`, or the instances stay live.\n\nCONFIGURATION: the container runs outside the Worker's binding graph, so it reads the store over the S3 API rather than through an r2 binding, and it can only be told about it via environment variables the Worker forwards (CONTAINER_ENV in shared/container-env.ts). Wire these as the cloudflare instance's `workerSecrets`: WALGIT_HTTP_TOKENS (comma-separated bearer tokens, comma-separated so a credential can be rotated without a window where neither works), and the log's home — WALGIT_S3_ENDPOINT, WALGIT_S3_BUCKET, WALGIT_S3_ACCESS_KEY_ID and WALGIT_S3_SECRET_ACCESS_KEY, from an r2 module instance's S3-API credentials. Without those four the host still serves reads from its local cache but REFUSES every push — accepting one it cannot persist is the single failure this app exists to prevent. A secret that is not in that forward list reaches the Worker and stops there.\n\nOPERATOR CLI: src/cli.ts — `bun src/cli.ts <serve|materialize|verify|gc|compact>`, run inside the container so it reads the same credentials the app does; there is no separate config file. `verify` is read-only and exits non-zero when the disk disagrees with index.json; `gc` reclaims superseded and orphaned objects and only reports unless given --yes; `compact` forces a compaction now rather than waiting for the threshold, and `--force=false` asks whether one is due without causing it.\n\nREF EVENTS: optional, off unless configured. Set WALGIT_EVENTS_URL (the deployment's own public origin) and WALGIT_EVENTS_TOKEN (a shared secret, wired as a workerSecret and forwarded to the container) and walgit serves a WebSocket at /_walgit/events: a client sends {\"watch\":[{\"repo\":\"my-thing\",\"refs\":[\"refs/heads/main\"]}]}, is answered with the current sha of each watched ref, and is then sent the new sha every time one moves (sha null is a deletion; an omitted refs list watches every ref in that repository). Subscribing takes exactly the credential a read takes, so a public deployment has a public stream. Events are latest state, not a log — no cursor, no since, no sequence number on the wire; a reconnecting client gets current state in its handshake. The push path announces from post-receive, which git runs only after the compare-and-swap on index.json won, so a push that lost is never announced; the announcement is authenticated, bounded, and can never fail a push. With either variable unset the endpoint does not exist."
|
|
20
|
+
"instructions": "STATUS: the front door and the push path are deployable — a Cloudflare Worker proxying to a Durable-Object-bound Container that serves git smart-HTTP, with every push persisted to the write-ahead log in object storage before it is acknowledged and linearized by compare-and-swap on index.json. The bare repos on the container's filesystem are a cache, reconciled against the log on every access and materialized from it when the objects a ref needs are absent. A repo whose cache is gone is rebuilt from the log on first access — not disaster recovery but the normal path, since the container sleeps when idle and its disk is wiped completely on every restart. The log is compacted in the background: once a repo accumulates WALGIT_COMPACTION_THRESHOLD (default 50) un-superseded entries, a post-receive hook hands a detached process a `git repack -adf` whose single pack is published as one WAL entry under a per-repo lease, so a cold restore replays one entry however many pushes the repo has taken. Superseded entries and the packs rejected pushes leave behind are deleted only after WALGIT_GC_GRACE_MS (default one hour), never immediately — a restore that read index.json a moment before a compaction is still downloading what that compaction superseded, and deleting it out from under that restore fails silently. Both knobs are optional environment variables, not secrets.\n\nTRANSPORT: smart-HTTP only. walgit used to also serve SSH, which needed raw inbound TCP and is why it ran on Fly (docs/adr/0006 in the zbc repository); no Cloudflare product delivers raw inbound TCP, so the SSH transport was removed rather than kept on a second host. Clients send the token as the Basic-auth password: `git clone https://walgit:$TOKEN@<worker-host>/myrepo.git`. A repository is created on first push to a name nobody has used.\n\nDEPLOYMENT: through the `cloudflare` module. `wrangler deploy` builds the container image from this package's Dockerfile, so Docker must be running at apply time and the account must be on a Workers Paid plan with Containers enabled. Set `immediateContainerRollout: true` on the instance — wrangler's gradual rollout never drains a single always-warm container, so a redeployed image otherwise never takes effect until it idle-sleeps. That flag covers the IMAGE only; a deploy that changes only forwarded env vars produces no new container version to roll, and the container reads its environment once at start — so the Durable Object fingerprints the environment it would boot with, keeps it in DO storage, and destroys the running container the first time the two differ (reconcileEnv in worker/index.ts). Changing a var therefore costs one container restart on the next request and takes effect immediately. CLOUDFLARE_API_TOKEN needs Workers Scripts: Edit and Containers: Edit. Trap when tearing one down: `wrangler delete` on the Worker does NOT delete its container application — that needs a separate `wrangler containers delete`, or the instances stay live.\n\nCONFIGURATION: the container runs outside the Worker's binding graph, so it reads the store over the S3 API rather than through an r2 binding, and it can only be told about it via environment variables the Worker forwards (CONTAINER_ENV in shared/container-env.ts). Wire these as the cloudflare instance's `workerSecrets`: WALGIT_HTTP_TOKENS (comma-separated bearer tokens, comma-separated so a credential can be rotated without a window where neither works), and the log's home — WALGIT_S3_ENDPOINT, WALGIT_S3_BUCKET, WALGIT_S3_ACCESS_KEY_ID and WALGIT_S3_SECRET_ACCESS_KEY, from an r2 module instance's S3-API credentials. Without those four the host still serves reads from its local cache but REFUSES every push — accepting one it cannot persist is the single failure this app exists to prevent. A secret that is not in that forward list reaches the Worker and stops there.\n\nOPERATOR CLI: src/cli.ts — `bun src/cli.ts <serve|materialize|verify|gc|compact>`, run inside the container so it reads the same credentials the app does; there is no separate config file. `verify` is read-only and exits non-zero when the disk disagrees with index.json; `gc` reclaims superseded and orphaned objects and only reports unless given --yes; `compact` forces a compaction now rather than waiting for the threshold, and `--force=false` asks whether one is due without causing it.\n\nREF EVENTS: optional, off unless configured. Set WALGIT_EVENTS_URL (the deployment's own public origin) and WALGIT_EVENTS_TOKEN (a shared secret, wired as a workerSecret and forwarded to the container) and walgit serves a WebSocket at /_walgit/events: a client sends {\"watch\":[{\"repo\":\"my-thing\",\"refs\":[\"refs/heads/main\"]}]}, is answered with the current sha of each watched ref, and is then sent the new sha every time one moves (sha null is a deletion; an omitted refs list watches every ref in that repository). Subscribing takes exactly the credential a read takes, so a public deployment has a public stream. Events are latest state, not a log — no cursor, no since, no sequence number on the wire; a reconnecting client gets current state in its handshake. The push path announces from post-receive, which git runs only after the compare-and-swap on index.json won, so a push that lost is never announced; the announcement is authenticated, bounded, and can never fail a push. With either variable unset the endpoint does not exist.\n\nMCP: the deployment answers the Model Context Protocol at /_walgit/mcp (Streamable HTTP), at the edge and on every deployment — there is no variable to set and nothing to install. `claude mcp add --transport http agentgit https://<host>/_walgit/mcp`. It carries only what the host can answer without the caller's disk: agentgit_status (does a name exist, is it claimed, is it private, and its refs), agentgit_watch (blocks until a ref moves, five minutes per call), agentgit_provenance (which key signed the push that moved a ref), and the /llms.txt manual as the resource agentgit://manual. agentgit_status and agentgit_provenance read through the same gate a clone passes, so a Private name refuses an unproven reader exactly as info/refs does; agentgit_watch needs the ref-event stream above and says so where it is unconfigured."
|
|
21
21
|
}
|