Skip to content

fix(doctor): resolve env.sh path via getTeamaiHome for project scope - #348

Merged
jeff-r2026 merged 1 commit into
mainfrom
worktree-fix-doctor-envsh-path
Aug 27, 2026
Merged

jeff-r2026 merged 1 commit into
mainfrom
worktree-fix-doctor-envsh-path

Conversation

@jeff-r2026

Copy link
Copy Markdown
Collaborator

Problem

Running teamai doctor in project scope always reports the env-injection check as failed, even when env variables are correctly injected:

✖ Env variables injected in shell profile
  → Run `teamai pull` to inject env variables into shell profile

Root Cause

The check in src/doctor.ts hardcodes the env.sh path to the user home:

const envShPath = path.join(home, '.teamai', 'env.sh');
if (!await pathExists(envShPath)) return false;

But teamai pull writes env.sh to getTeamaiHome(scope, projectRoot), which is <projectRoot>/.teamai/env.sh in project scope (and the shell profile is injected to source that path). So ~/.teamai/env.sh never exists in project scope and the check yields a false negative.

Fix

Resolve the env.sh path with getTeamaiHome(localConfig.scope, localConfig.projectRoot) so the check mirrors exactly where pull writes. The shell-profile lookup (.zshrc/.bashrc) correctly stays under the user home.

Test Plan

  • npx tsc --noEmit passes
  • npm run build passes
  • npx vitest run doctor — 7/7 pass
  • Real CLI e2e in a project-scope repo: the check flips ✖ → ✔, full teamai doctor reports All checks passed!

The env-injection check hardcoded ~/.teamai/env.sh, but in project scope
`teamai pull` writes env.sh to <projectRoot>/.teamai/env.sh. The check
therefore always failed in project scope even when env vars were correctly
injected. Use getTeamaiHome(scope, projectRoot) to mirror the pull path.
@jeff-r2026
jeff-r2026 merged commit 12ee507 into main Aug 27, 2026
7 checks passed
@jeff-r2026
jeff-r2026 deleted the worktree-fix-doctor-envsh-path branch September 11, 2026 09:15
Walternater pushed a commit to Walternater/teamai-cli that referenced this pull request Nov 2, 2026
…encent#348)

The env-injection check hardcoded ~/.teamai/env.sh, but in project scope
`teamai pull` writes env.sh to <projectRoot>/.teamai/env.sh. The check
therefore always failed in project scope even when env vars were correctly
injected. Use getTeamaiHome(scope, projectRoot) to mirror the pull path.
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.

1 participant