Conversation
Co-authored-by: fbosch <6979916+fbosch@users.noreply.github.com>
Co-authored-by: fbosch <6979916+fbosch@users.noreply.github.com>
Co-authored-by: fbosch <6979916+fbosch@users.noreply.github.com>
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the
📝 WalkthroughWalkthroughThis PR adds a new CLI command to clear the global Git cache with metrics reporting, extends the TOC configuration to support "tree" and "compressed" formats with normalization logic, updates schemas and documentation, and includes comprehensive tests for all new features. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
commit: |
There was a problem hiding this comment.
Pull request overview
This pull request adds a new tocFormat configuration option to control how TOC.md files are formatted, supporting two formats: "tree" (hierarchical directory structure) and "compressed" (flat file list). The default format is "compressed".
Changes:
- Added
tocFormatconfiguration field accepting "tree" or "compressed" as values - Implemented compressed TOC rendering that displays files in a flat list with full paths
- Updated configuration schema and types to support both the new
tocFormatfield and backward-compatibletocfield (which can now be boolean or format string) - Added comprehensive test coverage for both TOC formats and backward compatibility scenarios
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/sync-toc-formats.test.js | New comprehensive test suite covering default compressed format, explicit tree format, defaults inheritance, and backward compatibility with boolean and string toc values |
| src/toc.ts | Added renderCompressedToc function for flat file list rendering and updated generateSourceToc and writeToc to support format selection |
| src/config.ts | Added TocFormat type, updated interfaces to include both toc and tocFormat fields, implemented normalizeTocConfig for handling configuration normalization, and updated DEFAULT_CONFIG to use tocFormat: "compressed" |
| src/config-schema.ts | Added TocFormatSchema and updated Zod schemas to accept toc as union of boolean or format string, plus separate tocFormat field |
| docs.config.schema.json | Updated JSON schema to reflect new toc and tocFormat field definitions with appropriate types and enums |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: fbosch <6979916+fbosch@users.noreply.github.com>
Co-authored-by: fbosch <6979916+fbosch@users.noreply.github.com>
Co-authored-by: fbosch <6979916+fbosch@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: fbosch <6979916+fbosch@users.noreply.github.com>
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@src/cli/index.ts`:
- Around line 247-252: The code currently treats zero values as absent because
it checks truthiness; update the checks for result.bytesFreed and
result.repoCount in the sizeInMB and repoLabel computations to explicitly handle
zero (use !== undefined or the nullish coalescing operator ??) so that
bytesFreed === 0 yields "0.00 MB" and repoCount === 0 produces " (0 cached
repositories)"; modify the expressions that set sizeInMB and repoLabel
(referencing sizeInMB, repoLabel, result.bytesFreed, result.repoCount)
accordingly.
In `@src/git/fetch-source.ts`:
- Around line 47-59: The configs array in fetch-source.ts currently only adds
"protocol.file.allow=never" when options?.allowFileProtocol is false, but when
options.allowFileProtocol is true you must explicitly set
"protocol.file.allow=always" to avoid Git 2.38.1+ defaulting to "user" (which
can block non-interactive file:// clones); update the logic around configs (the
configs variable and the conditional using options?.allowFileProtocol) to push
"-c", "protocol.file.allow=always" when allowFileProtocol is true and keep
pushing "-c", "protocol.file.allow=never" when it is false or undefined so local
cache clones succeed in non-interactive scenarios.
🧹 Nitpick comments (1)
src/git/fetch-source.ts (1)
15-41: Consider extracting shared cache-path helpers.
getCacheBaseDir,resolveGitCacheDir, andexistsare duplicated insrc/clean-git-cache.ts. A shared utility would reduce divergence risk as behavior evolves.
Co-authored-by: fbosch <6979916+fbosch@users.noreply.github.com>
Co-authored-by: fbosch <6979916+fbosch@users.noreply.github.com>
Co-authored-by: fbosch <6979916+fbosch@users.noreply.github.com>
Two issues were preventing correct behavior in edge cases:
0as absent, displaying "unknown size" and omitting repo count when cache was empty but successfully clearedprotocol.file.allow=alwayscaused Git 2.38.1+ to default to "user" mode, blocking non-interactive file:// clones from local cacheChanges
src/cli/index.ts: Replace truthy checks with explicit!== undefinedsrc/git/fetch-source.ts: Add explicit protocol configuration for both true and false cases✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Summary by CodeRabbit
Release Notes
New Features
clean-cacheCLI command to manage and clear global git cache with metrics reportingtimeoutMsconfiguration option (default: 120 seconds)cleanGitCachepublic API for cache managementDocumentation
Tests