Skip to content

Conversation

@ahundt
Copy link

@ahundt ahundt commented Nov 25, 2025

Choose which to pack: commit graphs, metadata, and diffs to analyze changes

Enhances --include-logs to include structured git commit data with optional diff/patch content, using orthogonal flags that mirror git log's own options.

Why

To evaluate repository history for cleanup, review, or AI analysis, info is needed beyond commit messages:

  1. Diffs — diff content shows exactly what lines were added/removed
  2. Commit Dependencies — parent hashes reveal commit relationships
  3. How work was integrated — branch/merge topology shows integration points
  4. Where releases are — tag mappings identify version boundaries

This adds these capabilities through flags that match git log's parameter structure.

Features

Graph Visualization (--graph) — NEW

  • ASCII graph: same format as git log --graph --oneline --all
  • Mermaid diagram: renders in GitHub, GitLab, documentation sites
  • Shows branch connections within the specified commit range

Commit Metadata

With --include-logs (existing): date, message, files

Add any output verbosity/graph option (--graph/--stat/--patch/--summary/etc.) for NEW fields:

  • Hashes: full SHA and abbreviated for referencing
  • Parents: merge commits show 2+ parents
  • Author: name, email, timestamp — who wrote the code
  • Committer: name, email, timestamp — may differ in cherry-picks, rebases
  • Body: full commit message body

Patch/Diff Content (--patch, --stat, etc.) — NEW

Include actual code changes — see exactly what lines were added, removed, or modified per commit. Choose detail level with diff format options.

Tag Mapping (--graph) — NEW

Maps git tags to commit hashes for identifying release boundaries. Included with graph visualization.

CLI Options

repomix --include-logs [--commit-range <range>] [--stat|--patch|...] [--graph] [path/to/repo]

Diff Format Options (mutually exclusive, mirrors git log):

Option Git Equivalent What it does Why you'd use it
--name-only --name-only Filenames only Default — see what files changed
--stat --stat Per-file change counts See scope without full diffs
--patch --patch Line-by-line diffs Evaluate actual code changes
--numstat --numstat Machine-readable +/- Programmatic analysis
--shortstat --shortstat One-line summary Quick overview
--dirstat --dirstat Directory percentages See which areas changed most
--name-status --name-status Filenames with A/M/D/R Track adds, mods, deletes, renames
--raw --raw Low-level with blob SHAs Detailed analysis

Output Verbosity & Graph Options (combinable with diff format):

Option Git Equivalent What it does Default
--graph --graph --all ASCII + Mermaid graphs off
--summary --summary File operations (create/delete/rename) off
--commit-range <range> <range> Specify commit range HEAD~50..HEAD
--include-logs-count <n> -n Limit commits 50

Usage Examples

# Full diffs for code review
repomix --include-logs --patch

# Analyze release range with graph
repomix --include-logs --commit-range v1.0..v2.0 --stat --graph

# Review feature branch
repomix --include-logs --commit-range main..feature --stat --graph

# Quick scope overview
repomix --include-logs --shortstat

Performance

Measured over 10 runs each on repomix repo (median with min-max range, lower duration is better):

Test Suite Comparison:

Metric Main (a63546b) This PR (586d3ae) Change Notes
Total Duration 3.58s (3.57-3.73s) 3.62s (3.57-3.71s) ✅ +1.1% Within variance
Test Files 96 97 ✅ +1 New gitHistory.test.ts
Test Count 852 884 ✅ +32 +3.8% coverage

gitLogHandle.test.ts (10 runs each, tests the changed code, lower duration is better):

Metric Main (a63546b) This PR (586d3ae) Change
Median 344ms 255ms 🚀 -26%
Min 278ms 249ms 🚀 -10%
Max 896ms 296ms 🚀 -67%
Range 618ms 47ms 🚀 -92%

Repomix Execution (repomix --include-logs on repomix repo, 10 runs each, lower duration is better):

Metric Main (a63546b) This PR (586d3ae) Change Notes
Execution time 10.83s (10.69-10.99s) 10.39s (10.00-10.75s) 🚀 -4% Faster with more features

Backwards Compatibility

Preserved:

  • All existing CLI arguments (--include-logs, --include-logs-count, --include-diffs) remain unchanged;
  • Core XML structure: <git_logs>, <git_log_commit>, <date>, <message>, <files>
  • Default behavior with --include-logs alone produces equivalent output
  • New fields are optional and only appear when new flags are used

Changed (Minor):

  • Date format: 2025-11-20 23:12:33 +09002025-11-26T04:30:33-05:00 (strict ISO 8601)
    • More parseable format using git's %aI instead of %ad with --date=iso
    • Both are ISO 8601 variants; the new format includes T separator and colon in timezone
    • This is a minor format change that improves parseability for automated tools
  • All new new flags (--stat, --patch, --graph, --summary, --commit-range, etc.) are purely additive.

New optional sections (only when using enhancement flags):

  • <hash>, <author>, <committer>, <parents>, <body>, <patch> per commit
  • <summary> section with commit counts and range info
  • <commit_graph> section with ASCII and Mermaid visualizations

Output Structure

GitLogCommit with progressive fields:

interface GitLogCommit {
  date: string;
  message: string;
  files: string[];
  // Extended (with --graph, --stat, --patch, --summary, etc.):
  hash?: string;
  abbreviatedHash?: string;
  author?: { name: string; email: string; date: string };
  committer?: { name: string; email: string; date: string };
  parents?: string[];
  body?: string;
  patch?: string;
}

Checklist

  • npm run test — 884 tests pass
  • npm run lint — 0 errors, 0 warnings
  • Documentation updated
  • Backward compatible (--include-logs behavior preserved)

@ahundt ahundt requested a review from yamadashy as a code owner November 25, 2025 04:39
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This PR adds comprehensive Git commit history analysis capabilities to Repomix, introducing CLI flags (--patch, --stat, --graph, --summary, --commit-range) and configuration options to retrieve, parse, and render structured commit metadata, patches, ASCII/Mermaid graphs, and tags. The implementation spans CLI parsing, config schema, core git parsing utilities, output generation, and documentation.

Changes

Cohort / File(s) Summary
CLI Options & Configuration
src/cli/types.ts, src/cli/cliRun.ts, src/cli/actions/defaultAction.ts
Adds new CliOptions fields (commitRange, stat, patch, numstat, shortstat, dirstat, nameOnly, nameStatus, raw, graph, summary); registers CLI flags with grouping (Git Log Diff Format Options, Git Log Output Verbosity & Graph Options); wires flags into cliConfig with mutual-exclusion validation and commitPatchDetail derivation.
Config Schema
src/config/configSchema.ts
Extends git output config with commitRange (default 'HEAD~50..HEAD'), commitPatchDetail (default 'name-only'), includeCommitGraph, includeSummary, includeGitTags, includeCommitPatches fields in both base and default schemas.
Git History Core
src/core/git/gitCommand.ts, src/core/git/gitHistory.ts, src/core/git/gitLogHandle.ts
Introduces structured git output parsing layer with NUL delimiters; adds CommitMetadata, CommitGraph, ParsedCommitRange interfaces; implements parseCommitRange, getCommitMetadata, getCommitGraph, getTags, getCommitPatch, generateMermaidGraph functions; refactors git log handling to two-pass structured parsing with optional patches and graph.
Output Generation
src/core/output/outputGeneratorTypes.ts, src/core/output/outputGenerate.ts, src/core/output/outputStyles/markdownStyle.ts, src/core/output/outputStyles/xmlStyle.ts
Extends RenderContext with gitCommitHistorySummary and gitCommitGraph; updates markdown/XML output templates to render commit history sections (graph, summary, commits with metadata, patches, tags).
Integration
src/core/packager.ts, src/core/metrics/calculateGitLogMetrics.ts, src/core/security/securityCheck.ts
Updates GitLogCommit shape to include optional hash, abbreviatedHash, author, committer, parents, body, patch fields; adjusts metrics calculation and security checks to consume new logCommits structure instead of logContent.
Tests — Config & Metrics
tests/config/configSchema.test.ts, tests/core/metrics/calculateGitDiffMetrics.test.ts, tests/core/metrics/calculateGitLogMetrics.test.ts
Extends mock RepomixConfig with new git fields; updates GitLogResult shape expectations to use logCommits array instead of logContent/commits.
Tests — Git & Output
tests/core/git/gitHistory.test.ts, tests/core/git/gitLogHandle.test.ts, tests/core/output/outputGenerate.test.ts, tests/core/output/outputGenerateDiffs.test.ts, tests/core/output/outputGenerateMarkdownStyle.test.ts, tests/core/output/outputGenerateXmlStyle.test.ts
Adds comprehensive test suite for gitHistory functions (parseCommitRange, getCommitMetadata, getTags, getCommitPatch, getCommitGraph); refactors gitLogHandle tests to mock structured output and NUL-separated parsing; extends output tests to verify new git history rendering across markdown/XML/JSON.
Tests — Utilities
tests/cli/actions/workers/defaultActionWorker.test.ts, tests/core/output/flagFullDirectoryStructure.test.ts, tests/core/output/outputStyles/jsonStyle.test.ts
Updates mock RepomixConfigMerged.git with new fields (commitRange, commitPatchDetail, includeCommitGraph, includeSummary, includeGitTags, includeCommitPatches).
Documentation — English
README.md, llms-install.md, website/client/src/en/guide/command-line-options.md, website/client/src/en/guide/configuration.md, website/client/src/en/guide/output.md, website/client/src/en/guide/usage.md, website/client/src/en/guide/tips/git-commit-history.md
Adds sections documenting Git Commit History Analysis feature: CLI options (diff format flags, output detail/graph options, commit-range syntax), configuration defaults, output components (metadata, ASCII/Mermaid graphs, tags, patches), and usage examples/workflows.
Documentation — Translations
website/client/src/*/guide/command-line-options.md (de, es, fr, hi, id, ja, ko, pt-br, vi, zh-cn, zh-tw)
Adds translated Git Commit History Options sections describing orthogonal diff flags and output options; consistent content across languages with some duplication within files.
Documentation — Navigation & Other
website/client/.vitepress/config/configEnUs.ts, .gitignore
Adds sidebar navigation entry for Git Commit History Analysis guide; adds .claude to gitignore.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI<br/>(cliRun.ts)
    participant Action as Action<br/>(defaultAction.ts)
    participant GitCmd as Git Commands<br/>(gitCommand.ts)
    participant GitHist as Git History<br/>(gitHistory.ts)
    participant GitLog as Git Log Handle<br/>(gitLogHandle.ts)
    participant Output as Output Generate<br/>(outputGenerate.ts)
    participant Render as Render Styles<br/>(markdown/xml/json)

    CLI->>Action: Parse flags (--patch, --graph, --summary, --commit-range)
    Action->>Action: Validate mutual exclusion, derive commitPatchDetail
    Action->>Action: Augment cliConfig with git options
    
    Action->>GitLog: getGitLogs(config, deps)
    
    GitLog->>GitCmd: execGitLogStructured(range, maxCommits)
    GitCmd-->>GitLog: NUL-delimited structured metadata
    
    GitLog->>GitHist: parseCommitRange(range)
    GitHist-->>GitLog: { from, to, raw }
    
    alt includeCommitPatches
        GitLog->>GitCmd: execGitLogTextBlob(range, patchDetail)
        GitCmd-->>GitLog: patch/stat/diff text blobs
    end
    
    alt includeCommitGraph
        GitLog->>GitCmd: execGitGraph(range)
        GitCmd-->>GitLog: git log --graph output
        GitLog->>GitHist: generateMermaidGraph(commits, tags)
        GitHist-->>GitLog: Mermaid diagram string
    end
    
    GitLog->>GitHist: getTags(directory)
    GitHist-->>GitLog: tag→hash map
    
    GitLog-->>Action: GitLogResult { logCommits[], graph?, summary? }
    
    Action->>Output: generateOutput(context, gitLogResult)
    Output->>Output: Build RenderContext with gitCommitHistorySummary, gitCommitGraph
    Output->>Render: Render git history section
    Render->>Render: Format commits, patches, graph, tags per style
    Render-->>Output: Rendered markdown/XML/JSON
    Output-->>Action: Final output string
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • gitCommand.ts & gitHistory.ts (~25 min): Multi-pass git command architecture with structured NUL-delimited parsing requires careful review of delimiter handling, regex patterns, and error paths. Note: gitCommand.ts contains apparent duplicate declarations of NUL, METADATA_FORMAT, GitLogStructuredOptions, GitLogTextBlobOptions, execGitLogStructured, execGitLogTextBlob, execGitGraph—confirm if intentional or merge artifact.
  • gitLogHandle.ts refactor (~20 min): Significant restructuring from simple text parsing to two-pass structured approach; parseStructuredOutput helper regex patterns and Mermaid graph generation logic need verification for correctness and edge cases.
  • CLI integration & config wiring (~10 min): Multiple touch points (cliRun.ts, defaultAction.ts, configSchema.ts) require tracing flag→config→output flow to ensure mutual-exclusion validation and commitPatchDetail derivation work correctly.
  • Output generation complexity (~10 min): RenderContext changes, optional field rendering across markdown/XML/JSON styles, and new data shape (logCommits vs. logContent) must be validated for consistency.
  • Test coverage (~5 min): Extensive test additions are largely straightforward mock-based tests, though gitLogHandle.test.ts refactor adds structured parsing expectations that should be spot-checked.

Areas requiring extra attention:

  • Duplicate code block in src/core/git/gitCommand.ts (lines near end of file repeating NUL constant, METADATA_FORMAT, and all three exec* functions)
  • NUL delimiter parsing robustness for edge cases (empty output, incomplete records, special characters in commit messages)
  • Mermaid graph generation for complex merge scenarios and tag escaping
  • Integration with existing packager/metrics/security flows to ensure logCommits structure properly replaces logContent
  • Semantic consistency between CliOptions (snake_case: nameOnly, nameStatus) and command-line flags (kebab-case: --name-only, --name-status)

Possibly related issues

Possibly related PRs

Suggested labels

enhancement, git, feature

Suggested reviewers

  • yamadashy

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: enhancing --include-logs to pack git commit history with graphs, metadata, and diffs/patches. It is concise, related to the primary objective, and conveys meaningful information.
Description check ✅ Passed The pull request description is comprehensive and exceeds template requirements. It includes a detailed explanation of changes (Why, Features, CLI Options, Usage Examples, Performance), backwards compatibility assessment, output structure, and a complete checklist with verification that npm run test and npm run lint have been executed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @ahundt, 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!

This pull request significantly enhances the repomix tool by introducing a robust Git commit history analysis feature. This allows AI systems to gain a deeper understanding of code evolution, development patterns, and contextual information beyond just current file contents. By providing detailed commit metadata, visual graphs, and configurable patch levels, the tool now offers richer insights crucial for advanced AI-driven code analysis and understanding.

Highlights

  • Comprehensive Git Commit History Analysis: Introduced a new feature to analyze and include detailed Git commit history in the output, providing rich metadata, visual graphs (ASCII and Mermaid), and configurable patch details for AI systems.
  • New CLI Options and Configuration: Added six new CLI options (--include-commit-history, --commit-range, --commit-patch-detail, --no-commit-graph, --no-git-tags, --no-commit-patches) and corresponding configuration schema updates to give users fine-grained control over Git history extraction.
  • Enhanced Output Formats: Integrated the new Git commit history data into both Markdown and XML output styles, ensuring structured and comprehensive presentation for downstream AI analysis.
  • New Core Modules for Git Operations: Developed dedicated core modules (src/core/git/gitHistory.ts and src/core/git/gitHistoryHandle.ts) to manage Git command execution, parse commit data, and orchestrate the history collection process.
  • Extensive Documentation and Testing: Updated README.md, llms-install.md, and the project website with new guides and examples for the Git commit history feature, complemented by 871 new unit and integration tests to ensure reliability.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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.

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.

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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/core/output/outputGenerate.ts (1)

66-119: Add missing git_commit_history section to XML output.

The generateParsableXmlOutput function is missing the git_commit_history section in the xmlDocument structure. The RenderContext provides gitCommitHistoryEnabled, gitCommitHistorySummary, gitCommitHistoryItems, and gitCommitGraph, and the XML template supports rendering this data (xmlStyle.ts line 83+), but the XML builder code does not include it. The JSON output correctly includes this section (lines 160-172). Add the conditional git_commit_history block to the xmlDocument object in generateParsableXmlOutput to match JSON output functionality.

🧹 Nitpick comments (3)
website/client/src/en/guide/tips/git-commit-history.md (2)

32-38: Clarify the relationship between --no-commit-patches and --commit-patch-detail metadata.

Both options appear to produce metadata-only output. The comment on line 37 says they're equivalent, but having two ways to achieve the same result could confuse users.

Consider clarifying:

  • When to use each option
  • Whether they're truly equivalent or have subtle differences
  • Whether one is preferred over the other

40-50: Consider adding privacy guidance for sensitive metadata.

Line 49 mentions that author/committer email addresses are included in the output. While this transparency is good, consider adding a note about:

  • Privacy implications when sharing output
  • How to filter or anonymize this data if needed
  • Whether the security check covers PII in git metadata
src/core/git/gitHistoryHandle.ts (1)

89-98: Consider parallel execution for better performance.

The sequential for...of loop processes commits one at a time. For larger commit ranges, parallel execution could improve performance.

-    const commits: HistoryCommitResult[] = [];
-    for (const metadata of graph.commits) {
-      // Get patch if requested
-      const patch = includePatches ? await deps.getCommitPatch(gitRoot, metadata.hash, detailLevel) : '';
-
-      commits.push({
-        metadata,
-        patch,
-      });
-    }
+    const commits: HistoryCommitResult[] = await Promise.all(
+      graph.commits.map(async (metadata) => ({
+        metadata,
+        patch: includePatches ? await deps.getCommitPatch(gitRoot, metadata.hash, detailLevel) : '',
+      })),
+    );
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7c3af7a and fcd2874.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (30)
  • README.md (2 hunks)
  • llms-install.md (2 hunks)
  • src/cli/actions/defaultAction.ts (1 hunks)
  • src/cli/cliRun.ts (2 hunks)
  • src/cli/types.ts (1 hunks)
  • src/config/configSchema.ts (2 hunks)
  • src/core/git/gitHistory.ts (1 hunks)
  • src/core/git/gitHistoryHandle.ts (1 hunks)
  • src/core/output/outputGenerate.ts (7 hunks)
  • src/core/output/outputGeneratorTypes.ts (3 hunks)
  • src/core/output/outputStyles/markdownStyle.ts (1 hunks)
  • src/core/output/outputStyles/xmlStyle.ts (1 hunks)
  • src/core/packager.ts (4 hunks)
  • tests/cli/actions/workers/defaultActionWorker.test.ts (1 hunks)
  • tests/config/configSchema.test.ts (2 hunks)
  • tests/core/git/gitHistory.test.ts (1 hunks)
  • tests/core/metrics/calculateGitDiffMetrics.test.ts (1 hunks)
  • tests/core/metrics/calculateGitLogMetrics.test.ts (1 hunks)
  • tests/core/output/diffsInOutput.test.ts (2 hunks)
  • tests/core/output/flagFullDirectoryStructure.test.ts (3 hunks)
  • tests/core/output/outputGenerate.test.ts (2 hunks)
  • tests/core/output/outputGenerateDiffs.test.ts (5 hunks)
  • tests/core/output/outputStyles/jsonStyle.test.ts (1 hunks)
  • tests/core/packager.test.ts (1 hunks)
  • website/client/.vitepress/config/configEnUs.ts (1 hunks)
  • website/client/src/en/guide/command-line-options.md (2 hunks)
  • website/client/src/en/guide/configuration.md (1 hunks)
  • website/client/src/en/guide/output.md (1 hunks)
  • website/client/src/en/guide/tips/git-commit-history.md (1 hunks)
  • website/client/src/en/guide/usage.md (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
src/core/output/outputGeneratorTypes.ts (1)
src/core/git/gitHistoryHandle.ts (1)
  • GitHistoryResult (34-38)
tests/core/git/gitHistory.test.ts (1)
src/core/git/gitHistory.ts (5)
  • parseCommitRange (59-85)
  • getCommitMetadata (90-183)
  • getTags (252-282)
  • getCommitPatch (287-327)
  • getCommitGraph (188-247)
src/core/output/outputGenerate.ts (1)
src/core/git/gitHistoryHandle.ts (1)
  • GitHistoryResult (34-38)
tests/core/output/diffsInOutput.test.ts (1)
src/core/output/outputGenerate.ts (1)
  • generateOutput (255-298)
🔇 Additional comments (42)
tests/core/output/outputStyles/jsonStyle.test.ts (1)

34-39: LGTM! Test configuration properly extended.

The git history config fields are correctly added to the test mock with appropriate defaults that align with the new feature design.

tests/core/metrics/calculateGitLogMetrics.test.ts (1)

52-57: LGTM! Consistent test config update.

Git history configuration fields properly added, maintaining consistency with the expanded schema and other test files.

website/client/src/en/guide/output.md (1)

244-286: Excellent documentation of the new commit history feature.

The section clearly explains the XML structure, patch detail levels, and provides practical guidance for users. The examples are well-formatted and the explanations are concise.

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

61-72: Well-documented CLI options.

The new git commit history options are clearly explained with appropriate detail levels and semantic descriptions. The placement and formatting align with existing documentation patterns.


119-124: Great example usage patterns.

The examples effectively demonstrate common scenarios for the new git commit history feature, from basic usage to advanced configurations.

website/client/.vitepress/config/configEnUs.ts (1)

48-48: LGTM! Navigation entry properly added.

The new guide link is appropriately placed in the Advanced section and follows the existing navigation structure.

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

89-90: LGTM! Consistent API signature updates.

All generateOutput call sites properly updated with the new optional parameters. The inline comments clearly indicate the purpose of each undefined parameter, maintaining good code readability.

Also applies to: 123-125, 158-160, 193-195, 238-240

tests/core/output/flagFullDirectoryStructure.test.ts (2)

34-39: LGTM! Test configuration properly extended.

Git history fields added consistently with the expanded schema and other test files.


80-80: LGTM! Function signatures correctly updated.

The buildOutputGeneratorContext calls properly include the new optional parameter, maintaining backward compatibility with undefined.

Also applies to: 113-113

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

83-145: Excellent template implementation.

The new git_history block is well-structured and follows existing Handlebars patterns in the file. The comprehensive structure properly handles:

  • Conditional rendering with appropriate guards
  • Nested optional fields (mermaid_graph, tags, patch)
  • Proper attribute and element hierarchy
  • Consistent formatting with the rest of the template

The template correctly uses triple braces for unescaped content, which is appropriate for pre-formatted git data.

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

44-53: Tests correctly updated for new gitHistoryResult parameter

The extra undefined arguments in both generateOutput and buildOutputGeneratorContext calls match the extended core signature and preserve existing behavior; mocks and expectations remain consistent with the new API.

Also applies to: 55-64

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

126-141: generateOutput mocks aligned with extended signature

Both test cases now pass gitDiffResult, gitLogResult (undefined), and gitHistoryResult (undefined) before the deps object, which matches the updated generateOutput function signature and keeps the diff-focused assertions intact.

Also applies to: 199-214

tests/core/packager.test.ts (1)

90-98: Packager test correctly mirrors new generateOutput arity

The additional undefined in the generateOutput expectation matches the new gitHistoryResult argument, keeping the pack orchestration test in sync with the core output API.

tests/core/metrics/calculateGitDiffMetrics.test.ts (1)

46-58: Mock config extended to cover new git history fields without affecting diff tests

Including the git commit history options on mockConfig.output.git keeps this test aligned with the expanded schema while leaving the git diff metrics behavior unchanged, since none of these new fields are consumed by calculateGitDiffMetrics.

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

79-142: Git commit history Markdown template is structurally sound

The new gitCommitHistoryEnabled block cleanly renders summary, optional graph/tags, and per-commit details with appropriate Handlebars conditionals and Markdown fencing, and it composes safely with existing git diff/log sections.

README.md (1)

289-306: Commit history CLI docs are consistent with new options

The new README sections accurately describe --include-commit-history, --commit-range, --commit-patch-detail, and the --no-commit-* flags, including defaults and intended behavior, and they line up with the CLI option names introduced in code.

Also applies to: 653-658

src/cli/cliRun.ts (1)

16-49: CLI wiring for git commit history options looks correct

The semantic suggestion entries for git-commits, commit-range, and history match the cleaned option keys, and the new commit history flags are defined with clear help text and Commander-friendly --no-* semantics that align with the documented behavior.

Also applies to: 143-155

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

283-307: Git commit history CLI options are merged into config safely

The new buildCliConfig block merges commit history–related CLI flags into output.git without clobbering existing git settings, and it respects the “only override when explicitly set (especially for --no-* flags)” convention used elsewhere in this function.

website/client/src/en/guide/usage.md (1)

120-145: Excellent documentation structure and examples.

The commit history analysis section is clear, well-organized, and provides practical examples that progress from simple to advanced use cases. The reference to the detailed guide is helpful.

src/core/packager.ts (2)

109-111: Clean integration following established patterns.

The git history retrieval is correctly positioned before security checks and follows the same pattern as getGitDiffs and getGitLogs. The progress callback message is clear and consistent.


127-127: Proper threading of git history through the pipeline.

The gitHistoryResult parameter is correctly added to the generateOutput call, maintaining parameter order consistency with the function signature.

src/cli/types.ts (1)

30-36: Well-typed CLI options with clear documentation.

The new git commit history options are properly typed, especially the union type for commitPatchDetail. The comments explaining the negative flag behavior (lines 34-36) are helpful for understanding how --no-commit-graph and similar flags work.

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

4-4: Type-safe integration with proper optional handling.

The type extensions correctly use GitHistoryResult['field'] syntax to extract specific types, ensuring consistency with the source type definition. Making all fields optional properly supports the feature being disabled.

Also applies to: 15-15, 39-42

tests/cli/actions/workers/defaultActionWorker.test.ts (1)

62-67: Test fixture properly updated with correct defaults.

The mock configuration includes all new git history fields with values matching the documented defaults. Good use of as const for commitPatchDetail to ensure type safety in tests.

tests/core/git/gitHistory.test.ts (5)

10-64: Comprehensive test coverage for parseCommitRange.

Tests cover multiple range formats (HEAD, tags, branches), single commit shorthand, whitespace handling, and error cases (empty, invalid format). Well-structured and thorough.


66-145: Thorough testing of getCommitMetadata with edge cases.

Tests validate full metadata parsing including multi-parent commits, author/committer details, message/body separation, and file lists. Good coverage of the initial commit edge case (no parents) and error handling.


147-189: Complete getTags test coverage with error resilience.

Tests verify tag parsing, empty results, and graceful error handling. The error case properly returns an empty object rather than throwing, which is the correct resilient behavior.


191-279: Excellent verification of all patch detail levels.

Tests cover all four detail levels (full, stat, files, metadata) and verify the correct git arguments are passed for each. Good inclusion of error case for invalid detail level.


281-333: Well-structured integration test for getCommitGraph.

The test properly mocks sequential git operations and validates the composite workflow including graph visualization, commit metadata, and tag mapping. Good assertions on commits length, graph content, mermaidGraph presence, and tags.

llms-install.md (1)

64-66: LGTM!

The new git commit history parameters are well-documented with accurate defaults matching the schema definitions. The descriptions clearly explain each option's purpose and accepted values.

src/config/configSchema.ts (2)

51-57: LGTM!

The new git commit history configuration options are well-structured and follow the existing pattern. The commitPatchDetail enum provides clear validation, and the optional nature of all fields maintains backward compatibility.


117-123: LGTM!

Sensible defaults: includeCommitHistory: false ensures opt-in behavior, while the sub-options default to true to provide comprehensive output when enabled. The default range of HEAD~50..HEAD is a reasonable scope for most analysis use cases.

src/core/git/gitHistoryHandle.ts (2)

43-51: LGTM!

Good use of dependency injection for testability. The function signature with optional deps parameter allows easy mocking in tests.


128-134: LGTM!

Proper error handling: re-throws RepomixError instances directly while wrapping unknown errors with context and original cause.

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

124-129: LGTM!

Test values correctly match the schema defaults. Good coverage for the new git history configuration options.


235-240: LGTM!

Consistent test coverage for the merged schema with the same expected values.

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

59-62: LGTM!

Render context fields correctly expose git history data with appropriate undefined handling via optional chaining and nullish coalescing.


160-188: LGTM!

The JSON output structure for gitCommitHistory is comprehensive, including summary, graph components, and per-commit metadata with optional patches. The conditional spread operators correctly handle optional fields.


255-282: LGTM!

The function signature extension with gitHistoryResult parameter maintains backward compatibility via default undefined value, and the parameter is correctly propagated through the context builder.

src/core/git/gitHistory.ts (3)

59-85: LGTM!

The range parsing handles both single commit and range formats cleanly. The single commit conversion to commit^..commit is a reasonable approach.


252-282: LGTM!

Graceful error handling returns an empty object instead of throwing, which is appropriate for optional tag information.


287-327: LGTM!

Clean implementation with proper handling of all detail levels. The exhaustive switch with a default error case ensures invalid values are caught.

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 comprehensive git commit history analysis feature, which is a great addition for understanding code evolution. The implementation is thorough, covering CLI options, configuration, core logic, output generation, testing, and documentation. However, I've identified a few critical issues in the implementation that could lead to incorrect data parsing and invalid XML output. I've also found a minor issue with the Mermaid graph generation. My review includes specific suggestions to address these points and improve the feature's robustness.

@ahundt
Copy link
Author

ahundt commented Nov 25, 2025

Hey, I addressed the ai-generated review feedback in the latest commit:

Fixed:

  • Body/file parsing now uses %x00 null byte delimiter instead of the fragile heuristic. Null bytes can't appear in commit messages or file paths, so this reliably separates them.
  • Mermaid gitGraph syntax corrected. Was using invalid merge <hash>, now uses proper commit id: "..." tag: "..." type: HIGHLIGHT.
  • Added git_history section to parsable XML output to match JSON structure.
  • Added includeCommitPatches to configuration docs.
  • Added files list to XML (<files>) and Markdown (**Files Changed**) templates.

Kept as-is:

  • --all flag stays. It's git's standard flag for showing branch topology within the specified range. Documented this behavior.

Out of scope:

  • CDATA wrapping: The existing XML templates don't use it, so adding it just for commit history would be inconsistent. Parsable XML uses XMLBuilder which escapes automatically.
  • Parallel patch fetching: Overkill for this functionality. Sequential is simpler and avoids spawning many git processes.

894 tests passing, lint clean. Let me know if you'd like any changes! Thanks for the useful tool!

@ahundt ahundt force-pushed the feat/git-commit-history-squashed branch from dfda264 to 67ff18a Compare November 25, 2025 20:07
@ahundt ahundt changed the title feat(git): add git commit history analysis to explore and find high quality commits feat(git): enhance --include-logs with Output Verbosity, Diff, & Graph Options Nov 26, 2025
@ahundt ahundt changed the title feat(git): enhance --include-logs with Output Verbosity, Diff, & Graph Options feat(git): enhance --include-logs with Output Verbosity, Metadata, Diff, & Graph Options Nov 26, 2025
@ahundt ahundt changed the title feat(git): enhance --include-logs with Output Verbosity, Metadata, Diff, & Graph Options feat(git): update --include-logs to optionally pack git commit history with graphs, metadata, and diffs/patches Nov 26, 2025
@ahundt ahundt force-pushed the feat/git-commit-history-squashed branch 4 times, most recently from e2b824d to 3b8412a Compare November 26, 2025 11:05
@ahundt
Copy link
Author

ahundt commented Nov 26, 2025

@yamadashy this seems to be in reasonably good shape now if you're up for giving it a look! The summary at the very top should be up to date now.

/gemini review

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 26, 2025

@ahundt, thank you for the comprehensive updates and for addressing the previous feedback! I can see you've made thoughtful improvements:

Robust parsing with null byte delimiters
Correct Mermaid syntax for git graphs
Complete XML/JSON parity with the new git_history section
Enhanced documentation and template coverage
Strong test coverage (894 tests passing, lint clean)

Your decisions on keeping --all and deferring CDATA/parallel fetching are reasonable given the context and consistency with the existing codebase.

I'll perform a full review of the entire PR now to provide comprehensive feedback on the implementation.

✅ Actions performed

Full review triggered.

@gemini-code-assist
Copy link
Contributor

Hello @ahundt,

Thank you for the detailed update and for addressing the feedback from the previous review. I appreciate the thoroughness of your changes and the clear explanations for the decisions made.

I've reviewed the latest commit, and the fixes you've implemented are excellent:

  • Null Byte Delimiter: The adoption of %x00 for robust parsing of commit metadata and file lists is a significant improvement. This eliminates the fragility of previous heuristics and ensures reliable data extraction, even with unusual commit messages or file paths.
  • Mermaid GitGraph Syntax: The correction to use commit id: "..." tag: "..." type: HIGHLIGHT is spot on. This ensures compatibility with Mermaid and correctly visualizes merge commits and tags.
  • XML Output Structure: The git_history section has been correctly integrated into the parsable XML output, aligning it with the JSON structure and providing a consistent, rich data representation.
  • Configuration Documentation: includeCommitPatches is now properly documented in llms-install.md and website/client/src/en/guide/configuration.md.
  • Files List in Templates: The inclusion of the files list in both XML and Markdown templates for commit history is a valuable addition, providing a complete picture of each commit's changes.

Your decision to keep the --all flag for git log and to document its behavior is reasonable, as it aligns with standard Git functionality for showing branch topology. Similarly, your rationale for not implementing CDATA wrapping (due to existing XML templates and automatic escaping) and parallel patch fetching (for simplicity and avoiding process overhead) is well-justified.

The new two-pass architecture for Git log parsing, along with the dedicated modules for Git operations (gitCommand.ts, gitHistory.ts, gitLogHandle.ts), significantly enhances the robustness, maintainability, and flexibility of the Git history feature. The comprehensive test suite, especially gitHistory.test.ts, demonstrates a strong commitment to quality and covers various scenarios and edge cases.

Overall, this is a very well-executed enhancement. Great work!

I will now proceed with a full review as requested by /gemini review.

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: 5

🧹 Nitpick comments (13)
tests/core/metrics/calculateGitDiffMetrics.test.ts (1)

46-58: Mock config now mirrors extended git options; consider centralizing

Adding commitRange, commitPatchDetail, includeCommitGraph, includeSummary, includeGitTags, and includeCommitPatches keeps this mock aligned with the real config shape, even though calculateGitDiffMetrics doesn’t use them directly.
To reduce drift as more git options are added, consider extracting a shared createMockConfig() factory used across metrics/git tests instead of inlining these defaults here.

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

61-78: Git commit history options section is accurate; only minor FR style nits

The new section correctly mirrors the CLI behavior (diff format flags vs graph/detail options and the --commit-range syntax). For style, you might optionally tweak wording to be more idiomatic French, e.g.:

  • Heading: ## Options de l’historique des commits Git (lowercase “historique” and “commits”).
  • “Ces flags indépendants…” → “Ces indicateurs indépendants…” if you want to avoid the anglicism flags.
  • “les hashes SHA” → “les hachages SHA” for more standard French.

Purely stylistic; the current text is understandable and technically correct.

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

61-78: Korean git history options read clearly; optional wording tweak

The section accurately documents the diff-format flags and the graph/detail options, including the default HEAD~50..HEAD range and .. / ... syntax. If you want slightly more natural Korean, consider replacing “직교 플래그들은” with “독립적인 플래그들은” or similar, which may read more intuitively than the mathematical “직교” for most readers.

src/core/metrics/calculateGitLogMetrics.ts (1)

22-37: Updated token counting for structured git logs is sound; consider including all rendered pieces

Using logCommits plus the optional graph.graph to build logContent and adding an explicit guard for “no commits” is a good adaptation to the new structured GitLogResult. Two follow-ups you might consider:

  • If the rendered output also includes additional git history strings (e.g., a separate Mermaid graph or a textual summary/tags section), you may want to concatenate those into logContent as well so gitLogTokenCount reflects everything actually emitted.
  • With the logCommits.length === 0 guard and JSON.stringify, the if (!logContent) check becomes effectively redundant; you could simplify by relying on the earlier guard, though it’s harmless as-is.

These are small refinements; the current implementation is correct for non-empty logCommits.

Also applies to: 47-48

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

61-79: Minor PT-BR wording tweak for naturalness

Frase inicial pode soar um pouco estranha em PT-BR (“Esses flags…”). Sugestão leve:

- Esses flags independentes espelham a estrutura do git log para controle detalhado:
+ Essas flags independentes espelham a estrutura do git log para controle detalhado:

Os avisos de “pontuação duplicada” do analisador vêm do uso legítimo de intervalos git (HEAD~50..HEAD, main...feature-branch), então não vejo necessidade de alteração aí.

README.md (1)

289-310: Git history examples and options are strong; consider clarifying flag interaction

The new examples and option descriptions for --commit-range, diff format flags, --graph, and --summary look consistent with the PR’s design and give users a good mental model of “orthogonal” git history controls.

One thing that might be worth spelling out explicitly:

  • How --include-logs-count interacts with --commit-range when both are provided (e.g., does the explicit commit range override the count, are both applied, or is one ignored?).
  • Whether the default --include-logs-count and the default commit range HEAD~50..HEAD are intended to be strictly equivalent, or if they differ in edge cases.

A short note in this README section (and/or the CLI docs) about precedence would help avoid user confusion once people start composing these flags.

Also applies to: 657-672

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

28-40: Git config test defaults updated; consider tying them to schema defaults

Extending the mock output.git block with commitRange, commitPatchDetail, includeCommitGraph, includeSummary, includeGitTags, and includeCommitPatches looks correct for the expanded RepomixConfigMerged type and keeps this test compiling.

To reduce future drift, you might consider deriving these values from the actual config defaults (e.g., via a shared helper or factory) rather than hard-coding them here, so tests continue to mirror real-world default behavior if the schema changes.

src/core/security/securityCheck.ts (1)

49-64: Consider scanning mermaidGraph content as well.

The security check scans gitLogResult.graph.graph (ASCII graph) but not gitLogResult.graph.mermaidGraph. Since Mermaid graphs may also contain commit messages that could leak sensitive data, consider adding it to the scan.

     // Check commit graph visualization if available
     if (gitLogResult.graph) {
       gitLogTasks.push({
         filePath: 'Git commit graph',
         content: gitLogResult.graph.graph,
         type: 'gitLog',
       });
+      if (gitLogResult.graph.mermaidGraph) {
+        gitLogTasks.push({
+          filePath: 'Git commit mermaid graph',
+          content: gitLogResult.graph.mermaidGraph,
+          type: 'gitLog',
+        });
+      }
     }
website/client/src/es/guide/command-line-options.md (1)

117-124: Missing git history examples compared to English documentation.

The English documentation includes new examples for git commit history analysis (lines 126-134 in EN version) demonstrating --patch, --graph, --summary, and --commit-range usage. Consider adding the equivalent examples to maintain parity.

Add the following examples after Line 124:

# Análisis del historial de commits de Git con flags independientes
repomix --include-logs  # Log simple de commits (formato name-only por defecto)
repomix --include-logs --patch  # Diffs línea por línea
repomix --include-logs --graph  # Con visualización de gráfico de commits
repomix --include-logs --patch --graph --summary  # Análisis completo
repomix --include-logs --commit-range "v1.0..HEAD"  # Rango específico (dos puntos)
repomix --include-logs --commit-range "main...feature"  # Diff simétrico (tres puntos)
repomix --include-logs --stat --graph -o analysis.xml  # Análisis completo a archivo
src/core/git/gitCommand.ts (1)

243-255: Consider whether --all flag should be configurable.

The execGitGraph function hardcodes --all which shows commits from all branches. This may include unrelated branches in the visualization when users only want to see commits in a specific range.

Based on the PR comments mentioning "Documented and retained --all flag behavior", this appears to be intentional. However, consider if this should be a configurable option for users who want branch-scoped graphs.

src/core/git/gitLogHandle.ts (2)

112-117: Patch-to-commit matching relies on array index alignment.

The patches are matched to commits by array index (patches[commits.length] at line 192). This assumes execGitLogTextBlob returns patches in the exact same order as execGitLogStructured returns commits. While this should be true when using the same range/maxCommits parameters, if the two git commands ever produce different commit counts (e.g., due to timing or edge cases), patches could be misaligned.

Consider adding a defensive check or log warning if patches.length !== commits.length after parsing, to catch potential mismatches during development/debugging.


246-253: Type assertion could allow invalid values.

The as 'patch' | 'stat' | 'shortstat' | 'dirstat' | 'numstat' assertion at line 251 doesn't include all valid PatchDetailLevel values from the schema (missing 'raw', 'name-only', 'name-status'). While the patchTypes.includes() check filters which values reach here, the assertion doesn't fully match PatchDetailLevel.

Consider using the PatchDetailLevel type directly or validating the value before the assertion.

src/core/git/gitHistory.ts (1)

81-86: Edge case: Range with multiple .. sequences.

If a range string contains multiple .. (e.g., user error like HEAD~10..HEAD..main), split('..') will return more than two parts, and only the first two will be used. The function won't report an error for this malformed input.

Consider adding validation for exactly two parts:

   // Handle range formats
   const [from, to] = range.split('..');
+  const parts = range.split('..');
+  if (parts.length !== 2) {
+    throw new RepomixError(`Invalid commit range format: '${range}'. Expected exactly one '..' separator`);
+  }
+  const [from, to] = parts;

   if (!from || !to) {
     throw new RepomixError(`Invalid commit range format: '${range}'. Expected format: 'from..to'`);
   }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3b83f9c and 3b8412a.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (44)
  • .gitignore (1 hunks)
  • README.md (2 hunks)
  • llms-install.md (2 hunks)
  • src/cli/actions/defaultAction.ts (1 hunks)
  • src/cli/cliRun.ts (2 hunks)
  • src/cli/types.ts (1 hunks)
  • src/config/configSchema.ts (2 hunks)
  • src/core/git/gitCommand.ts (1 hunks)
  • src/core/git/gitHistory.ts (1 hunks)
  • src/core/git/gitLogHandle.ts (2 hunks)
  • src/core/metrics/calculateGitLogMetrics.ts (2 hunks)
  • src/core/output/outputGenerate.ts (4 hunks)
  • src/core/output/outputGeneratorTypes.ts (1 hunks)
  • src/core/output/outputStyles/markdownStyle.ts (1 hunks)
  • src/core/output/outputStyles/xmlStyle.ts (2 hunks)
  • src/core/packager.ts (1 hunks)
  • src/core/security/securityCheck.ts (1 hunks)
  • tests/cli/actions/workers/defaultActionWorker.test.ts (1 hunks)
  • tests/config/configSchema.test.ts (2 hunks)
  • tests/core/git/gitHistory.test.ts (1 hunks)
  • tests/core/git/gitLogHandle.test.ts (11 hunks)
  • tests/core/metrics/calculateGitDiffMetrics.test.ts (1 hunks)
  • tests/core/metrics/calculateGitLogMetrics.test.ts (19 hunks)
  • tests/core/output/flagFullDirectoryStructure.test.ts (1 hunks)
  • tests/core/output/outputGenerate.test.ts (2 hunks)
  • tests/core/output/outputGenerateDiffs.test.ts (5 hunks)
  • tests/core/output/outputStyles/jsonStyle.test.ts (1 hunks)
  • website/client/.vitepress/config/configEnUs.ts (1 hunks)
  • website/client/src/de/guide/command-line-options.md (1 hunks)
  • website/client/src/en/guide/command-line-options.md (2 hunks)
  • website/client/src/en/guide/configuration.md (3 hunks)
  • website/client/src/en/guide/output.md (1 hunks)
  • website/client/src/en/guide/tips/git-commit-history.md (1 hunks)
  • website/client/src/en/guide/usage.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/hi/guide/command-line-options.md (1 hunks)
  • website/client/src/id/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/vi/guide/command-line-options.md (1 hunks)
  • website/client/src/zh-cn/guide/command-line-options.md (1 hunks)
  • website/client/src/zh-tw/guide/command-line-options.md (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (7)
src/cli/actions/defaultAction.ts (1)
src/shared/errorHandle.ts (1)
  • RepomixError (6-11)
src/core/git/gitCommand.ts (1)
src/shared/logger.ts (1)
  • error (34-38)
src/core/git/gitLogHandle.ts (4)
src/core/git/gitHistory.ts (3)
  • PatchDetailLevel (53-61)
  • CommitGraph (33-39)
  • CommitMetadata (11-28)
src/config/configSchema.ts (1)
  • RepomixConfigMerged (173-173)
src/shared/logger.ts (1)
  • error (34-38)
src/shared/errorHandle.ts (1)
  • RepomixError (6-11)
tests/core/git/gitHistory.test.ts (1)
src/core/git/gitHistory.ts (5)
  • parseCommitRange (67-93)
  • getCommitMetadata (102-187)
  • getTags (256-286)
  • getCommitPatch (291-353)
  • getCommitGraph (192-251)
tests/core/metrics/calculateGitLogMetrics.test.ts (1)
src/core/git/gitLogHandle.ts (1)
  • GitLogResult (37-41)
src/core/output/outputGeneratorTypes.ts (1)
src/core/git/gitLogHandle.ts (1)
  • GitLogResult (37-41)
tests/core/output/outputGenerate.test.ts (2)
tests/testing/testUtils.ts (1)
  • createMockConfig (15-45)
src/core/output/outputGenerate.ts (1)
  • generateOutput (294-335)
🪛 LanguageTool
website/client/src/fr/guide/command-line-options.md

[grammar] ~61-~61: «  historique  » semble plus probable dans ce contexte
Context: ...'intégration d'outils IA ## Options de l'Historique des Commits Git Ces flags indépendants...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_UPPERCASE)


[grammar] ~61-~61: «  commits  » semble plus probable dans ce contexte
Context: ...tils IA ## Options de l'Historique des Commits Git Ces flags indépendants reflètent l...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_UPPERCASE)


[grammar] ~63-~63: Il y a peut-être une erreur ici
Context: ...a structure de git log pour un contrôle précis : Flags de Format de Diff (mutuellement ...

(QB_NEW_FR)


[grammar] ~65-~65: «  format  » semble plus probable dans ce contexte
Context: ...g pour un contrôle précis : Flags de Format de Diff (mutuellement exclusifs - cho...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_UPPERCASE)


[grammar] ~65-~65: «  diff  » semble plus probable dans ce contexte
Context: ...contrôle précis : Flags de Format de Diff (mutuellement exclusifs - choisissez-...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_UPPERCASE)


[grammar] ~65-~65: Il y a peut-être une erreur ici
Context: ...Flags de Format de Diff** (mutuellement exclusifs - choisissez-en un) : - --stat : Affic...

(QB_NEW_FR)


[typographical] ~65-~65: Le trait d’union est employé sans espace pour former des mots, alors que le tiret est encadré par des espaces et placé entre deux mots distincts.
Context: ...ormat de Diff** (mutuellement exclusifs - choisissez-en un) : - --stat : Affich...

(TIRET)


[grammar] ~65-~65: Il y a peut-être une erreur ici
Context: ...mat de Diff** (mutuellement exclusifs - choisissez-en un) : - --stat : Afficher le nombre...

(QB_NEW_FR)


[grammar] ~65-~65: Il y a peut-être une erreur ici
Context: ...tuellement exclusifs - choisissez-en un) : - --stat : Afficher le nombre de mod...

(QB_NEW_FR)


[grammar] ~65-~65: Envisagez un remplacement
Context: ...ellement exclusifs - choisissez-en un) : - --stat : Afficher le nombre de modifications par...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_SPACE_
__
)


[typographical] ~66-~66: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ...e de modifications par fichier (git log --stat) - --patch : Afficher les diffs l...

(TIRET)


[grammar] ~66-~66: Envisagez un remplacement
Context: ...difications par fichier (git log --stat) - --patch : Afficher les diffs ligne par ligne (gi...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_SPACE_
__
)


[typographical] ~67-~67: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ...cher les diffs ligne par ligne (git log --patch) - --numstat : Afficher les ajou...

(TIRET)


[grammar] ~67-~67: Envisagez un remplacement
Context: ... diffs ligne par ligne (git log --patch) - --numstat : Afficher les ajouts/suppressions numér...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_SPACE_
__
)


[typographical] ~68-~68: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ...essions numériques par fichier (git log --numstat) - --shortstat : Afficher un r...

(TIRET)


[grammar] ~68-~68: Envisagez un remplacement
Context: ...mériques par fichier (git log --numstat) - --shortstat : Afficher un résumé d'une ligne des mod...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_SPACE_
__
)


[typographical] ~69-~69: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ... d'une ligne des modifications (git log --shortstat) - --dirstat : Afficher la d...

(TIRET)


[grammar] ~69-~69: Envisagez un remplacement
Context: ... des modifications (git log --shortstat) - --dirstat : Afficher la distribution des modificat...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_SPACE_
__
)


[typographical] ~70-~70: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ...s modifications par répertoire (git log --dirstat) - --name-only : Afficher uniq...

(TIRET)


[grammar] ~70-~70: Envisagez un remplacement
Context: ...tions par répertoire (git log --dirstat) - --name-only : Afficher uniquement les noms de fichie...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_SPACE_
__
)


[typographical] ~71-~71: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ...niquement les noms de fichiers (git log --name-only) - par défaut - `--name-status...

(TIRET)


[typographical] ~71-~71: Ce signe est un trait d’union, il ne sert qu’à former des mots composés. Employez un tiret ou un autre signe de ponctuation plus approprié.
Context: ...es noms de fichiers (git log --name-only) - par défaut - --name-status : Afficher les...

(TIRET)


[grammar] ~71-~71: Envisagez un remplacement
Context: ...hiers (git log --name-only) - par défaut - --name-status : Afficher les noms de fichiers avec le ...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_SPACE_
__
)


[typographical] ~72-~72: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ...ichiers avec le statut A/M/D/R (git log --name-status) - --raw : Afficher le for...

(TIRET)


[grammar] ~72-~72: Envisagez un remplacement
Context: ...e statut A/M/D/R (git log --name-status) - --raw : Afficher le format bas niveau avec les...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_SPACE_
__
)


[grammar] ~73-~73: «  hash  » semble plus probable dans ce contexte
Context: ... Afficher le format bas niveau avec les hashes SHA et les modes (git log --raw) **Options...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_SPELLING)


[typographical] ~73-~73: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ...ec les hashes SHA et les modes (git log --raw) **Options de Niveau de Détail et d...

(TIRET)


[typographical] ~76-~76: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ...he de commits ASCII et Mermaid (git log --graph --all) - --summary : Afficher le...

(TIRET)


[typographical] ~76-~76: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ...mmits ASCII et Mermaid (git log --graph --all) - --summary : Afficher les opérat...

(TIRET)


[typographical] ~77-~77: Ces deux traits d’union peuvent être associés pour former un tiret.
Context: ...enommages, changements de mode (git log --summary) - --commit-range <range> : Pl...

(TIRET)


[grammar] 78-78: Envisagez un remplacement
Context: ...HEAD
50..HEAD, supporte les syntaxes .. et ..., ex : "HEAD
100..HEAD", "v1.0..v2.0", "...

(QB_NEW_FR_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION__PERIOD3_HORIZONTAL_ELLIPSIS)


[grammar] ~78-78: Élément manquant
Context: ....HEAD, supporte les syntaxes .. et ..., ex : "HEAD
100..HEAD", "v1.0..v2.0", "main.....

(QB_NEW_FR_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)


[typographical] ~78-78: Le caractère « points de suspension » est suivi par une espace.
Context: ..."HEAD
100..HEAD", "v1.0..v2.0", "main...feature-branch") ## Exemples ```bash # Utilis...

(POINTS_SUSPENSIONS_SPACE)


[grammar] ~78-~78: Il y a peut-être une erreur ici
Context: ..., "v1.0..v2.0", "main...feature-branch") ## Exemples ```bash # Utilisation de base ...

(QB_NEW_FR)

website/client/src/en/guide/configuration.md

[style] ~341-~341: Consider an alternative to strengthen your wording.
Context: ...its that modified the file). Files with more changes appear at the bottom of the output. Thi...

(CHANGES_ADJUSTMENTS)

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

[grammar] ~65-~65: Ersetze das Satzzeichen
Context: ...Flags** (sich gegenseitig ausschließend - wählen Sie eines): - --stat: Änderung...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)


[grammar] ~66-~66: Ersetze das Satzzeichen
Context: ...Änderungsanzahl pro Datei anzeigen (git log --stat) - --patch: Zeilenweise Diffs anzeige...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASHDASHSTAT_–STAT)


[grammar] ~67-~67: Ersetze das Satzzeichen
Context: ...patch: Zeilenweise Diffs anzeigen (git log --patch) - --numstat`: Numerische Hinzufügunge...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASHDASHPATCH_–PATCH)


[grammar] ~68-~68: Ersetze das Satzzeichen
Context: ...ngen/Löschungen pro Datei anzeigen (git log --numstat) - --shortstat: Einzeilige Zusammenfa...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASHDASHNUMSTAT_–NUMSTAT)


[grammar] ~69-~69: Ersetze das Satzzeichen
Context: ...menfassung der Änderungen anzeigen (git log --shortstat) - --dirstat: Verzeichnis-Änderungsve...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASHDASHSHORTSTAT_–SHORTSTAT)


[grammar] ~70-~70: Ersetze das Satzzeichen
Context: ...chnis-Änderungsverteilung anzeigen (git log --dirstat) - --name-only: Nur Dateinamen anzeig...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASHDASHDIRSTAT_–DIRSTAT)


[grammar] ~71-~71: Hier könnte ein Fehler sein.
Context: ...ame-only: Nur Dateinamen anzeigen (git log --name-only) - Standard - --name-status...

(QB_NEW_DE)


[grammar] ~71-~71: Ersetze das Satzzeichen
Context: ...nly: Nur Dateinamen anzeigen (git log --name-only) - Standard - --name-status`: Date...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASHDASHNAMEDASHONLY_–NAMEDASHONLY)


[grammar] ~71-~71: Ersetze das Satzzeichen
Context: ...Nur Dateinamen anzeigen (git log --name-only) - Standard - --name-status: Dateinamen ...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)


[grammar] ~72-~72: Hier könnte ein Fehler sein.
Context: ...inamen mit A/M/D/R-Status anzeigen (git log --name-status) - --raw: Low-Level-Form...

(QB_NEW_DE)


[grammar] ~72-~72: Ersetze das Satzzeichen
Context: ...n mit A/M/D/R-Status anzeigen (git log --name-status) - --raw: Low-Level-Format mit ...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASHDASHNAMEDASHSTATUS_–NAMEDASHSTATUS)


[grammar] ~73-~73: Ersetze das Satzzeichen
Context: ...t mit SHA-Hashes und Modi anzeigen (git log --raw) **Optionen für Ausgabedetails und Gra...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASHDASHRAW_–RAW)


[style] ~76-~76: Möchten Sie die modernere Schreibweise „Mermaid-Commit-Graf-Visualisierung“ verwenden?
Context: ...m Diff-Format): - --graph: ASCII- und Mermaid-Commit-Graph-Visualisierung einschließen (git log --graph --all) - ...

(F_ANSTATT_PH)


[style] ~76-~76: Möchten Sie die modernere Schreibweise „--graf“ verwenden?
Context: ...ph-Visualisierung einschließen (git log --graph --all) - --summary: Dateioperationen ...

(F_ANSTATT_PH)


[grammar] 78-78: Hier könnte ein Fehler sein.
Context: ...EAD
50..HEAD, unterstützt sowohl .. als auch ... Syntax, z.B. "HEAD
100..HEAD", "v1.0..v2...

(QB_NEW_DE)


[grammar] ~78-78: Hier könnte ein Fehler sein.
Context: ...tzt sowohl .. als auch ... Syntax, z.B. "HEAD
100..HEAD", "v1.0..v2.0", "main...feature-b...

(QB_NEW_DE)


[grammar] ~78-78: Ersetze das Satzzeichen
Context: ..... als auch ... Syntax, z.B. "HEAD
100..HEAD", "v1.0..v2.0", "main...feature-branch")...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_L_DOUBLE_QUOT)


[grammar] ~78-78: Ersetze das Satzzeichen
Context: ...auch ... Syntax, z.B. "HEAD
100..HEAD", "v1.0..v2.0", "main...feature-branch") ## ...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_„)


[grammar] ~78-78: Ersetze das Satzzeichen
Context: ...yntax, z.B. "HEAD
100..HEAD", "v1.0..v2.0", "main...feature-branch") ## Beispiele...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_L_DOUBLE_QUOT)


[grammar] ~78-78: Ersetze das Satzzeichen
Context: ...x, z.B. "HEAD
100..HEAD", "v1.0..v2.0", "main...feature-branch") ## Beispiele ```bash # Grund...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_„)


[grammar] ~78-~78: Ersetze das Satzzeichen
Context: ...0..HEAD", "v1.0..v2.0", "main...feature-branch") ## Beispiele ```bash # Grundlegende ...

(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_L_DOUBLE_QUOT)

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

[grammar] ~61-~61: Corrige la mayúscula.
Context: ... de herramientas de IA ## Opciones del Historial de Commits de Git Estos flags independ...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_UPPERCASE)


[grammar] ~61-~61: Corrige la mayúscula.
Context: ...tas de IA ## Opciones del Historial de Commits de Git Estos flags independientes refl...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_UPPERCASE)


[grammar] ~65-~65: Agrega una palabra o signo.
Context: ...a de git log para control detallado: Flags de Formato de Diff (mutuamente excluy...

(QB_NEW_ES_OTHER_ERROR_IDS_MISSING_OTHER)


[grammar] ~65-~65: Corrige la mayúscula.
Context: ...log para control detallado: Flags de Formato de Diff (mutuamente excluyentes - eli...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_UPPERCASE)


[grammar] ~65-~65: Corrige la mayúscula.
Context: ...ntrol detallado: Flags de Formato de Diff (mutuamente excluyentes - elija uno):...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ORTHOGRAPHY_UPPERCASE)


[grammar] ~65-~65: Cambia la palabra o signo.
Context: ...Flags de Formato de Diff* (mutuamente excluyentes - elija uno): - --stat: Mostrar conteo ...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION)


[grammar] ~65-~65: Cambia la palabra o signo.
Context: ...** (mutuamente excluyentes - elija uno): - --stat: Mostrar conteo de cambios por archivo ...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_SPACE)

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

[grammar] ~62-~62: Possível erro de concordância.
Context: ... Opções de Histórico de Commits do Git Esses flags independentes espelham a estrutura do g...

(GENERAL_GENDER_AGREEMENT_ERRORS)


[uncategorized] ~65-~65: Pontuação duplicada
Context: ...f** (mutuamente exclusivos - escolha um): - --stat: Mostrar contagem de alterações por arqu...

(DOUBLE_PUNCTUATION_XML)


[uncategorized] ~75-~75: Pontuação duplicada
Context: ...ombináveis com qualquer formato de diff): - --graph: Incluir visualização de gráfico de comm...

(DOUBLE_PUNCTUATION_XML)


[typographical] ~78-78: Dois pontos consecutivos
Context: ...mmits Git para analisar (padrão: HEAD
50..HEAD, suporta sintaxes .. e ..., ex: "HE...

(DOUBLE_PUNCTUATION)


[typographical] 78-78: Dois pontos consecutivos
Context: ...padrão: HEAD
50..HEAD, suporta sintaxes .. e ..., ex: "HEAD
100..HEAD", "v1.0..v2....

(DOUBLE_PUNCTUATION)


[typographical] ~78-78: Dois pontos consecutivos
Context: ...suporta sintaxes .. e ..., ex: "HEAD
100..HEAD", "v1.0..v2.0", "main...feature-bra...

(DOUBLE_PUNCTUATION)


[typographical] ~78-78: Dois pontos consecutivos
Context: ...es .. e ..., ex: "HEAD
100..HEAD", "v1.0..v2.0", "main...feature-branch") ## Exem...

(DOUBLE_PUNCTUATION)

🔇 Additional comments (72)
.gitignore (1)

56-56: Verify this change is intentional and related to the PR.

The addition of .claude to .gitignore appears unrelated to the PR objectives, which focus on Git commit history analysis capabilities. While the pattern is consistent with other development artifact ignores (.aider*, .serena/), there's no mention of this change in the PR description.

Is this change intentional for this PR, or was it accidentally included during development/review?

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

61-79: Documentation clearly explains new Git commit history options.

The new section properly documents the orthogonal diff-format flags (marked as mutually exclusive) and output-detail/graph options (marked as optional). Defaults are explicit (e.g., --name-only is default; commit-range defaults to HEAD~50..HEAD), and examples clarify syntax variations (three-dot vs two-dot ranges). Structure and formatting align with the rest of the Japanese documentation.


99-101: Usage examples effectively demonstrate integration of new flags.

The examples at lines 99–101 show practical combinations (e.g., --include-logs --include-logs-count, --include-diffs --include-logs) that help users understand how the new git history options compose with existing flags. Placement and conciseness are good.

website/client/src/zh-tw/guide/command-line-options.md (3)

71-71: Verify the default diff format.

Line 71 marks --name-only as the default ("預設"), but the PR summary states "Defaults preserve prior --include-logs behavior." Confirm that --name-only is indeed the default diff format when using --include-logs, and clarify if this applies only when no other diff-format flag is specified.


75-78: Confirm interaction and syntax rules.

Line 75 states that --graph and --summary can combine with any diff format. Verify there are no conflicts (e.g., some git log combinations that produce parsing or output errors). Also confirm the commit-range syntax examples (e.g., HEAD~100..HEAD, v1.0..v2.0, main...feature-branch) are accurately documented per git semantics.


61-79: Based on my investigation, I'm unable to complete the verification of this review comment due to technical limitations:

  1. Repository access failed: The clone operation for yamadashy/repomix failed
  2. File not found: Web searches cannot locate website/client/src/zh-tw/guide/command-line-options.md in the yamadashy/repomix repository
  3. PR not found: PR #968 does not appear in the yamadashy/repomix repository

The review comment references:

  • A specific file and lines (61-79)
  • An AI summary claiming content duplication
  • Claims about default values and git syntax

Without access to:

  • The actual file content to verify duplication
  • The PR context to understand the changes
  • The repository structure to confirm file location

I cannot verify the core concern (section duplication) or the specific technical claims made in the review.


Unable to verify: Insufficient access to repository and PR context.

The primary concern—verifying whether the "Git提交歷史選項" section is duplicated later in the file—cannot be assessed without direct access to the file content. The referenced PR #968 and file location could not be located through available channels. Manual verification by accessing the repository directly or providing alternative file context is required to validate this review comment.

src/core/packager.ts (1)

103-107: Clarifying comment for git log handling looks good

The new comment accurately captures that getGitLogs now covers both simple logs and full history based on config, and it’s in the right place for future readers.

website/client/.vitepress/config/configEnUs.ts (1)

41-49: New “Git Commit History Analysis” sidebar entry is consistent

The added Advanced item fits the existing structure and naming, and the /guide/tips/git-commit-history path is clear and descriptive. Just ensure the target page exists so the link doesn’t 404.

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

61-78: Indonesian git commit history section aligns well with CLI behavior

The new “Opsi Riwayat Commit Git” section correctly captures the mutually exclusive diff flags and the combinable graph/summary/--commit-range options, including the default range and example syntax. Looks good as-is.

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

61-78: Hindi git commit history documentation is clear and consistent

The “Git कमिट इतिहास विकल्प” section accurately documents the diff-format flags, graph/detail options, and --commit-range behavior, matching the rest of the locales and the CLI. No issues from a docs/semantics standpoint.

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

60-78: Git 提交历史选项文档清晰并与英文版一致

该段准确描述了各个 diff 格式、图表和提交范围标志的行为,与 CLI 语义保持一致,无需进一步修改。

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

61-78: Git-Commit-Verlaufsoptionen Abschnitt ist inhaltlich stimmig

Die Beschreibung der Diff-Formate, --graph, --summary und --commit-range spiegelt das Verhalten von git log korrekt wider und passt zu den übrigen Sprachen. Die von LanguageTool gemeldeten Hinweise zu „doppelter“ Interpunktion stammen im Wesentlichen von gültiger Git-Syntax (HEAD~50..HEAD, main...feature-branch) und müssen hier nicht angepasst werden.

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

61-78: Mục “Tùy chọn Lịch sử Commit Git” rõ ràng và nhất quán

Phần mô tả các flag định dạng diff, --graph, --summary--commit-range phản ánh đúng hành vi git log và phù hợp với tài liệu tiếng Anh, không thấy vấn đề cần chỉnh sửa thêm.

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

83-91: generateOutput calls correctly updated for new gitLogResult parameter

All test invocations of generateOutput have been adjusted to include the new trailing gitLogResult argument, using undefined where commit log data is not under test. This keeps the tests focused on diff behavior while matching the updated function signature, without changing their effective assertions.

Also applies to: 116-125, 150-159, 184-193, 228-237

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

35-37: RenderContext git history fields are well-typed and consistent

Adding gitCommitHistorySummary and gitCommitGraph as GitLogResult['summary'] / ['graph'] keeps the render context strongly tied to the git history model while avoiding duplication of types. This should make it straightforward for output styles to opt into richer commit summaries and graphs when present.

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

232-253: LGTM!

The test data structure has been correctly updated to use logCommits array format, aligning with the new structured git history model. The test appropriately verifies that git log content appears in the output.


308-363: LGTM! Comprehensive test coverage for markdown git commit history.

The test properly validates:

  • Summary section with totalCommits, mergeCommits, range, detailLevel
  • Graph data with ASCII, Mermaid, and tags
  • Extended commit metadata (hash, abbreviatedHash, parents, author, committer, body, patch)
  • Files changed rendering

The mock data structure accurately reflects the new GitLogResult shape.


365-432: LGTM! Solid parsable XML test with proper handling of fast-xml-parser quirks.

Good handling of the single-element array behavior (Lines 424-426) where fast-xml-parser returns an object instead of array for single items. The assertions correctly verify the XML structure including summary, commit_graph, and commit details.


434-481: LGTM!

Good test for verifying the files list rendering in the XML template (non-parsable style). Correctly asserts the presence of <files> tags and individual file paths.


483-536: LGTM!

Properly tests the merge_commits rendering in parsable XML when the graph contains merge commit data. The assertion at Line 535 correctly expects a string value (single element) rather than an array due to XMLParser behavior.

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

61-79: LGTM! Clear and comprehensive documentation of the new git history options.

The documentation correctly:

  • Describes diff format flags as mutually exclusive with clear git log equivalents
  • Documents combinable options (graph, summary, commit-range) separately
  • Provides appropriate defaults and syntax examples for commit-range

126-134: LGTM! Helpful examples demonstrating the new git history flags.

The examples cover common use cases including simple logs, patches, graphs, combined options, and both two-dot and three-dot commit range syntax.

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

61-79: LGTM! Spanish translation is accurate and consistent with English documentation.

The static analysis hints about capitalization ("Commits", "Formato", "Diff") are false positives - these are technical terms and proper nouns that are correctly capitalized in this context.

website/client/src/en/guide/output.md (2)

244-305: LGTM! Comprehensive documentation of the commit history output structure.

The XML example clearly demonstrates all new sections and fields:

  • Summary block with metadata
  • Commit graph (ASCII and Mermaid)
  • Tags section
  • Full commit metadata including author, committer, parents, body, and patch

This will help users understand the new output format.


307-320: LGTM! Clear documentation of the diff format flags and graph options.

The list correctly identifies:

  • Diff format flags as mutually exclusive
  • Output verbosity & graph options as combinable
  • Appropriate descriptions for each option
src/cli/cliRun.ts (2)

46-48: LGTM!

Good additions to the semantic suggestion map - users typing --git-commits, --commit-range, or --history will get helpful suggestions for the correct options.


143-160: Verification of mutual exclusivity enforcement for diff format options cannot be completed due to repository access issues.

The review comment raises a valid concern about diff format options being documented as mutually exclusive but not enforced at the CLI level. The suggested use of Commander's .conflicts() method is accurate—this method does enforce mutual exclusivity with clear error messages at parse time.

However, I cannot verify whether:

  • Validation is already handled downstream in config processing
  • Users receive clear error messages when specifying conflicting options
  • The non-exclusive behavior is intentional

To properly complete this review, the codebase would need to be directly inspected to determine if this is already validated elsewhere (in which case the review comment could be resolved), or if the refactor is truly needed (in which case it should be applied).

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

67-98: LGTM! Well-structured summary and graph sections.

The template correctly:

  • Renders summary only when gitCommitHistorySummary exists
  • Includes optional Mermaid diagram and Tags with proper conditionals
  • Uses appropriate Markdown formatting (code blocks, bold, lists)

100-138: LGTM! Comprehensive commit metadata rendering with proper conditional guards.

The enhanced commit section properly handles:

  • Optional fields (hash, author, parents, body, patch) with {{#if}} guards
  • Files list with inline code formatting
  • Patch/diff content in a diff code block
  • Visual separation between commits with ---
src/core/output/outputStyles/xmlStyle.ts (2)

69-96: LGTM - Git history summary and graph sections are well-structured.

The conditional blocks for gitCommitHistorySummary and gitCommitGraph follow the existing template patterns. The tag iteration using {{#each gitCommitGraph.tags}} with @key for object keys is correct Handlebars syntax for iterating over object properties.


107-141: LGTM - Extended commit metadata fields are properly guarded.

The new optional fields (hash, author, committer, parents, body, patch) are all conditionally rendered, preventing empty tags when data is not requested. The nested structure for author/committer with name, email, and date sub-elements is clean and consistent.

website/client/src/en/guide/usage.md (1)

120-163: LGTM - Comprehensive documentation for the new commit history analysis feature.

The documentation clearly explains the orthogonal flag design, distinguishes between mutually exclusive diff format flags and combinable verbosity/graph options, and provides practical examples. The cross-reference to the detailed tips guide is helpful for users wanting more depth.

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

283-302: LGTM - Mutual exclusion validation for diff format flags.

The validation correctly identifies when multiple mutually exclusive diff format flags are used and throws a clear error message. Using filter(Boolean) to count truthy values is a clean approach.


304-343: LGTM - Clean config construction with proper merging.

The logic correctly determines the patch detail level and constructs the git log configuration. Auto-enabling includeLogs: true when any enhancement flag is used (line 329) provides good UX - users can simply use --patch without explicitly adding --include-logs.

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

34-39: LGTM - Test fixture updated with new git config options.

The mock configuration correctly includes the new git history options to satisfy the updated RepomixConfigMerged type. Using as const for commitPatchDetail ensures proper type narrowing.

website/client/src/en/guide/tips/git-commit-history.md (2)

1-52: LGTM - Excellent documentation structure with clear parameter organization.

The documentation effectively explains the orthogonal parameter design with well-formatted tables distinguishing mutually exclusive diff format flags from combinable verbosity options. The Git parameter mapping helps users understand the relationship to native git commands.


107-172: LGTM - Practical workflow examples and helpful tips.

The example workflows cover a good range of use cases from code review to architecture analysis. The tips section provides actionable guidance on choosing the right diff format and combining flags effectively. The advanced examples demonstrate real-world usage patterns with valid flag combinations.

tests/cli/actions/workers/defaultActionWorker.test.ts (1)

62-67: LGTM! New git configuration fields properly added to test fixture.

The mock configuration correctly includes all new git history options (commitRange, commitPatchDetail, includeCommitGraph, includeSummary, includeGitTags, includeCommitPatches) with appropriate test values that align with the expanded config schema.

src/cli/types.ts (1)

30-44: LGTM! Well-documented CLI option additions.

The new git log options are well-organized with clear inline comments mapping each flag to its corresponding git log option. The separation into mutually exclusive diff format flags and combinable graph/summary options is clearly documented.

tests/core/metrics/calculateGitLogMetrics.test.ts (3)

52-57: LGTM! Mock configuration properly extended with new git options.

The test configuration correctly includes all new git history configuration fields, mirroring the expanded schema.


164-189: LGTM! Test correctly validates token calculation with new logCommits structure.

The test properly verifies that JSON.stringify(gitLogResult.logCommits) is passed to the token calculator, aligning with the refactored GitLogResult interface that uses structured logCommits instead of raw logContent.


209-235: LGTM! Comprehensive test for complex multi-commit scenarios.

Good coverage of the new structured format including optional fields like author and body, verifying that token calculation handles rich commit metadata correctly.

tests/core/git/gitLogHandle.test.ts (5)

9-61: LGTM! Well-designed helper for structured git output generation.

The createStructuredOutput helper is well-documented and correctly simulates the NUL-separated format used by git log -z --raw. The comment explaining that git rejects NUL in commit content provides good context for why this delimiter is safe.


382-425: LGTM! Important edge case test for hash-like filenames.

This test ensures that 40-character hex filenames (which look like git commit hashes) are correctly treated as filenames rather than being misinterpreted as commit boundaries. This is a valuable regression test for the NUL-based parsing approach.


427-482: LGTM! Patch retrieval test validates two-pass architecture.

Good coverage of the execGitLogTextBlob integration for patch retrieval, including verification that the correct parameters are passed and that patch content is properly associated with commits.


484-531: LGTM! Graph retrieval test covers new graph functionality.

The test properly verifies execGitGraph integration and that graph output is correctly included in the result structure.


3-3: The import of GIT_LOG_FORMAT_SEPARATOR is valid and correctly exported.

Verification confirms that GIT_LOG_FORMAT_SEPARATOR is definitively exported from src/core/git/gitLogHandle.ts (line 13: export const GIT_LOG_FORMAT_SEPARATOR = '%x00';). The import at line 3 of the test file is correct. Both GIT_LOG_FORMAT_SEPARATOR and GIT_LOG_RECORD_SEPARATOR remain exported—the AI summary may have conflated these two separate constants, but neither has been removed.

website/client/src/en/guide/configuration.md (4)

340-358: LGTM! Clear and well-organized documentation for new git options.

The documentation effectively explains the relationship between includeLogs and the detailed commit history options, clarifying that structured metadata is automatically included when advanced options are used. The separation into "Simple Git Output" and "Detailed Commit History Options" sections improves readability.


359-374: LGTM! Helpful example configuration for advanced usage.

The example clearly demonstrates how to combine the new git history options for comprehensive commit analysis. The inline comment explaining what data is included is useful context.


178-184: LGTM! Example JSON config updated with all new git options.

The example configuration correctly includes all new git history options with their default values.


111-116: Verify includeCommitPatches default value consistency between documentation and schema.

The documentation states includeCommitPatches defaults to false (line 116), but previous context suggested the default in src/config/configSchema.ts might be true. This inconsistency should be verified and corrected if the defaults don't match across both files.

tests/core/git/gitHistory.test.ts (3)

1-9: LGTM! Well-structured test suite with comprehensive coverage.

The test file properly covers all exported functions from gitHistory.ts with appropriate edge cases including:

  • Initial commits with no parents
  • Empty bodies
  • Special characters in file paths
  • Quote escaping for Mermaid syntax
  • Various patch detail levels

The use of dependency injection via mocks enables isolated unit testing.


399-450: Good coverage of composite getCommitGraph workflow.

The test properly mocks the sequential git operations (graph visualization, commit hashes, tags) and validates:

  • Correct number of commits returned
  • Graph content presence
  • Mermaid graph generation
  • Tag mappings

The dependency injection pattern allows testing the orchestration logic in isolation.


83-114: I'm unable to clone the repository to verify the actual implementation of the body parsing logic in src/core/git/gitHistory.ts. However, based on the code snippet you've provided in the review comment, I can identify the discrepancy:

The mock data includes leading spaces in both body lines (' This is the commit body' and ' with multiple lines'), but the expected output shows the first line without leading spaces while preserving them on the second line. This inconsistency suggests either:

  1. The implementation applies additional string processing (like dedenting or trimming individual lines) beyond the lines.slice(10).join('\n').trim() shown
  2. The test expectation needs adjustment to match the actual implementation behavior

Body parsing expectation needs verification against actual implementation.

The mock data includes leading spaces on body lines, but the test expectation shows the first line without them. Please verify that the implementation's body parsing logic (in gitHistory.ts) matches this expected output, or adjust the test mock/expectation accordingly.

src/config/configSchema.ts (2)

51-58: LGTM! Schema additions are well-structured.

The new git history options in the base schema properly use optional types with appropriate enums for commitPatchDetail. The enum values align with git's supported diff format options.


118-125: Sensible defaults for new git history options.

The default configuration values are conservative:

  • commitRange: 'HEAD~50..HEAD' - matches existing includeLogsCount default
  • commitPatchDetail: 'name-only' - lightweight, minimal output
  • includeCommitGraph/includeSummary/includeCommitPatches: false - opt-in for richer data
  • includeGitTags: true - tags are lightweight metadata, reasonable default
src/core/output/outputGenerate.ts (3)

33-61: LGTM! Clean integration of git history data into render context.

The changes properly extract and pass through the new git history fields from gitLogResult:

  • gitLogCommits from logCommits
  • gitCommitHistorySummary from summary
  • gitCommitGraph from graph

Optional chaining ensures null-safety when gitLogResult is undefined.


97-145: Well-structured conditional field inclusion in XML output.

The spread pattern ...(condition && { field: value }) cleanly handles optional fields without cluttering the output with empty/undefined values. The XML structure properly:

  • Nests summary statistics under summary
  • Nests graph visualization under commit_graph
  • Extends commit entries with optional metadata fields

The guards on line 141 (commit.parents && commit.parents.length > 0) and lines 142-143 (truthy checks for body/patch) prevent empty array/string pollution.


193-226: JSON output mirrors XML structure appropriately.

The JSON generation maintains consistency with XML while using idiomatic camelCase naming. The optional field handling follows the same pattern, ensuring the output shape only includes populated fields.

src/core/git/gitCommand.ts (2)

180-199: Excellent documentation of the two-pass architecture.

The comments clearly explain:

  • Why NUL bytes are safe delimiters (git rejects them in commit content)
  • The three-pass approach (structured, text blob, graph)
  • The format string field order

This design choice improves robustness over fragile heuristics.


211-226: LGTM! Structured metadata extraction with proper argument handling.

The function correctly:

  • Uses -z --raw for NUL-terminated output
  • Prioritizes range over maxCommits when both could be set
  • Logs trace on failure before rethrowing
tests/config/configSchema.test.ts (2)

124-130: LGTM! New git configuration fields are properly tested.

The test fixture correctly includes all new git-related configuration fields with sensible default values that align with the schema and the PR's feature additions.


235-241: Test values are consistent with the default schema test.

The merged config test mirrors the same git configuration fields and values as the default schema test, maintaining consistency across test cases.

src/core/git/gitLogHandle.ts (3)

19-60: Well-structured type definitions with clear documentation.

The progressive optional fields pattern in GitLogCommit is a clean approach for handling different levels of detail based on configuration. The JSDoc comments clearly explain when each field is present.


154-181: Robust file entry parsing with proper commit boundary detection.

The two-step boundary detection (checking for 40-char hash AND validating the next part is an abbreviation of it) effectively prevents false positives from filenames that might look like hashes. Good defensive approach.


309-312: Good error handling pattern.

Re-throwing RepomixError as-is while wrapping other errors with context preserves stack traces and provides meaningful error messages. This is a solid error handling approach.

src/core/git/gitHistory.ts (6)

109-163: Robust parsing with null byte delimiter - addresses previous review feedback.

The implementation correctly uses %x00 (null byte) as a reliable delimiter between commit metadata and file list. Since git rejects commits containing null bytes, this approach is 100% robust and resolves the previously flagged fragile heuristic parsing issue.

The body handling is also correct: lines.slice(10).join('\n') properly reconstructs multi-line commit bodies.


206-229: N+1 git calls pattern for metadata fetching.

The function makes one git log call per commit to fetch metadata (line 229). For ranges with many commits, this could be slow. The current approach is acceptable given this is an opt-in enhanced feature, but for future optimization, consider batching metadata retrieval in a single git log call with appropriate formatting.

The --all flag at line 213 is intentionally kept per the PR discussion to show branch topology within the range.


256-286: Graceful degradation on tag retrieval failure.

Returning an empty object on error is appropriate since tags are supplementary metadata. The parsing correctly handles the standard git tag format.


291-353: Complete coverage of all patch detail levels.

The switch statement correctly maps all PatchDetailLevel values to their corresponding git flags, with a default case that throws for invalid values.


368-401: Mermaid syntax issues resolved - addresses previous review feedback.

The implementation now correctly uses commit id: "..." type: HIGHLIGHT for merge commits instead of the invalid merge ${hash} syntax. Tags are properly attached to commit lines rather than creating phantom commits. The generated diagrams should render correctly in Mermaid.


358-360: Proper escaping for Mermaid string safety.

The escaping function handles the key characters (quotes and newlines) that could break Mermaid diagram syntax when commit messages contain them.

@ahundt ahundt force-pushed the feat/git-commit-history-squashed branch from 3b8412a to e0ff030 Compare November 26, 2025 12:50
@yamadashy
Copy link
Owner

Hi @ahundt!
Thank you for this PR!

I've been thinking about extending the git history-related features, so the direction looks good to me.

I'd like to take some time to think about the option design. I don't have time to review the code in detail right now, but I'll take a closer look later!

@ahundt
Copy link
Author

ahundt commented Nov 29, 2025

Ok I stuck to your existing pattern and it is essentially a pass through of the existing git commands which I view as one of the the likeliest paths users and tools like ais will be able to run with existing knowledge, and thus a reasonable choice. It is dramatically simplified from the initial commit.

…ta extraction

Summary: Enable detailed git commit history in repository output for AI systems to understand code evolution, including ASCII/Mermaid graph visualization, commit metadata extraction (hash/author/committer/parents/files), and configurable patch detail levels.

Previous behavior: Repomix supported basic git log output via --include-logs flag, which only displayed simple chronological commit messages without graph topology, detailed metadata (author/committer/parents), diff patches, or branch/merge visualization.

What changed:
- src/cli/cliRun.ts: add 6 CLI options (--include-commit-history, --commit-range, --commit-patch-detail, --no-commit-graph, --no-git-tags, --no-commit-patches) with semantic suggestion mappings
- src/cli/actions/defaultAction.ts: add buildCliConfig() logic to process commit history options and merge into config.output.git
- src/cli/types.ts: add CliOptions fields for commit history (includeCommitHistory, commitRange, commitPatchDetail, commitGraph, gitTags, commitPatches)
- src/config/configSchema.ts: add repomixConfigBaseSchema and repomixConfigDefaultSchema fields for commit history config with defaults (commitRange: 'HEAD~50..HEAD', commitPatchDetail: 'stat', includeCommitGraph: true, includeGitTags: true, includeCommitPatches: true)
- src/core/git/gitHistory.ts: create parseCommitRange(), getCommitMetadata(), getCommitGraph(), getCommitPatch(), getTags() functions to execute git log/show commands, parse commit data including full author/committer metadata, generate ASCII/Mermaid graphs from topology, and retrieve diffs at configurable detail levels
- src/core/git/gitHistoryHandle.ts: create getGitHistory() to orchestrate git history collection with configurable patch detail levels (full/stat/files/metadata)
- src/core/output/outputGenerate.ts: integrate getGitHistory() and add gitCommitHistory* fields to template data
- src/core/output/outputGeneratorTypes.ts: add GeneratedOutputData fields for gitCommitHistory, gitCommitGraph, gitCommitHistoryItems
- src/core/output/outputStyles/markdownStyle.ts: add Git Commit History section with Summary (total commits/merge commits/range/detail level), Commit Graph (ASCII/Mermaid/Tags), and per-commit details (hash/author/committer/date/message/body/files/patch)
- src/core/output/outputStyles/xmlStyle.ts: add <git_history> with <summary>, <commit_graph>, and <commit> elements including full author/committer metadata
- src/core/packager.ts: add gitHistory parameter to packDirectory()
- tests/core/git/gitHistory.test.ts: add tests for parseCommitRange, getCommitMetadata, getCommitGraph, getCommitPatch, getTags functions (19 tests, 282 lines)
- tests/*: add integration tests and update existing tests for git history functionality
- website/client/src/en/guide/tips/git-commit-history.md: create guide explaining feature usage, patch detail levels, and configuration options
- website/client/src/en/guide/*.md: update command-line-options.md, configuration.md, output.md, usage.md with git commit history documentation
- website/client/.vitepress/config/configEnUs.ts: add sidebar link to git-commit-history guide
- README.md: add git commit history feature to main feature list with examples
- llms-install.md: document includeCommitHistory, commitRange, commitPatchDetail options for MCP tools

Why: AI systems analyzing repositories need to understand code evolution patterns beyond individual file contents. Commit history reveals development patterns, identifies code stability risks, and provides context about why changes were made. Graph visualization shows branch/merge topology for understanding parallel development. Raw author/committer email metadata allows consumers to identify development patterns (e.g., commits from AI assistants like claude@ or copilot@ vs human developers) without pre-classifying commits. This enables more context-aware AI analysis of repository health and development practices.

Files affected:
- 2 new core files: src/core/git/gitHistory.ts (372 lines), src/core/git/gitHistoryHandle.ts (149 lines)
- 8 modified source files: CLI (cliRun.ts, defaultAction.ts, types.ts), config (configSchema.ts), output (outputGenerate.ts, outputGeneratorTypes.ts, markdownStyle.ts, xmlStyle.ts)
- 1 modified packager: src/core/packager.ts
- 10 test files added/modified: comprehensive unit tests for all git history functions (871 tests pass)
- 5 documentation files: new guide + updates to existing guides
- 2 project files: README.md, llms-install.md

Testable:
```bash
# Basic commit history with graph
npx repomix --include-commit-history --output output.xml

# Analyze last 20 commits
npx repomix --include-commit-history --commit-range HEAD~20..HEAD

# Full diffs for specific range
npx repomix --include-commit-history --commit-range v1.0..v2.0 --commit-patch-detail full

# Metadata only (no patches, no graph)
npx repomix --include-commit-history --commit-patch-detail metadata --no-commit-graph

# Verify author/committer metadata is visible
npx repomix --include-commit-history -o output.xml
grep '<email>' output.xml

# Run tests
npm run test  # 871 tests pass
npm run lint  # 0 errors
```
…syntax, tests

Summary: Fix commit history parsing by replacing fragile body/file heuristic with
null byte delimiter, add missing git_history section to parsable XML output, fix
invalid Mermaid gitGraph syntax, add files list to XML/Markdown templates.

Previous behavior:
- getCommitMetadata() in gitHistory.ts used heuristic loop assuming body lines
  start with spaces or are empty, which misclassified body text like
  "This line has no leading space" as a file path
- generateMermaidGraph() produced invalid syntax: `merge abc1234 tag: "message"`
  and separate `commit tag: "v1.0"` lines which Mermaid parsers reject
- generateParsableXmlOutput() in outputGenerate.ts had no git_history section,
  while generateParsableJsonOutput() had complete gitCommitHistory structure
- xmlStyle.ts and markdownStyle.ts templates rendered commits without files list
  even though metadata.files was available

What changed:
- src/core/git/gitHistory.ts:
  - Add NULL_BYTE constant and %x00 to git log format string after %b
  - Split stdout on NULL_BYTE: `const [formatOutput, fileListOutput] = result.stdout.split(NULL_BYTE)`
  - Body parsing: `lines.slice(10).join('\n').trim()` instead of heuristic loop
  - Files parsing: `fileListOutput.split('\n').filter(Boolean)` instead of heuristic
  - Add escapeMermaidString(): replaces " with ' and \n with space
  - Fix Mermaid syntax: `commit id: "abc1234: (merge) message" tag: "v1.0" type: HIGHLIGHT`
    instead of separate merge/tag lines
- src/core/output/outputGenerate.ts:
  - Add git_history block to generateParsableXmlOutput() matching JSON structure:
    summary (total_commits, merge_commits, range, detail_level),
    commit_graph (ascii_graph, mermaid_graph, merge_commits, tags),
    commits array with @_hash/@_abbreviated_hash attributes, author/committer/parents/message/body/files/patch
- src/core/output/outputStyles/xmlStyle.ts:
  - Add `{{#if this.metadata.files.length}}<files>{{#each}}<file>{{{this}}}</file>{{/each}}</files>{{/if}}`
- src/core/output/outputStyles/markdownStyle.ts:
  - Add `{{#if this.metadata.files.length}}**Files Changed**:\n{{#each}}- \`{{{this}}}\`{{/each}}{{/if}}`
- tests/core/git/gitHistory.test.ts:
  - Add NULL_BYTE constant matching implementation
  - Update existing tests to use NULL_BYTE instead of empty line after body
  - Add test: body text without leading spaces parsed correctly (edge case fix verification)
  - Add test: empty body with NULL_BYTE handled
  - Add test: files with special characters (parentheses, brackets, hyphens) in paths
  - Add test: commit with no files changed returns empty array
- tests/core/git/gitHistoryHandle.test.ts (new file, 264 lines):
  - Test: returns undefined when includeCommitHistory is false
  - Test: returns undefined when directory is not a git repository
  - Test: returns git history with default options (range HEAD~50..HEAD, detailLevel stat)
  - Test: uses custom commitRange from config
  - Test: uses custom commitPatchDetail from config
  - Test: excludes graph when includeCommitGraph is false
  - Test: excludes tags when includeGitTags is false (returns empty object)
  - Test: excludes patches when includeCommitPatches is false
  - Test: counts merge commits correctly (commits with 2+ parents)
  - Test: throws RepomixError on git command failure
  - Test: uses cwd when rootDirs is empty
- tests/core/output/outputGenerate.test.ts:
  - Add test: markdown output includes Files Changed section with bullet list
  - Add test: parsable XML output includes git_history with summary/commit_graph/commits
  - Add test: XML template output includes <files>/<file> elements
  - Add test: parsable XML commit_graph includes merge_commits field
- website/client/src/en/guide/configuration.md:
  - Add includeCommitPatches option to table: "Whether to include code patches (diffs) for each commit"
  - Add complete example config JSON with all commit history options
  - Add "Commit History Analysis" section explaining each option
- website/client/src/en/guide/output.md:
  - Update XML example: hash="abc123def456789" instead of "abc123"
  - Add <parents><parent>def456abc789012</parent></parents> element
  - Add <body>Extended commit message body...</body> element
  - Add <files><file>src/feature.ts</file><file>tests/feature.test.ts</file></files> element
- website/client/src/en/guide/tips/git-commit-history.md:
  - Clarify --all flag: "shows how branches connect within the specified range"

Why: Null bytes (\0) cannot appear in git commit messages or file paths, making
%x00 a reliable delimiter vs heuristics that fail on body text without indentation.
Mermaid gitGraph requires specific syntax (commit id: "..." tag: "..." type: ...).
XML/JSON output parity ensures consistent data regardless of format choice.

Testable: npm run test (894 pass), npm run lint (pass).
Generate: repomix --include-commit-history --style xml --parsable-style
Verify: XML contains <git_history> with <summary>, <commit_graph>, <commits>
…ional parameter

Previous behavior:
- CLI had 6 separate flags: --include-commit-history, --commit-range, --commit-patch-detail, --no-commit-graph, --no-git-tags, --no-commit-patches
- Patch detail levels used git-incompatible names: 'full', 'files'
- Documentation used vague terms like "complete diffs", "change statistics"
- Config file and CLI both exposed all fine-grained controls

What changed:
- Simplified CLI to 2 flags with optional parameter syntax
- Renamed patch levels to match git log parameters: 'full'→'patch', 'files'→'name-only'
- Made patch detail level an optional parameter: --include-commit-history [level]
- Config file retains all advanced options (includeCommitGraph, includeGitTags, includeCommitPatches)
- Updated all descriptions to use concrete terms with examples
- Added git parameter references throughout documentation

Why:
This change follows the principle of optimizing for the 95% use case. Most users want simple commit history analysis without fine-tuning every component. The simplified CLI makes common tasks easier (just --include-commit-history patch) while advanced users can still use config files for edge cases. Parameter names now match git's conventions for familiarity.

Files changed:
- src/cli/cliRun.ts: Simplified from 6 flags to 2, added optional parameter with validation
- src/cli/types.ts: Changed includeCommitHistory to boolean | string type, removed 3 boolean flags
- src/cli/actions/defaultAction.ts: Streamlined config building logic, handle string vs boolean type
- src/config/configSchema.ts: Updated enum from ['full', 'stat', 'files', 'metadata'] to ['patch', 'stat', 'name-only', 'metadata']
- src/core/git/gitHistory.ts: Updated PatchDetailLevel type and switch cases for 'patch' and 'name-only'
- tests/core/git/gitHistory.test.ts: Updated test cases to use new parameter names
- tests/core/git/gitHistoryHandle.test.ts: Changed 'full' to 'patch' in test expectations
- tests/core/output/outputGenerate.test.ts: Updated detailLevel from 'full' to 'patch'
- README.md: Replaced vague terms with concrete examples, simplified CLI examples
- llms-install.md: Added git log parameter references to commitPatchDetail descriptions
- website/client/src/en/guide/command-line-options.md: Condensed 6 options into 2 with git param mapping
- website/client/src/en/guide/configuration.md: Updated table and detailed explanations with concrete terms
- website/client/src/en/guide/tips/git-commit-history.md: Added Git Param column to table, made examples concise
- website/client/src/en/guide/output.md: Added git param references to patch detail levels
- website/client/src/en/guide/usage.md: Updated examples to use simplified syntax with git params

Technical details:
- Commander.js optional parameter syntax: --include-commit-history [level]
- Validation function checks valid levels: ['patch', 'stat', 'name-only', 'metadata']
- Type narrowing in defaultAction.ts: typeof options.includeCommitHistory === 'string'
- Zod enum validation updated in both base and default schemas
- Git commands mapped: patch→--patch, stat→--stat, name-only→--name-only, metadata→--no-patch

Testable:
- Run: npm run lint (passes: 0 errors, 0 warnings)
- Run: npm test (passes: 894/894 tests)
- Run: repomix --include-commit-history (uses stat level by default)
- Run: repomix --include-commit-history patch (shows line-by-line diffs)
- Run: repomix --include-commit-history name-only (shows filenames only)
- Run: repomix --include-commit-history metadata (no diffs, metadata only)
- Run: repomix --include-commit-history invalid (shows error with valid options)
…git log

Replace --include-commit-history with orthogonal CLI flags that directly
map to git log parameters, enabling precise control over diff output format
and enhancement features.

Previous behavior:
- Single --include-commit-history flag enabled comprehensive history
- gitHistoryHandle.ts separate from gitLogHandle.ts
- includeCommitHistory config field controlled all history features
- Limited to 4 diff formats (patch, stat, name-only, name-status)
- No separate control over graph visualization vs summary output

What changed:
- Removed --include-commit-history CLI flag
- Removed includeCommitHistory config field
- Deleted src/core/git/gitHistoryHandle.ts (merged into gitLogHandle.ts)
- Added 8 diff format flags matching git log: --stat, --patch, --numstat,
  --shortstat, --dirstat, --name-only, --name-status, --raw
- Added 2 enhancement flags: --graph (commit graph visualization),
  --summary (file operations like creates, renames, mode changes)
- Extended commitPatchDetail enum to support all 8 formats
- Added includeSummary config field for granular control
- Implemented mutual exclusion validation for diff format flags
- Unified getGitLogs() function returns GitLogResult | GitHistoryResult
- Automatic routing between simple mode (includeLogs only) and
  comprehensive mode (includeCommitGraph or includeSummary enabled)
- Support both .. and ... commit range syntax in all documentation

Why:
Enable users to select exact git log output format needed for their use case
without enabling unwanted features. Orthogonal flags match git log's design,
making the interface intuitive for git users. Consolidating handlers reduces
code duplication and maintenance burden.

Files affected:
Core implementation:
- src/config/configSchema.ts: extended commitPatchDetail enum to 8 formats,
  added includeSummary field, removed includeCommitHistory
- src/core/git/gitHistory.ts: extended PatchDetailLevel type with 5 new
  formats (numstat, shortstat, dirstat, name-status, raw), added
  includeSummary parameter to getCommitPatch()
- src/core/git/gitLogHandle.ts: merged all gitHistoryHandle.ts
  functionality, added getComprehensiveGitHistory() and getSimpleGitLogs()
  helpers, unified getGitLogs() with routing logic
- src/core/git/gitHistoryHandle.ts: deleted (consolidated into
  gitLogHandle.ts)
- src/core/output/outputGenerate.ts: removed gitHistoryResult parameter
  from generateOutput() and buildOutputGeneratorContext() (8→6 params,
  7→6 params), updated createRenderContext() to detect and extract from
  GitLogResult | GitHistoryResult union type
- src/core/packager.ts: replaced separate getGitHistory() call with single
  unified getGitLogs() call

CLI:
- src/cli/types.ts: removed includeCommitHistory field, added 8 orthogonal
  diff format flags (stat, patch, numstat, shortstat, dirstat, nameOnly,
  nameStatus, raw) and 2 enhancement flags (graph, summary)
- src/cli/cliRun.ts: removed --include-commit-history option, added 8 diff
  format option flags and 2 enhancement option flags with descriptions
- src/cli/actions/defaultAction.ts: implemented mutual exclusion validation
  for diff format flags (lines 287-302), mapped each CLI flag to
  appropriate config field (lines 305-340), fixed linter error by removing
  duplicate else-if block

Tests (fixed compilation errors):
- tests/core/output/diffsInOutput.test.ts: updated generateOutput() calls
  from 8 to 6 parameters
- tests/core/output/flagFullDirectoryStructure.test.ts: removed
  includeCommitHistory, added includeSummary, updated
  buildOutputGeneratorContext() calls from 7 to 6 parameters
- tests/core/output/outputGenerate.test.ts: replaced includeCommitHistory
  with includeCommitGraph + includeCommitPatches in mock structures
- tests/core/output/outputGenerateDiffs.test.ts: updated generateOutput()
  calls from 8 to 6 parameters
- tests/core/output/outputStyles/jsonStyle.test.ts: removed
  includeCommitHistory, added includeSummary
- tests/core/metrics/calculateGitDiffMetrics.test.ts: removed
  includeCommitHistory, added includeSummary
- tests/core/metrics/calculateGitLogMetrics.test.ts: removed
  includeCommitHistory, added includeSummary
- tests/core/git/gitLogHandle.test.ts: added missing mock dependencies
  (isGitRepository, getCommitGraph, getCommitPatch), added type casts for
  union type access

Documentation (with concrete examples for both .. and ... syntax):
- README.md: replaced --include-commit-history examples with orthogonal
  flags, listed all 8 diff format flags and 2 enhancement flags
- website/client/src/en/guide/tips/git-commit-history.md: complete rewrite
  with orthogonal parameter design, detailed tables for diff format and
  enhancement flags, workflow examples
- website/client/src/en/guide/usage.md: updated Commit History Analysis
  section with all flags and examples
- website/client/src/en/guide/command-line-options.md: reorganized Git
  Commit History Options section with detailed flag descriptions
- website/client/src/en/guide/output.md: updated to reflect new flag
  structure and all diff formats

Testable:
- Verify mutual exclusion: npx repomix --stat --patch (should error)
- Test diff format flag: npx repomix --name-only --commit-range HEAD~10..HEAD
- Test enhancement flags: npx repomix --name-status --graph --summary
- Test both range syntaxes: npx repomix --stat --commit-range main..feature
  vs npx repomix --stat --commit-range main...feature
- Verify simple mode: npx repomix --include-logs (no graph/summary)
- Verify comprehensive mode: npx repomix --include-logs --graph
…t codebase

Update all functions that accept git log results to handle the new union
type (GitLogResult | GitHistoryResult) returned by the unified getGitLogs()
function.

Previous behavior:
- Functions expected only GitLogResult type
- GitHistoryResult couldn't be passed to security checks or metrics
- Test mocks used old includeCommitHistory field
- Test mocks called functions with wrong parameter counts
- Boolean expression returned non-boolean type

What changed:
Type signature updates:
- src/core/metrics/calculateMetrics.ts: updated gitLogResult parameter
  type from GitLogResult | undefined to GitLogResult | GitHistoryResult |
  undefined
- src/core/metrics/calculateGitLogMetrics.ts: same type update, added
  logic to extract content from either logContent (simple) or graph.graph
  (comprehensive)
- src/core/security/validateFileSafety.ts: same type update for
  gitLogResult parameter
- src/core/security/securityCheck.ts: same type update, added logic to
  check both logContent and graph.graph fields for security scanning

Union type handling:
- src/core/output/outputGenerate.ts:36: added !! boolean coercion to fix
  "boolean | undefined" assignment error
- src/core/metrics/calculateGitLogMetrics.ts:24-30: added type
  discrimination logic using 'logContent' in gitLogResult vs 'graph' in
  gitLogResult
- src/core/security/securityCheck.ts:50-64: same discrimination logic
  for security checks

Test fixes:
- tests/config/configSchema.test.ts: replaced includeCommitHistory with
  includeSummary (2 occurrences)
- tests/core/packager.test.ts:90-97: updated generateOutput() mock call
  from 7 to 6 parameters (removed extra undefined)
- tests/core/git/gitHistory.test.ts:314,334,354: added includeSummary
  parameter (false) to getCommitPatch() calls, replaced "metadata" test
  with "includeSummary" test
- tests/core/git/gitHistoryHandle.test.ts: deleted file (consolidation
  into gitLogHandle.ts completed)

Why:
The consolidated getGitLogs() function returns a union type to support
both simple logs and comprehensive history. All consuming functions must
handle both types correctly to avoid TypeScript compilation errors and
runtime failures. Tests needed updates to match new function signatures
and remove references to deleted functionality.

Files affected:
- src/core/metrics/calculateGitLogMetrics.ts: type update, union
  discrimination
- src/core/metrics/calculateMetrics.ts: type signature update
- src/core/output/outputGenerate.ts: boolean coercion fix
- src/core/security/securityCheck.ts: type update, union discrimination
- src/core/security/validateFileSafety.ts: type signature update
- tests/config/configSchema.test.ts: replaced includeCommitHistory
- tests/core/packager.test.ts: fixed parameter count
- tests/core/git/gitHistory.test.ts: added includeSummary parameter,
  updated test
- tests/core/git/gitHistoryHandle.test.ts: deleted obsolete file

Testable:
- npm run build (passes without TypeScript errors)
- npm test (all 883 tests pass across 97 test files)
- Verify union type handling: Git operations work with both simple and
  comprehensive modes
- Verify security checks: Both logContent and graph fields scanned
- Verify metrics: Token counts calculated for both result types
…ult into GitLogResult eliminating union type

Summary: Replace union type (GitLogResult | GitHistoryResult) with single GitLogResult interface using optional fields for simple/comprehensive modes, and add conditional checks to prevent git_logs/gitLogs output when comprehensive mode is active.

Previous behavior (from git diff --staged):
- getGitLogs() in gitLogHandle.ts:300 returned GitLogResult | GitHistoryResult union type
- createRenderContext() in outputGenerate.ts:33 used 'summary' in result checks for type discrimination
- generateParsableXmlOutput() line 119: git_logs block output when renderContext.gitLogEnabled (no check for comprehensive mode)
- generateParsableJsonOutput() line 210: gitLogs field output when renderContext.gitLogEnabled (no check for comprehensive mode)
- Result: empty <git_logs></git_logs> tag appeared alongside <git_history> in XML
- Result: gitLogs: undefined appeared alongside gitCommitHistory in JSON
- Tests expected old {date, message, files} structure instead of {metadata: {...}, patch} structure

What changed:
Type consolidation (src/core/git/gitLogHandle.ts):
- Line 56: Renamed GitHistoryResult interface to GitLogResult with optional fields
- Line 27-29: Made patch field optional in HistoryCommitResult (patch?: string)
- Line 56-66: GitLogResult structure: commits (required), graph/summary/logContent (optional)
- Lines 156-176: getSimpleGitLogs() converts {date, message, files} to {metadata: CommitMetadata, patch: undefined}
- Line 199: getComprehensiveGitHistory() return type changed from GitHistoryResult to GitLogResult
- Line 300: getGitLogs() return type changed from union to single GitLogResult | undefined

Conditional output logic (src/core/output/outputGenerate.ts):
- Line 8: Removed GitHistoryResult import, kept GitLogCommit and GitLogResult
- Lines 36-50: Added extractSimpleCommits() function to convert HistoryCommitResult[] to GitLogCommit[] for templates
- Line 53: Changed isComprehensiveHistory from config check to data check: !!(gitLogResult?.graph || gitLogResult?.summary)
- Lines 77-82: Access gitLogResult fields directly instead of separate gitHistoryResult parameter
- Line 119: Added && !renderContext.gitCommitHistoryEnabled to git_logs condition (prevents dual output in XML)
- Line 210: Added && !renderContext.gitCommitHistoryEnabled to gitLogs condition (prevents dual output in JSON)

Type signature updates (removed union type):
- src/core/output/outputGeneratorTypes.ts:13: gitLogResult from GitLogResult | GitHistoryResult | undefined to GitLogResult | undefined
- src/core/metrics/calculateMetrics.ts:29: gitLogResult parameter type
- src/core/metrics/calculateGitLogMetrics.ts:8-26: gitLogResult parameter, extract content from logContent || graph?.graph
- src/core/security/securityCheck.ts:10: gitLogResult parameter type
- src/core/security/validateFileSafety.ts:17: gitLogResult parameter type

Test structure updates:
- tests/core/git/gitLogHandle.test.ts:89-134: Changed 3 test expectations from {date, message, files} to {metadata: {hash, abbreviatedHash, parents, author: {name, email, date}, committer: {name, email, date}, message, body, files}, patch: undefined}
- tests/core/git/gitLogHandle.test.ts:3-9: Added import type GitLogResult on separate line (TypeScript best practice)
- tests/core/git/gitLogHandle.test.ts:84-239: Added missing deps (isGitRepository, getCommitGraph, getCommitPatch) to all getGitLogs test calls
- tests/core/output/outputGenerate.test.ts:67-92: Updated mock gitLogResult to use metadata wrapper structure
- tests/cli/actions/workers/defaultActionWorker.test.ts:62: Removed includeCommitHistory field (no longer exists)
- tests/cli/actions/workers/defaultActionWorker.test.ts:65: Added includeSummary field (required by schema)
- tests/core/git/gitHistory.test.ts:392: Added missing includeSummary parameter to getCommitPatch call

Why: Union types require type discrimination checks ('summary' in result) scattered across 9 files. Single interface with optional fields:
1. Removes all type discrimination logic from outputGenerate.ts, calculateGitLogMetrics.ts
2. Single function signature GitLogResult | undefined instead of GitLogResult | GitHistoryResult | undefined
3. Backward compatibility via optional logContent field for simple mode
4. Fixes XML/JSON template substitution bug where git_logs appeared empty alongside git_history
5. Data-driven mode detection (graph || summary present) instead of config flag check

Files affected:
- src/core/git/gitLogHandle.ts (102 insertions): Type consolidation, metadata wrapper conversion
- src/core/output/outputGenerate.ts (50 modifications): Removed type discrimination, added dual-output prevention
- src/core/output/outputGeneratorTypes.ts (10 modifications): Removed union type from interface
- src/core/metrics/calculateGitLogMetrics.ts (15 modifications): Extract content from unified type
- src/core/metrics/calculateMetrics.ts (4 modifications): Updated parameter type
- src/core/security/securityCheck.ts (8 modifications): Updated parameter type
- src/core/security/validateFileSafety.ts (4 modifications): Updated parameter type
- tests/core/git/gitLogHandle.test.ts (106 insertions): Metadata wrapper expectations, fixed deps, proper imports
- tests/core/output/outputGenerate.test.ts (22 insertions): Metadata wrapper mock data
- tests/cli/actions/workers/defaultActionWorker.test.ts (2 modifications): Fixed config schema compliance
- tests/core/git/gitHistory.test.ts (1 modification): Fixed getCommitPatch parameter count

Testable:
- Run: node bin/repomix.cjs --style xml --commit-range HEAD~3..HEAD --stat --parsable-style --output test.xml
  - Verify: grep "<git_history>" test.xml shows git_history block present
  - Verify: grep "<git_logs>" test.xml | wc -l returns 0 (no git_logs when comprehensive mode active)
- Run: node bin/repomix.cjs --style json --commit-range HEAD~3..HEAD --stat --output test.json
  - Verify: jq '.gitCommitHistory' test.json shows object with summary, commits
  - Verify: jq '.gitLogs' test.json shows null (not present when comprehensive mode active)
- Run: npm run lint
  - Verify: 0 errors, 0 warnings
- Run: npm test
  - Verify: all 883 tests pass
…CommitPatches default

**Summary**: Consolidates all git commit output into single git_logs block across XML/Markdown/JSON formats while maintaining backward compatibility, and fixes includeCommitPatches default that broke backward compat.

**Previous behavior**:
- XML/Markdown had separate <git_history> and <git_logs> blocks
- includeCommitPatches defaulted to true, forcing --include-logs to use graph path
- When --include-logs used alone, tried to fetch git log --graph which failed on repos with <50 commits
- Tests checked for "Git Commit History" heading in markdown
- JSON output included both logCommits and commits with empty metadata in backward compat mode

**What changed**:
- src/config/configSchema.ts:125: Change includeCommitPatches default from true to false
- src/core/git/gitLogHandle.ts:43-56: Update GitLogResult interface docs to describe additive optional fields
- src/core/git/gitLogHandle.ts:129-227: Remove getSimpleGitLogs/getComprehensiveGitLogs split, use single getGitLogs function
- src/core/output/outputGenerate.ts:36-76: Remove gitCommitHistoryEnabled field and hasGraphOrSummary variable
- src/core/output/outputGeneratorTypes.ts:37: Remove gitCommitHistoryEnabled field from RenderContext
- src/core/output/outputStyles/xmlStyle.ts:67-152: Consolidate git_history into git_logs block with additive optional fields
- src/core/output/outputStyles/markdownStyle.ts:64-150: Consolidate "Git Commit History" section into "Git Logs" section
- src/core/output/outputGenerate.ts:114-165,213-256: Consolidate parsable XML and JSON output to single gitLogs structure
- src/core/output/outputGenerate.ts:142,237: Add !renderContext.gitLogCommits condition to prevent outputting commits with empty metadata in backward compat mode
- tests/core/output/outputGenerate.test.ts:330,457: Add includeLogs: true to test configs
- tests/core/output/outputGenerate.test.ts:374: Update test expectation from "Git Commit History" to "# Git Logs"

**Why**: Consolidating into one naturally backward and forward compatible structure eliminates special case handling and makes output format cleaner. Fixing includeCommitPatches default ensures --include-logs alone uses backward compatible git log command, not git log --graph.

**Testable**:
- Backward compat: `repomix --include-logs --style xml` outputs only git_log_commit entries
- Full features: `repomix --include-logs --commit-range HEAD~1..HEAD --stat --graph --summary --style xml` outputs summary, commit_graph, and commits in git_logs block
- All 883 tests passing
- All linting passing (0 errors, 0 warnings)

**Files affected**:
- src/config/configSchema.ts: Fix includeCommitPatches default
- src/core/git/gitLogHandle.ts: Update docs, simplify function
- src/core/output/outputGenerate.ts: Remove mode flag, consolidate output
- src/core/output/outputGeneratorTypes.ts: Remove gitCommitHistoryEnabled field
- src/core/output/outputStyles/xmlStyle.ts: Consolidate into git_logs block
- src/core/output/outputStyles/markdownStyle.ts: Consolidate into Git Logs section
- tests/core/output/outputGenerate.test.ts: Update test configs and expectations
…le GitLogCommit structure

Summary: Eliminate duplicate commit data structures (logCommits vs commits) by enhancing GitLogCommit interface with progressive optional fields, following DRY principles while maintaining backward compatibility with main branch.

Previous behavior (based on git diff):
- GitLogResult had two separate arrays: logCommits (core fields) and commits (full metadata with HistoryCommitResult wrapper)
- Output generation used extractBasicCommits() to transform commits → logCommits
- Templates had conditional logic: render logCommits OR commits, never both
- Token counting used logContent string field
- Security checking used logContent string field

What changed:
- src/core/git/gitLogHandle.ts:
  * Removed HistoryCommitResult interface (lines 24-29)
  * Enhanced GitLogCommit interface with optional fields: hash, abbreviatedHash, author, committer, parents, body, patch (lines 58-97)
  * Updated GitLogResult to use only logCommits array, removed logContent and commits fields (lines 42-54)
  * Full features path populates all fields including extended metadata (lines 193-215)
  * Backward compat path returns only core fields (lines 236-240)

- src/core/output/outputGenerate.ts:
  * Removed extractBasicCommits() transformation function (lines 36-46)
  * Simplified createRenderContext to return only gitLogCommits (lines 55-62)
  * Consolidated XML output to single git_log_commit mapping with progressive optional fields (lines 117-145)
  * Consolidated JSON output to single logCommits array with progressive optional fields (lines 209-225)

- src/core/output/outputGeneratorTypes.ts:
  * Removed gitLogContent and gitCommitHistoryItems fields from RenderContext (lines 34-37)

- src/core/output/outputStyles/xmlStyle.ts:
  * Moved summary and commit_graph sections before commits for overview-first presentation (lines 98-143)
  * Removed separate gitCommitHistoryItems loop
  * Single gitLogCommits loop with conditional rendering of optional fields

- src/core/output/outputStyles/markdownStyle.ts:
  * Removed separate gitCommitHistoryItems loop (lines 100-138)
  * Single gitLogCommits loop with progressive disclosure of extended fields

- src/core/metrics/calculateGitLogMetrics.ts:
  * Changed from logContent string to JSON.stringify(logCommits) for token counting (lines 22-33)
  * Maintains graph content in token count calculation

- src/core/security/securityCheck.ts:
  * Changed from logContent string to JSON.stringify(logCommits) for security scanning (lines 49-56)

- tests/core/git/gitLogHandle.test.ts:
  * Updated expectations from commits array with metadata wrapper to logCommits with core fields only (lines 93-105)

- tests/core/metrics/calculateGitLogMetrics.test.ts:
  * Updated mock data from logContent string to logCommits array (multiple test cases)
  * Validators expect JSON.stringify(logCommits) for token counting

- tests/core/output/outputGenerate.test.ts:
  * Updated mock GitLogResult objects to use logCommits with flattened structure (lines 232-238, 331-343)
  * Changed XML assertions from commits['@_hash'] to git_log_commit.hash (lines 424-431)
  * Updated files format expectations to match plain-text rendering

Why:
- Violates DRY: Two arrays (logCommits, commits) representing same concept
- Unnecessary complexity: Conditional output logic to prevent rendering both
- Template duplication: Separate iteration loops for same data
- Data transformation overhead: extractBasicCommits() converting between formats
- Single source of truth: One canonical structure eliminates inconsistencies

Implementation approach:
- Progressive disclosure pattern: Core fields (date, message, files) always present, extended fields (hash, author, committer, parents, body, patch) optional
- Backward compatible: Old parsers ignore unknown optional fields per JSON/XML specs
- Forward compatible: Extended fields populate when graph/summary/patches enabled
- Additive evolution: Existing gitLogCommits field grows capabilities rather than being replaced

Files affected:
- src/core/git/gitLogHandle.ts: Enhanced GitLogCommit interface, removed HistoryCommitResult, updated GitLogResult
- src/core/output/outputGenerate.ts: Removed extractBasicCommits(), simplified render context
- src/core/output/outputGeneratorTypes.ts: Cleaned up RenderContext interface
- src/core/output/outputStyles/xmlStyle.ts: Unified template with progressive optional fields
- src/core/output/outputStyles/markdownStyle.ts: Unified template with progressive optional fields
- src/core/metrics/calculateGitLogMetrics.ts: JSON serialization for token counting
- src/core/security/securityCheck.ts: JSON serialization for security scanning
- tests/core/git/gitLogHandle.test.ts: Updated expectations for unified structure
- tests/core/metrics/calculateGitLogMetrics.test.ts: Updated mock data and assertions
- tests/core/output/outputGenerate.test.ts: Updated mock data and XML/JSON expectations

Testable outcomes:
- Run: npm run test → All 883 tests pass
- Run: repomix --include-logs --style xml → Outputs only core fields (date, message, files)
- Run: repomix --include-logs --commit-range HEAD~1..HEAD --graph --stat --summary --style xml → Outputs all extended fields (hash, author, committer, parents, body, patch) plus summary and graph sections
- Verify: XML/JSON output structure matches main branch baseline for backward compatibility
- Verify: Progressive disclosure works - optional fields only present when features enabled

Backward compatibility: Maintained with main branch - gitLogCommits field existed in main with same plain-text files format, core fields structure unchanged

Implementation note: Token counting and security scanning now use JSON.stringify(logCommits) instead of raw logContent string (removed field), providing consistent serialization for internal metrics
…patch flag mapping

Summary: Eliminate dual simple/enhanced code paths by implementing single git log execution that combines metadata, files, patches, and graph in one subprocess call using git's parameter stacking capability, and fix CLI bug where --stat/--patch flags failed to enable patch fetching.

Previous behavior (based on git diff):
- getGitLogs() had if/else branching (lines 299-362): simple path vs enhanced path
- Enhanced path called getCommitGraph() which looped calling git log -1 per commit for metadata (gitHistory.ts:229)
- Simple path called execGitLog() once for basic date|message + files
- CLI set commitPatchDetail when --stat/--patch specified but left includeCommitPatches as false
- Result: patches never fetched despite user requesting them via --stat/--patch flags

What changed:
- src/cli/actions/defaultAction.ts:330-333:
  * Change commitPatchDetail mapping from single field to object with includeCommitPatches: true
  * When user specifies --stat/--patch/--numstat/etc, both commitPatchDetail and includeCommitPatches are set

- src/core/git/gitCommand.ts:7,181-281:
  * Import PatchDetailLevel type
  * Add GitLogCompleteOptions interface (directory, range, maxCommits, includeGraph, patchDetail)
  * Add execGitLogComplete() function
  * Build git log args array conditionally: base format with metadata fields, add --stat/--patch/etc if patchDetail specified, add --graph --all if includeGraph true, add range or -n maxCommits
  * Use separators: \x1E (record separator) between commits, \x1F (field separator) between metadata fields, \x00 (null byte) before file list
  * Return raw git log stdout for parsing

- src/core/git/gitHistory.ts:368:
  * Export generateMermaidGraph() (was const, now export const for reuse)

- src/core/git/gitLogHandle.ts:4,8-11:
  * Import execGitLogComplete, GitLogCompleteOptions from gitCommand
  * Import generateMermaidGraph, getTags from gitHistory
  * Update deps parameter in getGitLogs() to use new functions

- src/core/git/gitLogHandle.ts:125-245:
  * Add ParsedCommitComplete interface with hash, abbreviatedHash, parents, author, committer, message, body, files, optional patch, optional graphPrefix
  * Add parseGitLogComplete() function
  * Split records on \x1E separator
  * Extract graph prefix lines (before first field separator) if hasGraph is true
  * Split metadata section from files/patch section on null byte
  * Parse metadata by splitting on field separator and stripping graph prefixes from each field
  * Split files and patch sections on blank lines (\n\n+)
  * Normalize line endings with split(/\r?\n/) to handle CRLF

- src/core/git/gitLogHandle.ts:297-397:
  * Remove entire if/else block (enhanced mode vs simple mode branching deleted)
  * Calculate needsEnhanced based on includeCommitGraph || includeCommitPatches || includeSummary
  * Call execGitLogComplete() once with conditional parameters (range if enhanced, maxCommits otherwise)
  * Call parseGitLogComplete() to extract all data from single output
  * Map to GitLogCommit array with core fields always present, extended fields only when needsEnhanced
  * Build CommitGraph from parsed data by reconstructing ASCII from graphPrefix, building metadata array, generating Mermaid
  * Build summary from parsed data (no separate git calls)

- tests/core/git/gitLogHandle.test.ts:67-355:
  * Replace getGitLog/getCommitGraph mocks with execGitLogComplete/getTags mocks
  * Build mock output using \x1E, \x1F, \x00 separators matching execGitLogComplete format
  * Update expected function calls to match GitLogCompleteOptions structure
  * Update all assertions to expect {logCommits, graph, summary} return structure
  * Add test data with \r\n line endings to verify CRLF handling

Why:
- Dual code paths violated DRY principle with separate implementations for simple vs enhanced
- Enhanced mode made multiple separate git subprocess calls instead of combining parameters
- Git supports combining --pretty + --name-only + --stat + --graph in single command
- Parsing interleaved output once is more efficient than multiple subprocess calls
- CLI bug prevented user-requested patches from appearing in output

Implementation approach:
- Conditional parameter building: start with base args, add flags based on config
- Intelligent parsing: use separators to reliably split commits, fields, files, patches
- Progressive disclosure: parse all data, conditionally include fields in GitLogCommit based on needsEnhanced
- Graph reconstruction: preserve graph prefix lines during parsing, rejoin for ASCII graph
- Single source of truth: one git call, one parse, multiple uses of parsed data

Files affected:
- src/cli/actions/defaultAction.ts: Fix CLI param mapping for patch flags
- src/core/git/gitCommand.ts: Add execGitLogComplete() with conditional arg building
- src/core/git/gitHistory.ts: Export generateMermaidGraph
- src/core/git/gitLogHandle.ts: Add parseGitLogComplete(), consolidate getGitLogs()
- tests/core/git/gitLogHandle.test.ts: Update mocks for consolidated API

Testable outcomes:
- Run: npm run test → All 883 tests pass
- Run: repomix --include-logs → Outputs only core fields (date, message, files)
- Run: repomix --include-logs --graph --stat → Outputs extended fields (hash, author, committer, parents) and patches
- Run: repomix --stat → Patches appear in output (CLI bug fixed)
- Verify: git log called once per execution instead of multiple times
- Verify: Progressive disclosure works - extended fields only when enhancement flags used

Performance: Consolidated multiple git subprocess calls into single git log invocation by using git's parameter stacking capability (--pretty + --name-only + --stat + --graph)
…th implementation

Summary: Update MCP and user documentation to accurately describe consolidated git logs implementation where all modes use single optimized code path with progressive field disclosure.

Previous behavior (documentation):
- configuration.md line 111 referenced removed includeCommitHistory flag
- configuration.md had incorrect default values for includeCommitGraph (true → false) and includeCommitPatches (true → false)
- llms-install.md documented includeCommitHistory instead of orthogonal flags (includeLogs, includeCommitGraph, includeSummary, includeCommitPatches)
- output.md showed old <git_history>/<commits> XML structure from previous implementation

What changed:
- llms-install.md:64-69:
  * Remove includeCommitHistory parameter documentation
  * Add includeLogs, includeCommitGraph, includeSummary, includeCommitPatches parameters
  * Update commitPatchDetail to list all format options: patch, stat, numstat, shortstat, dirstat, name-only, name-status, raw

- llms-install.md:114-119:
  * Same updates for pack_remote_repository tool

- website/client/src/en/guide/configuration.md:111-116:
  * Remove includeCommitHistory row from configuration table
  * Add includeSummary row
  * Correct defaults: includeCommitGraph false (was true), includeCommitPatches false (was true)
  * Update commitPatchDetail description with all format options

- website/client/src/en/guide/configuration.md:173-185:
  * Remove includeCommitHistory from example config
  * Add includeSummary with correct default false
  * Update all git config defaults to match implementation

- website/client/src/en/guide/configuration.md:349-372:
  * Replace "Commit History Analysis" section with "Commit History Enhancement"
  * Remove includeCommitHistory description
  * Document that enhancement flags (commitRange, includeCommitGraph, includeSummary, includeCommitPatches) provide structured metadata when combined with includeLogs
  * Update example config to use includeLogs + enhancement flags instead of includeCommitHistory

- website/client/src/en/guide/output.md:246-305:
  * Update XML structure from <git_history>/<commits> to <git_logs>/<git_log_commit>
  * Show summary and commit_graph elements with correct structure
  * Show git_log_commit elements with all fields (date, message, files, hash, abbreviated_hash, author, committer, parents, body, patch)
  * Files rendered as plain text (backward compatible with main branch)
  * Update heading from "Commit History Output" context

Why:
- Documentation must accurately reflect actual API and configuration schema
- Users need correct parameter names for MCP tools (pack_codebase, pack_remote_repository)
- Configuration examples must show valid flag combinations that match implementation
- Default values in docs must match configSchema.ts defaults
- XML structure examples must match actual template output

Files affected:
- llms-install.md: MCP tool parameters for both pack_codebase and pack_remote_repository
- website/client/src/en/guide/configuration.md: Config table, defaults, examples, and descriptions
- website/client/src/en/guide/output.md: XML structure example for git logs

Testable outcomes:
- Configuration table defaults match src/config/configSchema.ts default values
- Example configs use valid flag names (includeLogs, includeCommitGraph, includeSummary, includeCommitPatches)
- XML output structure matches src/core/output/outputStyles/xmlStyle.ts template
- MCP parameter names match src/mcp/tools/ implementation
… chars in commits

Previous behavior: Parser used ASCII control characters \x1E (Record Separator)
and \x1F (Unit Separator) as delimiters. These characters CAN appear in git
commit messages, breaking parsing when encountered.

What changed:
- gitCommand.ts: Replace execGitLogComplete with two-pass architecture
  - execGitLogStructured: Metadata + files via -z --raw (NUL-terminated)
  - execGitLogTextBlob: Patch/stat content with double-NUL separator
  - execGitGraph: Separate call avoids prefix interleaving
  - All delimiters now use NUL (\x00) which git rejects in commit content

- gitLogHandle.ts: Rewrite parser for robustness and performance
  - Incremental parsing by detecting 40-char hex hashes as commit boundaries
  - Verify commit boundary by checking abbreviated hash shares prefix
  - Handle filenames that look like git hashes (after raw entry lines)
  - Pre-compile regexes and add length checks for ~40% performance gain

- gitLogHandle.test.ts: Update test infrastructure
  - Use proper 40-char hex hashes in mocks
  - Add edge case test for hash-like filenames
  - Remove DOUBLE_NUL constant (parser no longer relies on it)

Why: Git rejects commits containing NUL bytes ("a NUL byte in commit log
message not allowed"), making NUL 100% safe as delimiter. ASCII control
characters \x1E/\x1F can appear in messages (rare but possible).

Files affected:
- src/core/git/gitCommand.ts: New two-pass git log functions
- src/core/git/gitLogHandle.ts: Rewritten parser with hash-based boundaries
- tests/core/git/gitLogHandle.test.ts: Updated mocks and added edge case test

Testable: npm run test (884 tests pass), parser handles commits with \x1E/\x1F
…tions'

Previous behavior: CLI and docs used "Enhancement Flags" and "Range Options"
as category names for git log related flags.

What changed: Renamed to "Output Verbosity & Graph Options" across all
documentation and source files:
- src/cli/cliRun.ts: .optionsGroup('Git Log Output Verbosity & Graph Options')
- src/cli/types.ts: comment updated to match
- README.md: section header updated
- website/client/src/en/guide/*: All English docs updated

Why: "Enhancement Flags" was vague and non-descriptive. "Output Verbosity &
Graph Options" clearly describes that these options control the level of
detail (verbosity) in git log output and graph visualization. The commit
range is a form of verbosity since it restricts the amount of output.

Files affected:
- src/cli/cliRun.ts:157-158 - CLI option group name
- src/cli/types.ts:42 - Type comment
- README.md:669 - Section header
- website/client/src/en/guide/command-line-options.md - Merged sections
- website/client/src/en/guide/configuration.md - Updated references
- website/client/src/en/guide/output.md - Updated references
- website/client/src/en/guide/tips/git-commit-history.md - Section header
- website/client/src/en/guide/usage.md - Section header
Previous behavior: All translation files had the Git Commit History Options
section in English only.

What changed: Properly translated the Git Commit History Options section
into each respective language:
- de (German): Git-Commit-Verlaufsoptionen
- es (Spanish): Opciones del Historial de Commits de Git
- fr (French): Options de l'Historique des Commits Git
- hi (Hindi): Git कमिट इतिहास विकल्प
- id (Indonesian): Opsi Riwayat Commit Git
- ja (Japanese): Gitコミット履歴オプション
- ko (Korean): Git 커밋 히스토리 옵션
- pt-br (Portuguese-BR): Opções de Histórico de Commits do Git
- vi (Vietnamese): Tùy chọn Lịch sử Commit Git
- zh-cn (Chinese Simplified): Git提交历史选项
- zh-tw (Chinese Traditional): Git提交歷史選項

Each translation includes:
- Section header translated to native language
- Introductory paragraph about orthogonal flags
- "Diff Format Flags" subheader with mutually exclusive note
- All 8 diff format option descriptions
- "Output Verbosity & Graph Options" subheader with combinable note
- All 3 verbosity/graph option descriptions

Why: Proper i18n requires content to be in the user's native language,
not just the section headers. Technical terms like git log flags remain
in English as they are command-line parameters.

Files affected:
- website/client/src/de/guide/command-line-options.md
- website/client/src/es/guide/command-line-options.md
- website/client/src/fr/guide/command-line-options.md
- website/client/src/hi/guide/command-line-options.md
- website/client/src/id/guide/command-line-options.md
- website/client/src/ja/guide/command-line-options.md
- website/client/src/ko/guide/command-line-options.md
- website/client/src/pt-br/guide/command-line-options.md
- website/client/src/vi/guide/command-line-options.md
- website/client/src/zh-cn/guide/command-line-options.md
- website/client/src/zh-tw/guide/command-line-options.md
…name-only'

Previous behavior: Documentation and TypeScript types claimed commitPatchDetail
defaulted to 'stat', but configSchema.ts:121 actually defaults to 'name-only'.
Additionally, GitLogTextBlobOptions.patchDetail union type was missing three
valid values ('name-only', 'name-status', 'raw'), and patchTypes array omitted
'raw', preventing commitPatchDetail: 'raw' from fetching patch content.

What changed:
- llms-install.md: Fix default from 'stat' to 'name-only' (2 occurrences)
- src/core/git/gitCommand.ts:208: Add 'name-only' | 'name-status' | 'raw' to
  GitLogTextBlobOptions.patchDetail union type
- src/core/git/gitLogHandle.ts:241: Add 'raw' to patchTypes array so
  commitPatchDetail: 'raw' triggers patch fetching
- src/core/git/gitLogHandle.ts:251-259: Update type cast to match expanded union
- website/client/src/en/guide/configuration.md: Fix default from 'stat' to
  'name-only' (3 occurrences: table, JSON example, prose)

Why: CodeRabbit review identified documentation/type mismatches with the actual
config schema. Users configuring commitPatchDetail: 'raw' would silently get no
patch output because 'raw' wasn't in the patchTypes check array.

Testable: npm run lint && npm test (884 tests pass)
@yamadashy yamadashy force-pushed the feat/git-commit-history-squashed branch from 6d34ebc to 414ab2d Compare November 29, 2025 15:08
@yamadashy
Copy link
Owner

yamadashy commented Nov 30, 2025

@ahundt
I've thought about the option design. The idea of mirroring git log options is great - it makes the CLI intuitive for users familiar with git.

Here are my thoughts:

Option naming

  • I'd prefer --git- prefix (e.g., --git-stat, --git-patch)
  • It may seem redundant since they're used with --include-logs, but for example, if we want to add other graph-related features in the future, --include-logs --graph could conflict
  • Adding the prefix now avoids namespace issues later

Design concerns

  • --patch fails with stdout maxBuffer length exceeded on this repository
  • includeLogsCount seems ignored when using --patch, --graph, etc.
  • Relationship between commitRange and includeLogsCount is unclear

Scope

  • Many options are added at once. Starting with a minimal set (e.g., --git-patch, --git-stat) might be easier to review and iterate on

What do you think?

@ahundt
Copy link
Author

ahundt commented Dec 8, 2025

I'm actually using all the params, they are helpful for inspecting and diagnosing good commits and bad commits in a messy history.

Also if it were instead set up as commands and/or ordered params the ambiguity would go away.

like how there is git rm, not git --rm; and then git rm can itself have params/flags, and those params/flags can also (potentially) work for git log, for example.

even if the --include-logs was kept, there could still be ordering to disambiguate. But I don't care that much if you want --git-patch, it is a bit redundant but not the end of the world it would get the job done.

@ahundt
Copy link
Author

ahundt commented Dec 17, 2025

Just following up!

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