Changelog
v0.3.0
Section titled “v0.3.0”Changed
Section titled “Changed”@xtandard/kitis now a dependency. The storage drivers, drizzle table factories, auth and authorization providers, the hooks runner, the validation core, the panel and API plumbing, the framework adapters, the CLI plumbing, the admin shell, the React embed, the build configs and the docs-site tooling come from@xtandard/kit. Every subpath and exported name of@xtandard/flagsis unchanged (the API-surface diff has no removals); users never install or configure the kit.- Every SQL, document, Redis, memory and file adapter now has
compareAndSwap(memory, file, Redis/RedisJSON, Postgres, Drizzle on pg/MySQL/SQLite, MongoDB, SQLite, libSQL). Only unstorage and Cloudflare KV lack it. Comparisons are structural (object key order is ignored). - Values are written as canonical JSON (sorted object keys) by every adapter. Data written by earlier releases reads, lists and swaps as before; no migration.
- unstorage writes string values JSON-encoded (
"hello"is stored as"\"hello\""). An older release still reads them, and strings stored by earlier releases read back as before. - New Postgres tables get
key text COLLATE "C"(bytewise, index-usable prefixes). Existing tables are untouched and keep working; the optionalALTERis in the kit’s storage guide.pgFlagsTablekeeps the plaintextkey (no drizzle-kit diff for existing schemas). mysqlFlagsTabletakeskeyCollation(utf8mb4_bindefault;utf8mb4_0900_binon MySQL 8.0+ orutf8mb4_nopad_binon MariaDB for new tables). See “MySQL PAD SPACE” under Fixed.createFetchHandler:sourceStorageis optional when a prebuiltcoreis given (one of the two is required, checked at construction). The result, and every adapter helper (flagsPanelfor Bun, Hono, Express and Elysia), gainsclose(), which stops the OFREP SSE poller.- Every panel answers
GET {basePath}/healthcheckwith{ "ok": true }, and serves the SPA’sindex.htmlwithcache-control: no-cache(an upgrade no longer serves a stale page that points at deleted hashed assets). The standalone server andservekeep their{ status, title }healthcheck at/healthcheckand{basePath}/healthcheck. - A non-GET request outside the API gets
405with anAllow: GET, HEADheader. - The OpenAPI document’s
info.versionis the package version (it was a hard-coded0.1.0). - CLI:
AUTH_ROLEsets the basic-auth user’s role (adminby default, as before).SOURCE_SQLITE_TABLE/RUNTIME_SQLITE_TABLEset the SQLite table (defaultxtandard_flags, as before).UI_DIRoverrides the bundled UI directory (the standalone image already honoured it).bun src/cli.ts <command>runs the CLI directly (a self-run guard); importing the module never runs it.
- The standalone app delegates to the CLI’s
serve, with its own defaults unchanged (memory storage,./data/{source,runtime}and./data/{source,runtime}.sqlite). - Optional-peer error messages read
@xtandard/flags/storage/redis requires the optional peer "redis". Install it with: bun add redis (or npm install redis). - Validation:
ValidationErrorandValidationResult(@xtandard/flags) are now type aliases of the kit’sValidationIssue/ValidationResult, with the same shape. - Admin UI: the header is the kit’s shell. The unpublished-changes badge and the Discard and
Publish buttons sit before the read-only badge; an embedded dashboard whose
/configrequest fails (and that has no server bootstrap) shows a “Could not load the panel configuration” message instead of an empty shell. - React embed:
@xtandard/flags/reactalso exports theFetchLiketype. - New exports (additions only):
MemoryFlagsStorage(./storage/memory);FileFlagsStorage,FileLegacyModeandmigrateFileStorage(./storage/file);KeyCollisionError(./storage/drizzle); theFetchLiketype (./react). - Docs site, CI and release run on the kit’s tooling and reusable workflows (
@v0.1). CI now usesredis:8, so the RedisJSON conformance cases run. The Docker image is smoke-tested before it is pushed, anddocker.ymlhas arefresh-kitdispatch input. Release notes come from the tag’s CHANGELOG section.
Inherited from @xtandard/kit (inventory §3; each has a permanent regression test in the kit).
Server and API
Section titled “Server and API”- Node 20.0–20.15 served the “UI not built” page instead of the admin SPA
(
process.getBuiltinModuleis missing there); the UI directory now resolves on every Node 20 thatenginesallows (kit 0.1.1). - A throwing auth provider is a
500, not a401. A broken identity provider no longer looks like bad credentials (flags lacked wh 543e1fa). - The panel requires
sourceStorageor a prebuiltcoreand says so at construction, instead of failing on the first request (wh 5b151c1). - Domain errors are mapped by name (
ReadonlyError,NotFoundError,SnapshotProtectedError, the validation errors), so a class copy from another bundle no longer turns into a500. - A malformed
%escape in a path is a404, not a500(URIError). - Key-shaped path parameters are re-validated before they reach storage (MySQL PAD SPACE,
inventory §5). Flag, segment and snapshot keys must match
[a-zA-Z0-9._-]+; project and environment keys (path and the OFREPprojectKey/environmentKeyquery) may not be empty,./.., contain/, or have leading/trailing whitespace. Example:DELETE …/snapshots/v1%20passed the “active snapshot is protected” check ("v1 " !== "v1") and then deleted thev1row on MySQL; it is now a404. - The panel title is HTML-escaped in the served page, and so are the
<base href>and the bootstrap JSON (<,>, U+2028/U+2029);$sequences in the config are kept. - Express keeps every
Set-Cookieheader and multi-value request headers, re-serialises pre-parsed bodies (JSON, string, bytes, urlencoded) without a stalecontent-length, and streams responses with backpressure, so the OFREP SSE stream now works under Express (it was buffered). - The CLI’s Node server (
npx … serve) keeps everySet-Cookie, streams every response (not only SSE) and cancels the body when the client disconnects. - Elysia:
PATCHandDELETEbodies reach the panel (onlyPOST/PUTwere rebuilt), a stalecontent-lengthis dropped, and two mounts with different prefixes are no longer deduplicated by the plugin name. - The OpenAPI
info.versionis the package version, not0.1.0.
- Negative numbers and a bare
-are values (--value -5,--reason -), not new flags (kit 0.1.1parseArgs). bun src/cli.tsruns the CLI even when its path can’t be resolved as written (kit 0.1.1isMainModule).- An unknown
SOURCE_STORAGE_DRIVER/RUNTIME_STORAGE_DRIVERfails instead of silently using thefiledriver. - An empty environment variable counts as unset (
TITLE=in a.envfile kept an empty title). - (Unknown
AUTH_MODEalready fails since v0.2.1’s hotfix; the kit now enforces it.)
Storage
Section titled “Storage”- file
legacy: "read-through"(the flags default) could delete another key’s file. The raw legacy path ofx/a%25/kis the encoded path ofx/a%/k, so writing or removingx/a%25/kdeletedx/a%/k, and reading a missingx/a%25/kreturnedx/a%/k’s value (same for^escapes). Present in every earlier flags release; fixed in the kit (#18), and the conformance suite now runs in read-through mode. - file: a write is atomic (temporary file + rename), so a crash never leaves a half-written
value;
watchreports arenameasremoveonly when the file is gone (writes were reported as removals); empty key segments are distinct (a//b≠a/b); on a case-insensitive file system a read-through never opens a legacyAcme/foracme(realpathcheck). - Redis:
getKeysde-duplicates SCAN results (SCAN may return a key twice);watchescapes glob characters in the watched prefix (PSUBSCRIBE), so it no longer misses or over-matches events. - unstorage: keys ending in
$are no longer hidden (unstorage treats them as meta keys), empty key segments are kept, and a stored string that looks like JSON reads back as that string ("123"came back as the number123). Older spellings still read. - MySQL (drizzle):
getKeysno longer skips keys containing supplementary characters (emoji): an indexedLIKE 'p%'onutf8mb4_binmisses them on MySQL 8.4; it is now a range scan plus an exactstartsWith. - MySQL PAD SPACE:
utf8mb4_binignores trailing spaces, sosetItem("flags/a ")overwrote"flags/a", and reads, removes and swaps acted on the other spelling. Reads, removes and swaps now match keys byte-exactly, and a colliding write throwsKeyCollisionErrorinstead of overwriting. New tables can opt into a NO PAD collation (keyCollation). - Postgres / Drizzle: a stored JSON string that looks like JSON (
"123") reads back as the string (it was parsed twice); a failed connect or table creation is retried on the next call instead of being cached (Postgres, libSQL). - SQLite / libSQL: prefix listing uses
GLOB(case-sensitive, index-usable); MongoDB re-checks prefixes withstartsWith, so a case-insensitive collection collation never leaks keys from another prefix. @xtandard/flags/storage/sqlitecan be imported under Node (bun:sqliteloads on first use; opening a database still needs Bun). The SQLite table is created on first use.withWatchresults survive an object spread ({ ...withWatch(s, sub) }kept no methods).
Validation
Section titled “Validation”- JSON values must be finite: a
jsonvariant (or condition value) containingNaNorInfinityis rejected; it was stored asnull. - A root-level validation issue carries the base path (
flag) without a trailing dot (flag.).
Admin UI and embed
Section titled “Admin UI and embed”- The embed’s
routing: "memory"keeps the query string, so the?project=/?env=scope survives navigation. - The theme host watcher works without
MutationObserver(theme="inherit"in environments without it fell over).
Tooling
Section titled “Tooling”- CI runs the RedisJSON conformance cases (
redis:8); withredis:7they never ran. - The deprecated
TransactionalFlagsStorage/isTransactionalstay exported for compatibility; no adapter implements them (they never did).
Migration
Section titled “Migration”None. The API-surface diff (xtandard-kit api-surface) shows no removals, stored data written by
earlier releases reads unchanged, and no persisted or HTTP-contract default changed (table
xtandard_flags, Mongo xtandard_flags/flags_kv, pg channel xtandard_flags, CLI tables
xtandard_flags_{source,runtime}, Redis prefixes xtandard:flags:{source,runtime}, file dirs
./.flags/… (CLI) and ./data/… (image), readonly status 403, realm xtandard-flags,
__FLAGS_CONFIG__, xtandard-flags:theme, .xtandard-flags).
Optional, for MySQL users on utf8mb4_bin tables who want trailing-space keys kept distinct:
ALTER TABLE flags_kv MODIFY `key` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin NOT NULL;-- MariaDB: COLLATE utf8mb4_nopad_binv0.2.1
Section titled “v0.2.1”Security fix for the standalone server, the CLI and the Docker image: a mistyped AUTH_MODE no longer serves an open panel. Library APIs, storage and the HTTP API are unchanged.
🩹 Fixes
Section titled “🩹 Fixes”- auth: reject unknown
AUTH_MODEinstead of serving an open panel (#23). Any value other thannoneorbasic(a typo, wrong case) used to fall through tonone, leaving the admin panel and API unauthenticated. The server now exits withUnknown AUTH_MODE "x" (expected none or basic)before it listens. An empty or unsetAUTH_MODEstill meansnone, and now prints the same unauthenticated-panel warning as an explicitnone.
Migration
Section titled “Migration”None if AUTH_MODE is none, basic or unset. If a deployment fails to start after upgrading, its AUTH_MODE was invalid and the panel was open: set it to basic (with credentials) or none explicitly.
v0.2.0
Section titled “v0.2.0”⚠️ Migration
Section titled “⚠️ Migration”-
MySQL (Drizzle storage): run a one-off
ALTER TABLE. Thekeycolumn is nowvarchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin. MySQL’s default collation (utf8mb4_0900_ai_ci) folds case and accents, soflags/Acme/…andflags/acme/…were the same row. New tables get the binary collation from the schema; tables created before 0.2.0 need (adjust the length if you setkeyLength):ALTER TABLE flags_kvMODIFY `key` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL;If two keys already collided, the table holds only the last write; the
ALTERdoesn’t bring the other back.getKeysalso usedESCAPE '\', a MySQL syntax error, so listing failed on every MySQL call before this release. -
File storage: keys with uppercase letters get a new file name. Each key segment is now encoded so it stays distinct on case-insensitive file systems (macOS and Windows defaults): an uppercase letter becomes
^+ the lowercase letter (Acme→^acme), and characters outside[a-z0-9._~!@,=+-]become%XX. All-lowercase keys (flags/default/production/…) keep their file names, so most trees need nothing. Files written before 0.2.0 are still read and listed, and are replaced by the encoded name on the next write. On a case-insensitive file system such a legacy file can still answer for its lowercase twin until it is rewritten, so if your tree has keys with uppercase letters, re-save them once (read and write back each key fromgetKeys("flags/")). -
unstorage storage: keys containing
%,?,\or:are stored under an escaped name (%25,%3F,%5C,%3A), because unstorage cut keys at?and turned\and:into separators. Keys without those characters are unchanged. A key with one of them written before 0.2.0 is not found under its new name (with?,\or:it was stored mangled anyway); write it again.
🩹 Fixes
Section titled “🩹 Fixes”- storage: Exact keys and literal prefixes on every backend:
getKeyson SQLite, libSQL, Postgres and Drizzle keeps only exactstartsWithmatches (SQLite’sLIKEfolds ASCII case); Redis escapes glob characters inSCAN MATCH; unstorage lists by plain string prefix. The storage conformance suite now covers case/accent-distinct keys,? \ :round-trips and% _ ! * [ ] ? \ : %25in prefixes, and runs live against MySQL, Redis and MongoDB in CI (c9d27ae) - site: Serve og:url, og:image and sitemap URLs over https (2ada92e)
🎨 Brand
Section titled “🎨 Brand”- brand: Vector brand kit in the xtandard family system: symbol, horizontal and stacked lockups for light and dark, monochrome, favicon set and social card, generated by
scripts/brand-assets.shand documented indocs/BRAND.md(276a822, f4cf88c, 3b7a255, f1b90e7) - ui: The admin UI and the React embed show the theme-aware symbol next to the title (a host
logoUrlstill replaces it), and the standalone UI ships the new favicon set. The old PNG logos (logo.png,logo-128.png,logo-256.png,favicon.png) are gone fromdocs/assets/; the README uses the SVG lockups
📖 Documentation
Section titled “📖 Documentation”- Documentation site (Starlight) on GitHub Pages: https://me.xantiagoma.com/xtandard-flags/ (4ac42a6)
- api: Readable Elysia adapter types (
FlagsElysiaPlugin);/elysia2documented against Elysia 2; re-exports listed on each module page (f6dfee5, e98d7db) - readme: “The xtandard ecosystem” section, with audit, links and entitlements (2e9c23e, e128f08)
🏡 Chore
Section titled “🏡 Chore”- Pre-commit formatting skips
.mdxand tolerates commits touching only fmt-ignored files (d4c9ed3)
❤️ Contributors
Section titled “❤️ Contributors”- Santiago Montoya (@xantiagoma)
v0.1.11
Section titled “v0.1.11”v0.1.10
Section titled “v0.1.10”🩹 Fixes
Section titled “🩹 Fixes”- react: Embedded dashboard resolves to one theme; theme=“inherit” follows the host (de6600e)
- release: Npm trusted publishing (OIDC) + manual re-publish of a tag (63f8530)
❤️ Contributors
Section titled “❤️ Contributors”- Santiago Montoya (@xantiagoma)
v0.1.9
Section titled “v0.1.9”🚀 Enhancements
Section titled “🚀 Enhancements”- elysia: Elysia 2 support via @xtandard/flags/elysia2 (b5405ef)
❤️ Contributors
Section titled “❤️ Contributors”- Santiago Montoya [email protected]
v0.1.8
Section titled “v0.1.8”🩹 Fixes
Section titled “🩹 Fixes”- react: Scope the embed stylesheet so it can’t leak into the host app.
@xtandard/flags/react/styles.csswas a full, unscoped Tailwind v4 build — its preflight resets (*,button,h1,a, tables) and generic utilities (.flex,.border, …) restyled the entire host page, not just<FlagsDashboard/>. Every rule is now scoped under the embed’s.xtandard-flagswrapper (preflight and utilities included), with the design tokens re-homed onto the wrapper and a build guardrail that fails if any rule escapes the scope. Base UI portals (Select/Combobox popups, Dialogs) now render inside the wrapper too, so they stay styled under the scoped stylesheet. The standalone SPA bundle (dist/ui) is unchanged.
v0.1.7
Section titled “v0.1.7”🚀 Enhancements
Section titled “🚀 Enhancements”- snapshots: Guarded deletion + configurable retention (count and/or age) —
deleteSnapshotin core/API/UI/CLI (never the active or latest version; the delete stays on the audit record), plus aretentionpolicy ({ snapshots/audit: { keepLast?, maxAge? } }, union-of-keeps) applied after each publish withSNAPSHOT_/AUDIT_KEEP_LAST/_MAX_AGEenv support. The removed payloads are surfaced toafterhooks (snapshot.deleted,audit.pruned) for offloading. (d2977c5) - storage:
createRedisJSONStorage— native RedisJSON documents (JSON.SET/JSON.GET) on the samestorage/redissubpath, making stored snapshots/drafts JSONPath-queryable and RediSearch-indexable (server needs the JSON module: Redis 8 / Redis Stack; zero new client deps). (9fa002f) - react:
initialProjectKey/initialEnvironmentKeyon<FlagsDashboard/>— embed hosts can pre-select where the dashboard opens (URL?project=/?env=still wins). (6de66ce)
📖 Documentation
Section titled “📖 Documentation”- demo: The seeded demo (
bun run demo) showcases snapshot deletion — several deletable versions, a pre-deleted v2 in the audit, protected active/latest. (b455ace) - examples: One-command runner for the react-embed example (
bun run examples:react-embed). (9df10dd)
❤️ Contributors
Section titled “❤️ Contributors”- Santiago Montoya (@xantiagoma)
v0.1.6
Section titled “v0.1.6”🩹 Fixes
Section titled “🩹 Fixes”- storage: Make the Drizzle exports compatible with
[email protected]beta — widen the peer range (>=0.44.0 || >=1.0.0-0) and return the portableDrizzleKvTablefrom the*FlagsTablefactories so their.d.tsno longer freezes the 0.45PgColumnbrand (fixes TS2883/TS2322 for consumers on1.0.0-beta.x). Verified against both1.0.0-beta.22and0.45.x. (8397b69)
❤️ Contributors
Section titled “❤️ Contributors”- Santiago Montoya (@xantiagoma)
v0.1.5
Section titled “v0.1.5”🚀 Enhancements
Section titled “🚀 Enhancements”- hooks: Control-plane
before/afterhooks on the admin core (throw to deny; best-effort side effects) (e40d149) - hooks: Map before-hook denials to HTTP status via
HookDeniedError(8bf47ef) - hooks: Bundled
hooks/webhook(HMAC + retry) andhooks/logreference adapters (4ae1dba) - hooks: Pinned flag tests that gate publishing (
hooks/test-gate+Flag.tests) (b117e8b) - eval:
onEvaluationruntime-plane observer for usage/exposure (in-process provider + OFREP) (70ea275) - embed: Cross-origin support for the embedded dashboard (
credentials/fetchprops + panelcors) (cc6a15c) - storage: Drizzle adapter (
storage/drizzle) +drizzle/{pg,mysql,sqlite}table factories (1649545) - storage: Composable
withWatch+pgListenNotify— addwatchto any storage from any change source (17dab87)
🩹 Fixes
Section titled “🩹 Fixes”- hooks: Map
HookDeniedErrorfrom separate bundles by name, notinstanceof(723121c) - examples: Map
@xtandard/flags/hooks/*to source in examples tsconfig (20760de)
📖 Documentation
Section titled “📖 Documentation”- hooks: Add
docs/HOOKS.md+ runnableexamples/hooks(all hook flavors incl.onEvaluation) (3839a16) - embed: Document CORS ownership — mount vs plugin, no double-up (b0c12d6)
- storage: Make watch coverage explicit (which adapters self-notify) +
withWatchoverride behavior (e9b3325)
❤️ Contributors
Section titled “❤️ Contributors”- Santiago Montoya (@xantiagoma)
v0.1.4
Section titled “v0.1.4”🚀 Enhancements
Section titled “🚀 Enhancements”- cli: Complete
--help(all env vars/drivers, options, examples) + add--version(08b9bc6)
📖 Documentation
Section titled “📖 Documentation”- Complete env/driver reference (incl. sqlite) + clarify the
xtandard-flagsbinary vs@xtandard/flagspackage (9274cba)
❤️ Contributors
Section titled “❤️ Contributors”- Santiago Montoya (@xantiagoma)
v0.1.3
Section titled “v0.1.3”🚀 Enhancements
Section titled “🚀 Enhancements”- ofrep: Full OpenFeature compliance — ETag/304, flag metadata, opt-in SSE (4efae2e)
- examples: One-command runner for the polyglot OFREP clients (f0b8ad8)
🩹 Fixes
Section titled “🩹 Fixes”- ci: Exclude cli.ts from coverage; add pre-commit + pre-push hooks (8bdb873)
📖 Documentation
Section titled “📖 Documentation”- examples: OFREP client example + polyglot Python/Go/plain-TS clients (d22157b, a90ad9b)
- examples: Auth + authorization flexibility demo (cd5bc54)
- readme: Frame the two evaluation paths — in-process (recommended) vs OFREP (53a2d47)
❤️ Contributors
Section titled “❤️ Contributors”- Santiago Montoya (@xantiagoma)
v0.1.2
Section titled “v0.1.2”🚀 Enhancements
Section titled “🚀 Enhancements”- cli: Print resolved storage location on
servestartup (19cc902)
🩹 Fixes
Section titled “🩹 Fixes”- ci: Exclude changelogen’s CHANGELOG.md from the format check (8810808)
- release: Publish the GitHub Release even when changelogen pre-created a draft (b85c7a5)
❤️ Contributors
Section titled “❤️ Contributors”- Santiago Montoya (@xantiagoma)
v0.1.1
Section titled “v0.1.1”🏡 Chore
Section titled “🏡 Chore”- Align npm keywords with the GitHub topics (094e0a7)
- release: Create a GitHub Release on tag push (80ce518)
❤️ Contributors
Section titled “❤️ Contributors”- Santiago Montoya (@xantiagoma)