platform ops: disk usage, backup/export, and shared init - #6
Merged
Merged
Conversation
sdelcore
force-pushed
the
add-site-retention
branch
from
July 7, 2026 00:47
4d26ae2 to
838baf3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #5 (chain: #3 ← #5 ← this). Base this PR's review on top of the versioning/rollback/delete work; merge #3 and #5 first.
Three operational features for the shared platform.
1. Per-site disk usage
GET /api/sitesnow includes abytesfield per site — the summed size of the site'ssites/,db/,uploads/, andversions/trees (regular files only, race errors ignored). The homepage renders it as a human-readable size (B/KB/MB/GB, one decimal) next to the existing updated-at, andshared listprints it as a middle column.2. Backup / export
New
GET /api/exportstreams a gzipped tarball of the whole data directory (sites, db, uploads, versions, identity.json if present), skipping transientdeploy-*/old-*/*.old-*swap dirs. Newshared backup [file]downloads it, defaulting toshared-backup-<yyyymmdd-hhmmss>.tar.gzin the cwd and printing the path and size.3.
shared initNew
shared init [dir]scaffoldsindex.html(loads/shared.js, demonstratesshared.identity()) and.claude/skills/shared-sites/SKILL.md(an agent skill documenting the full client API + deploy flow), both embedded in the binary viainternal/web. Refuses to overwrite existing files, skipping with a note.Why
Operational visibility (how much disk each site uses), a one-command backup for the plain-files data dir, and a fast on-ramp for building new sites with accurate, in-repo API docs for coding agents.
Verification
go build ./...,go vet ./...,gofmt -l .(clean), andnix buildall pass.SHARED_DATA: deployed a site with a known-size file plus a db doc and an upload →/api/sitesbytesreflected it and the homepage rendered the size string;shared backupproduced a tarball listing the site files, db json, and upload;shared initcreated both files in a fresh dir, a second run skipped them with a note, and the scaffoldedindex.htmldeployed and loaded (200).File boundaries
Did not touch
internal/server/ai.go, the AI parts ofinternal/web/shared.js, or the README AI/env-AI rows (owned by a parallel branch).server.gochange is limited to one route registration.