Skip to content

kubectl long values, --all_namespaces, and Vercel services roots (#153) - #179

Merged
paureis merged 6 commits into
mainfrom
fix/153-long-values-services
Nov 5, 2026
Merged

paureis merged 6 commits into
mainfrom
fix/153-long-values-services

Conversation

@paureis

@paureis paureis commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Closes #153 (items 1 to 3 merged in #158).

kubectl and helm: a long flag that may take the next word

kubectl logs pod --container -n x: pflag gives --container the next word whole, so the container is -n and no namespace is set, but cloudpin read namespace x. Now any long flag without =, followed by a word starting with -, stops as "can't tell" when that word or a later one would pick the target, unless the flag is known never to take the next word. The lists hold every such flag of kubectl 1.36.1 (88) and helm v3.22.1 and v4.3.1 (78), compared against the source by a script.

  • Still pass: get pods --watch -n prod, --all, --force, --dry-run, logs --prefix -n prod, --container=x -n prod, helm --atomic --wait -n prod.
  • Cost: a plugin's boolean or a flag newer than 1.36 before a target word (kubectl myplugin --flag -n x) stops. --flag=true gets past it, and the message says so.
  • src/providers/kubernetes.ts was over the size cap, so argument parsing moved to kubernetes-args.ts first, in a commit of its own with a move proof.

kubectl: --all_namespaces

kubectl reads _ as - in a flag's name, so --all_namespaces lists every namespace while a namespace pin passed. Checked on the real kubectl 1.36.1: it accepts get pods --all_namespaces and refuses --bogus_flag.

Vercel: services

With experimental services on, Vercel links the parent project's root instead of the folder (vercel 50.35 util/projects/find-project-root.ts, detect-services.ts). This holds for every command that reads a link, not only vercel dev. cloudpin now reads up to two parent roots when services may be on. It doesn't run Vercel's detector, so a parent linked to another team, with services on and none found, is a false block.

Evidence

  • New tests: test/kubernetes-long-values.test.ts (117), test/vercel-dev-services.test.ts (46), test/kubernetes-underscore-flag.test.ts (7), each seen failing first, with wrong-pin controls.
  • npm run typecheck exit 0; npx vitest run: 3177 passed, 19 skipped.
  • 55 mutations killed by the builder; one more here (only the next word read: 7 fail).

Not tested

No real cluster or Vercel services project: the long-flag and services behaviour comes from the sources named above.

Left open

A kuberc alias whose prependArgs ends in a flag that takes a value (["--container"]) still gives cloudpin the wrong reading of the user's next word. Rare, noted in #145.

🤖 Generated with Claude Code

paureis and others added 6 commits November 4, 2026 19:14
Pure move, so item 4 can change the parser: kubernetes.ts is over the file-size cap. shortLetters,
splitShortGroups, VALUE_FLAGS and commandWords moved unchanged; splitShortGroups gained `export`,
and kubernetes.ts re-exports commandWords for readonly.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n't tell (#153)

`kubectl logs pod --container -n x`: pflag gives --container the next word whole, so no namespace
is set, while cloudpin read namespace x and passed when x was pinned. cloudpin now keeps the flags
that never take the next word (every boolean and NoOptDefVal flag of kubectl 1.36.1 and helm
v3.22.1 and v4.3.1). Any other long flag without "=", followed by a word that starts with "-",
stops when that word or a later one would pick the target, since the two readings can differ.
The message names the flag and no value, and says how to write it so it can be read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With services on, a command in a service's folder links the parent project's root, not the folder
(vercel 50.35 util/projects/find-project-root.ts resolveProjectCwd), through getLinkedProject,
ensureLink, build and dev, so this is every command that reads a link, not only `vercel dev`.
cloudpin now reads that root's link as well: the nearest folder above with .vercel, vercel.json,
vercel.toml or .git, when VERCEL_USE_EXPERIMENTAL_SERVICES is on, or its config sets services, or it
has a config only Vercel can read. A link in the set only adds a check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rcel project root

Controls found missing when planning the mutation run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kubectl reads "_" as "-" in a flag's name. kubectl 1.36.1 accepts
`get pods --all_namespaces` and refuses `--bogus_flag`, so a namespace pin
passed while the command listed every namespace.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paureis
paureis merged commit 56e4792 into main Nov 5, 2026
4 checks passed
@paureis
paureis deleted the fix/153-long-values-services branch November 5, 2026 00:27
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.

Exemption and parse leftovers: plugin --help, value flags that swallow --help, yargs --no-help, kubectl long values, vercel dev services

1 participant