Skip to content

feat(install-tracker): pick path, preview diff, confirm before PR - #16

Merged
ralyodio merged 1 commit into
masterfrom
feat/install-tracker-confirm-flow
May 22, 2026
Merged

ralyodio merged 1 commit into
masterfrom
feat/install-tracker-confirm-flow

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

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.

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>
@ralyodio
ralyodio merged commit c1657d3 into master May 22, 2026
@ralyodio
ralyodio deleted the feat/install-tracker-confirm-flow branch May 22, 2026 14:30
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