Skip to content

Commit 1421d94

Browse files
committed
Address second Copilot review round: docs accuracy and stale comment
- output.ts: update inline comment — seg.line/seg.col are now absolute file line numbers resolved by api.ts (not fragment-relative) - output-formats.md: replace nested-backtick prose with fenced code block example to avoid malformed Markdown rendering - output-formats.md: reword Query title section to distinguish format (Markdown/JSON) from output-type (repo-only/repo-and-matches) - output-formats.md: remove #L2 anchor from JSON example url field — buildJsonOutput() emits m.htmlUrl without anchoring to line - README.md: qualify matchedText/line/col as 'when segment data is available' to avoid overstating the JSON schema guarantee
1 parent 48015fa commit 1421d94

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ github-code-search query "TODO" --org my-org
3636
- **Per-repository aggregation** — results grouped by repo, not as a flat list; fold/unfold each repo to focus on what matters
3737
- **Keyboard-driven TUI** — navigate with arrow keys, toggle selections, filter by file path, confirm with Enter — without leaving the terminal
3838
- **Fine-grained selection** — pick exactly the repos and extracts you want; deselected items are recorded as exclusions in the replay command
39-
- **Structured output** — Markdown document with a `# Results for` query heading, GitHub deeplinks and the exact matched token per extract; or machine-readable JSON with `matchedText`, `line` and `col` fields — ready to paste into docs, issues or scripts
39+
- **Structured output** — Markdown document with a `# Results for` query heading, GitHub deeplinks and the exact matched token per extract; or machine-readable JSON that, when segment data is available, includes `matchedText`, `line` and `col` fields — ready to paste into docs, issues or scripts
4040
- **Team-prefix grouping** — group results by team prefix (e.g. `platform/`, `data/`) using `--group-by-team-prefix`
4141
- **Replay command** — every session produces a one-liner you can run in CI to reproduce the exact same selection without the UI
4242
- **Regex search** — use `/pattern/flags` syntax for pattern-based searches; the CLI derives a safe API query and filters results locally

docs/usage/output-formats.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,15 @@ github-code-search "useFeatureFlag" --org fulll --no-interactive
3232

3333
:::
3434

35-
Each extract link points directly to the matching line on GitHub. When the GitHub API returns the exact matched token, it is appended inline in backticks (e.g. `` : `useFeatureFlag` ``).
35+
Each extract link points directly to the matching line on GitHub. When the GitHub API returns the exact matched token, it is appended inline after the link — for example:
36+
37+
```text
38+
- [ ] [src/foo.ts:3:5](https://github.com/org/repo/blob/main/src/foo.ts#L3): `useFeatureFlag`
39+
```
3640

3741
## Query title
3842

39-
Every output (both Markdown and repo-only) is prefixed with a `# Results for` heading that identifies the search query. When active qualifiers are present, they are appended after a `·` separator:
43+
Every output — in both Markdown and JSON formats, and for both `repo-only` and `repo-and-matches` output types — is prefixed with a `# Results for` heading that identifies the search query. When active qualifiers are present, they are appended after a `·` separator:
4044

4145
```text
4246
# Results for "useFeatureFlag" · including archived · excluding templates
@@ -67,7 +71,7 @@ github-code-search "useFeatureFlag" --org fulll --format json --no-interactive
6771
"matches": [
6872
{
6973
"path": "src/middlewares/featureFlags.ts",
70-
"url": "https://github.com/fulll/auth-service/blob/main/src/middlewares/featureFlags.ts#L2",
74+
"url": "https://github.com/fulll/auth-service/blob/main/src/middlewares/featureFlags.ts",
7175
"line": 2,
7276
"col": 19,
7377
"matchedText": "useFeatureFlag"

src/output.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,9 @@ export function buildMarkdownOutput(
247247
for (const m of matches) {
248248
// Use VS Code-ready path:line:col as link text and anchor the URL to the
249249
// line when location info is available (GitHub #Lline deeplink).
250-
// Position is fragment-relative (GitHub Code Search API does not return
251-
// absolute line numbers).
250+
// seg.line/seg.col reflect absolute file line numbers resolved by api.ts
251+
// (falling back to fragment-relative positions when raw content is
252+
// unavailable).
252253
const seg = m.textMatches[0]?.matches[0];
253254
if (seg) {
254255
const matchedText = seg.text ? `: ${mdInlineCode(seg.text)}` : "";

0 commit comments

Comments
 (0)