Skip to content

Commit 5011e4b

Browse files
committed
fix: Clarify path-filters parameter logic and syntax
1 parent 4619e56 commit 5011e4b

3 files changed

Lines changed: 28 additions & 20 deletions

File tree

src/cli.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -337,21 +337,18 @@ Options:
337337
--cache <path> Custom cache path
338338
--json Output results in JSON format
339339
--path-filters, -f <filters> Filter search results by path patterns (comma-separated)
340-
Top-level comma-separated patterns use OR logic.
341-
Within each pattern, all substrings must match (AND logic).
342-
Supports limited glob syntax compiled to Qdrant filters:
343-
-f "src/**/*.ts" # All .ts files in src
344-
-f "components/*.tsx" # All .tsx in components
340+
Logic:
341+
- Include patterns (no ! prefix): OR logic - matches ANY pattern
342+
- Exclude patterns (! prefix): AND logic - applied globally to exclude ALL matches
343+
- Within each pattern: case-insensitive substring matching, order-independent
344+
Supported: ** (recursive), * (single-level), {a,b} (braces), !prefix (exclude)
345+
Examples:
346+
-f "src/**/*.ts" # src tree only
347+
-f "components/*.tsx" # all .tsx in components
345348
-f "{src,lib}/**/*.js" # .js files in multiple dirs
346-
-f "!.md,!.txt" # Exclude markdown/text files
347-
-f "src/**/*.ts,lib/**/*.ts" # OR logic: either src or lib .ts files
348-
Supported syntax:
349-
** Recursive directories (e.g., src/**/*)
350-
* Single level wildcard (e.g., src/*)
351-
{a,b} Brace expansion for OR (e.g., {src,lib})
352-
! Exclusion prefix (e.g., !*.test.ts)
353-
Note: Uses substring matching, case-insensitive.
354-
Unsupported features ([]) are ignored, ? is treated as a regular character.
349+
-f "!.md,!.txt" # exclude markdown/text files
350+
-f "src/**/*.ts,lib/**/*.ts" # src OR lib .ts files
351+
-f "**/*.ts,!**/*.test.ts" # all .ts excluding tests
355352
--limit, -l <number> Maximum number of search results (default: from config, max 50)
356353
Examples: --limit=30, -l 20
357354
--min-score, -s <number> Minimum similarity score for search results (0-1, default: from config)

src/mcp/http-server.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,23 @@ export class CodebaseHTTPMCPServer {
5656
]).optional()
5757
.describe('Maximum number of results to return (default from config, max 50)'),
5858
filters: z.object({
59-
pathFilters: z.array(z.string()).optional().describe("Filter by path patterns with limited glob support. " +
60-
"Top-level patterns (array elements) use OR logic. Within each pattern, all substrings must match (AND logic). " +
61-
"Supports: ** (recursive), * (single level), {a,b} (brace expansion), ! (exclusion). " +
62-
"Use ! prefix for exclusion. Compiled to Qdrant substring filters (case-insensitive, not strict glob matching). " +
63-
"Examples: ['src/**/*.ts', 'components/*.tsx', '!**/*.test.ts']. " +
64-
"Unsupported features ([]) are ignored, ? is treated as a regular character."),
59+
pathFilters: z.array(z.string()).optional().describe(
60+
"Filter paths using glob-like patterns.\n\n" +
61+
62+
"**Logic:**\n" +
63+
"- Include patterns (no ! prefix): OR logic - matches ANY pattern\n" +
64+
"- Exclude patterns (! prefix): AND logic - applied globally to exclude ALL matches\n" +
65+
"- Within each pattern: case-insensitive substring matching, order-independent, all parts must exist\n\n" +
66+
67+
"**Supported:**\n" +
68+
"- ** (recursive), * (single-level), {a,b} (braces), !prefix (exclude)\n\n" +
69+
70+
"**Examples:**\n" +
71+
"- ['src/**/*.ts'] → src tree only\n" +
72+
"- ['src/**/*.ts', 'lib/**/*.ts'] → src OR lib\n" +
73+
"- ['**/*.ts', '!**/*.test.ts'] → all .ts excluding tests\n" +
74+
"- ['src/{components,utils}/*.ts'] → specific folders"
75+
),
6576
minScore: z.union([
6677
z.coerce.number(),
6778
z.string().transform(s => Number(s))

0 commit comments

Comments
 (0)