Skip to content

Commit f0f7be9

Browse files
authored
feat(feedback): add command to submit CLI feedback (#150)
closes #119 ## Summary Adds a `sentry feedback` command that lets users send feedback about the CLI. All text after `feedback` is joined and sent via `Sentry.captureFeedback()` to the CLI's Sentry project. ## Usage ```bash sentry feedback i love this tool sentry feedback the issue view is confusing ``` ## Test Plan ```bash bun run dev feedback test message # => Feedback submitted. Thank you! bun run dev feedback # => Please provide a feedback message. ``` --- Closes #119
1 parent 2574f6a commit f0f7be9

5 files changed

Lines changed: 128 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: feedback
3+
description: Send feedback about the Sentry CLI
4+
---
5+
6+
Send feedback about your experience with the CLI.
7+
8+
## Commands
9+
10+
### `sentry feedback`
11+
12+
Submit feedback about the CLI directly to the Sentry team.
13+
14+
```bash
15+
sentry feedback <message>
16+
```
17+
18+
**Arguments:**
19+
20+
| Argument | Description |
21+
|----------|-------------|
22+
| `<message>` | Your feedback message (all words after `feedback` are joined) |
23+
24+
## Examples
25+
26+
```bash
27+
# Send positive feedback
28+
sentry feedback i love this tool
29+
30+
# Report an issue
31+
sentry feedback the issue view is confusing
32+
33+
# Suggest an improvement
34+
sentry feedback would be great to have a search command
35+
```
36+
37+
## Notes
38+
39+
- Feedback is sent via Sentry's telemetry system
40+
- If telemetry is disabled (`SENTRY_CLI_NO_TELEMETRY=1`), feedback cannot be sent
41+
- All feedback is anonymous and used to improve the CLI

docs/src/content/docs/commands/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The Sentry CLI provides commands for interacting with various Sentry resources.
1515
| [`issue`](./issue/) | Issue tracking |
1616
| [`event`](./event/) | Event inspection |
1717
| [`api`](./api/) | Direct API access |
18+
| [`feedback`](./feedback/) | Send feedback about the CLI |
1819

1920
## Global Options
2021

plugins/sentry-cli/skills/sentry-cli/SKILL.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,29 @@ Update the Sentry CLI to the latest version
376376
- `--check - Check for updates without installing`
377377
- `--method <value> - Installation method to use (curl, npm, pnpm, bun, yarn)`
378378

379+
### Feedback
380+
381+
Send feedback about the CLI
382+
383+
#### `sentry feedback <message...>`
384+
385+
Send feedback about the CLI
386+
387+
**Examples:**
388+
389+
```bash
390+
sentry feedback <message>
391+
392+
# Send positive feedback
393+
sentry feedback i love this tool
394+
395+
# Report an issue
396+
sentry feedback the issue view is confusing
397+
398+
# Suggest an improvement
399+
sentry feedback would be great to have a search command
400+
```
401+
379402
## Output Formats
380403

381404
### JSON Output

src/app.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import { apiCommand } from "./commands/api.js";
1010
import { authRoute } from "./commands/auth/index.js";
1111
import { eventRoute } from "./commands/event/index.js";
12+
import { feedbackCommand } from "./commands/feedback.js";
1213
import { helpCommand } from "./commands/help.js";
1314
import { issueRoute } from "./commands/issue/index.js";
1415
import { orgRoute } from "./commands/org/index.js";
@@ -29,6 +30,7 @@ export const routes = buildRouteMap({
2930
event: eventRoute,
3031
api: apiCommand,
3132
upgrade: upgradeCommand,
33+
feedback: feedbackCommand,
3234
},
3335
aliases: {
3436
update: "upgrade",

src/commands/feedback.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/**
2+
* Feedback Command
3+
*
4+
* Allows users to submit feedback about the CLI.
5+
* All arguments after 'feedback' are joined into a single message.
6+
*
7+
* @example sentry feedback i love this tool
8+
* @example sentry feedback the issue view is confusing
9+
*/
10+
11+
// biome-ignore lint/performance/noNamespaceImport: Sentry SDK recommends namespace import
12+
import * as Sentry from "@sentry/bun";
13+
import { buildCommand } from "@stricli/core";
14+
import type { SentryContext } from "../context.js";
15+
import { ValidationError } from "../lib/errors.js";
16+
17+
export const feedbackCommand = buildCommand({
18+
docs: {
19+
brief: "Send feedback about the CLI",
20+
fullDescription:
21+
"Submit feedback about your experience with the Sentry CLI. " +
22+
"All text after 'feedback' is sent as your message.",
23+
},
24+
parameters: {
25+
flags: {},
26+
positional: {
27+
kind: "array",
28+
parameter: {
29+
brief: "Your feedback message",
30+
parse: String,
31+
placeholder: "message",
32+
},
33+
},
34+
},
35+
// biome-ignore lint/complexity/noBannedTypes: Stricli requires empty object for commands with no flags
36+
async func(this: SentryContext, _flags: {}, ...messageParts: string[]) {
37+
const { stdout, stderr } = this;
38+
const message = messageParts.join(" ");
39+
40+
if (!message.trim()) {
41+
throw new ValidationError("Please provide a feedback message.");
42+
}
43+
44+
if (!Sentry.isEnabled()) {
45+
stderr.write("Feedback not sent: telemetry is disabled.\n");
46+
stderr.write("Unset SENTRY_CLI_NO_TELEMETRY to enable feedback.\n");
47+
return;
48+
}
49+
50+
Sentry.captureFeedback({ message });
51+
52+
// Flush to ensure feedback is sent before process exits
53+
const sent = await Sentry.flush(3000);
54+
55+
if (sent) {
56+
stdout.write("Feedback submitted. Thank you!\n");
57+
} else {
58+
stderr.write("Feedback may not have been sent (network timeout).\n");
59+
}
60+
},
61+
});

0 commit comments

Comments
 (0)