Skip to content

Commit 34b00c9

Browse files
daniel-lxshannesrudolph
authored andcommitted
feat: track slash command usage via UI clicks instead of text detection
- Remove detectSlashCommands utility and its usage from Task.ts - Add telemetry tracking to SlashCommandsList for popover clicks - Add telemetry tracking to ChatTextArea for context menu selections - Track both mode switches and custom commands with appropriate types - Delete unused slashCommandDetection.ts and its tests
1 parent f1b9ecc commit 34b00c9

File tree

4 files changed

+14
-271
lines changed

4 files changed

+14
-271
lines changed

src/core/task/Task.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ import {
3939
import { TelemetryService } from "@roo-code/telemetry"
4040
import { CloudService, BridgeOrchestrator } from "@roo-code/cloud"
4141

42-
// utils
43-
import { detectSlashCommands } from "../../utils/slashCommandDetection"
44-
4542
// api
4643
import { ApiHandler, ApiHandlerCreateMessageMetadata, buildApiHandler } from "../../api"
4744
import { ApiStream, GroundingSource } from "../../api/transform/stream"
@@ -903,7 +900,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
903900
this.askResponse = askResponse
904901
this.askResponseText = text
905902
this.askResponseImages = images
906-
907903
// Create a checkpoint whenever the user sends a message.
908904
// Use allowEmpty=true to ensure a checkpoint is recorded even if there are no file changes.
909905
// Suppress the checkpoint_saved chat row for this particular checkpoint to keep the timeline clean.
@@ -928,14 +924,6 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
928924
})
929925
}
930926
}
931-
932-
// Detect and track slash command usage
933-
if (askResponse === "messageResponse" && text && TelemetryService.hasInstance()) {
934-
const slashCommands = detectSlashCommands(text)
935-
for (const command of slashCommands) {
936-
TelemetryService.instance.captureSlashCommandUsed(this.taskId, command.type, command.commandName)
937-
}
938-
}
939927
}
940928

941929
public approveAsk({ text, images }: { text?: string; images?: string[] } = {}) {

src/utils/__tests__/slashCommandDetection.spec.ts

Lines changed: 0 additions & 191 deletions
This file was deleted.

src/utils/slashCommandDetection.ts

Lines changed: 0 additions & 68 deletions
This file was deleted.

webview-ui/src/components/chat/ChatTextArea.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import {
2222
import { cn } from "@src/lib/utils"
2323
import { convertToMentionPath } from "@src/utils/path-mentions"
2424
import { StandardTooltip } from "@src/components/ui"
25+
import { telemetryClient } from "@src/utils/TelemetryClient"
26+
import { TelemetryEventName } from "@roo-code/types"
2527

2628
import Thumbnails from "../common/Thumbnails"
2729
import { ModeSelector } from "./ModeSelector"
@@ -299,6 +301,12 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
299301
}
300302

301303
if (type === ContextMenuOptionType.Mode && value) {
304+
// Track telemetry for mode selection from context menu
305+
telemetryClient.capture(TelemetryEventName.SLASH_COMMAND_USED, {
306+
commandType: "mode",
307+
commandName: value,
308+
})
309+
302310
// Handle mode selection.
303311
setMode(value)
304312
setInputValue("")
@@ -308,6 +316,12 @@ export const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
308316
}
309317

310318
if (type === ContextMenuOptionType.Command && value) {
319+
// Track telemetry for slash command usage from context menu
320+
telemetryClient.capture(TelemetryEventName.SLASH_COMMAND_USED, {
321+
commandType: "custom",
322+
commandName: value,
323+
})
324+
311325
// Handle command selection.
312326
setSelectedMenuIndex(-1)
313327
setInputValue("")

0 commit comments

Comments
 (0)