mirror of
https://github.com/yamadashy/repomix.git
synced 2025-06-11 00:25:54 +03:00
feat(rename): Rename to repomix
# Conflicts: # src/core/packager.ts # src/core/security/securityCheck.ts # src/shared/processConcurrency.ts # Conflicts: # package-lock.json # package.json
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Repopack",
|
||||
"name": "Repomix",
|
||||
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bullseye",
|
||||
"runArgs": ["--name", "repopack-devcontainer"],
|
||||
"runArgs": ["--name", "repomix-devcontainer"],
|
||||
"postCreateCommand": "npm install"
|
||||
}
|
||||
|
||||
4
.github/workflows/brew.yml
vendored
4
.github/workflows/brew.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
||||
- name: Release | Brew
|
||||
uses: mislav/bump-homebrew-formula-action@v3
|
||||
with:
|
||||
formula-name: repopack
|
||||
formula-path: Formula/r/repopack.rb
|
||||
formula-name: repomix
|
||||
formula-path: Formula/r/repomix.rb
|
||||
env:
|
||||
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
|
||||
|
||||
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -131,9 +131,9 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: node bin/repopack
|
||||
- run: node bin/repomix
|
||||
- name: Upload build artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: repopack-output-${{ matrix.os }}-${{ matrix.node-version }}.txt
|
||||
path: repopack-output.txt
|
||||
name: repomix-output-${{ matrix.os }}-${{ matrix.node-version }}.txt
|
||||
path: repomix-output.txt
|
||||
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -21,10 +21,10 @@ coverage/
|
||||
*.tmp
|
||||
*.temp
|
||||
|
||||
# Repopack output
|
||||
repopack-output.txt
|
||||
repopack-output.xml
|
||||
repopack-output.md
|
||||
# Repomix output
|
||||
repomix-output.txt
|
||||
repomix-output.xml
|
||||
repomix-output.md
|
||||
|
||||
# ESLint cache
|
||||
.eslintcache
|
||||
|
||||
@@ -31,7 +31,7 @@ biome.json
|
||||
.editorconfig
|
||||
.node-version
|
||||
.tool-versions
|
||||
repopack.config.js
|
||||
repomix.config.js
|
||||
|
||||
# Editor files
|
||||
.vscode/
|
||||
@@ -40,8 +40,8 @@ repopack.config.js
|
||||
# Logs
|
||||
*.log
|
||||
|
||||
# Repopack output
|
||||
repopack-output.txt
|
||||
# Repomix output
|
||||
repomix-output.txt
|
||||
|
||||
# Development scripts
|
||||
scripts/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Repopack Contributor Covenant Code of Conduct
|
||||
# Repomix Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# Contribution Guide
|
||||
|
||||
Thanks for your interest in **Repopack**! 🚀 We’d love your help to make it even better. Here’s how you can get involved:
|
||||
Thanks for your interest in **Repomix**! 🚀 We’d love your help to make it even better. Here’s how you can get involved:
|
||||
|
||||
|
||||
- **Create an Issue**: Spot a bug? Have an idea for a new feature? Let us know by creating an issue.
|
||||
- **Submit a Pull Request**: Found something to fix or improve? Jump in and submit a PR!
|
||||
- **Spread the Word**: Share your experience with Repopack on social media, blogs, or with your tech community.
|
||||
- **Use Repopack**: The best feedback comes from real-world usage, so feel free to integrate Repopack into your own projects!
|
||||
- **Spread the Word**: Share your experience with Repomix on social media, blogs, or with your tech community.
|
||||
- **Use Repomix**: The best feedback comes from real-world usage, so feel free to integrate Repomix into your own projects!
|
||||
|
||||
## Maintainers
|
||||
|
||||
Repopack is maintained by Yamadashy ([@yamadashy](https://github.com/yamadashy)). While all contributions are welcome, please understand that not every suggestion may be accepted if they don't align with the project's goals or coding standards.
|
||||
Repomix is maintained by Yamadashy ([@yamadashy](https://github.com/yamadashy)). While all contributions are welcome, please understand that not every suggestion may be accepted if they don't align with the project's goals or coding standards.
|
||||
|
||||
---
|
||||
|
||||
@@ -24,15 +24,15 @@ Before submitting a Pull Request, please ensure:
|
||||
|
||||
## Local Development
|
||||
|
||||
To set up Repopack for local development:
|
||||
To set up Repomix for local development:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/yamadashy/repopack.git
|
||||
cd repopack
|
||||
git clone https://github.com/yamadashy/repomix.git
|
||||
cd repomix
|
||||
npm install
|
||||
```
|
||||
|
||||
To run Repopack locally:
|
||||
To run Repomix locally:
|
||||
|
||||
```bash
|
||||
npm run cli-run
|
||||
@@ -68,4 +68,4 @@ When adding new features or making changes, please update the relevant documenta
|
||||
|
||||
New versions are managed by the maintainer. If you think a release is needed, open an issue to discuss it
|
||||
|
||||
Thank you for contributing to Repopack!
|
||||
Thank you for contributing to Repomix!
|
||||
|
||||
151
README.md
151
README.md
@@ -1,14 +1,39 @@
|
||||
# 📦 Repopack
|
||||
# 📦 Repomix (formerly Repopack)
|
||||
|
||||
[](https://github.com/yamadashy/repopack/actions?query=workflow%3A"ci")
|
||||
[](https://www.npmjs.com/package/repopack)
|
||||
[](https://www.npmjs.com/package/repopack)
|
||||
[](https://github.com/yamadashy/repopack/blob/main/LICENSE)
|
||||
[](https://www.npmjs.com/package/repopack)
|
||||
[](https://github.com/yamadashy/repomix/actions?query=workflow%3A"ci")
|
||||
[](https://www.npmjs.com/package/repomix)
|
||||
[](https://www.npmjs.com/package/repomix)
|
||||
[](https://github.com/yamadashy/repomix/blob/main/LICENSE)
|
||||
[](https://www.npmjs.com/package/repomix)
|
||||
|
||||
Repopack is a powerful tool that packs your entire repository into a single, AI-friendly file.
|
||||
Repomix is a powerful tool that packs your entire repository into a single, AI-friendly file.
|
||||
It is perfect for when you need to feed your codebase to Large Language Models (LLMs) or other AI tools like Claude, ChatGPT, and Gemini.
|
||||
|
||||
# Important Notice: Project Renamed to Repomix
|
||||
|
||||
> [!NOTE]
|
||||
> Due to legal considerations, this project has been renamed from "Repopack" to "Repomix".
|
||||
> We are committed to ensuring a smooth transition for all users.
|
||||
|
||||
## Migration Guide
|
||||
|
||||
### For CLI Users
|
||||
```bash
|
||||
# Install new package
|
||||
npm install -g repomix
|
||||
|
||||
# Or use directly with npx
|
||||
npx repomix
|
||||
```
|
||||
|
||||
### Configuration Files
|
||||
Your existing configuration files (`repopack.config.json` and `.repopackignore`) will continue to work during the transition period. The CLI will automatically detect these files and offer to migrate them to the new format (`repomix.config.json` and `.repomixignore`).
|
||||
|
||||
### Timeline
|
||||
- Current: Transition period begins
|
||||
- December 1st, 2024: The `repopack` npm package will be transferred
|
||||
|
||||
We appreciate your understanding and cooperation during this transition. The project's functionality remains unchanged - only the name has been updated.
|
||||
|
||||
|
||||
## 🌟 Features
|
||||
@@ -24,29 +49,29 @@ It is perfect for when you need to feed your codebase to Large Language Models (
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
You can try Repopack instantly in your project directory without installation:
|
||||
You can try Repomix instantly in your project directory without installation:
|
||||
|
||||
```bash
|
||||
npx repopack
|
||||
npx repomix
|
||||
```
|
||||
|
||||
Or install globally for repeated use:
|
||||
|
||||
```bash
|
||||
# Install using npm
|
||||
npm install -g repopack
|
||||
npm install -g repomix
|
||||
|
||||
# Alternatively using yarn
|
||||
yarn global add repopack
|
||||
yarn global add repomix
|
||||
|
||||
# Alternatively using Homebrew (macOS)
|
||||
brew install repopack
|
||||
brew install repomix
|
||||
|
||||
# Then run in any project directory
|
||||
repopack
|
||||
repomix
|
||||
```
|
||||
|
||||
That's it! Repopack will generate a `repopack-output.txt` file in your current directory, containing your entire repository in an AI-friendly format.
|
||||
That's it! Repomix will generate a `repomix-output.txt` file in your current directory, containing your entire repository in an AI-friendly format.
|
||||
|
||||
|
||||
|
||||
@@ -55,45 +80,45 @@ That's it! Repopack will generate a `repopack-output.txt` file in your current d
|
||||
To pack your entire repository:
|
||||
|
||||
```bash
|
||||
repopack
|
||||
repomix
|
||||
```
|
||||
|
||||
To pack a specific directory:
|
||||
|
||||
```bash
|
||||
repopack path/to/directory
|
||||
repomix path/to/directory
|
||||
```
|
||||
|
||||
To pack specific files or directories using [glob patterns](https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#pattern-syntax):
|
||||
|
||||
```bash
|
||||
repopack --include "src/**/*.ts,**/*.md"
|
||||
repomix --include "src/**/*.ts,**/*.md"
|
||||
```
|
||||
|
||||
To exclude specific files or directories:
|
||||
|
||||
```bash
|
||||
repopack --ignore "**/*.log,tmp/"
|
||||
repomix --ignore "**/*.log,tmp/"
|
||||
```
|
||||
|
||||
To pack a remote repository:
|
||||
```bash
|
||||
repopack --remote https://github.com/yamadashy/repopack
|
||||
repomix --remote https://github.com/yamadashy/repomix
|
||||
|
||||
# You can also use GitHub shorthand:
|
||||
repopack --remote yamadashy/repopack
|
||||
repomix --remote yamadashy/repomix
|
||||
```
|
||||
|
||||
To initialize a new configuration file (`repopack.config.json`):
|
||||
To initialize a new configuration file (`repomix.config.json`):
|
||||
|
||||
```bash
|
||||
repopack --init
|
||||
repomix --init
|
||||
```
|
||||
|
||||
Once you have generated the packed file, you can use it with Generative AI tools like Claude, ChatGPT, and Gemini.
|
||||
|
||||
### Prompt Examples
|
||||
Once you have generated the packed file with Repopack, you can use it with AI tools like Claude, ChatGPT, and Gemini. Here are some example prompts to get you started:
|
||||
Once you have generated the packed file with Repomix, you can use it with AI tools like Claude, ChatGPT, and Gemini. Here are some example prompts to get you started:
|
||||
|
||||
#### Code Review and Refactoring
|
||||
For a comprehensive code review and refactoring suggestions:
|
||||
@@ -134,7 +159,7 @@ Feel free to modify these prompts based on your specific needs and the capabilit
|
||||
|
||||
### Output File Format
|
||||
|
||||
Repopack generates a single file with clear separators between different parts of your codebase.
|
||||
Repomix generates a single file with clear separators between different parts of your codebase.
|
||||
To enhance AI comprehension, the output file begins with an AI-oriented explanation, making it easier for AI models to understand the context and structure of the packed repository.
|
||||
|
||||
#### Plain Text Format (default)
|
||||
@@ -185,7 +210,7 @@ Instruction
|
||||
|
||||
To generate output in XML format, use the `--style xml` option:
|
||||
```bash
|
||||
repopack --style xml
|
||||
repomix --style xml
|
||||
```
|
||||
|
||||
The XML format structures the content in a hierarchical manner:
|
||||
@@ -224,13 +249,13 @@ https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/use-xml-
|
||||
|
||||
> When your prompts involve multiple components like context, instructions, and examples, XML tags can be a game-changer. They help Claude parse your prompts more accurately, leading to higher-quality outputs.
|
||||
|
||||
This means that the XML output from Repopack is not just a different format, but potentially a more effective way to feed your codebase into AI systems for analysis, code review, or other tasks.
|
||||
This means that the XML output from Repomix is not just a different format, but potentially a more effective way to feed your codebase into AI systems for analysis, code review, or other tasks.
|
||||
|
||||
#### Markdown Format
|
||||
|
||||
To generate output in Markdown format, use the `--style markdown` option:
|
||||
```bash
|
||||
repopack --style markdown
|
||||
repomix --style markdown
|
||||
```
|
||||
|
||||
The Markdown format structures the content in a hierarchical manner:
|
||||
@@ -280,58 +305,58 @@ This format provides a clean, readable structure that is both human-friendly and
|
||||
|
||||
Examples:
|
||||
```bash
|
||||
repopack -o custom-output.txt
|
||||
repopack -i "*.log,tmp" -v
|
||||
repopack -c ./custom-config.json
|
||||
repopack --style xml
|
||||
repopack --remote https://github.com/user/repo.git
|
||||
npx repopack src
|
||||
repomix -o custom-output.txt
|
||||
repomix -i "*.log,tmp" -v
|
||||
repomix -c ./custom-config.json
|
||||
repomix --style xml
|
||||
repomix --remote https://github.com/user/repo.git
|
||||
npx repomix src
|
||||
```
|
||||
|
||||
### Updating Repopack
|
||||
### Updating Repomix
|
||||
|
||||
To update a globally installed Repopack:
|
||||
To update a globally installed Repomix:
|
||||
|
||||
```bash
|
||||
# Using npm
|
||||
npm update -g repopack
|
||||
npm update -g repomix
|
||||
|
||||
# Using yarn
|
||||
yarn global upgrade repopack
|
||||
yarn global upgrade repomix
|
||||
```
|
||||
|
||||
Using `npx repopack` is generally more convenient as it always uses the latest version.
|
||||
Using `npx repomix` is generally more convenient as it always uses the latest version.
|
||||
|
||||
|
||||
### Remote Repository Processing
|
||||
|
||||
Repopack supports processing remote Git repositories without the need for manual cloning. This feature allows you to quickly analyze any public Git repository with a single command.
|
||||
Repomix supports processing remote Git repositories without the need for manual cloning. This feature allows you to quickly analyze any public Git repository with a single command.
|
||||
|
||||
To process a remote repository, use the `--remote` option followed by the repository URL:
|
||||
|
||||
```bash
|
||||
repopack --remote https://github.com/user/repo.git
|
||||
repomix --remote https://github.com/user/repo.git
|
||||
```
|
||||
|
||||
You can also use GitHub's shorthand format:
|
||||
|
||||
```bash
|
||||
repopack --remote user/repo
|
||||
repomix --remote user/repo
|
||||
```
|
||||
|
||||
|
||||
## ⚙️ Configuration
|
||||
|
||||
Create a `repopack.config.json` file in your project root for custom configurations.
|
||||
Create a `repomix.config.json` file in your project root for custom configurations.
|
||||
```bash
|
||||
repopack --init
|
||||
repomix --init
|
||||
```
|
||||
|
||||
Here's an explanation of the configuration options:
|
||||
|
||||
| Option | Description | Default |
|
||||
|--------|-------------|---------|
|
||||
|`output.filePath`| The name of the output file | `"repopack-output.txt"` |
|
||||
|`output.filePath`| The name of the output file | `"repomix-output.txt"` |
|
||||
|`output.style`| The style of the output (`plain`, `xml`, `markdown`) |`"plain"`|
|
||||
|`output.headerText`| Custom text to include in the file header |`null`|
|
||||
|`output.instructionFilePath`| Path to a file containing detailed custom instructions |`null`|
|
||||
@@ -350,7 +375,7 @@ Example configuration:
|
||||
```json
|
||||
{
|
||||
"output": {
|
||||
"filePath": "repopack-output.xml",
|
||||
"filePath": "repomix-output.xml",
|
||||
"style": "xml",
|
||||
"headerText": "Custom header information for the packed file.",
|
||||
"removeComments": false,
|
||||
@@ -374,34 +399,34 @@ Example configuration:
|
||||
To create a global configuration file:
|
||||
|
||||
```bash
|
||||
repopack --init --global
|
||||
repomix --init --global
|
||||
```
|
||||
|
||||
The global configuration file will be created in:
|
||||
- Windows: `%LOCALAPPDATA%\Repopack\repopack.config.json`
|
||||
- macOS/Linux: `$XDG_CONFIG_HOME/repopack/repopack.config.json` or `~/.config/repopack/repopack.config.json`
|
||||
- Windows: `%LOCALAPPDATA%\Repomix\repomix.config.json`
|
||||
- macOS/Linux: `$XDG_CONFIG_HOME/repomix/repomix.config.json` or `~/.config/repomix/repomix.config.json`
|
||||
|
||||
Note: Local configuration (if present) takes precedence over global configuration.
|
||||
|
||||
### Include and Ignore
|
||||
#### Include Patterns
|
||||
Repopack now supports specifying files to include using [glob patterns](https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#pattern-syntax). This allows for more flexible and powerful file selection:
|
||||
Repomix now supports specifying files to include using [glob patterns](https://github.com/mrmlnc/fast-glob?tab=readme-ov-file#pattern-syntax). This allows for more flexible and powerful file selection:
|
||||
|
||||
- Use `**/*.js` to include all JavaScript files in any directory
|
||||
- Use `src/**/*` to include all files within the `src` directory and its subdirectories
|
||||
- Combine multiple patterns like `["src/**/*.js", "**/*.md"]` to include JavaScript files in `src` and all Markdown files
|
||||
|
||||
#### Ignore Patterns
|
||||
Repopack offers multiple methods to set ignore patterns for excluding specific files or directories during the packing process:
|
||||
Repomix offers multiple methods to set ignore patterns for excluding specific files or directories during the packing process:
|
||||
|
||||
- **.gitignore**: By default, patterns listed in your project's `.gitignore` file are used. This behavior can be controlled with the `ignore.useGitignore` setting.
|
||||
- **Default patterns**: Repopack includes a default list of commonly excluded files and directories (e.g., node_modules, .git, binary files). This feature can be controlled with the `ignore.useDefaultPatterns` setting. Please see [defaultIgnore.ts](src/config/defaultIgnore.ts) for more details.
|
||||
- **.repopackignore**: You can create a `.repopackignore` file in your project root to define Repopack-specific ignore patterns. This file follows the same format as `.gitignore`.
|
||||
- **Default patterns**: Repomix includes a default list of commonly excluded files and directories (e.g., node_modules, .git, binary files). This feature can be controlled with the `ignore.useDefaultPatterns` setting. Please see [defaultIgnore.ts](src/config/defaultIgnore.ts) for more details.
|
||||
- **.repomixignore**: You can create a `.repomixignore` file in your project root to define Repomix-specific ignore patterns. This file follows the same format as `.gitignore`.
|
||||
- **Custom patterns**: Additional ignore patterns can be specified using the `ignore.customPatterns` option in the configuration file. You can overwrite this setting with the `-i, --ignore` command line option.
|
||||
|
||||
Priority Order (from highest to lowest):
|
||||
1. Custom patterns `ignore.customPatterns`
|
||||
2. `.repopackignore`
|
||||
2. `.repomixignore`
|
||||
3. `.gitignore` (if `ignore.useGitignore` is true)
|
||||
4. Default patterns (if `ignore.useDefaultPatterns` is true)
|
||||
|
||||
@@ -415,7 +440,7 @@ The `output.instructionFilePath` option allows you to specify a separate file co
|
||||
|
||||
Here's an example of how you might use this feature:
|
||||
|
||||
1. Create a file named `repopack-instruction.md` in your project root:
|
||||
1. Create a file named `repomix-instruction.md` in your project root:
|
||||
|
||||
```markdown
|
||||
# Coding Guidelines
|
||||
@@ -429,18 +454,18 @@ Here's an example of how you might use this feature:
|
||||
- Optimize for handling large codebases while maintaining output quality
|
||||
```
|
||||
|
||||
2. In your `repopack.config.json`, add the `instructionFilePath` option:
|
||||
2. In your `repomix.config.json`, add the `instructionFilePath` option:
|
||||
|
||||
```json5
|
||||
{
|
||||
"output": {
|
||||
"instructionFilePath": "repopack-instruction.md",
|
||||
"instructionFilePath": "repomix-instruction.md",
|
||||
// other options...
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
When Repopack generates the output, it will include the contents of `repopack-instruction.md` in a dedicated section.
|
||||
When Repomix generates the output, it will include the contents of `repomix-instruction.md` in a dedicated section.
|
||||
|
||||
Note: The instruction content is appended at the end of the output file. This placement can be particularly effective for AI systems. For those interested in understanding why this might be beneficial, Anthropic provides some insights in their documentation:
|
||||
https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/long-context-tips
|
||||
@@ -450,7 +475,7 @@ https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/long-con
|
||||
|
||||
### Comment Removal
|
||||
|
||||
When `output.removeComments` is set to `true`, Repopack will attempt to remove comments from supported file types. This feature can help reduce the size of the output file and focus on the essential code content.
|
||||
When `output.removeComments` is set to `true`, Repomix will attempt to remove comments from supported file types. This feature can help reduce the size of the output file and focus on the essential code content.
|
||||
|
||||
Supported languages include:
|
||||
HTML, CSS, JavaScript, TypeScript, Vue, Svelte, Python, PHP, Ruby, C, C#, Java, Go, Rust, Swift, Kotlin, Dart, Shell, and YAML.
|
||||
@@ -461,7 +486,7 @@ Note: The comment removal process is conservative to avoid accidentally removing
|
||||
|
||||
## 🔍 Security Check
|
||||
|
||||
Repopack includes a security check feature that uses [Secretlint](https://github.com/secretlint/secretlint) to detect potentially sensitive information in your files. This feature helps you identify possible security risks before sharing your packed repository.
|
||||
Repomix includes a security check feature that uses [Secretlint](https://github.com/secretlint/secretlint) to detect potentially sensitive information in your files. This feature helps you identify possible security risks before sharing your packed repository.
|
||||
|
||||
The security check results will be displayed in the CLI output after the packing process is complete. If any suspicious files are detected, you'll see a list of these files along with a warning message.
|
||||
|
||||
@@ -477,7 +502,7 @@ Example output:
|
||||
Please review these files for potentially sensitive information.
|
||||
```
|
||||
|
||||
By default, Repopack's security check feature is enabled. You can disable it by setting `security.enableSecurityCheck` to `false` in your configuration file:
|
||||
By default, Repomix's security check feature is enabled. You can disable it by setting `security.enableSecurityCheck` to `false` in your configuration file:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -495,8 +520,8 @@ We welcome contributions from the community! To get started, please refer to our
|
||||
|
||||
### Contributors
|
||||
|
||||
<a href="https://github.com/yamadashy/repopack/graphs/contributors">
|
||||
<img alt="contributors" src="https://contrib.rocks/image?repo=yamadashy/repopack"/>
|
||||
<a href="https://github.com/yamadashy/repomix/graphs/contributors">
|
||||
<img alt="contributors" src="https://contrib.rocks/image?repo=yamadashy/repomix"/>
|
||||
</a>
|
||||
|
||||
## 📜 License
|
||||
@@ -505,7 +530,7 @@ This project is licensed under the [MIT License](LICENSE).
|
||||
|
||||
<p align="center">
|
||||
|
||||
<a href="#-repopack" target="_blank">
|
||||
<a href="#-repomix" target="_blank">
|
||||
Back To Top
|
||||
</a>
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
To securely report a vulnerability, please [open an advisory on GitHub](https://github.com/yamadashy/repopack/security/advisories/new) or report it by sending an email to `koukun0120@gmail.com`.
|
||||
To securely report a vulnerability, please [open an advisory on GitHub](https://github.com/yamadashy/repomix/security/advisories/new) or report it by sending an email to `koukun0120@gmail.com`.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
Add this file so we can use `node bin/repopack` or `node bin/repopack.js`
|
||||
instead of `node bin/repopack.cjs`.
|
||||
Add this file so we can use `node bin/repomix` or `node bin/repomix.js`
|
||||
instead of `node bin/repomix.cjs`.
|
||||
|
||||
This file should only used for development.
|
||||
*/
|
||||
@@ -10,7 +10,7 @@
|
||||
"tsconfig.json",
|
||||
"tsconfig.build.json",
|
||||
"vite.config.ts",
|
||||
"repopack.config.json"
|
||||
"repomix.config.json"
|
||||
]
|
||||
},
|
||||
"organizeImports": {
|
||||
|
||||
10
package-lock.json
generated
10
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "repopack",
|
||||
"version": "0.1.44",
|
||||
"name": "repomix",
|
||||
"version": "0.2.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "repopack",
|
||||
"version": "0.1.44",
|
||||
"name": "repomix",
|
||||
"version": "0.2.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@clack/prompts": "^0.7.0",
|
||||
@@ -26,7 +26,7 @@
|
||||
"tiktoken": "^1.0.17"
|
||||
},
|
||||
"bin": {
|
||||
"repopack": "bin/repopack.cjs"
|
||||
"repomix": "bin/repomix.cjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "^1.9.4",
|
||||
|
||||
14
package.json
14
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "repopack",
|
||||
"version": "0.1.44",
|
||||
"name": "repomix",
|
||||
"version": "0.2.0",
|
||||
"description": "A tool to pack repository contents to single file for AI consumption",
|
||||
"main": "./lib/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
@@ -9,7 +9,7 @@
|
||||
"types": "./lib/index.d.ts"
|
||||
}
|
||||
},
|
||||
"bin": "./bin/repopack.cjs",
|
||||
"bin": "./bin/repomix.cjs",
|
||||
"scripts": {
|
||||
"clean": "rimraf lib",
|
||||
"build": "npm run clean && tsc -p tsconfig.build.json --sourceMap --declaration",
|
||||
@@ -19,7 +19,7 @@
|
||||
"lint-secretlint": "secretlint \"**/*\" --secretlintignore .gitignore",
|
||||
"test": "vitest",
|
||||
"test-coverage": "vitest run --coverage",
|
||||
"cli-run": "npm run build && node --trace-warnings bin/repopack",
|
||||
"cli-run": "npm run build && node --trace-warnings bin/repomix",
|
||||
"npm-publish": "npm run lint && npm run test-coverage && npm run build && npm publish",
|
||||
"npm-release-patch": "npm version patch && npm run npm-publish",
|
||||
"npm-release-minor": "npm version minor && npm run npm-publish",
|
||||
@@ -39,13 +39,13 @@
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/yamadashy/repopack.git"
|
||||
"url": "git://github.com/yamadashy/repomix.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/yamadashy/repopack/issues"
|
||||
"url": "https://github.com/yamadashy/repomix/issues"
|
||||
},
|
||||
"author": "Kazuki Yamada <koukun0120@gmail.com>",
|
||||
"homepage": "https://github.com/yamadashy/repopack",
|
||||
"homepage": "https://github.com/yamadashy/repomix",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@@ -13,7 +13,7 @@ Here are some examples of release notes that follow the guidelines:
|
||||
|
||||
v0.1.40
|
||||
````md
|
||||
This release introduces improvements to file handling and output formatting, enhancing Repopack's functionality and user experience.
|
||||
This release introduces improvements to file handling and output formatting, enhancing Repomix's functionality and user experience.
|
||||
|
||||
## Improvements
|
||||
|
||||
@@ -39,12 +39,12 @@ This release introduces improvements to file handling and output formatting, enh
|
||||
To update to the latest version, run:
|
||||
|
||||
```bash
|
||||
npm update -g repopack
|
||||
npm update -g repomix
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
We value your feedback and contributions in making Repopack better! If you encounter any issues or have suggestions, please share them through our GitHub issues.
|
||||
We value your feedback and contributions in making Repomix better! If you encounter any issues or have suggestions, please share them through our GitHub issues.
|
||||
````
|
||||
|
||||
v0.1.38
|
||||
@@ -63,10 +63,10 @@ This release introduces a new Markdown output style, providing users with an add
|
||||
To use the new Markdown output style, use the `--style markdown` option:
|
||||
|
||||
```bash
|
||||
repopack --style markdown
|
||||
repomix --style markdown
|
||||
```
|
||||
|
||||
Or update your `repopack.config.json`:
|
||||
Or update your `repomix.config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -80,15 +80,15 @@ Or update your `repopack.config.json`:
|
||||
|
||||
To update, simply run:
|
||||
```bash
|
||||
npm update -g repopack
|
||||
npm update -g repomix
|
||||
```
|
||||
|
||||
As always, we appreciate your feedback and contributions to make Repopack even better! If you encounter any issues or have suggestions regarding this new feature, please let us know through our GitHub issues.
|
||||
As always, we appreciate your feedback and contributions to make Repomix even better! If you encounter any issues or have suggestions regarding this new feature, please let us know through our GitHub issues.
|
||||
````
|
||||
|
||||
v0.1.36
|
||||
````md
|
||||
This release introduces a new configuration option that allows users to control the security check feature, providing more flexibility in how Repopack handles sensitive information detection.
|
||||
This release introduces a new configuration option that allows users to control the security check feature, providing more flexibility in how Repomix handles sensitive information detection.
|
||||
|
||||
## What's New
|
||||
|
||||
@@ -99,7 +99,7 @@ This release introduces a new configuration option that allows users to control
|
||||
|
||||
## How to Use
|
||||
|
||||
To **disable** the security check, add the following to your `repopack.config.json`:
|
||||
To **disable** the security check, add the following to your `repomix.config.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -115,10 +115,10 @@ To **disable** the security check, add the following to your `repopack.config.js
|
||||
|
||||
To update, simply run:
|
||||
```bash
|
||||
npm update -g repopack
|
||||
npm update -g repomix
|
||||
```
|
||||
|
||||
As always, we appreciate your feedback and contributions to make Repopack even better! If you encounter any issues or have suggestions regarding this new feature, please let us know through our GitHub issues.
|
||||
As always, we appreciate your feedback and contributions to make Repomix even better! If you encounter any issues or have suggestions regarding this new feature, please let us know through our GitHub issues.
|
||||
````
|
||||
|
||||
v0.1.32
|
||||
@@ -135,8 +135,8 @@ This release focuses on improving performance and user experience, particularly
|
||||
---
|
||||
To update, simply run:
|
||||
```
|
||||
npm update -g repopack
|
||||
npm update -g repomix
|
||||
```
|
||||
|
||||
As always, we appreciate your feedback and contributions to make Repopack even better!
|
||||
As always, we appreciate your feedback and contributions to make Repomix even better!
|
||||
````
|
||||
21
repomix.config.json
Normal file
21
repomix.config.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"output": {
|
||||
"filePath": "repomix-output.xml",
|
||||
"style": "xml",
|
||||
"headerText": "This repository contains the source code for the Repomix tool.\nRepomix is designed to pack repository contents into a single file,\nmaking it easier for AI systems to analyze and process the codebase.\n\nKey Features:\n- Configurable ignore patterns\n- Custom header text support\n- Efficient file processing and packing\n\nPlease refer to the README.md file for more detailed information on usage and configuration.\n",
|
||||
"instructionFilePath": "repomix-instruction.md",
|
||||
"removeComments": false,
|
||||
"removeEmptyLines": false,
|
||||
"topFilesLength": 5,
|
||||
"showLineNumbers": false
|
||||
},
|
||||
"include": [],
|
||||
"ignore": {
|
||||
"useGitignore": true,
|
||||
"useDefaultPatterns": true,
|
||||
"customPatterns": []
|
||||
},
|
||||
"security": {
|
||||
"enableSecurityCheck": true
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"output": {
|
||||
"filePath": "repopack-output.xml",
|
||||
"style": "xml",
|
||||
"headerText": "This repository contains the source code for the Repopack tool.\nRepopack is designed to pack repository contents into a single file,\nmaking it easier for AI systems to analyze and process the codebase.\n\nKey Features:\n- Configurable ignore patterns\n- Custom header text support\n- Efficient file processing and packing\n\nPlease refer to the README.md file for more detailed information on usage and configuration.\n",
|
||||
"instructionFilePath": "repopack-instruction.md",
|
||||
"removeComments": false,
|
||||
"removeEmptyLines": false,
|
||||
"topFilesLength": 5,
|
||||
"showLineNumbers": false
|
||||
},
|
||||
"include": [],
|
||||
"ignore": {
|
||||
"useGitignore": true,
|
||||
"useDefaultPatterns": true,
|
||||
"customPatterns": []
|
||||
},
|
||||
"security": {
|
||||
"enableSecurityCheck": true
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
import path from 'node:path';
|
||||
import { loadFileConfig, mergeConfigs } from '../../config/configLoad.js';
|
||||
import type {
|
||||
RepopackConfigCli,
|
||||
RepopackConfigFile,
|
||||
RepopackConfigMerged,
|
||||
RepopackOutputStyle,
|
||||
RepomixConfigCli,
|
||||
RepomixConfigFile,
|
||||
RepomixConfigMerged,
|
||||
RepomixOutputStyle,
|
||||
} from '../../config/configTypes.js';
|
||||
import { type PackResult, pack } from '../../core/packager.js';
|
||||
import { logger } from '../../shared/logger.js';
|
||||
@@ -14,7 +14,7 @@ import Spinner from '../cliSpinner.js';
|
||||
|
||||
export interface DefaultActionRunnerResult {
|
||||
packResult: PackResult;
|
||||
config: RepopackConfigMerged;
|
||||
config: RepomixConfigMerged;
|
||||
}
|
||||
|
||||
export const runDefaultAction = async (
|
||||
@@ -25,15 +25,15 @@ export const runDefaultAction = async (
|
||||
logger.trace('Loaded CLI options:', options);
|
||||
|
||||
// Load the config file
|
||||
const fileConfig: RepopackConfigFile = await loadFileConfig(cwd, options.config ?? null);
|
||||
const fileConfig: RepomixConfigFile = await loadFileConfig(cwd, options.config ?? null);
|
||||
logger.trace('Loaded file config:', fileConfig);
|
||||
|
||||
// Parse the CLI options into a config
|
||||
const cliConfig: RepopackConfigCli = buildCliConfig(options);
|
||||
const cliConfig: RepomixConfigCli = buildCliConfig(options);
|
||||
logger.trace('CLI config:', cliConfig);
|
||||
|
||||
// Merge default, file, and CLI configs
|
||||
const config: RepopackConfigMerged = mergeConfigs(cwd, fileConfig, cliConfig);
|
||||
const config: RepomixConfigMerged = mergeConfigs(cwd, fileConfig, cliConfig);
|
||||
|
||||
logger.trace('Merged config:', config);
|
||||
|
||||
@@ -82,8 +82,8 @@ export const runDefaultAction = async (
|
||||
};
|
||||
};
|
||||
|
||||
const buildCliConfig = (options: CliOptions): RepopackConfigCli => {
|
||||
const cliConfig: RepopackConfigCli = {};
|
||||
const buildCliConfig = (options: CliOptions): RepomixConfigCli => {
|
||||
const cliConfig: RepomixConfigCli = {};
|
||||
|
||||
if (options.output) {
|
||||
cliConfig.output = { filePath: options.output };
|
||||
@@ -101,7 +101,7 @@ const buildCliConfig = (options: CliOptions): RepopackConfigCli => {
|
||||
cliConfig.output = { ...cliConfig.output, showLineNumbers: options.outputShowLineNumbers };
|
||||
}
|
||||
if (options.style) {
|
||||
cliConfig.output = { ...cliConfig.output, style: options.style.toLowerCase() as RepopackOutputStyle };
|
||||
cliConfig.output = { ...cliConfig.output, style: options.style.toLowerCase() as RepomixOutputStyle };
|
||||
}
|
||||
|
||||
return cliConfig;
|
||||
|
||||
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import * as prompts from '@clack/prompts';
|
||||
import pc from 'picocolors';
|
||||
import type { RepopackConfigFile, RepopackOutputStyle } from '../../config/configTypes.js';
|
||||
import type { RepomixConfigFile, RepomixOutputStyle } from '../../config/configTypes.js';
|
||||
import { defaultConfig, defaultFilePathMap } from '../../config/defaultConfig.js';
|
||||
import { getGlobalDirectory } from '../../config/globalDirectory.js';
|
||||
import { logger } from '../../shared/logger.js';
|
||||
@@ -13,13 +13,13 @@ const onCancelOperation = () => {
|
||||
};
|
||||
|
||||
export const runInitAction = async (rootDir: string, isGlobal: boolean): Promise<void> => {
|
||||
prompts.intro(pc.bold(`Welcome to Repopack ${isGlobal ? 'Global ' : ''}Configuration!`));
|
||||
prompts.intro(pc.bold(`Welcome to Repomix ${isGlobal ? 'Global ' : ''}Configuration!`));
|
||||
|
||||
try {
|
||||
// Step 1: Ask if user wants to create a config file
|
||||
const isCreatedConfig = await createConfigFile(rootDir, isGlobal);
|
||||
|
||||
// Step 2: Ask if user wants to create a .repopackignore file
|
||||
// Step 2: Ask if user wants to create a .repomixignore file
|
||||
const isCreatedIgnoreFile = await createIgnoreFile(rootDir, isGlobal);
|
||||
|
||||
if (!isCreatedConfig && !isCreatedIgnoreFile) {
|
||||
@@ -27,7 +27,7 @@ export const runInitAction = async (rootDir: string, isGlobal: boolean): Promise
|
||||
pc.yellow('No files were created. You can run this command again when you need to create configuration files.'),
|
||||
);
|
||||
} else {
|
||||
prompts.outro(pc.green('Initialization complete! You can now use Repopack with your specified settings.'));
|
||||
prompts.outro(pc.green('Initialization complete! You can now use Repomix with your specified settings.'));
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('An error occurred during initialization:', error);
|
||||
@@ -38,14 +38,14 @@ export async function createConfigFile(rootDir: string, isGlobal: boolean): Prom
|
||||
const isCancelled = false;
|
||||
|
||||
const configPath = isGlobal
|
||||
? path.resolve(getGlobalDirectory(), 'repopack.config.json')
|
||||
: path.resolve(rootDir, 'repopack.config.json');
|
||||
? path.resolve(getGlobalDirectory(), 'repomix.config.json')
|
||||
: path.resolve(rootDir, 'repomix.config.json');
|
||||
|
||||
const isCreateConfig = await prompts.confirm({
|
||||
message: `Do you want to create a ${isGlobal ? 'global ' : ''}${pc.green('repopack.config.json')} file?`,
|
||||
message: `Do you want to create a ${isGlobal ? 'global ' : ''}${pc.green('repomix.config.json')} file?`,
|
||||
});
|
||||
if (!isCreateConfig) {
|
||||
prompts.log.info(`Skipping ${pc.green('repopack.config.json')} file creation.`);
|
||||
prompts.log.info(`Skipping ${pc.green('repomix.config.json')} file creation.`);
|
||||
return false;
|
||||
}
|
||||
if (prompts.isCancel(isCreateConfig)) {
|
||||
@@ -63,10 +63,10 @@ export async function createConfigFile(rootDir: string, isGlobal: boolean): Prom
|
||||
|
||||
if (isConfigFileExists) {
|
||||
const isOverwrite = await prompts.confirm({
|
||||
message: `A ${isGlobal ? 'global ' : ''}${pc.green('repopack.config.json')} file already exists. Do you want to overwrite it?`,
|
||||
message: `A ${isGlobal ? 'global ' : ''}${pc.green('repomix.config.json')} file already exists. Do you want to overwrite it?`,
|
||||
});
|
||||
if (!isOverwrite) {
|
||||
prompts.log.info(`Skipping ${pc.green('repopack.config.json')} file creation.`);
|
||||
prompts.log.info(`Skipping ${pc.green('repomix.config.json')} file creation.`);
|
||||
return false;
|
||||
}
|
||||
if (prompts.isCancel(isOverwrite)) {
|
||||
@@ -95,7 +95,7 @@ export async function createConfigFile(rootDir: string, isGlobal: boolean): Prom
|
||||
if (isCancelled) {
|
||||
return;
|
||||
}
|
||||
const defaultFilePath = defaultFilePathMap[results.outputStyle as RepopackOutputStyle];
|
||||
const defaultFilePath = defaultFilePathMap[results.outputStyle as RepomixOutputStyle];
|
||||
return prompts.text({
|
||||
message: 'Output file path:',
|
||||
initialValue: defaultFilePath,
|
||||
@@ -108,12 +108,12 @@ export async function createConfigFile(rootDir: string, isGlobal: boolean): Prom
|
||||
},
|
||||
);
|
||||
|
||||
const config: RepopackConfigFile = {
|
||||
const config: RepomixConfigFile = {
|
||||
...defaultConfig,
|
||||
output: {
|
||||
...defaultConfig.output,
|
||||
filePath: options.outputFilePath as string,
|
||||
style: options.outputStyle as RepopackOutputStyle,
|
||||
style: options.outputStyle as RepomixOutputStyle,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -131,16 +131,16 @@ export async function createConfigFile(rootDir: string, isGlobal: boolean): Prom
|
||||
|
||||
export async function createIgnoreFile(rootDir: string, isGlobal: boolean): Promise<boolean> {
|
||||
if (isGlobal) {
|
||||
prompts.log.info(`Skipping ${pc.green('.repopackignore')} file creation for global configuration.`);
|
||||
prompts.log.info(`Skipping ${pc.green('.repomixignore')} file creation for global configuration.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
const ignorePath = path.resolve(rootDir, '.repopackignore');
|
||||
const ignorePath = path.resolve(rootDir, '.repomixignore');
|
||||
const createIgnore = await prompts.confirm({
|
||||
message: `Do you want to create a ${pc.green('.repopackignore')} file?`,
|
||||
message: `Do you want to create a ${pc.green('.repomixignore')} file?`,
|
||||
});
|
||||
if (!createIgnore) {
|
||||
prompts.log.info(`Skipping ${pc.green('.repopackignore')} file creation.`);
|
||||
prompts.log.info(`Skipping ${pc.green('.repomixignore')} file creation.`);
|
||||
return false;
|
||||
}
|
||||
if (prompts.isCancel(createIgnore)) {
|
||||
@@ -158,11 +158,11 @@ export async function createIgnoreFile(rootDir: string, isGlobal: boolean): Prom
|
||||
|
||||
if (isIgnoreFileExists) {
|
||||
const overwrite = await prompts.confirm({
|
||||
message: `A ${pc.green('.repopackignore')} file already exists. Do you want to overwrite it?`,
|
||||
message: `A ${pc.green('.repomixignore')} file already exists. Do you want to overwrite it?`,
|
||||
});
|
||||
|
||||
if (!overwrite) {
|
||||
prompts.log.info(`${pc.green('.repopackignore')} file creation skipped. Existing file will not be modified.`);
|
||||
prompts.log.info(`${pc.green('.repomixignore')} file creation skipped. Existing file will not be modified.`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -175,7 +175,7 @@ export async function createIgnoreFile(rootDir: string, isGlobal: boolean): Prom
|
||||
|
||||
await fs.writeFile(ignorePath, defaultIgnoreContent);
|
||||
prompts.log.success(
|
||||
pc.green('Created .repopackignore file!\n') + pc.dim(`Path: ${path.relative(rootDir, ignorePath)}`),
|
||||
pc.green('Created .repomixignore file!\n') + pc.dim(`Path: ${path.relative(rootDir, ignorePath)}`),
|
||||
);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -4,7 +4,7 @@ import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { promisify } from 'node:util';
|
||||
import pc from 'picocolors';
|
||||
import { RepopackError } from '../../shared/errorHandle.js';
|
||||
import { RepomixError } from '../../shared/errorHandle.js';
|
||||
import { logger } from '../../shared/logger.js';
|
||||
import type { CliOptions } from '../cliRun.js';
|
||||
import Spinner from '../cliSpinner.js';
|
||||
@@ -15,7 +15,7 @@ const execAsync = promisify(exec);
|
||||
export const runRemoteAction = async (repoUrl: string, options: CliOptions): Promise<void> => {
|
||||
const gitInstalled = await checkGitInstallation();
|
||||
if (!gitInstalled) {
|
||||
throw new RepopackError('Git is not installed or not in the system PATH.');
|
||||
throw new RepomixError('Git is not installed or not in the system PATH.');
|
||||
}
|
||||
|
||||
const formattedUrl = formatGitUrl(repoUrl);
|
||||
@@ -53,7 +53,7 @@ export const formatGitUrl = (url: string): string => {
|
||||
};
|
||||
|
||||
const createTempDirectory = async (): Promise<string> => {
|
||||
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'repopack-'));
|
||||
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'repomix-'));
|
||||
logger.trace(`Created temporary directory. (path: ${pc.dim(tempDir)})`);
|
||||
return tempDir;
|
||||
};
|
||||
@@ -65,7 +65,7 @@ const cloneRepository = async (url: string, directory: string): Promise<void> =>
|
||||
try {
|
||||
await execAsync(`git clone --depth 1 ${url} ${directory}`);
|
||||
} catch (error) {
|
||||
throw new RepopackError(`Failed to clone repository: ${(error as Error).message}`);
|
||||
throw new RepomixError(`Failed to clone repository: ${(error as Error).message}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -99,6 +99,6 @@ const copyOutputToCurrentDirectory = async (
|
||||
logger.trace(`Copying output file from: ${sourcePath} to: ${targetPath}`);
|
||||
await fs.copyFile(sourcePath, targetPath);
|
||||
} catch (error) {
|
||||
throw new RepopackError(`Failed to copy output file: ${(error as Error).message}`);
|
||||
throw new RepomixError(`Failed to copy output file: ${(error as Error).message}`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import path from 'node:path';
|
||||
import pc from 'picocolors';
|
||||
import type { RepopackConfigMerged } from '../config/configTypes.js';
|
||||
import type { RepomixConfigMerged } from '../config/configTypes.js';
|
||||
import type { SuspiciousFileResult } from '../core/security/securityCheck.js';
|
||||
import { logger } from '../shared/logger.js';
|
||||
|
||||
@@ -10,7 +10,7 @@ export const printSummary = (
|
||||
totalTokens: number,
|
||||
outputPath: string,
|
||||
suspiciousFilesResults: SuspiciousFileResult[],
|
||||
config: RepopackConfigMerged,
|
||||
config: RepomixConfigMerged,
|
||||
) => {
|
||||
let securityCheckMessage = '';
|
||||
if (config.security.enableSecurityCheck) {
|
||||
@@ -35,7 +35,7 @@ export const printSummary = (
|
||||
export const printSecurityCheck = (
|
||||
rootDir: string,
|
||||
suspiciousFilesResults: SuspiciousFileResult[],
|
||||
config: RepopackConfigMerged,
|
||||
config: RepomixConfigMerged,
|
||||
) => {
|
||||
if (!config.security.enableSecurityCheck) {
|
||||
return;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import process from 'node:process';
|
||||
import { type OptionValues, program } from 'commander';
|
||||
import pc from 'picocolors';
|
||||
import type { RepopackOutputStyle } from '../config/configTypes.js';
|
||||
import type { RepomixOutputStyle } from '../config/configTypes.js';
|
||||
import { getVersion } from '../core/file/packageJsonParse.js';
|
||||
import { handleError } from '../shared/errorHandle.js';
|
||||
import { logger } from '../shared/logger.js';
|
||||
@@ -19,7 +19,7 @@ export interface CliOptions extends OptionValues {
|
||||
verbose?: boolean;
|
||||
topFilesLen?: number;
|
||||
outputShowLineNumbers?: boolean;
|
||||
style?: RepopackOutputStyle;
|
||||
style?: RepomixOutputStyle;
|
||||
init?: boolean;
|
||||
global?: boolean;
|
||||
remote?: string;
|
||||
@@ -30,7 +30,7 @@ export async function run() {
|
||||
const version = await getVersion();
|
||||
|
||||
program
|
||||
.description('Repopack - Pack your repository into a single AI-friendly file')
|
||||
.description('Repomix - Pack your repository into a single AI-friendly file')
|
||||
.arguments('[directory]')
|
||||
.option('-v, --version', 'show version information')
|
||||
.option('-o, --output <file>', 'specify the output file name')
|
||||
@@ -41,7 +41,7 @@ export async function run() {
|
||||
.option('--output-show-line-numbers', 'add line numbers to each line in the output')
|
||||
.option('--style <type>', 'specify the output style (plain, xml, markdown)')
|
||||
.option('--verbose', 'enable verbose logging for detailed output')
|
||||
.option('--init', 'initialize a new repopack.config.json file')
|
||||
.option('--init', 'initialize a new repomix.config.json file')
|
||||
.option('--global', 'use global configuration (only applicable with --init)')
|
||||
.option('--remote <url>', 'process a remote Git repository')
|
||||
.action((directory = '.', options: CliOptions = {}) => executeAction(directory, process.cwd(), options));
|
||||
@@ -61,7 +61,7 @@ const executeAction = async (directory: string, cwd: string, options: CliOptions
|
||||
}
|
||||
|
||||
const version = await getVersion();
|
||||
logger.log(pc.dim(`\n📦 Repopack v${version}\n`));
|
||||
logger.log(pc.dim(`\n📦 Repomix v${version}\n`));
|
||||
|
||||
if (options.init) {
|
||||
await runInitAction(cwd, options.global || false);
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import * as fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { RepopackError } from '../shared/errorHandle.js';
|
||||
import { RepomixError } from '../shared/errorHandle.js';
|
||||
import { logger } from '../shared/logger.js';
|
||||
import type { RepopackConfigCli, RepopackConfigFile, RepopackConfigMerged } from './configTypes.js';
|
||||
import { RepopackConfigValidationError, validateConfig } from './configValidate.js';
|
||||
import type { RepomixConfigCli, RepomixConfigFile, RepomixConfigMerged } from './configTypes.js';
|
||||
import { RepomixConfigValidationError, validateConfig } from './configValidate.js';
|
||||
import { defaultConfig, defaultFilePathMap } from './defaultConfig.js';
|
||||
import { getGlobalDirectory } from './globalDirectory.js';
|
||||
|
||||
const defaultConfigPath = 'repopack.config.json';
|
||||
const defaultConfigPath = 'repomix.config.json';
|
||||
|
||||
const getGlobalConfigPath = () => {
|
||||
return path.join(getGlobalDirectory(), 'repopack.config.json');
|
||||
return path.join(getGlobalDirectory(), 'repomix.config.json');
|
||||
};
|
||||
|
||||
export const loadFileConfig = async (rootDir: string, argConfigPath: string | null): Promise<RepopackConfigFile> => {
|
||||
export const loadFileConfig = async (rootDir: string, argConfigPath: string | null): Promise<RepomixConfigFile> => {
|
||||
let useDefaultConfig = false;
|
||||
let configPath = argConfigPath;
|
||||
if (!configPath) {
|
||||
@@ -50,38 +50,38 @@ export const loadFileConfig = async (rootDir: string, argConfigPath: string | nu
|
||||
}
|
||||
|
||||
logger.note(
|
||||
`No custom config found at ${configPath} or global config at ${globalConfigPath}.\nYou can add a config file for additional settings. Please check https://github.com/yamadashy/repopack for more information.`,
|
||||
`No custom config found at ${configPath} or global config at ${globalConfigPath}.\nYou can add a config file for additional settings. Please check https://github.com/yamadashy/repomix for more information.`,
|
||||
);
|
||||
return {};
|
||||
}
|
||||
throw new RepopackError(`Config file not found at ${configPath}`);
|
||||
throw new RepomixError(`Config file not found at ${configPath}`);
|
||||
};
|
||||
|
||||
const loadAndValidateConfig = async (filePath: string): Promise<RepopackConfigFile> => {
|
||||
const loadAndValidateConfig = async (filePath: string): Promise<RepomixConfigFile> => {
|
||||
try {
|
||||
const fileContent = await fs.readFile(filePath, 'utf-8');
|
||||
const config = JSON.parse(fileContent);
|
||||
validateConfig(config);
|
||||
return config;
|
||||
} catch (error) {
|
||||
if (error instanceof RepopackConfigValidationError) {
|
||||
throw new RepopackError(`Invalid configuration in ${filePath}: ${error.message}`);
|
||||
if (error instanceof RepomixConfigValidationError) {
|
||||
throw new RepomixError(`Invalid configuration in ${filePath}: ${error.message}`);
|
||||
}
|
||||
if (error instanceof SyntaxError) {
|
||||
throw new RepopackError(`Invalid JSON in config file ${filePath}: ${error.message}`);
|
||||
throw new RepomixError(`Invalid JSON in config file ${filePath}: ${error.message}`);
|
||||
}
|
||||
if (error instanceof Error) {
|
||||
throw new RepopackError(`Error loading config from ${filePath}: ${error.message}`);
|
||||
throw new RepomixError(`Error loading config from ${filePath}: ${error.message}`);
|
||||
}
|
||||
throw new RepopackError(`Error loading config from ${filePath}`);
|
||||
throw new RepomixError(`Error loading config from ${filePath}`);
|
||||
}
|
||||
};
|
||||
|
||||
export const mergeConfigs = (
|
||||
cwd: string,
|
||||
fileConfig: RepopackConfigFile,
|
||||
cliConfig: RepopackConfigCli,
|
||||
): RepopackConfigMerged => {
|
||||
fileConfig: RepomixConfigFile,
|
||||
cliConfig: RepomixConfigCli,
|
||||
): RepomixConfigMerged => {
|
||||
// If the output file path is not provided in the config file or CLI, use the default file path for the style
|
||||
if (cliConfig.output?.filePath == null && fileConfig.output?.filePath == null) {
|
||||
const style = cliConfig.output?.style || fileConfig.output?.style || defaultConfig.output.style;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export type RepopackOutputStyle = 'plain' | 'xml' | 'markdown';
|
||||
export type RepomixOutputStyle = 'plain' | 'xml' | 'markdown';
|
||||
|
||||
interface RepopackConfigBase {
|
||||
interface RepomixConfigBase {
|
||||
output?: {
|
||||
filePath?: string;
|
||||
style?: RepopackOutputStyle;
|
||||
style?: RepomixOutputStyle;
|
||||
headerText?: string;
|
||||
instructionFilePath?: string;
|
||||
removeComments?: boolean;
|
||||
@@ -22,10 +22,10 @@ interface RepopackConfigBase {
|
||||
};
|
||||
}
|
||||
|
||||
export type RepopackConfigDefault = RepopackConfigBase & {
|
||||
export type RepomixConfigDefault = RepomixConfigBase & {
|
||||
output: {
|
||||
filePath: string;
|
||||
style: RepopackOutputStyle;
|
||||
style: RepomixOutputStyle;
|
||||
headerText?: string;
|
||||
instructionFilePath?: string;
|
||||
removeComments: boolean;
|
||||
@@ -44,12 +44,12 @@ export type RepopackConfigDefault = RepopackConfigBase & {
|
||||
};
|
||||
};
|
||||
|
||||
export type RepopackConfigFile = RepopackConfigBase;
|
||||
export type RepomixConfigFile = RepomixConfigBase;
|
||||
|
||||
export type RepopackConfigCli = RepopackConfigBase;
|
||||
export type RepomixConfigCli = RepomixConfigBase;
|
||||
|
||||
export type RepopackConfigMerged = RepopackConfigDefault &
|
||||
RepopackConfigFile &
|
||||
RepopackConfigCli & {
|
||||
export type RepomixConfigMerged = RepomixConfigDefault &
|
||||
RepomixConfigFile &
|
||||
RepomixConfigCli & {
|
||||
cwd: string;
|
||||
};
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
import { RepopackError } from '../shared/errorHandle.js';
|
||||
import type { RepopackConfigFile } from './configTypes.js';
|
||||
import { RepomixError } from '../shared/errorHandle.js';
|
||||
import type { RepomixConfigFile } from './configTypes.js';
|
||||
|
||||
export class RepopackConfigValidationError extends RepopackError {
|
||||
export class RepomixConfigValidationError extends RepomixError {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'RepopackConfigValidationError';
|
||||
this.name = 'RepomixConfigValidationError';
|
||||
}
|
||||
}
|
||||
|
||||
export function validateConfig(config: unknown): asserts config is RepopackConfigFile {
|
||||
export function validateConfig(config: unknown): asserts config is RepomixConfigFile {
|
||||
if (typeof config !== 'object' || config == null) {
|
||||
throw new RepopackConfigValidationError('Configuration must be an object');
|
||||
throw new RepomixConfigValidationError('Configuration must be an object');
|
||||
}
|
||||
|
||||
const { output, ignore, security } = config as Partial<RepopackConfigFile>;
|
||||
const { output, ignore, security } = config as Partial<RepomixConfigFile>;
|
||||
|
||||
// Validate output
|
||||
if (output !== undefined) {
|
||||
if (typeof output !== 'object' || output == null) {
|
||||
throw new RepopackConfigValidationError('output must be an object');
|
||||
throw new RepomixConfigValidationError('output must be an object');
|
||||
}
|
||||
|
||||
const { filePath, headerText, style } = output;
|
||||
if (filePath !== undefined && typeof filePath !== 'string') {
|
||||
throw new RepopackConfigValidationError('output.filePath must be a string');
|
||||
throw new RepomixConfigValidationError('output.filePath must be a string');
|
||||
}
|
||||
if (headerText !== undefined && typeof headerText !== 'string') {
|
||||
throw new RepopackConfigValidationError('output.headerText must be a string');
|
||||
throw new RepomixConfigValidationError('output.headerText must be a string');
|
||||
}
|
||||
if (style !== undefined) {
|
||||
if (typeof style !== 'string') {
|
||||
throw new RepopackConfigValidationError('output.style must be a string');
|
||||
throw new RepomixConfigValidationError('output.style must be a string');
|
||||
}
|
||||
if (style !== 'plain' && style !== 'xml' && style !== 'markdown') {
|
||||
throw new RepopackConfigValidationError('output.style must be either "plain", "xml" or "markdown"');
|
||||
throw new RepomixConfigValidationError('output.style must be either "plain", "xml" or "markdown"');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,19 +41,19 @@ export function validateConfig(config: unknown): asserts config is RepopackConfi
|
||||
// Validate ignore
|
||||
if (ignore !== undefined) {
|
||||
if (typeof ignore !== 'object' || ignore == null) {
|
||||
throw new RepopackConfigValidationError('ignore must be an object');
|
||||
throw new RepomixConfigValidationError('ignore must be an object');
|
||||
}
|
||||
|
||||
const { useDefaultPatterns, customPatterns } = ignore;
|
||||
if (useDefaultPatterns !== undefined && typeof useDefaultPatterns !== 'boolean') {
|
||||
throw new RepopackConfigValidationError('ignore.useDefaultPatterns must be a boolean');
|
||||
throw new RepomixConfigValidationError('ignore.useDefaultPatterns must be a boolean');
|
||||
}
|
||||
if (customPatterns !== undefined) {
|
||||
if (!Array.isArray(customPatterns)) {
|
||||
throw new RepopackConfigValidationError('ignore.customPatterns must be an array');
|
||||
throw new RepomixConfigValidationError('ignore.customPatterns must be an array');
|
||||
}
|
||||
if (!customPatterns.every((pattern) => typeof pattern === 'string')) {
|
||||
throw new RepopackConfigValidationError('All items in ignore.customPatterns must be strings');
|
||||
throw new RepomixConfigValidationError('All items in ignore.customPatterns must be strings');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,12 +61,12 @@ export function validateConfig(config: unknown): asserts config is RepopackConfi
|
||||
// Validate security
|
||||
if (security !== undefined) {
|
||||
if (typeof security !== 'object' || security == null) {
|
||||
throw new RepopackConfigValidationError('security must be an object');
|
||||
throw new RepomixConfigValidationError('security must be an object');
|
||||
}
|
||||
|
||||
const { enableSecurityCheck } = security;
|
||||
if (enableSecurityCheck !== undefined && typeof enableSecurityCheck !== 'boolean') {
|
||||
throw new RepopackConfigValidationError('security.enableSecurityCheck must be a boolean');
|
||||
throw new RepomixConfigValidationError('security.enableSecurityCheck must be a boolean');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { RepopackConfigDefault, RepopackOutputStyle } from './configTypes.js';
|
||||
import type { RepomixConfigDefault, RepomixOutputStyle } from './configTypes.js';
|
||||
|
||||
export const defaultFilePathMap: Record<RepopackOutputStyle, string> = {
|
||||
plain: 'repopack-output.txt',
|
||||
markdown: 'repopack-output.md',
|
||||
xml: 'repopack-output.xml',
|
||||
export const defaultFilePathMap: Record<RepomixOutputStyle, string> = {
|
||||
plain: 'repomix-output.txt',
|
||||
markdown: 'repomix-output.md',
|
||||
xml: 'repomix-output.xml',
|
||||
};
|
||||
|
||||
export const defaultConfig: RepopackConfigDefault = {
|
||||
export const defaultConfig: RepomixConfigDefault = {
|
||||
output: {
|
||||
filePath: defaultFilePathMap.plain,
|
||||
style: 'plain',
|
||||
|
||||
@@ -118,8 +118,8 @@ export const defaultIgnoreList = [
|
||||
'tmp/**',
|
||||
'temp/**',
|
||||
|
||||
// repopack output
|
||||
'repopack-output.txt',
|
||||
// repomix output
|
||||
'repomix-output.txt',
|
||||
|
||||
// Essential Python-related entries
|
||||
'**/__pycache__/**',
|
||||
|
||||
@@ -4,12 +4,12 @@ import path from 'node:path';
|
||||
export const getGlobalDirectory = () => {
|
||||
if (process.platform === 'win32') {
|
||||
const localAppData = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');
|
||||
return path.join(localAppData, 'Repopack');
|
||||
return path.join(localAppData, 'Repomix');
|
||||
}
|
||||
|
||||
if (process.env.XDG_CONFIG_HOME) {
|
||||
return path.join(process.env.XDG_CONFIG_HOME, 'repopack');
|
||||
return path.join(process.env.XDG_CONFIG_HOME, 'repomix');
|
||||
}
|
||||
|
||||
return path.join(os.homedir(), '.config', 'repopack');
|
||||
return path.join(os.homedir(), '.config', 'repomix');
|
||||
};
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import pMap from 'p-map';
|
||||
import type { RepopackConfigMerged } from '../../config/configTypes.js';
|
||||
import type { RepomixConfigMerged } from '../../config/configTypes.js';
|
||||
import { getProcessConcurrency } from '../../shared/processConcurrency.js';
|
||||
import { getFileManipulator } from './fileManipulate.js';
|
||||
import type { ProcessedFile, RawFile } from './fileTypes.js';
|
||||
|
||||
export const processFiles = async (rawFiles: RawFile[], config: RepopackConfigMerged): Promise<ProcessedFile[]> => {
|
||||
export const processFiles = async (rawFiles: RawFile[], config: RepomixConfigMerged): Promise<ProcessedFile[]> => {
|
||||
return pMap(
|
||||
rawFiles,
|
||||
async (rawFile) => ({
|
||||
@@ -20,7 +20,7 @@ export const processFiles = async (rawFiles: RawFile[], config: RepopackConfigMe
|
||||
export const processContent = async (
|
||||
content: string,
|
||||
filePath: string,
|
||||
config: RepopackConfigMerged,
|
||||
config: RepomixConfigMerged,
|
||||
): Promise<string> => {
|
||||
let processedContent = content;
|
||||
const manipulator = getFileManipulator(filePath);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { globby } from 'globby';
|
||||
import type { RepopackConfigMerged } from '../../config/configTypes.js';
|
||||
import type { RepomixConfigMerged } from '../../config/configTypes.js';
|
||||
import { defaultIgnoreList } from '../../config/defaultIgnore.js';
|
||||
import { logger } from '../../shared/logger.js';
|
||||
import { sortPaths } from './filePathSort.js';
|
||||
|
||||
export const searchFiles = async (rootDir: string, config: RepopackConfigMerged): Promise<string[]> => {
|
||||
export const searchFiles = async (rootDir: string, config: RepomixConfigMerged): Promise<string[]> => {
|
||||
const includePatterns = config.include.length > 0 ? config.include : ['**/*'];
|
||||
|
||||
try {
|
||||
@@ -53,19 +53,19 @@ export const parseIgnoreContent = (content: string): string[] => {
|
||||
}, []);
|
||||
};
|
||||
|
||||
export const getIgnoreFilePatterns = async (config: RepopackConfigMerged): Promise<string[]> => {
|
||||
export const getIgnoreFilePatterns = async (config: RepomixConfigMerged): Promise<string[]> => {
|
||||
const ignoreFilePatterns: string[] = [];
|
||||
|
||||
if (config.ignore.useGitignore) {
|
||||
ignoreFilePatterns.push('**/.gitignore');
|
||||
}
|
||||
|
||||
ignoreFilePatterns.push('**/.repopackignore');
|
||||
ignoreFilePatterns.push('**/.repomixignore');
|
||||
|
||||
return ignoreFilePatterns;
|
||||
};
|
||||
|
||||
export const getIgnorePatterns = async (rootDir: string, config: RepopackConfigMerged): Promise<string[]> => {
|
||||
export const getIgnorePatterns = async (rootDir: string, config: RepomixConfigMerged): Promise<string[]> => {
|
||||
const ignorePatterns = new Set<string>();
|
||||
|
||||
// Add default ignore patterns
|
||||
@@ -76,7 +76,7 @@ export const getIgnorePatterns = async (rootDir: string, config: RepopackConfigM
|
||||
}
|
||||
}
|
||||
|
||||
// Add repopack output file
|
||||
// Add repomix output file
|
||||
if (config.output.filePath) {
|
||||
logger.trace('Adding output file to ignore patterns:', config.output.filePath);
|
||||
ignorePatterns.add(config.output.filePath);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import Handlebars from 'handlebars';
|
||||
import type { RepopackConfigMerged } from '../../config/configTypes.js';
|
||||
import { RepopackError } from '../../shared/errorHandle.js';
|
||||
import type { RepomixConfigMerged } from '../../config/configTypes.js';
|
||||
import { RepomixError } from '../../shared/errorHandle.js';
|
||||
import { generateTreeString } from '../file/fileTreeGenerate.js';
|
||||
import type { ProcessedFile } from '../file/fileTypes.js';
|
||||
import type { OutputGeneratorContext } from './outputGeneratorTypes.js';
|
||||
@@ -38,7 +38,7 @@ const createRenderContext = (outputGeneratorContext: OutputGeneratorContext) =>
|
||||
|
||||
export const generateOutput = async (
|
||||
rootDir: string,
|
||||
config: RepopackConfigMerged,
|
||||
config: RepomixConfigMerged,
|
||||
processedFiles: ProcessedFile[],
|
||||
allFilePaths: string[],
|
||||
): Promise<string> => {
|
||||
@@ -63,7 +63,7 @@ export const generateOutput = async (
|
||||
|
||||
export const buildOutputGeneratorContext = async (
|
||||
rootDir: string,
|
||||
config: RepopackConfigMerged,
|
||||
config: RepomixConfigMerged,
|
||||
allFilePaths: string[],
|
||||
processedFiles: ProcessedFile[],
|
||||
): Promise<OutputGeneratorContext> => {
|
||||
@@ -74,7 +74,7 @@ export const buildOutputGeneratorContext = async (
|
||||
try {
|
||||
repositoryInstruction = await fs.readFile(instructionPath, 'utf-8');
|
||||
} catch {
|
||||
throw new RepopackError(`Instruction file not found at ${instructionPath}`);
|
||||
throw new RepomixError(`Instruction file not found at ${instructionPath}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { RepopackConfigMerged } from '../../config/configTypes.js';
|
||||
import type { RepomixConfigMerged } from '../../config/configTypes.js';
|
||||
import type { ProcessedFile } from '../file/fileTypes.js';
|
||||
|
||||
export interface OutputGeneratorContext {
|
||||
generationDate: string;
|
||||
treeString: string;
|
||||
processedFiles: ProcessedFile[];
|
||||
config: RepopackConfigMerged;
|
||||
config: RepomixConfigMerged;
|
||||
instruction: string;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { RepopackConfigMerged } from '../../config/configTypes.js';
|
||||
import type { RepomixConfigMerged } from '../../config/configTypes.js';
|
||||
|
||||
export const generateHeader = (generationDate: string): string => {
|
||||
return `
|
||||
This file is a merged representation of the entire codebase, combining all repository files into a single document.
|
||||
Generated by Repopack on: ${generationDate}
|
||||
Generated by Repomix on: ${generationDate}
|
||||
`.trim();
|
||||
};
|
||||
|
||||
@@ -24,7 +24,7 @@ The content is organized as follows:
|
||||
`.trim();
|
||||
};
|
||||
|
||||
export const generateSummaryUsageGuidelines = (config: RepopackConfigMerged, repositoryInstruction: string): string => {
|
||||
export const generateSummaryUsageGuidelines = (config: RepomixConfigMerged, repositoryInstruction: string): string => {
|
||||
return `
|
||||
- This file should be treated as read-only. Any changes should be made to the
|
||||
original repository files, not this packed version.
|
||||
@@ -37,9 +37,9 @@ ${repositoryInstruction ? '- Pay special attention to the Repository Instruction
|
||||
`.trim();
|
||||
};
|
||||
|
||||
export const generateSummaryNotes = (config: RepopackConfigMerged): string => {
|
||||
export const generateSummaryNotes = (config: RepomixConfigMerged): string => {
|
||||
return `
|
||||
- Some files may have been excluded based on .gitignore rules and Repopack's
|
||||
- Some files may have been excluded based on .gitignore rules and Repomix's
|
||||
configuration.
|
||||
- Binary files are not included in this packed representation. Please refer to
|
||||
the Repository Structure section for a complete list of file paths, including
|
||||
@@ -51,6 +51,6 @@ ${config.output.showLineNumbers ? '- Line numbers have been added to the beginni
|
||||
|
||||
export const generateSummaryAdditionalInfo = (): string => {
|
||||
return `
|
||||
For more information about Repopack, visit: https://github.com/yamadashy/repopack
|
||||
For more information about Repomix, visit: https://github.com/yamadashy/repomix
|
||||
`.trim();
|
||||
};
|
||||
|
||||
@@ -3,10 +3,10 @@ import path from 'node:path';
|
||||
import { setTimeout } from 'node:timers/promises';
|
||||
import pMap from 'p-map';
|
||||
import pc from 'picocolors';
|
||||
import type { RepopackConfigMerged } from '../config/configTypes.js';
|
||||
import type { RepomixConfigMerged } from '../config/configTypes.js';
|
||||
import { logger } from '../shared/logger.js';
|
||||
import { getProcessConcurrency } from '../shared/processConcurrency.js';
|
||||
import type { RepopackProgressCallback } from '../shared/types.js';
|
||||
import type { RepomixProgressCallback } from '../shared/types.js';
|
||||
import { collectFiles as defaultCollectFiles } from './file/fileCollect.js';
|
||||
import { processFiles as defaultProcessFiles } from './file/fileProcess.js';
|
||||
import { searchFiles as defaultSearchFiles } from './file/fileSearch.js';
|
||||
@@ -33,8 +33,8 @@ export interface PackResult {
|
||||
|
||||
export const pack = async (
|
||||
rootDir: string,
|
||||
config: RepopackConfigMerged,
|
||||
progressCallback: RepopackProgressCallback = () => {},
|
||||
config: RepomixConfigMerged,
|
||||
progressCallback: RepomixProgressCallback = () => {},
|
||||
deps: PackDependencies = {
|
||||
searchFiles: defaultSearchFiles,
|
||||
collectFiles: defaultCollectFiles,
|
||||
|
||||
@@ -6,7 +6,7 @@ import pMap from 'p-map';
|
||||
import pc from 'picocolors';
|
||||
import { logger } from '../../shared/logger.js';
|
||||
import { getProcessConcurrency } from '../../shared/processConcurrency.js';
|
||||
import type { RepopackProgressCallback } from '../../shared/types.js';
|
||||
import type { RepomixProgressCallback } from '../../shared/types.js';
|
||||
import type { RawFile } from '../file/fileTypes.js';
|
||||
|
||||
export interface SuspiciousFileResult {
|
||||
@@ -16,7 +16,7 @@ export interface SuspiciousFileResult {
|
||||
|
||||
export const runSecurityCheck = async (
|
||||
rawFiles: RawFile[],
|
||||
progressCallback: RepopackProgressCallback = () => {},
|
||||
progressCallback: RepomixProgressCallback = () => {},
|
||||
): Promise<SuspiciousFileResult[]> => {
|
||||
const secretLintConfig = createSecretLintConfig();
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export { pack } from './core/packager.js';
|
||||
export type { RepopackConfigFile as RepopackConfig } from './config/configTypes.js';
|
||||
export type { RepomixConfigFile as RepomixConfig } from './config/configTypes.js';
|
||||
export { run as cli } from './cli/cliRun.js';
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { logger } from './logger.js';
|
||||
|
||||
export class RepopackError extends Error {
|
||||
export class RepomixError extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
this.name = 'RepopackError';
|
||||
this.name = 'RepomixError';
|
||||
}
|
||||
}
|
||||
|
||||
export const handleError = (error: unknown): void => {
|
||||
if (error instanceof RepopackError) {
|
||||
if (error instanceof RepomixError) {
|
||||
logger.error(`Error: ${error.message}`);
|
||||
} else if (error instanceof Error) {
|
||||
logger.error(`Unexpected error: ${error.message}`);
|
||||
@@ -17,5 +17,5 @@ export const handleError = (error: unknown): void => {
|
||||
logger.error('An unknown error occurred');
|
||||
}
|
||||
|
||||
logger.info('For more help, please visit: https://github.com/yamadashy/repopack/issues');
|
||||
logger.info('For more help, please visit: https://github.com/yamadashy/repomix/issues');
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
export type RepopackProgressCallback = (message: string) => void;
|
||||
export type RepomixProgressCallback = (message: string) => void;
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('initAction', () => {
|
||||
|
||||
await createConfigFile('/test/dir', false);
|
||||
|
||||
const configPath = path.resolve('/test/dir/repopack.config.json');
|
||||
const configPath = path.resolve('/test/dir/repomix.config.json');
|
||||
|
||||
console.log('configPath', configPath);
|
||||
|
||||
@@ -45,11 +45,11 @@ describe('initAction', () => {
|
||||
outputStyle: 'plain',
|
||||
});
|
||||
vi.mocked(prompts.confirm).mockResolvedValue(true);
|
||||
vi.mocked(getGlobalDirectory).mockImplementation(() => '/global/repopack');
|
||||
vi.mocked(getGlobalDirectory).mockImplementation(() => '/global/repomix');
|
||||
|
||||
await createConfigFile('/test/dir', true);
|
||||
|
||||
const configPath = path.resolve('/global/repopack/repopack.config.json');
|
||||
const configPath = path.resolve('/global/repomix/repomix.config.json');
|
||||
|
||||
expect(fs.mkdir).toHaveBeenCalledWith(path.dirname(configPath), { recursive: true });
|
||||
expect(fs.writeFile).toHaveBeenCalledWith(configPath, expect.stringContaining('"filePath": "global-output.txt"'));
|
||||
@@ -93,20 +93,20 @@ describe('initAction', () => {
|
||||
});
|
||||
|
||||
describe('createIgnoreFile', () => {
|
||||
it('should not create a new .repopackignore file when global flag is set', async () => {
|
||||
it('should not create a new .repomixignore file when global flag is set', async () => {
|
||||
const result = await createIgnoreFile('/test/dir', true);
|
||||
|
||||
expect(result).toBe(false);
|
||||
expect(fs.writeFile).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should create a new .repopackignore file when one does not exist', async () => {
|
||||
it('should create a new .repomixignore file when one does not exist', async () => {
|
||||
vi.mocked(fs.access).mockRejectedValue(new Error('File does not exist'));
|
||||
vi.mocked(prompts.confirm).mockResolvedValue(true);
|
||||
|
||||
await createIgnoreFile('/test/dir', false);
|
||||
|
||||
const ignorePath = path.resolve('/test/dir/.repopackignore');
|
||||
const ignorePath = path.resolve('/test/dir/.repomixignore');
|
||||
|
||||
expect(fs.writeFile).toHaveBeenCalledWith(
|
||||
ignorePath,
|
||||
@@ -114,7 +114,7 @@ describe('initAction', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should prompt to overwrite when .repopackignore file already exists', async () => {
|
||||
it('should prompt to overwrite when .repomixignore file already exists', async () => {
|
||||
vi.mocked(fs.access).mockResolvedValue(undefined);
|
||||
vi.mocked(prompts.confirm)
|
||||
.mockResolvedValueOnce(true) // First call for creating the file
|
||||
@@ -138,7 +138,7 @@ describe('initAction', () => {
|
||||
expect(fs.writeFile).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should return false when user chooses not to create .repopackignore', async () => {
|
||||
it('should return false when user chooses not to create .repomixignore', async () => {
|
||||
vi.mocked(prompts.confirm).mockResolvedValue(false);
|
||||
|
||||
const result = await createIgnoreFile('/test/dir', false);
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
import { beforeEach, describe, expect, test, vi } from 'vitest';
|
||||
import { loadFileConfig, mergeConfigs } from '../../src/config/configLoad.js';
|
||||
import type { RepopackConfigCli, RepopackConfigFile } from '../../src/config/configTypes.js';
|
||||
import type { RepomixConfigCli, RepomixConfigFile } from '../../src/config/configTypes.js';
|
||||
import { getGlobalDirectory } from '../../src/config/globalDirectory.js';
|
||||
import { logger } from '../../src/shared/logger.js';
|
||||
|
||||
@@ -43,7 +43,7 @@ describe('configLoad', () => {
|
||||
output: { filePath: 'global-output.txt' },
|
||||
ignore: { useDefaultPatterns: false },
|
||||
};
|
||||
vi.mocked(getGlobalDirectory).mockReturnValue('/global/repopack');
|
||||
vi.mocked(getGlobalDirectory).mockReturnValue('/global/repomix');
|
||||
vi.mocked(fs.stat)
|
||||
.mockRejectedValueOnce(new Error('File not found')) // Local config
|
||||
.mockResolvedValueOnce({ isFile: () => true } as Stats); // Global config
|
||||
@@ -51,12 +51,12 @@ describe('configLoad', () => {
|
||||
|
||||
const result = await loadFileConfig(process.cwd(), null);
|
||||
expect(result).toEqual(mockGlobalConfig);
|
||||
expect(fs.readFile).toHaveBeenCalledWith(path.join('/global/repopack', 'repopack.config.json'), 'utf-8');
|
||||
expect(fs.readFile).toHaveBeenCalledWith(path.join('/global/repomix', 'repomix.config.json'), 'utf-8');
|
||||
});
|
||||
|
||||
test('should return an empty object if no config file is found', async () => {
|
||||
const loggerSpy = vi.spyOn(logger, 'note').mockImplementation(vi.fn());
|
||||
vi.mocked(getGlobalDirectory).mockReturnValue('/global/repopack');
|
||||
vi.mocked(getGlobalDirectory).mockReturnValue('/global/repomix');
|
||||
vi.mocked(fs.stat).mockRejectedValue(new Error('File not found'));
|
||||
|
||||
const result = await loadFileConfig(process.cwd(), null);
|
||||
@@ -75,11 +75,11 @@ describe('configLoad', () => {
|
||||
|
||||
describe('mergeConfigs', () => {
|
||||
test('should correctly merge configs', () => {
|
||||
const fileConfig: RepopackConfigFile = {
|
||||
const fileConfig: RepomixConfigFile = {
|
||||
output: { filePath: 'file-output.txt' },
|
||||
ignore: { useDefaultPatterns: true, customPatterns: ['file-ignore'] },
|
||||
};
|
||||
const cliConfig: RepopackConfigCli = {
|
||||
const cliConfig: RepomixConfigCli = {
|
||||
output: { filePath: 'cli-output.txt' },
|
||||
ignore: { customPatterns: ['cli-ignore'] },
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import { RepopackConfigValidationError, validateConfig } from '../../src/config/configValidate.js';
|
||||
import { RepomixConfigValidationError, validateConfig } from '../../src/config/configValidate.js';
|
||||
|
||||
describe('configValidate', () => {
|
||||
test('should pass for a valid config', () => {
|
||||
@@ -11,22 +11,22 @@ describe('configValidate', () => {
|
||||
});
|
||||
|
||||
test('should throw for non-object config', () => {
|
||||
expect(() => validateConfig('not an object')).toThrow(RepopackConfigValidationError);
|
||||
expect(() => validateConfig('not an object')).toThrow(RepomixConfigValidationError);
|
||||
});
|
||||
|
||||
test('should throw for invalid output.filePath', () => {
|
||||
const invalidConfig = { output: { filePath: 123 } };
|
||||
expect(() => validateConfig(invalidConfig)).toThrow(RepopackConfigValidationError);
|
||||
expect(() => validateConfig(invalidConfig)).toThrow(RepomixConfigValidationError);
|
||||
});
|
||||
|
||||
test('should throw for invalid ignore.useDefaultPatterns', () => {
|
||||
const invalidConfig = { ignore: { useDefaultPatterns: 'true' } };
|
||||
expect(() => validateConfig(invalidConfig)).toThrow(RepopackConfigValidationError);
|
||||
expect(() => validateConfig(invalidConfig)).toThrow(RepomixConfigValidationError);
|
||||
});
|
||||
|
||||
test('should throw for invalid ignore.customPatterns', () => {
|
||||
const invalidConfig = { ignore: { customPatterns: 'not an array' } };
|
||||
expect(() => validateConfig(invalidConfig)).toThrow(RepopackConfigValidationError);
|
||||
expect(() => validateConfig(invalidConfig)).toThrow(RepomixConfigValidationError);
|
||||
});
|
||||
|
||||
test('should pass for a valid config with output style', () => {
|
||||
@@ -39,13 +39,13 @@ describe('configValidate', () => {
|
||||
|
||||
test('should throw for invalid output.style type', () => {
|
||||
const invalidConfig = { output: { style: 123 } };
|
||||
expect(() => validateConfig(invalidConfig)).toThrow(RepopackConfigValidationError);
|
||||
expect(() => validateConfig(invalidConfig)).toThrow(RepomixConfigValidationError);
|
||||
expect(() => validateConfig(invalidConfig)).toThrow('output.style must be a string');
|
||||
});
|
||||
|
||||
test('should throw for invalid output.style value', () => {
|
||||
const invalidConfig = { output: { style: 'invalid' } };
|
||||
expect(() => validateConfig(invalidConfig)).toThrow(RepopackConfigValidationError);
|
||||
expect(() => validateConfig(invalidConfig)).toThrow(RepomixConfigValidationError);
|
||||
expect(() => validateConfig(invalidConfig)).toThrow('output.style must be either "plain", "xml" or "markdown"');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ describe('globalDirectory', () => {
|
||||
process.env.LOCALAPPDATA = 'C:\\Users\\TestUser\\AppData\\Local';
|
||||
|
||||
const result = getGlobalDirectory();
|
||||
expect(result).toBe(path.join('C:\\Users\\TestUser\\AppData\\Local', 'Repopack'));
|
||||
expect(result).toBe(path.join('C:\\Users\\TestUser\\AppData\\Local', 'Repomix'));
|
||||
});
|
||||
|
||||
test.runIf(isWindows)('should use homedir if LOCALAPPDATA is not set on Windows', () => {
|
||||
@@ -27,7 +27,7 @@ describe('globalDirectory', () => {
|
||||
process.env.LOCALAPPDATA = undefined;
|
||||
|
||||
const result = getGlobalDirectory();
|
||||
expect(result).toBe(path.join('C:\\Users\\TestUser', 'AppData', 'Local', 'Repopack'));
|
||||
expect(result).toBe(path.join('C:\\Users\\TestUser', 'AppData', 'Local', 'Repomix'));
|
||||
});
|
||||
|
||||
test.runIf(isLinux)('should use XDG_CONFIG_HOME on Unix systems if set', () => {
|
||||
@@ -35,7 +35,7 @@ describe('globalDirectory', () => {
|
||||
process.env.XDG_CONFIG_HOME = '/custom/config';
|
||||
|
||||
const result = getGlobalDirectory();
|
||||
expect(result).toBe(path.join('/custom/config', 'repopack'));
|
||||
expect(result).toBe(path.join('/custom/config', 'repomix'));
|
||||
});
|
||||
|
||||
test.runIf(isMac)('should use ~/.config on Unix systems if XDG_CONFIG_HOME is not set', () => {
|
||||
@@ -44,6 +44,6 @@ describe('globalDirectory', () => {
|
||||
process.env.XDG_CONFIG_HOME = undefined;
|
||||
|
||||
const result = getGlobalDirectory();
|
||||
expect(result).toBe(path.join('/Users/TestUser', '.config', 'repopack'));
|
||||
expect(result).toBe(path.join('/Users/TestUser', '.config', 'repomix'));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('fileSearch', () => {
|
||||
});
|
||||
|
||||
describe('getIgnoreFilePaths', () => {
|
||||
test('should return correct paths when .gitignore and .repopackignore exist', async () => {
|
||||
test('should return correct paths when .gitignore and .repomixignore exist', async () => {
|
||||
vi.mocked(fs.access).mockResolvedValue(undefined);
|
||||
const mockConfig = createMockConfig({
|
||||
ignore: {
|
||||
@@ -31,7 +31,7 @@ describe('fileSearch', () => {
|
||||
},
|
||||
});
|
||||
const filePatterns = await getIgnoreFilePatterns(mockConfig);
|
||||
expect(filePatterns).toEqual(['**/.gitignore', '**/.repopackignore']);
|
||||
expect(filePatterns).toEqual(['**/.gitignore', '**/.repomixignore']);
|
||||
});
|
||||
|
||||
test('should not include .gitignore when useGitignore is false', async () => {
|
||||
@@ -44,7 +44,7 @@ describe('fileSearch', () => {
|
||||
},
|
||||
});
|
||||
const filePatterns = await getIgnoreFilePatterns(mockConfig);
|
||||
expect(filePatterns).toEqual(['**/.repopackignore']);
|
||||
expect(filePatterns).toEqual(['**/.repomixignore']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ describe('fileSearch', () => {
|
||||
|
||||
const patterns = await getIgnorePatterns(process.cwd(), mockConfig);
|
||||
|
||||
expect(patterns).toEqual(['repopack-output.txt', '*.custom', 'temp/']);
|
||||
expect(patterns).toEqual(['repomix-output.txt', '*.custom', 'temp/']);
|
||||
});
|
||||
|
||||
test('should combine default and custom patterns', async () => {
|
||||
@@ -144,7 +144,7 @@ node_modules
|
||||
expect.objectContaining({
|
||||
cwd: '/mock/root',
|
||||
ignore: expect.arrayContaining(['*.custom']),
|
||||
ignoreFiles: expect.arrayContaining(['**/.gitignore', '**/.repopackignore']),
|
||||
ignoreFiles: expect.arrayContaining(['**/.gitignore', '**/.repomixignore']),
|
||||
onlyFiles: true,
|
||||
absolute: false,
|
||||
dot: true,
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('packageJsonParse', () => {
|
||||
|
||||
test('getVersion should return correct version from package.json', async () => {
|
||||
const mockPackageJson = {
|
||||
name: 'repopack',
|
||||
name: 'repomix',
|
||||
version: '1.2.3',
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('packageJsonParse', () => {
|
||||
|
||||
test('getVersion should handle missing version in package.json', async () => {
|
||||
const mockPackageJson = {
|
||||
name: 'repopack',
|
||||
name: 'repomix',
|
||||
};
|
||||
|
||||
const loggerSpy = vi.spyOn(logger, 'warn').mockImplementation(vi.fn());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Simple Project
|
||||
|
||||
This is a simple project used for testing Repopack.
|
||||
This is a simple project used for testing Repomix.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "simple-project",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple project for testing Repopack",
|
||||
"description": "A simple project for testing Repomix",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"start": "node src/index.js"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"output": {
|
||||
"filePath": "repopack-output.txt",
|
||||
"filePath": "repomix-output.txt",
|
||||
"headerText": "This repository is simple-project",
|
||||
"removeComments": false,
|
||||
"removeEmptyLines": false,
|
||||
@@ -35,7 +35,7 @@ Usage Guidelines:
|
||||
|
||||
Notes:
|
||||
------
|
||||
- Some files may have been excluded based on .gitignore rules and Repopack's
|
||||
- Some files may have been excluded based on .gitignore rules and Repomix's
|
||||
configuration.
|
||||
- Binary files are not included in this packed representation. Please refer to
|
||||
the Repository Structure section for a complete list of file paths, including
|
||||
@@ -47,28 +47,28 @@ User Provided Header:
|
||||
-----------------------
|
||||
This repository is simple-project
|
||||
|
||||
For more information about Repopack, visit: https://github.com/yamadashy/repopack
|
||||
For more information about Repomix, visit: https://github.com/yamadashy/repomix
|
||||
|
||||
================================================================
|
||||
Repository Structure
|
||||
================================================================
|
||||
resources/
|
||||
.repopackignore
|
||||
.repomixignore
|
||||
data.txt
|
||||
src/
|
||||
index.js
|
||||
utils.js
|
||||
.repopackignore
|
||||
.repomixignore
|
||||
package.json
|
||||
README.md
|
||||
repopack.config.json
|
||||
repomix.config.json
|
||||
|
||||
================================================================
|
||||
Repository Files
|
||||
================================================================
|
||||
|
||||
================
|
||||
File: resources/.repopackignore
|
||||
File: resources/.repomixignore
|
||||
================
|
||||
ignored-data.txt
|
||||
|
||||
@@ -100,7 +100,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
================
|
||||
File: .repopackignore
|
||||
File: .repomixignore
|
||||
================
|
||||
**/build/**
|
||||
|
||||
@@ -110,7 +110,7 @@ File: package.json
|
||||
{
|
||||
"name": "simple-project",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple project for testing Repopack",
|
||||
"description": "A simple project for testing Repomix",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"start": "node src/index.js"
|
||||
@@ -125,7 +125,7 @@ File: README.md
|
||||
================
|
||||
# Simple Project
|
||||
|
||||
This is a simple project used for testing Repopack.
|
||||
This is a simple project used for testing Repomix.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -138,11 +138,11 @@ npm start
|
||||
This will output a greeting message to the console.
|
||||
|
||||
================
|
||||
File: repopack.config.json
|
||||
File: repomix.config.json
|
||||
================
|
||||
{
|
||||
"output": {
|
||||
"filePath": "repopack-output.txt",
|
||||
"filePath": "repomix-output.txt",
|
||||
"headerText": "This repository is simple-project",
|
||||
"removeComments": false,
|
||||
"removeEmptyLines": false,
|
||||
|
||||
@@ -30,7 +30,7 @@ The content is organized as follows:
|
||||
</usage_guidelines>
|
||||
|
||||
<notes>
|
||||
- Some files may have been excluded based on .gitignore rules and Repopack's
|
||||
- Some files may have been excluded based on .gitignore rules and Repomix's
|
||||
configuration.
|
||||
- Binary files are not included in this packed representation. Please refer to
|
||||
the Repository Structure section for a complete list of file paths, including
|
||||
@@ -42,28 +42,28 @@ The content is organized as follows:
|
||||
This repository is simple-project
|
||||
</user_provided_header>
|
||||
|
||||
For more information about Repopack, visit: https://github.com/yamadashy/repopack
|
||||
For more information about Repomix, visit: https://github.com/yamadashy/repomix
|
||||
</additional_info>
|
||||
|
||||
</file_summary>
|
||||
|
||||
<repository_structure>
|
||||
resources/
|
||||
.repopackignore
|
||||
.repomixignore
|
||||
data.txt
|
||||
src/
|
||||
index.js
|
||||
utils.js
|
||||
.repopackignore
|
||||
.repomixignore
|
||||
package.json
|
||||
README.md
|
||||
repopack.config.json
|
||||
repomix.config.json
|
||||
</repository_structure>
|
||||
|
||||
<repository_files>
|
||||
This section contains the contents of the repository's files.
|
||||
|
||||
<file path="resources/.repopackignore">
|
||||
<file path="resources/.repomixignore">
|
||||
ignored-data.txt
|
||||
</file>
|
||||
|
||||
@@ -91,7 +91,7 @@ module.exports = {
|
||||
};
|
||||
</file>
|
||||
|
||||
<file path=".repopackignore">
|
||||
<file path=".repomixignore">
|
||||
**/build/**
|
||||
</file>
|
||||
|
||||
@@ -99,7 +99,7 @@ module.exports = {
|
||||
{
|
||||
"name": "simple-project",
|
||||
"version": "1.0.0",
|
||||
"description": "A simple project for testing Repopack",
|
||||
"description": "A simple project for testing Repomix",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
"start": "node src/index.js"
|
||||
@@ -113,7 +113,7 @@ module.exports = {
|
||||
<file path="README.md">
|
||||
# Simple Project
|
||||
|
||||
This is a simple project used for testing Repopack.
|
||||
This is a simple project used for testing Repomix.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -126,10 +126,10 @@ npm start
|
||||
This will output a greeting message to the console.
|
||||
</file>
|
||||
|
||||
<file path="repopack.config.json">
|
||||
<file path="repomix.config.json">
|
||||
{
|
||||
"output": {
|
||||
"filePath": "repopack-output.txt",
|
||||
"filePath": "repomix-output.txt",
|
||||
"headerText": "This repository is simple-project",
|
||||
"removeComments": false,
|
||||
"removeEmptyLines": false,
|
||||
|
||||
@@ -4,7 +4,7 @@ import path from 'node:path';
|
||||
import process from 'node:process';
|
||||
import { afterEach, beforeEach, describe, expect, test } from 'vitest';
|
||||
import { loadFileConfig, mergeConfigs } from '../../src/config/configLoad.js';
|
||||
import type { RepopackConfigFile, RepopackConfigMerged, RepopackOutputStyle } from '../../src/config/configTypes.js';
|
||||
import type { RepomixConfigFile, RepomixConfigMerged, RepomixOutputStyle } from '../../src/config/configTypes.js';
|
||||
import { pack } from '../../src/core/packager.js';
|
||||
import { isWindows } from '../testing/testUtils.js';
|
||||
|
||||
@@ -27,7 +27,7 @@ describe.runIf(!isWindows)('packager integration', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
// Create a temporary directory for each test
|
||||
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'repopack-test-'));
|
||||
tempDir = await fs.mkdtemp(path.join(os.tmpdir(), 'repomix-test-'));
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -41,11 +41,11 @@ describe.runIf(!isWindows)('packager integration', () => {
|
||||
const expectedOutputPath = path.join(outputsDir, output);
|
||||
const actualOutputPath = path.join(tempDir, output);
|
||||
|
||||
const fileConfig: RepopackConfigFile = await loadFileConfig(inputDir, null);
|
||||
const mergedConfig: RepopackConfigMerged = mergeConfigs(process.cwd(), fileConfig, {
|
||||
const fileConfig: RepomixConfigFile = await loadFileConfig(inputDir, null);
|
||||
const mergedConfig: RepomixConfigMerged = mergeConfigs(process.cwd(), fileConfig, {
|
||||
output: {
|
||||
filePath: actualOutputPath,
|
||||
style: (config.output?.style || 'plain') as RepopackOutputStyle,
|
||||
style: (config.output?.style || 'plain') as RepomixOutputStyle,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -56,8 +56,8 @@ describe.runIf(!isWindows)('packager integration', () => {
|
||||
let actualOutput = await fs.readFile(actualOutputPath, 'utf-8');
|
||||
let expectedOutput = await fs.readFile(expectedOutputPath, 'utf-8');
|
||||
|
||||
actualOutput = actualOutput.replace(/^Generated by Repopack on:.*\n/gm, '');
|
||||
expectedOutput = expectedOutput.replace(/^Generated by Repopack on:.*\n/gm, '');
|
||||
actualOutput = actualOutput.replace(/^Generated by Repomix on:.*\n/gm, '');
|
||||
expectedOutput = expectedOutput.replace(/^Generated by Repomix on:.*\n/gm, '');
|
||||
|
||||
// Compare the outputs
|
||||
expect(actualOutput).toBe(expectedOutput);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import os from 'node:os';
|
||||
import process from 'node:process';
|
||||
import type { RepopackConfigMerged } from '../../src/config/configTypes.js';
|
||||
import type { RepomixConfigMerged } from '../../src/config/configTypes.js';
|
||||
import { defaultConfig } from '../../src/config/defaultConfig.js';
|
||||
|
||||
type DeepPartial<T> = {
|
||||
@@ -13,7 +13,7 @@ type DeepPartial<T> = {
|
||||
: T[P];
|
||||
};
|
||||
|
||||
export const createMockConfig = (config: DeepPartial<RepopackConfigMerged> = {}): RepopackConfigMerged => {
|
||||
export const createMockConfig = (config: DeepPartial<RepomixConfigMerged> = {}): RepomixConfigMerged => {
|
||||
return {
|
||||
cwd: process.cwd(),
|
||||
output: {
|
||||
|
||||
Reference in New Issue
Block a user