Part · flags.featureWhat's actually behind
What's actually behind flags.feature
The part exactly as partkit add flags.feature vendors it into your repo — verified, locked, every byte readable. Nothing here is mocked.
flags.featurev1.1.0
✓ attested🔒 read-onlyflags.feature@1
Lives at parts/flags.feature/ in your repo — open, owned, readable. Not buried in node_modules. 578 lines of source you can audit.
content hash
838f5ec9ed…d35901pinned in parts.lock — ctrlai guard fails CI if a single byte changestested against
node 25.3.0parts/flags.feature/src/index.tstypescript · 1,378 bytes/**
* flags.feature — public interface. The ONLY legal import surface.
* Contract: ../contract.json · What your app must provide: ../seams.md
*
* Typed feature flags with targeting rules and sticky percentage rollout, on a
* FAIL-SAFE evaluation hot path: a flag outage never throws — it returns your
* fallback. Bind it to a database connection (the SqlExecutor seam); constructing
* it performs no I/O.
*/
import { createFlagSet } from "./internal/flags";
import type { FlagSet, SqlExecutor } from "./internal/types";
export { FlagError } from "./internal/errors";
export type { FlagErrorCode } from "./internal/errors";
export type {
Condition,
ConditionOp,
EvalContext,
FlagDefinition,
FlagDefinitionInput,
FlagSet,
FlagType,
FlagValue,
Json,
Rule,
SqlExecutor,
Variant,
} from "./internal/types";
/**
* Bind the flag set to a database connection (the SqlExecutor seam).
* Constructing it performs no I/O and never throws (contract invariant 1).
*
* const ff = flags(db);
* if (await ff.evaluate("new-checkout", { subjectId: user.id }, false)) { … }
* await ff.setFlag({ key: "new-checkout", type: "boolean", enabled: true,
* default: false, rollout: [{ value: true, weight: 10 }, { value: false, weight: 90 }] });
*/
export function flags(db: SqlExecutor): FlagSet {
return createFlagSet(db);
}