Skip to content

harden: doctor --fix symlink repairs unguarded (EACCES aborts run) + probes non-file canonical entries (#230 audit) #237

Description

@edheltzel

From the post-merge audit of #230 (reviewer report findings 3 and 9, validator-confirmed).

  1. src/commands/doctor.ts:883-890: the symlink repair loop calls sc.repair() bare while the sibling mcp-env probe routes through resolveProbeResult (:546-559) — which exists precisely to degrade a thrown repair into FAIL. One EACCES under ~/.claude/skills aborts the entire doctor run before any results print. Newly load-bearing now that probes are per-skill files. Fix: route the repair through resolveProbeResult (one line). Related: the lstatSync catch at :577-579 misreads EACCES as "Target missing".
  2. src/commands/doctor.ts:512-513: readdirSync probe enumeration includes dotfiles and subdirectories; the installer links only depth-1 plain files with dotfiles excluded (lib/install-lib.sh:1236-1249). A .DS_Store in a canonical dir would get symlinked into ~/.claude/skills/ by --fix. Filter to files, mirroring the installer's [[ -f ]] guard.
  3. Test gap: buildSymlinkProbes has zero coverage and is unexported, while the file's other probes are exported exactly to be testable (finding 4b). Export + tmpdir unit test.

Refs #230, #228.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions