Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/instructions/bug-fixing.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Add a one-line comment above the fix if the root cause is non-obvious:
Once the PR is merged into `main`, publish a **patch** release:

```bash
bun pm version patch # bumps package.json: 1.2.4 → 1.2.5
sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json # bump directly — do NOT use bun pm version
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release command uses sed -i '', which is BSD/macOS-specific and can fail on GNU sed. Please provide a portable alternative or separate commands for macOS vs Linux.

Suggested change
sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json # bump directly — do NOT use bun pm version
tmpfile="$(mktemp)"
jq '.version = "X.Y.Z"' package.json > "$tmpfile" && mv "$tmpfile" package.json # bump directly — do NOT use bun pm version

Copilot uses AI. Check for mistakes.
git checkout -b release/$(jq -r .version package.json)
git add package.json
git commit -S -m "v$(jq -r .version package.json)"
Expand All @@ -101,4 +101,6 @@ git push origin release/$(jq -r .version package.json) --tags
```

The tag push triggers `cd.yaml` which builds all-platform binaries and creates the GitHub Release automatically.

For the blog post (optional for patch, but encouraged): **ask the user interactively** for the highlights and description before writing `docs/blog/release-v<X-Y-Z>.md`.
See the full release guide in `AGENTS.md § Release process`.
8 changes: 3 additions & 5 deletions .github/instructions/implement-feature.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ bun run build.ts # binary compiles without errors
Once the PR is merged into `main`, publish a **minor** (new feature) or **major** (breaking change) release:

```bash
bun pm version minor # new feature: 1.2.4 → 1.3.0
# or
bun pm version major # breaking change: 1.2.4 → 2.0.0

sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json # bump directly — do NOT use bun pm version
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documented version bump command uses sed -i '', which is not portable to GNU sed (Linux). Please adjust the instructions to a cross-platform approach or provide OS-specific variants.

Suggested change
sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json # bump directly — do NOT use bun pm version
jq '.version = "X.Y.Z"' package.json > package.tmp.json && mv package.tmp.json package.json # bump directly — do NOT use bun pm version

Copilot uses AI. Check for mistakes.
# X.Y.Z: new feature → 1.2.4 → 1.3.0 | breaking change → 1.2.4 → 2.0.0
git checkout -b release/$(jq -r .version package.json)
git add package.json
git commit -S -m "v$(jq -r .version package.json)"
Expand All @@ -90,7 +88,7 @@ git push origin release/$(jq -r .version package.json) --tags

The tag push triggers `cd.yaml` which builds all-platform binaries and creates the GitHub Release automatically.

For **minor and major releases**, also write the blog post **before pushing the tag**:
For **minor and major releases**, a blog post is **required** — **ask the user interactively** for the highlights and description before writing `docs/blog/release-v<X-Y-Z>.md`. Do not draft it from code alone.

- Create `docs/blog/release-v<X-Y-Z>.md` with feature highlights
- Add a row in `docs/blog/index.md`
Expand Down
27 changes: 25 additions & 2 deletions .github/instructions/release.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,39 @@ This project follows [Semantic Versioning](https://semver.org/):

## 2. Bump the version

Edit `package.json` directly — **do not use `bun pm version`**.

> `bun pm version` automatically creates a git commit _and_ a git tag in one shot,
> which conflicts with the release workflow (tag must land on the release branch,
> not on the current branch, and only after the blog post / CHANGELOG are ready).
> Undoing that auto-tag with `git tag -d` and `git push --delete` is error-prone.

```bash
bun pm version patch # or minor / major
# Option A — in-place sed (reliable, no interactive editor needed)
sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json
Comment on lines +32 to +33
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This in-place sed -i '' example is macOS/BSD-specific and will break on GNU sed. Since this is meant to be “reliable”, it should either be made portable or split into explicit macOS and Linux instructions.

Suggested change
# Option A — in-place sed (reliable, no interactive editor needed)
sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json
# Option A — non-interactive sed (no editor needed)
# macOS / BSD sed:
sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json
# GNU sed (Linux):
sed -i 's/"version": ".*"/"version": "X.Y.Z"/' package.json

Copilot uses AI. Check for mistakes.

# Option B — edit package.json manually, change the "version" field
```

If the working tree is dirty (staged or unstaged changes), `bun pm version` will refuse. In that case bump directly in `package.json`, then commit the version bump as the first commit on the release branch.
Verify the bump before committing:

```bash
jq -r .version package.json # should print X.Y.Z
```

## 3. Write the blog post

**Required for minor and major releases. Optional (but encouraged) for patch releases.**

> **Ask the user interactively before writing.** Do not invent highlights or
> descriptions. Before drafting the post, ask the user:
>
> - Which changes should be highlighted?
> - Is there a one-line description for the front-matter?
> - Any before/after examples or screenshots to include?
>
> Only proceed to write the file once you have the user's input.

1. Create `docs/blog/release-v<X-Y-Z>.md` — use existing posts as format reference:
- `docs/blog/release-v1-3-0.md` (minor, feature-focused)
- `docs/blog/release-v1-4-0.md` (minor, TUI/community-focused)
Expand Down
38 changes: 38 additions & 0 deletions .github/skills/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,34 @@ This skill complements `.github/instructions/release.instructions.md`.

---

## Version bump — important note

**Never use `bun pm version patch/minor/major` to bump the version.**

Unlike `npm version`, Bun's implementation creates both a git commit _and_ a git
tag in a single operation. This is incompatible with the release workflow:

- The tag must land on the dedicated `release/X.Y.Z` branch, not on `main`.
- The blog post and `CHANGELOG.md` must be committed _before_ the version tag is
pushed (the CD pipeline reads the tag to build binaries and name the release).
- Undoing an unwanted auto-tag requires `git tag -d vX.Y.Z` locally and
`git push origin --delete vX.Y.Z` on the remote — easy to forget one of the
two, which can trigger the CD pipeline prematurely.

**Correct approach:**

```bash
# Bump directly in package.json
sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json

# Verify
jq -r .version package.json
```
Comment on lines +24 to +30
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suggested sed -i '' command is not portable (GNU sed on Linux treats '' differently and often errors). Please update this section to include a cross-platform approach or separate macOS vs Linux commands.

Copilot uses AI. Check for mistakes.

The git commit and tag are created separately in steps 4 and 5.

---

## Semver decision guide

| Change type | Bump | Example |
Expand Down Expand Up @@ -57,6 +85,16 @@ Pushing `vX.Y.Z` triggers the release pipeline automatically:

Required for **minor** and **major** releases. Optional for patch (GitHub Release body is sufficient for patch).

> **Always ask the user interactively before writing the blog post.**
> Do not invent highlights, descriptions or examples from code alone.
> Ask at minimum:
>
> - Which changes deserve a `###` section and why?
> - Suggested one-line `description` for the front-matter.
> - Any before/after CLI output or screenshots to illustrate?
>
> Then draft the post and show it to the user for approval before committing.

**Front-matter:**

```yaml
Expand Down
18 changes: 14 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,11 @@ This project follows [Semantic Versioning](https://semver.org/):
### Step-by-step

```bash
# 1. Bump the version in package.json (pick one)
bun pm version patch # bug fix
bun pm version minor # new feature
bun pm version major # breaking change
# 1. Bump the version in package.json directly
# Do NOT use `bun pm version` — it creates a git commit AND a git tag
# automatically, which conflicts with the release workflow below.
sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json
Comment on lines +182 to +183
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sed -i '' is BSD/macOS-specific and fails on GNU sed (common on Linux CI/dev machines). Consider documenting a cross-platform version bump command (e.g. use sed -i.bak … and remove the backup, or use a small Node/Bun script), or explicitly provide both macOS and Linux variants.

Suggested change
# automatically, which conflicts with the release workflow below.
sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json
# automatically, which conflicts with the release workflow below.
# macOS (BSD sed)
sed -i '' 's/"version": ".*"/"version": "X.Y.Z"/' package.json
# Linux (GNU sed)
sed -i 's/"version": ".*"/"version": "X.Y.Z"/' package.json

Copilot uses AI. Check for mistakes.
jq -r .version package.json # verify

# 2. Create the release branch and commit
git checkout -b release/$(jq -r .version package.json)
Expand Down Expand Up @@ -215,6 +216,15 @@ Pushing a **major** tag (`vX.0.0`) additionally triggers **`docs.yml` → snapsh

### Blog post requirement

> **Always ask the user interactively before writing the blog post.**
> Do not invent highlights or descriptions from code alone. Ask at minimum:
>
> - Which changes should be highlighted?
> - Is there a one-line description for the front-matter?
> - Any before/after CLI output examples to include?
>
> Only proceed to write `docs/blog/release-v<X-Y-Z>.md` once you have the user's input.

| Release type | Blog post | Location |
| ------------ | ----------------------------------------------------------- | --------------------------------- |
| **Major** | Required (written by hand — CI stub automates the skeleton) | `docs/blog/release-vX-0-0.md` |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Each release entry covers the motivation, new features, breaking changes (if any

| Version | Blog post |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
| [v1.8.2](https://fulll.github.io/github-code-search/blog/release-v1-8-2) | Fix rate-limit errors aborting multi-page searches; auto-wait and retry with live progress |
| [v1.8.1](https://fulll.github.io/github-code-search/blog/release-v1-8-1) | Fix silent hang after pagination bar — concurrency cap + progress bar for line-number resolution |
| [v1.8.0](https://fulll.github.io/github-code-search/blog/release-v1-8-0) | Purple TUI theme, fetch progress bar, position indicator, line-anchored file links, Esc to close help |
| [v1.7.0](https://fulll.github.io/github-code-search/blog/release-v1-7-0) | Shell completions (bash/zsh/fish) + extended syntax highlighting (PHP, C/C++, Swift, Terraform/HCL, Dockerfile) |
Expand Down
1 change: 1 addition & 0 deletions docs/blog/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Full release notes and changelogs are always available on

| Release | Highlights |
| -------------------------- | ---------------------------------------------------------------------------------------------------------- |
| [v1.8.2](./release-v1-8-2) | Fix rate-limit errors aborting multi-page searches — auto-wait and resume with live feedback |
| [v1.8.1](./release-v1-8-1) | Fix silent hang after pagination bar — concurrency cap + progress bar for line-number resolution |
| [v1.8.0](./release-v1-8-0) | Purple TUI theme, fetch progress bar, position indicator, line-anchored file links, Esc to close help |
| [v1.7.0](./release-v1-7-0) | Shell completions (bash/zsh/fish), extended syntax highlighting (PHP, C/C++, Swift, Terraform, Dockerfile) |
Expand Down
73 changes: 73 additions & 0 deletions docs/blog/release-v1-8-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
title: "What's new in v1.8.2"
description: "Bug fix: multi-page searches no longer abort when GitHub rate-limits mid-pagination — the CLI now waits and resumes automatically."
date: 2026-03-09
---

# What's new in github-code-search v1.8.2

> Full release notes: <https://github.com/fulll/github-code-search/releases/tag/v1.8.2>

## Highlights

### Fix: multi-page searches aborted by rate limits now auto-resume

When searching across a large organisation with many results (close to the
GitHub 1 000-result cap), the CLI could crash mid-way through pagination with:

```
Fetching results from GitHub… ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░ page 9/10
error: GitHub API rate limit exceeded. Please retry in 53 seconds.
```
Comment on lines +18 to +21
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fenced code block is missing a language identifier. The docs guidelines for this repo require every code block to declare its language (e.g. text for CLI output).

Copilot uses AI. Check for mistakes.

The search was lost at ~90 % completion and had to be restarted from scratch.

#### Root causes (three compounding issues)

**1. Long rate-limit waits threw immediately.**
When `x-ratelimit-reset` indicated a wait longer than 10 seconds,
`fetchWithRetry` threw an error instead of waiting. The pagination loop
propagated this exception and discarded all pages already fetched.

**2. Secondary rate limits were not recognised.**
GitHub secondary rate limits return `403 + Retry-After` (without
`x-ratelimit-remaining: 0`). This pattern bypassed the retry logic entirely
and surfaced as an unhandled API error.

**3. 422 error when results hit exactly 1 000.**
When `total_count` was an exact multiple of 100 (e.g. 1 000 results across 10
full pages), the pagination loop attempted a page 11. GitHub rejects this with
`422 Cannot access beyond the first 1000 results`.

#### What changed

- **Auto-wait with visible feedback.** When a rate-limit response is received
during pagination, the CLI now prints a message, waits for the exact duration
indicated by GitHub (`x-ratelimit-reset` or `Retry-After` + 1 s clock-skew
buffer), and resumes automatically — no retry counting, no data lost:
Comment on lines +44 to +47
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release notes claim multi-page searches now auto-wait and resume on long rate-limit delays, but the current implementation of fetchWithRetry still throws when the computed delay exceeds MAX_AUTO_RETRY_WAIT_MS (10s) and there is no onRateLimit callback support in the codebase. Either include the rate-limit retry implementation changes in this PR, or adjust the release post to match the actual shipped behavior.

Copilot uses AI. Check for mistakes.

```
Fetching results from GitHub… ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░ page 9/10
Rate limited — waiting 53 seconds, resuming automatically…
Fetching results from GitHub… ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ page 10/10
```
Comment on lines +49 to +53
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fenced code block is missing a language identifier. Please add one (likely text) so the docs conform to the repo convention of language-tagged code fences.

Copilot uses AI. Check for mistakes.

- **Secondary rate limit detection.** Any `403 + Retry-After` response is now
treated as a retriable rate-limit condition.

- **Page 11 guard.** `fetchAllResults` now short-circuits before requesting
a page beyond `totalPages`, preventing the 422 error at the cap.

**Before:** error at page 9, search lost.
**After:** transparent pause, TUI opens with all 1 000 results.

---

## Upgrade

```bash
github-code-search upgrade
```

Or download the latest binary directly from the
[GitHub Releases page](https://github.com/fulll/github-code-search/releases/tag/v1.8.2).
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "github-code-search",
"version": "1.8.1",
"version": "1.8.2",
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version is bumped to v1.8.2 here, but the PR description/release notes mention rate-limit auto-retry changes (e.g. onRateLimit callback, secondary rate-limit detection) that are not present in the current source (src/api-utils.ts still throws for waits > 10s). Either include the implementation changes in this PR, or delay the version bump/release artifacts until the code changes are actually included.

Copilot uses AI. Check for mistakes.
"description": "Interactive GitHub code search with per-repo aggregation",
"keywords": [
"bun",
Expand Down