From e3e3965b425dfb4b17ddb4200f09ba68a9cec840 Mon Sep 17 00:00:00 2001 From: Felarof Date: Wed, 14 Jan 2026 15:28:30 -0800 Subject: [PATCH] chore: refactor JTBD agent to have follow naming conventions and add conventions to claude.md --- apps/agent/CLAUDE.md | 9 +++++++++ apps/agent/entrypoints/options/App.tsx | 2 +- .../agent/entrypoints/options/create-graph/GraphChat.tsx | 2 +- .../options/jtbd-agent/{chat.tsx => SurveyChat.tsx} | 6 +++--- .../options/jtbd-agent/{header.tsx => SurveyHeader.tsx} | 0 .../options/jtbd-agent/{index.tsx => SurveyPage.tsx} | 8 ++++---- .../jtbd-agent/{welcome.tsx => SurveyWelcome.tsx} | 0 .../{voice-input-button.tsx => VoiceInputButton.tsx} | 0 .../options/jtbd-agent/{use-chat.ts => useSurveyChat.ts} | 0 .../jtbd-agent/{use-voice-input.ts => useVoiceInput.ts} | 0 apps/agent/entrypoints/sidepanel/index/Chat.tsx | 2 +- .../jtbd-popup/{use-jtbd-popup.ts => useJtbdPopup.ts} | 0 12 files changed, 19 insertions(+), 10 deletions(-) rename apps/agent/entrypoints/options/jtbd-agent/{chat.tsx => SurveyChat.tsx} (97%) rename apps/agent/entrypoints/options/jtbd-agent/{header.tsx => SurveyHeader.tsx} (100%) rename apps/agent/entrypoints/options/jtbd-agent/{index.tsx => SurveyPage.tsx} (94%) rename apps/agent/entrypoints/options/jtbd-agent/{welcome.tsx => SurveyWelcome.tsx} (100%) rename apps/agent/entrypoints/options/jtbd-agent/{voice-input-button.tsx => VoiceInputButton.tsx} (100%) rename apps/agent/entrypoints/options/jtbd-agent/{use-chat.ts => useSurveyChat.ts} (100%) rename apps/agent/entrypoints/options/jtbd-agent/{use-voice-input.ts => useVoiceInput.ts} (100%) rename apps/agent/lib/jtbd-popup/{use-jtbd-popup.ts => useJtbdPopup.ts} (100%) diff --git a/apps/agent/CLAUDE.md b/apps/agent/CLAUDE.md index eebf97696..3fdc48fd0 100644 --- a/apps/agent/CLAUDE.md +++ b/apps/agent/CLAUDE.md @@ -6,6 +6,15 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co - Write minimal code comments. Only add comments for non-obvious logic, complex algorithms, or critical warnings. Skip comments for self-explanatory code, obvious function names, and simple operations. +## File Naming Convention + +| Type | Convention | Example | +|------|------------|---------| +| Folders | kebab-case | `ai-settings/`, `jtbd-popup/`, `llm-hub/` | +| React components (.tsx) | PascalCase | `AISettingsPage.tsx`, `SurveyHeader.tsx` | +| Hooks (.ts) | camelCase with `use` prefix | `useRunWorkflow.ts`, `useVoiceInput.ts` | +| Non-component files (.ts) | lowercase | `types.ts`, `models.ts`, `storage.ts` | + ## Project Overview **BrowserOS Agent Chrome Extension** - This project contains the official chrome extension for BrowserOS Agent, enabling users to interact with the core functionalities of BrowserOS. diff --git a/apps/agent/entrypoints/options/App.tsx b/apps/agent/entrypoints/options/App.tsx index b4bde08ec..7ac65db4d 100644 --- a/apps/agent/entrypoints/options/App.tsx +++ b/apps/agent/entrypoints/options/App.tsx @@ -4,7 +4,7 @@ import { AISettingsPage } from './ai-settings/AISettingsPage' import { ConnectMCP } from './connect-mcp/ConnectMCP' import { CreateGraph } from './create-graph/CreateGraph' import { CustomizationPage } from './customization/CustomizationPage' -import { SurveyPage } from './jtbd-agent' +import { SurveyPage } from './jtbd-agent/SurveyPage' import { DashboardLayout } from './layout/DashboardLayout' import { LlmHubPage } from './llm-hub/LlmHubPage' import { MCPSettingsPage } from './mcp-settings/MCPSettingsPage' diff --git a/apps/agent/entrypoints/options/create-graph/GraphChat.tsx b/apps/agent/entrypoints/options/create-graph/GraphChat.tsx index 61956a4dc..83bc1aed7 100644 --- a/apps/agent/entrypoints/options/create-graph/GraphChat.tsx +++ b/apps/agent/entrypoints/options/create-graph/GraphChat.tsx @@ -9,7 +9,7 @@ import { GRAPH_MESSAGE_DISLIKE_EVENT, GRAPH_MESSAGE_LIKE_EVENT, } from '@/lib/constants/analyticsEvents' -import { useJtbdPopup } from '@/lib/jtbd-popup/use-jtbd-popup' +import { useJtbdPopup } from '@/lib/jtbd-popup/useJtbdPopup' import { track } from '@/lib/metrics/track' import { cn } from '@/lib/utils' diff --git a/apps/agent/entrypoints/options/jtbd-agent/chat.tsx b/apps/agent/entrypoints/options/jtbd-agent/SurveyChat.tsx similarity index 97% rename from apps/agent/entrypoints/options/jtbd-agent/chat.tsx rename to apps/agent/entrypoints/options/jtbd-agent/SurveyChat.tsx index 57e5aee2a..bab46fabb 100644 --- a/apps/agent/entrypoints/options/jtbd-agent/chat.tsx +++ b/apps/agent/entrypoints/options/jtbd-agent/SurveyChat.tsx @@ -4,9 +4,9 @@ import { MessageResponse } from '@/components/ai-elements/message' import { Button } from '@/components/ui/button' import { Textarea } from '@/components/ui/textarea' import { cn } from '@/lib/utils' -import type { Message } from './use-chat' -import { useVoiceInput } from './use-voice-input' -import { VoiceInputButton } from './voice-input-button' +import type { Message } from './useSurveyChat' +import { useVoiceInput } from './useVoiceInput' +import { VoiceInputButton } from './VoiceInputButton' interface Props { messages: Message[] diff --git a/apps/agent/entrypoints/options/jtbd-agent/header.tsx b/apps/agent/entrypoints/options/jtbd-agent/SurveyHeader.tsx similarity index 100% rename from apps/agent/entrypoints/options/jtbd-agent/header.tsx rename to apps/agent/entrypoints/options/jtbd-agent/SurveyHeader.tsx diff --git a/apps/agent/entrypoints/options/jtbd-agent/index.tsx b/apps/agent/entrypoints/options/jtbd-agent/SurveyPage.tsx similarity index 94% rename from apps/agent/entrypoints/options/jtbd-agent/index.tsx rename to apps/agent/entrypoints/options/jtbd-agent/SurveyPage.tsx index bd3864e20..0bd886386 100644 --- a/apps/agent/entrypoints/options/jtbd-agent/index.tsx +++ b/apps/agent/entrypoints/options/jtbd-agent/SurveyPage.tsx @@ -2,10 +2,10 @@ import { AlertCircle, CheckCircle2, RotateCcw } from 'lucide-react' import type { FC } from 'react' import { Button } from '@/components/ui/button' import { jtbdPopupStorage } from '@/lib/jtbd-popup/storage' -import { Chat } from './chat' -import { Header } from './header' -import { useChat } from './use-chat' -import { Welcome } from './welcome' +import { Chat } from './SurveyChat' +import { Header } from './SurveyHeader' +import { Welcome } from './SurveyWelcome' +import { useChat } from './useSurveyChat' const ThankYouCard: FC<{ onReset: () => void }> = ({ onReset }) => (
diff --git a/apps/agent/entrypoints/options/jtbd-agent/welcome.tsx b/apps/agent/entrypoints/options/jtbd-agent/SurveyWelcome.tsx similarity index 100% rename from apps/agent/entrypoints/options/jtbd-agent/welcome.tsx rename to apps/agent/entrypoints/options/jtbd-agent/SurveyWelcome.tsx diff --git a/apps/agent/entrypoints/options/jtbd-agent/voice-input-button.tsx b/apps/agent/entrypoints/options/jtbd-agent/VoiceInputButton.tsx similarity index 100% rename from apps/agent/entrypoints/options/jtbd-agent/voice-input-button.tsx rename to apps/agent/entrypoints/options/jtbd-agent/VoiceInputButton.tsx diff --git a/apps/agent/entrypoints/options/jtbd-agent/use-chat.ts b/apps/agent/entrypoints/options/jtbd-agent/useSurveyChat.ts similarity index 100% rename from apps/agent/entrypoints/options/jtbd-agent/use-chat.ts rename to apps/agent/entrypoints/options/jtbd-agent/useSurveyChat.ts diff --git a/apps/agent/entrypoints/options/jtbd-agent/use-voice-input.ts b/apps/agent/entrypoints/options/jtbd-agent/useVoiceInput.ts similarity index 100% rename from apps/agent/entrypoints/options/jtbd-agent/use-voice-input.ts rename to apps/agent/entrypoints/options/jtbd-agent/useVoiceInput.ts diff --git a/apps/agent/entrypoints/sidepanel/index/Chat.tsx b/apps/agent/entrypoints/sidepanel/index/Chat.tsx index 9a0104ca4..3ecc54b70 100644 --- a/apps/agent/entrypoints/sidepanel/index/Chat.tsx +++ b/apps/agent/entrypoints/sidepanel/index/Chat.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef, useState } from 'react' import { createBrowserOSAction } from '@/lib/chat-actions/types' import { SIDEPANEL_AI_TRIGGERED_EVENT } from '@/lib/constants/analyticsEvents' -import { useJtbdPopup } from '@/lib/jtbd-popup/use-jtbd-popup' +import { useJtbdPopup } from '@/lib/jtbd-popup/useJtbdPopup' import { track } from '@/lib/metrics/track' import { ChatEmptyState } from './ChatEmptyState' import { ChatError } from './ChatError' diff --git a/apps/agent/lib/jtbd-popup/use-jtbd-popup.ts b/apps/agent/lib/jtbd-popup/useJtbdPopup.ts similarity index 100% rename from apps/agent/lib/jtbd-popup/use-jtbd-popup.ts rename to apps/agent/lib/jtbd-popup/useJtbdPopup.ts