Skip to content

platform ops: disk usage, backup/export, and shared init - #6

Merged
sdelcore merged 3 commits into
mainfrom
platform-ops
Jul 7, 2026
Merged

sdelcore merged 3 commits into
mainfrom
platform-ops

Conversation

@sdelcore

@sdelcore sdelcore commented Jul 6, 2026

Copy link
Copy Markdown
Owner

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/sites now includes a bytes field per site — the summed size of the site's sites/, db/, uploads/, and versions/ 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, and shared list prints it as a middle column.

2. Backup / export

New GET /api/export streams a gzipped tarball of the whole data directory (sites, db, uploads, versions, identity.json if present), skipping transient deploy-* / old-* / *.old-* swap dirs. New shared backup [file] downloads it, defaulting to shared-backup-<yyyymmdd-hhmmss>.tar.gz in the cwd and printing the path and size.

3. shared init

New shared init [dir] scaffolds index.html (loads /shared.js, demonstrates shared.identity()) and .claude/skills/shared-sites/SKILL.md (an agent skill documenting the full client API + deploy flow), both embedded in the binary via internal/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), and nix build all pass.
  • Live server against scratch SHARED_DATA: deployed a site with a known-size file plus a db doc and an upload → /api/sites bytes reflected it and the homepage rendered the size string; shared backup produced a tarball listing the site files, db json, and upload; shared init created both files in a fresh dir, a second run skipped them with a note, and the scaffolded index.html deployed and loaded (200).

File boundaries

Did not touch internal/server/ai.go, the AI parts of internal/web/shared.js, or the README AI/env-AI rows (owned by a parallel branch). server.go change is limited to one route registration.

@sdelcore
sdelcore force-pushed the add-site-retention branch from 4d26ae2 to 838baf3 Compare July 7, 2026 00:47
@sdelcore
sdelcore changed the base branch from add-site-retention to main July 7, 2026 00:47
@sdelcore
sdelcore merged commit c92b08a into main Jul 7, 2026
@sdelcore
sdelcore deleted the platform-ops branch July 7, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant