Bug: Unable to Exclude Dotfiles in .codetopromptrc Configuration
Description:
I am using the .codetopromptrc file to configure code2prompt and trying to exclude files that start with a dot (such as .gitignore and .codetopromptrc) using the exclude option. However, I cannot seem to exclude these dotfiles, including the .codetopromptrc file itself. I have tried various patterns, but the dotfiles still appear in the Table of Contents.
Steps to Reproduce:
-
Create a .codetopromptrc configuration file with the following content:
{
"suppress_comments": false,
"line_number": false,
"encoding": "cl100k_base",
"filter": "**.tsx, **.js, README.md, notes.txt, **/Dockerfile, package.json, tsconfig.json, *.yml, .env",
"exclude": "**.txt, tests/*,prototypes/*, **/node_modules/**, **/frontend/build/**, **/.git/**, **/.vscode/**, **/.idea/**, backend/package-lock.json, code2prompt.txt, .gitignore, .codepromptrc",
"tokens": false
}
-
Run the following command:
code2prompt --output code2prompt.txt --tokens --path .
-
The resulting table of contents still includes dotfiles, such as .gitignore and .codetopromptrc:
# Table of Contents
- notes.txt
- README.md
- .gitignore
- .codetopromptrc
- LICENSE
- .github/workflows/ci-cd.yml
- backend/Dockerfile
- backend/package.json
- backend/src/app.js
- backend/src/handlers/health.js
- frontend/tsconfig.json
- frontend/package.json
- frontend/src/react-app-env.d.ts
- frontend/src/App.tsx
- frontend/src/index.tsx
- frontend/src/components/HealthCheck.tsx
- frontend/src/pages/HealthCheck.tsx
- frontend/public/index.html
Expected Behavior:
Files like .gitignore, .codetopromptrc, and other dotfiles should be excluded as specified in the exclude option.
Attempted Solutions:
- Tried the following patterns in the
exclude option to remove dotfiles:
.codetopromptrc
**.codetopromptrc
/\.codetopromptrc
None of these worked to exclude the dotfiles.
note: It might be intended, but if you specify the --gitignore option from the command line then it will ignore the exclude options in the .codetopromptrc file.
Environment:
code2prompt version 0.6.5
Possible Fix:
There might be an issue with how the tool processes glob patterns for dotfiles in the exclude option. Support for better handling of dotfile exclusions would resolve this issue.
Bug: Unable to Exclude Dotfiles in
.codetopromptrcConfigurationDescription:
I am using the
.codetopromptrcfile to configurecode2promptand trying to exclude files that start with a dot (such as.gitignoreand.codetopromptrc) using theexcludeoption. However, I cannot seem to exclude these dotfiles, including the.codetopromptrcfile itself. I have tried various patterns, but the dotfiles still appear in the Table of Contents.Steps to Reproduce:
Create a
.codetopromptrcconfiguration file with the following content:{ "suppress_comments": false, "line_number": false, "encoding": "cl100k_base", "filter": "**.tsx, **.js, README.md, notes.txt, **/Dockerfile, package.json, tsconfig.json, *.yml, .env", "exclude": "**.txt, tests/*,prototypes/*, **/node_modules/**, **/frontend/build/**, **/.git/**, **/.vscode/**, **/.idea/**, backend/package-lock.json, code2prompt.txt, .gitignore, .codepromptrc", "tokens": false }Run the following command:
code2prompt --output code2prompt.txt --tokens --path .The resulting table of contents still includes dotfiles, such as
.gitignoreand.codetopromptrc:Expected Behavior:
Files like
.gitignore,.codetopromptrc, and other dotfiles should be excluded as specified in theexcludeoption.Attempted Solutions:
excludeoption to remove dotfiles:.codetopromptrc**.codetopromptrc/\.codetopromptrcNone of these worked to exclude the dotfiles.
note: It might be intended, but if you specify the --gitignore option from the command line then it will ignore the exclude options in the .codetopromptrc file.
Environment:
code2prompt version 0.6.5
Possible Fix:
There might be an issue with how the tool processes glob patterns for dotfiles in the
excludeoption. Support for better handling of dotfile exclusions would resolve this issue.