Skip to content

fix(install-tracker): fall back to GitHub code search for monorepos - #12

Merged
ralyodio merged 1 commit into
masterfrom
fix/install-tracker-monorepo
May 22, 2026
Merged

ralyodio merged 1 commit into
masterfrom
fix/install-tracker-monorepo

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Adds a GitHub Code Search fallback + optional rootPath so the tracker installer handles monorepos like profullstack/sh1pt (layout at sites/sh1pt.com/app/layout.tsx). Search runs only when the canonical list misses; index lag is acceptable since we instrument existing sites. UI exposure of rootPath comes next.

The rigid candidate list missed any monorepo whose app lived in a
subdirectory (e.g. profullstack/sh1pt has the Next.js layout at
sites/sh1pt.com/app/layout.tsx). The error was clear but unactionable.

Three changes:

1. installTracker() takes an optional rootPath, which prefixes the
   canonical candidate paths. Caller (the API route or future UI) can
   pin a monorepo's app directory explicitly.

2. When canonical probing still misses, fall back to GitHub Code
   Search for any file containing "</body>" in the repo. Handles
   monorepos and non-standard layouts (SvelteKit src/app.html,
   Remix app/root.tsx, etc.) without us having to enumerate them.
   Hits inside rootPath get priority when set.

3. New searchRepoCode() helper in lib/github/repos.ts. Quoted-substring
   query scoped to repo:owner/name via the /search/code endpoint.

The fallback's index lag (minutes) is fine — we instrument existing
sites, not freshly-pushed ones. Error message now also tells the user
to set a root path or open an issue with their layout.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 6ae3754 into master May 22, 2026
@ralyodio
ralyodio deleted the fix/install-tracker-monorepo branch May 22, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant