Repository navigation
fix(cli): Pass trace command names instead of parsing usage hints - #2086
Merged
Merged
Conversation
#2085 made trace usage hints start with the running program, but commandNameFromUsageHint still stripped only a leading `sentry `. Under npx or sentry-mcp, ambiguous-project suggestions from log list, span list, span view, trace logs and trace view named the program twice. The trace resolvers now take the bare command name from each command, and commandNameFromUsageHint is gone. Refs #2085 Refs #2050
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
BYK
approved these changes
Nov 7, 2026
This branch was previously 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.
Fixes a regression from #2085 that Warden reported. It also removes the last runtime parsing of a leading
sentryon this path.Summary
#2085 made the trace usage hints start with the running program (
npx -y sentry …,sentry-mcp …).commandNameFromUsageHintinlib/trace-target.tsstill stripped only a leadingsentry. Under npx orsentry-mcp, it returnednpx -y sentry log list, and thesentrytag then added the program name a second time. Ambiguous-project errors suggestednpx -y sentry npx -y sentry log list org-a/frontend/….What changed
resolveTraceOrg,resolveTraceOrgProjectandresolveTraceOrgOptionalProjecttake acommandNameargument. Each command passes its own bare name:log list,span list,span view,trace logsortrace view.commandNameFromUsageHintand its two regexes are deleted. Nothing derives a command name from hint text anymore.How it was tested
test/lib/trace-target.test.ts. Under asentry-mcpidentity, an ambiguous bare project in all three resolvers suggestssentry-mcp <command> org-a/frontendand neversentry-mcp sentry-mcp. I checked that the test fails when the old hint parsing is put back.tsc --noEmit(packages/cli): passes.pnpm run lint: 0 warnings, 0 errors.node --test scripts/cli-lint-rules.test.mjs: 116 pass.pnpm --filter sentry run check:doc-examples: 1649 examples match.vitestontest/lib/trace-target.test.tsandtest/commands/{log,span,trace}: 374 pass, 2 skipped.Refs #2085
Refs #2050
via @BYK.
--
View Session [Sentry]