Skip to content

Commit aabe4ae

Browse files
celestial-vaultElephant Lumps
andauthored
Check if new user (RooCodeInc#3586)
* add detection for new users for intro component * fix lint issue * changeset * remove redundant fragment --------- Co-authored-by: Elephant Lumps <[email protected]>
1 parent 5147e28 commit aabe4ae

File tree

6 files changed

+23
-0
lines changed

6 files changed

+23
-0
lines changed

.changeset/cool-mugs-admire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"claude-dev": minor
3+
---
4+
5+
Add detection for new users to display special components

src/core/controller/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,18 @@ export class Controller {
146146
chatSettings,
147147
shellIntegrationTimeout,
148148
enableCheckpointsSetting,
149+
isNewUser,
150+
taskHistory,
149151
} = await getAllExtensionState(this.context)
150152

153+
const NEW_USER_TASK_COUNT_THRESHOLD = 10
154+
155+
// Check if the user has completed enough tasks to no longer be considered a "new user"
156+
if (isNewUser && !historyItem && taskHistory && taskHistory.length >= NEW_USER_TASK_COUNT_THRESHOLD) {
157+
await updateGlobalState(this.context, "isNewUser", false)
158+
await this.postStateToWebview()
159+
}
160+
151161
if (autoApprovalSettings) {
152162
const updatedAutoApprovalSettings = {
153163
...autoApprovalSettings,
@@ -1357,6 +1367,7 @@ export class Controller {
13571367
enableCheckpointsSetting,
13581368
globalClineRulesToggles,
13591369
shellIntegrationTimeout,
1370+
isNewUser,
13601371
} = await getAllExtensionState(this.context)
13611372

13621373
const localClineRulesToggles =
@@ -1399,6 +1410,7 @@ export class Controller {
13991410
localCursorRulesToggles: localCursorRulesToggles || {},
14001411
workflowToggles: workflowToggles || {},
14011412
shellIntegrationTimeout,
1413+
isNewUser,
14021414
}
14031415
}
14041416

src/core/storage/state-keys.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,6 @@ export type GlobalStateKey =
8888
| "favoritedModelIds"
8989
| "requestTimeoutMs"
9090
| "shellIntegrationTimeout"
91+
| "isNewUser"
9192

9293
export type LocalStateKey = "localClineRulesToggles"

src/core/storage/state.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ async function migrateEnableCheckpointsSetting(enableCheckpointsSettingRaw: bool
7676

7777
export async function getAllExtensionState(context: vscode.ExtensionContext) {
7878
const [
79+
isNewUser,
7980
storedApiProvider,
8081
apiModelId,
8182
apiKey,
@@ -162,6 +163,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
162163
enableCheckpointsSettingRaw,
163164
mcpMarketplaceEnabledRaw,
164165
] = await Promise.all([
166+
getGlobalState(context, "isNewUser") as Promise<boolean | undefined>,
165167
getGlobalState(context, "apiProvider") as Promise<ApiProvider | undefined>,
166168
getGlobalState(context, "apiModelId") as Promise<string | undefined>,
167169
getSecret(context, "apiKey") as Promise<string | undefined>,
@@ -354,6 +356,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) {
354356
favoritedModelIds,
355357
requestTimeoutMs,
356358
},
359+
isNewUser: isNewUser ?? true,
357360
lastShownAnnouncementId,
358361
customInstructions,
359362
taskHistory,

src/shared/ExtensionMessage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export type Platform = "aix" | "darwin" | "freebsd" | "linux" | "openbsd" | "sun
115115
export const DEFAULT_PLATFORM = "unknown"
116116

117117
export interface ExtensionState {
118+
isNewUser: boolean
118119
apiConfiguration?: ApiConfiguration
119120
autoApprovalSettings: AutoApprovalSettings
120121
browserSettings: BrowserSettings

webview-ui/src/context/ExtensionStateContext.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export const ExtensionStateContextProvider: React.FC<{
8080
localWindsurfRulesToggles: {},
8181
workflowToggles: {},
8282
shellIntegrationTimeout: 4000, // default timeout for shell integration
83+
isNewUser: false,
8384
})
8485
const [didHydrateState, setDidHydrateState] = useState(false)
8586
const [showWelcome, setShowWelcome] = useState(false)

0 commit comments

Comments
 (0)