Skip to content

fix(cli): skip onboarding prompts without a tty#491

Merged
rohitg00 merged 1 commit into
rohitg00:mainfrom
honor2030:fix/noninteractive-onboarding
May 19, 2026
Merged

fix(cli): skip onboarding prompts without a tty#491
rohitg00 merged 1 commit into
rohitg00:mainfrom
honor2030:fix/noninteractive-onboarding

Conversation

@honor2030
Copy link
Copy Markdown
Contributor

@honor2030 honor2030 commented May 18, 2026

Summary

  • Detect non-interactive/CI environments before starting first-run onboarding prompts.
  • Seed default preferences in non-TTY runs so deployments can continue without hanging on interactive setup.
  • Add regression coverage that non-TTY onboarding does not call prompt APIs.

Test Plan

  • RED: npm test -- test/cli-onboarding.test.ts failed before the non-TTY guard because interactive prompt APIs were invoked.
  • GREEN: npm test -- test/cli-onboarding.test.ts test/preferences.test.ts → 8 tests passed.
  • GREEN: npm test → 92 files / 1008 tests passed.
  • GREEN: npm run build
  • GREEN: git diff --check

Closes #484

Summary by CodeRabbit

  • New Features

    • Onboarding now automatically detects non-interactive environments (CI systems or shells without TTY support) and bypasses interactive prompts, applying default settings instead. Default behavior includes disabling the splash screen and recording the initial onboarding timestamp.
  • Tests

    • Added test coverage for non-interactive onboarding scenarios.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 18, 2026

@honor2030 is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e496e803-d7b9-4291-9842-6df9398658df

📥 Commits

Reviewing files that changed from the base of the PR and between 9061da5 and c11f86a.

📒 Files selected for processing (2)
  • src/cli/onboarding.ts
  • test/cli-onboarding.test.ts

📝 Walkthrough

Walkthrough

This PR adds graceful handling of non-interactive environments to CLI onboarding. When running without a TTY or in CI, the onboarding module now skips all interactive prompts, writes default preferences to disk, and returns immediately with empty results instead of attempting prompts that would fail.

Changes

Non-Interactive Onboarding Flow

Layer / File(s) Summary
Non-TTY detection and default preferences
src/cli/onboarding.ts
shouldSkipInteractiveOnboarding() detects non-TTY stdin/stdout or CI environment flag. writeDefaultOnboardingPrefs() writes default onboarding preferences (skipSplash: true, firstRunAt timestamp) to disk. runOnboarding() branches on non-interactive detection to early-return empty agents/provider instead of entering interactive prompts.
Non-TTY onboarding test coverage
test/cli-onboarding.test.ts
Test suite forces non-TTY mode via process.stdin.isTTY and process.stdout.isTTY stubs, mocks @clack/prompts to prevent prompt execution, dynamically imports runOnboarding(), asserts no prompts are called and empty data is returned, validates default preferences file is written to temp HOME directory with expected fields, and performs full teardown restoring environment state.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly Related PRs

  • rohitg00/agentmemory#403: Both PRs modify the runOnboarding() flow in src/cli/onboarding.ts—this PR adds non-TTY early-exit on the foundation of the initial interactive onboarding implementation.

Poem

🐰 When terminals lack a TTY tale,
And CI pipes refuse to wail,
We skip the prompts with grace and care,
Write defaults silent through the air—
No interactive dance, just defaults in place,
Deployments now thrive in every space!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and concisely summarizes the main change: skipping onboarding prompts in non-TTY environments, which is the primary objective of the changeset.
Linked Issues check ✅ Passed The pull request fully addresses issue #484 by detecting non-TTY environments, preventing interactive prompts from blocking, and seeding default preferences for non-interactive deployments.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the onboarding flow and non-TTY detection; no unrelated modifications to other systems or features were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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.

@rohitg00 rohitg00 mentioned this pull request May 19, 2026
@rohitg00 rohitg00 merged commit db9f000 into rohitg00:main May 19, 2026
3 of 4 checks passed
@rohitg00
Copy link
Copy Markdown
Owner

Merged + shipping in next release. Thanks @honor2030 — clean fix for non-tty onboarding interruption (CI / pipe / docker run -d). Regression test covers TTY-restoring sandbox.

@rohitg00 rohitg00 mentioned this pull request May 19, 2026
rohitg00 added a commit that referenced this pull request May 19, 2026
Quality + integration wave. Bundles 11 PRs since v0.9.20:

Contributor feature:
- #237 OpenCode plugin with 22 auto-capture hooks (@cl0ckt0wer)

Bug fixes (9):
- #516 memory_recall endpoint + format/token_budget (@serhiizghama, closes #507/#440)
- #461 env-file AGENTMEMORY_DROP_STALE_INDEX flag honored (@honor2030, closes #456)
- #487 Windows hook path quoting (@honor2030, closes #477)
- #517 viewer IME composition guard (@jonathanzhan1975)
- #472 chunk large sessions for LLM context window (@efenex)
- #473 surface lessons in smart-search + diagnose tally (@efenex)
- #486 declare all Hermes plugin hooks (@honor2030)
- #500 rebuildIndex non-blocking on boot (@efenex)
- #504 batched embed in rebuildIndex (25h -> 3h) (@efenex)
- #491 cli skip onboarding without tty (@honor2030)

Upstream-installer revert:
- #546 drop --next workaround now that iii-hq/iii#1660 shipped

1067/1067 tests pass across 95 files.
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.

First-time (One-time) setup doesn't work with Fly deployment

2 participants