packages.wenpai.net/internal/composer
Scott Walkinshaw 6006ec6cfe
Incremental sync refactor (phase 2) (#90)
* Add PackageType() as single source of truth for vendor→type mapping

Centralizes the wp-plugin→plugin / wp-theme→theme mapping that was
duplicated across telemetry/ingest.go and will be needed by the new
Composer serve layer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Extract packages.json to embedded file

Single source of truth for the root Composer repository descriptor.
Both the builder (for R2 uploads) and the new serve layer use
composer.PackagesJSON(). The embedded file is discoverable by searching
for "packages.json" in the repo.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Remove DeterministicJSON — json.Marshal already sorts map keys

Go's json.Marshal has sorted map keys since Go 1. The recursive
sortKeys helper was redundant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Refactor SerializePackage to single-file output

Instead of producing both tagged and dev files, SerializePackage now
takes a name that encodes the version filter: "akismet" for tagged
versions, "akismet~dev" for dev versions. Returns ([]byte, error).

Removes PackageFiles, FileOutput types. The sync step (Phase 3) will
call it twice — once per file — rather than getting both at once.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add DB-backed Composer serve layer (Phase 2)

Replace filesystem-based serving of /packages.json and /p2/ with
handlers that query SQLite and serialize on the fly. Production
continues serving from R2/CDN — these handlers are for local dev.

- handlePackagesJSON: returns pre-built embedded JSON
- handleP2Package: queries package by type+name, calls SerializePackage
- Router updated to use {vendor}/{file} path wildcards
- dev-bootstrap no longer runs build/deploy (not needed for serving)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix errcheck lint warnings in Composer handlers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Handle errors from PackagesJSON instead of silently discarding them

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Ben Word <ben@benword.com>
2026-04-03 10:11:18 -05:00
..
format.go Incremental sync refactor (phase 2) (#90) 2026-04-03 10:11:18 -05:00
hash.go Incremental sync refactor (phase 2) (#90) 2026-04-03 10:11:18 -05:00
packages.json Incremental sync refactor (phase 2) (#90) 2026-04-03 10:11:18 -05:00
root.go Incremental sync refactor (phase 2) (#90) 2026-04-03 10:11:18 -05:00
serialize.go Incremental sync refactor (phase 2) (#90) 2026-04-03 10:11:18 -05:00