- Move makeChunkConfig and renderGroups to module level for better readability
- Add GenerateOutputFn type alias using typeof generateOutput
- Add comment explaining O(N²) complexity and why it's acceptable
- Fix test mock property names to match actual GitDiffResult/GitLogResult types
- Update integration tests to use produceOutput instead of individual functions
Move split/single output generation and writing logic to
packager/produceOutput.ts to keep packager.ts focused
on the high-level orchestration flow.
- Create produceOutput module handling both output modes
- Simplify packager.ts from 227 to 181 lines
- Update related tests to use new dependency structure
- Add test for sizeParse overflow case
- Use RepomixProgressCallback type in outputSplit.ts for consistency
- Improve configuration.md description for splitOutput option
Adds a size-based output splitter via --split-output (kb/mb) and writes numbered parts without splitting within a top-level folder.
Also updates metrics aggregation for multi-part output and adds unit tests.
Replace the original strip-comments package with @repomix/strip-comments,
which provides enhanced support for:
- Go directives (//go:build, //go:generate, etc.)
- C++ document comments (///)
- Python docstrings (""" and ''') and hash comments
This removes the custom GoManipulator, PythonManipulator, and CppManipulator
implementations in favor of the improved library support.
Note: preserveNewlines option keeps newlines for line number preservation,
so docstrings are replaced with empty lines rather than being fully removed.
Add comprehensive tests to increase code coverage from 89.81% to 90.28%:
writeSkillOutput.ts (63.88% → 100%):
- Add test for techStack file writing
- Add tests for EPERM/EACCES error handling
- Add test for generic error handling
- Add test for non-Error object handling
fileSystemReadFileTool.ts (62.5% → 100%):
- Add test for directory path error
- Add test for successful file reading
- Add test for security check failure
- Add test for general errors during file reading
- Add test for non-Error object handling
- Use TextDecoder('utf-8', { fatal: true }) to distinguish actual decode
errors from legitimate U+FFFD characters in UTF-8 files
- Change test temp directory from tests/fixtures to os.tmpdir() to avoid
clobbering committed fixtures and reduce parallel-run collisions
- Non-UTF-8 files still use iconv.decode() fallback behavior
Addresses CodeRabbit review comments on PR #1007
Remove the confidence < 0.2 check that was causing valid UTF-8/ASCII files
to be incorrectly skipped. Files are now only skipped if they contain actual
decode errors (U+FFFD replacement characters).
This fixes issues where:
- Valid Python files were skipped with confidence=0.00 (#869)
- HTML files with Thymeleaf syntax (~{}) were incorrectly detected as binary (#847)
The isbinaryfile library (added in PR #1006) now handles binary detection more
accurately, making the confidence-based heuristic unnecessary.
Fixes#869
- Fix extractRepoName to handle trailing slashes, query strings, and
fragments in URLs (e.g., https://github.com/user/repo/ now works)
- Extract toTitleCase helper function to reduce code duplication
- Use projectName instead of sourceUrl for link text in SKILL.md footer
(displays as "from [Vite](https://...)" instead of full URL twice)
- Add tests for URL edge cases (trailing slash, query, fragment)
Add unit tests for the copySkillOutputToCurrentDirectory function:
- Copy .claude/skills directory when it exists
- Skip copy when directory does not exist
- Handle EPERM and EACCES permission errors
- Handle generic errors
- Fix project name generation to use repository name from URL instead of
temp directory name (e.g., "Vite" instead of "Repomix HPkbgH")
- Add source URL to SKILL.md footer for remote repositories only
(local repos don't include URL to avoid exposing personal paths)
- Copy only .claude/skills/ directory to prevent conflicts with
repository's own .claude config (commands, agents, etc.)
Example SKILL.md footer:
- Remote: "This skill was generated by Repomix from [https://github.com/...]"
- Local: "This skill was generated by Repomix"
- Replace process.exit() with OperationCancelledError in skillPrompts.ts
- Centralize Handlebars helper registration in outputStyleUtils.ts
- Add path normalization validation in generateSkillTool.ts
- Set idempotentHint to true for generate_skill MCP tool
- Add skillGenerate config merge tests in configLoad.test.ts
- Add path normalization test in generateSkillTool.test.ts
Reorganize skill generation code for better domain separation:
- Move files from core/output/skill/ to core/skill/ (5 files)
- Move writeSkillOutput.ts from core/packager/ to core/skill/
- Create packSkill.ts to encapsulate skill generation logic
- Simplify packager.ts by delegating skill generation to packSkill()
- Add re-exports in outputGenerate.ts for backward compatibility
This change improves code organization by:
- Separating skill domain from output domain
- Reducing packager.ts complexity
- Centralizing all skill-related code in one location
Instead of creating separate variables and passing them through the task,
directly update cliOptions.skillName and cliOptions.skillDir. This simplifies
the code flow and removes redundant fields from DefaultActionTask interface.
Remove generateGitDiffsSection and generateGitLogsSection functions
and their tests as they are no longer used in the skill generation flow.
These became dead code after removing git diffs/logs from skill output.
- Show all dependencies without truncation (removed 20/10 limits)
- Add runtime version detection (.node-version, .nvmrc, .tool-versions, etc.)
- Add configuration files section to tech-stack.md
- Move statistics section from SKILL.md to summary.md
- Update summary.md to use multi-file format language
- Increase largest files display from 5 to 10
- Improve generate_skill MCP tool description with skill types and paths
Remove remoteUrl from config schema and pass pre-computed skillName
through CLI options instead. This provides cleaner separation between
configuration and runtime data.
- Add generateDefaultSkillNameFromUrl() for remote repository names
- Update generateDefaultSkillName() to only handle local directories
- Pass skillName through DefaultActionTask to packager
Add new features to improve skill output for understanding codebases:
- Add tech-stack.md: Auto-detect languages, frameworks, and dependencies
from package.json, requirements.txt, go.mod, Cargo.toml, etc.
- Add file statistics section to SKILL.md with language breakdown
and largest files list
- Rename structure.md to project-structure.md for clarity
- Add total lines count to SKILL.md header
Add Overview, Common Use Cases, and Tips sections to make the template
more actionable and instantly understandable. Remove redundant File Format
section (delegated to summary.md).
Changes:
- Add Overview section explaining when to use this skill
- Add Common Use Cases with concrete scenarios (understand feature, debug, find usages)
- Add Tips section for effective usage
- Remove File Format section to reduce redundancy
Restructure SKILL.md to be more practical and scannable:
- Add reference files table with descriptions
- Include Quick Reference section with concrete examples
- Show exact grep patterns for finding files
- Display file format examples for understanding structure
- Move statistics inline with header for brevity
Skill output is designed for referencing external codebases (e.g., GitHub
repositories) as persistent skills. Git diffs (uncommitted changes) and
git logs (commit history) are not meaningful in this context since:
- Remote repositories have no uncommitted changes
- Commit history is less relevant for reference skills
This simplifies the skill output to include only:
- SKILL.md
- references/summary.md
- references/structure.md
- references/files.md
Display the number of lines next to each file in the directory
structure section of skill output. This helps when using grep
to find specific files by line count.
Example:
src/
index.ts (42 lines)
utils.ts (128 lines)
When the skill directory is under the current working directory,
show a relative path (e.g., .claude/skills/my-skill) instead of
an absolute path for better readability.
When Personal Skills location is selected, the summary was showing
a relative path (.claude/skills/) instead of the actual path
(~/.claude/skills/). Now passes the computed skillDir to reportResults.
Add @clack/prompts-based selection for skill output location:
- Personal Skills (~/.claude/skills/) - default, available across all projects
- Project Skills (.claude/skills/) - shared with team via git
Features:
- Interactive prompt to choose skill location
- Overwrite confirmation when skill directory already exists
- Works with both local and remote repositories
Refactor and improve the skill generation feature based on code review:
- Split generateSkillOutput into generateSkillReferences and
generateSkillMdFromReferences to avoid double generation
- Add try-catch error handling to writeSkillOutput with proper
permission error messages
- Add unit tests for skillSectionGenerators (12 tests)
- Add validation tests for --skill-generate flag combinations
- Update createMockConfig to support skillGenerate and remoteUrl
Improve the Claude Agent Skills generation feature:
- Rename CLI option from --generate-skill to --skill-generate [name]
- Make skill name optional with auto-generation (repomix-reference-<folder>)
- Split skill output into multiple reference files:
- summary.md: Purpose, format description, and notes
- structure.md: Directory tree view
- files.md: Complete file contents
- git-diffs.md: Uncommitted changes (optional)
- git-logs.md: Recent commit history (optional)
- Move skill-related code to src/core/output/skill/ folder
- Extract shared language mapping to outputStyleUtils.ts
- Add 100+ language mappings for syntax highlighting
Implement Claude Agent Skills format output support for Repomix.
This feature was requested in issue #952 to enable seamless integration
with Claude Code's skill system.
New CLI option:
repomix --generate-skill <name>
Output structure:
.claude/skills/<name>/
├── SKILL.md # Entry point with YAML frontmatter
└── references/
└── codebase.md # Packed codebase in Markdown format
Features:
- Skill name auto-converts to kebab-case (max 64 chars)
- SKILL.md includes usage guidance for reading the codebase
- Incompatible with --stdout and --copy options
- MCP tool `generate_skill` for programmatic access
New files:
- src/core/output/skillUtils.ts
- src/core/output/outputStyles/skillStyle.ts
- src/core/packager/writeSkillOutput.ts
- src/mcp/tools/generateSkillTool.ts
Closes#952
The @modelcontextprotocol/sdk package updated CallToolResult.content
to a union type (text | image | audio | ...). Added proper type
assertions to access the text property in packCodebaseTool tests.
Created BaseParseStrategy abstract class to reduce code duplication:
- Common helper methods (getCaptureTypes, checkAndAddToProcessed, validateLineExists)
- Shared ParseResult type and CommonCaptureTypes constants
- All strategies (Default, TypeScript, Python, Go, CSS, Vue) now extend base class
Unified language configuration in languageConfig.ts:
- Consolidated ext2Lang.ts and lang2Query.ts functionality
- Single source of truth for language settings (extensions, queries, strategies)
- Efficient Map-based lookup system for better performance
- Removed switch statement in createParseStrategy()
Updated all Strategy classes to extend BaseParseStrategy:
- Eliminated ~200 lines of duplicate code
- Improved maintainability and extensibility
- Easier to add new languages (single configuration change)
This refactoring was motivated by the need to reduce code duplication across
language-specific strategies and simplify the process of adding new language
support. The previous implementation had language configurations scattered
across multiple files, making it difficult to maintain and extend.
Fixed a critical functional bug where multiple subscripts with the same
parameter name (e.g., 'key') would create identifier collisions in the parsed
output, making them indistinguishable.
The fix changes the subscript capture pattern from capturing the parameter
name to capturing the entire subscript_declaration node with @name.definition.method
tags. This ensures each subscript is uniquely identified by its full signature
(e.g., "subscript(key: String) -> Value?") rather than just the parameter name.
Added comprehensive test cases:
- Swift protocol/class with multiple subscripts to validate the fix
- C# mixed inheritance (base class + multiple interfaces) for better coverage
All 869 tests pass with this change.
Enhanced test coverage and documentation based on code review feedback:
1. C# Multiple Interface Test Enhancement:
- Added explicit assertions for interface names (IDisposable, IComparable,
ICloneable) to verify base_list pattern correctly captures all interfaces
- This validates the query pattern handles comma-separated interfaces
2. Swift Subscript Documentation:
- Added comments documenting the current subscript parameter naming behavior
- Notes that parameter names (e.g., "key") are captured rather than subscript
signatures, which may cause non-unique identifiers
- Marked as future improvement consideration for semantic accuracy
Note: Static protocol method verification was already present in the test
expectations (line 244), so no changes needed there.
These changes address non-blocking suggestions from PR review to improve
test coverage and code documentation.
Added comprehensive test case to verify that the base_list query pattern
correctly handles comma-separated multiple interface implementations.
The test validates parsing of a class implementing IDisposable, IComparable,
and ICloneable interfaces, ensuring all methods are correctly captured.
This test was suggested in PR review feedback to strengthen test coverage
for the base_list query pattern.
After updating @repomix/tree-sitter-wasms to 0.1.15, we reviewed all
language query files against their official tree-sitter tags.scm files.
This revealed that Swift queries were missing protocol method definitions
(protocol_function_declaration, subscript_declaration, init_declaration
within protocol_body).
This commit adds the missing patterns and comprehensive test coverage
for protocol methods to ensure Swift protocol definitions are properly
parsed and included in the output.
Update tree-sitter-wasms package to version 0.1.15 to get latest language
grammar updates. Updated C# query patterns to match the new tree-sitter-c_sharp
grammar structure based on official tags.scm.
Changes:
- Update @repomix/tree-sitter-wasms from 0.1.14 to 0.1.15
- Fix C# query patterns for compatibility with new grammar:
- Remove field specifiers from base_list patterns
- Add type_parameter_constraints_clause pattern
- Add type_parameter_constraint pattern (correct node name)
- Restore type: field for object_creation_expression and variable_declaration
- Add comprehensive C# test cases for inheritance, interfaces, generics, etc.
All patterns now follow the official tree-sitter-c-sharp tags.scm specification.
Fix TS18048 errors in createBaseGlobbyOptions consistency tests by adding
expect(options).toBeDefined() and if (!options) continue guards. This ensures
type safety and prevents undefined access to globby call options.
All three tests now properly guard against potentially undefined options:
- should use consistent base options across all globby calls
- should respect gitignore config consistently across all functions
- should apply custom ignore patterns consistently across all functions
This addresses the coderabbitai feedback on PR #964.
This commit addresses three suggestions from AI code review bots on PR #964:
1. Remove unnecessary array spreads in createBaseGlobbyOptions
- Removed defensive copying of ignorePatterns and ignoreFilePatterns
- Arrays are already created fresh in calling functions, making spreads redundant
- Minor performance optimization by avoiding unnecessary array allocations
2. Extract prepareIgnoreContext helper function
- Centralized duplicate ignore pattern preparation logic
- Eliminated code duplication across searchFiles, listDirectories, and listFiles
- The new helper handles:
* Getting ignore patterns and ignore file patterns
* Normalizing patterns for consistent trailing slash handling
* Git worktree special case handling
- Improves maintainability and ensures consistency across all globby calls
3. Add explanatory comment to v16 behavior test
- Documented why v16's behavior is superior (matches Git's standard behavior)
- Clarifies that v16 respects parent directory .gitignore files
- Helps future maintainers understand the intentional breaking change
All 856 tests pass with no regressions.
- Add test for parent directory .gitignore pattern handling (v16 behavior)
- Add tests for createBaseGlobbyOptions consistency across all functions
- Verify gitignore option is passed correctly to all globby calls
- Ensure no regression from v15 to v16 upgrade
These tests prove that:
1. Parent .gitignore files are respected with globby v16
2. All 4 globby calls (searchFiles files/dirs, listDirectories, listFiles)
use consistent base options
3. gitignore configuration is applied uniformly across all functions
All 856 tests pass, confirming no regression from the changes.
- Upgrade globby from v15 to v16
- Use gitignore option to respect parent directory .gitignore files
- This matches Git's standard behavior where parent .gitignore patterns apply to subdirectories
- Move .gitignore handling from ignoreFiles to gitignore option
- Update tests to reflect the new behavior
This change improves compatibility with Git and provides more accurate file filtering when running Repomix in subdirectories.