@lesto/flags
v0.1.7
Published
Lesto's first-class feature flags — declare a flag on a route or page and the gate hides it when off.
Readme
@lesto/flags
First-class feature flags — gate a route or page; an off flag is a 404.
Part of Lesto, the batteries-included, agent-native fullstack framework.
bun add @lesto/flagsimport { defineFlags } from "@lesto/flags";
const flags = defineFlags({
defaults: { "new-listing-ui": false },
resolve: (flag, c) => (c.query("preview") === "1" ? true : undefined),
});
app
.use(flags.gate("beta")) // hides a whole subtree when off
.get("/api/new", flags.gate("new-listing-ui"), handler);Resolution is dynamic-then-static, and an off flag is a 404 — the feature simply doesn't exist to a client. An unknown flag is off.
