Repository navigation
CLI and CI
The editor's flag checks also run from the command line, so a pull request that reads a flag Flagsmith doesn't have fails before it merges.
flowchart LR
PR["Pull request"] --> CI["CI job:<br/>flag-responder check"]
CI --> SCAN["Scan the code for flag keys<br/>(offline)"]
CI --> FS[("Flagsmith")]
SCAN --> CMP{"Compare"}
FS --> CMP
CMP -->|"all known"| OK["✅ pass"]
CMP -->|"missing / unhealthy and on"| FAIL["❌ exit 1, with file:line"]
| Command | What it does | Needs Flagsmith? |
|---|---|---|
flag-responder scan |
Lists every flag key found in the code, with file and line | No |
flag-responder check |
Compares the code with Flagsmith and exits 1 on problems. By default only missing flags fail; --fail-on missing,unhealthy,stale widens it, and --format github adds annotations on the pull request |
Yes |
flag-responder publish-refs |
Sends code references to Flagsmith, so the dashboard shows where each flag is used | Yes |
Configuration comes from environment variables: FLAGSMITH_URL (default http://localhost:8000), FLAGSMITH_API_KEY (organisation key) and FLAGSMITH_PROJECT (name or id). Flags override them: --url --project --dir --fail-on --repo-url --format.
Run it from a clone without installing anything:
cd extension && npm ci && npm run compile
node out/cli.js check --dir ..- GitHub Actions:
docs/ci/github-actions.yml - GitLab CI:
docs/ci/gitlab-ci.yml
Store the API key as a CI secret. The job needs network access to your Flagsmith, so an instance that only runs on a laptop won't be reachable from hosted CI.
The scanner reads the call shapes of the Flagsmith SDKs (JS/TS, React useFlags, Node, Python, Go, Java/Kotlin, .NET, Ruby, PHP), for example isFeatureEnabled('key'), get_feature_value("key") and useFlags(['a','b']). It skips node_modules, build folders and virtualenvs.
- Calls in comments are listed but never reported as missing.
-
Your own wrappers: add a regular expression with one capture group to
flaglens.extraPatterns, for exampleisOn\\(['"]([\\w.-]+)['"]\\). -
Same-named calls from other libraries (say
user.hasFeature("x")) are read as flag checks. This is the price of pattern-matching instead of parsing.
Repository · Latest release · Report an issue · Wiki sources live in docs/wiki: edit them there and republish.