Skip to content

fix(config): Revert config file from TypeScript to JSON format#905

Merged
yamadashy merged 2 commits intomainfrom
fix/js-config
Oct 19, 2025
Merged

fix(config): Revert config file from TypeScript to JSON format#905
yamadashy merged 2 commits intomainfrom
fix/js-config

Conversation

@yamadashy
Copy link
Owner

Summary

This PR reverts the repository's config file from TypeScript (repomix.config.ts) to JSON (repomix.config.json) format to address issue #899.

Problem

When running repomix against its own repository without installing dependencies (npm install), the TypeScript config file fails with:

Error loading config from /tmp/repomix/repomix.config.ts: Cannot find module 'picocolors'

This happens because:

  • The TypeScript config imports modules (defineConfig, picocolors, etc.)
  • These imports require runtime module resolution
  • Without npm install, dependencies are not available

Solution

Switch to JSON format configuration which:

  • Requires no dependencies or module resolution
  • Works immediately after git clone without npm install
  • Is more stable and universal
  • Maintains all the same configuration options

Checklist

  • Run npm run test
  • Run npm run lint

Closes #899

This change addresses issue #899 where running repomix against its own
repository fails when dependencies are not installed. The TypeScript
config file required runtime module resolution (including dependencies
like picocolors), which caused errors in fresh clones without npm install.

The JSON format:
- Requires no dependencies or module resolution
- Is more stable and universal
- Works immediately after git clone without npm install
- Maintains all the same configuration options

Closes #899
Copilot AI review requested due to automatic review settings October 19, 2025 13:10
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 19, 2025

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

The PR replaces the TypeScript configuration file (repomix.config.ts) with a static JSON configuration (repomix.config.json) and introduces a corresponding JSON schema (website/client/src/public/schemas/1.8.0/schema.json). This change eliminates a module-loading issue where the TypeScript config imports local dependencies.

Changes

Cohort / File(s) Summary
Configuration migration
repomix.config.json
New JSON-based configuration file defining input constraints (maxFileSize), output formatting options (style, compress, showLineNumbers, etc.), Git integration settings (sortByChanges, includeDiffs, includeLogs), inclusion/exclusion rules, security toggles, and token counting configuration.
Removed TypeScript config
repomix.config.ts
Removed the entire TypeScript configuration file that previously exported a defineConfig object with equivalent configuration structure.
Schema definition
website/client/src/public/schemas/1.8.0/schema.json
New JSON Schema (v7) defining the complete Repomix configuration structure with validation rules for all top-level properties (input, output, include, ignore, security, tokenCount) and nested object schemas.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

The review requires validation of the new JSON config structure against expected settings, verification of schema comprehensiveness and correctness, and confirmation that removing the TypeScript config file resolves the reported module-loading issue without breaking existing workflows.

Possibly related PRs

Suggested reviewers

  • yamadashy

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed The title "fix(config): Revert config file from TypeScript to JSON format" is specific and directly summarizes the primary change in the changeset. It clearly identifies that the config file format is being reverted from TypeScript to JSON, which matches the core changes shown in the raw summary where repomix.config.ts is removed and repomix.config.json is added. The title is concise and conveys meaningful information about the changeset.
Linked Issues Check ✅ Passed The PR directly addresses issue #899 by removing the TypeScript config file that imports runtime dependencies (defineConfig, picocolors) and replacing it with a JSON config that requires no module resolution or dependency installation. This change enables repomix to run against its own repository immediately after git clone without requiring npm install, which is the core objective stated in the linked issue. The raw summary confirms the old TypeScript config and its imports are removed, while the new JSON config preserves all configuration options, fulfilling the stated requirements.
Out of Scope Changes Check ✅ Passed All changes in this PR are directly related to addressing issue #899. The removal of repomix.config.ts and addition of repomix.config.json are the core changes needed to resolve the config loading error when dependencies aren't installed. The addition of website/client/src/public/schemas/1.8.0/schema.json is a supporting file that provides schema validation for the new JSON configuration format, which is logically necessary when introducing a JSON config. No unrelated features, fixes, or scope creep are evident in the changeset.
Description Check ✅ Passed The PR description exceeds the requirements of the provided template and is well-structured. It includes a clear "Summary" section explaining the reversion from TypeScript to JSON, a "Problem" section detailing the error that occurs when dependencies aren't installed, and a "Solution" section explaining why JSON format resolves the issue. The checklist is completed with both npm run test and npm run lint marked as completed, and the description links to the addressed issue (#899). The description provides sufficient context about the change and its motivation.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/js-config

📜 Recent 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 d4c7d6e and ccd63ba.

📒 Files selected for processing (3)
  • repomix.config.json (1 hunks)
  • repomix.config.ts (0 hunks)
  • website/client/src/public/schemas/1.8.0/schema.json (1 hunks)
💤 Files with no reviewable changes (1)
  • repomix.config.ts
🔇 Additional comments (2)
website/client/src/public/schemas/1.8.0/schema.json (1)

1-154: Comprehensive schema provides solid validation foundation.

The JSON Schema is well-structured with proper type constraints, enum validation for output styles, and appropriate use of additionalProperties: false to enforce strict property validation. The schema correctly mirrors the configuration structure and enforces nested constraints (e.g., git options).

repomix.config.json (1)

2-2: Verify schema URL resolution for the "latest" pointer.

The configuration references https://repomix.com/schemas/latest/schema.json, which should resolve to the newly added schema file (website/client/src/public/schemas/1.8.0/schema.json). Ensure the URL routing and "latest" pointer are properly configured.


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 @yamadashy, 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 implements a crucial fix by changing the repomix configuration file from TypeScript to JSON. This modification resolves a problem where the tool's configuration would fail to load if its dependencies were not installed, hindering immediate use after cloning the repository. The switch to JSON ensures that the configuration is dependency-free and functions out-of-the-box, enhancing the overall stability and user experience of the repomix tool.

Highlights

  • Configuration Format Reversion: The repository's configuration file has been reverted from TypeScript (repomix.config.ts) to JSON (repomix.config.json).
  • Dependency Resolution Fix: This change addresses an issue where the TypeScript configuration failed due to module resolution errors when dependencies were not installed, specifically picocolors.
  • Improved Usability: The new JSON configuration now works immediately after a git clone without requiring npm install, making the tool more stable and universally accessible.
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

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Reverts the repository configuration from TypeScript to a pure JSON format to eliminate runtime dependency issues when loading the config without installed packages.

  • Removes TypeScript-based config that required module resolution.
  • Adds a JSON schema-based config file with equivalent settings.
  • Simplifies loading by avoiding imports and runtime dependencies.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
repomix.config.ts Removed TypeScript config that depended on runtime imports.
repomix.config.json Added JSON config providing equivalent settings without dependencies.

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 reverts the configuration file from TypeScript to JSON format to resolve an issue with dependency resolution when running repomix on its own repository. This is a sensible change that improves the tool's out-of-the-box experience. The new repomix.config.json file correctly mirrors the previous configuration. I have one suggestion to improve the new configuration file by making it strictly compliant with the JSON standard.

@cloudflare-workers-and-pages
Copy link

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

Deploying repomix with  Cloudflare Pages  Cloudflare Pages

Latest commit: ccd63ba
Status: ✅  Deploy successful!
Preview URL: https://05259269.repomix.pages.dev
Branch Preview URL: https://fix-js-config.repomix.pages.dev

View logs

@claude
Copy link
Contributor

claude bot commented Oct 19, 2025

PR Review - Config File Format Reversion

Thank you for addressing issue #899! This is a pragmatic solution to ensure Repomix can analyze its own repository without requiring dependencies. Here's my review:

✅ Strengths

  1. Problem Resolution: Correctly addresses the core issue - TypeScript config files fail without npm install due to module imports
  2. Backward Compatibility: JSON format is universally supported and requires no dependencies
  3. Test Coverage: Existing tests for JSON config loading already cover this format
  4. Schema Support: Proper $schema reference enables IDE validation and autocomplete

🔍 Issues & Suggestions

1. JSON5 Comment Syntax (Major Issue)

File: repomix.config.json
Lines: 35-36

"ignore": {
  "useGitignore": true,
  "useDefaultPatterns": true,
  // ignore is specified in .repomixignore
  "customPatterns": []
}

Problem: The file uses .json extension but contains JavaScript-style comments (//), which is invalid JSON syntax. While JSON5 supports comments, standard JSON parsers will fail.

Why it works now: The code uses JSON5.parse() for all JSON files (configLoad.ts:130), which tolerates comments.

Recommendation: Either:

  • Rename to repomix.config.json5 or repomix.config.jsonc to match the syntax
  • Remove the comment to keep valid JSON

I suggest removing the comment since:

  • The .repomixignore reference is already clear from context
  • Keeps the file as pure JSON for maximum compatibility
  • The schema file is also pure JSON without comments
2. Missing Schema File Generation (Minor Issue)

File: website/client/src/public/schemas/1.8.0/schema.json

Observation: The schema file appears to be manually added to the PR, but based on website/client/scripts/generateSchema.ts, it should be generated automatically.

Verification needed:

  • Was this schema generated by running the generation script?
  • Should the build process automatically generate this?

Recommendation: Document in the PR description or CONTRIBUTING.md that the schema should be generated via the appropriate npm script.

3. Documentation Update Consideration

While the configuration documentation (website/client/src/en/guide/configuration.md) correctly shows JSON as the recommended format for --init, you may want to add a note about why JSON is preferred for library repositories or when avoiding dependencies.

Suggested addition to the Configuration docs:

> **Note**: For repositories that may be analyzed without installing dependencies (like via npx), 
> JSON format is recommended over TypeScript. TypeScript configs require the `repomix` package 
> to be installed for the `defineConfig` import.
4. GitHub Action Dependency Consideration

File: .github/actions/repomix/action.yml
Lines: 49-56

The action currently runs npm install if package.json exists, which was necessary for TypeScript configs. With JSON config, this step may not be needed for the Repomix repository itself.

Current behavior is correct but consider adding a comment explaining this handles both TS and JSON configs in different repositories.

🧪 Testing Recommendations

  1. Verify the exact issue scenario:

    cd /tmp
    git clone https://github.com/yamadashy/repomix
    cd repomix
    npx repomix@latest  # Should work with JSON config
  2. Test comment handling: Ensure the JSON5 parser correctly handles the comment (or remove it)

  3. Validate schema reference: Verify the schema URL resolves correctly:

    https://repomix.com/schemas/latest/schema.json
    

📋 Checklist Status

  • ✅ Tests pass
  • ✅ Linting passes
  • ⚠️ JSON syntax issue needs resolution
  • ℹ️ Schema generation process should be verified

Summary

This is a solid fix for the reported issue. The main action item is addressing the JSON comment syntax to ensure full compatibility. Once that's resolved, this PR will properly solve #899.

Recommended action: Remove the comment on line 35 of repomix.config.json or rename the file to repomix.config.json5.

@yamadashy yamadashy merged commit 31b93c0 into main Oct 19, 2025
4 checks passed
@yamadashy yamadashy deleted the fix/js-config branch October 19, 2025 13:14
@coderabbitai coderabbitai bot mentioned this pull request Dec 12, 2025
2 tasks
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.

Running against the repomix repository itself fails

2 participants