Skip to content

[Feature] Remote template registry client: search, sync, download, cache, provenance #239

Open

Description

@Antruly

Context

Parent design: #235. The maintainer wants a separate, open-source template registry with a standard format, frontend and backend packages, add/import/export, and search/sync/download of the latest versions. uvp provides the client and the standard; it does not host the registry.

Scope

  • Define the registry contract on top of F's package format: an index with package metadata, versions, checksums, licences, and provenance; immutable versions; no executable content at search time.
  • Add a registry client to uvp:
    • search by category/framework/style/tags/features and free text; return multiple matches with metadata for an external AI to choose;
    • download and verify (checksum; signature if the registry provides one) into the local store;
    • sync/update with explicit version pinning and an offline cache;
    • never auto-upload a local package;
    • network requests are a declared effect and are never made by uvp build/uvp run.
  • The registry URL is configurable; the first-party registry is a separate open-source repository created by the maintainer. This issue covers only the uvp client and the contract; the registry repository and its moderation/review process are a separate deliverable.
  • Offline behaviour: the local store and search still work; sync reports undetermined, not "no updates", when the registry cannot be reached.
  • Licence/provenance are part of every result; a package without a licence is not offered for shared use.

Acceptance criteria

  • A local fixture registry (tests) supports search, download, checksum verification, pinning, and offline fallback; tests cover a corrupted checksum and an unreachable registry (reported as unknown, not empty).
  • The client returns multiple matches with the metadata an AI needs; no model call is made by uvp.
  • A local package is never uploaded implicitly; any upload would be a separate, explicitly authorized operation.
  • npm run docs:check and the MCP boundary test pass.

Dependencies

Depends on F (package format/local store). The separate registry repository is a maintainer deliverable; without it, this issue can be developed against a fixture registry.

References

Owner

Unassigned; depends on F. One active task per engineer.

Activity

  1. added
    enhancement
    on Oct 18, 2026
  2. Antruly commented on Oct 18, 2026

    @Antruly
    OwnerAuthor

    Official registry repository

    The separate, open-source registry now exists: https://github.com/Antruly/uvp-templates (public, MIT).

    It holds the data and the review process. uvp remains the owner of the package format; if the two disagree, uvp wins.

    • Layout: packages/<id>/<version>/ with uvp.template/1, README.md, LICENSE, and files/.
    • Index: deterministic index.json (no timestamps, no model calls), raw URL:
      https://raw.githubusercontent.com/Antruly/uvp-templates/main/index.json
    • Required CI (validate): registry tests, index determinism, provisional preflight (paths, limits, digests, licence/provenance), a bounded secret/PII scan, and the PR disclosure policy.
    • Runtime CI: installs the latest published uvp-agents and runs validate → import → init → build. It is gated by the repository variable UVP_RUNTIME=1 and the runtime-check label, because the submitted C++ is compiled and run on an ephemeral runner.
    • Human gate: an AI-assisted PR must disclose that and name a human owner; agents never approve or merge; branch protection requires a PR and the validate check.

    Observed 2026-10-18: the latest published uvp-agents is 0.2.0 and has no uvp template command (invalid_request: No command named "template"), so the runtime lane reports undetermined rather than passing. Its forward command shape is documented in the registry's docs/runtime-ci.md; when a release exposes it, the lane is enabled and added as a required check.

    No packages are published yet. A structural pass is not a build claim.

    The client work remains in this issue: search, sync, download, cache, and provenance on top of this index and package format.

    Assisted-by: Claude Code (direction-lead)

  3. Antruly commented on Oct 18, 2026

    @Antruly
    OwnerAuthor

    🤖 Antruly-dev-1 · AI Engineer 1 · agent:dev-ai-1

    Claiming this task as Antruly-dev-1. I will follow
    docs/ai-engineer-operations.md and docs/agent-workflow.md.

    Planned scope — first increment, library only. The registry's own
    docs/index-format.md and the uvp.template/1 vocabulary already fix the data
    contract, so this increment can be built without a further design decision:

    1. src/domain/templateRegistry.ts — a closed-shape reader for the untrusted
      uvp.registry/1 index. It validates schema, ids, versions, categories,
      frameworks, tags, requires, licence, provenance, and the files[]
      digest/byte list, reusing the existing package vocabulary rather than
      re-spelling it. Malformed entries are named, never silently dropped.
    2. src/application/TemplateRegistry.ts — fetch the index over an injectable
      transport with a bounded body and a timeout; cache the last good copy under
      the local store root; and return three states — network read, stale cache
      (with the fetch failure named), and undetermined when neither is available.
      An unreachable registry is never reported as an empty registry.
    3. Deterministic metadata search over the index (free text, category, framework,
      tags, features) returning multiple candidates with their provenance, reusing
      the local search's matching rules rather than a second implementation.

    Not in this increment: download into the store, checksum-verified sync and
    pinning, and any CLI/MCP tool contract or effects change. Those follow as
    separate PRs on this issue, so this PR adds no user-facing surface.

    Checks planned: focused vitest against a local fixture HTTP server (no real
    network in tests), then npm run check:pr with the real libuvcpp 1.7.0 root.

  4. Antruly commented on Oct 18, 2026

    @Antruly
    OwnerAuthor

    🤖 Antruly-dev-1 · AI Engineer 1 · agent:dev-ai-1

    First increment merged: #257 → a8791a4 (head 285140a, owner approval at that head). It lands the read side only: src/domain/templateRegistry.ts (closed-shape uvp.registry/1 reader, including the entries the registry's generator actually emits), src/application/TemplateRegistry.ts (network read, URL-keyed last-good cache, three reported states, deterministic search), and the shared templateDiscovery.ts filters. The fixture tests/support/fixtures/registry-index.generated.json is produced by Antruly/uvp-templates's own builder at a95b3e0, with a regeneration script.

    Main CI on a8791a4: CI run 39132288331, 12 jobs success, 2 skipped (Real libuvcpp and Windows MSVC by change classification — not coverage).

    Still open in this issue: download + checksum verification of a package, sync/pinning, and the CLI/MCP surface. The download increment needs the package fetch URL/layout decided (the index names packages/<id>/<version> inside the registry repository, but no archive/endpoint contract is documented yet), so I am not starting it fail-closed.

  5. Antruly commented on Oct 18, 2026

    @Antruly
    OwnerAuthor

    🤖 Antruly-dev-1 · AI Engineer 1 · agent:dev-ai-1

    Design question for the next increment (download + checksum). The registry documents packages/<id>/<version>/ as immutable and the index carries a manifest digest plus files[].digest/bytes, but it documents no way for a client to fetch a package. I do not want to infer one, so here are the three shapes I can see; say which (or none) and I will file the increment.

    1. Per-file raw fetch (no registry change). For a chosen version, GET each files[] path plus template.json from raw.githubusercontent.com/Antruly/uvp-templates/<ref>/packages/<id>/<version>/…, verify every sha256/byte count, and verify the manifest's canonical digest. Works today; costs one request per file (the package format allows up to 512) and needs a pinned ref to make "immutable" enforceable rather than a policy — the index currently carries no commit.
    2. Repository archive at a pinned commit. One tarball of the repository at a commit, extract only packages/<id>/<version>/ with the existing path checks, then verify the same digests. Cheap in requests, but still has no commit in the index and downloads more than the package. GitHub's archive endpoint has no subdirectory form.
    3. Published package tarball (registry change). The registry builds packages/<id>/<version>.tgz with a published digest and the index names it. Cleanest client contract and one request, but it is new work in uvp-templates (and its CI) before the client can use it.

    My recommendation: 3 as the target contract, with the index gaining a ref/commit field either way so "immutable path" can be verified; 1 is the stopgap if you want the client usable before the registry publishes archives. If you pick 1, the increment should state plainly that immutability is the registry's policy, not something the client can prove.

  6. Antruly commented on Nov 25, 2026

    @Antruly
    OwnerAuthor

    Decision (2026-11-25): option 3. The registry publishes one tarball per package version with a published digest, and the index names it. Option 1 is not the stopgap.

    Contract:

    • archives/<id>/<version>.tgz, deterministic (sorted paths, fixed mode/mtime, package contents at the root).
    • index.json version entry gains archive: { path, digest, bytes }; digest is sha256: over the .tgz.
    • The archive is immutable; CI regenerates and compares.
    • The client verifies the archive digest, extracts only the package tree, then verifies every files[] digest. Offline cache and undetermined on unreachable registry remain in scope.

    Sequencing is forced by the closed index reader: [email protected] rejects an unknown version-entry key, so the client must accept archive and ship first. Both halves are now tracked:

    npm publishing is currently blocked on Trusted Publisher configuration (publish.yml run 45655925350 failed with ENEEDAUTH), so the client half is gated on that release step, not on design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions