Skip to content

Commit 9977837

Browse files
committed
feat: added pear ai creator mode with backend only flag to not show it to the users when we don't want it to
1 parent 1fd2f29 commit 9977837

8 files changed

Lines changed: 20 additions & 7 deletions

File tree

src/activate/registerPearListener.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as vscode from "vscode"
22
import { ClineProvider } from "../core/webview/ClineProvider"
33
import { assert } from "../utils/util"
4+
import { PEARAI_CREATOR_MODE_WEBAPP_MANAGER_SLUG } from "../shared/modes"
45

56
export const getPearaiExtension = async () => {
67
const pearAiExtension = vscode.extensions.getExtension("pearai.pearai")
@@ -51,7 +52,11 @@ export const registerPearListener = async (provider: ClineProvider) => {
5152
await new Promise((resolve) => setTimeout(resolve, 3000))
5253

5354
// * This does actually work but the UI update does not happen. This method calls this.postStateToWebview() so not sure what is going on - James
54-
await provider.handleModeSwitch("Creator")
55+
if(msg.newProjectType !== "NONE") {
56+
// Only switch to the creator manager if we're creating a new project
57+
// TODO: later when we need to make a different type of project, we need to change this
58+
await provider.handleModeSwitch(PEARAI_CREATOR_MODE_WEBAPP_MANAGER_SLUG);
59+
}
5560

5661
// Clicl the chat btn
5762
await provider.postMessageToWebview({ type: "action", action: "chatButtonClicked" })

src/exports/roo-code.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ type GlobalSettings = {
364364
]
365365
)[]
366366
source?: ("global" | "project") | undefined
367+
backendOnly?: boolean | undefined
367368
}[]
368369
| undefined
369370
customModePrompts?:

src/exports/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ type GlobalSettings = {
367367
]
368368
)[]
369369
source?: ("global" | "project") | undefined
370+
backendOnly?: boolean | undefined
370371
}[]
371372
| undefined
372373
customModePrompts?:

src/schemas/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ export const modeConfigSchema = z.object({
215215
customInstructions: z.string().optional(),
216216
groups: groupEntryArraySchema,
217217
source: z.enum(["global", "project"]).optional(),
218+
backendOnly: z.boolean().optional()
218219
})
219220

220221
export type ModeConfig = z.infer<typeof modeConfigSchema>

src/shared/modes.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,17 @@ export function getToolsForMode(groups: readonly GroupEntry[]): string[] {
5151
return Array.from(tools)
5252
}
5353

54+
export const PEARAI_CREATOR_MODE_WEBAPP_MANAGER_SLUG = 'pearai-creator-webapp-manager' as const;
55+
5456
// Main modes configuration as an ordered array
5557
export const modes: readonly ModeConfig[] = [
5658
{
57-
slug: "creator",
58-
name: "Creator",
59-
// TODO: CHANGE ME TO ACTUALLY BE LIKE THE CREATOR MODE WE WANT
59+
slug: PEARAI_CREATOR_MODE_WEBAPP_MANAGER_SLUG,
60+
name: "🍐 PearAI Creator Webapp Manager",
6061
roleDefinition:
61-
"You are PearAI Agent (Powered by Roo Code / Cline), a creative and systematic software architect focused on turning high-level ideas into actionable plans. Your primary goal is to help users transform their ideas into structured action plans.",
62+
"<PEARAI CREATOR_WEBAPP_MANAGER></PEARAL_CREATOR_WEBAPP_MANAGER>",
6263
groups: ["read", "edit", "browser", "command", "mcp"],
64+
backendOnly: true,
6365
},
6466
{
6567
slug: "code",

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
10391039
value: mode.slug,
10401040
label: mode.name,
10411041
type: DropdownOptionType.ITEM,
1042+
backendOnly: mode.backendOnly
10421043
})),
10431044
{
10441045
value: "sep-1",

webview-ui/src/components/prompts/PromptsView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
6868
const [visualMode, setVisualMode] = useState(mode)
6969

7070
// Memoize modes to preserve array order
71-
const modes = useMemo(() => getAllModes(customModes), [customModes])
71+
const modes = useMemo(() => getAllModes(customModes).filter(x => !x.backendOnly), [customModes])
7272

7373
const [testPrompt, setTestPrompt] = useState("")
7474
const [isEnhancing, setIsEnhancing] = useState(false)

webview-ui/src/components/ui/select-dropdown.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export interface DropdownOption {
2121
disabled?: boolean
2222
type?: DropdownOptionType
2323
pinned?: boolean
24+
backendOnly?: boolean;
2425
}
2526

2627
export interface SelectDropdownProps {
@@ -157,7 +158,8 @@ export const SelectDropdown = React.memo(
157158
result.pop()
158159
}
159160

160-
return result
161+
// filtering out "backendOnly" options
162+
return result.filter(x => !x.backendOnly);
161163
}, [filteredOptions])
162164

163165
const handleSelect = React.useCallback(

0 commit comments

Comments
 (0)