Stale feature flag cleanup bot
The idea
Feature flags are supposed to be temporary, but removal has no owner: the flag hits 100%, the launch succeeds, everyone moves on, and the losing branch becomes permanent dead code nobody dares delete because nobody remembers whether it is safe. Multiply by years and the codebase is riddled with untaken paths that still cost comprehension and still get maintained.
Uber built Piranha internally because this debt is real at scale, and LaunchDarkly itself will happily list your stale flags, but listing is where every existing tool stops. The wedge is writing the removal code: cross-reference the provider API (which flags are 100% and rule-free) with the codebase, AST-transform the easy boolean cases into a clean PR, and file precise issues for the rest. The deliverable is a diff, not a report.
Who pays
The buyer is a team already paying LaunchDarkly or PostHog meaningful money, meaning flags are load-bearing and flag debt is visible; the champion is the tech lead who keeps writing remove old flags on the tech-debt board. At 19 to 49 dollars a month it undercuts a single engineer-hour of manual cleanup monthly. Distribution: GitHub Marketplace, LaunchDarkly/PostHog community spaces, and content about flag debt that name-checks Piranha for credibility.
MVP scope
- LaunchDarkly integration detecting flags at 100% with no targeting rules past a staleness window
- Repo grep to locate and classify every reference to each stale flag
- jscodeshift transform inlining the winning branch for simple boolean cases, with import cleanup
- One-flag-per-PR output with provider links and evidence, capped open-PR count
- Filed issues with file/line detail for cases too complex to auto-fix
- Skip for v1: PostHog/Unleash providers, non-JS languages, multivariate flag transforms, auto-archiving flags in the provider, Slack notifications
Build FlagJanitor, a bot that finds fully-rolled-out feature flags and opens the PR that removes them. Stack: Node.js service, GitHub App for repo access and PRs, LaunchDarkly API as the first flag-provider integration (design the provider layer as an interface so PostHog and Unleash slot in later). Stripe payment links for billing; keep the web UI to a settings page. Core flow: team installs the GitHub App and connects a LaunchDarkly API key. On a weekly schedule (and on demand), FlagJanitor pulls all flags and identifies stale ones: serving 100% to the on variation (or fully off) in production for a configurable period, default 30 days, with no targeting rules. It then greps the connected repos for each stale flag's key to classify every reference. For the simplest and most common pattern, a boolean variation call feeding a single if/else or ternary, use an AST transform (jscodeshift for JS/TS in v1) to inline the winning branch, delete the dead one, remove the variation call and any now-unused imports, then open a PR titled Remove stale flag <key>, body linking the LaunchDarkly flag page, its 100%-since date, and every file touched. One flag per PR, capped at three open PRs at a time so the bot never floods review queues. References too complex to transform safely (multivariate flags, dynamic keys, non-JS files) get a filed GitHub issue listing exact file/line locations instead, never a risky guess. Config in .flagjanitor.yml: staleness window, excluded flags, target repos. Pricing: 19 GBP/month up to 3 repos, 49 GBP/month unlimited.
// More Dev tool ideas
-
Deprecation countdowns for the APIs you use
Stripe and Shopify deprecations hide in changelogs until things break; this scans your code for affected calls and gives you a countdown.
Dev tool 1 month -
App store reviews filed as GitHub issues
Bug reports buried in app store reviews never reach the tracker; this clusters new reviews and files deduped GitHub issues nightly.
Dev tool 1 week -
Nightly restore drills for database backups
A backup you've never restored is a guess; this restores your Postgres dump to a scratch instance nightly and proves the data is intact.
Dev tool 1 week -
Hosted monitoring and alerts for BullMQ queues
A stuck BullMQ queue can silently eat jobs for days; hosted dashboards, dead-letter alerts and retry controls without running Grafana.
Dev tool 1 week