feat(addons): unified distribution Phase 2 — addon publish, hosted installs, registry snapshots - #734
Merged
Merged
Conversation
…nstalls + registry snapshots GH #724/#726. Client-side publish flow and registry consolidation: - `lean-ctx addon publish --namespace <ns>`: wraps lean-ctx-addon.toml verbatim into a signed kind=addon .ctxpkg after local gates that mirror the hosted listing bar (schema, runnable [mcp], audit — blocking findings refuse, review publishes disclosed; --check = all gates, no network). - `lean-ctx addon add <ns>/<name>[@Version]`: resolves hosted packs — index-verified download, integrity + mandatory ed25519 signature + kind↔payload coherence — then the embedded manifest walks the unchanged consent → preflight → health-probe pipeline; `addon update` re-resolves from the install source (ctxpkg: sources unpinned to latest non-yanked). - kind↔payload coherence (validate_kind_coherence) enforced in verify, import and the publish self-check; the context registry refuses kind=addon packs (wrong trust chain, points at `addon add`). - Bundled registries become generated snapshots: gen_registry validates, sorts and canonicalizes rust/data/{addon,grammar}_registry.json; drift fails CI + preflight + a lib test (deterministic, #498). Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
5 tasks
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
Implements the client side of Phase 2 of the Unified Distribution plan (#724, #726) — self-service addon publishing plus hosted installs, on the same package format, registry and trust chain as every other pack. Design:
docs/specs/unified-distribution-v1.md.lean-ctx addon publish --namespace <ns>(core/addons/publish.rs): wraps the authoringlean-ctx-addon.tomlverbatim into a signedkind=addon.ctxpkgand uploads it via the existingremote.rspublish path. Local gates run before any network I/O and mirror the hosted listing bar: schema validation, runnable[mcp]endpoint, non-empty description, and theaudit.rsverdict — blocking findings (shell-exec, fetch-exec, non-HTTPS, malware heuristics, under-declared capabilities) refuse;reviewpublishes with findings disclosed.--checkruns everything including signing + a self-verification round-trip, then stops.lean-ctx addon add <ns>/<name>[@version]: resolves hosted packs — registry-index-verified download, integrity hashes, mandatory ed25519 signature (executable references get no unsigned path), and kind ↔ payload coherence — then the embedded manifest walks the exact same consent → preflight → health-probe pipeline as local/curated installs. Install source is recorded asctxpkg:@ns/name@version;addon updatere-resolves from that source (latest non-yanked).verify::validate_kind_coherence): akind=addonpack must embed a parseable, valid, runnable addon manifest whose name/version match the pack; any other kind must not carry anaddonpayload. Enforced inverify_package_text, on import, and in the publish self-check. The context registry refuseskind=addonpacks (wrong trust chain — the error points ataddon add).core/addons/registry_snapshot.rs+gen_registry):rust/data/{addon,grammar}_registry.jsonare now generated, canonical snapshots — validated (same bar asaddon registry validate), name-sorted, deterministic, timestamp-free (fix(ctx_expand): fall back to reference_store for ref_-prefixed IDs #498). Drift fails CI, preflight and a lib test; hand-editing ends.Server side (ctxpkg.com
kindfilter on resolve/search/catalog, leanctx.com catalog view) is tracked in #726 and stays open after this merge.Test plan
cargo clippy --all-features -- -D warningsclean,cargo fmt --checkclean,cargo doccleangen_docs --check+gen_registry --checkgreen; Windows cross-check greenaddon publish --checkbuilds, signs and self-verifies a real pack from a scratch manifestMade with Cursor