Repository navigation
Vercel: deploy, pull and dev check the link of the folder they name (#147) - #150
Merged
Merged
Conversation
…e given (#147) Failing on its own: cloudpin reads .vercel/project.json only from --cwd or the folder the command runs in, so `vercel deploy sub` with sub linked to another team passes a pin it should fail. Covers deploy (explicit, bare word, flags before the path, deploy init), --cwd, pull and dev, with controls for known command words, a path Vercel refuses, and the scope staying with the folder the command runs in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A pure move, so the #147 fix fits under the file-size cap: the global flag tables, HELP_COMMANDS, mainParse and splitShortGroups, with their comments, move verbatim to src/providers/vercel-args.ts. vercel.ts imports the three names it uses. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… does (#147) mainParse becomes argParse(args, spec, permissive) with the global options and permissive mode, as before. Commands parse their own options merged with the globals and not permissively, where an unknown flag is an error; the deploy-path fix needs that. No behaviour change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…147) vercel deploy <dir>, a bare vercel <dir>, deploy init <dir>, pull <dir> and dev <dir> link and act on the project in <dir>, but cloudpin read the link only from --cwd or the folder the command runs in, so a folder linked to another team passed a pin it should fail. linkDirs reads each command the way vercel 50.35 does: the path positional after the command's own options, resolved against the folder after --cwd. Deploy falls back to that folder when Vercel would refuse the path (missing, a file, a symlink), since nothing deploys. A first word that is no Vercel command may run an extension vercel-<word> in the folder instead of a deploy, so both folders' links count there. The scope still comes only from the local config in the folder the command runs in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unknown flag after the deploy path, deploy init's own options, and a folder named dev beside `vercel dev dev`: each case fails if the command's strict parse turns permissive, deploy init parses with the wrong options, or the second "dev" is read as a folder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
Since #147 a positional word can name the folder whose link picks the team, but dynamicTarget only reads targetFlags, and linkDirs took the marker as a missing folder: `vercel deploy "$D"` and `vercel "$D"` read the folder they run in, and `vercel pull "$D"` and `vercel dev "$D"` read a folder named after the marker, with no link at all. All were allowed; pull and dev also when the folder they run in was linked to the wrong team. linkDirs now returns undefined when the word it would read as the folder, or the first word (which may be any command), holds a dynamic marker, also after "--", where dynamicTarget stops reading. resolve turns that into a can't tell with its own fix, so Resolution's error gains an optional `fix`. VERCEL_ORG_ID is still read first, since Vercel then reads no link. A word that isn't the folder (`ls "$D"`, `--meta "k=$V"`, a second path) still passes, and a variable set earlier in the line reads the folder it names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
paureis
marked this pull request as ready for review
November 4, 2026 23:38
paureis
added a commit
that referenced
this pull request
Nov 4, 2026
paureis
added a commit
that referenced
this pull request
Nov 4, 2026
…o longer exempt the command (#153, items 1-3) (#158) * Test: help flags that kubectl/helm plugins, pflag value flags and yargs booleans do not stop (#153) Failing tests for #153 items 1 to 3, with guard-level wrong-pin controls: kubectl and helm plugins given --help, a pflag value flag that takes --help as its value (gh, kubectl, helm), and wrangler's --help false, -h false and --no-help. Controls show supabase and wrangler value flags never take --help, and real help stays exempt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * kubectl/helm: exempt --help only for built-in commands, not plugins (#153) kubectl runs kubectl-<name> from PATH when the first word is not a command, and kubectl-create-<x> when <x> right after `create` is not a built-in subcommand name; helm plugins are commands with DisableFlagParsing. Either way the plugin gets --help and may act on the cluster, so --help now exempts only built-in commands (kubectl 1.36.1, helm v3.22.1 and v4.3.1 source). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * gh, kubectl, helm: --help taken as a flag's value is not help (#153) pflag gives a flag that takes a value the next word whatever it is, so `gh secret set X --body --help` sets the body to "--help" and runs. Which flags take a value depends on the command, so a help flag right after any -x or --x word without "=" no longer exempts the command. Real help requests seldom end with a flag: none of 65 gh, kubectl, helm, supabase and wrangler help calls in local agent transcripts did. supabase (effect/cli) and wrangler (yargs) never take a word starting with "-" as a value, so they keep their rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Wrangler: --help false, -h false and --no-help turn help off (#153) yargs-parser 21.1.1 (yargs 17.7.2) takes a "true" or "false" right after a boolean flag as its value, reads --no-help and --no-h as off, and keeps the last one, so `wrangler deploy --help false` deploys. cloudpin now reads help the same way. Other spellings (--help=true, -xh) count as off, which only adds a check. Compared with yargs-parser on 200,000 random argument lists: cloudpin never exempted a command yargs would run; the old rule did 8,363 times. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Wrangler: put cachedAccount's comment back above it (#153) The previous commit inserted yargsHelp between the comment and the function it documents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * CHANGELOG and ROADMAP lines for #153 and #147 #147's lines were missed when #150 merged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <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.
Closes #147. Target: 1.3.0.
The bug
vercel deploy <dir>and a barevercel <dir>link and deploy the project in<dir>, but cloudpin read.vercel/project.jsononly from--cwdor the current folder. Ifsub/was linked to another team,vercel deploy subpassed the pin and deployed there.vercel pull <dir>(which downloads env vars) andvercel dev <dir>work the same way.The fix
src/providers/vercel.tsto the newsrc/providers/vercel-args.ts, becausevercel.tswould otherwise go over the 5,000-token file cap. A script checked that the moved block is verbatim, and its control (one changed character) fails as it should. The test counts are unchanged.mainParsebecomesargParse(args, spec, permissive): arg 5.0.0 with the globals plus a command's own options.linkDirsreturns the folders whose link a command acts on, andresolvetakes the union of their linked teams.VERCEL_ORG_IDstill overrides all of them, and the scope stays with the folder the command runs in. Here is what each command links in vercel 50.35 (sources are in the code comments):--cwd, and only when it is a directory, asvalidatePathsrequires. A path Vercel refuses deploys nothing, so the base folder is read instead.vercel-<word>in the base folder if that extension exists, and otherwise deploys the word as a path. Both folders count, because adding a check is the safe reading.deploy continuelinks the base folder.Tests
The tests are in the new file
test/vercel-deploy-dir.test.ts, 56 of them. They were committed failing first (30 of the first 52 failed) and include guard-level wrong-pin controls. Typecheck passes. Full suite: 53 files, 1444 passed, 8 skipped.deploy continuealready requires--id, which the default deploy parse rejects either way.Left open
vercel devlinks that project root instead of the folder.guidanceandmetricsare commands only when their feature flags are set. Reading them as paths only adds checks.🤖 Generated with Claude Code
Added when merging (2026-11-04)
A review found that a folder known only at run time got through:
vercel deploy "$D"read the current folder, andvercel pull "$D"anddev "$D"read a folder with no link, so nothing was compared. It now stops as "can't tell" (bf53a6a), tested intest/vercel-dynamic-dir.test.ts: 43 of its 100 tests failed before the fix, and removing each part of it turns tests red.npm run typecheckexit 0;npx vitest run: 2874 passed, 19 skipped.Still open, for #163: a glob or brace in the folder word (
vercel deploy su*) reaches cloudpin unexpanded, so the current folder's link is read.