Skip to content

Add .env file support for environment variables #674

@tbrandenburg

Description

@tbrandenburg

Problem

The CLI includes a comprehensive .env.example file that documents all available environment variables (GITHUB_TOKEN, CI_GITHUB_TOKEN, TELEGRAM_BOT_TOKEN, etc.), but the CLI does not actually load .env files automatically.

This creates a misleading user experience where users expect to:

  1. Copy .env.example to .env
  2. Set their tokens in .env
  3. Have the CLI automatically use those values

Current Behavior

  • ❌ CLI does not load .env files automatically
  • ❌ No dotenv dependency in package.json
  • ❌ No .env loading code in entry points
  • ✅ CLI reads process.env directly (manual exports work)

Evidence

  • package.json has no dotenv-related dependencies
  • No require('dotenv').config() in bin/run.js or src/index.ts
  • Code in src/adapters/github/auth.ts only reads process.env directly
  • Testing confirms .env files are ignored

User Workarounds

Currently users must:
No work items found.

Proposed Solution

Add automatic .env file loading:

  1. Add dotenv dependency:

added 1 package, and audited 266 packages in 1s

72 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

  1. Load .env in entry point (bin/run.js):

  2. Look for .env files in:

    • Current working directory
    • User's home directory (~/.work/.env)
    • Project root (if in git repo)

Acceptance Criteria

  • Users can create .env file and have CLI automatically load it
  • .env file loading follows standard precedence (local > home > system)
  • Existing environment variable behavior unchanged
  • Manual exports still take precedence over .env files
  • Update documentation to reflect new behavior

Priority

Medium - Improves user experience and aligns behavior with documented expectations.

Labels

  • enhancement
  • user-experience
  • configuration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions