assist refactor and assist complexity
These commands work on TypeScript projects. Refactoring and code quality covers the slash commands that drive them.
Refactoring
Section titled “Refactoring”The commands that change files are dry runs by default: they print what they would do. Add --apply to do it.
assist refactor check [pattern]lists files over 100 lines.--max-lines <n>changes the limit, and--modified,--stagedor--unstagedcheck only those changes.assist refactor ignore <file>exempts a file fromrefactor check, allowing it its current length plus ten lines. Exemptions are kept inrefactor.yml.assist refactor rename file <source> <destination>moves a file and updates every import of it.assist refactor rename symbol <file> <oldName> <newName>renames a variable, function, class or type everywhere it’s used.assist refactor extract <file> <functionName> <destination>moves a function, and the private helpers only it uses, into a new file and imports it back.assist refactor restructure [root]experimental plans where every file underrootbelongs by its imports.--applymoves the files, rewrites their imports and removes emptied folders.--checklists files that differ from the plan and fails if there are any, so it can run as a verify check. See Restructuring folders for its settings.
Complexity
Section titled “Complexity”The metric commands take a file glob and an optional --threshold, and fail when a result crosses it.
assist complexity <pattern>reports every metric below for a single matching file, or maintainability alone when several match. A bare file name matches anywhere in the repo.assist complexity cyclomatic [pattern]scores the branching in each function.assist complexity halstead [pattern]reports Halstead volume, difficulty and effort for each function.assist complexity maintainability [pattern]scores each file’s maintainability from 0 to 100.--thresholdis the minimum score, and--ignore <glob>excludes more files on top ofcomplexity.ignore.assist complexity sloc [pattern]counts each file’s source lines.
