fix: ship web fetch-browser so the blocked-fetch escalation works (#247) - #271
Open
ankitranjan7 wants to merge 1 commit into
Open
fix: ship web fetch-browser so the blocked-fetch escalation works (#247)#271ankitranjan7 wants to merge 1 commit into
ankitranjan7 wants to merge 1 commit into
Conversation
`webcmd web fetch` raises FETCH_BLOCKED / FETCH_REQUIRES_BROWSER with a hint pointing at `webcmd web fetch-browser`, and smart-search names it as the mandatory second rung. On a fresh install that command died with ADAPTER_LOAD: 0470ac4 dropped "clis/" from package.json `files` when it moved adapters to plugins, but the generated cli-manifest.json still advertises web/fetch-browser, and no `web` plugin was ever created — so there was nothing to install either. The published package cannot carry adapter source at the root (the packaging guard forbids it), so the build stages clis/ next to the compiled output instead: dist/src/clis/ ships under the existing dist/src/ entry, and BUILTIN_CLIS resolves there when the repo-root tree is absent. The core manifest is staged alongside it so the manifest lookup contract (clisDir/../cli-manifest.json) still holds and an installed CLI does not fall back to a filesystem scan. check-package-bin now asserts every cli-manifest module is present in the tarball, which is the regression this bug was. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
🟢 No documentation gap found — medium confidenceThe automated review found no documentation gap in the supplied changes. This review is advisory and does not block merging. |
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.
Fixes #247
What was actually broken
The issue's mechanism is right, the symptom has drifted. On 0.6.0 the failure is not
Site "web" is not installed— the generatedcli-manifest.jsondoes ship and advertisesweb/fetch-browser, so the command is discoverable and dies on execution:(reproduced against a globally installed 0.6.0). Dead end either way, same root cause.
Root cause: 0470ac43 (#216) removed
"clis/"frompackage.jsonfileswhile moving adapters to plugins.clis/webwas moved to neither place — and there is nowebplugin (webcmd-plugin.jsonregisters 122; none isweb), sowebcmd plugin search weboffers no recovery.The fix
Ship it in the core package, per the issue's first option. The published package can't carry adapter source at the root — check-package-bin.mjs:73 fails the build on a top-level
clis/orplugins/in the tarball, and that policy stays — so the build stages the tree next to the compiled output instead:copy-yaml.cjscopiesclis/→dist/src/clis/(tests excluded), the same staging it already does forplaywright-client.js.filesalready shipsdist/src/.BUILTIN_CLISuses the repo-rootclis/when it exists (dev,tsx src/main.ts) and falls back to<compiled dir>/clisin an installed package.build-manifestwrites a second copy of the manifest todist/src/cli-manifest.json, because the lookup contract isclisDir/../cli-manifest.json— without it an installed CLI would fall back to a filesystem scan and eagerly import every adapter on startup.check-package-bingains the positive assertion: everycli-manifest.jsonmodulePathmust be present in the packed tarball. That is precisely the regression this bug was.What this does not do: reimplement
fetch-browseras a client-owned fast path next toweb fetch. The browser lifecycle it depends on (page provisioning, session, cloak, pre-nav, observation, tab cleanup) lives inexecution.tsaround the adapter, and a literal port duplicates all of it. This delivers what the core option promised — ships in the package, zero install steps, the pair works out of the box — while keeping one browser lifecycle. Say the word if you want the literal port instead.Verification
npm pack→ install tarball to a temp prefix →webcmd web fetch-browser --url https://example.com --stdoutreturns the extracted Markdown. Before:ADAPTER_LOAD.check:package-binpasses; with the staging step reverted it fails withpacked tarball is missing manifest module for web/fetch-browser— the guard bites on the real regression.cli-manifest.jsonandhosted-contract.jsonregenerate byte-identical (check:hosted-contractpasses).check:plugin-parity,typecheck, andnpm test(394 files, 4781 tests) pass.Notes
clis/web/fetch.jscontent, not its location. It also benefits: its discoverability entry forweb fetchpointed at a file fresh installs did not contain either, and now does.🤖 Generated with Claude Code