Skip to content

First-launch onboarding wizard: opt-in PATH, MCP, and skill setup #1180

Closed

Description

@malibio

Overview

After NodeSpace installs and nodespaced starts for the first time (#1179), show a one-time onboarding wizard that prompts the user to configure the three integration points: CLI PATH, Claude MCP, and Claude Code skill. Each step is opt-in and independent — users can skip any step and revisit later via #1181.

Problem Statement

After DMG install, three things need manual configuration for the full NodeSpace experience:

  1. nodespace CLI on $PATH — required for terminal use and agent access
  2. MCP config in Claude desktop — gives Claude AI direct knowledge graph access
  3. Skill file for Claude Code — gives Claude Code CLI knowledge graph access during coding sessions

Without prompting, users have no idea these integrations exist or how to set them up.

Proposed Solution

A modal wizard shown once on first launch (after daemon is confirmed running). Three sequential prompt screens, each with a primary action button and a "Skip" option. Completion state stored in ~/.nodespace/config.json so the wizard never shows again.

Screen 1: PATH

"Add NodeSpace to your terminal?"
Use nodespace commands directly from any terminal window.

[Add to PATH] [Skip]

Writes export PATH="$HOME/.nodespace/bin:$PATH" to ~/.zshrc and ~/.bash_profile (whichever exist). Shows confirmation with instruction to open a new terminal.

Screen 2: MCP

"Connect NodeSpace to Claude?"
Gives Claude desktop direct access to your knowledge graph as AI tools.

[Install MCP] [Skip]

Writes to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "nodespace": {
      "command": "nodespace",
      "args": ["mcp"]
    }
  }
}

Only shown if Claude desktop is detected (~/Library/Application Support/Claude/ exists).

Screen 3: Skill

"Add NodeSpace to Claude Code?"
Lets Claude Code read and write your knowledge graph during coding sessions.

[Add Skill] [Skip]

Writes SKILL.md to ~/.claude/skills/nodespace/SKILL.md. Only shown if ~/.claude/ exists.

Final screen

"You're all set!"
Shows summary of what was configured and what was skipped, with links to configure later via Settings → Integrations.

Acceptance Criteria

  • Wizard shown exactly once on first launch after daemon is confirmed running
  • Completion state persisted to ~/.nodespace/config.json — never shown again after completion or full skip
  • Screen 1: PATH — appends to ~/.zshrc / ~/.bash_profile on confirmation; shows success confirmation
  • Screen 2: MCP — only shown if Claude desktop detected; writes correct claude_desktop_config.json entry; handles existing mcpServers object without overwriting other entries
  • Screen 3: Skill — only shown if ~/.claude/ exists; writes SKILL.md to correct path
  • Each screen has primary action + Skip; skipped steps recorded in config
  • Summary screen shows what was set up vs skipped with link to Settings → Integrations
  • All three actions idempotent — safe to run again from Settings without duplicating entries
  • bun run test:all passes
  • bun run quality:fix passes

Technical Specifications

Reference Files

  • packages/desktop-app/src-tauri/src/main.rs — setup hook where wizard is triggered after daemon ping
  • packages/desktop-app/src/lib/components/onboarding/ — new Svelte wizard components
  • packages/desktop-app/src-tauri/src/commands/onboarding.rs — new Tauri commands for file writes (PATH append, MCP config write, skill write)
  • ~/.nodespace/config.json — persists onboarding_completed: true and per-step status

Config schema

{
  "onboarding_completed": true,
  "integrations": {
    "path_configured": true,
    "mcp_configured": false,
    "skill_configured": true
  }
}

Detection logic (Tauri backend)

  • Claude desktop: check ~/Library/Application Support/Claude/ exists
  • Claude Code skill: check ~/.claude/ exists
  • PATH already set: check if ~/.nodespace/bin already in $PATH

MCP config write (safe merge)

Read existing claude_desktop_config.json if present, merge nodespace into mcpServers object, write back. Never overwrite other MCP server entries.

Dependencies

Related Issues

Non-Goals

  • Auto-detecting other agents beyond Claude desktop and Claude Code
  • Homebrew / Windows installer integration
  • Skill content authoring (SKILL.md content is pre-written, not user-editable here)

Activity

  1. malibio commented on May 19, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 4 failed | 125 passed (129 files)

  2. self-assigned this
    on May 19, 2026
  3. malibio commented on May 19, 2026

    @malibio
    CollaboratorAuthor

    Code Review — Issue #1180: First-Launch Onboarding Wizard

    Reviewer: Principal Engineer (automated review)
    Branch: worktree-issue-1180-onboarding-wizard
    Commit: 4c66b1e2
    Files reviewed: 5 changed files, 860 lines added


    Summary

    This is a solid, well-scoped implementation of a first-launch onboarding wizard. The backend logic is idiomatic async Rust, the Svelte 5 component uses runes correctly, logging standards are followed throughout, and the MCP merge path correctly avoids clobbering existing server entries. All acceptance criteria are met functionally. Three issues require attention before merge — one Critical (process panic risk), one Important (missing user-facing error feedback), and several minor items.


    Critical Issues

    [Critical/Blocker] configure_mcp: process panic if claude_desktop_config.json has a non-object JSON root
    packages/desktop-app/src-tauri/src/commands/onboarding.rs lines 155–171

    The command parses the existing Claude Desktop config with serde_json::from_str, which succeeds for any valid JSON — including arrays ([]) or scalars. After parsing, the code attempts root["mcpServers"] = serde_json::json!({}) using serde_json's IndexMut trait. When root is not a Value::Object, IndexMut with a &str key panics unconditionally in serde_json (it is explicitly documented to panic on non-Object values).

    The existing guard at line 166 (root.get("mcpServers").map_or(false, |v| v.is_object())) protects the nested assignment but does not guard against a non-object root. If a user has ever hand-edited their claude_desktop_config.json into an invalid-but-parseable form, invoking configure_mcp will crash the Tauri process.

    Fix: Validate the root after parsing:

    let mut root: serde_json::Value = if config_path.exists() {
        let raw = tokio::fs::read_to_string(&config_path).await
            .map_err(|e| format!("Failed to read Claude Desktop config: {e}"))?;
        let parsed: serde_json::Value = serde_json::from_str(&raw)
            .map_err(|e| format!("Claude Desktop config contains invalid JSON: {e}"))?;
        if !parsed.is_object() {
            return Err("Claude Desktop config is not a JSON object — cannot safely merge".into());
        }
        parsed
    } else {
        serde_json::json!({})
    };

    Important Issues

    [Important] No user-facing error feedback when a step action fails
    packages/desktop-app/src/lib/components/onboarding/onboarding-wizard.svelte lines 97–128

    All three handleConfigure* functions catch errors with log.error(...) and silently leave the UI unchanged. The user sees no indication that the action failed — the button stays enabled, the success banner never appears, and there is no error message. This violates basic UX contract: a user who clicks "Add to PATH" and gets a permissions failure has no way to know it didn't work.

    The fix is straightforward: add an errorMessage = $state<string | null>(null) reactive variable, set it in the catch blocks, and render a dismissible error banner in the template alongside the success banner. The isLoading reset in finally is already correct.


    Suggested Improvements

    [Improvement] Double IPC call to check_onboarding_status on every launch with a brief render gap
    packages/desktop-app/src/lib/components/layout/app-shell.svelte line 202 and onboarding-wizard.svelte line 71

    app-shell invokes check_onboarding_status to determine whether to show the wizard. The wizard then invokes the same command again in onMount to read showMcp, showSkill, and pathAlreadyConfigured. This means two round-trips on every first launch. More practically, the wizard renders with showMcp = false and showSkill = false as defaults while the second async call is in-flight — causing the step-indicator dots to shift when the response arrives.

    The clean resolution is to pass the full status as a prop from app-shell to OnboardingWizard rather than re-fetching. app-shell already has the full OnboardingStatus object in the .then() handler — it currently discards all fields except completed. Threading the full object as a prop eliminates the second IPC call and removes the transient render gap.

    [Improvement] configure_path succeeds silently when neither ~/.zshrc nor ~/.bash_profile exist
    packages/desktop-app/src-tauri/src/commands/onboarding.rs lines 134–139

    If neither file exists, both append_path_to_file calls return Ok(false) (file not found, no-op). The command returns Ok(()), the frontend sets pathDone = true, and the success banner tells the user "Added to ~/.zshrc and/or ~/.bash_profile" — which is false. On a macOS machine this is unlikely (zsh is the default shell and ~/.zshrc typically exists), but the discrepancy is misleading.

    configure_path already returns Ok(()) — consider returning a richer result type that indicates whether at least one file was modified, matching the append_path_to_file return signature that already produces bool. The frontend can then distinguish "added" from "nothing to write to."

    [Improvement] append_path_to_file reads the file twice
    packages/desktop-app/src-tauri/src/commands/onboarding.rs lines 87–96

    file_contains_nodespace_path reads the file (line 75), and then if the guard passes, append_path_to_file reads it again at line 91. For a desktop shell config file this is functionally harmless, but it is two filesystem round-trips for content that was already in memory. Refactor to a single read: read once, check for the marker string, and conditionally append — eliminating file_contains_nodespace_path as a separate function.


    Nitpicks

    Nit: onboarding-wizard.svelte line 384: The stepSequence derived uses a wrapped IIFE $derived((() => { ... })()). This is technically valid — $derived tracks reactive reads inside the synchronously-called IIFE — but $derived.by(() => { ... }) is the idiomatic Svelte 5 form for a block body. Prefer $derived.by for clarity.

    Nit: onboarding-wizard.svelte lines 187, 191: The stepSequence.indexOf(step) call inside the #each loop is O(n) per iteration, making the total O(n²) for the step dots. With a maximum of 4 steps this is entirely inconsequential, but a currentStepIndex derived variable would make the intent clearer.

    Nit: onboarding.rs line 92: The function signature is async fn file_contains_nodespace_path(path: &PathBuf). Prefer &Path over &PathBuf per Rust API guidelines — &PathBuf coerces to &Path at call sites but &Path is the more general and idiomatic borrow type.

    Nit: onboarding-wizard.svelte: No tests are included for this component. The step progression logic, the stepSequence derived, and the pathWasAlreadyConfigured branch conditions are unit-testable with vi.mock('@tauri-apps/api/core'). Given the acceptance criteria require bun run test:all to pass, this is not a blocker today, but the component has enough branching logic to warrant a test file before #1181 (Settings → Integrations) builds on top of it.


    Acceptance Criteria Verification

    Criterion Status
    Wizard shown exactly once on first launch PASS — onboarding_completed gate in check_onboarding_status
    Completion state persisted to ~/.nodespace/config.json PASS — complete_onboarding command with serde(default) schema
    PATH: appends to shell files; shows confirmation PARTIAL — idempotent logic correct; success banner shown even if no files existed (see Important issue above)
    MCP: only shown if Claude detected; merges without overwriting PARTIAL — detection correct; merge logic correct for well-formed JSON; panic risk on malformed root (see Critical)
    Skill: only shown if ~/.claude/ exists; writes to correct path PASS
    Each screen has primary action + Skip PASS
    Summary screen with configured/skipped status PASS
    All actions idempotent PASS — PATH checks for existing line; MCP overwrites only nodespace key; Skill is an overwrite (safe)
    bun run test:all passes Not verified in review (no CI output available)
    bun run quality:fix passes Not verified in review

    Verdict: Request Changes — the serde_json panic in configure_mcp on a malformed-but-valid JSON root is a process-crash vector that must be fixed before merge. The missing error feedback in the UI is strongly recommended. All other items are improvements or nits that can be addressed now or tracked as follow-up.

  4. added a commit that references this issue on Jun 22, 2026
    52e6ac1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions