Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
20.49k stars 1.89k forks source link

Repo map is unexpectedly much smaller when accidentally mentioning filenames (without extensions) of deeply-nested files #1628

Open tkeith opened 3 weeks ago

tkeith commented 3 weeks ago

Issue

I created a fresh t3 app using npm create t3-app@latest. It has file src/trpc/server.ts and directory src/server. Here's the full tree:

.
├── README.md
├── next-env.d.ts
├── next.config.js
├── package.json
├── postcss.config.cjs
├── prettier.config.js
├── prisma
│   └── schema.prisma
├── public
│   └── favicon.ico
├── src
│   ├── app
│   │   ├── _components
│   │   │   └── post.tsx
│   │   ├── api
│   │   │   └── trpc
│   │   │       └── [trpc]
│   │   │           └── route.ts
│   │   ├── layout.tsx
│   │   └── page.tsx
│   ├── env.js
│   ├── server
│   │   ├── api
│   │   │   ├── root.ts
│   │   │   ├── routers
│   │   │   │   └── post.ts
│   │   │   └── trpc.ts
│   │   └── db.ts
│   ├── styles
│   │   └── globals.css
│   └── trpc
│       ├── query-client.ts
│       ├── react.tsx
│       └── server.ts
├── tailwind.config.ts
└── tsconfig.json

When I launch aider and enter the message "test", I get a reasonable-looking repo map:

USER Here are summaries of some files present in my git repository.
USER Do not propose changes to these files, treat them as *read-only*.
USER If you need to edit any of these files, ask me to *add them to the chat* first.
USER 
USER .env.example
USER 
USER .eslintrc.cjs
USER 
USER .gitignore
USER 
USER README.md
USER 
USER next.config.js
USER 
USER package.json
USER 
USER postcss.config.cjs
USER 
USER prettier.config.js
USER 
USER prisma/schema.prisma
USER 
USER public/favicon.ico
USER 
USER src/app/_components/post.tsx
USER 
USER src/app/api/trpc/[trpc]/route.ts
USER 
USER src/app/layout.tsx
USER 
USER src/app/page.tsx
USER 
USER src/env.js
USER 
USER src/server/api/root.ts:
USER ⋮...
USER │export type AppRouter = typeof appRouter;
USER │
USER ⋮...
USER 
USER src/server/api/routers/post.ts
USER 
USER src/server/api/trpc.ts
USER 
USER src/server/db.ts
USER 
USER src/styles/globals.css
USER 
USER src/trpc/query-client.ts
USER 
USER src/trpc/react.tsx
USER 
USER src/trpc/server.ts
USER 
USER tailwind.config.ts
USER 
USER tsconfig.json

However, when I enter a prompt including the word "server", like "test server test", I get a very minimal one, which isn't very useful to aider:

USER Here are summaries of some files present in my git repository.
USER Do not propose changes to these files, treat them as *read-only*.
USER If you need to edit any of these files, ask me to *add them to the chat* first.
USER 
USER .env.example
USER 
USER .gitignore
USER 
USER README.md
USER 
USER next.config.js
USER 
USER package.json
USER 
USER tsconfig.json

I'm guessing this has to do with the nested directory server or file server.ts, but I don't understand the intent of this behavior. Is this a bug? Is there a way to work around this?

Version and model info

Aider v0.57.0 Main model: claude-3-5-sonnet-20240620 with diff edit format, infinite output Weak model: claude-3-haiku-20240307 Git repo: .git with 25 files Repo-map: using 1024 tokens, auto refresh

paul-gauthier commented 1 week ago

Thanks for trying aider and filing this issue.

Can you try aider --upgrade to get the latest version and see if this problem is better? I believe it should be fixed.