Skip to content

Add ways to disable onboarding#245

Merged
wonderwhy-er merged 2 commits into
mainfrom
add-ways-to-disable-onboarding
Sep 18, 2025
Merged

Add ways to disable onboarding#245
wonderwhy-er merged 2 commits into
mainfrom
add-ways-to-disable-onboarding

Conversation

@wonderwhy-er

@wonderwhy-er wonderwhy-er commented Sep 18, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added a command-line option to disable onboarding for a session (--no-onboarding), with clear logging when active.
    • Onboarding is now automatically skipped in specific environments to streamline startup.
  • Documentation

    • Introduced a Command Line Options section detailing usage of --no-onboarding, environment behavior, and examples (direct node, npm scripts, and npx setups).
    • Added guidance on when onboarding is auto-disabled and where debug information appears.
    • Included notes about setup-time debug options and restarting the app after changing flags.

@coderabbitai

coderabbitai Bot commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds a CLI flag (--no-onboarding) and global variable (disableOnboarding) to control onboarding. Updates onboarding logic to short-circuit when the flag is set or when the client is desktop-commander. Logs informational/debug messages accordingly. Documentation updated with new Command Line Options and usage examples.

Changes

Cohort / File(s) Summary
Documentation: Command Line Options
README.md
Added a new “Command Line Options” section documenting --no-onboarding and setup-time --debug; provided examples for Node, npm scripts, and npx; noted automatic disable conditions and related debug logging.
CLI flag plumbing
src/index.ts, src/types.ts
Parsed --no-onboarding from process.argv; exposed as global disableOnboarding; logged presence to stderr; added global type declaration for disableOnboarding.
Onboarding gating updates
src/utils/usageTracker.ts
Updated shouldShowOnboarding to return false if global disableOnboarding is set; added dynamic check for currentClient.name === 'desktop-commander'; fall back with debug log on import failure; retained existing gating rules.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User as User
  participant CLI as CLI entry (src/index.ts)
  participant Global as Global State
  participant Tracker as usageTracker.shouldShowOnboarding
  participant Client as server.js (dynamic)

  User->>CLI: Launch app with args (e.g., --no-onboarding)
  CLI->>Global: Set disableOnboarding = true/false
  CLI->>Tracker: shouldShowOnboarding()
  alt Flag set
    Tracker->>Global: Read disableOnboarding
    Tracker-->>CLI: false (skip onboarding)
  else Flag not set
    Tracker->>Client: import server.js
    alt Client name is "desktop-commander"
      Tracker-->>CLI: false (skip onboarding)
    else Import fails or name differs
      Tracker-->>CLI: existing gating logic (stats/state/time)
    end
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • serg33v

Poem

I flip a flag, hop past the gate,
No carrots of prompts—accelerate!
A whisper to globals, a nod to the CLI,
Onboarding sleeps as commands fly by.
Debug burrows glow, logs twinkle bright—
Commander marches, light and tight. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Add ways to disable onboarding" is concise and accurately summarizes the primary changes (adding a --no-onboarding CLI flag, a global disable flag, and documentation updates), so it clearly communicates the main intent to reviewers.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-ways-to-disable-onboarding

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (4)
src/types.ts (1)

4-7: Type the global instead of using (global as any); augment NodeJS.Global

Define these globals on Node’s Global to get proper typing across the codebase and avoid any casts.

Apply:

 declare global {
-  var mcpTransport: FilteredStdioServerTransport | undefined;
-  var disableOnboarding: boolean | undefined;
+  var mcpTransport: FilteredStdioServerTransport | undefined;
+  var disableOnboarding: boolean | undefined;
+
+  // Provide property types on `global` for runtime access
+  namespace NodeJS {
+    interface Global {
+      mcpTransport?: FilteredStdioServerTransport;
+      disableOnboarding?: boolean;
+    }
+  }
 }
src/utils/usageTracker.ts (2)

385-400: Use typed global and structured logging; add debug when client gate disables onboarding

  • Avoid (global as any); rely on the typed global.
  • Emit a structured debug log when onboarding is disabled due to client detection.
  • Prefer logToStderr over console.log to keep stdout JSON-RPC clean.
+import { logToStderr } from './logger.js';
 ...
-// Check if onboarding is disabled via command line argument
-if ((global as any).disableOnboarding) {
+// Check if onboarding is disabled via command line argument
+if (global.disableOnboarding) {
   return false;
 }
 
 // Check if client is desktop-commander (disable for this client)
 try {
   const { currentClient } = await import('../server.js');
   if (currentClient?.name === 'desktop-commander') {
+    logToStderr('debug', 'Onboarding disabled for desktop-commander client');
     return false;
   }
 } catch (error) {
   // If we can't import server, continue with other checks
-  console.log('[ONBOARDING DEBUG] Could not check client name, continuing...');
+  logToStderr('debug', '[ONBOARDING] Could not check client name, continuing...');
 }

Note: There are other console.log calls later in this file (e.g., Lines 465, 486, 499). Consider switching them to logToStderr in a follow-up for consistency.


391-395: Avoid hard-coded client string

Extract 'desktop-commander' to a shared constant (e.g., in utils/logger.ts or a constants.ts) to keep the identifier consistent across logging and gating logic.

README.md (1)

660-697: Add debug note for client-based disabling; optional env example

  • You already document the flag-based log message. Add a line noting a debug log is emitted when onboarding is disabled for the desktop-commander client.
  • If you adopt the DC_DISABLE_ONBOARDING env var, add a short example.

Example additions:

  • “When the MCP client is ‘desktop-commander’, onboarding is disabled (debug log: ‘Onboarding disabled for desktop-commander client’).”
  • “Alternatively set DC_DISABLE_ONBOARDING=1 to disable onboarding without CLI args.”
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0a01551 and ad10078.

📒 Files selected for processing (4)
  • README.md (2 hunks)
  • src/index.ts (1 hunks)
  • src/types.ts (1 hunks)
  • src/utils/usageTracker.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/index.ts (1)
src/utils/logger.ts (1)
  • logToStderr (71-82)
src/utils/usageTracker.ts (1)
src/server.ts (1)
  • currentClient (132-132)

Comment thread README.md
Comment on lines +90 to +93
**Command line options during setup:**
- `--debug`: Enable debugging mode for Node.js inspector
- `--no-onboarding`: Disable onboarding prompts for new users

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

🧩 Analysis chain

Confirm: does setup honor --no-onboarding?

Docs list --no-onboarding under “Command line options during setup”, but the server entrypoint short-circuits on setup and the PR wires the flag for runtime only. Verify runSetup actually persists this flag (e.g., into Claude config args); otherwise, move this bullet to the runtime CLI section.


🏁 Script executed:

#!/bin/bash
# Check if setup pipeline consumes or persists --no-onboarding
rg -nC3 -S '\-\-no-onboarding|noOnboarding|disableOnboarding' --type ts --type tsx

Length of output: 27


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Searching for '--no-onboarding' or related identifiers..."
rg -nC3 -S '\-\-no-onboarding|noOnboarding|disableOnboarding' -g '!*node_modules/*' -g '!*dist/*' -g '!*build/*' || true

echo -e "\nSearching for runSetup definitions/usages..."
rg -nC3 -S '(\brunSetup\b|function\s+runSetup\b|export\s+function\s+runSetup\b|const\s+runSetup\b|async\s+function\s+runSetup\b)' -g '!*node_modules/*' -g '!*dist/*' -g '!*build/*' || true

echo -e "\nSearching for CLI parsers (commander|yargs|minimist|meow|caporal)..."
rg -nC3 -S '\b(commander|yargs|meow|minimist|caporal)\b' -g '!*node_modules/*' -g '!*dist/*' -g '!*build/*' || true

echo -e "\nSearching for process.argv usages..."
rg -nC3 -S 'process\.argv' -g '!*node_modules/*' -g '!*dist/*' -g '!*build/*' || true

if [ -f README.md ]; then
  echo -e "\nREADME.md lines 90-93:"
  nl -ba README.md | sed -n '90,93p' || true
fi

if [ -f package.json ]; then
  echo -e "\npackage.json scripts:"
  jq -r '.scripts' package.json || true
fi

exit 0

Length of output: 2395


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Repo root:"
ls -la || true

echo -e "\nFind files with 'setup-claude' in the name:"
find . -type f -iname "*setup-claude*" -print || true

echo -e "\nSearch for 'onboard' (onboarding, onboard) and '--no-onboarding' usages (exclude common build dirs):"
grep -RIn --binary-files=without-match --exclude-dir={node_modules,.git,dist,build} -e 'onboard' -e '--no-onboarding' -e 'noOnboarding' -e 'disableOnboarding' || true

echo -e "\nSearch for 'setup' script usages and 'process.argv' (to find flag parsing):"
grep -RIn --binary-files=without-match --exclude-dir={node_modules,.git,dist,build} -e 'process.argv' -e '\\bsetup\\b' -e 'runSetup' -e 'setup-claude-server' || true

echo -e "\nIf setup-claude-server.js exists at repo root or in dist, print first 300 lines:"
for f in setup-claude-server.js dist/setup-claude-server.js; do
  if [ -f "$f" ]; then
    echo "---- $f ----"
    sed -n '1,300p' "$f" || true
  else
    echo "$f: not found"
  fi
done

echo -e "\nShow README.md lines 90-93 (if present):"
if [ -f README.md ]; then
  sed -n '90,93p' README.md || true
else
  echo "README.md not found"
fi

Length of output: 26979


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== src/index.ts ==="
sed -n '1,240p' src/index.ts || true

echo -e "\n=== src/npm-scripts/setup.ts ==="
sed -n '1,400p' src/npm-scripts/setup.ts || true

echo -e "\n=== src/utils/usageTracker.ts (360-420) ==="
sed -n '360,420p' src/utils/usageTracker.ts || true

echo -e "\n=== grep for 'no-onboarding' / 'disableOnboarding' / 'onboard' in key files ==="
grep -nC2 --binary-files=without-match -e '--no-onboarding' -e 'disableOnboarding' -e 'onboard' setup-claude-server.js src/npm-scripts/setup.ts src/index.ts src/utils/usageTracker.ts || true

Length of output: 16029


Action: --no-onboarding is not honored during setup — update docs or persist the flag.

Verified: README lists --no-onboarding under setup (README.md lines 90–93) but code short-circuits on setup before parsing that flag (src/index.ts calls runSetup and returns). runSetup (src/npm-scripts/setup.ts) imports/executes setup-claude-server.js without passing args, and setup-claude-server.js contains no handling for --no-onboarding. Runtime handling exists (src/index.ts sets global.disableOnboarding; src/utils/usageTracker.ts reads it), so the flag only takes effect when starting the server, not during setup.

  • Fix options or docs: either move the README bullet to the runtime CLI section, or make setup persist/consume the flag (pass CLI args into setup-claude-server.js or write the flag into config during setup). Files to update: README.md (90–93), src/index.ts, src/npm-scripts/setup.ts, setup-claude-server.js (and optionally src/utils/usageTracker.ts).
🤖 Prompt for AI Agents
In README.md lines 90–93 and related setup flow (src/index.ts,
src/npm-scripts/setup.ts, setup-claude-server.js, optionally
src/utils/usageTracker.ts): the --no-onboarding flag is documented as a setup
option but is ignored during setup because runSetup returns before parsing args
and setup-claude-server.js is invoked without args; either update the README to
move/remove that bullet or make the flag persist/consumed during setup by
passing CLI args from src/index.ts through src/npm-scripts/setup.ts into
setup-claude-server.js and/or writing the flag into the config/storage used by
usageTracker so global.disableOnboarding is set during setup; modify README.md
(move the flag to runtime CLI section if choosing docs), and if implementing
behavior change, update src/index.ts to forward process.argv to runSetup, update
src/npm-scripts/setup.ts to forward args to the child/require of
setup-claude-server.js, and add handling in setup-claude-server.js to read the
flag and persist it to the same config/flag that src/utils/usageTracker.ts
reads.

Comment thread src/index.ts
Comment on lines +26 to +34
// Parse command line arguments for onboarding control
const DISABLE_ONBOARDING = process.argv.includes('--no-onboarding');
if (DISABLE_ONBOARDING) {
logToStderr('info', 'Onboarding disabled via --no-onboarding flag');
}

// Set global flag for onboarding control
(global as any).disableOnboarding = DISABLE_ONBOARDING;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

🧩 Analysis chain

Set the global flag without any; optional env support

Use the typed global and drop the any cast. Optionally support an env var for headless/packaged runs.

 // Parse command line arguments for onboarding control
-const DISABLE_ONBOARDING = process.argv.includes('--no-onboarding');
+const DISABLE_ONBOARDING =
+  process.argv.includes('--no-onboarding')
+  // Optional: allow env override (document if adopted)
+  || process.env.DC_DISABLE_ONBOARDING === '1'
+  || process.env.DC_DISABLE_ONBOARDING === 'true';

 if (DISABLE_ONBOARDING) {
   logToStderr('info', 'Onboarding disabled via --no-onboarding flag');
 }

 // Set global flag for onboarding control
-(global as any).disableOnboarding = DISABLE_ONBOARDING;
+global.disableOnboarding = DISABLE_ONBOARDING;

Verification script (ensures no remaining unsafe casts and that the flag is wired once):


🏁 Script executed:

#!/bin/bash
rg -nC2 -S '\(global as any\)\.disableOnboarding|global\.disableOnboarding|disableOnboarding' --type ts

Length of output: 749


Use the typed global (remove any) and add optional env override

src/types.ts already declares global.disableOnboarding; replace all casts and set the flag from args or an env var in src/index.ts, and update usages elsewhere.

Locations:

  • src/types.ts (declare global: disableOnboarding at line ~6)
  • src/index.ts (assignment at line 33) — suggested change below
  • src/utils/usageTracker.ts (check at line 386) — change if ((global as any).disableOnboarding)if (global.disableOnboarding)

Suggested diff for src/index.ts:

 // Parse command line arguments for onboarding control
-const DISABLE_ONBOARDING = process.argv.includes('--no-onboarding');
+const DISABLE_ONBOARDING =
+  process.argv.includes('--no-onboarding')
+  // Optional: allow env override (document if adopted)
+  || process.env.DC_DISABLE_ONBOARDING === '1'
+  || process.env.DC_DISABLE_ONBOARDING === 'true';

 if (DISABLE_ONBOARDING) {
   logToStderr('info', 'Onboarding disabled via --no-onboarding flag');
 }

 // Set global flag for onboarding control
-(global as any).disableOnboarding = DISABLE_ONBOARDING;
+global.disableOnboarding = DISABLE_ONBOARDING;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Parse command line arguments for onboarding control
const DISABLE_ONBOARDING = process.argv.includes('--no-onboarding');
if (DISABLE_ONBOARDING) {
logToStderr('info', 'Onboarding disabled via --no-onboarding flag');
}
// Set global flag for onboarding control
(global as any).disableOnboarding = DISABLE_ONBOARDING;
// Parse command line arguments for onboarding control
const DISABLE_ONBOARDING =
process.argv.includes('--no-onboarding')
// Optional: allow env override (document if adopted)
|| process.env.DC_DISABLE_ONBOARDING === '1'
|| process.env.DC_DISABLE_ONBOARDING === 'true';
if (DISABLE_ONBOARDING) {
logToStderr('info', 'Onboarding disabled via --no-onboarding flag');
}
// Set global flag for onboarding control
global.disableOnboarding = DISABLE_ONBOARDING;

@wonderwhy-er wonderwhy-er merged commit 575e888 into main Sep 18, 2025
2 checks passed
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