240 Commits

Author SHA1 Message Date
Kazuki Yamada
a8f4301587 fix(cli): Use actual total tokens for percentage calculation in top files
User identified percentage calculation issue:
- User noticed percentage was calculated against partial token sum (only top candidates)
- User requested using actual total tokens from entire output instead
- Assistant updated printTopFiles to accept totalTokens parameter
- Now uses packResult.totalTokens for accurate percentage calculation
- Fixed all function calls and tests to include the new parameter
- Percentages now reflect actual proportion of each file to total output

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 18:19:38 +09:00
Kazuki Yamada
f1d11d9fae perf(metrics): Optimize token counting for top files display
- Add character-based pre-filtering to reduce token calculation overhead
- Implement calculateSelectiveFileMetrics for targeted token counting
- Only calculate tokens for top candidates (5x display count) instead of all files
- Maintain accurate token-based ranking while improving performance for large codebases
- Update tests to cover new selective calculation functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-08 17:33:25 +09:00
sakamossan
97d550e946 add test 2025-06-05 23:44:33 +09:00
sakamossan
9091bf0a9b feat(cli): Set exit code when repomix fails 2025-06-05 23:44:33 +09:00
Kazuki Yamada
9494381bbc fix(core): Address PR feedback on error handling and test optimization
- Preserve original error stack traces when rethrowing errors

- Add specific error messages for unknown error codes

- Remove redundant mock configurations in tests that duplicate beforeEach setup

- Keep only necessary mocks that differ from default behavior

- Improve code maintainability and test clarity
2025-06-01 01:10:48 +09:00
Kazuki Yamada
1580f7dfce fix(core): Add proper file vs directory validation in searchFiles
- Add fs.stat check to validate path exists and is a directory before permission check

- Throw clear error message when file path is provided instead of directory path

- Prevents ENOTDIR errors when fs.readdir is called on file paths

- Add comprehensive test cases for path validation scenarios

- Fixes issues where shell glob expansion passes file paths to directory processing
2025-05-31 23:31:47 +09:00
Kazuki Yamada
d99c6425f8 test(config): Add test case for config file not found error - Add test for RepomixError when argConfigPath is provided but file doesn't exist - Improve test coverage for error handling in configLoad.ts - Address code review feedback from @coderabbitai 2025-05-31 21:14:09 +09:00
claude[bot]
99e093d056 feat(config): Add support for .jsonc extension with priority order
- Add support for .jsonc config files alongside existing .json5 and .json
- Implement priority order: repomix.config.json5 → repomix.config.jsonc → repomix.config.json
- Update config file discovery for both local and global configurations
- Add comprehensive tests for JSONC support and priority ordering
- JSON5 parser already supports JSONC format (JSON with comments)

Fixes #618

Co-authored-by: yamadashy <yamadashy@users.noreply.github.com>
2025-05-31 11:53:02 +00:00
Kazuki Yamada
9f6aa1ad10 refactor(mcp): Introduce buildMcpToolSuccessResponse and buildMcpToolErrorResponse for consistent response handling 2025-05-25 16:51:09 +09:00
Kazuki Yamada
e8a85dbfe7 fix(mcp): Validate startLine and endLine inputs to prevent logical errors 2025-05-25 15:03:15 +09:00
Kazuki Yamada
7c2bac6d30 test(security): Update logger mock to use repomixLogLevels and clean up expectations 2025-05-25 14:45:59 +09:00
Kazuki Yamada
e67d0bf384 test(security): Add tests for runSecurityCheck with Git diff processing 2025-05-25 12:18:58 +09:00
Kazuki Yamada
03fa4ce584 refactor(mcp): Improve descriptions for Tree-sitter compression and grep options 2025-05-25 12:18:58 +09:00
Kazuki Yamada
712b982e00 feat(mcp): Add processedFiles and safeFilePaths to PackResult and update related interfaces 2025-05-25 12:18:58 +09:00
Kazuki Yamada
97921af088 test(mcp): Add tests for multilingual and Unicode search functionality 2025-05-25 12:18:58 +09:00
Kazuki Yamada
e62ce0caed refactor(mcp): Enhance tool descriptions for clarity and detail 2025-05-25 12:18:58 +09:00
Kazuki Yamada
2fce4b49c5 feat(mcp): Implement grep-like search functionality with context formatting 2025-05-25 12:18:58 +09:00
Devin AI
dcc2f10395 feat(mcp): enhance MCP tools with line specification and grep functionality
- Add line number specification (startLine, endLine) to read_repomix_output
- Add new grep_repomix_output tool for searching output content
- Include total line count in pack_codebase and pack_remote_repository results
- Add comprehensive tests for new functionality

Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-25 12:18:58 +09:00
Kazuki Yamada
fecebc2ca6 refactor(core): Update GitDiffResult imports and restructure git handling modules 2025-05-24 14:14:26 +09:00
Kazuki Yamada
b13a21aebd refactor(core): Migrate GitDiffResult and related functions to gitHandle module 2025-05-24 13:59:32 +09:00
Kazuki Yamada
9f4d1bc462 refactor(core): Rename getRemoteRefs to execLsRemote and update implementation 2025-05-24 13:51:15 +09:00
Kazuki Yamada
0be489dcbb refactor(core): Update git command imports and restructure gitHandle module 2025-05-24 13:37:57 +09:00
Kazuki Yamada
081732f112 refactor(core): Rename getFileChangeCount to execGitLogFilenames and update return type 2025-05-24 13:24:43 +09:00
Devin AI
58495bc584 style: Fix formatting in gitCommand.test.ts
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-24 02:40:50 +00:00
Devin AI
3dda598def refactor: Improve error message for invalid URL protocol
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-24 02:37:26 +00:00
Devin AI
9c4e77333f style: Fix linting issues in gitCommand.test.ts
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-24 11:34:56 +09:00
Devin AI
2f4f84209d fix(core): Throw errors for invalid URLs in getRemoteRefs function
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-24 11:34:56 +09:00
Kazuki Yamada
8f9b307ffa refactor(core/git): Improve parseRemoteValue function formatting and add test for getRemoteRefs 2025-05-24 11:34:56 +09:00
Devin AI
9a7409f41c fix(core): Fix command injection vulnerability in git clone
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-19 15:51:51 +00:00
Kazuki Yamada
9538395cdf refactor(core): Move Git-related modules to dedicated core/git directory 2025-05-19 14:53:28 +00:00
Kazuki Yamada
ce3d025e23 fix(output): Update numbering for multiple file entries in output formats 2025-05-17 16:44:10 +09:00
Kazuki Yamada
5e8ff25335 feat(output): Ensure consistent order of sections (Summary, UserProvidedHeader, Directory Structure) across all output styles 2025-05-17 16:22:22 +09:00
Josh Wand
1862005828 feat: --no-file-summary now also suppresses generationHeader; doesn't suppress headerText (fixes #554) 2025-05-15 16:31:50 +00:00
Devin AI
48ec00c63a - Replace hardcoded config objects with createMockConfig utility
- Add proper typing to mock objects and functions
- Remove unnecessary type casting
- Add GitDiffResult type to git diff objects

Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-13 22:55:50 +09:00
Devin AI
8ebb7c1c86 Replace type assertions with createMockConfig in treeSitter test files and fix outputSort test
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-12 14:36:55 +00:00
Devin AI
7b81a2660f Replace type assertions with createMockConfig in outputSort.test.ts
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-12 14:33:23 +00:00
Devin AI
59b1bfe70d Remove unnecessary unknown type casting in processConcurrency.test.ts
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-12 14:32:02 +00:00
Devin AI
6b5af52c26 Fix lint errors in test files
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-11 14:14:52 +00:00
Devin AI
e126b15ba9 Add tests to improve coverage for MCP tools and prompts
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-11 14:06:14 +00:00
Devin AI
2161dbc1c8 feat(mcp): Add support for MCP tool annotations
Co-Authored-By: Kazuki Yamada <koukun0120@gmail.com>
2025-05-10 19:50:50 +09:00
Kazuki Yamada
5617f9de64 test(cli): Remove stdout mode test for piped input 2025-05-10 16:33:09 +09:00
Kazuki Yamada
95f7092b94 feat(cli): add --stdout option for output to stdout instead of file, enhancing CLI flexibility
- Introduced `--stdout` flag to allow output to standard output, which cannot be used with the `--output` option.
- Updated CLI configuration to handle `stdout` mode.
- Enhanced documentation with examples for using `--stdout`.
- Added tests to ensure correct behavior when using `--stdout` in various scenarios.
2025-05-10 16:33:09 +09:00
Kazuki Yamada
1e7a09c4c7 refactor(security): Enhance security check structure by introducing SecurityCheckType and updating file path handling 2025-05-10 16:12:00 +09:00
Kazuki Yamada
db0f7de668 refactor(core): Simplify getWorkTreeDiff and consolidate diff handling 2025-05-10 13:43:27 +09:00
Kazuki Yamada
265845a9c0 fix(gitDiff): Fix syntax and tests 2025-05-10 11:26:05 +09:00
Kazuki Yamada
464ccc582b feat(diff): Refactor CLI and output generation to support git diffs
- Updated CLI options to use `--include-diffs` instead of `--diffs`.
- Refactored `printSummary` to accept a `PackResult` object for better data handling.
- Introduced `getStagedDiff` function to retrieve staged changes from git.
- Created `getGitDiffs` function to encapsulate logic for fetching both worktree and staged diffs.
- Modified output generation functions to include git diffs in various formats (markdown, XML, plain text).
- Updated tests to reflect changes in CLI options and output generation logic, ensuring proper handling of git diffs.
- Removed deprecated `diffContent` from config schema and adjusted related logic.
2025-05-07 00:25:23 +09:00
pmdyy
412a94b9d9 fix(output): fix lints 2025-05-06 00:08:51 -06:00
pmdyy
cdfa93c594 feat(output): Add git diff support with --diffs flag 2025-05-05 23:57:05 -06:00
Riqwan Thamir
2c4e026df3 feat(core): Make it easier to pick & override pack's deps + core export 2025-04-21 15:58:26 +02:00
Kazuki Yamada
53ae395280 test(cli): Fix logger mock path in clipboard test 2025-04-20 18:38:05 +09:00