Skip to content

feat(settings): guided MCP onboarding + reset app data#52

Merged
m-szymanska merged 2 commits into
developfrom
feat/mcp-onboarding-and-reset
Jul 6, 2026
Merged

feat(settings): guided MCP onboarding + reset app data#52
m-szymanska merged 2 commits into
developfrom
feat/mcp-onboarding-and-reset

Conversation

@m-szymanska

Copy link
Copy Markdown
Contributor

What

Two UX/product cuts around first-run experience and user data control:

1. Guided MCP setup instead of a dead end (72f3f23)

  • Fresh installs with no mcp.json previously hit a bare "MCP not configured" wall in onboarding with no path forward.
  • The agentic readiness step now shows a short explainer (what MCP servers add, that they are optional) with two actions: Set up MCP servers (deep-links into Settings → Engine, where MCP management lives) and Skip for now.
  • The Settings MCP section gets a matching human-friendly empty state with an add-first-server action.
  • No new onboarding steps added — the persisted step-index resume contract (12 load-bearing indexes, mirrored in Rust) is untouched.

2. Reset app data (384ce9a)

  • Settings → Engine gains a danger-zone Reset app data… action: two-step destructive confirmation listing exactly what is removed (conversation history, transcriptions, logs, preferences, MCP config), with an opt-in checkbox to also remove API keys from the Keychain (default OFF).
  • Deletion is implemented Rust-side as CodescribeConfig.reset_app_data(include_keys): paths derive from Config::config_dir() / UserSettings::settings_dir() (honors CODESCRIBE_DATA_DIR, no hardcoded home), removal is tolerant to already-missing dirs, TCC grants are never touched. Swift clears the UserDefaults domain and relaunches into a fresh onboarding.
  • Unit test covers reset scope following the data dir and idempotency (tempdir, no real home touched).

Gates

cargo fmt --check / clippy -D warnings clean · cargo test -p codescribe-ffi 42 passed · cargo test -p codescribe -p codescribe-core all suites 0 failed · make app PROFILE=debug and release build both BUILD SUCCEEDED.

Notes for review

  • showSettingsWindow: is a private-but-stable selector (macOS 14+), used with a showPreferencesWindow: fallback.
  • Runtime click-through smoke (onboarding → Settings deep-link, reset → relaunch) still pending on a live install.

🤖 Generated with Claude Code

m-szymanska and others added 2 commits July 5, 2026 21:55
When the agentic-readiness step finds no MCP server configured, show a
short human explainer plus "Set up MCP servers" (deep-links to Settings
> Engine) and "Skip for now" actions, replacing the old blank dead end.
Enrich the Settings MCP empty-state with the same optional-tool framing.
A one-shot SettingsDeepLink lets the wizard open the Settings window on
the MCP section.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add a destructive "Reset app data" danger zone at the foot of the Engine
panel: a two-step confirm that wipes all local codescribe data and, when
opted in, the Keychain API keys. The wipe logic lives in the Rust bridge
as reset_app_data(include_keys), removing the config/logs/transcription
tree and the Application Support store via the existing path helpers
(honoring CODESCRIBE_DATA_DIR, never hardcoding ~), plus the Keychain
bundle. Swift clears the UserDefaults domain and relaunches so the app
comes up fresh (onboarding from the top). TCC grants are left untouched.
Unit test asserts the reset scope follows CODESCRIBE_DATA_DIR and is
idempotent.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@m-szymanska m-szymanska merged commit ca6dc2f into develop Jul 6, 2026
2 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 384ce9a16c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +268 to +269
} else if !model.mcpSetupDismissed {
mcpSetupPrompt

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Show the MCP setup prompt for the no-config row

When mcp_status() runs with no mcp.json, it still returns a non-empty neutral row (probe_mcp_status_at reports no mcp.json), so after the readiness refresh model.mcpStatus satisfies the preceding if let mcp..., !mcp.rows.isEmpty and this new else never renders. In the fresh-install/no-MCP scenario the user only sees the status card, not the new setup/skip actions, so the onboarding route added here is effectively unreachable.

Useful? React with 👍 / 👎.

Comment thread bridge/src/config.rs
})?;
}
if include_keys {
for account in KEYCHAIN_ACCOUNTS {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear account-login tokens during reset

When a user has signed in with ChatGPT and then chooses Reset app data with key removal, this loop only deletes KEYCHAIN_ACCOUNTS. Provider account tokens are stored in the same Keychain bundle under LLM_OPENAI_ACCOUNT_TOKENS via account_auth::store_account_tokens, and that account is not in KEYCHAIN_ACCOUNTS, so the relaunched “fresh” app can still report the provider account as signed in and retain OAuth tokens after the privacy reset.

Useful? React with 👍 / 👎.

Comment on lines +225 to +227
if !NSApp.sendAction(Selector(("showSettingsWindow:")), to: nil, from: nil) {
// Older selector name kept as a defensive fallback.
_ = NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the supported Settings opener

For the setup button path, this relies on the private showSettingsWindow:/old showPreferencesWindow: responder chain. The tray settings entry in this repo was already moved to @Environment(\.openSettings) because that selector stopped working on newer macOS; in those environments clicking “Set up MCP servers” merely sets pendingSection and neither action opens the window, leaving the onboarding user with no route to the MCP editor.

Useful? React with 👍 / 👎.

Comment thread bridge/src/config.rs
Comment on lines +706 to +707
let config_dir = Config::config_dir();
let settings_dir = codescribe_core::config::UserSettings::settings_dir();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include the actual MCP config path in reset scope

When CODESCRIBE_DATA_DIR is set, these are the only reset targets, but the MCP management/probe path still comes from default_mcp_config_path() as $HOME/.codescribe/mcp.json. In that supported override context, Reset app data leaves the configured MCP servers file behind, so the relaunched app is not fresh and still shows the old MCP configuration despite the confirmation saying MCP configuration is deleted.

Useful? React with 👍 / 👎.

Comment thread bridge/src/config.rs
/// UserDefaults (window frames / SwiftUI scene restoration) is a CFPreferences
/// domain with no core helper; the Swift caller clears it before relaunch.
pub fn reset_app_data(&self, include_keys: bool) -> Result<(), CsError> {
for dir in app_data_dirs() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid wiping files before Keychain can fail

When includeKeys is enabled and any Keychain delete returns an error (for example the user denies Keychain access), this removes both data directories first and then returns without relaunching or clearing defaults. That leaves the running app in a partially reset state even though SettingsViewModel.resetAppData treats failures as “nothing is relaunched”; deleting the Keychain entries before the filesystem wipe would avoid losing app data on a later Keychain failure.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant