Skip to content

Vercel: -y inside a short group asks on a protected environment; teams change and team are exempt (#148) - #151

Merged
paureis merged 9 commits into
mainfrom
fix/148-vercel-yes-group
Nov 4, 2026
Merged

paureis merged 9 commits into
mainfrom
fix/148-vercel-yes-group

Conversation

@paureis

@paureis paureis commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #148. Target: 1.3.0.

What changes

  • -y inside a short group now asks on a protected environment. vercel project inspect -dy (also -yd and -dyQ x) counted as read-only, yet with no project name it can run ensureLink, which may create and link a project. The new passesYes in vercel-args.ts reads --yes the way project inspect does (vercel 50.35 src/commands/project/index.ts, then inspect.ts):

    • every short group is split;
    • a first -- is dropped by project's permissive parse, so -y after it still counts;
    • --yes=false sets yes too.

    No other command on the read-only list calls ensureLink.

  • vercel teams change and the team alias are exempt like teams switch|ls (src/commands/teams/index.ts: list = ls|list, switch = switch|change; teamsCommand's aliases are switch and team).

  • Coverage only: --api URL <cmd>, -dv and -dh were already fixed by Vercel: -v anywhere, or a deploy flag before an exempt word, skips the check #146. This PR adds the guard-level and resolve-level tests that were missing for them.

Tests

The tests are in the new file test/vercel-yes-group.test.ts, 39 of them. They were committed failing first (17 of 39 failed), and include guard-level confirm checks on a protected environment and wrong-pin exemptions. Typecheck passes. Full suite: 54 files, 1483 passed, 8 skipped.

The builder broke five pieces of the fix on purpose, and each one made tests fail. I broke two more myself: passesYes back to the old word-only check (8 tests failed), and the team alias dropped (6 failed). The files were restored afterwards.

Left open

  • A project read_only rule for project inspect still skips the --yes check. That was left unchanged on purpose: the rules are the user's explicit list, applied the same way for every provider.
  • Some Vercel aliases (domain ls, cert ls, aliases ls) still ask on a protected environment. That's over-cautious, but it errs on the safe side.

🤖 Generated with Claude Code

paureis and others added 8 commits October 24, 2026 22:40
…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>
Fails until the fix: `project inspect -dy` counts as read-only on a
protected environment, and `teams change` and `team ls|switch` are
checked instead of exempt. The --api, -dv and -dh cases already pass
(#146); they are pinned here at guard and resolve level.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ent (#148)

`vercel project inspect -dy` counted as read-only, though inspect with
no name goes through ensureLink, which with --yes can create a project,
link the folder and connect Git. The project command parses
permissively, keeping an unknown -y of a group as a word and dropping a
first "--", and inspect parses those words again with --yes/-y
(vercel 50.35, src/commands/project/index.ts and inspect.ts). So the
check splits every short group, those after "--" included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…148)

`vercel teams change` is teams switch, and `vercel team ls|switch` is
teams (vercel 50.35: src/commands/teams/index.ts COMMAND_CONFIG maps
switch to switch|change and list to ls|list; teamsCommand's aliases are
switch and team). Both were checked instead of exempt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paureis paureis added this to the 1.3.0 milestone Oct 25, 2026
@paureis
paureis changed the base branch from fix/147-vercel-deploy-dir to main November 4, 2026 23:40
Keeps main's linkDirs and the dynamic-folder check, with this branch's passesYes
and team aliases. CHANGELOG and ROADMAP lines for #148.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paureis
paureis marked this pull request as ready for review November 4, 2026 23:41
@paureis
paureis merged commit ccb9582 into main Nov 4, 2026
5 checks passed
@paureis
paureis deleted the fix/148-vercel-yes-group branch November 4, 2026 23:42
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.

Vercel: -y in a group (project inspect -dy), and false blocks on --api, -dv, teams change

1 participant