Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(doctor): count the key saved in .repowise/.env when checking provider config (#4708)
Raghav Chamadiya511aa4526edd
diff --git a/packages/cli/src/repowise/cli/_helpers/providers.py b/packages/cli/src/repowise/cli/_helpers/providers.pyindex 8542af4ad..d58cf1e78 100644--- a/packages/cli/src/repowise/cli/_helpers/providers.py+++ b/packages/cli/src/repowise/cli/_helpers/providers.py@@ -227,11 +227,15 @@ def validate_provider_config(List of warning messages for missing or invalid configuration.Empty list means all required config is present."""+ from repowise.core.providers.llm.registry import repo_env_lookup+warnings = []+ # The key init saves to .repowise/.env counts, as it does for resolution.+ getenv = repo_env_lookup(repo_path)def _is_env_var_set(var_name: str) -> bool:"""Check if environment variable is set and non-empty."""- value = os.environ.get(var_name)+ value = getenv(var_name)return value is not None and value.strip() != ""def _is_env_var_exists(var_name: str) -> bool:diff --git a/tests/unit/cli/test_helpers.py b/tests/unit/cli/test_helpers.pyindex 67a44ce83..79b5d5980 100644--- a/tests/unit/cli/test_helpers.py+++ b/tests/unit/cli/test_helpers.py@@ -566,6 +566,15 @@ class TestValidateProviderConfig:assert len(warnings) == 1assert "ANTHROPIC_API_KEY" in warnings[0]+ def test_key_in_the_repo_env_file_counts(self, monkeypatch, tmp_path):+ monkeypatch.delenv("OPENAI_API_KEY", raising=False)+ monkeypatch.setenv("REPOWISE_PROVIDER", "openai")+ (tmp_path / ".repowise").mkdir()+ (tmp_path / ".repowise" / ".env").write_text("OPENAI_API_KEY=sk-test\n")++ assert validate_provider_config(repo_path=tmp_path) == []+ assert validate_provider_config() != []+def test_openai_missing_key(self, monkeypatch):monkeypatch.delenv("OPENAI_API_KEY", raising=False)monkeypatch.setenv("REPOWISE_PROVIDER", "openai")