diff --git a/.changeset/cool-mugs-admire.md b/.changeset/cool-mugs-admire.md new file mode 100644 index 00000000..39687197 --- /dev/null +++ b/.changeset/cool-mugs-admire.md @@ -0,0 +1,5 @@ +--- +"claude-dev": minor +--- + +Add detection for new users to display special components diff --git a/src/core/controller/index.ts b/src/core/controller/index.ts index 6be3cc92..bccc6142 100644 --- a/src/core/controller/index.ts +++ b/src/core/controller/index.ts @@ -146,8 +146,18 @@ export class Controller { chatSettings, shellIntegrationTimeout, enableCheckpointsSetting, + isNewUser, + taskHistory, } = await getAllExtensionState(this.context) + const NEW_USER_TASK_COUNT_THRESHOLD = 10 + + // Check if the user has completed enough tasks to no longer be considered a "new user" + if (isNewUser && !historyItem && taskHistory && taskHistory.length >= NEW_USER_TASK_COUNT_THRESHOLD) { + await updateGlobalState(this.context, "isNewUser", false) + await this.postStateToWebview() + } + if (autoApprovalSettings) { const updatedAutoApprovalSettings = { ...autoApprovalSettings, @@ -1357,6 +1367,7 @@ export class Controller { enableCheckpointsSetting, globalClineRulesToggles, shellIntegrationTimeout, + isNewUser, } = await getAllExtensionState(this.context) const localClineRulesToggles = @@ -1399,6 +1410,7 @@ export class Controller { localCursorRulesToggles: localCursorRulesToggles || {}, workflowToggles: workflowToggles || {}, shellIntegrationTimeout, + isNewUser, } } diff --git a/src/core/storage/state-keys.ts b/src/core/storage/state-keys.ts index c722013d..1fb89ceb 100644 --- a/src/core/storage/state-keys.ts +++ b/src/core/storage/state-keys.ts @@ -88,5 +88,6 @@ export type GlobalStateKey = | "favoritedModelIds" | "requestTimeoutMs" | "shellIntegrationTimeout" + | "isNewUser" export type LocalStateKey = "localClineRulesToggles" diff --git a/src/core/storage/state.ts b/src/core/storage/state.ts index 7f988d1f..0f6d366e 100644 --- a/src/core/storage/state.ts +++ b/src/core/storage/state.ts @@ -76,6 +76,7 @@ async function migrateEnableCheckpointsSetting(enableCheckpointsSettingRaw: bool export async function getAllExtensionState(context: vscode.ExtensionContext) { const [ + isNewUser, storedApiProvider, apiModelId, apiKey, @@ -162,6 +163,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) { enableCheckpointsSettingRaw, mcpMarketplaceEnabledRaw, ] = await Promise.all([ + getGlobalState(context, "isNewUser") as Promise, getGlobalState(context, "apiProvider") as Promise, getGlobalState(context, "apiModelId") as Promise, getSecret(context, "apiKey") as Promise, @@ -354,6 +356,7 @@ export async function getAllExtensionState(context: vscode.ExtensionContext) { favoritedModelIds, requestTimeoutMs, }, + isNewUser: isNewUser ?? true, lastShownAnnouncementId, customInstructions, taskHistory, diff --git a/src/shared/ExtensionMessage.ts b/src/shared/ExtensionMessage.ts index 93f0d0c7..cb342f2d 100644 --- a/src/shared/ExtensionMessage.ts +++ b/src/shared/ExtensionMessage.ts @@ -115,6 +115,7 @@ export type Platform = "aix" | "darwin" | "freebsd" | "linux" | "openbsd" | "sun export const DEFAULT_PLATFORM = "unknown" export interface ExtensionState { + isNewUser: boolean apiConfiguration?: ApiConfiguration autoApprovalSettings: AutoApprovalSettings browserSettings: BrowserSettings diff --git a/webview-ui/src/context/ExtensionStateContext.tsx b/webview-ui/src/context/ExtensionStateContext.tsx index 1b435c88..71f23fc5 100644 --- a/webview-ui/src/context/ExtensionStateContext.tsx +++ b/webview-ui/src/context/ExtensionStateContext.tsx @@ -80,6 +80,7 @@ export const ExtensionStateContextProvider: React.FC<{ localWindsurfRulesToggles: {}, workflowToggles: {}, shellIntegrationTimeout: 4000, // default timeout for shell integration + isNewUser: false, }) const [didHydrateState, setDidHydrateState] = useState(false) const [showWelcome, setShowWelcome] = useState(false)