Version of get_npm_global_prefix that accepts an injected
CommandRunner. Tests use this with a MockCommandRunner to
exercise the success arm (binary present, stdout parsed) without
requiring npm on the host’s PATH.
Pure parser for npm root -g stdout. Returns the trimmed path or
None on empty input. Extracted so the helper logic is unit-
testable without shelling out.
Pure parser for yarn global dir stdout. Returns <dir>/node_modules
or None on empty input. Extracted so the path-derivation logic is
unit-testable without shelling out.