MCPcopy Create free account
hub / github.com/arctic-cli/interface / handler

Function handler

packages/arctic/src/cli/cmd/bug.ts:11–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9 command: "bug",
10 describe: "report a bug to the Arctic team",
11 async handler() {
12 UI.empty()
13 prompts.intro("Bug Report")
14
15 const description = await prompts.text({
16 message: "Describe the bug",
17 placeholder: "What happened? What did you expect to happen?",
18 validate: (value) => {
19 if (!value || value.trim().length === 0) return "Please describe the bug"
20 if (value.trim().length < 20) return "Please provide more detail (at least 20 characters)"
21 return
22 },
23 })
24
25 if (prompts.isCancel(description)) {
26 prompts.outro("Cancelled")
27 return
28 }
29
30 const steps = await prompts.text({
31 message: "Steps to reproduce (optional)",
32 placeholder: "1. Go to... 2. Click on... 3. See error...",
33 })
34
35 if (prompts.isCancel(steps)) {
36 prompts.outro("Cancelled")
37 return
38 }
39
40 const context = await prompts.confirm({
41 message: "Include system info (OS, Arctic version) in the report?",
42 initialValue: true,
43 })
44
45 if (prompts.isCancel(context)) {
46 prompts.outro("Cancelled")
47 return
48 }
49
50 await Telemetry.track("bug.reported", {
51 hasSteps: steps ? true : false,
52 length: description.length,
53 })
54 await Telemetry.flush()
55
56 const issueURL = new URL("https://github.com/arctic-cli/interface/issues/new?template=bug-report.yml")
57 issueURL.searchParams.set("title", `bug: ${description.slice(0, 100)}`)
58
59 let fullDescription = description
60 if (steps) {
61 fullDescription += `\n\n## Steps to Reproduce\n${steps}`
62 }
63 if (context) {
64 fullDescription += `\n\n## System Info\n- Arctic version: ${Installation.VERSION}\n- Channel: ${Installation.CHANNEL}\n- OS: ${os.platform()} ${os.arch()}\n- Node version: ${process.version}`
65 }
66 issueURL.searchParams.set("description", fullDescription)
67
68 prompts.log.success("Thank you for reporting this bug!")

Callers

nothing calls this directly

Calls 4

flushMethod · 0.80
textMethod · 0.65
setMethod · 0.45
messageMethod · 0.45

Tested by

no test coverage detected