Find the document shell wherever it lives, and ask when it can't be found - #219
Closed
ralyodio wants to merge 1 commit into
Closed
Find the document shell wherever it lives, and ask when it can't be found#219ralyodio wants to merge 1 commit into
ralyodio wants to merge 1 commit into
Conversation
…ound "Submit PR to install all sizes" ended at "No layout/template file with a </body> tag was found in the repo" — a dead end with no next step, on repos that plainly have a body to install into. Discovery only knew a hand-written list of conventions, and fell back to GitHub code search, which does not index private repos. A shell anywhere else was invisible. - Read the repo tree (one request) and probe anything template-shaped: document extensions anywhere, component extensions whose name or directory says "shell". Build output, vendored code and fixtures are never opened. This works on private repos, so it runs before code search. - The tree also says which canonical paths exist, so a repo now costs one request per real file instead of a miss for every convention we know. Probes run six at a time rather than one after another. - Widen the canonical list: SvelteKit src/app.html, Remix app/root.tsx, Rails, Django/Jinja, Eleventy, Blade, WordPress footer.php, .js layouts. - Stop penalizing templates/ — for Django, Flask, Jinja and Rails that is exactly where the shell lives, and the -100 hid the only installable file. - When all three passes come up empty, say so and ask for the path: the publisher knows where their shell is. The ad installer returns needsTargetPath and the slot manager prompts for a file, then retries against the same repo. The route already accepted target_path. - The stats-tracker installer had the same dead end and gets the same tree fallback; it also no longer runs code search once a repo is already installed, which could have injected a second copy elsewhere. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LT2u8KFbyeicqE9z2kUHJR
Contributor
Author
|
Superseded by #220. deb65fe landed the same tree-walk idea on master while this was in flight; #220 is rebased on it and keeps only what is still missing there — the tree fallback in installTracker (which opens the PR, as opposed to the picker), the templates/ ranking fix, the basename gate for Rails/Laravel/WordPress shells, and test coverage for the walk (the mock had no listRepoTree, so it was never exercised). |
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.
Submit PR to install all sizeswas ending at "No layout/template file with a</body>tag was found in the repo" — a dead end with no next step, on repos that plainly have a body to install into.Why it missed
Discovery knew a hand-written list of framework conventions and, when those missed, fell back to GitHub code search — which does not index private repos. A shell kept anywhere else was invisible.
What changed
Read the repo tree. One request lists every path. We probe anything template-shaped: document extensions (
.html,.astro,.erb,.njk,.twig, …) anywhere, and component extensions whose name or directory says "document shell". Build output, vendored code and fixtures are never opened. This works on private repos, so it runs before code search.Cheaper, too. The tree also tells us which canonical paths exist, so a repo now costs one request per real file instead of a miss for every convention we ever wrote down — and probes run six at a time instead of serially.
Wider canonical list: SvelteKit
src/app.html, Remixapp/root.tsx, Rails, Django/Jinja, Eleventy, Blade, WordPressfooter.php, and.jslayouts.Stopped penalizing
templates/. For Django, Flask, Jinja and Rails that directory is exactly where the shell lives, and the-100was hiding the only installable file in those repos.When all three passes come up empty, ask. The publisher knows where their shell is.
installAdEmbedreturnsneedsTargetPath, and the slot manager prompts for a file path and retries against the same repo. The route already acceptedtarget_path— the UI just never sent it. The same hook fires when a named path is wrong or has no</body>.The stats-tracker installer had the identical dead end and gets the same tree fallback. It also no longer runs code search once a repo is already installed — that path could have injected a second copy into an unrelated file.
Verification
pnpm installstill fails at HEAD (the@profullstack/autoblogpin), so there is novitestortscin this checkout. The new logic was exercised against a fake GitHub API by bundling the unmodified source with theesbuildthat is innode_modules— 33 checks, all passing:server/render/document.tsx) is founddist/andnode_modules/are never offeredrootPathstill scopes discovery, with no double-prefixed probe</body>with one loaderneedsTargetPath; an explicit path installs; a bad explicit path asks againContract tests covering all of the above are added to
tests/contract/install-{ad,tracker}.test.tsfor when the repo can install again.🤖 Generated with Claude Code
https://claude.ai/code/session_01LT2u8KFbyeicqE9z2kUHJR