Skip to content

refactor: extract --fix execution logic from src/index.ts to src/utils/fix-runner.ts #414

@sonukapoor

Description

@sonukapoor

`src/index.ts` contains roughly 180 lines of `--fix` execution logic that has no reason to live in the entry point:

  • `FixExecutionResult` type (line 497)
  • `applyFixesIfRequested()` (line 378) — orchestrates spinner, runs install commands per target, returns a result object
  • `buildFixCommandParts()` (line 451) — builds the install command array for a given package manager
  • `runInstallCommand()` (line 467) — spawns the child process and resolves on exit
  • `commandLabelForPackageManager()` (line 490) — maps package manager to display label
  • `countBySeverity()` (line 506) — counts findings by severity label
  • `printFixModeSummary()` (line 521) — prints the applied/skipped summary after `--fix` completes

Work to do:

  1. Create `src/utils/fix-runner.ts`
  2. Move all the above and export what `src/index.ts` needs
  3. Update `src/index.ts` to import from `./utils/fix-runner.js`
  4. Run `npm test && npm run build` to confirm nothing broke

No behaviour changes — pure extraction.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions