Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Aug 10, 2025

This PR implements the enhancement described in #6907 to show package names and file paths during the indexing process, providing better visibility into what is being indexed, especially in multi-package workspaces.

Changes Made

1. Enhanced state-manager.ts

  • Updated reportFileQueueProgress method to accept full file path and optional package name parameters
  • Modified status messages to display package names when available, or full paths otherwise
  • Added path module import for basename extraction

2. Enhanced orchestrator.ts

  • Added extractPackageName method to intelligently extract package names from file paths
  • Detects packages in:
    • node_modules (e.g., @scope/package or package)
    • monorepo packages directory
    • src directory structure
  • Passes full file path and extracted package name to state manager

3. File Watcher Integration

  • Verified that file-watcher.ts already passes full file paths in progress updates
  • No changes needed as it was already providing the required data

Benefits

  • Users now see which package is being indexed in multi-package workspaces
  • Full file paths are displayed when package names cannot be determined
  • Better understanding of indexing progress and scope
  • Improved debugging capabilities when indexing issues occur

Testing

  • All existing tests pass (394 tests)
  • TypeScript compilation successful
  • ESLint checks pass with no warnings

Example Output

Before: Processing 5 / 10 files. Current: index.ts
After: Processing 5 / 10 files. Package: @myorg/package, File: index.ts
Or: Processing 5 / 10 files. Path: /workspace/src/utils/index.ts

Fixes #6907


Important

Enhance indexing process to display package names and file paths, improving visibility and debugging in multi-package workspaces.

  • Behavior:
    • reportFileQueueProgress in state-manager.ts now accepts full file paths and optional package names.
    • Status messages display package names if available, otherwise full paths.
  • Functions:
    • extractPackageName in orchestrator.ts extracts package names from file paths, handling node_modules, monorepo packages, and src directories.
    • Passes full file path and extracted package name to state-manager.ts.
  • Misc:
    • file-watcher.ts already provides full file paths, no changes needed.
    • Adds path module import in state-manager.ts for basename extraction.

This description was created by Ellipsis for da160fe. You can customize this summary. It will automatically update as commits are pushed.

- Enhanced state-manager.ts to accept full file path and package name parameters
- Added package name extraction logic to orchestrator.ts
- Updated status messages to display package names and file paths during indexing
- Improved user visibility into what is being indexed in multi-package workspaces

Fixes #6907
@roomote roomote bot requested review from cte, jr and mrubens as code owners August 10, 2025 16:51
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. enhancement New feature or request labels Aug 10, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

I reviewed my own code and found issues. Shocking, I know.

}`
// Extract file information for display
const fileBasename = currentFilePath ? path.basename(currentFilePath) : "..."
const packageDisplay = packageName ? `${packageName}` : ""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These template literals are redundant. Could we simplify to just:

const pathDisplay = currentFilePath ? `${currentFilePath}` : ""

if (packageName) {
message = `Processing ${processedFiles} / ${totalFiles} ${this._currentItemUnit}. Package: ${packageDisplay}, File: ${fileBasename}`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have we considered using the i18n system for these new status messages? The rest of the codebase uses t() for user-facing strings, and it would maintain consistency.


// Extract npm package name from package.json if close to the file
try {
const dirPath = path.dirname(filePath)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This variable is declared but never used. Should we remove it?

const dirPath = path.dirname(filePath)

// Check if it's part of the src/ directory structure
const srcMatch = filePath.match(/src[\\/\\\\]([^\\/\\\\]+)/)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this the intended behavior? A file at src/components/Button.tsx would return "components" as the package name, which seems misleading. Should we reconsider this logic or perhaps only use this as a last resort?

* @param filePath Path to extract package name from
* @returns Package name if identified, otherwise undefined
*/
private extractPackageName(filePath?: string): string | undefined {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This new method lacks test coverage. Could we add unit tests to verify the package name extraction logic works correctly for various path patterns?

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Aug 10, 2025
@daniel-lxs
Copy link
Member

Closing, the author of the issue is interesten in implementing this

@daniel-lxs daniel-lxs closed this Aug 12, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Aug 12, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Show Package Names and File Paths during indexing

4 participants