Skip to content

feat: --no-file-summary now also suppresses generationHeader; doesn't suppress headerText (fixes #554) #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

joshwand
Copy link
Contributor

@joshwand joshwand commented May 15, 2025

--no-file-summary should also suppress generationHeader; should not suppress user-specified headerText ( fixes #554 )

Checklist

  • Run npm run test
  • Run npm run lint

@joshwand joshwand requested a review from yamadashy as a code owner May 15, 2025 16:32
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @joshwand, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

Hello team, gemini-code-assist here with a summary of this pull request. This PR implements a feature requested in the title: modifying the behavior of the --no-file-summary flag. Previously, this flag would suppress the file summary section but still include the automatically generated generationHeader and the user-provided headerText. With this change, --no-file-summary (or fileSummaryEnabled: false in the configuration) will now correctly suppress the generationHeader as well, while ensuring that the user-provided headerText is always included if specified, regardless of whether the file summary is enabled. This change affects the output generation logic and the templates for Markdown, Plain, and XML styles. New tests have been added to verify this updated behavior across the different output formats.

Highlights

  • Feature Implementation: Modifies the behavior of the --no-file-summary flag to align with the requested functionality.
  • Conditional Output: The automatically generated generationHeader is now only included in the output when the file summary is enabled (fileSummaryEnabled: true).
  • Unconditional Output: The user-provided headerText is now always included in the output if it is specified, regardless of the fileSummaryEnabled setting.
  • Template Updates: The Handlebars templates for Markdown, Plain, and XML output styles have been updated to reflect the new conditional logic for the generationHeader and headerText.
  • New Tests: Adds comprehensive tests to outputGenerate.test.ts and the style-specific test files (markdownStyle.test.ts, plainStyle.test.ts, xmlStyle.test.ts) to ensure the correct header behavior when the file summary is disabled.

Changelog

Click here to see the changelog
  • src/core/output/outputGenerate.ts
    • Adjusted the XML output structure (xmlDocument) to place the generationHeader inside the file_summary element (making it conditional on fileSummaryEnabled) and move the user_provided_header outside the file_summary element (making it unconditional).
  • src/core/output/outputStyles/markdownStyle.ts
    • Moved the {{{generationHeader}}} helper call inside the {{#if fileSummaryEnabled}} block.
    • Moved the {{#if headerText}}...{{/if}} block outside the {{#if fileSummaryEnabled}}...{{/if}} block.
    • Added necessary imports for testing utilities.
  • src/core/output/outputStyles/plainStyle.ts
    • Moved the {{{generationHeader}}} helper call inside the {{#if fileSummaryEnabled}} block.
    • Moved the {{#if headerText}}...{{/if}} block outside the {{#if fileSummaryEnabled}}...{{/if}} block.
  • src/core/output/outputStyles/xmlStyle.ts
    • Moved the {{{generationHeader}}} helper call inside the {{#if fileSummaryEnabled}} block.
    • Moved the {{#if headerText}}...{{/if}} block outside the {{#if fileSummaryEnabled}}...{{/if}} block.
    • Adjusted XML element nesting to accommodate the moved headerText.
  • tests/core/output/outputGenerate.test.ts
    • Added new tests to generateOutput for plain, XML, and markdown styles to verify that the generationHeader is omitted and headerText is included when fileSummaryEnabled is false.
  • tests/core/output/outputStyles/markdownStyle.test.ts
    • Added template-specific tests for the markdown style to confirm that headerText is displayed and generationHeader is not displayed when fileSummaryEnabled is false.
    • Added imports for generateOutput and createMockConfig.
  • tests/core/output/outputStyles/plainStyle.test.ts
    • Added a template-specific test for the plain style to confirm the header behavior when fileSummaryEnabled is false.
  • tests/core/output/outputStyles/xmlStyle.test.ts
    • Added a template-specific test for the xml style to confirm the header behavior when fileSummaryEnabled is false.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A flag flips its state,
Header logic shifts its fate,
User text stays true.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@joshwand joshwand changed the title feat: --no-file-summary now also suppresses generationHeader; doesn't suppress headerText feat: --no-file-summary now also suppresses generationHeader; doesn't suppress headerText (fixes #554) May 15, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively addresses issue #554 by ensuring that --no-file-summary (or fileSummaryEnabled: false) suppresses the generationHeader across all output formats, while correctly preserving headerText if provided. The changes are well-localized to the output generation and templating logic.

The addition of new test cases for various output styles (plain, XML, Markdown) and for both parsable and template-based XML is commendable, ensuring good coverage for the modified behavior. The tests clearly verify the suppression of generationHeader and the persistence of headerText under the specified conditions.

One area for clarification is the structural change in the parsable XML output when fileSummaryEnabled is true, which I've detailed in a specific comment.

Summary of Findings

  • Parsable XML Structure Change: When fileSummaryEnabled is true, the generationHeader in parsable XML output has moved from being the text content of the root <repomix> element to being the text content of the <file_summary> element. This also overwrites the previous default text of <file_summary>. This is a structural change that might affect existing consumers of the parsable XML format and warrants confirmation.
  • Test Coverage: The PR includes good test coverage for the new behavior, especially for the suppression of generationHeader when fileSummaryEnabled is false.
  • Consistency Across Formats: The change makes the placement of generationHeader (as part of the summary section, if enabled) consistent across different output formats (Markdown, plain, template XML, and parsable XML).

Merge Readiness

The pull request correctly implements the primary goal of suppressing generationHeader when --no-file-summary is used. The added tests are valuable.

However, there's a structural change to the parsable XML output when the file summary is enabled, which could be a breaking change for existing consumers. I've raised a medium severity comment regarding this. It would be beneficial to clarify the intent behind this specific structural change before merging.

I am unable to approve pull requests myself, but I recommend addressing or acknowledging the point raised about the parsable XML structure to ensure clarity and avoid unintended consequences for users of that format. Once that's clarified, the PR should be in good shape.

Copy link

codecov bot commented May 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.41%. Comparing base (fbad7c9) to head (ce3d025).
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #556      +/-   ##
==========================================
+ Coverage   88.39%   88.41%   +0.01%     
==========================================
  Files          91       91              
  Lines        4679     4678       -1     
  Branches      935      937       +2     
==========================================
  Hits         4136     4136              
+ Misses        543      542       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yamadashy yamadashy requested a review from Copilot May 17, 2025 06:38
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates output generation templates and tests to ensure that the generationHeader is suppressed when fileSummary is disabled while still displaying the headerText regardless of fileSummary configuration.

  • Added tests across xml, plain, and markdown styles for the new behavior
  • Updated templates in XML, plain, and markdown output generators to conditionally render generationHeader inside fileSummary blocks and always render headerText

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/core/output/outputStyles/xmlStyle.test.ts Added new test to check xml style behavior with fileSummary disabled
tests/core/output/outputStyles/plainStyle.test.ts Added new test to verify plain style displays headerText while suppressing generationHeader
tests/core/output/outputStyles/markdownStyle.test.ts Added new tests for markdown style ensuring proper headerText and suppression of generationHeader
tests/core/output/outputGenerate.test.ts Added new tests for output generation for txt, xml, and markdown styles
src/core/output/outputStyles/xmlStyle.ts Updated XML template to conditionally render generationHeader and always render headerText
src/core/output/outputStyles/plainStyle.ts Updated plain template to conditionally render generationHeader and consistently display headerText
src/core/output/outputStyles/markdownStyle.ts Updated markdown template to conditionally render generationHeader and move headerText block
src/core/output/outputGenerate.ts Adjusted XML output generation to remove extra header wrapping and ensure headerText is top-level

@yamadashy yamadashy requested a review from Copilot May 17, 2025 07:33
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that disabling file summaries (--no-file-summary) suppresses only the automatically generated header, while still showing any user-specified headerText.

  • Added and updated integration and unit tests for XML, plain, and Markdown styles to cover the new behavior.
  • Modified Handlebars templates (xmlStyle, plainStyle, markdownStyle) and the XML builder (generateParsableXmlOutput) to conditionally wrap generation headers and always include headerText.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/integration-tests/packager.test.ts Updated config shape, added Markdown style case, and clarified assertions.
tests/integration-tests/fixtures/packager/outputs/simple-project-output.xml Added a "Repository files" entry and relocated closing tags for user-provided header.
tests/integration-tests/fixtures/packager/outputs/simple-project-output.txt Inserted user-provided header section into plain-text fixture.
tests/integration-tests/fixtures/packager/outputs/simple-project-output.md Added the expected Markdown output fixture.
tests/core/output/outputStyles/xmlStyle.test.ts New test verifying XML header behavior when file summaries are disabled.
tests/core/output/outputStyles/plainStyle.test.ts New test verifying plain text header behavior when file summaries are disabled.
tests/core/output/outputStyles/markdownStyle.test.ts Updated expectations and added tests for Markdown header/generation-header logic.
tests/core/output/outputGenerate.test.ts Added integration tests for generateOutput across all three styles and flags.
src/core/output/outputStyles/xmlStyle.ts Wrapped generation header & file summary in if fileSummaryEnabled; moved headerText.
src/core/output/outputStyles/plainStyle.ts Wrapped generation header & summary in if fileSummaryEnabled; moved headerText.
src/core/output/outputStyles/markdownStyle.ts Wrapped generation header & summary in if fileSummaryEnabled; moved headerText.
src/core/output/outputGenerate.ts Moved generationHeader into file_summary and always include user_provided_header.

@yamadashy yamadashy requested a review from Copilot May 17, 2025 07:44
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that the --no-file-summary option suppresses the auto-generated header but still includes any user-provided header text.

  • Wrapped generationHeader in fileSummaryEnabled guards and moved the headerText block outside that guard in all output templates (XML, plain, markdown).
  • Added new unit tests for each style to verify that headerText always appears and generationHeader is conditional, plus updated integration tests and fixtures for markdown and plain outputs.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/integration-tests/packager.test.ts Expanded the integration matrix to cover markdown style and updated assertions for headers.
tests/integration-tests/fixtures/packager/outputs/*.xml Adjusted numbering and removed <additional_info> wrapper around <user_provided_header>.
tests/integration-tests/fixtures/packager/outputs/*.txt Updated separators and block for “User Provided Header” to match plain template changes.
tests/integration-tests/fixtures/packager/outputs/*.md Added a full markdown output fixture including user header and code blocks.
tests/core/output/outputStyles/xmlStyle.test.ts Added a test for XML style to check headerText vs. generationHeader behavior.
tests/core/output/outputStyles/plainStyle.test.ts Added a similar test for plain style.
tests/core/output/outputStyles/markdownStyle.test.ts Updated expectations to match the new single-# header for user-provided text.
tests/core/output/outputGenerate.test.ts New tests to verify generateOutput behavior across all three styles.
src/core/output/outputStyles/xmlStyle.ts Wrapped generationHeader in fileSummaryEnabled and moved headerText out.
src/core/output/outputStyles/plainStyle.ts Same wrap/move logic applied for plain text template.
src/core/output/outputStyles/markdownStyle.ts Applied the same pattern in the markdown template.
src/core/output/outputGenerate.ts Updated XML builder to only set #text for file summary when enabled and always include headerText.
Comments suppressed due to low confidence (2)

tests/core/output/outputStyles/xmlStyle.test.ts:35

  • This test uses createMockConfig and generateOutput but neither is imported in this file. Please add:
import { generateOutput } from '../../../../src/core/output/outputGenerate.js';
import { createMockConfig } from '../../../testing/testUtils.js';
const mockConfig = createMockConfig({

tests/core/output/outputStyles/plainStyle.test.ts:35

  • This test uses createMockConfig and generateOutput but neither is imported in this file. Please add:
import { generateOutput } from '../../../../src/core/output/outputGenerate.js';
import { createMockConfig } from '../../../testing/testUtils.js';
const mockConfig = createMockConfig({

@yamadashy
Copy link
Owner

@joshwand
Thank you for addressing this!

I made a few minor tweaks, and everything looks good!
I’ll merge this now.

Please let me know if there’s anything else.

@yamadashy yamadashy merged commit de4cddc into yamadashy:main May 17, 2025
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: --no-file-summary should also suppress generationHeader; should not suppress user-specified headerText
2 participants