Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe CLI reporting functionality was updated to compute and pass output file paths to the reporting functions. The Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Updates CLI post-pack messaging to make the generated output location unambiguous by showing absolute paths in the summary and a prominent completion block.
Changes:
- Print absolute output paths in the Pack Summary (single and multi-part outputs).
- Add a completion section that highlights the output path (bold + cyan + underlined).
- Update unit tests/mocks to support the new formatting and completion signature.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/cli/cliReport.ts | Switch summary output to absolute paths and add a highlighted completion block with an output path parameter. |
| tests/cli/cliReport.test.ts | Update picocolors mock and adjust completion test to assert new output lines. |
| if (packResult.outputFiles && packResult.outputFiles.length > 0) { | ||
| const first = packResult.outputFiles[0]; | ||
| const last = packResult.outputFiles[packResult.outputFiles.length - 1]; | ||
| const firstDisplayPath = getDisplayPath(path.resolve(cwd, first), cwd); | ||
| const lastDisplayPath = getDisplayPath(path.resolve(cwd, last), cwd); | ||
| const firstAbsPath = path.resolve(cwd, first); | ||
| const lastAbsPath = path.resolve(cwd, last); | ||
|
|
||
| logger.log( | ||
| ` Output: ${firstDisplayPath} ${pc.dim('…')} ${lastDisplayPath} ${pc.dim(`(${packResult.outputFiles.length} parts)`)}`, | ||
| ` Output: ${firstAbsPath} ${pc.dim('…')} ${lastAbsPath} ${pc.dim(`(${packResult.outputFiles.length} parts)`)}`, | ||
| ); | ||
| } else { | ||
| const outputPath = path.resolve(cwd, config.output.filePath); | ||
| const displayPath = getDisplayPath(outputPath, cwd); | ||
| logger.log(` Output: ${displayPath}`); | ||
| logger.log(` Output: ${outputPath}`); | ||
| } |
There was a problem hiding this comment.
The PR changes reportSummary() to print absolute paths for both single and multi-part output, but the existing cliReport unit tests don't assert the Output: line at all. Adding assertions for the absolute-path output (including the multi-part first … last (N parts) case) would help prevent regressions and ensure the new UX is covered.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/cli/cliReport.test.ts (1)
327-335: Add one regression test for output-path selection.This only proves that
reportCompletion()formats the string it receives. It will not catch mismatches betweenoptions.skillDir,outputFiles[0], andconfig.output.filePath, which is where the new behavior can drift.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/cli/cliReport.test.ts` around lines 327 - 335, Add a regression test that verifies the actual output-path selection logic (not just formatting) by exercising the code path that picks between options.skillDir, outputFiles[0], and config.output.filePath and asserting the final printed path is the chosen one; specifically, in the test suite that calls reportCompletion, construct a scenario where options.skillDir, outputFiles (array with first element), and config.output.filePath differ, invoke the function or command that resolves the output path, and assert that the logger received the message containing the resolved path (referencing options.skillDir, outputFiles[0], config.output.filePath and reportCompletion to locate the relevant code).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/cli/cliReport.ts`:
- Around line 59-67: The completion banner uses a raw file path while the
summary uses getDisplayPath(options.skillDir...), causing inconsistent output in
skill mode; update the outputPath computation in the reportCompletion call to
pass the same display path used by reportSummary (use
getDisplayPath(options.skillDir, path.resolve(cwd, ...)) or, if options.skillDir
is falsy, fall back to the resolved path) so reportCompletion receives the
identical display string; also apply the same change to the other similar blocks
that compute outputPath (the other reportSummary/reportCompletion pairs).
---
Nitpick comments:
In `@tests/cli/cliReport.test.ts`:
- Around line 327-335: Add a regression test that verifies the actual
output-path selection logic (not just formatting) by exercising the code path
that picks between options.skillDir, outputFiles[0], and config.output.filePath
and asserting the final printed path is the chosen one; specifically, in the
test suite that calls reportCompletion, construct a scenario where
options.skillDir, outputFiles (array with first element), and
config.output.filePath differ, invoke the function or command that resolves the
output path, and assert that the logger received the message containing the
resolved path (referencing options.skillDir, outputFiles[0],
config.output.filePath and reportCompletion to locate the relevant code).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6ff589ae-b444-42d8-81b8-bedf8241b7e5
📒 Files selected for processing (2)
src/cli/cliReport.tstests/cli/cliReport.test.ts
| reportSummary(cwd, packResult, config, options); | ||
| logger.log(''); | ||
|
|
||
| reportCompletion(); | ||
| const outputPath = | ||
| packResult.outputFiles && packResult.outputFiles.length > 0 | ||
| ? path.resolve(cwd, packResult.outputFiles[0]) | ||
| : path.resolve(cwd, config.output.filePath); | ||
|
|
||
| reportCompletion(outputPath); |
There was a problem hiding this comment.
Keep the --skill output location consistent across summary and completion.
Line 97 still renders options.skillDir through getDisplayPath(), while Lines 62-65 ignore options.skillDir and pass the regular file path into reportCompletion(). In skill mode the summary can stay relative and the new completion banner can point at a different target entirely.
💡 Proposed fix
reportSummary(cwd, packResult, config, options);
logger.log('');
const outputPath =
- packResult.outputFiles && packResult.outputFiles.length > 0
- ? path.resolve(cwd, packResult.outputFiles[0])
- : path.resolve(cwd, config.output.filePath);
+ config.skillGenerate !== undefined && options.skillDir
+ ? path.resolve(cwd, options.skillDir)
+ : packResult.outputFiles && packResult.outputFiles.length > 0
+ ? path.resolve(cwd, packResult.outputFiles[0])
+ : path.resolve(cwd, config.output.filePath);
reportCompletion(outputPath);
@@
if (config.skillGenerate !== undefined && options.skillDir) {
- const displayPath = getDisplayPath(options.skillDir, cwd);
- logger.log(` Output: ${displayPath} ${pc.dim('(skill directory)')}`);
+ const skillDirPath = path.resolve(cwd, options.skillDir);
+ logger.log(` Output: ${skillDirPath} ${pc.dim('(skill directory)')}`);
} else {
@@
- logger.log(`📁 Output file generated at:`);
+ logger.log('📁 Output generated at:');Also applies to: 95-111, 244-250
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/cli/cliReport.ts` around lines 59 - 67, The completion banner uses a raw
file path while the summary uses getDisplayPath(options.skillDir...), causing
inconsistent output in skill mode; update the outputPath computation in the
reportCompletion call to pass the same display path used by reportSummary (use
getDisplayPath(options.skillDir, path.resolve(cwd, ...)) or, if options.skillDir
is falsy, fall back to the resolved path) so reportCompletion receives the
identical display string; also apply the same change to the other similar blocks
that compute outputPath (the other reportSummary/reportCompletion pairs).
There was a problem hiding this comment.
Code Review
This pull request updates the CLI reporting to include the absolute output file path in the completion message and summary. The review feedback suggests deduplicating the path calculation logic and improving the handling of multi-file outputs to ensure labels and formatting correctly reflect whether one or multiple files were generated.
| const outputPath = | ||
| packResult.outputFiles && packResult.outputFiles.length > 0 | ||
| ? path.resolve(cwd, packResult.outputFiles[0]) | ||
| : path.resolve(cwd, config.output.filePath); |
There was a problem hiding this comment.
|
|
||
| logger.log( | ||
| ` Output: ${firstDisplayPath} ${pc.dim('…')} ${lastDisplayPath} ${pc.dim(`(${packResult.outputFiles.length} parts)`)}`, | ||
| ` Output: ${firstAbsPath} ${pc.dim('…')} ${lastAbsPath} ${pc.dim(`(${packResult.outputFiles.length} parts)`)}`, |
There was a problem hiding this comment.
The range display (e.g., path … path (1 parts)) is used even when only a single output file is generated. It would be cleaner to show a single path in that case.
packResult.outputFiles.length === 1
? ` Output: ${firstAbsPath}`
: ` Output: ${firstAbsPath} ${pc.dim('…')} ${lastAbsPath} ${pc.dim(`(${packResult.outputFiles.length} parts)`)}`,| logger.log('Your repository has been successfully packed.'); | ||
|
|
||
| logger.log(''); | ||
| logger.log(`📁 Output file generated at:`); |
- Extract resolveOutputPath() helper to eliminate duplicated path logic - Fix skill-mode bug: completion banner now correctly points to skillDir - Show absolute path for skill directory in Pack Summary Output line - Avoid range display when outputFiles has exactly one entry - Change completion label to neutral 'Output generated at:' - Add tests for Output: line in reportSummary (single, single-entry array, multi-part) - Add resolveOutputPath test suite covering all three path-selection branches
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
|
||
| expect(logger.log).toHaveBeenCalledWith('GREEN:🎉 All Done!'); | ||
| expect(logger.log).toHaveBeenCalledWith('Your repository has been successfully packed.'); | ||
| expect(logger.log).toHaveBeenCalledWith('📁 Output generated at:'); |
There was a problem hiding this comment.
🟡 Test expects wrong heading string — missing the word "file"
The test asserts '📁 Output generated at:' but getOutputSummary at src/cli/cliReport.ts:265 returns '📁 Output file generated at:' (note the extra word "file"). This test will fail at runtime because the strings don't match.
| expect(logger.log).toHaveBeenCalledWith('📁 Output generated at:'); | |
| expect(logger.log).toHaveBeenCalledWith('📁 Output file generated at:'); |
Was this helpful? React with 👍 or 👎 to provide feedback.
| if (packResult.outputFiles && packResult.outputFiles.length > 0) { | ||
| return path.resolve(cwd, packResult.outputFiles[0]); | ||
| } |
There was a problem hiding this comment.
🟡 resolveOutputPath only returns first file, making multi-file completion banner unreachable
resolveOutputPath returns string and only returns the first output file (packResult.outputFiles[0]) at src/cli/cliReport.ts:35. reportCompletion at line 285 accepts string | string[] and getOutputSummary (lines 270-282) has multi-file logic for shared directories. However, since resolveOutputPath always produces a single string, the multi-file branches in getOutputSummary are dead code. When split output generates multiple files, the completion banner misleadingly shows only the first file instead of all output files or their shared directory.
Prompt for agents
The resolveOutputPath function returns a single string, but reportCompletion and getOutputSummary are designed to handle string | string[]. When packResult.outputFiles has multiple entries (split output), only the first file path is returned, making the multi-file display logic in getOutputSummary unreachable dead code.
To fix this, resolveOutputPath should return string | string[] and pass all output file paths through:
- Change the return type of resolveOutputPath to string | string[]
- When packResult.outputFiles has multiple entries, return all of them (mapped through path.resolve)
- When it has one entry, return the single resolved path
- The skill dir and fallback branches stay as single strings
Alternatively, if the intent is to always show a single path in the completion banner, then the multi-file branches in getOutputSummary should be removed as they are misleading dead code.
Was this helpful? React with 👍 or 👎 to provide feedback.
Problem
After packing completes, the CLI only shows a relative path in the Pack Summary:
This is ambiguous — users have to guess which directory that file was written to,
especially when running repomix from a deeply nested or unfamiliar path.
Solution
Output:now shows the full absolute path instead of relative.📁 Output file generated at:blockwith the absolute path styled as bold + cyan + underlined, so it is impossible to miss.
Before
After
Changes
src/cli/cliReport.ts— resolve and pass absolute output path toreportCompletion();remove
getDisplayPath()wrapping inreportSummary()for both single and multi-part output.tests/cli/cliReport.test.ts— addboldto picocolors mock; updatereportCompletiontest to pass a path argument and assert the new output lines.
All 15 existing tests pass.