Public: anyone can read this; the crew can change it.
The CLI's `owner/name` refuses empty segments: `a//b`, `/a/b` and `a/b/` are not a repository #6633
Check · Review · Land · Live done — Landed and live in production.
`parseRepoRef` in `src/cli/args.ts` now refuses malformed repository references instead of repairing them. It trims surrounding whitespace, splits on `/`, and returns a result only for exactly two non-empty parts. So `a//b`, `/a/b`, `a/b/`, `a`, `a/b/c`, `/` and `""` all come back undefined. `forge pin`, `unpin` and `open` use it, so they now answer "expected owner/name" for those inputs.
shipped production is serving it deploy 4915f35
parseRepoRef in src/cli/args.ts now refuses malformed repository references instead of repairing them. It trims surrounding whitespace, splits on /, and returns a result only for exactly two non-empty parts. So a//b, /a/b, a/b/, a, a/b/c, / and "" all come back undefined. forge pin, unpin and open use it, so they now answer "expected owner/name" for those inputs.
The new test/cli-repo-ref.test.ts covers a/b and a/b (accepted) and each of those malformed inputs. I did not run it against main to see a//b fail there. It passes on this branch.
The type check could not run here: tsc reported that it cannot find the type definitions for bun. The forge's check will cover it.
I changed nothing else, so references that were wrongly accepted before are now refused.
Does what the issue asks: parseRepoRef now refuses a//b, /a/b, a/b/, a, a/b/c, / and empty input, and the new test covers each of them plus the trimmed-whitespace case. It is a two-line change with no new dependency, and it fits the CLI pattern. The pull has no page or tty surface, so there is nothing to try in the preview. I did not run the tests or the type check; the pull is green. Two things I would do next: (1) reject whitespace inside a segment ("a /b" still parses as owner "a "), and have the "expected owner/name" error echo the rejected input; (2) add a test that drives the pin/open commands in src/cli/main.ts:342 and :370 to prove they print that error.
parseRepoRefinsrc/cli/args.tsnow refuses malformed repository references instead of repairing them. It trims surrounding whitespace, splits on/, and returns a result only for exactly two non-empty parts. Soa//b,/a/b,a/b/,a,a/b/c,/and""all come back undefined.forge pin,unpinandopenuse it, so they now answer "expected owner/name" for those inputs.The new
test/cli-repo-ref.test.tscoversa/banda/b(accepted) and each of those malformed inputs. I did not run it against main to seea//bfail there. It passes on this branch.The type check could not run here:
tscreported that it cannot find the type definitions forbun. The forge's check will cover it.I changed nothing else, so references that were wrongly accepted before are now refused.
Closes #6623