Skip to content

fix(dev-cli): include prereq checks in envCheck allGood flag#1303

Merged
evanjacobson merged 1 commit intoKilo-Org:improvement/kiloclaw-dev-clifrom
evan-claw:fix/env-check-allgood-false-positive
Mar 20, 2026
Merged

fix(dev-cli): include prereq checks in envCheck allGood flag#1303
evanjacobson merged 1 commit intoKilo-Org:improvement/kiloclaw-dev-clifrom
evan-claw:fix/env-check-allgood-false-positive

Conversation

@evan-claw
Copy link

Problem

The envCheck function in dev/cli/src/commands/env.ts displays a false-positive success banner.

allGood is initialized to true (line 27) and only set to false inside the per-service for loop (lines 39, 49). The two prerequisite checks — .env.local existence and .vercel/project.json existence — print errors/warnings but never flip allGood to false.

Proof the issue is real

When .env.local is missing, the function:

  1. Prints ✗ .env.local missing — run: vercel env pull via ui.error()
  2. Proceeds through the service loop (which may find everything OK)
  3. Reaches allGood === true and prints All environment checks passed!

Same for .vercel/project.json: ui.warn() fires but allGood stays true.

The new tests confirm this — they fail on the original code (3/4 fail) and pass on the fixed code (4/4 pass).

Proof this is not a band-aid

The root cause is in envCheck itself: allGood is declared after the prereq checks and doesn't incorporate their results. There is no upstream caller or data source that should be responsible for this — the function owns both the checks and the banner, so the fix belongs here.

What changed

dev/cli/src/commands/env.ts: Changed let allGood = truelet allGood = envLocalExists && vercelLinked, moved before the services filter. This ensures the final banner reflects all checks, not just the service loop.

dev/cli/test/env-check.test.ts: Added 4 integration tests that run envCheck against a temp directory tree with controlled filesystem state:

  1. Missing .env.local → banner says "needs attention" (not "passed")
  2. Missing .vercel/project.json → banner says "needs attention"
  3. Both missing → banner says "needs attention"
  4. All present + services OK → banner says "passed"

All 19 tests pass (15 existing + 4 new).

Fixes review comment: #1142 (comment)

The allGood flag was only set to false by the per-service env loop.
If .env.local was missing or .vercel/project.json was absent, the
function still displayed 'All environment checks passed!' despite
having printed an error or warning above.

Initialize allGood from envLocalExists && vercelLinked so the final
banner correctly reflects all preceding checks.

Adds 4 integration tests that exercise envCheck against a temp
directory tree and assert the banner matches the actual check results.
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 19, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • dev/cli/src/commands/env.ts
  • dev/cli/test/env-check.test.ts

Reviewed by gpt-5.4-20260305 · 133,279 tokens

@evanjacobson evanjacobson merged commit e151f78 into Kilo-Org:improvement/kiloclaw-dev-cli Mar 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants