The complexity-report command fails with a require is not defined error when prompting the user to generate a new report. This occurs if the report file is missing at:
.taskmaster/reports/task-complexity-report.json
In scripts/modules/ui.js at line 1685, the displayComplexityReport function uses a CommonJS require('readline') statement inside an ES module. This leads to a runtime error since ES modules do not support require().
-
Update the
readlineimport to use dynamicimport()syntax:-
Replace:
const readline = require('readline').createInterface({ input: process.stdin, output: process.stdout });
-
With:
const readline = await import('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
-
-
Update references accordingly:
- Change
readline.question()βrl.question() - Change
readline.close()βrl.close()
- Change
-
Note:
- This aligns with the dynamic import pattern already used elsewhere in the same file (e.g., lines 1977β1979).
- It ensures consistency with ES module syntax across the project and resolves the runtime error.