[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-1272":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":13,"openIssues":14,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":15,"stars30d":15,"stars90d":14,"forks30d":14,"starsTrendScore":16,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":14,"starSnapshotCount":14,"syncStatus":31,"lastSyncTime":32,"discoverSource":33},1272,"envradar","CodMughees\u002Fenvradar","CodMughees","Catch undocumented, unused, and drifting environment variables in your repo","",null,"Python",273,4,0,1,3,2.1,"MIT License",false,"main",true,[23,24,25,26,27],"cli","developer-tools","devops","productivity","python","2026-06-12 02:00:25","# envradar\n\nFind undocumented, unused, and drifting environment variables before they confuse the next person who clones your repo.\n\nenvradar scans source code, `.env` files, Docker Compose files, and GitHub Actions workflows to answer four annoying questions quickly:\n\n- Which variables are used in code but missing from `.env.example`?\n- Which variables are documented but no longer used?\n- Which variables exist locally but are not documented for new contributors?\n- Which secrets only show up in CI pipelines and deserve a second look?\n\nIt works both as a CLI and as a reusable GitHub Action.\n\n## Why this is useful\n\nEnvironment variable drift is one of the most common sources of bad onboarding, broken preview deploys, and “works on my machine” bugs. envradar gives maintainers a low-friction way to catch that drift before publishing a repo or merging a pull request.\n\n## Features\n\n- Detects env vars in Python, JavaScript, TypeScript, Go, Ruby, Java, Kotlin, Rust, PHP, and .NET-style code.\n- Parses `.env.example`, `.env.sample`, `.env.template`, and local `.env*` files.\n- Detects `${VAR}` placeholders in Docker Compose files.\n- Detects `${{ secrets.NAME }}` and `${{ vars.NAME }}` references in GitHub Actions workflows.\n- Outputs plain text, markdown, or JSON.\n- Supports a small `envradar.yml` config for ignored variables and placeholder values.\n- Emits GitHub annotations and a job summary when used as a GitHub Action.\n- Exits non-zero in strict mode so you can block merges when drift is found.\n\n## Use as a GitHub Action\n\nAfter you tag a release such as `v1`, other repositories can use envradar directly:\n\n```yaml\nname: envradar\non:\n  pull_request:\n  push:\n    branches: [main]\n\njobs:\n  scan:\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions\u002Fcheckout@v5\n      - id: envradar\n        uses: CodMughees\u002Fenvradar@v1\n        with:\n          fail-on-findings: \"true\"\n          report-format: markdown\n          report-file: docs\u002Fenvradar-report.md\n      - name: Print summary counts\n        run: |\n          echo \"strict findings: ${{ steps.envradar.outputs.strict-findings }}\"\n          echo \"missing vars:    ${{ steps.envradar.outputs.missing-count }}\"\n```\n\nWhat the action gives you:\n\n- workflow annotations pinned to specific files and lines\n- a job summary with counts and a markdown report\n- optional generated files such as `.env.example` and contributor docs\n- outputs you can reuse in later workflow steps\n\n### Action inputs\n\n| Input | Default | Description |\n| --- | --- | --- |\n| `path` | `.` | Path inside the checked-out repository to scan |\n| `config` | empty | Optional path to `envradar.yml` or `.envradar.yml` |\n| `report-format` | `text` | Log and file output format: `text`, `markdown`, or `json` |\n| `report-file` | empty | Optional path where a report file should be written |\n| `write-example` | empty | Optional path where a generated `.env.example` should be written |\n| `write-docs` | empty | Optional path where markdown docs should be written |\n| `fail-on-findings` | `false` | Fail the workflow when strict findings exist |\n| `summary` | `true` | Write a markdown report to the GitHub job summary |\n| `annotations` | `true` | Emit GitHub annotations |\n| `python-version` | `3.11` | Python version used by the action |\n\n### Action outputs\n\n| Output | Description |\n| --- | --- |\n| `scanned-files` | Number of files scanned |\n| `required-runtime-count` | Runtime variables detected in code and compose files |\n| `documented-count` | Variables detected in example\u002Ftemplate files |\n| `strict-findings` | Total count of missing, stale, and local-only findings |\n| `missing-count` | Variables used but missing from documented examples |\n| `unused-count` | Documented variables that are no longer used |\n| `local-only-count` | Local variables that are not documented |\n| `workflow-only-count` | Variables that only appear in workflow files |\n| `has-findings` | `true` when strict findings exist |\n| `report-path` | Absolute path to a generated report file |\n| `example-path` | Absolute path to a generated `.env.example` |\n| `docs-path` | Absolute path to generated markdown docs |\n| `config-path` | Absolute path to the config file that was loaded |\n\n## Install the CLI from source\n\n```bash\npython -m pip install -e .\n```\n\nOr with `pipx`:\n\n```bash\npipx install .\n```\n\n## Quick start\n\nScan the current repository:\n\n```bash\nenvradar .\n```\n\nGet copy-pasteable markdown output:\n\n```bash\nenvradar . --format markdown\n```\n\nFail CI when drift is found:\n\n```bash\nenvradar . --strict\n```\n\nGenerate a fresh `.env.example`:\n\n```bash\nenvradar . --write-example .env.example\n```\n\nGenerate a docs page for contributors:\n\n```bash\nenvradar . --write-docs docs\u002Fenvironment.md\n```\n\n## Example output\n\n```text\n$ envradar .\n\nenvradar scanned 42 files.\nRequired runtime vars: 3\nDocumented vars: 2\n\nMissing from .env.example (1)\n  - DATABASE_URL -- src\u002Fsettings.py:12, docker-compose.yml:8\n\nDocumented but not used (1)\n  - SENTRY_DSN -- .env.example:7\n\nPresent locally but not documented (1)\n  - STRIPE_WEBHOOK_SECRET -- .env:4\n\nWorkflow-only secrets or vars (1)\n  - PYPI_API_TOKEN -- .github\u002Fworkflows\u002Frelease.yml:22\n```\n\n## Config\n\nIf `envradar.yml` or `.envradar.yml` exists at the repo root, envradar will load it automatically.\n\n```yaml\nignore:\n  - CI\n  - GITHUB_TOKEN\n  - PYPI_API_TOKEN\n\nplaceholders:\n  DATABASE_URL: postgresql:\u002F\u002Flocalhost:5432\u002Fapp\n  REDIS_URL: redis:\u002F\u002Flocalhost:6379\u002F0\n```\n\n`ignore` removes noisy variables from every report. `placeholders` are used when generating `.env.example`.\n\n## JSON output\n\n```bash\nenvradar . --format json\n```\n\nThis is useful for automation, bots, or dashboards.\n\n## CLI in GitHub Actions\n\nIf you want full control instead of using the packaged action, you can still install and run the CLI in a workflow:\n\n```yaml\nname: envradar-cli\non:\n  pull_request:\n  push:\n    branches: [main]\n\njobs:\n  scan:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v5\n      - uses: actions\u002Fsetup-python@v5\n        with:\n          python-version: \"3.11\"\n      - run: python -m pip install -e .\n      - run: envradar . --strict\n```\n\n## Safety notes\n\n- envradar never prints values from local `.env` files.\n- Generated `.env.example` files only reuse values already present in example\u002Ftemplate files or explicit placeholders from config.\n- Real secrets stay local unless you intentionally type them into tracked example files yourself.\n\n## Limitations\n\n- The scanner relies on static patterns, so deeply dynamic env lookups may be missed.\n- Monorepos with many independent apps may want separate runs per package.\n- Shell scripts are intentionally not parsed yet to avoid too many false positives.\n\n## Development\n\n```bash\npython -m pip install -e .[dev]\nruff check .\npytest\n```\n\n## Release the GitHub Action\n\nAfter the action is working in this repository, tag a major release so other repos can depend on a stable ref:\n\n```bash\ngit tag -a v1 -m \"envradar action v1\"\ngit push origin v1\n```\n\nYou can move the `v1` tag forward for compatible updates, and publish the action to GitHub Marketplace later.\n\n## License\n\nMIT\n","envradar 是一个用于检测代码库中未记录、未使用或漂移的环境变量的工具。它能够扫描源代码、.env 文件、Docker Compose 文件以及 GitHub Actions 工作流，以发现缺失于 .env.example 中但被代码引用的变量、文档中存在但不再使用的变量、本地存在但未为新贡献者记录的变量，以及仅在 CI 管道中出现可能需要复审的秘密。该工具支持多种编程语言，并能以 CLI 或 GitHub Action 形式运行，输出结果可选文本、Markdown 或 JSON 格式。适用于软件开发团队维护项目配置的一致性与清晰度，尤其是在代码审查阶段确保环境变量的正确性和完整性，减少因配置错误导致的问题。",2,"2026-06-11 02:42:42","CREATED_QUERY"]