-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Codex/add ignorecontent configuration and cli support br7p2k #822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| import { minimatch } from 'minimatch'; | ||
| import pc from 'picocolors'; | ||
| import type { RepomixConfigMerged } from '../../config/configSchema.js'; | ||
| import { logger } from '../../shared/logger.js'; | ||
| import { initTaskRunner } from '../../shared/processConcurrency.js'; | ||
| import type { RepomixProgressCallback } from '../../shared/types.js'; | ||
| import { normalizeGlobPattern } from './fileSearch.js'; | ||
| import type { RawFile } from './fileTypes.js'; | ||
| import type { FileCollectResult, FileCollectTask, SkippedFileInfo } from './workers/fileCollectWorker.js'; | ||
|
|
||
|
|
@@ -28,12 +30,29 @@ export const collectFiles = async ( | |
| workerPath: new URL('./workers/fileCollectWorker.js', import.meta.url).href, | ||
| runtime: 'worker_threads', | ||
| }); | ||
|
|
||
| const shouldSkipContent = (filePath: string, patterns: string[]): boolean => { | ||
| let skip = false; | ||
| for (const pattern of patterns) { | ||
| const normalizedPattern = normalizeGlobPattern(pattern.startsWith('!') ? pattern.slice(1) : pattern); | ||
| if (pattern.startsWith('!')) { | ||
| if (minimatch(filePath, normalizedPattern, { dot: true })) { | ||
| skip = false; | ||
| } | ||
| } else if (minimatch(filePath, normalizedPattern, { dot: true })) { | ||
| skip = true; | ||
| } | ||
| } | ||
| return skip; | ||
| }; | ||
|
Comment on lines
+34
to
+47
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current implementation of const shouldSkipContent = (filePath: string, patterns: string[]): boolean => {
// Negated patterns ("!...") should always take precedence to ensure content is included.
const isExplicitlyIncluded = patterns
.filter((pattern) => pattern.startsWith('!'))
.some((pattern) => minimatch(filePath, normalizeGlobPattern(pattern.slice(1)), { dot: true }));
if (isExplicitlyIncluded) {
return false; // Do not skip content.
}
// If not explicitly included, check if it matches any ignore pattern.
const isIgnored = patterns
.filter((pattern) => !pattern.startsWith('!'))
.some((pattern) => minimatch(filePath, normalizeGlobPattern(pattern), { dot: true }));
return isIgnored;
}; |
||
|
|
||
| const tasks = filePaths.map( | ||
| (filePath) => | ||
| ({ | ||
| filePath, | ||
| rootDir, | ||
| maxFileSize: config.input.maxFileSize, | ||
| skipContent: shouldSkipContent(filePath, config.ignoreContent), | ||
| }) satisfies FileCollectTask, | ||
| ); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| export interface RawFile { | ||
| path: string; | ||
| content: string; | ||
| content?: string; | ||
| } | ||
|
|
||
| export interface ProcessedFile { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,9 +111,10 @@ export const pack = async ( | |
| ); | ||
|
|
||
| // Process files (remove comments, etc.) | ||
| const rawFilesForProcessing = safeRawFiles.filter((file) => file.content !== undefined); | ||
| progressCallback('Processing files...'); | ||
| const processedFiles = await withMemoryLogging('Process Files', () => | ||
| deps.processFiles(safeRawFiles, config, progressCallback), | ||
| deps.processFiles(rawFilesForProcessing, config, progressCallback), | ||
|
Comment on lines
+114
to
+117
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The filtering of progressCallback('Processing files...');
const processedFiles = await withMemoryLogging('Process Files', () =>
deps.processFiles(safeRawFiles, config, progressCallback),
); |
||
| ); | ||
|
|
||
| progressCallback('Generating output...'); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -35,6 +35,7 @@ | |||||
| ## Dateiauswahloptionen | ||||||
| - `--include <patterns>`: Liste der Einschlussmuster (kommagetrennt) | ||||||
| - `-i, --ignore <patterns>`: Zusätzliche Ignoriermuster (kommagetrennt) | ||||||
| - `--ignore-content <patterns>`: Skip file content for matched patterns (comma-separated; prefix with `!` to keep specific paths) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The description for
Suggested change
|
||||||
| - `--no-gitignore`: .gitignore-Datei-Nutzung deaktivieren | ||||||
| - `--no-default-patterns`: Standardmuster deaktivieren | ||||||
|
|
||||||
|
|
@@ -75,6 +76,9 @@ repomix --compress | |||||
| # Spezifische Dateien verarbeiten | ||||||
| repomix --include "src/**/*.ts" --ignore "**/*.test.ts" | ||||||
|
|
||||||
| # Ignore file contents for matching patterns | ||||||
| repomix --ignore-content "components/**,!components/slider/**" | ||||||
|
|
||||||
| # Remote-Repository mit Branch | ||||||
| repomix --remote https://github.com/user/repo/tree/main | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description for
--ignore-contentcould be clearer. "Patterns to include files but skip their content" might be confusing, as this option doesn't handle file inclusion but rather content exclusion for already included files. A more accurate description would focus on skipping content.