| 7 | command: "feedback", |
| 8 | describe: "send feedback to the Arctic team", |
| 9 | async handler() { |
| 10 | UI.empty() |
| 11 | prompts.intro("Feedback") |
| 12 | |
| 13 | const feedback = await prompts.text({ |
| 14 | message: "What would you like to tell us?", |
| 15 | placeholder: "I love Arctic because... or I wish Arctic could...", |
| 16 | validate: (value) => { |
| 17 | if (!value || value.trim().length === 0) return "Please enter some feedback" |
| 18 | if (value.trim().length < 10) return "Please provide a bit more detail (at least 10 characters)" |
| 19 | return |
| 20 | }, |
| 21 | }) |
| 22 | |
| 23 | if (prompts.isCancel(feedback)) { |
| 24 | prompts.outro("Cancelled") |
| 25 | return |
| 26 | } |
| 27 | |
| 28 | const category = await prompts.select({ |
| 29 | message: "What type of feedback is this?", |
| 30 | options: [ |
| 31 | { value: "feature", label: "Feature Request", hint: "Something you'd like to see added" }, |
| 32 | { value: "improvement", label: "Improvement", hint: "Something that could work better" }, |
| 33 | { value: "praise", label: "Praise", hint: "Tell us what you love" }, |
| 34 | { value: "other", label: "Other", hint: "Anything else" }, |
| 35 | ], |
| 36 | }) |
| 37 | |
| 38 | if (prompts.isCancel(category)) { |
| 39 | prompts.outro("Cancelled") |
| 40 | return |
| 41 | } |
| 42 | |
| 43 | const confirm = await prompts.confirm({ |
| 44 | message: "Would you like to include your feedback in anonymous telemetry to help us improve?", |
| 45 | initialValue: true, |
| 46 | }) |
| 47 | |
| 48 | if (prompts.isCancel(confirm)) { |
| 49 | prompts.outro("Cancelled") |
| 50 | return |
| 51 | } |
| 52 | |
| 53 | if (confirm) { |
| 54 | await Telemetry.track("feedback.submitted", { |
| 55 | category: category as string, |
| 56 | length: feedback.length, |
| 57 | }) |
| 58 | await Telemetry.flush() |
| 59 | } |
| 60 | |
| 61 | const issueURL = new URL("https://github.com/arctic-cli/interface/issues/new?template=feature-request.yml") |
| 62 | issueURL.searchParams.set("title", `${category}: ${feedback.slice(0, 100)}`) |
| 63 | issueURL.searchParams.set("description", feedback) |
| 64 | |
| 65 | prompts.log.success("Thank you for your feedback!") |
| 66 | prompts.log.message(``) |