Code enhancement
npx --no-install udiot enhance --help
npx --no-install udiot enhance src/services/orders.ts --dry-run
enhance (alias e) parses a TypeScript file and reports suggestions: long
lines, snake_case variables, synchronous fs calls, for loops, eval(),
Math.random(), async functions without try/catch, and console.log.
With AI enabled, the model's suggestions are added; only those that point at
real lines and name the code to replace are kept. The command needs the
optional peer typescript.
| Option | Meaning |
|---|---|
-t, --type <types> |
Comma-separated categories: style, performance, security, bug-fix, refactor, optimization |
-c, --confidence <level> |
Minimum confidence, default 50 |
--auto-fix |
Apply the safe automatic fixes (trailing whitespace, runs of blank lines) |
--dry-run |
Show the suggestions only |
-i, --interactive |
Review one suggestion at a time (the default) |
-b, --batch |
Pick several suggestions to apply at once |
--no-backup |
Skip the <name>.backup.<timestamp>.<ext> copy made before changing a file |
Many suggestions are advice rather than a replacement: what to do about an
eval() call, for example. Those are shown but cannot be applied; change the
code by hand. A suggestion is applied only if its code is still on the line
where it was found, and the renaming suggestion changes only the declaration,
so update the references yourself.
Review the diff after any change and run your tests. Commit before running a mutating mode, or keep the backups.