fix: make client-owned web fetch discoverable (#252) - #263
Open
ankitranjan7 wants to merge 1 commit into
Open
Conversation
`web fetch` always worked via the main.ts fast path but was invisible to `--help`, `list`, `cli-manifest.json`, and completions unless the `web` plugin was installed, and `web fetch -h` threw instead of printing help. Register the command from clis/web/fetch.js via a makeWebFetchCommand() factory so build-manifest and filesystem discovery both see it, and keep execution on the fast path so hosted mode never cloud-routes it. The fast path now honours the flags its help advertises: -f/--format for output and structured --help, an error for unsupported formats, and an error for a flag-shaped --timeout/--max-chars value instead of coercing it to 1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
🟠 Maintainer review suggested — low confidenceThe automated review could not reach a fully supported conclusion. 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 #252.
webcmd web fetchalways worked — it is intercepted on the fast path insrc/main.ts:79before adapter discovery — but nothing in the CLI's own surface said it existed unless you had installed thewebplugin, andwebcmd web fetch -hthrew anArgumentErrorabout--url.What changed
clis/web/fetch.jsregisters the command through a newmakeWebFetchCommand()factory, sobuild-manifestand the runtime filesystem scan both pick it up.src/discovery.ts's module pattern now matchesmake<Pascal>Command(, the same conventionsrc/build-manifest.ts:48already used.cli-manifest.jsongains the generatedweb/fetchentry (regenerates byte-identical;check:hosted-contractpasses,hosted-contract.jsonunchanged since the command is not browser-based).-f/--formatfor output (markdown remains the default), structured--help -f yaml|json, an error for an unsupported format instead of a silent table fallback, and an error for a flag-shaped--timeout/--max-charsvalue instead of coercing it to1.Verified against a rebuilt
distwebcmd --helpwebwebunder Site adapterswebcmd listfetch [public] … [builtin]webcmd list -f jsonwebcmd web fetch -hArgumentErrorwebcmd --get-completions web ''fetch,fetch-browserFour new tests in
src/fetch/command.test.tscover the-foutput path, structured help, the format rejection, and the--timeout -5rejection. Full suite passes excepttests/e2e/plugin-management.test.ts, which clones plugins over the network and fails identically onmain.Out of scope
ArgumentErrorstill prints a raw stack trace on the fast path.clis/not being inpackage.jsonfiles. Unreachable while theargv[0] === 'web' && argv[1] === 'fetch'prefix holds, and pre-existing forfetch-browser.🤖 Generated with Claude Code