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

Cannot exclude filenames that start with a dot #15

Open
yazoooo opened this issue Sep 5, 2024 · 0 comments
Open

Cannot exclude filenames that start with a dot #15

yazoooo opened this issue Sep 5, 2024 · 0 comments

Comments

@yazoooo
Copy link

yazoooo commented Sep 5, 2024

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:

  1. 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
    }
  2. Run the following command:

    code2prompt --output code2prompt.txt --tokens --path .
  3. 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.

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

1 participant