feat(install-tracker): pick path, preview diff, confirm before PR - #16
Merged
Merged
Conversation
User report: on profullstack/sh1pt the tracker installer picked boilerplates/next-supabase/app/layout.tsx — a template, not the live site at sites/sh1pt.com/app/layout.tsx. PRs were auto-submitted without review. Fix: four-step modal — pick repo → pick path → preview → submit. The user always sees and approves the target file before any PR opens. Backend (one endpoint, three modes): - mode=candidates: scan canonical paths + code search, return ranked candidate file paths. Ranking penalizes boilerplates/, examples/, templates/, samples/, fixtures/, tests/, stories/, docs/. Boosts apps/*, sites/*, web/, anything containing the repo name, root-level files, and Next.js app/layout.tsx specifically. No PR opened. - mode=preview: given a target_path, return the before/after content and the exact snippet that would be inserted. No PR opened. Detects "already installed" (data-site marker present) and "not a template" (no </body> in file) up front. - mode=submit: requires target_path, runs installTracker with targetPath set so discovery is skipped. Opens the PR. project_pr_runs row recorded only in this mode (the scan / preview steps are free reads — no logging needed). installTracker now accepts an explicit targetPath that short-circuits discovery entirely. UI uses this after the user confirms. UI flow (replaces single-shot "click repo → PR opens"): 1. Pick repo from the list (filter, bound vs all). 2. Optional "Web app subdirectory" input (visible, not buried). 3. Click "Use this repo" → backend scans → shows ranked candidates + a manual path field for explicit override. 4. Click "Use this file" or type a path → backend previews → shows the snippet that will be inserted (and notes the next/script import if it's a Next.js layout). 5. Click "Open PR" → backend submits. PR URL shown on success. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four-step modal so users see exactly which file the tracker will edit before any PR opens. Backend exposes three modes on the existing endpoint: candidates (ranked scan), preview (would-be diff), submit (open PR with explicit target_path). Ranking penalizes boilerplates/templates/examples and boosts apps/sites/web + repo-name matches, so sh1pt-style monorepos pick the right file by default.