cru-flags
Clients for Cru's pipeline feature-flag service, one per language, in one
repository. Each one reads CRU_FLAGS_URL, polls that one JSON document with
ETag revalidation, keeps the last good copy through any outage, and answers
"is this flag on?" from memory without ever raising:
| Language | Package | Install | Read a flag |
|---|---|---|---|
| Go | github.com/CruGlobal/cru-flags |
go get github.com/CruGlobal/cru-flags |
cruflags.Enabled("checkout_v2") |
| TypeScript | @cruglobal/flags |
npm install @cruglobal/flags |
flags.enabled("checkout_v2") |
| Python | cru-flags |
pip install cru-flags |
flags.enabled("checkout_v2") |
| Ruby | cru-flags |
gem "cru-flags" |
Flipper.enabled?(:checkout_v2) (Rails) |
All four have zero runtime dependencies (the gem's one exception is flipper,
for its read-only Flipper adapter), share one version number, and release
together.
How flags are created and flipped (cru app flags), and how they fit the
merge-dark / demo-on-stage / launch-in-production workflow, is in the
pipeline guide.
Status: AI-generated, maintained on a best-effort basis. These libraries were authored primarily by an AI assistant against the design documents linked below. Dependabot keeps tooling current; feature work and fixes happen as needed. Issues and pull requests are welcome.
The contract every client keeps
CRU_FLAGS_URLunset means every flag is off, silently. Local development, CI, preview and lab environments have no flag document, and that is a normal state, not a configuration error.- Unknown flags read off. Only a literal
"Enabled": trueturns a flag on. - A flag read never fetches, never blocks and never raises. It is a memory lookup.
- Poll every 30 seconds, plus or minus 20% jitter, sending
If-None-Matchso an unchanged document costs a304. - Keep last-known-good. A failed poll (timeout,
5xx, a malformed body) changes nothing, forever. Flags never fall back to off on error. A404means "this app has no flags yet" and is not an error. - Fetch once at startup (
Ready) so the first requests after a deploy see real flags. - Log health transitions only: once when polling starts failing, once when it recovers.
The conformance suite encodes these rules as cases, and every client's test suite runs them against the same test server.
Quick start
Go
import cruflags "github.com/CruGlobal/cru-flags"
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
cruflags.Ready(ctx) // optional: wait for the first fetch before serving
cancel()
if cruflags.Enabled("checkout_v2") {
// ...
}
}
Details: docs/go/README.md.
TypeScript / Node.js
import { flags } from "@cruglobal/flags";
await flags.ready(); // optional warmup
if (flags.enabled("checkout_v2")) {
// ...
}
Details: docs/node/README.md.
Python
from cru_flags import flags
flags.ready(timeout=3.0) # optional warmup
if flags.enabled("checkout_v2"):
...
Details: docs/python/README.md.
Ruby
# Gemfile
gem "cru-flags"
# In Rails the Railtie wires Flipper for you:
Flipper.enabled?(:checkout_v2)
# Anywhere else:
CruFlags.enabled?("checkout_v2")
Details: docs/ruby/README.md.
Lambda and Cloud Run
On runtimes that freeze the process between requests, a background poll timer
does not tick. Set CRU_FLAGS_REFRESH_MODE=on-demand and every client drops
the timer and refreshes from the read path instead, at most once per poll
interval. Call Ready during init so the first invocation sees real flags.
Repository layout
| Path | What |
|---|---|
*.go, go.mod |
Go package cruflags |
src/, test/*.ts, package.json |
TypeScript package @cruglobal/flags |
cru_flags/, tests/, pyproject.toml |
Python package cru-flags |
lib/, test/*.rb, cru-flags.gemspec |
Ruby gem cru-flags |
conformance/ |
Shared cases and the test server every client runs against |
docs/<language>/ |
Each client's README, design document and old changelog |
Each language's design document (docs/<language>/design.md) is the
authoritative specification for that client. See
CONTRIBUTING.md
to work on them.
Releasing
release-please keeps a release
pull request open on main, built from Conventional Commit subjects. Merging
it bumps every version file, writes CHANGELOG.md, tags vX.Y.Z and
publishes a GitHub Release. The release workflow then publishes to npm, PyPI
and RubyGems through trusted publishing (no registry tokens live in this
repository). The Go module needs no publish step: the tag is the release.
License
Metadata
Release files for cru-flags 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cru_flags-0.3.0.tar.gz | 15.1 kB | With provenance | Details for cru_flags-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cru_flags-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for cru_flags-0.3.0-py3-none-any.whl |
Total release size: 29.4 kB
Release files / cru_flags-0.3.0.tar.gz
| Download URL | cru_flags-0.3.0.tar.gz |
|---|---|
| Size | 15.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
076b2c8c98cf6dcbb0db8183caefb9addd819920ea9b526b3fe1f93b6a0482ee
|
|
BLAKE2b-256 checksum How to use checksums |
d7abf0988766322f3c4ec365be4d36869193f7338995fba0d891f643aa3bde0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logRelease files / cru_flags-0.3.0-py3-none-any.whl
| Download URL | cru_flags-0.3.0-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
011909037d51cf26253fed47e56ffae7c88b8471f820d3b0c839ab75816b14fc
|
|
BLAKE2b-256 checksum How to use checksums |
4d08e18dff2bd97a81695ab76a0be3e6077c9ae1300cc98921798a7afccb0e5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logSecurity for cru-flags 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cru_flags-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.