Skip to content

Add whitelist support for .roo/temp/ directory in list_files tool to allow gitignored workflow filesΒ #5409

@MuriloFP

Description

@MuriloFP

What specific problem does this solve?

The .roo/temp/ directory is used by various modes (PR Fixer, Issue Fixer, etc.) to store temporary workflow files that are essential for their operation. However, we need to add .roo/temp/ to .gitignore to prevent these temporary files from being committed to the repository.

Who is affected: All users who use modes that rely on temporary workflow files
When this happens: When modes try to list or access files in .roo/temp/ after it's added to .gitignore
Current behavior: When .roo/temp/ is added to .gitignore, the list_files tool completely ignores the directory because ripgrep respects .gitignore by default in recursive mode
Expected behavior: The list_files tool should be able to list files in .roo/temp/ even when it's in .gitignore
Impact: Without access to temp files, modes cannot complete their workflows, breaking functionality for PR fixing, issue fixing, and other orchestrated tasks

Additional context (optional)

Currently, modes store workflow files in .roo/temp/ subdirectories (e.g., .roo/temp/pr-fixer-orchestrator/pr-3999/). These files need to be accessible to the modes but should not be committed to git.

Roo Code Task Links (Optional)

No response

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear impact and context

Interested in implementing this?

  • Yes, I'd like to help implement this feature

Implementation requirements

  • I understand this needs approval before implementation begins

How should this be solved? (REQUIRED if contributing, optional otherwise)

How should this be solved?

Add a whitelist mechanism to the list_files tool that allows specific directories to be listed even when they're gitignored. The .roo/temp/ directory should be whitelisted by default.

What will change:

  • Add a whitelist constant in src/services/glob/constants.ts for directories that should always be visible
  • Modify the ripgrep arguments in src/services/glob/list-files.ts to exclude whitelisted paths from gitignore filtering
  • Ensure both recursive and non-recursive modes respect the whitelist

User interaction:

  • No user-facing changes required
  • Modes will transparently be able to access their workflow files
  • The .roo/temp/ directory will appear in file listings even when gitignored

How will we know it works? (Acceptance Criteria - REQUIRED if contributing, optional otherwise)

Given .roo/temp/ is added to .gitignore
When a mode calls list_files on .roo/temp/ or any parent directory
Then the .roo/temp/ directory and its contents are listed
And other gitignored directories remain hidden
But .roo/temp/ files are still ignored by git

Given a mode creates workflow files in .roo/temp/mode-name/
When the mode lists files recursively from the project root
Then the workflow files in .roo/temp/mode-name/ are visible
And the files can be read and accessed normally

Technical considerations (REQUIRED if contributing, optional otherwise)

Implementation approach:

  • Key files to modify:
    • src/services/glob/constants.ts - Add GITIGNORE_WHITELIST constant
    • src/services/glob/list-files.ts - Modify buildRecursiveArgs() to add --no-ignore for whitelisted paths
  • Current architecture:
    • The tool uses ripgrep with --files flag to list files
    • In recursive mode, ripgrep respects .gitignore by default
    • The buildRecursiveArgs() function at lines 108-120 builds the ripgrep arguments
  • Integration points:
    • The listFiles() function is called by listFilesTool in src/core/tools/listFilesTool.ts
    • No changes needed to the tool interface or assistant message handling
  • Similar patterns in codebase:
    • DIRS_TO_IGNORE constant already exists for excluding directories
    • The whitelist would follow a similar pattern but for inclusion

Performance implications:

  • Minimal impact - only adds a few extra ripgrep arguments
  • No additional file system operations required

Compatibility concerns:

  • None - the change is backward compatible
  • Existing behavior for non-whitelisted directories remains unchanged

Trade-offs and risks (REQUIRED if contributing, optional otherwise)

Alternatives considered:

  • Store temp files outside the project directory: Would require significant refactoring and complicate file access
  • Don't add .roo/temp/ to .gitignore: Would pollute git history with temporary files
  • Use a different tool for accessing temp files: Would add complexity and inconsistency

Potential risks:

  • If whitelist is too broad, it could expose unintended files: Mitigation - keep whitelist minimal and specific
  • Ripgrep argument handling complexity: Mitigation - thorough testing of both recursive and non-recursive modes

Breaking changes:

  • None - this is a purely additive change

Metadata

Metadata

Assignees

Labels

Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.enhancementNew feature or requestproposal

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions