{"_id":"@a0n/aeon-flags","_rev":"2-bc597434bdfb837402790321a6029339","name":"@a0n/aeon-flags","dist-tags":{"latest":"5.0.0"},"versions":{"5.0.0":{"name":"@a0n/aeon-flags","version":"5.0.0","author":{"url":"https://buley.fyi","name":"Taylor William Buley"},"license":"MIT","_id":"@a0n/aeon-flags@5.0.0","maintainers":[{"name":"buley","email":"buley@outlook.com"}],"dist":{"shasum":"3a538dd03ce54b6324b3c18bc942feac6d725423","tarball":"https://registry.npmjs.org/@a0n/aeon-flags/-/aeon-flags-5.0.0.tgz","fileCount":17,"integrity":"sha512-/BERxQCZzRuqSWDe4CW3w6ufEqZeN0P+i8b9m5ZlPxtK+10t8m9NTHcs7av6bvNI9fdH+CFR/ovhq47JCb3+jw==","signatures":[{"sig":"MEUCIQChbkQwTkxWZ7a4aOd0Z5Q0cq6icstQlyfvp+O1B+CWAwIgaqLtgIZT/gUgtgzamblcP/mybWdiD7OFIakAbMx1JXk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24433},"main":"dist/index.js","type":"module","_from":"file:a0n-aeon-flags-5.0.0.tgz","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./esi":{"types":"./dist/esi.d.ts","import":"./dist/esi.js"},"./react":{"types":"./dist/react.d.ts","import":"./dist/react.js"}},"scripts":{"dev":"tsc -w","test":"bun test --coverage","build":"tsc"},"_npmUser":{"name":"buley","email":"buley@outlook.com"},"_resolved":"/private/var/folders/kf/tkq8cmd54fl9c1wh414dj3240000gn/T/dc1b629af657fad41e6c580a341505de/a0n-aeon-flags-5.0.0.tgz","_integrity":"sha512-/BERxQCZzRuqSWDe4CW3w6ufEqZeN0P+i8b9m5ZlPxtK+10t8m9NTHcs7av6bvNI9fdH+CFR/ovhq47JCb3+jw==","_npmVersion":"11.11.0","description":"UCAN-powered Feature Flags with optional Edge Side Inference (ESI) cache and Tier gating. A lightweight alternative to CloudBees and LaunchDarkly.","directories":{},"_nodeVersion":"25.8.0","_hasShrinkwrap":false,"devDependencies":{"react":"^19.2.4","react-dom":"^19.2.4","typescript":"^5.7.0","@types/react":"^19.2.14","@types/react-dom":"^19.2.3"},"peerDependencies":{"@a0n/aeon-flux":"5.0.1"},"peerDependenciesMeta":{"@a0n/aeon-flux":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/aeon-flags_5.0.0_1773802307988_0.17299962628316523","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package is deprecated and no longer supported. Do not use."}},"time":{"created":"2026-03-18T02:51:47.828Z","modified":"2026-03-27T20:49:08.162Z","5.0.0":"2026-03-18T02:51:48.134Z"},"author":{"url":"https://buley.fyi","name":"Taylor William Buley"},"license":"MIT","description":"UCAN-powered Feature Flags with optional Edge Side Inference (ESI) cache and Tier gating. A lightweight alternative to CloudBees and LaunchDarkly.","maintainers":[{"name":"buley","email":"buley@outlook.com"}],"readme":"# @a0n/aeon-flags\n\n`@a0n/aeon-flags` is a local feature-flag evaluator with optional UCAN-aware gating, React helpers, and edge-friendly output.\n\nThe project nickname is **Goodchild**, but the product story is simple: evaluate flags close to the app, keep rollout logic deterministic, and make it easy to hide or show UI without waiting on a hosted flag service round-trip.\n\n## Why People May Like It\n\n- flags can be evaluated locally instead of waiting on a remote check,\n- rules support tiers, rollout percentages, and custom matching,\n- UCAN tokens can contribute context or explicitly force a flag on or off,\n- pre-resolved verified auth context can be consumed directly on the hot path, avoiding UCAN reparsing after ingress,\n- the React package gives you `GoodchildProvider`, `useFlag`, and `Guard`,\n- and the ESI helpers can turn flag decisions into edge-rendered HTML branches.\n\nThat is the package's strongest fair brag: it is small, but it already covers plain TypeScript use, React use, and edge-rendered use.\n\n## Install\n\n```bash\nbun add @a0n/aeon-flags\n```\n\n## Quick Start\n\n```ts\nimport { FlagManager } from '@a0n/aeon-flags';\n\nconst flags = new FlagManager([\n  {\n    id: 'experimental-ui',\n    enabled: true,\n    rules: [\n      { tiers: ['premium', 'enterprise'] },\n      { rolloutPercentage: 50 },\n    ],\n  },\n]);\n\nconst isEnabled = flags.evaluate('experimental-ui', {\n  context: { userId: 'user-123', tier: 'premium' },\n});\n```\n\n## What The Rules Can Do\n\n- turn a flag on or off globally,\n- limit a flag to certain account tiers,\n- roll it out to a percentage of users,\n- run custom match logic against local context,\n- and accept UCAN-derived context when you have it.\n\nIf a UCAN includes an explicit capability for a flag, the manager can force that flag on or off immediately.\n\n## React Helpers\n\n```tsx\nimport { GoodchildProvider, Guard } from '@a0n/aeon-flags/react';\n\nfunction App() {\n  return (\n    <GoodchildProvider manager={flags} context={{ tier: 'free' }}>\n      <Dashboard />\n    </GoodchildProvider>\n  );\n}\n\nfunction Dashboard() {\n  return (\n    <main>\n      <h1>Dashboard</h1>\n      <Guard flag=\"experimental-ui\" fallback={<p>Upgrade to Pro to see this feature</p>}>\n        <ExperimentalProWidget />\n      </Guard>\n    </main>\n  );\n}\n```\n\nThat is one of the nicest things about the package: you can keep the flag logic out of your rendering code and let `Guard` handle the decision cleanly.\n\n## Edge And ESI\n\nThe manager can generate a simple variable map for edge rendering:\n\n```ts\nconst esiVars = flags.generateESIVariables({\n  context: { userId: 'user-123', tier: 'premium' },\n});\n```\n\nAnd the ESI helper can turn that into a branchable tag:\n\n```ts\nimport { generateESIFlagTag } from '@a0n/aeon-flags/esi';\n\nconst html = generateESIFlagTag(\n  'experimental-ui',\n  '<div>Enabled branch</div>',\n  '<div>Fallback branch</div>'\n);\n```\n\n## Export Surface\n\n- `@a0n/aeon-flags`: `FlagManager`, UCAN helpers, core types, and canned ice-policy helpers\n- `@a0n/aeon-flags/react`: provider, hooks, and `Guard`\n- `@a0n/aeon-flags/esi`: ESI tag helper\n\n## Why This README Is Grounded\n\nThis package does not need lore to justify itself. The strongest fair brag is that it already gives you a compact, understandable flag system with local evaluation, UCAN-aware rules, React guards, and edge-friendly output.\n","readmeFilename":"README.md"}