nanocoder
nanocoder copied to clipboard
[Bug] FileScanner returns backslash paths on Windows, which breaks directory detection for init and AGENTS.md generation
Description
FileScanner stores paths from path.relative(), which uses \ on Windows. The project analyzer and the AGENTS.md generator split and match them with /, so folders like src/utils and patterns like docs/* are not recognised. Three tests in the repo's own file-scanner.spec.ts already fail on Windows because of this.
Environment
- OS: Windows 11 Home 10.0.26300
- Node version: v22.22.3
- Nanocoder version: 1.32.0 (built from main at eb7dee57)
- Provider: Not provider-specific
- Model: Not model-specific
Steps to Reproduce
- Create a folder with
src/index.ts,src/utils/helper.tsanddocs/guide.md. - Run
await new FileScanner(root).scan(). - Or run
pnpm exec ava source/init/file-scanner.spec.ts.
Expected Behavior
files contains src/index.ts, src/utils/helper.ts, docs/guide.md, and directories contains src/utils.
Actual Behavior
files: ["docs\\guide.md","src\\index.ts","src\\utils\\helper.ts"]
✘ FileScanner - scan finds files in directory
✘ FileScanner - getFilesByPattern with docs pattern
✘ FileScanner - scan handles subdirectories
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder (main)
Suggested fix:
source/init/file-scanner.ts:75-88: convert eachrelative()result with.split(sep).join('/')before storing it infilesanddirectories.source/init/project-analyzer.ts(thesplit('/')calls) andsource/init/agents-template-generator.tsthen work as written.- The three failing specs above should pass.
I'd like to pick this up. I'm on Windows 11, so I can reproduce the three failing file-scanner.spec.ts tests and check the fix against them.