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

Remove filetype checking #32

Merged
merged 3 commits into from
Jul 30, 2023
Merged

Remove filetype checking #32

merged 3 commits into from
Jul 30, 2023

Conversation

PCSwingle
Copy link
Member

@PCSwingle PCSwingle commented Jul 29, 2023

Remove filetype checking, add glob includes, and fix a few bugs. To test include globs in zsh, put quotes around paths.

In case you're wondering why the glob path expansion is at the very beginning (outside of codefilemanager), there are 2 reasons:

  1. We need it to resolve the git root
  2. Because some terminals (such as zsh) automatically expand glob patterns, I think it's best to do it at the very beginning so there is no difference between terminals.

@PCSwingle PCSwingle mentioned this pull request Jul 30, 2023
@@ -77,4 +77,4 @@ Run Mentat from within your project directory. Mentat uses git, so if your proje

`mentat <paths to files or directories>`

If you provide a directory, Mentat will add all non-hidden text files in that directory to it's context. If this exceeds the GPT-4 token context limit, try running Mentat with just the files you need it to see.
If you provide a directory, Mentat will add all non git-ignored text files in that directory to it's context. If you provide a glob pattern, Mentat will add all files matching the pattern to it's context. If this exceeds the GPT-4 token context limit, try running Mentat with just the files you need it to see.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you provide a directory, Mentat will add all non git-ignored text files in that directory to it's context. If you provide a glob pattern, Mentat will add all files matching the pattern to it's context. If this exceeds the GPT-4 token context limit, try running Mentat with just the files you need it to see.
List the files you would like Mentat to read and edit as arguments. Mentat will add each of them to context, so be careful not to exceed the GPT-4 token context limit. To add multiple files at once, you can also provide directories as arguments. When a directory is provided, Mentat will add all the contained files, except for ones ignored in your `.gitignore`.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we not mentioning that you an use globs as file paths?

### File Exclude Glob list
List of [glob patterns](https://docs.python.org/3/library/glob.html) that will exclude all files from context that it matches starting from the given directory.
List of [glob patterns](https://docs.python.org/3/library/glob.html) that will exclude all files from context that it matches starting from the git root. Importantly, this means that the pattern to exclude all files ending with `.py` would be `**/*.py` rather than `*.py`. Here is an example that would exclude all hidden directories and files:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
List of [glob patterns](https://docs.python.org/3/library/glob.html) that will exclude all files from context that it matches starting from the git root. Importantly, this means that the pattern to exclude all files ending with `.py` would be `**/*.py` rather than `*.py`. Here is an example that would exclude all hidden directories and files:
List of [glob patterns](https://docs.python.org/3/library/glob.html) to exclude files from being read/edited by Mentat. These take effect whenever you provide Mentat with a directory as an argument. Mentat will add all files in the directory that are not in your `.gitignore` and do not match these glob patterns. Glob patterns are interpreted from the git root location. If you wanted to exclude all files ending in `.py`, the pattern to use would be `**/*.py` rather than `*.py`. Here is an example that would exclude all hidden directories and files:

Comment on lines -25 to -59
# mimetypes is OS dependent, so it's best to add as many extensions as we can
# fmt: off
default_filetype_include_list = [
".py", # Python
".java", # Java
".scala", # Scala
".kt", # Kotlin
".php", # PHP
".html", # HTML
".css", # CSS
".less", # Less
".scss", # SCSS
".js", # Javascript
".ts", # Typescript
".c", # C
".cpp", # C++
".h", # C Header
".cs", # C#
".go", # Go
".rs", # Rust
".rb", # Ruby
".swift", # Swift
".lua", # Lua
".pl", # Perl
".sql", # SQL
".r", # R
".m", # objective-c
".sh", # shell scripts
".f", # fortran
".jsx", # javascript react
".tsx", # typescript react
]
default_filetype_exclude_list = []
# fmt: on

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

@biobootloader
Copy link
Member

Massive.

@biobootloader biobootloader merged commit 33529d5 into main Jul 30, 2023
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants