defer line counting from PathIndex build to manifest - #6
Merged
Conversation
The inline !echo with ${VAR:-default} syntax triggered
Claude Code permission rejection on some clients.
Replaced with printenv (no expansion) plus TeamCreate
tool availability as a secondary gate.
PathIndex walk now does stat-only -- no file opens, no byte reads. Line counting and binary content detection move to buildManifest(), which runs only for changed files (~10-50). 172K-file repo: 22s -> 1s for index build. Other changes in this commit: - readFile falls through to direct fs read when file is not in the index (supports reading outside indexed paths) - buildManifest runs in parallel with fetchDiffs and resolveInstructions - Pool class and #countLines removed; standalone countFileLines() exported for on-demand use
There was a problem hiding this comment.
Pull request overview
Improves session startup performance by making PathIndex construction stat-only and deferring line counting/binary probing to manifest building for changed files, while also parallelizing startup work and bumping plugin/package versions.
Changes:
- Make
PathIndex.new()stat-only (no file opens/reads); move line counting intobuildManifest()via newcountFileLines(). - Parallelize
buildManifest()with diff fetching and instruction resolution duringSession.start(). - Allow
RepoFs.readFile()to fall back to direct filesystem reads when a path is missing from the index; bump versions to 0.1.7.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| claude/kensai/skills/review/SKILL.md | Updates environment check command for agent teams enablement. |
| claude/kensai/mcp/review/src/session/session.ts | Defers line counting to manifest build; parallelizes manifest with other startup tasks. |
| claude/kensai/mcp/review/src/repofs/repofs.ts | Changes readFile() to fall back to filesystem when path isn’t indexed. |
| claude/kensai/mcp/review/src/repofs/pathindex/pathindex.ts | Makes index build stat-only; introduces exported countFileLines(). |
| claude/kensai/mcp/review/src/repofs/pathindex/pathindex.test.ts | Updates PathIndex expectations and adds tests for countFileLines(). |
| claude/kensai/mcp/review/package.json | Bumps MCP package version to 0.1.7. |
| claude/kensai/.claude-plugin/plugin.json | Bumps plugin version to 0.1.7. |
| .claude-plugin/marketplace.json | Bumps marketplace version to 0.1.7. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Direct filesystem fallback in readFile bypassed the WALK_EXCLUDE_DIRS guard, allowing reads into .git/. Now checks the first path segment against the exclusion set before falling through to stat. Also fixes isBinary JSDoc to reflect extension-based detection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
buildManifest(), which runs only for changed filesreadFile()falls through to direct filesystem read when file is not in the indexbuildManifestparallelized withfetchDiffsandresolveInstructionsPerformance
Benchmarked on two Gaijin repos:
Test plan
countFileLines)vp checkclean