Skip to content

Add metadata-only output mode with --no-files flag#491

Merged
yamadashy merged 3 commits intomainfrom
feature/metadata-only-output
Apr 19, 2025
Merged

Add metadata-only output mode with --no-files flag#491
yamadashy merged 3 commits intomainfrom
feature/metadata-only-output

Conversation

@yamadashy
Copy link
Owner

related:

Checklist

  • Run npm run test
  • Run npm run lint

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Apr 19, 2025

Deploying repomix with  Cloudflare Pages  Cloudflare Pages

Latest commit: 20b2027
Status: ✅  Deploy successful!
Preview URL: https://b05ee36c.repomix.pages.dev
Branch Preview URL: https://feature-metadata-only-output.repomix.pages.dev

View logs

@codecov
Copy link

codecov bot commented Apr 19, 2025

Codecov Report

Attention: Patch coverage is 94.73684% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.57%. Comparing base (5d0f92d) to head (20b2027).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/core/output/outputGenerate.ts 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #491      +/-   ##
==========================================
+ Coverage   84.55%   84.57%   +0.01%     
==========================================
  Files          88       88              
  Lines        4350     4362      +12     
  Branches      845      847       +2     
==========================================
+ Hits         3678     3689      +11     
- Misses        672      673       +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
Copy link
Owner Author

@gemini review

@gemini-code-assist
Copy link
Contributor

Okay, I will review the pull request. Thank you for requesting a review!

@yamadashy yamadashy requested a review from Copilot April 19, 2025 09:51
Copy link
Contributor

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 introduces a new metadata-only output mode by adding the --no-files flag, which disables file content output and propagates the change throughout the CLI, configuration schemas, and various output formats.

  • Updated documentation in both English and German
  • Extended tests to cover both the explicit --no-files and files-enabled behaviors
  • Integrated flag handling in configuration, output generation, and CLI options

Reviewed Changes

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

Show a summary per file
File Description
website/client/src/en/guide/command-line-options.md Added description for the --no-files flag
website/client/src/de/guide/command-line-options.md Added German description for the --no-files flag
tests/mcp/tools/packCodebaseTool.test.ts Added files flag handling in test configuration
tests/integration-tests/packager.test.ts Updated integration tests to handle metadata-only output mode
tests/core/treeSitter/parseFile.solidity.test.ts Adjusted output file path and added files flag in tests
tests/core/output/outputStyles/markdownStyle.test.ts Updated markdown style test to include filesEnabled option
tests/core/output/outputGenerate.test.ts Added filesEnabled test configuration
tests/config/configSchema.test.ts Added files flag to config schema tests
tests/cli/cliRun.test.ts Updated CLI run tests with files flag
tests/cli/actions/defaultAction.test.ts Added tests for handling --no-files and explicit files flags
src/core/output/outputStyles/xmlStyle.ts Added conditional markup for files section when enabled
src/core/output/outputStyles/plainStyle.ts Added conditional block for files section in plain style
src/core/output/outputStyles/markdownStyle.ts Included filesEnabled section in markdown template
src/core/output/outputStyleDecorate.ts Updated documentation to include repository files section
src/core/output/outputGeneratorTypes.ts Extended RenderContext with filesEnabled property
src/core/output/outputGenerate.ts Conditioned files output based on filesEnabled flag
src/config/configSchema.ts Updated config schema to include and default the files flag
src/cli/types.ts Added files property to CLI options type
src/cli/cliRun.ts Added --no-files CLI option
src/cli/actions/defaultAction.ts Configured CLI action to update output.files when explicitly set to false

@yamadashy
Copy link
Owner Author

/gemini review

@yamadashy yamadashy requested a review from Copilot April 19, 2025 10:22
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 introduces a new --no-files flag to disable the output of file contents, enabling a metadata-only mode. The changes are well-structured and cover the necessary modifications across the CLI, configuration, core logic, and tests. The addition of this feature enhances the tool's flexibility by allowing users to generate output focused solely on metadata, which can be useful in various scenarios.

Merge Readiness

The pull request appears to be in good shape for merging. All requested changes have been addressed, and the new feature is well-integrated with existing functionality. However, it's always a good idea to have another team member review the changes before merging, as I am unable to approve the pull request. The addition of the --no-files flag and associated functionality seems to be well-implemented and tested. I recommend merging this pull request after another review.

Copy link
Contributor

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 implements a metadata-only output mode that disables file content output using the new --no-files flag. Key changes include:

  • Documentation updates in both English and German guides for the new CLI flag.
  • Updates to test cases across unit, integration, and configuration files to incorporate the new files flag.
  • Modifications in output generation templates, configuration schemas, and CLI handling to support the files flag.

Reviewed Changes

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

Show a summary per file
File Description
website/client/src/en/guide/command-line-options.md Added documentation for --no-files flag (metadata-only mode)
website/client/src/de/guide/command-line-options.md Same as English, added German documentation for --no-files flag
tests/mcp/tools/packCodebaseTool.test.ts Updated test config to include the files flag
tests/integration-tests/packager.test.ts Modified tests to conditionally verify XML/plain text outputs with files flag
tests/core/treeSitter/parseFile.solidity.test.ts Updated filePath and added files flag into test config
tests/core/output/outputStyles/* Modified templates to conditionally display file content based on filesEnabled flag
tests/core/output/outputGenerate.test.ts Added filesEnabled flag in test data
tests/config/configSchema.test.ts Updated config tests to include the files flag
tests/cli/cliRun.test.ts Updated CLI tests to handle the new files flag
tests/cli/actions/defaultAction.test.ts Added tests to verify CLI handling of --no-files and explicit --files flag
src/core/output/outputGeneratorTypes.ts Added a new filesEnabled property to the RenderContext interface
src/core/output/outputGenerate.ts Integrated filesEnabled flag in XML output generation
src/config/configSchema.ts Added the files property to the configuration schema
src/cli/types.ts Extended CLI options to include the files flag
src/cli/cliRun.ts Registered the new --no-files flag in the CLI command setup
src/cli/actions/defaultAction.ts Added logic to override files flag when explicitly set to false

@yamadashy
Copy link
Owner Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 19, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 19, 2025

📝 Walkthrough

Walkthrough

This change introduces a new configurable option, files, to control whether file contents are included in the output of the CLI tool. The option is implemented as a boolean flag available via the CLI (--no-files), configuration files, and internal context objects. The configuration schemas are updated to include the files property, defaulting to true. The CLI logic is extended to parse and handle the new flag, and the internal merging of configurations respects explicit user input. Output generation logic now conditionally includes the files section based on the filesEnabled flag, which is propagated through the rendering context. Output templates for markdown, plain text, and XML are updated to render the files section only if enabled. Tests for CLI actions, configuration, output generation, and templates are updated to cover the new flag. Documentation in multiple languages is updated to describe the new --no-files option.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant ConfigLoader
    participant OutputGenerator
    participant Renderer

    User->>CLI: Run command with or without --no-files
    CLI->>ConfigLoader: Load and merge config (includes files flag)
    ConfigLoader-->>CLI: Merged config with output.files
    CLI->>OutputGenerator: Generate output with config
    OutputGenerator->>Renderer: Render output (filesEnabled flag)
    alt filesEnabled is true
        Renderer->>OutputGenerator: Include files content in output
    else filesEnabled is false
        Renderer->>OutputGenerator: Omit files content from output
    end
    OutputGenerator-->>CLI: Output result
    CLI-->>User: Display or save output
Loading

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
tests/core/output/outputGenerate.test.ts (1)

1-136: Add a test for metadata‑only mode (--no-files).
To fully cover the new behavior, consider adding a test case where filesEnabled: false is returned from buildOutputGeneratorContext, and assert that the generated output omits file content sections.

website/client/src/fr/guide/command-line-options.md (1)

15-15: Formatting adjustment needed for French typography standards.

The documentation correctly explains the new --no-files command-line option for metadata-only output mode. However, there are two minor formatting issues according to French typographical standards:

  1. There should be an unbreakable space before the colon in "(par défaut: true)"
  2. The apostrophe character should be the curved French apostrophe
- - `--no-files`: Désactiver la sortie du contenu des fichiers (mode métadonnées uniquement) (par défaut: `true`)
+ - `--no-files`: Désactiver la sortie du contenu des fichiers (mode métadonnées uniquement) (par défaut : `true`)
🧰 Tools
🪛 LanguageTool

[uncategorized] ~15-~15: Les deux-points sont précédés d’une espace insécable.
Context: ...iers (mode métadonnées uniquement) (par défaut: true) - --remove-comments: Supprime...

(FRENCH_WHITESPACE)


[typographical] ~15-~15: Caractère d’apostrophe incorrect.
Context: ...de métadonnées uniquement) (par défaut: true) - --remove-comments: Supprimer les c...

(APOS_INCORRECT)

tests/integration-tests/packager.test.ts (1)

129-152: Improved test strategy for output verification

The new approach is more robust than direct string comparison, verifying key elements while accommodating the conditional inclusion of file contents based on the new files flag.

Two suggestions:

  1. Consider translating the Japanese comments to English for consistency
  2. Consider adding a test case with files: false to verify that behavior
-      // Compare the outputs - XMLとプレーンテキストで異なる場合は条件分岐
+      // Compare the outputs - Different checks for XML and plain text formats
       expect(actualOutput).toContain('This file is a merged representation of the entire codebase');

       if (config.output?.style === 'xml') {
-        // XML形式のテスト
+        // Test for XML format
         expect(actualOutput).toContain('<file_summary>');
         expect(actualOutput).toContain('<directory_structure>');
         expect(actualOutput).toContain('resources/');
         expect(actualOutput).toContain('src/');
         expect(actualOutput).toContain('<file path="src/index.js">');
         expect(actualOutput).toContain('function main() {');
         expect(actualOutput).toContain('<file path="src/utils.js">');
         expect(actualOutput).toContain('function greet(name) {');
       } else {
-        // プレーンテキスト形式のテスト
+        // Test for plain text format
         expect(actualOutput).toContain('File Summary');
         expect(actualOutput).toContain('Directory Structure');
         expect(actualOutput).toContain('resources/');
         expect(actualOutput).toContain('src/');
         expect(actualOutput).toContain('File: src/index.js');
         expect(actualOutput).toContain('function main() {');
         expect(actualOutput).toContain('File: src/utils.js');
         expect(actualOutput).toContain('function greet(name) {');
       }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d0f92d and 20b2027.

📒 Files selected for processing (26)
  • src/cli/actions/defaultAction.ts (1 hunks)
  • src/cli/cliRun.ts (1 hunks)
  • src/cli/types.ts (1 hunks)
  • src/config/configSchema.ts (2 hunks)
  • src/core/output/outputGenerate.ts (2 hunks)
  • src/core/output/outputGeneratorTypes.ts (1 hunks)
  • src/core/output/outputStyleDecorate.ts (1 hunks)
  • src/core/output/outputStyles/markdownStyle.ts (2 hunks)
  • src/core/output/outputStyles/plainStyle.ts (2 hunks)
  • src/core/output/outputStyles/xmlStyle.ts (2 hunks)
  • tests/cli/actions/defaultAction.test.ts (2 hunks)
  • tests/cli/cliRun.test.ts (2 hunks)
  • tests/config/configSchema.test.ts (3 hunks)
  • tests/core/output/outputGenerate.test.ts (1 hunks)
  • tests/core/output/outputStyles/markdownStyle.test.ts (1 hunks)
  • tests/core/treeSitter/parseFile.solidity.test.ts (2 hunks)
  • tests/integration-tests/packager.test.ts (1 hunks)
  • tests/mcp/tools/packCodebaseTool.test.ts (1 hunks)
  • website/client/src/de/guide/command-line-options.md (1 hunks)
  • website/client/src/en/guide/command-line-options.md (1 hunks)
  • website/client/src/es/guide/command-line-options.md (1 hunks)
  • website/client/src/fr/guide/command-line-options.md (1 hunks)
  • website/client/src/ja/guide/command-line-options.md (1 hunks)
  • website/client/src/ko/guide/command-line-options.md (1 hunks)
  • website/client/src/pt-br/guide/command-line-options.md (1 hunks)
  • website/client/src/zh-cn/guide/command-line-options.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
website/client/src/fr/guide/command-line-options.md

[uncategorized] ~15-~15: Les deux-points sont précédés d’une espace insécable.
Context: ...iers (mode métadonnées uniquement) (par défaut: true) - --remove-comments: Supprime...

(FRENCH_WHITESPACE)


[typographical] ~15-~15: Caractère d’apostrophe incorrect.
Context: ...de métadonnées uniquement) (par défaut: true) - --remove-comments: Supprimer les c...

(APOS_INCORRECT)

🪛 GitHub Check: codecov/patch
src/core/output/outputGenerate.ts

[warning] 81-81: src/core/output/outputGenerate.ts#L81
Added line #L81 was not covered by tests

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (30)
website/client/src/zh-cn/guide/command-line-options.md (1)

15-15: Documentation updated with --no-files flag.
Translation accurately reflects the new CLI option for disabling file content output in metadata‑only mode, and the default value is clearly stated.

src/core/output/outputStyleDecorate.ts (1)

106-106: Summary section updated to include repository files.
The new list item “4. Repository files (if enabled)” correctly aligns the summary with the filesEnabled feature. The enumeration and formatting are consistent.

website/client/src/pt-br/guide/command-line-options.md (1)

15-15: Portuguese docs include --no-files.
The translation accurately describes the new metadata‑only flag and its default setting.

website/client/src/ko/guide/command-line-options.md (1)

15-15: Korean docs include --no-files.
The description correctly reflects the metadata‑only flag and default value, matching other locales.

tests/core/output/outputGenerate.test.ts (1)

39-39: Mock context now includes filesEnabled.
The test correctly mocks the new filesEnabled property to validate that file‑content rendering is gated by this flag.

website/client/src/es/guide/command-line-options.md (1)

15-15: Documentation added for the new --no-files flag looks good!

The Spanish translation is clear and follows the same format as other command-line options in the documentation.

website/client/src/ja/guide/command-line-options.md (1)

15-15: Documentation added for the new --no-files flag looks good!

The Japanese translation is clear and follows the same format as other command-line options in the documentation.

website/client/src/en/guide/command-line-options.md (1)

15-15: Documentation added for the new --no-files flag looks good!

The English description is clear and follows the same format as other command-line options in the documentation.

src/cli/types.ts (1)

17-17: The new files property is correctly implemented in the CliOptions interface.

The property is appropriately placed in the "Output Options" section of the interface, matching the documentation changes.

tests/cli/cliRun.test.ts (2)

72-72: LGTM! Test configuration updated correctly.

The test mock configuration has been properly updated to include the new files property, ensuring tests reflect the newly added feature.


116-116: LGTM! Remote action test configuration updated correctly.

The test mock configuration for remote actions has been properly updated to include the new files property, maintaining consistency with the feature changes.

website/client/src/de/guide/command-line-options.md (1)

15-15: LGTM! German documentation properly updated.

The German translation of the new --no-files option is accurate and correctly explains its purpose as a metadata-only mode.

tests/core/output/outputStyles/markdownStyle.test.ts (1)

34-35: LGTM! Test data properties added for new feature.

Correctly added the filesEnabled flag to test data to support the new feature for metadata-only output mode. The markdownCodeBlockDelimiter property is also appropriately included to ensure proper markdown rendering.

tests/core/treeSitter/parseFile.solidity.test.ts (2)

11-11: Updated output path to be consistent with other tests.

The output file path has been updated from 'repomix-output.xml' to 'output.txt', which helps maintain consistency across test files.


22-22: Added support for the new files configuration option.

The test configuration now properly includes the new files property set to true, which aligns with the newly introduced metadata-only output mode feature.

tests/mcp/tools/packCodebaseTool.test.ts (1)

69-69: Added support for the new files configuration option.

The mock object correctly includes the new files: true property in the output configuration, ensuring the tests properly reflect the updated configuration schema with the new metadata-only output mode feature.

src/core/output/outputStyles/plainStyle.ts (1)

51-63: Implemented conditional rendering of file contents.

The "Files" section of the template is now conditionally rendered based on the filesEnabled flag, which correctly implements the metadata-only output mode feature when the --no-files flag is used.

src/core/output/outputGeneratorTypes.ts (1)

24-24: Added filesEnabled property to RenderContext interface.

The new readonly boolean property filesEnabled has been added to the RenderContext interface, following the same pattern as existing properties like fileSummaryEnabled and directoryStructureEnabled. This property is essential for conditionally rendering file contents in output templates.

src/cli/cliRun.ts (1)

60-60: LGTM! New CLI option properly added.

The --no-files option is correctly implemented and well documented with an appropriate description. It fits nicely with the other output control flags like --no-file-summary and --no-directory-structure.

src/core/output/outputStyles/markdownStyle.ts (1)

39-49: LGTM! Conditional rendering properly implemented.

The Handlebars conditional is correctly implemented to wrap the entire "Files" section, including the header and file content blocks. This ensures the section is only rendered when filesEnabled is true.

src/core/output/outputStyles/xmlStyle.ts (1)

46-57: LGTM! Conditional XML section correctly implemented.

The conditional rendering for the XML output is properly implemented, matching the pattern used in the markdown style. The entire <files> section will be omitted when filesEnabled is false.

src/cli/actions/defaultAction.ts (1)

169-175: LGTM! CLI option handling is consistent with other flags.

The implementation correctly follows the established pattern for handling --no-* flags in Commander.js. The option is only applied when explicitly set to false, which respects the config file values unless overridden by the CLI.

tests/cli/actions/defaultAction.test.ts (2)

38-38: LGTM: Default configuration setup properly includes files option

The mock configuration correctly includes the new files: true default value, ensuring test consistency with the schema changes.


495-527: Well-structured tests for the new files flag

These tests properly verify both the --no-files flag and explicit --files flag behavior, following the established pattern for boolean CLI options in this codebase.

src/config/configSchema.ts (2)

26-26: LGTM: Appropriate schema addition for base config

The files boolean option is correctly added as optional in the base schema.


73-73: LGTM: Default value properly set

The files option is appropriately configured with a default value of true in the default schema.

tests/config/configSchema.test.ts (3)

69-69: LGTM: Test case updated for new files option

The test correctly includes the new files: true property in the valid default config test case.


85-85: Note: Ordering change for customPatterns

This change only modifies the formatting of the array, but doesn't impact functionality.


159-159: LGTM: Merged config test updated

The test correctly includes the new files: true property in the valid merged config test case.

src/core/output/outputGenerate.ts (1)

46-46: Good implementation of the filesEnabled flag

The addition of the filesEnabled flag to the render context correctly propagates the configuration option, following the same pattern as other feature flags in this function.

@yamadashy yamadashy merged commit eac02c6 into main Apr 19, 2025
53 checks passed
@yamadashy yamadashy deleted the feature/metadata-only-output branch April 19, 2025 11:24
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.

2 participants