Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ This format provides a clean, readable structure that is both human-friendly and
- `--copy`: Additionally copy generated output to system clipboard
- `--remote <url>`: Process a remote Git repository
- `--remote-branch <name>`: Specify the remote branch name, tag, or commit hash (defaults to repository default branch)
- `--no-security-check`: Disable security check
- `--verbose`: Enable verbose logging

Examples:
Expand Down Expand Up @@ -513,6 +514,15 @@ By default, Repomix's security check feature is enabled. You can disable it by s
}
```

Or using the `--no-security-check` command line option:

```bash
repomix --no-security-check
```

> [!NOTE]
> Disabling security checks may expose sensitive information. Use this option with caution and only when necessary, such as when working with test files or documentation that contains example credentials.



## 🤝 Contribution
Expand Down
3 changes: 3 additions & 0 deletions src/cli/actions/defaultAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ const buildCliConfig = (options: CliOptions): RepomixConfigCli => {
if (options.style) {
cliConfig.output = { ...cliConfig.output, style: options.style.toLowerCase() as RepomixOutputStyle };
}
if (options.securityCheck !== undefined) {
cliConfig.security = { enableSecurityCheck: options.securityCheck };
}

try {
return repomixConfigCliSchema.parse(cliConfig);
Expand Down
2 changes: 2 additions & 0 deletions src/cli/cliRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface CliOptions extends OptionValues {
global?: boolean;
remote?: string;
remoteBranch?: string;
securityCheck?: boolean;
}

export const run = async () => {
Expand All @@ -49,6 +50,7 @@ export const run = async () => {
'--remote-branch <name>',
'specify the remote branch name, tag, or commit hash (defaults to repository default branch)',
)
.option('--no-security-check', 'disable security check')
.action((directory = '.', options: CliOptions = {}) => executeAction(directory, process.cwd(), options));

await program.parseAsync(process.argv);
Expand Down
38 changes: 38 additions & 0 deletions tests/cli/actions/defaultAction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,42 @@ describe('defaultAction', () => {

await expect(runDefaultAction('.', process.cwd(), options)).rejects.toThrow('Test error');
});

describe('security check flag', () => {
it('should handle --no-security-check flag', async () => {
const options: CliOptions = {
securityCheck: false,
};

await runDefaultAction('.', process.cwd(), options);

expect(configLoader.mergeConfigs).toHaveBeenCalledWith(
process.cwd(),
expect.anything(),
expect.objectContaining({
security: {
enableSecurityCheck: false,
},
}),
);
});

it('should handle explicit --security-check flag', async () => {
const options: CliOptions = {
securityCheck: true,
};

await runDefaultAction('.', process.cwd(), options);

expect(configLoader.mergeConfigs).toHaveBeenCalledWith(
process.cwd(),
expect.anything(),
expect.objectContaining({
security: {
enableSecurityCheck: true,
},
}),
);
});
});
});
38 changes: 38 additions & 0 deletions tests/cli/cliRun.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,42 @@ describe('cliRun', () => {
expect(defaultAction.runDefaultAction).not.toHaveBeenCalled();
});
});

describe('security check flag', () => {
test('should enable security check by default', async () => {
await executeAction('.', process.cwd(), {});

expect(defaultAction.runDefaultAction).toHaveBeenCalledWith(
'.',
process.cwd(),
expect.not.objectContaining({
securityCheck: false,
}),
);
});

test('should handle --no-security-check flag', async () => {
await executeAction('.', process.cwd(), { securityCheck: false });

expect(defaultAction.runDefaultAction).toHaveBeenCalledWith(
'.',
process.cwd(),
expect.objectContaining({
securityCheck: false,
}),
);
});

test('should handle explicit --security-check flag', async () => {
await executeAction('.', process.cwd(), { securityCheck: true });

expect(defaultAction.runDefaultAction).toHaveBeenCalledWith(
'.',
process.cwd(),
expect.objectContaining({
securityCheck: true,
}),
);
});
});
});