Duvaxa

DevOps & Cloud · Feature flag cleanup

FlagRetire

Delete the flags you're done with.

Your flag platform knows which flags are finished; your code doesn't. FlagRetire joins the two and lists every flag to remove, archive or fix, with the exact lines of code.

Product teams with 50 or more feature flagsEngineering managers with a tech-debt budgetTeams moving between flag platforms
flag-retire · example
$ flag-retire scan --launchdarkly shop --repo .
FlagRetire: 9 flags, fix code 2 | remove 2 | archive 2 | review 1 | keep 3
ERROR FR004 tax-engine-2: no such flag (src/checkout.ts:17; did you mean tax-engine-v2?)
WARNING FR001 new-checkout: serves true everywhere for 120d: remove, keep the true path
src/checkout.ts:4 if (await ld.variation('new-checkout', user, false)) {
WARNING FR002 holiday-banner: off everywhere for 300d: remove with its dead code
Real run on the built-in demo shop and LaunchDarkly export.
ReadsLaunchDarkly, Unleash, flagd
FindsEvery line using a flag
CatchesMissing and archived flags
Runs inYour CI, read-only

The problem

Teams add feature flags fast and remove them slowly. After a few years there are hundreds: rolled out to everyone months ago, switched off for good, or deleted in the platform while the code still asks for them and silently gets the default. Each one is an if-statement nobody dares to touch.

What it does

01

Reads LaunchDarkly and Unleash directly with a read-only token, or flagd / OpenFeature files and your own flag table as JSON or CSV

02

Finds every use in code: SDK calls in Python, JavaScript, TypeScript, Go, Java, Ruby, C# and PHP, string keys, constants that hold a key, and React camelCase keys

03

Fully rolled out: one value for everyone for 30 days, so remove the flag and keep that path

04

Off everywhere: the code behind it is dead, so remove both

05

Catches the silent bugs: code asking for a flag that was deleted or mistyped, or one that is archived, with a "did you mean"

06

Never suggests removing kill switches, operational or permission flags

07

CI gate and cleanup tracker: fail a pull request that uses a missing flag, export a CSV per owner

How it works

  1. Point it at your flag platform and your repository
  2. Review the list: remove, archive, fix or ask the owner
  3. Add the CI gate so broken flag references never merge

Works with

LaunchDarklyUnleashOpenFeatureflagdFlagsmithGrowthBookStatsigConfigCatFlipperGitHub ActionsCSV

Runs in your CI

GitHub Actions workflow step
# Block code that uses a missing or archived flag
flag-retire scan --launchdarkly $LD_PROJECT --repo . --fail-on error --format md --out flags.md
Licensed customers get the action or command-line tool installed in their own organisation; it runs on your runners, so your code and plans never leave them. The command-line tools run in GitLab CI the same way.

Your data

  • Read-only API tokens, taken from environment variables and never stored.
  • Code is scanned where it runs; nothing is uploaded.
  • Reports hold flag keys, file paths and the matching line only.

Who it's for

Product teams with 50 or more feature flagsEngineering managers with a tech-debt budgetTeams moving between flag platforms

Questions

LaunchDarkly already shows stale flags. Why this?

Its code references and stale views work for LaunchDarkly only. FlagRetire works across platforms and in-house flag tables, and it finds the broken cases: code calling flags that no longer exist.

Does it change our code?

No. It lists each flag with the value to keep and every line to edit; `flag-retire show` prints each use with the code around it.

Related

Often used with FlagRetire

See FlagRetire on your own data

A 30-minute call. We run the product on your export, repository or document and walk you through the results.

Book a demo