Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel Filestructure is too large » Custom Laravel Configuration #3

Open
tronics opened this issue Sep 16, 2024 · 5 comments
Open

Comments

@tronics
Copy link

tronics commented Sep 16, 2024

Hello,

Since we have now phpstorm support, which is very welcomed, working on projects that use the laravel framework is of course a main goal.
When including the filestructure of a laravel project in a project the resulting query it is already exhausting the request and we get a "message too long" error in chatGPT.

How to include only the /app, /public and /routes folders?
I looked into config and have not yet found the best way to do this.
Please advice.

Thank you!

@atwellpub
Copy link
Contributor

atwellpub commented Sep 16, 2024

Hi @tronics

You should be able to achieve this by leveraging the exclude_patterns array. You would need to set up every folder you did not want to include.

{
    "excluded_patterns": [
        ".git",
        ".gitignore",
        "gradle",
        "gradlew",
        "gradlew.*",
        "node_modules",
        ".snapshots",
        ".idea",
        ".vscode",
        "*.log",
        "*.tmp",
        "target",
        "dist",
        "build",
        ".DS_Store",
        "*.bak",
        "*.swp",
        "*.swo",
        "*.lock",
        "*.iml",
        "coverage",
        "*.min.js",
        "*.min.css",
        "__pycache__"
    ],
    "default": {
        "default_prompt": "Please ##review my latest plugin code structure and wait for the next prompt.\n",
        "default_include_all_files": false,
        "default_include_entire_project_structure": true
    },
    "included_patterns": [
        "build.gradle",
        "settings.gradle",
        "gradle.properties",
        "pom.xml",
        "Makefile",
        "CMakeLists.txt",
        "package.json",
        "package-lock.json",
        "yarn.lock",
        "requirements.txt",
        "Pipfile",
        "Pipfile.lock",
        "Gemfile",
        "Gemfile.lock",
        "composer.json",
        "composer.lock",
        ".editorconfig",
        ".eslintrc.json",
        ".eslintrc.js",
        ".prettierrc",
        ".babelrc",
        ".env",
        ".dockerignore",
        ".gitattributes",
        ".stylelintrc",
        ".npmrc"
    ]
}

The included_patterns are an attempt to overwrite exclude patterns, for example; we do not want to include the folder gradle, but we do want to include build.gradle, so we add build.gradle to the included_patterns array.

I'd have to know more about your folder structure to advise how to drill down into /app, /public and /routes. I've personally not developed on a Laravel build.

@tronics
Copy link
Author

tronics commented Sep 16, 2024

Hi,

@atwellpub Thank you for explaining the exclude field and the include to override it.
Attached you find the site structure for a fresh laravel project with jetstream and pest testing.
Only helper files were created via phpstorm. And there are a few mysql migrations to get the included authentification running that comes with jetstream.

You see this list is quite heavy.

Eventually I would exclude everything (wildcard possible) and include only /app and /router. Not sure if that would work.
/public is also interesting and this is where the frontend resides.. those that use react and vue will certainly want to include that folder as well.
Help is appreciated. Ideally it would always keep that basic selection, so I can snapshot quickly.

laravel file structure.md

@atwellpub
Copy link
Contributor

This config file should help your structure:

{
    "excluded_patterns": [
        ".git",
        ".gitignore",
        "gradle",
        "gradlew",
        "gradlew.*",
        "node_modules",
        ".snapshots",
        ".idea",
        ".vscode",
        "*.log",
        "*.tmp",
        "target",
        "dist",
        "build",
        ".DS_Store",
        "*.bak",
        "*.swp",
        "*.swo",
        "*.lock",
        "*.iml",
        "coverage",
        "*.min.js",
        "*.min.css",
        "__pycache__",
        "tests",
        "storage",
        "bootstrap",
        "config",
        "database",
        "vendor",
        "*.phpunit.cache",
        "*.env"
    ],
    "default": {
        "default_prompt": "Please ##review my latest plugin code structure and wait for the next prompt.\n",
        "default_include_all_files": false,
        "default_include_entire_project_structure": true
    },
     "included_patterns": [
        "build.gradle",
        "settings.gradle",
        "gradle.properties",
        "pom.xml",
        "Makefile",
        "CMakeLists.txt",
        "package.json",
        "package-lock.json",
        "yarn.lock",
        "requirements.txt",
        "Pipfile",
        "Pipfile.lock",
        "Gemfile",
        "Gemfile.lock",
        "composer.json",
        "composer.lock",
        ".editorconfig",
        ".eslintrc.json",
        ".eslintrc.js",
        ".prettierrc",
        ".babelrc",
        ".env",
        ".dockerignore",
        ".gitattributes",
        ".stylelintrc",
        ".npmrc"
    ]
}

Excluded:

  • tests, storage, bootstrap, vendor

I'm adding vendor to the default excluded patterns and I am open to more recommendations; as long as they don't conflict with other popular devop builds then they should be okay to add.

@tronics
Copy link
Author

tronics commented Sep 17, 2024

Yes, I understand you are trying to find a general configuration suitable for all projects.

With your suggested configuration the output is still too extensive to be able to post it to the LLM.

Most developers need a perfect config for their specific project type. My focus is currently Laravel.
You might want to provide different configs to select for the dev depending on project in the future.
Or just put some knowledgebase on github or docs to provide good startpoints.
Would make onboarding very comfy.

I would argue the LLM has already knowledge what laravel is and only the individual code is enough to get good results.
So what I did to only show code and structure that I added to the project.

This seems like a good config for my goals - small size and custom code included.
The strategy is to exclude everything and only add a few folders.

Really happy with this one.

CONFIG

    "excluded_patterns": [
        "*.*",
        "*/*.*",
        "*/*/*.*",
        "app/Providers",
        "vendor",
        "LICENSE",
        ".git",
        ".gitignore",
        "gradle",
        "gradlew",
        "gradlew.*",
        "node_modules",
        ".snapshots",
        ".idea",
        ".vscode",
        "*.log",
        "*.tmp",
        "target",
        "dist",
        "build",
        ".DS_Store",
        "*.bak",
        "*.swp",
        "*.swo",
        "*.lock",
        "*.iml",
        "coverage",
        "*.min.js",
        "*.min.css",
        "__pycache__",
        "tests",
        "storage",
        "bootstrap",
        "config",
        "database",
        "vendor",
        "*.phpunit.cache",
        "*.env"
    ],
    "default": {
        "default_prompt": "Code and Filestructure for my laravel PHP 8.3 web application, wait for the next prompt for instructions.\n",
        "default_include_all_files": false,
        "default_include_entire_project_structure": true
    },
    "included_patterns": [
        "app/*.php",
        "routes/*.php",
        "public/*.php",
        "public/*.js"
    ]
}```

RESULT
[test.md](https://github.com/user-attachments/files/17029654/test.md)

@atwellpub atwellpub changed the title Laravel Filestructure is too large Laravel Filestructure is too large » Custom Laravel Configuration Sep 17, 2024
@atwellpub
Copy link
Contributor

Most developers need a perfect config for their specific project type. My focus is currently Laravel.
You might want to provide different configs to select for the dev depending on project in the future.
Or just put some knowledgebase on github or docs to provide good startpoints.
Would make onboarding very comfy.

I'm not opposed, and would it would take time and help from the user base. But doable.

This seems like a good config for my goals - small size and custom code included.

Thank you so much for providing a config that is working for you. Amazing work.

I'll keep thinking about a way to bring project specific config defaults to the project. Right now I really appreciate the sharing of your progress and this will help provide a heads up for others looking to do that same. I'll also leave the issue open until some improvement makes its way into the plugin to handle different default environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants