Skip to content

Commit 636b7be

Browse files
committed
Address Copilot review comments on PR #120
- types.ts: make isTemplate optional (isTemplate?: boolean) to keep existing builders/fixtures valid without changes - output.ts: shell-quote groupByTeamPrefix in buildReplayCommand to prevent replay command breakage when the value contains spaces - output.test.ts: add tests for excludeTemplates flag in replay command; update groupByTeamPrefix assertion to reflect new shell-quoting - docs/usage/filtering.md: fix intro count (three → four filtering options); reword template info box to clarify filtering applies in both interactive and non-interactive mode
1 parent 214555e commit 636b7be

4 files changed

Lines changed: 20 additions & 6 deletions

File tree

docs/usage/filtering.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Filtering
22

3-
`github-code-search` provides three pre-query filtering options so you can exclude noise before results ever appear in the TUI or output.
3+
`github-code-search` provides four pre-query filtering options so you can exclude noise before results ever appear in the TUI or output.
44

55
## `--exclude-repositories`
66

@@ -73,7 +73,7 @@ github-code-search "useFeatureFlag" --org fulll --exclude-template-repositories
7373
```
7474

7575
::: info
76-
Template repositories (marked as templates on GitHub) are filtered out in the aggregation step before the TUI is shown. Useful when your organisation uses template repos for boilerplate that should not appear in search results.
76+
Template repositories (marked as templates on GitHub) are filtered out in the aggregation step — both in interactive and non-interactive mode. Useful when your organisation uses template repos for boilerplate that should not appear in search results.
7777
:::
7878

7979
## Combining filters

src/output.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,25 @@ describe("buildReplayCommand", () => {
169169
expect(cmd).not.toContain("--include-archived");
170170
});
171171

172+
it("includes --exclude-template-repositories when excludeTemplates is true", () => {
173+
const groups = [makeGroup("myorg/repoA", ["a.ts"])];
174+
const opts: ReplayOptions = { excludeTemplates: true };
175+
const cmd = buildReplayCommand(groups, QUERY, ORG, new Set(), new Set(), opts);
176+
expect(cmd).toContain("--exclude-template-repositories");
177+
});
178+
179+
it("does not include --exclude-template-repositories when excludeTemplates is false (default)", () => {
180+
const groups = [makeGroup("myorg/repoA", ["a.ts"])];
181+
const opts: ReplayOptions = { excludeTemplates: false };
182+
const cmd = buildReplayCommand(groups, QUERY, ORG, new Set(), new Set(), opts);
183+
expect(cmd).not.toContain("--exclude-template-repositories");
184+
});
185+
172186
it("includes --group-by-team-prefix when groupByTeamPrefix is set", () => {
173187
const groups = [makeGroup("myorg/repoA", ["a.ts"])];
174188
const opts: ReplayOptions = { groupByTeamPrefix: "squad-,chapter-" };
175189
const cmd = buildReplayCommand(groups, QUERY, ORG, new Set(), new Set(), opts);
176-
expect(cmd).toContain("--group-by-team-prefix squad-,chapter-");
190+
expect(cmd).toContain("--group-by-team-prefix 'squad-,chapter-'");
177191
});
178192

179193
it("does not include --group-by-team-prefix when groupByTeamPrefix is empty (default)", () => {
@@ -567,6 +581,6 @@ describe("buildOutput", () => {
567581
groupByTeamPrefix: "squad-",
568582
});
569583
const parsed = JSON.parse(out);
570-
expect(parsed.replayCommand).toContain("--group-by-team-prefix squad-");
584+
expect(parsed.replayCommand).toContain("--group-by-team-prefix 'squad-'");
571585
});
572586
});

src/output.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function buildReplayCommand(
9696
parts.push("--exclude-template-repositories");
9797
}
9898
if (groupByTeamPrefix) {
99-
parts.push(`--group-by-team-prefix ${groupByTeamPrefix}`);
99+
parts.push(`--group-by-team-prefix ${shellQuote(groupByTeamPrefix)}`);
100100
}
101101
if (regexHint) {
102102
parts.push(`--regex-hint ${shellQuote(regexHint)}`);

src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface CodeMatch {
2121
htmlUrl: string;
2222
textMatches: TextMatch[];
2323
archived: boolean;
24-
isTemplate: boolean;
24+
isTemplate?: boolean;
2525
}
2626

2727
export interface RepoGroup {

0 commit comments

Comments
 (0)