Repository navigation
ref(cli): Remove the completion-only target parsers - #1750
Merged
Merged
Conversation
No command uses `parseOrgTarget`, `parseOrgProjectTarget`, or `parseIssueTarget` since #1564 moved every target and ID positional onto bound parsers, which carry the completion kind themselves. Remove them, and drop them and the already-removed `parseDashboardTarget` from the lint rules that banned them in commands. The lint rule now bans `withCompletionTarget` in commands instead, so a command cannot recreate an identity parser that only tags the kind. The introspection tests tag their own fixture parsers. Part of #1564 Co-Authored-By: BYK <burak.kaya@sentry.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BYK
approved these changes
Oct 30, 2026
BYK
enabled auto-merge (squash)
October 30, 2026 00:49
This was referenced Oct 30, 2026
BYK
added a commit
that referenced
this pull request
Oct 30, 2026
Stacked on #1750, which has merged; `origin/main` is merged in, so the diff is only this change. Every visible positional now declares how shell completion handles it, and positionals that can complete now do. Before this, 53 of the 126 positionals had no kind. `sentry alert issues <TAB>`, `sentry sourcemap upload <TAB>`, `sentry help <TAB>`, and `sentry cli completion <TAB>` all returned nothing. **What changed** - `completion-target.ts` adds the kinds `file`, `directory`, `org-project-or-directory`, `command-path`, `choice`, `account`, `project-spec`, and `text` (free text, no suggestions). Commands import pre-tagged parsers: `parseFilePath`, `parseDirectoryPath`, `parseText`, `parseCommandPath`, `parseAccountSelector`, and `choiceParser(values)`. They never tag `String`, and the #1750 ban on `withCompletionTarget` in commands stays. `choiceParser` returns its input unchanged, so commands keep their own validation. - The generator now also writes choice values, including Stricli `enum` flag values, so zsh and fish get them through `__complete`. It also writes every route group's subcommands. `__complete` uses these to complete nested subcommands (`alert issues <TAB>`, `dashboard widget <TAB>`) and `help`'s command path, and it lists directory entries for path arguments. Directories get a trailing `/`, and dotfiles show only when the partial starts with `.`. - `project create` now uses the `project-spec` kind instead of the `cmdPath` special case. `parseLoginEmail` moves to `db/accounts.ts` so `PARSER_TARGETS` can list it. `auth switch`, `auth logout`, and `auth login` complete stored accounts. `init` completes `org/project` targets, and directories only once the word looks like a path (`./`, `/`, `~/`), since init reads any other word as the target. - `cli completion` completes bash/zsh/fish. `cli defaults` completes its registry keys, on the first word only. `cli upgrade` completes nightly/stable/undo. - `test/lib/completion-coverage.test.ts` walks the real route tree and fails, naming the command and placeholder, for any visible positional without a kind. It has no allow-list. The "Shell completion" section of `packages/cli/AGENTS.md` explains which parser to use for each argument type and how to add a kind or an entity. **Follow-ups** - Positionals marked `text` that could complete: `release deploy` environment, `issue tags` key, `debug-files find` id, `monitor run` slug, `build download` id, `api` endpoint (from the API schema), `schema` query, and local sessions. Local sessions live only in the daemon's memory, so there is no cheap synchronous read. `event send` completes paths only, not its optional target. - Flags: the 184 `String`-parsed flags, numeric parsers, `--fields` from output schemas, and `--org`/`--project`/`--platform`/`--environment`. - Shell scripts: zsh flag specs; static nested groups; file directives (`-o nospace`/`filenames` in bash so a directory doesn't get a trailing space). - Entity kinds: releases, environments, teams, monitors, alert rules. <!-- junior-session-footer:start --> <!-- junior-conversation-id:agent%3A77d4f761a7cb5e1bf375330d5c1525f1 --> -- [View Session in Sentry](https://sentry.sentry.io/explore/conversations/agent%3A77d4f761a7cb5e1bf375330d5c1525f1/?project=4510944073809921) <!-- junior-session-footer:end --> --------- Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> Co-authored-by: BYK <burak.kaya@sentry.io> Co-authored-by: Claude <noreply@anthropic.com>
This branch had an error being deployed
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.
Part of #1564
No command uses
parseOrgTarget,parseOrgProjectTarget, orparseIssueTargetanymore. Every target and ID positional now goes through a bound parser (boundPositional,boundArguments, and thetarget-positional.tsparsers), and those parsers carry the completion kind themselves. The three identity parsers only survived as test fixtures.completion-target.ts.parseDashboardTarget(already deleted), from the lint rule name lists that banned them in commands. Removed their lint test cases too.require-target-resolutionnow banswithCompletionTargetin command files. Without this, a command could rebuild an identity parser that tags the kind and leaves the value forfuncto parse. No command calls it today; onlypositional-parse.tsdoes. Added a lint test case for it.introspect.test.tsnow tags its own fixture parsers, so completion extraction keeps the same coverage.packages/cli/AGENTS.mdand the doc comments to match.No runtime behavior changes. The generated completion metadata does not change, because no command used these parsers.
Verified locally:
pnpm run typecheck,pnpm run lint,node --test scripts/cli-lint-rules.test.mjs(65 pass), andvitest run test/lib/introspect.test.ts test/script.via BYK.
--
View Session in Sentry