Problem
normaliseInput, normaliseCommand, and expandPath are not exported, and expandPath calls os.homedir() internally. This makes it impossible to unit test path expansion without mocking the OS module or manipulating $HOME.
Solution
Export normaliseInput, normaliseCommand, and expandPath from index.ts, and add an optional homedir parameter so callers can inject a value for testing:
expandPath(path, homedir?) -- falls back to os.homedir() when not provided
normaliseCommand(command, options?) -- passes options.home through to expandPath
normaliseInput(input, options?) -- passes options.home through to normaliseCommand
The MCP stdio server continues to use os.homedir() (which reads $HOME) since there is no reason to override it at that level.
The parameter must be optional everywhere with no behaviour change when omitted.
Problem
normaliseInput,normaliseCommand, andexpandPathare not exported, andexpandPathcallsos.homedir()internally. This makes it impossible to unit test path expansion without mocking the OS module or manipulating$HOME.Solution
Export
normaliseInput,normaliseCommand, andexpandPathfromindex.ts, and add an optionalhomedirparameter so callers can inject a value for testing:expandPath(path, homedir?)-- falls back toos.homedir()when not providednormaliseCommand(command, options?)-- passesoptions.homethrough toexpandPathnormaliseInput(input, options?)-- passesoptions.homethrough tonormaliseCommandThe MCP stdio server continues to use
os.homedir()(which reads$HOME) since there is no reason to override it at that level.The parameter must be optional everywhere with no behaviour change when omitted.