Skip to content

build(allowances): vendor the catalog from commandcode-catalog - #15

Merged
peach0x33a merged 1 commit into
masterfrom
chore/vendor-catalog
Nov 16, 2026
Merged

peach0x33a merged 1 commit into
masterfrom
chore/vendor-catalog

Conversation

@peach0x33a

Copy link
Copy Markdown
Owner

Follow-up to #14: the catalog and its scraper now live in commandcode-catalog, which refreshes catalog.json weekly.

This PR

  • Removes cmd/gen-allowances (moved to the catalog repo).
  • Adds cmd/vendor-allowances: fetches the published catalog.json, validates it (schema version, source, captured date, model count, duplicate ids, positive allowances), and replaces internal/app/allowances.json atomically. It is idempotent.
  • go generate ./internal/app now vendors instead of scraping, so the app never parses the docs page.
  • The snapshot picks up tencent/hy4-flash, published upstream after feat(quota): derive per-model allowance and expose boosted usage #14.

Why vendor instead of fetching at runtime

go:embed keeps builds offline and a bad upstream deploy cannot affect a released binary. The catalog repo absorbs the parsing fragility; the app only trusts a versioned schema.

Not included

An app-side scheduled vendor workflow. A push made with the default GITHUB_TOKEN does not trigger CI, so it would need a PAT/GitHub App token; keeping go generate manual avoids that secret. The catalog itself still refreshes weekly.

Tested

go test ./..., go vet ./..., and go generate ./internal/app against the published catalog (100 models, schema 1).

Move the scraper out of the app: commandcode-catalog now owns the docs
parsing and publishes catalog.json weekly. The app vendors a validated
snapshot for go:embed, so builds stay offline and a bad upstream deploy
cannot affect a released binary.

go generate ./internal/app now runs cmd/vendor-allowances, which checks
the schema and model invariants before replacing the snapshot. The
vendored copy picks up tencent/hy4-flash.
@peach0x33a
peach0x33a merged commit 035ffd3 into master Nov 16, 2026
3 checks passed
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