From 91e7d9f52c3b9a1f4f556aed5945c3f9e0ff3578 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 16 Aug 2026 01:03:12 +0000 Subject: [PATCH 1/2] List Cache Core, Flags Core, and published Billing Core. The site catalog still treated Billing as planned and omitted the two new cores. Snapshot them as published 0.1.1 packages, keep 0.x honesty, and prefer that snapshot over stale Stage lines that still say unpublished. Co-authored-by: Fly Over Coder --- AGENTS.md | 7 +- docs/catalog/SCHEMA.md | 6 +- evals/assembly-eval.test.ts | 17 ++++- public/llms.txt | 31 +++++--- src/data/catalog-enrichment.ts | 125 +++++++++++++++++++++++++++++++ src/data/catalog-schema.test.ts | 3 + src/data/catalog-schema.ts | 3 + src/data/compile-catalog.test.ts | 112 ++++++++++++++++++++++++++- src/data/compile-catalog.ts | 15 ++-- src/data/components.ts | 76 ++++++++++++++++++- src/data/live-status.test.ts | 42 +++++++++++ src/data/live-status.ts | 35 ++++++++- src/data/mcp-tools.ts | 6 ++ src/pages/index.astro | 9 ++- 14 files changed, 452 insertions(+), 35 deletions(-) create mode 100644 src/data/live-status.test.ts diff --git a/AGENTS.md b/AGENTS.md index 84be0df..7d57e65 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -52,6 +52,7 @@ Analytics (cookieless) or nothing. ## Reference points The plan is `docs/PROJECT_PLAN.md`. The ecosystem's repos (spine, -storage-core, authorization-core, audit, webhooks, sessions, rate-limit, -support-desk, mail, identity, logger-adapters) are the source of truth for -everything the site says about them. +storage-core, storage-blobs, cache-core, authorization-core, audit, webhooks, +sessions, rate-limit, support-desk, mail, identity, billing-core, flags-core, +logger-adapters) are the source of truth for everything the site says about +them. diff --git a/docs/catalog/SCHEMA.md b/docs/catalog/SCHEMA.md index e80ed18..6f539d2 100644 --- a/docs/catalog/SCHEMA.md +++ b/docs/catalog/SCHEMA.md @@ -115,9 +115,9 @@ CompositionCatalog Structured flags (not free text) so `plan_composition` can stay rule-based: `accounts`, `passkeys`, `email_codes`, `sessions`, `authorization`, `storage`, -`storage_blobs`, `audit`, `mail_transactional`, `rate_limit_durable`, -`rate_limit_memory`, `webhooks_inbound`, `support_queue`, `health`, `logging`, -`events_in_process`, `cloudflare`, `azure`, `static_host`. +`storage_blobs`, `cache`, `flags`, `billing`, `audit`, `mail_transactional`, +`rate_limit_durable`, `rate_limit_memory`, `webhooks_inbound`, `support_queue`, +`health`, `logging`, `events_in_process`, `cloudflare`, `azure`, `static_host`. ## TypeScript source diff --git a/evals/assembly-eval.test.ts b/evals/assembly-eval.test.ts index 7f00bf7..4c97802 100644 --- a/evals/assembly-eval.test.ts +++ b/evals/assembly-eval.test.ts @@ -42,7 +42,22 @@ const EVAL_NPM: Record = { '@pegma/webhooks': '0.1.0', '@pegma/sessions': '0.1.0', '@pegma/mail': '0.1.0', - '@pegma/billing-core': null, + '@pegma/billing-core': '0.1.1', + '@pegma/billing-stripe': '0.1.1', + '@pegma/cache-core': '0.1.1', + '@pegma/cache-conformance': '0.1.1', + '@pegma/cache-redis': '0.1.1', + '@pegma/cache-azure-redis': '0.1.1', + '@pegma/cache-elasticache': '0.1.1', + '@pegma/cache-upstash-redis': '0.1.1', + '@pegma/flags-contracts': '0.1.1', + '@pegma/flags-core': '0.1.1', + '@pegma/flags-static': '0.1.1', + '@pegma/flags-azure-appconfig': '0.1.1', + '@pegma/flags-aws-appconfig': '0.1.1', + '@pegma/flags-cloudflare-flagship': '0.1.1', + '@pegma/flags-flagd': '0.1.1', + '@pegma/flags-launchdarkly': '0.1.1', '@pegma/identity': '0.1.0', '@pegma/rate-limit': '0.1.0', '@pegma/logger-tee': '0.1.1', diff --git a/public/llms.txt b/public/llms.txt index dbcaa3f..61948cb 100644 --- a/public/llms.txt +++ b/public/llms.txt @@ -1,8 +1,8 @@ # Pegma > An MIT-licensed family of composable backend components — storage, -> authorization, identity, audit, webhooks, sessions, rate limiting, billing, mail, -> a support desk — +> authorization, identity, audit, webhooks, sessions, rate limiting, cache, flags, +> billing, mail, a support desk — > designed to be assembled and maintained by AI agents. Early 0.x: some > packages published, none stable. npm scope: @pegma. GitHub: pegma-dev. @@ -34,6 +34,12 @@ reference environment. conditional deletes, bounded authoritative scans, single-partition transactions, and a conformance suite adapters must pass against a real backend. Published as 0.4.0. +- [Cache Core](https://github.com/pegma-dev/cache-core): + @pegma/cache-core, @pegma/cache-conformance, @pegma/cache-redis, + @pegma/cache-azure-redis, @pegma/cache-elasticache, + @pegma/cache-upstash-redis — a cache port and adapters: namespaced keys, + cache-aside getOrCompute, clock-driven TTL, conformance suite. Published + as 0.1.1; 0.x API remains unstable. Optional — not a store. - [Authorization Core](https://github.com/pegma-dev/authorization-core): @pegma/authorization-* (contracts, core, policy, auth0, stripe, storage, tokens, identity) — provider-neutral roles, entitlements, permissions, @@ -59,18 +65,25 @@ reference environment. remains unstable. - [Rate Limit](https://github.com/pegma-dev/rate-limit): @pegma/rate-limit — an honest in-memory tier and a durable fail-closed tier. Published as 0.1.0. +- [Flags Core](https://github.com/pegma-dev/flags-core): + @pegma/flags-contracts, @pegma/flags-core, @pegma/flags-static, + @pegma/flags-azure-appconfig, @pegma/flags-aws-appconfig, + @pegma/flags-cloudflare-flagship, @pegma/flags-flagd, + @pegma/flags-launchdarkly — a flag port and adapters: typed schema, + evaluation context, honest reasons, no authoring UI. Published as 0.1.1; + 0.x API remains unstable. Optional. - [Identity](https://github.com/pegma-dev/identity): @pegma/identity — first-party identity: passkeys-first, email-code fallback, NO passwords (a refusal, not a phase); user records in the host's own storage. Published as 0.1.0 and composed by this site's Cloudflare Worker. - [Billing Core](https://github.com/pegma-dev/billing-core): - @pegma/billing-core — a provider-agnostic subscription ledger maintained - correctly under out-of-order webhook delivery: event-arbitration guard - (watermark + snapshot freshness bound + lifecycle-rank tie-breaking), - drift-repairing reconciliation, declared sticky/first-wins invariants, - single-opportunity checkout reservation. Never sees card data or raw - payloads. Planned; extraction from the reference application scheduled - deliberately. + @pegma/billing-core, @pegma/billing-stripe — a provider-agnostic + subscription ledger maintained correctly under out-of-order webhook + delivery: event-arbitration guard (watermark + snapshot freshness bound + + lifecycle-rank tie-breaking), drift-repairing reconciliation, declared + sticky/first-wins invariants, single-opportunity checkout reservation. + Never sees card data or raw payloads. Not a payment processor. Published + as 0.1.1; 0.x API remains unstable. Optional. - [Mail](https://github.com/pegma-dev/mail): @pegma/mail — transactional mail: provider ports and an outbox pattern that owns NO store (jobs commit in the caller's transaction, the audit precedent). Published as diff --git a/src/data/catalog-enrichment.ts b/src/data/catalog-enrichment.ts index 8c18d25..3f38079 100644 --- a/src/data/catalog-enrichment.ts +++ b/src/data/catalog-enrichment.ts @@ -90,6 +90,48 @@ export const COMPONENT_ENRICHMENT: Readonly> // Distinct from record `storage` so generic storage plans do not pull R2/Blob. capabilityTags: ['storage_blobs', 'cloudflare', 'azure'], }, + 'cache-core': { + dependencies: [ + { componentId: 'spine', kind: 'requires', note: 'Injected Clock and Logger' }, + ], + adapters: [ + { + id: 'memory', + packageName: '@pegma/cache-core', + host: 'memory', + when: 'Tests and local sketches; not a durability claim', + }, + { + id: 'redis', + packageName: '@pegma/cache-redis', + host: 'other', + when: 'Generic Redis (ioredis) behind the cache port', + }, + { + id: 'azure-redis', + packageName: '@pegma/cache-azure-redis', + host: 'azure', + when: 'Azure Cache for Redis; thin composition of cache-redis', + }, + { + id: 'elasticache', + packageName: '@pegma/cache-elasticache', + host: 'other', + when: 'Amazon ElastiCache; thin composition of cache-redis', + }, + { + id: 'upstash-redis', + packageName: '@pegma/cache-upstash-redis', + host: 'other', + when: 'Upstash Redis REST client behind the same port', + }, + ], + hostMustProvide: [ + 'Chosen adapter binding (Redis URL, Azure cache, ElastiCache, Upstash, or memory)', + 'Explicit fail-open vs fail-closed policy — fail-open computes, it does not accumulate', + ], + capabilityTags: ['cache', 'azure'], + }, 'authorization-core': { dependencies: [ { componentId: 'spine', kind: 'requires' }, @@ -176,6 +218,40 @@ export const COMPONENT_ENRICHMENT: Readonly> ], capabilityTags: ['mail_transactional'], }, + 'billing-core': { + dependencies: [ + { componentId: 'spine', kind: 'requires' }, + { + componentId: 'storage-core', + kind: 'requires', + note: 'Ledger collections over an injected Store', + }, + { + componentId: 'webhooks', + kind: 'composes_with', + note: 'Receipt dedup; this ledger owns ordering, not delivery identity', + }, + { + componentId: 'authorization-core', + kind: 'composes_with', + note: 'What a subscription grants is Authorization Core; this is what it is', + }, + ], + adapters: [ + { + id: 'stripe', + packageName: '@pegma/billing-stripe', + host: 'other', + when: 'Stripe event and subscription snapshot translation; host verifies signatures', + }, + ], + hostMustProvide: [ + 'Storage binding for the ledger', + 'Provider checkout/portal flows — this package is not a payment processor', + 'Webhook authenticity (signature verification stays with the host)', + ], + capabilityTags: ['billing'], + }, identity: { dependencies: [ { componentId: 'spine', kind: 'requires' }, @@ -225,6 +301,55 @@ export const COMPONENT_ENRICHMENT: Readonly> ], capabilityTags: ['rate_limit_durable', 'rate_limit_memory'], }, + 'flags-core': { + dependencies: [ + { componentId: 'spine', kind: 'requires', note: 'Injected Clock and Logger' }, + ], + adapters: [ + { + id: 'static', + packageName: '@pegma/flags-static', + host: 'memory', + when: 'Tests and local development; in-memory map, not a control plane', + }, + { + id: 'azure-appconfig', + packageName: '@pegma/flags-azure-appconfig', + host: 'azure', + when: 'Azure App Configuration; adapter translates, does not evaluate targeting rules', + }, + { + id: 'aws-appconfig', + packageName: '@pegma/flags-aws-appconfig', + host: 'other', + when: 'AWS AppConfig; already-evaluated values only', + }, + { + id: 'cloudflare-flagship', + packageName: '@pegma/flags-cloudflare-flagship', + host: 'cloudflare', + when: 'Cloudflare Flagship; already-evaluated *Details results', + }, + { + id: 'flagd', + packageName: '@pegma/flags-flagd', + host: 'other', + when: 'flagd / OpenFeature detail translation', + }, + { + id: 'launchdarkly', + packageName: '@pegma/flags-launchdarkly', + host: 'other', + when: 'LaunchDarkly adapter; no vendor SDK in application code', + }, + ], + hostMustProvide: [ + 'A constructed client at the composition root — no ambient getClient()', + 'EvaluationContext (targeting key; optional principal, tenant, environment)', + 'Chosen provider adapter; the provider owns targeting rules', + ], + capabilityTags: ['flags', 'cloudflare', 'azure'], + }, 'logger-adapters': { dependencies: [ { componentId: 'spine', kind: 'requires', note: 'Implements Spine Logger' }, diff --git a/src/data/catalog-schema.test.ts b/src/data/catalog-schema.test.ts index 1c927b0..94dc43e 100644 --- a/src/data/catalog-schema.test.ts +++ b/src/data/catalog-schema.test.ts @@ -57,6 +57,9 @@ const CAPABILITY_TAGS = new Set([ 'authorization', 'storage', 'storage_blobs', + 'cache', + 'flags', + 'billing', 'audit', 'mail_transactional', 'rate_limit_durable', diff --git a/src/data/catalog-schema.ts b/src/data/catalog-schema.ts index 636bd62..1808f2c 100644 --- a/src/data/catalog-schema.ts +++ b/src/data/catalog-schema.ts @@ -56,6 +56,9 @@ export type CapabilityTag = | 'storage' /** Opaque object/blob bytes (storage-blobs); distinct from record storage. */ | 'storage_blobs' + | 'cache' + | 'flags' + | 'billing' | 'audit' | 'mail_transactional' | 'rate_limit_durable' diff --git a/src/data/compile-catalog.test.ts b/src/data/compile-catalog.test.ts index 73cc519..a076c90 100644 --- a/src/data/compile-catalog.test.ts +++ b/src/data/compile-catalog.test.ts @@ -4,7 +4,7 @@ import { compileCompositionCatalog, } from './compile-catalog'; import { CATALOG_SCHEMA_VERSION } from './catalog-schema'; -import { components } from './components'; +import { components, SNAPSHOT_DATE } from './components'; import { RECIPE_BACKLOG } from './recipe-backlog'; const FIXED_AT = '2026-07-29T00:00:00.000Z'; @@ -31,6 +31,41 @@ function compile(npm: Record) { } describe('compileCompositionCatalog', () => { + it('lists sixteen registry components including published cache, flags, and billing', () => { + expect(SNAPSHOT_DATE).toBe('2026-08-15'); + expect(components).toHaveLength(16); + const byRepo = Object.fromEntries(components.map((c) => [c.repo, c])); + expect(byRepo['cache-core']?.status).toBe('published'); + expect(byRepo['cache-core']?.packages).toEqual([ + '@pegma/cache-core', + '@pegma/cache-conformance', + '@pegma/cache-redis', + '@pegma/cache-azure-redis', + '@pegma/cache-elasticache', + '@pegma/cache-upstash-redis', + ]); + expect(byRepo['flags-core']?.status).toBe('published'); + expect(byRepo['flags-core']?.packages).toEqual([ + '@pegma/flags-contracts', + '@pegma/flags-core', + '@pegma/flags-static', + '@pegma/flags-azure-appconfig', + '@pegma/flags-aws-appconfig', + '@pegma/flags-cloudflare-flagship', + '@pegma/flags-flagd', + '@pegma/flags-launchdarkly', + ]); + expect(byRepo['billing-core']?.status).toBe('published'); + expect(byRepo['billing-core']?.packages).toEqual([ + '@pegma/billing-core', + '@pegma/billing-stripe', + ]); + expect(byRepo['billing-core']?.now).toMatch(/0\.1\.1/); + expect(byRepo['billing-core']?.now).not.toMatch(/unpublished|nothing extracted|planned/i); + expect(byRepo['cache-core']?.now).not.toMatch(/unpublished/i); + expect(byRepo['flags-core']?.now).not.toMatch(/unpublished/i); + }); + it('emits schema 0.1.0 with one entry per registry component', async () => { clearNpmVersionCache(); const catalog = await compile({ @@ -138,4 +173,79 @@ describe('compileCompositionCatalog', () => { ); expect(storage.capabilityTags).toContain('storage'); }); + + it('drops stale unpublished Stage text when the snapshot is already published', async () => { + clearNpmVersionCache(); + const catalog = await compileCompositionCatalog({ + generatedAt: FIXED_AT, + stageByRepo: { + ...NO_STAGES, + 'cache-core': + 'Phase 5 — Upstash Redis adapter, in-tree, unpublished. Packages are 0.1.1 and not published.', + 'flags-core': + 'Phase 3 vendor adapters implemented in-tree; unpublished. Public API unstable (0.x).', + 'billing-core': + 'Phase 4 — Stripe adapter in-tree. Nothing is published. (0.1.1, unpublished.)', + }, + npmLookup: fakeNpm({ + '@pegma/cache-core': '0.1.1', + '@pegma/cache-conformance': '0.1.1', + '@pegma/cache-redis': '0.1.1', + '@pegma/cache-azure-redis': '0.1.1', + '@pegma/cache-elasticache': '0.1.1', + '@pegma/cache-upstash-redis': '0.1.1', + '@pegma/flags-contracts': '0.1.1', + '@pegma/flags-core': '0.1.1', + '@pegma/flags-static': '0.1.1', + '@pegma/flags-azure-appconfig': '0.1.1', + '@pegma/flags-aws-appconfig': '0.1.1', + '@pegma/flags-cloudflare-flagship': '0.1.1', + '@pegma/flags-flagd': '0.1.1', + '@pegma/flags-launchdarkly': '0.1.1', + '@pegma/billing-core': '0.1.1', + '@pegma/billing-stripe': '0.1.1', + }), + }); + + expect(catalog.snapshotDate).toBe('2026-08-15'); + expect(catalog.components).toHaveLength(16); + + for (const id of ['cache-core', 'flags-core', 'billing-core'] as const) { + const entry = catalog.components.find((c) => c.id === id)!; + expect(entry.status).toBe('published'); + expect(entry.stage).toBeUndefined(); + expect(entry.now).toBeDefined(); + expect(entry.now).not.toMatch(/unpublished/i); + expect(entry.publishUsability).toBe('usable'); + expect(entry.packages.every((p) => p.published && p.version === '0.1.1')).toBe( + true, + ); + } + + const billing = catalog.components.find((c) => c.id === 'billing-core')!; + expect(billing.packages.map((p) => p.name)).toEqual([ + '@pegma/billing-core', + '@pegma/billing-stripe', + ]); + expect(billing.capabilityTags).toContain('billing'); + + const cache = catalog.components.find((c) => c.id === 'cache-core')!; + expect(cache.adapters.map((a) => a.id)).toEqual( + expect.arrayContaining(['memory', 'redis', 'azure-redis', 'elasticache', 'upstash-redis']), + ); + expect(cache.capabilityTags).toContain('cache'); + + const flags = catalog.components.find((c) => c.id === 'flags-core')!; + expect(flags.adapters.map((a) => a.id)).toEqual( + expect.arrayContaining([ + 'static', + 'azure-appconfig', + 'aws-appconfig', + 'cloudflare-flagship', + 'flagd', + 'launchdarkly', + ]), + ); + expect(flags.capabilityTags).toContain('flags'); + }); }); diff --git a/src/data/compile-catalog.ts b/src/data/compile-catalog.ts index af4ea04..3313c8d 100644 --- a/src/data/compile-catalog.ts +++ b/src/data/compile-catalog.ts @@ -12,7 +12,7 @@ import { components, SNAPSHOT_DATE, type ComponentStatus } from './components'; import { enrichmentFor } from './catalog-enrichment'; import { RECIPE_BACKLOG } from './recipe-backlog'; -import { compileComponentStatus } from './live-status'; +import { compileComponentStatus, resolveCompiledStage } from './live-status'; import { CATALOG_SCHEMA_VERSION, type CatalogComponent, @@ -130,12 +130,13 @@ export async function compileCompositionCatalog( const compiled = options.stageByRepo !== undefined - ? components.map((component) => ({ - ...component, - stage: options.stageByRepo![component.repo] ?? null, - // Keep registry status when stages are injected (tests). - status: component.status, - })) + ? components.map((component) => { + const { status, stage } = resolveCompiledStage( + component.status, + options.stageByRepo![component.repo] ?? null, + ); + return { ...component, stage, status }; + }) : await Promise.all(components.map(compileComponentStatus)); const catalogComponents: CatalogComponent[] = []; diff --git a/src/data/components.ts b/src/data/components.ts index 1a3edde..21e05de 100644 --- a/src/data/components.ts +++ b/src/data/components.ts @@ -3,6 +3,11 @@ * snapshot. Build-time aggregation adds the Stage paragraph from each * repository's docs/PROJECT_PLAN.md when available; pages prefer that `stage` * field over `now`, so these facts stay useful during a fetch failure. + * + * Exception: when this snapshot marks a component `published` and the fetched + * Stage line still says unpublished, compile drops the Stage text and keeps + * the snapshot `now` (cache-core, flags-core, and billing-core until those + * plans are updated). */ export type ComponentStatus = 'published' | 'in development' | 'planned'; @@ -26,7 +31,7 @@ export interface PegmaComponent { readonly plan?: string; } -export const SNAPSHOT_DATE = '2026-07-29'; +export const SNAPSHOT_DATE = '2026-08-15'; export const components: readonly PegmaComponent[] = [ { @@ -97,6 +102,36 @@ export const components: readonly PegmaComponent[] = [ now: '0.1.2 on npm with Azure Blob, R2, and S3 adapters; first consumer planned is Support Desk attachments.', plan: 'docs/PROJECT_PLAN.md', }, + { + repo: 'cache-core', + title: 'Cache Core', + packages: [ + '@pegma/cache-core', + '@pegma/cache-conformance', + '@pegma/cache-redis', + '@pegma/cache-azure-redis', + '@pegma/cache-elasticache', + '@pegma/cache-upstash-redis', + ], + status: 'published', + summary: + 'A cache port and adapters: ephemeral getOrCompute, namespaced keys, clock-driven TTL.', + owns: [ + 'Strict key namespacing with schema-aware codecs (JSON and binary)', + 'Cache-aside getOrCompute with single-flight coalescing and optional probabilistic early expiration (XFetch)', + 'Sliding and absolute TTL via an injected Spine Clock', + 'Fail-open / fail-closed fallback policies', + 'A conformance suite every adapter must pass', + ], + refuses: [ + 'Durability guarantees — durable state belongs in @pegma/storage-core', + 'Implicit cross-partition multi-key ops; Redis Cluster hash tags are in the contract', + 'Unbounded local memory fallbacks when a remote cache is down', + 'Vendor clients leaking into application code', + ], + now: '0.1.1 on npm with Redis, Azure Cache for Redis, ElastiCache, and Upstash adapters; 0.x API remains unstable.', + plan: 'docs/PROJECT_PLAN.md', + }, { repo: 'authorization-core', title: 'Authorization Core', @@ -233,8 +268,8 @@ export const components: readonly PegmaComponent[] = [ { repo: 'billing-core', title: 'Billing Core', - packages: ['@pegma/billing-core'], - status: 'planned', + packages: ['@pegma/billing-core', '@pegma/billing-stripe'], + status: 'published', summary: 'A provider-agnostic subscription ledger, maintained correctly under out-of-order webhook delivery.', owns: [ @@ -247,7 +282,7 @@ export const components: readonly PegmaComponent[] = [ 'Entitlement resolution — what a subscription grants is Authorization Core’s job; this is what it is', 'Card data, raw payloads, line items, amounts — the ledger stores identifiers and derived state only', ], - now: 'Plan published; extraction from the reference application’s production ledger is scheduled deliberately.', + now: '0.1.1 on npm with @pegma/billing-core and @pegma/billing-stripe; a subscription ledger, not a payment processor. 0.x API remains unstable.', plan: 'docs/PROJECT_PLAN.md', }, { @@ -289,6 +324,39 @@ export const components: readonly PegmaComponent[] = [ now: '0.1.1 on npm; durable fixed-window policies are composed by the production Identity worker.', plan: 'docs/PROJECT_PLAN.md', }, + { + repo: 'flags-core', + title: 'Flags Core', + packages: [ + '@pegma/flags-contracts', + '@pegma/flags-core', + '@pegma/flags-static', + '@pegma/flags-azure-appconfig', + '@pegma/flags-aws-appconfig', + '@pegma/flags-cloudflare-flagship', + '@pegma/flags-flagd', + '@pegma/flags-launchdarkly', + ], + status: 'published', + summary: + 'A flag port and adapters: typed evaluation, honest reasons, no authoring UI.', + owns: [ + 'Typed flag schema (declareFlags / flag.boolean|string|number|json)', + 'Standardized EvaluationContext and EvaluationDetail', + 'Local snapshot / TTL cache with stale-while-revalidate', + 'A conformance suite every adapter must pass', + 'Ports for Spine Logger, Clock, and a health probe helper', + ], + refuses: [ + 'Flag authoring or a control-plane UI (@pegma/flags-storage is not in scope)', + 'A custom rule or expression language', + 'Global singletons or ambient request context', + 'Blocking synchronous network on the request path', + 'Returning a default without a log line and an evaluation reason', + ], + now: '0.1.1 on npm with static, Azure App Configuration, AWS AppConfig, Cloudflare Flagship, flagd, and LaunchDarkly adapters; 0.x API remains unstable.', + plan: 'docs/PROJECT_PLAN.md', + }, { repo: 'logger-adapters', title: 'Logger Adapters', diff --git a/src/data/live-status.test.ts b/src/data/live-status.test.ts new file mode 100644 index 0000000..b59ee98 --- /dev/null +++ b/src/data/live-status.test.ts @@ -0,0 +1,42 @@ +import { describe, expect, it } from 'vitest'; +import { resolveCompiledStage, stageClaimsUnpublished } from './live-status'; + +describe('resolveCompiledStage', () => { + it('drops a stale unpublished Stage when the snapshot is already published', () => { + const stale = + 'Phase 4 — Stripe adapter in-tree. Nothing is published. (0.1.1, unpublished.)'; + expect(stageClaimsUnpublished(stale)).toBe(true); + expect(resolveCompiledStage('published', stale)).toEqual({ + status: 'published', + stage: null, + }); + expect( + resolveCompiledStage( + 'published', + 'Phase 5 — Upstash Redis adapter, in-tree, unpublished.', + ), + ).toEqual({ status: 'published', stage: null }); + expect( + resolveCompiledStage( + 'published', + 'Phase 3 vendor adapters implemented in-tree; unpublished.', + ), + ).toEqual({ status: 'published', stage: null }); + }); + + it('keeps a published Stage paragraph when it does not claim unpublished', () => { + const stage = '0.1.1 on npm; trusted publishing configured.'; + expect(stageClaimsUnpublished(stage)).toBe(false); + expect(resolveCompiledStage('published', stage)).toEqual({ + status: 'published', + stage, + }); + }); + + it('still marks in-development when the snapshot is not published', () => { + expect(resolveCompiledStage('in development', 'in-tree, unpublished')).toEqual({ + status: 'in development', + stage: 'in-tree, unpublished', + }); + }); +}); diff --git a/src/data/live-status.ts b/src/data/live-status.ts index 7ecc0df..bade8c1 100644 --- a/src/data/live-status.ts +++ b/src/data/live-status.ts @@ -59,11 +59,23 @@ export function planStage(repo: string, plan: string | undefined): Promise { - const stage = await planStage(component.repo, component.plan); + const fetched = await planStage(component.repo, component.plan); + const { status, stage } = resolveCompiledStage(component.status, fetched); return { ...component, stage, - status: statusFromStage(stage, component.status), + status, }; } diff --git a/src/data/mcp-tools.ts b/src/data/mcp-tools.ts index 1583d1b..32fe4d2 100644 --- a/src/data/mcp-tools.ts +++ b/src/data/mcp-tools.ts @@ -109,6 +109,9 @@ const EXCLUSIVE_TAGS = new Set([ 'webhooks_inbound', 'support_queue', 'storage_blobs', + 'cache', + 'flags', + 'billing', 'rate_limit_durable', 'rate_limit_memory', ]); @@ -706,6 +709,9 @@ export const CAPABILITY_TAGS = [ 'authorization', 'storage', 'storage_blobs', + 'cache', + 'flags', + 'billing', 'audit', 'mail_transactional', 'rate_limit_durable', diff --git a/src/pages/index.astro b/src/pages/index.astro index 52e63a4..f003d17 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -8,14 +8,15 @@ const withCompiledStatus = await Promise.all(components.map(compileComponentStat

A framework fastened together.

- Pegma is an MIT-licensed family of backend components — storage, sessions, audit, health - probes, structured logging — that a host application composes. Independent packages, one set - of shared contracts, and honest limits stated up front. + Pegma is an MIT-licensed family of backend components — storage, sessions, audit, cache, + flags, a subscription ledger, health probes, structured logging — that a host application + composes. Independent packages, one set of shared contracts, and honest limits stated up + front.

Use Pegma with your coding agent From d39f745748ced59832bcd3c1edae9014f413d797 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 16 Aug 2026 01:53:27 +0000 Subject: [PATCH 2/2] Let fetched PROJECT_PLAN Stage lines win. Remove the compile override that discarded a successful Stage fetch when the plan still said unpublished. Repository plans remain the roadmap authority; sibling docs PRs update those Stage lines. Keep leftover unpublished-phrase detection honest: "Nothing is published" counts as unpublished and must not match the positive "is published" signal. Co-authored-by: Fly Over Coder --- src/data/compile-catalog.test.ts | 43 ++++++++--------- src/data/compile-catalog.ts | 13 +++--- src/data/components.ts | 6 +-- src/data/live-status.test.ts | 79 ++++++++++++++++++++------------ src/data/live-status.ts | 54 +++++++++------------- 5 files changed, 99 insertions(+), 96 deletions(-) diff --git a/src/data/compile-catalog.test.ts b/src/data/compile-catalog.test.ts index a076c90..d40d40e 100644 --- a/src/data/compile-catalog.test.ts +++ b/src/data/compile-catalog.test.ts @@ -174,18 +174,21 @@ describe('compileCompositionCatalog', () => { expect(storage.capabilityTags).toContain('storage'); }); - it('drops stale unpublished Stage text when the snapshot is already published', async () => { + it('keeps a fetched unpublished Stage paragraph instead of forcing the snapshot', async () => { clearNpmVersionCache(); + const cacheStage = + 'Phase 5 — Upstash Redis adapter, in-tree, unpublished. Packages are 0.1.1 and not published.'; + const flagsStage = + 'Phase 3 vendor adapters implemented in-tree; unpublished. Public API unstable (0.x).'; + const billingStage = + 'Phase 4 — Stripe adapter in-tree. Nothing is published. (0.1.1, unpublished.)'; const catalog = await compileCompositionCatalog({ generatedAt: FIXED_AT, stageByRepo: { ...NO_STAGES, - 'cache-core': - 'Phase 5 — Upstash Redis adapter, in-tree, unpublished. Packages are 0.1.1 and not published.', - 'flags-core': - 'Phase 3 vendor adapters implemented in-tree; unpublished. Public API unstable (0.x).', - 'billing-core': - 'Phase 4 — Stripe adapter in-tree. Nothing is published. (0.1.1, unpublished.)', + 'cache-core': cacheStage, + 'flags-core': flagsStage, + 'billing-core': billingStage, }, npmLookup: fakeNpm({ '@pegma/cache-core': '0.1.1', @@ -210,32 +213,26 @@ describe('compileCompositionCatalog', () => { expect(catalog.snapshotDate).toBe('2026-08-15'); expect(catalog.components).toHaveLength(16); - for (const id of ['cache-core', 'flags-core', 'billing-core'] as const) { - const entry = catalog.components.find((c) => c.id === id)!; - expect(entry.status).toBe('published'); - expect(entry.stage).toBeUndefined(); - expect(entry.now).toBeDefined(); - expect(entry.now).not.toMatch(/unpublished/i); - expect(entry.publishUsability).toBe('usable'); - expect(entry.packages.every((p) => p.published && p.version === '0.1.1')).toBe( - true, - ); - } - + const cache = catalog.components.find((c) => c.id === 'cache-core')!; + const flags = catalog.components.find((c) => c.id === 'flags-core')!; const billing = catalog.components.find((c) => c.id === 'billing-core')!; + + expect(cache.stage).toBe(cacheStage); + expect(flags.stage).toBe(flagsStage); + expect(billing.stage).toBe(billingStage); + expect(cache.status).toBe('in_development'); + expect(flags.status).toBe('in_development'); + expect(billing.status).toBe('in_development'); + expect(billing.publishUsability).toBe('usable'); expect(billing.packages.map((p) => p.name)).toEqual([ '@pegma/billing-core', '@pegma/billing-stripe', ]); expect(billing.capabilityTags).toContain('billing'); - - const cache = catalog.components.find((c) => c.id === 'cache-core')!; expect(cache.adapters.map((a) => a.id)).toEqual( expect.arrayContaining(['memory', 'redis', 'azure-redis', 'elasticache', 'upstash-redis']), ); expect(cache.capabilityTags).toContain('cache'); - - const flags = catalog.components.find((c) => c.id === 'flags-core')!; expect(flags.adapters.map((a) => a.id)).toEqual( expect.arrayContaining([ 'static', diff --git a/src/data/compile-catalog.ts b/src/data/compile-catalog.ts index 3313c8d..e8cdd86 100644 --- a/src/data/compile-catalog.ts +++ b/src/data/compile-catalog.ts @@ -12,7 +12,7 @@ import { components, SNAPSHOT_DATE, type ComponentStatus } from './components'; import { enrichmentFor } from './catalog-enrichment'; import { RECIPE_BACKLOG } from './recipe-backlog'; -import { compileComponentStatus, resolveCompiledStage } from './live-status'; +import { compileComponentStatus, statusFromStage } from './live-status'; import { CATALOG_SCHEMA_VERSION, type CatalogComponent, @@ -131,11 +131,12 @@ export async function compileCompositionCatalog( const compiled = options.stageByRepo !== undefined ? components.map((component) => { - const { status, stage } = resolveCompiledStage( - component.status, - options.stageByRepo![component.repo] ?? null, - ); - return { ...component, stage, status }; + const stage = options.stageByRepo![component.repo] ?? null; + return { + ...component, + stage, + status: statusFromStage(stage, component.status), + }; }) : await Promise.all(components.map(compileComponentStatus)); const catalogComponents: CatalogComponent[] = []; diff --git a/src/data/components.ts b/src/data/components.ts index 21e05de..e5bb27b 100644 --- a/src/data/components.ts +++ b/src/data/components.ts @@ -3,11 +3,7 @@ * snapshot. Build-time aggregation adds the Stage paragraph from each * repository's docs/PROJECT_PLAN.md when available; pages prefer that `stage` * field over `now`, so these facts stay useful during a fetch failure. - * - * Exception: when this snapshot marks a component `published` and the fetched - * Stage line still says unpublished, compile drops the Stage text and keeps - * the snapshot `now` (cache-core, flags-core, and billing-core until those - * plans are updated). + * Fetched plans win disagreements; do not discard a successful Stage fetch. */ export type ComponentStatus = 'published' | 'in development' | 'planned'; diff --git a/src/data/live-status.test.ts b/src/data/live-status.test.ts index b59ee98..b787e17 100644 --- a/src/data/live-status.test.ts +++ b/src/data/live-status.test.ts @@ -1,42 +1,61 @@ import { describe, expect, it } from 'vitest'; -import { resolveCompiledStage, stageClaimsUnpublished } from './live-status'; +import { stageClaimsUnpublished, statusFromStage } from './live-status'; -describe('resolveCompiledStage', () => { - it('drops a stale unpublished Stage when the snapshot is already published', () => { - const stale = - 'Phase 4 — Stripe adapter in-tree. Nothing is published. (0.1.1, unpublished.)'; - expect(stageClaimsUnpublished(stale)).toBe(true); - expect(resolveCompiledStage('published', stale)).toEqual({ - status: 'published', - stage: null, - }); +describe('stageClaimsUnpublished', () => { + it('treats unpublished, not published, and Nothing is published as unpublished', () => { + expect(stageClaimsUnpublished('in-tree, unpublished.')).toBe(true); + expect(stageClaimsUnpublished('0.1.1 and not published')).toBe(true); + expect(stageClaimsUnpublished('Nothing is published. (0.1.1, unpublished.)')).toBe( + true, + ); + expect(stageClaimsUnpublished('Phase 4 — Stripe adapter in-tree. Nothing is published.')).toBe( + true, + ); + }); + + it('does not treat a real publish line as unpublished', () => { + expect(stageClaimsUnpublished('0.1.1 on npm; trusted publishing configured.')).toBe( + false, + ); + expect(stageClaimsUnpublished('The 0.1.0 package set is published on npm.')).toBe( + false, + ); + }); +}); + +describe('statusFromStage', () => { + it('does not treat Nothing is published as a positive publish signal', () => { + expect(statusFromStage('Nothing is published.', 'published')).toBe( + 'in development', + ); expect( - resolveCompiledStage( + statusFromStage( + 'Phase 4 — Stripe adapter in-tree. Nothing is published. (0.1.1, unpublished.)', 'published', - 'Phase 5 — Upstash Redis adapter, in-tree, unpublished.', ), - ).toEqual({ status: 'published', stage: null }); + ).toBe('in development'); + }); + + it('keeps a successfully fetched unpublished Stage as in-development when the snapshot is published', () => { expect( - resolveCompiledStage( - 'published', - 'Phase 3 vendor adapters implemented in-tree; unpublished.', - ), - ).toEqual({ status: 'published', stage: null }); + statusFromStage('Phase 5 — Upstash Redis adapter, in-tree, unpublished.', 'published'), + ).toBe('in development'); + expect( + statusFromStage('Phase 3 vendor adapters implemented in-tree; unpublished.', 'published'), + ).toBe('in development'); }); - it('keeps a published Stage paragraph when it does not claim unpublished', () => { - const stage = '0.1.1 on npm; trusted publishing configured.'; - expect(stageClaimsUnpublished(stage)).toBe(false); - expect(resolveCompiledStage('published', stage)).toEqual({ - status: 'published', - stage, - }); + it('maps honest publish phrasing to published', () => { + expect(statusFromStage('0.1.1 on npm; trusted publishing configured.', 'planned')).toBe( + 'published', + ); + expect( + statusFromStage('The 0.1.0 package set is published on npm from a signed tag.', 'in development'), + ).toBe('published'); }); - it('still marks in-development when the snapshot is not published', () => { - expect(resolveCompiledStage('in development', 'in-tree, unpublished')).toEqual({ - status: 'in development', - stage: 'in-tree, unpublished', - }); + it('falls back when there is no Stage paragraph', () => { + expect(statusFromStage(null, 'published')).toBe('published'); + expect(statusFromStage(null, 'planned')).toBe('planned'); }); }); diff --git a/src/data/live-status.ts b/src/data/live-status.ts index bade8c1..0e9d083 100644 --- a/src/data/live-status.ts +++ b/src/data/live-status.ts @@ -59,28 +59,35 @@ export function planStage(repo: string, plan: string | undefined): Promise { - const fetched = await planStage(component.repo, component.plan); - const { status, stage } = resolveCompiledStage(component.status, fetched); + const stage = await planStage(component.repo, component.plan); return { ...component, stage, - status, + status: statusFromStage(stage, component.status), }; }