Skip to content

Commit a97ecb1

Browse files
authored
Merge branch 'main' into dependabot/bun/knip-6.1.0
2 parents 5ef7da5 + 2d507a6 commit a97ecb1

22 files changed

+803
-80
lines changed

AGENTS.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ src/
7979
aggregate.ts # Result grouping & filtering (applyFiltersAndExclusions)
8080
completions.ts # Pure shell-completion generators: generateCompletion(),
8181
# detectShell(), getCompletionFilePath() — no I/O
82-
group.ts # groupByTeamPrefix — team-prefix grouping logic
82+
group.ts # groupByTeamPrefix, applyTeamPick, rebuildTeamSections,
83+
# flattenTeamSections — team-prefix grouping + pick logic
8384
regex.ts # Pure query parser: isRegexQuery(), buildApiQuery()
8485
# Detects /pattern/ syntax, derives safe API term,
8586
# returns RegExp for local client-side filtering — no I/O
@@ -94,9 +95,11 @@ src/
9495
render/
9596
highlight.ts # Syntax highlighting (language detection + token rules)
9697
filter.ts # FilterStats + buildFilterStats
98+
filter-match.ts # Pure pattern matchers — makeExtractMatcher, makeRepoMatcher
9799
rows.ts # buildRows, rowTerminalLines, isCursorVisible
98100
summary.ts # buildSummary, buildSummaryFull, buildSelectionSummary
99101
selection.ts # applySelectAll, applySelectNone
102+
team-pick.ts # renderTeamPickHeader — pick-mode candidate bar (pure, no I/O)
100103
101104
*.test.ts # Unit tests co-located with source files
102105
test-setup.ts # Global test setup (Bun preload)
@@ -254,3 +257,6 @@ For minor/major releases update `docs/blog/index.md` to add a row in the version
254257
- Shell-integration tests for `install.sh` live in `install.test.bats` and require `bats-core`. Run them with `bun run test:bats`. The CI runs them in a dedicated `test-bats` job using `bats-core/bats-action`.
255258
- `picocolors` is the only styling dependency; do not add `chalk` or similar.
256259
- Keep `knip` clean: every exported symbol must be used; every import must resolve.
260+
- The `--pick-team` option is repeatable (Commander collect function); each assignment resolves one combined section label to a single team. A warning is emitted on stderr when a label is not found.
261+
- `src/render/team-pick.ts` is a pure module (no I/O) and must be consumed only via the `src/render.ts` façade — it is imported **directly** inside `render.ts` for internal use but is not re-exported publicly (knip would flag it).
262+
- `RepoGroup.pickedFrom` (optional field in `src/types.ts`) tracks the combined label a repo was moved from; future split-mode features will use this to offer re-assignment.

CONTRIBUTING.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ src/
3232
aggregate.test.ts # Unit tests for aggregate.ts
3333
completions.ts # Pure shell-completion generators (generateCompletion, detectShell, getCompletionFilePath)
3434
completions.test.ts # Unit tests for completions.ts
35+
group.ts # groupByTeamPrefix, applyTeamPick, rebuildTeamSections, flattenTeamSections
36+
group.test.ts # Unit tests for group.ts
3537
render.ts # Façade: re-exports sub-modules + TUI renderGroups/renderHelpOverlay
3638
render.test.ts # Unit tests for render.ts (rows, filter, selection, rendering)
3739
render/
@@ -43,6 +45,8 @@ src/
4345
rows.ts # Row builder (buildRows, rowTerminalLines, isCursorVisible)
4446
summary.ts # Stats labels (buildSummary, buildSummaryFull, buildSelectionSummary)
4547
selection.ts # Selection mutations (applySelectAll, applySelectNone)
48+
team-pick.ts # Pick-mode candidate bar renderer (renderTeamPickHeader) — pure, no I/O
49+
team-pick.test.ts # Unit tests for team-pick.ts
4650
output.ts # Text (markdown) and JSON output formatters
4751
output.test.ts # Unit tests for output.ts
4852
tui.ts # Interactive keyboard-driven UI (navigation, filter mode, help overlay)
@@ -60,7 +64,7 @@ bun test # TypeScript unit tests (co-located *.test.ts files)
6064
bun run test:bats # Shell-integration tests for install.sh (requires bats-core)
6165
```
6266

63-
TypeScript tests are co-located with their source files and cover the pure functions in `aggregate.ts`, `completions.ts`, `output.ts`, `render.ts`, `render/highlight.ts`, and `upgrade.ts`.
67+
TypeScript tests are co-located with their source files and cover the pure functions in `aggregate.ts`, `completions.ts`, `group.ts`, `output.ts`, `render.ts`, `render/highlight.ts`, `render/team-pick.ts`, and `upgrade.ts`.
6468

6569
Shell-integration tests use [bats-core](https://github.com/bats-core/bats-core). Install it once with:
6670

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@ github-code-search query "useFeatureFlag" --org my-org --group-by-team-prefix pl
8383

8484
Get a team-scoped view of every usage site before refactoring a shared hook or utility.
8585

86+
**Skip template repositories**
87+
88+
```bash
89+
github-code-search query "TODO" --org my-org --exclude-template-repositories
90+
```
91+
92+
Exclude repositories that are marked as GitHub templates, so boilerplate repos don't clutter your results.
93+
8694
**Regex search — pattern-based code audit**
8795

8896
```bash

docs/architecture/components.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ provides shared pattern-matching helpers used by several render modules.
5555
C4Component
5656
title Level 3b: TUI render layer
5757
58-
UpdateLayoutConfig($c4ShapeInRow="5", $c4BoundaryInRow="1")
58+
UpdateLayoutConfig($c4ShapeInRow="6", $c4BoundaryInRow="1")
5959
6060
Container(tui, "TUI", "src/tui.ts", "Calls render functions<br/>on every redraw;<br/>formats output on Enter")
6161
@@ -65,6 +65,7 @@ C4Component
6565
Component(filter, "Filter stats", "src/render/filter.ts", "buildFilterStats()<br/>FilterStats — visible/hidden counts")
6666
Component(selection, "Selection helpers", "src/render/selection.ts", "applySelectAll()<br/>applySelectNone()")
6767
Component(highlight, "Syntax highlighter", "src/render/highlight.ts", "highlightFragment()<br/>ANSI token colouring")
68+
Component(teamPick, "Team pick bar", "src/render/team-pick.ts", "renderTeamPickHeader()<br/>ANSI candidate bar")
6869
Component(outputFn, "Output formatter", "src/output.ts", "buildOutput()<br/>markdown or JSON")
6970
Component(filterMatch, "Pattern matchers", "src/render/filter-match.ts", "makeExtractMatcher()<br/>makeRepoMatcher()")
7071
}
@@ -84,6 +85,9 @@ C4Component
8485
Rel(tui, highlight, "Highlight<br/>extracts")
8586
UpdateRelStyle(tui, highlight, $offsetX="-150", $offsetY="-16")
8687
88+
Rel(tui, teamPick, "Render pick<br/>mode bar")
89+
UpdateRelStyle(tui, teamPick, $offsetX="-180", $offsetY="-16")
90+
8791
Rel(tui, outputFn, "Format<br/>on Enter")
8892
UpdateRelStyle(tui, outputFn, $offsetX="17", $offsetY="160")
8993
@@ -100,22 +104,23 @@ C4Component
100104

101105
## Component descriptions
102106

103-
| Component | Source file | Key exports |
104-
| ------------------------ | ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
105-
| **Filter & aggregation** | `src/aggregate.ts` | `aggregate()` — filters `CodeMatch[]` by repository and extract exclusion lists; normalises both `repoName` and `org/repoName` forms. |
106-
| **Team grouping** | `src/group.ts` | `groupByTeamPrefix()` — groups `RepoGroup[]` into `TeamSection[]` keyed by team slug; `flattenTeamSections()` — converts back to a flat list for the TUI row builder. |
107-
| **Shell completions** | `src/completions.ts` | `generateCompletion(shell)` — returns the full bash/zsh/fish completion script; `detectShell()` — reads `$SHELL`; `getCompletionFilePath(shell, opts)` — resolves the XDG-aware installation path. |
108-
| **Row builder** | `src/render/rows.ts` | `buildRows()` — converts `RepoGroup[]` into `Row[]` filtered by the active target (path / content / repo); `rowTerminalLines()` — measures wrapped height; `isCursorVisible()` — viewport clipping. |
109-
| **Summary builder** | `src/render/summary.ts` | `buildSummary()` — compact header line; `buildSummaryFull()` — detailed counts; `buildSelectionSummary()` — "N files selected" footer. |
110-
| **Filter stats** | `src/render/filter.ts` | `buildFilterStats()` — produces the `FilterStats` object (visible repos, files, matches) used by the TUI filter bar live counter. |
111-
| **Pattern matchers** | `src/render/filter-match.ts` | `makeExtractMatcher()` — builds a case-insensitive substring or RegExp test function for path or content targets; `makeRepoMatcher()` — wraps the same logic for repo-name matching. |
112-
| **Selection helpers** | `src/render/selection.ts` | `applySelectAll()` — marks all visible rows as selected (respects filter target); `applySelectNone()` — deselects all visible rows. |
113-
| **Syntax highlighter** | `src/render/highlight.ts` | `highlightFragment()` — maps file extension to a language token ruleset and applies ANSI escape sequences. Falls back to plain text for unknown extensions. |
114-
| **Output formatter** | `src/output.ts` | `buildOutput()` — entry point for both `--format markdown` and `--format json` serialisation of the confirmed selection. |
107+
| Component | Source file | Key exports |
108+
| ------------------------ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
109+
| **Filter & aggregation** | `src/aggregate.ts` | `aggregate()` — filters `CodeMatch[]` by repository and extract exclusion lists; normalises both `repoName` and `org/repoName` forms. |
110+
| **Team grouping** | `src/group.ts` | `groupByTeamPrefix()` — groups `RepoGroup[]` into `TeamSection[]` keyed by team slug; `flattenTeamSections()` — converts back to a flat list for the TUI row builder; `applyTeamPick()` — moves repos from a combined section to a chosen team section; `rebuildTeamSections()` — reconstructs `TeamSection[]` from a flat list (used by TUI pick mode). |
111+
| **Shell completions** | `src/completions.ts` | `generateCompletion(shell)` — returns the full bash/zsh/fish completion script; `detectShell()` — reads `$SHELL`; `getCompletionFilePath(shell, opts)` — resolves the XDG-aware installation path. |
112+
| **Row builder** | `src/render/rows.ts` | `buildRows()` — converts `RepoGroup[]` into `Row[]` filtered by the active target (path / content / repo); `rowTerminalLines()` — measures wrapped height; `isCursorVisible()` — viewport clipping. |
113+
| **Summary builder** | `src/render/summary.ts` | `buildSummary()` — compact header line; `buildSummaryFull()` — detailed counts; `buildSelectionSummary()` — "N files selected" footer. |
114+
| **Filter stats** | `src/render/filter.ts` | `buildFilterStats()` — produces the `FilterStats` object (visible repos, files, matches) used by the TUI filter bar live counter. |
115+
| **Pattern matchers** | `src/render/filter-match.ts` | `makeExtractMatcher()` — builds a case-insensitive substring or RegExp test function for path or content targets; `makeRepoMatcher()` — wraps the same logic for repo-name matching. |
116+
| **Selection helpers** | `src/render/selection.ts` | `applySelectAll()` — marks all visible rows as selected (respects filter target); `applySelectNone()` — deselects all visible rows. |
117+
| **Syntax highlighter** | `src/render/highlight.ts` | `highlightFragment()` — maps file extension to a language token ruleset and applies ANSI escape sequences. Falls back to plain text for unknown extensions. |
118+
| **Team pick bar** | `src/render/team-pick.ts` | `renderTeamPickHeader()` — renders the ANSI pick-mode candidate bar shown when the user presses `p` on a multi-team section header. Focused candidate is highlighted in bold magenta; others are dimmed. |
119+
| **Output formatter** | `src/output.ts` | `buildOutput()` — entry point for both `--format markdown` and `--format json` serialisation of the confirmed selection. |
115120

116121
## Design principles
117122

118123
- **No I/O.** Every component in this layer is a pure function: given the same inputs it always returns the same outputs. This makes them straightforward to test with Bun's built-in test runner.
119124
- **Single responsibility.** Each component owns exactly one concern (rows, summary, selection, …). The TUI composes them at render time rather than duplicating logic.
120125
- **`types.ts` as the contract.** All components share the interfaces defined in `src/types.ts` (`TextMatchSegment`, `TextMatch`, `CodeMatch`, `RepoGroup`, `Row`, `TeamSection`, `OutputFormat`, `OutputType`, `FilterTarget`). Changes to these types require updating all components.
121-
- **`render.ts` as façade.** External consumers import from `src/render.ts`, which re-exports all symbols from the `src/render/` sub-modules plus the top-level `renderGroups()` and `renderHelpOverlay()` functions.
126+
- **`render.ts` as façade.** External consumers import from `src/render.ts`, which re-exports all symbols from the `src/render/` sub-modules plus the top-level `renderGroups()` and `renderHelpOverlay()` functions. `renderTeamPickHeader` is consumed internally by `render.ts` and is not re-exported (it is not part of the public façade).

0 commit comments

Comments
 (0)