Commit Graph

10 Commits

Author SHA1 Message Date
Kazuki Yamada fb281d4560 test(core): Wire createSecurityTaskRunner mock into smaller packager tests
Continuation of the perf(core) Pre-warm security worker pool change —
extends `mockDeps` / inline pack-test plumbing in the three smaller test
files so the default-scope path no longer attempts to spawn a real
worker pool from the test environment.

- tests/core/packager/diffsFunctionality.test.ts: adds
  `mockCreateSecurityTaskRunner` to both pack-call sites.
- tests/core/packager/splitOutput.test.ts: same — adds the stub to the
  inline mock deps.
- tests/core/security/validateFileSafety.test.ts: updates the
  `runSecurityCheck` call assertion to include the new
  `{ taskRunner: undefined }` deps argument forwarded by
  `validateFileSafety` when no pre-warmed runner is provided.

(See PR description / parent commit for the full perf change rationale,
benchmark numbers, and correctness notes.)
2026-05-09 02:30:26 +09:00
Kazuki Yamada f67731056a test: Round-3 PR review feedback
- validateFileSafety: pin the negative path of `if (config.security.enableSecurityCheck)`
  — every other test enabled the check, so a regression that always runs
  the security check would have passed silently.
- unifiedWorker:
  - Add a positive workerData=securityCheck + ambiguous-task case so the
    pair (override + this) distinguishes "inference always wins" from
    "inference wins only when it yields a value".
  - Stop pretending the handler-cache test verifies caching. Both branches
    of `if (cached) return cached;` end with the same Map.set, and Node's
    own module cache makes the dynamic import effectively free, so the
    cache is unobservable from outside without exposing internals.
    Renamed to "repeated calls" with a comment explaining the limitation.
- fileSystemReadDirectoryTool: translate the pre-existing Japanese comment
  to English per CLAUDE.md.
- TokenCounter: extract `LoadEncodingFn` type alias instead of the
  unusual `typeof loadEncoding`, so a signature drift between the local
  function and the deps field would surface at the type level.
2026-04-26 22:47:21 +09:00
Kazuki Yamada cbdfc29b4d test: Cover error/edge paths in core (output, file, security, treeSitter)
Lift the four most impactful uncovered files past 90% lines without
introducing fragile or contrived tests. Each block targets real
user-facing branches (error handling, optional features, init/dispose).

- core/output/outputGenerate (78% -> ~90%):
  - buildOutputGeneratorContext: instructionFilePath success and missing-file
    paths; pre-computed vs. searchFiles fallback for empty directories;
    full-tree mode (success and listing failure); searchFiles failure wrap.
  - generateOutput: unsupported style throws RepomixError.

- core/security/validateFileSafety (79% -> ~95%):
  - logSuspiciousContentWarning loop: header line per section, plus
    singular ("issue") and plural ("issues") suffix per result.
  - No-op behavior when no suspicious git diff/log entries exist.

- core/file/fileSearch (88% -> ~92%):
  - handleGlobbyError: EPERM and EACCES translated to PermissionError;
    other error codes pass through.
  - Outer catch: generic Error wrapped with directory context;
    non-Error throw produces the generic fallback message.

- core/treeSitter/languageParser (74% -> ~88%):
  - getResources before init() throws RepomixError.
  - init() is idempotent (Parser.init is called only once across two calls).
  - Parser.init() failure is wrapped as RepomixError.
  - dispose() resets state so subsequent calls require re-init.

Coverage:
- Statements 89.51% -> 90.23%
- Branches   79.31% -> 80.26%
- Functions  89.37% -> 89.69%
- Lines      90.06% -> 90.80%
2026-04-26 19:35:00 +09:00
Kazuki Yamada 5b5ee862a0 feat(cli): Add --include-logs option for git commit history
This feature allows users to include git log information in the output to help AI understand development patterns and file change relationships.

Key changes:
- Added --include-logs and --include-logs-count CLI options
- Default to 50 commits, configurable via CLI and config file
- Includes commit date, message, and changed file paths (excludes commit hashes)
- Added security checks and metrics calculation for git logs
- Updated output templates to include git logs section
- Comprehensive test coverage and TypeScript fixes

Resolves user request for including git commit history to provide development context for AI analysis.
2025-08-22 14:09:58 +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 265845a9c0 fix(gitDiff): Fix syntax and tests 2025-05-10 11:26:05 +09:00
Kazuki Yamada ebacdd967c feat(pack): Simplify the process and make it testable with DI 2025-01-25 12:43:38 +09:00
Mike Judge 33d9c14650 Fixes from linter 2024-12-24 17:42:55 -08:00
Mike Judge e57aea8940 Split up validateFileSafety into smaller functions that each do one thing 2024-12-24 16:11:10 -08:00
Mike Judge ce136f3397 Move validateFileSafety into the security folder 2024-12-24 13:58:40 -08:00