Running the complete suite from a real linked worktree exposes two false doctor failures: a healthy repository is reported as a non-repository because diagnosis checks only <cwd>/.git/HEAD. A linked worktree has a .git file, and a valid nested working directory need not contain .git at all.
A retained public diagnose() regression initializes and commits a real temporary repository, adds a real detached worktree, then diagnoses the checkout, worktree and a nested package directory. The current root checkout passes; the linked worktree fails. Git and the filesystem are not mocked.
Source owner: src/doctor.ts. This surfaced while verifying the dependency-discovery correction in #1459, but is a separate repository-detection defect.
Acceptance:
- Retain the real repository/worktree/nested-directory regression.
- Use Git's actual working-tree discovery rather than inferring a repository from a particular metadata pathname. Keep non-repository and unavailable-Git failures explicit and bounded.
- Preserve warning-only treatment of missing optional credentials and analyzers.
- Pass focused and complete tests, lint, types, documentation checks and build.
- Publish through the normal patch release and verify the installed package from actual linked worktrees.