Three pure utility functions related to running fix commands are currently defined in src/index.ts but belong in a dedicated module.
Functions to move (all currently in src/index.ts):
buildFixCommandParts(packageManager, targets) — builds the ["npm", "install", "pkg@version"] array
runInstallCommand(command, args, cwd) — spawns the install process and returns { status, error }
commandLabelForPackageManager(packageManager) — returns "npm install", "pnpm add", etc.
What to do:
- Create
src/utils/fix-runner.ts
- Move the three functions into it, adding
export to each
- Add the necessary imports (
node:child_process for spawn, and the relevant types from ../types.js and ../remediation/fix-commands.js)
- Update
src/index.ts to import them from ./utils/fix-runner.js
- Run
npm test and npm run build to confirm nothing broke
This is a pure refactor — no logic changes. The functions are self-contained and have no side effects, making this a safe extraction.
Three pure utility functions related to running fix commands are currently defined in
src/index.tsbut belong in a dedicated module.Functions to move (all currently in
src/index.ts):buildFixCommandParts(packageManager, targets)— builds the["npm", "install", "pkg@version"]arrayrunInstallCommand(command, args, cwd)— spawns the install process and returns{ status, error }commandLabelForPackageManager(packageManager)— returns"npm install","pnpm add", etc.What to do:
src/utils/fix-runner.tsexportto eachnode:child_processforspawn, and the relevant types from../types.jsand../remediation/fix-commands.js)src/index.tsto import them from./utils/fix-runner.jsnpm testandnpm run buildto confirm nothing brokeThis is a pure refactor — no logic changes. The functions are self-contained and have no side effects, making this a safe extraction.