diff --git a/.workers/plugins-registry/src/index.js b/.workers/plugins-registry/src/index.js index d76a43c..5b176b6 100644 --- a/.workers/plugins-registry/src/index.js +++ b/.workers/plugins-registry/src/index.js @@ -5,7 +5,7 @@ * * Serves a unified plugin registry that merges: * - Free registry (public, plugins/registry.json on GitHub) - * - Pro registry (private, plugins-pro/registry.json via GitHub API with token) + * - Pro registry (private, the Bundles repo registry.json via GitHub API with token) * * Endpoints: * GET /registry.json Combined registry (free + pro), or ?tier=free|pro to filter @@ -34,7 +34,7 @@ * stats:global — request statistics * * Secrets (set via wrangler secret put): - * GH_ACCESS_TOKEN — Fine-grained PAT with contents:read on nself-org/plugins-pro + * GH_ACCESS_TOKEN — Fine-grained PAT with contents:read on nself-org/bundles * Also used for authenticated free registry fetch (avoids raw CDN cache) * GITHUB_SYNC_TOKEN — Bearer token for POST /api/sync (from GitHub Actions) * SIGNING_PRIVATE_KEY — Ed25519 private key (32 bytes as hex, 64 hex chars) @@ -54,7 +54,7 @@ const FREE_REGISTRY_API_URL = 'https://api.github.com/repos/nself-org/plugins/contents/registry.json'; const PRO_REGISTRY_API_URL = - 'https://api.github.com/repos/nself-org/plugins-pro/contents/registry.json'; + 'https://api.github.com/repos/nself-org/bundles/contents/registry.json'; // Fallback: unauthenticated raw URL for free registry (used when GITHUB_TOKEN absent) const FREE_REGISTRY_RAW_URL = @@ -68,16 +68,16 @@ const KV_STATS = 'stats:global'; const DEFAULT_CACHE_TTL = 300; // seconds // bundles.json — P6-E4-W3-S3-T8 (ADR-P6-03: served by this worker at -// plugins.nself.org/bundles.json). Lives in plugins-pro alongside registry.json +// plugins.nself.org/bundles.json). Lives in the Bundles repo alongside registry.json // today; the path becomes nself-org/bundles/contents/bundles.json once the -// plugins-pro -> bundles repo rename (ADR-P6-01 / W3-S3-T6) has landed — update +// plugins-pro -> bundles rename (ADR-P6-01 / W3-S3-T6) landed 2026-09-16; updated // these two URL constants then, nothing else in this route needs to change. // Own KV keys, distinct from registry:*, so a bundles.json refresh/miss never // invalidates the unrelated registry cache. const BUNDLES_JSON_API_URL = - 'https://api.github.com/repos/nself-org/plugins-pro/contents/bundles.json'; + 'https://api.github.com/repos/nself-org/bundles/contents/bundles.json'; const BUNDLES_SCHEMA_API_URL = - 'https://api.github.com/repos/nself-org/plugins-pro/contents/bundles-schema.json'; + 'https://api.github.com/repos/nself-org/bundles/contents/bundles-schema.json'; const KV_BUNDLES_JSON = 'bundles-json-v1'; const KV_BUNDLES_SCHEMA = 'bundles-schema-v1'; const BUNDLES_CACHE_CONTROL = 'public, s-maxage=60, stale-while-revalidate=300'; @@ -572,7 +572,7 @@ async function handlePluginTarball(plugin, env) { ); } - const repo = (tier === 'pro') ? 'plugins-pro' : 'plugins'; + const repo = (tier === 'pro') ? 'bundles' : 'plugins'; const tarballUrl = `https://github.com/nself-org/${repo}/releases/download/v${resolvedVersion}/${name}-${resolvedVersion}.tar.gz`; @@ -620,7 +620,7 @@ async function handlePluginSignature(plugin, env) { ); } - const repo = (tier === 'pro') ? 'plugins-pro' : 'plugins'; + const repo = (tier === 'pro') ? 'bundles' : 'plugins'; const tarballUrl = `https://github.com/nself-org/${repo}/releases/download/v${resolvedVersion}/${name}-${resolvedVersion}.tar.gz`; const canonical = canonicalPluginString(name, resolvedVersion, tarballUrl); diff --git a/.workers/plugins-registry/src/index.ts b/.workers/plugins-registry/src/index.ts index 5bbc370..d21b0cd 100644 --- a/.workers/plugins-registry/src/index.ts +++ b/.workers/plugins-registry/src/index.ts @@ -36,7 +36,7 @@ * Secrets (set via `wrangler secret put`): * SIGNING_PRIVATE_KEY — Ed25519 seed, 32 bytes as 64 lowercase hex chars * PUBLIC_KEY_HEX — Ed25519 public key, 32 bytes as 64 lowercase hex chars - * GH_ACCESS_TOKEN — Fine-grained PAT (contents:read on plugins + plugins-pro) + * GH_ACCESS_TOKEN — Fine-grained PAT (contents:read on plugins + bundles) * GITHUB_SYNC_TOKEN — Bearer token for POST /api/sync */ @@ -473,7 +473,7 @@ async function handlePluginTarball(plugin: PluginEntry, env: Env): Promise { const { name, version, tier } = plugin; - const repo = tier === "pro" ? "plugins-pro" : "plugins"; + const repo = tier === "pro" ? "bundles" : "plugins"; const tarballURL = `https://github.com/nself-org/${repo}/releases/download/v${version}/${name}-${version}.tar.gz`; @@ -653,7 +653,7 @@ async function handleManifest(env: Env, ctx: ExecutionContext): Promise & { tier?: PluginTier }>) .map(([key, entry]) => (entry.name ? entry : { ...entry, name: key })); } else { @@ -270,7 +270,7 @@ function normaliseToArray(data: RegistryWireFormat, expectedTier: PluginTier): P const FREE_REGISTRY_API_URL = "https://api.github.com/repos/nself-org/plugins/contents/registry.json"; const PRO_REGISTRY_API_URL = - "https://api.github.com/repos/nself-org/plugins-pro/contents/registry.json"; + "https://api.github.com/repos/nself-org/bundles/contents/registry.json"; const FREE_REGISTRY_RAW_URL = "https://raw.githubusercontent.com/nself-org/plugins/main/registry.json"; @@ -429,9 +429,9 @@ export async function fetchAllPlugins( // --------------------------------------------------------------------------- // bundles.json — P6-E4-W3-S3-T8 (ADR-P6-03: served by this worker at -// plugins.nself.org/bundles.json). Lives in plugins-pro alongside +// plugins.nself.org/bundles.json). Lives in the Bundles repo alongside // registry.json today; the path becomes nself-org/bundles/contents/*.json -// once the plugins-pro -> bundles repo rename (ADR-P6-01 / W3-S3-T6) has +// the plugins-pro -> bundles rename (ADR-P6-01 / W3-S3-T6) landed 2026-09-16 and these are updated; it // landed — update the two URL constants below then, nothing else here needs // to change. Fetched the same way as the pro registry via the GitHub // Contents API and cached under its own KV key so a bundles.json miss/ @@ -439,9 +439,9 @@ export async function fetchAllPlugins( // --------------------------------------------------------------------------- const BUNDLES_JSON_API_URL = - "https://api.github.com/repos/nself-org/plugins-pro/contents/bundles.json"; + "https://api.github.com/repos/nself-org/bundles/contents/bundles.json"; const BUNDLES_SCHEMA_API_URL = - "https://api.github.com/repos/nself-org/plugins-pro/contents/bundles-schema.json"; + "https://api.github.com/repos/nself-org/bundles/contents/bundles-schema.json"; export const KV_BUNDLES_JSON = "bundles-json-v1"; export const KV_BUNDLES_SCHEMA = "bundles-schema-v1"; @@ -516,7 +516,7 @@ export function validateBundlesJson(data: unknown): { valid: boolean; errors: st } /** - * Fetches bundles.json from the plugins-pro repo via the GitHub Contents + * Fetches bundles.json from the Bundles repo via the GitHub Contents * API, mirroring fetchProRegistry's auth + KV-cache pattern above (reused * rather than re-implemented per DRY). Returns the raw parsed JSON * (unvalidated — callers run validateBundlesJson separately so a schema diff --git a/.workers/plugins-registry/wrangler.toml b/.workers/plugins-registry/wrangler.toml index 33beb96..6a47351 100644 --- a/.workers/plugins-registry/wrangler.toml +++ b/.workers/plugins-registry/wrangler.toml @@ -30,7 +30,7 @@ MARKETPLACE_GET_RATE_LIMIT = "60" MARKETPLACE_GET_RATE_WINDOW_MS = "60000" # Secrets (set via wrangler secret put ): -# GH_ACCESS_TOKEN — Fine-grained PAT with contents:read on nself-org/plugins-pro +# GH_ACCESS_TOKEN — Fine-grained PAT with contents:read on nself-org/bundles # Used to fetch the private pro registry from the GitHub Contents API. # GITHUB_SYNC_TOKEN — Bearer token for POST /api/sync (triggered by GitHub Actions)