Can we have a possibility to send our currently full file structure with full folder and file names from workpace we working on to a model that could be useful to get some suggestions from the LLM
Hi @bulawow ,
Have you seen these:
https://docs.cursor.com/context/@-symbols/@-folders
https://docs.cursor.com/context/@-symbols/@-files
Is that the type of functionality you are looking for?
Can you provide an example of the type of question/prompt you want to supply to Cursor?
No i mean passing whole workspace structure like this for a model
project-root/
βββ frontend/
β βββ public/
β β βββ index.html
β β βββ favicon.ico
β β βββ manifest.json
β βββ src/
β β βββ components/
β β β βββ Header.js
β β β βββ Footer.js
β β β βββ Navigation.js
β β βββ pages/
β β β βββ Home.js
β β β βββ About.js
β β β βββ Contact.js
β β βββ styles/
β β β βββ main.scss
β β β βββ variables.scss
β β βββ utils/
β β β βββ api.js
β β β βββ helpers.js
β β βββ App.js
β β βββ index.js
β βββ package.json
β βββ webpack.config.js
βββ backend/
β βββ src/
β β βββ controllers/
β β β βββ userController.js
β β β βββ productController.js
β β βββ models/
β β β βββ User.js
β β β βββ Product.js
β β βββ routes/
β β β βββ userRoutes.js
β β β βββ productRoutes.js
β β βββ middleware/
β β β βββ auth.js
β β β βββ errorHandler.js
β β βββ config/
β β β βββ database.js
β β βββ server.js
β βββ tests/
β β βββ unit/
β β β βββ userModel.test.js
β β βββ integration/
β β βββ userRoutes.test.js
β βββ package.json
β βββ .env
βββ database/
β βββ migrations/
β β βββ 001_create_users_table.sql
β β βββ 002_create_products_table.sql
β βββ seeds/
β βββ users.sql
β βββ products.sql
βββ docs/
β βββ api-spec.md
β βββ deployment-guide.md
βββ scripts/
β βββ deploy.sh
β βββ backup-db.sh
βββ .gitignore
βββ README.md
βββ docker-compose.yml
And then would you ask a question like:
Can you give me some advice on the structure of my application?
Is that the type of question you want to ask Cursor?
Is that why you want to pass it the folder structure specifically?
I could ask to rearange the workspace for me in a certain way
I could ask if this file structure is alright for certain standards
I could ask the model to analyze certain files inside a folder and ask if they are a good fit for the place they are currently placed at or to swap it somewhere else
Before creating new feature first i could explain what feature i am working on and ask the model what is the best place for it in the workspace
There is probably countless more possibilities i just cant think of more
You can ask this question in the chat or in Composer:
Show me the structure of my project. Then, you can keep asking more questions about the structure. I just checked, and it works.
Ye but it skips folders that donβt have any files and simply just skipps some files/folders if the workspace is big so having normal implementation of that instead of leaving ai to create it will be just better and more reliable
Show me the structure of my project
I tried this on a medium-sized codebase, and it only catches a few files. Thatβs one of my main topic of interest actually, is how to ask AI to document the structure/architecture of my project.
Havenβt found a compelling solution so far.
Really nice recommendation, perhaps the feature can search for files (excluding the contents of the file) and in addition to the file tree also provide small descriptions for each file (to keep the text to a minimum). Might help withhe AI not assuming files doesnβt exist.
I came to this post from a google search looking for the same thing. Iβm disappointed to learn that this feature does not exist yet. When working on a codebase that isnβt mine, I sometimes find it hard to find where a feature might be implemented. Ctrl+Enter works on smaller codebases, but on a bigger one it does not always seem to find the relevant files even after repeatedly trying again and again using different prompts. I would find it very helpful if we could send the entire file structure to the LLM so that it can then suggest files to look into based solely on their name and path.
Iβve been wanting this too (I was thinking a @FileStructure
command) and its come up several times where Iβve needed it. One example is expo router, where itβs nice to query about the file structure to understand the stack/tab etc layouts. But Iβve had a number of other times where Iβve found myself wanting it, so I donβt think itβs very niche and would be useful to a number of people
I havenβt tried that yet, but could including the file structure in a file that we then add as context make any sense? Maybe the output of a tree
command or something like that? Then one could figure out how to generate this automatically every time we change something in the project. Or just add a task to execute ad-hoc. Then maybe even ignore the structure file to not include it in the git changes.
@petros nice idea, here is a quick shot at it:
- Run the following command:
git ls-tree -r --name-only HEAD | grep -v -E '(vendor|public|seeds|migrate)' > tree.txt
This will create a tree.txt
file at the root of the project with all the files except:
- The ones ignored as per the
.gitignore
- The folders specified in the grep command
To display this in a human readable way you can add | tree --fromfile
but I wsa thinking that repeating full pathnames was probably more useful for AI ingestion.
- Go to the composer and type:
Using the file @tree.txt please establish as many needed steps to analyse
the files that you need, and write a comprehensive ARCHITECTURE.md file
that should be the go-to place for a developper who need to understand the
birds-eye view of the whole project, or details about any of its components.
The result is that the composer (with agents) did 3 steps by itself and produced a pretty comprehensive architecture document. This is not perfect and need to be improved, but it is already a good start!
Anybody welcome to improve based on that flow!
Thought this was a super sensible and obvious idea. Didnβt want to have to keep manually updating the tree, so I created AutoContextTree, a VS Code/Cursor extension which updates the tree automatically whenever you make a git commit.
Just spent more time trying and failing to publish with a Microsoft Personal Access Token than it took to create the extension, sigh! Just use the GitHub.