Skip to content

fix(cli): forward setup --check and --non-interactive flags to provider delegation - #1343

Merged
murdore merged 1 commit into
releasefrom
fix/setup-flag-forwarding
Aug 18, 2026
Merged

murdore merged 1 commit into
releasefrom
fix/setup-flag-forwarding

Conversation

@murdore

@murdore murdore commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

neurolink setup --provider openai --check ignores --check. It falls into the interactive "reconfigure?" prompt, and with no TTY — a script, a CI job — it crashes with User force closed the prompt and exits 1. --non-interactive is dropped the same way. Confirmed against the built CLI, not by reading.

The positional form neurolink setup openai --check works correctly, because it dispatches straight to the provider handler and never passes through handleSetup. That was the reference for correct behavior.

Cause

Not a missing flag declaration — yargs accepts both flags today. The break is in the handler layer:

  • SetupArgs had no check/nonInteractive fields, so handleSetup had no typed way to read what the user passed.
  • delegateToProviderSetup hardcoded check: false and nonInteractive: false regardless of argv, then handed that to the per-provider handlers — which do honor the flags when they receive them.

Pre-existing since 2025-09-09.

Fix

Adds the two fields to SetupArgs, forwards them from handleSetup, and gives delegateToProviderSetup a second parameter that defaults to the previous hardcoded values, so the interactive-wizard call site is byte-identical. The kebab-case "non-interactive" duplicate is kept in sync, because two handlers read that key rather than the camelCase one.

Tests

Three tests added to the existing CLI-subprocess suite, driving node dist/cli/index.js: --check takes the check-only path without prompting or hanging; the flag form matches the dedicated positional subcommand's --check; and --non-interactive works on its own. They use a provider whose check path reads only env vars, a fixed fake key for determinism, and closed stdin so a regression reproduces the original hang rather than waiting on a terminal.

Verified failing before the fix: with the source change stashed and rebuilt, all three fail for real (275 passed / 3 failed, non-zero exit). After: 278/278.

Noted, not changed

  • CLICommandFactory.createSetupCommand() in commandFactory.ts is dead code — parser.ts registers the setupCommandFactory version and never calls it. Deleting it is a separate cleanup.
  • setup --list exits 1 and setup --status hangs. Both are broken today, independent of this change, and confirmed unaffected by it.

CI on this branch will fail at Install ffmpeg until #1342 lands; that failure is unrelated to this change.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed setup command flags so --check correctly performs a non-interactive validation without prompting or hanging.
    • Fixed --non-interactive to reuse existing provider configuration without prompting.
    • Ensured setup flags work consistently across supported command formats.
  • Tests

    • Added regression coverage for setup validation and non-interactive configuration flows.

Copilot AI lite review requested due to automatic review settings August 17, 2026 20:04
@coderabbitai

coderabbitai Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d2d6deb-4cbe-433e-a8dd-4c78532f31e1

📥 Commits

Reviewing files that changed from the base of the PR and between 050af57 and 93d9038.

📒 Files selected for processing (3)
  • src/cli/commands/setup.ts
  • src/lib/types/cli.ts
  • test/continuous-test-suite-bugfixes.ts

📝 Walkthrough

Walkthrough

The setup command now forwards check and nonInteractive flags to provider setup. Provider delegation normalizes these flags. OpenAI end-to-end tests cover check-only execution, command parity, and non-interactive credential reuse.

Changes

Setup flag forwarding

Layer / File(s) Summary
Flag contract and provider delegation
src/lib/types/cli.ts, src/cli/commands/setup.ts
SetupArgs now includes optional check and nonInteractive flags. handleSetup forwards them to delegateToProviderSetup, which passes normalized values to provider setup.
Setup regression validation
test/continuous-test-suite-bugfixes.ts
End-to-end tests cover OpenAI check-only execution, parity between setup command forms, and non-interactive credential reuse.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: pdogra1299, adityaop007

Sequence Diagram(s)

sequenceDiagram
  participant CLI as handleSetup
  participant Delegate as delegateToProviderSetup
  participant Provider as OpenAI provider setup
  CLI->>Delegate: Forward check and nonInteractive
  Delegate->>Provider: Pass normalized setup flags
  Provider-->>CLI: Complete setup without prompts when applicable
Loading
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/setup-flag-forwarding

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.

@github-actions

github-actions Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

✅ Single Commit Policy - COMPLIANT

Status: Policy requirements met • 1 commit • Valid format • Ready for merge

📊 View validation details

📝 Commit Details

  • Hash: 93d9038a96808c5040e908fbd03f6f6de740279d
  • Message: fix(cli): forward setup --check and --non-interactive flags to provider delegation
  • Author: Sachin Sharma

✅ Validation Results

  • Single commit requirement met
  • No merge commits in branch
  • Semantic commit message format verified
  • Ready for squash merge to release branch

🤖 Automated validation by NeuroLink Single Commit Enforcement

@github-actions

Copy link
Copy Markdown
Contributor

🤖 AI Review & Build Compliance ✅

Status: AI analysis complete • Build rules validated • Ready for review

📊 View detailed analysis results

🛡️ Analysis Complete

  • ✅ Security scan (vulnerabilities, API keys)
  • ✅ TypeScript safety & code quality
  • ✅ Error handling & best practices
  • ✅ Build rule enforcement validated
  • ✅ Commit format & compliance checks

📋 Ready for Merge When

  • All CI checks passing
  • Manual review approved
  • Any AI-flagged issues resolved

🤖 AI analysis complete - check individual code comments for specific feedback

Copilot AI 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.

Pull request overview

Fixes the CLI setup provider-delegation path so neurolink setup --provider <p> --check and --non-interactive are no longer silently dropped, preventing unintended interactive prompts (and failures/hangs) in non-TTY/scripted environments. This aligns the --provider flag form with the already-correct positional subcommand behavior (neurolink setup <p> ...) and adds regression coverage in the built-CLI subprocess test suite.

Changes:

  • Extend SetupArgs to include check and nonInteractive.
  • Forward check/nonInteractive from handleSetup() into delegateToProviderSetup(), and keep the "non-interactive" argv key in sync for provider handlers that read it.
  • Add CLI subprocess regression tests verifying --check and --non-interactive do not prompt or hang, and that flag-form delegation matches the positional subcommand.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/continuous-test-suite-bugfixes.ts Adds subprocess E2E-style regression tests against node dist/cli/index.js for setup --provider ... --check/--non-interactive.
src/lib/types/cli.ts Adds check and nonInteractive fields to SetupArgs so the handler can read forwarded flags.
src/cli/commands/setup.ts Plumbs check/nonInteractive through the delegation layer and mirrors "non-interactive" for compatibility with existing provider setup handlers.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Tara-ag

Tara-ag commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Review Summary for PR #1343

Decision: ✅ APPROVED

This is a clean, minimal bug fix that addresses the issue where --check and --non-interactive flags were being dropped when calling provider-specific setup commands.

Changes Reviewed

File 1: src/cli/commands/setup.ts

  • Added forwarding of argv.check and argv.nonInteractive to delegateToProviderSetup()
  • Updated hardcoded setupArgs object to use passed flags instead of always false
  • Clean implementation following existing patterns

File 2: src/lib/types/cli.ts

  • Added two optional fields to SetupArgs type: check?: boolean; and nonInteractive?: boolean;
  • No breaking change (only adding new optional properties)

File 3: test/continuous-test-suite-bugfixes.ts

  • Added 3 comprehensive test cases verifying the fix
  • Tests cover both flag form (--provider openai --check) and subcommand form
  • Includes proper timeout handling and edge case testing

Impact Analysis

  • Blast Radius: 139 files affected (all provider setup handlers receive these flags via delegateToProviderSetup)
  • Affected Flows: CLI parser → setup command → provider delegation chain
  • Breaking Changes: None (only adding optional parameters with defaults)
  • Security Concerns: None

Quality Assessment

✅ Type Safety: Properly typed, no any usage
✅ No Breaking Changes: Only additive changes
✅ Testing: Comprehensive test coverage added
✅ Code Quality: Follows existing patterns, clean implementation
✅ Documentation: Tests serve as documentation for expected behavior

Focus Areas Checked

  • ✅ Security: No issues
  • ✅ Architecture: No CLAUDE.md violations
  • ✅ Type Safety: Proper typing throughout
  • ✅ Testing: New tests verify the fix
  • ✅ Performance: No performance impact (pure flag forwarding)

Scope: This PR fixes a critical bug in CLI setup where important flags were being silently dropped, causing interactive prompts to hang or crash in CI environments. The fix is minimal, well-tested, and follows established patterns in the codebase.

@Tara-ag Tara-ag 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.

Review Summary for PR #1343

Decision: ✅ APPROVED

This is a clean, minimal bug fix that addresses the issue where --check and --non-interactive flags were being dropped when calling provider-specific setup commands.

Changes Reviewed

File 1: src/cli/commands/setup.ts

  • Added forwarding of argv.check and argv.nonInteractive to delegateToProviderSetup()
  • Updated hardcoded setupArgs object to use passed flags instead of always false
  • Clean implementation following existing patterns

File 2: src/lib/types/cli.ts

  • Added two optional fields to SetupArgs type: check?: boolean; and nonInteractive?: boolean;
  • No breaking change (only adding new optional properties)

File 3: test/continuous-test-suite-bugfixes.ts

  • Added 3 comprehensive test cases verifying the fix
  • Tests cover both flag form (--provider openai --check) and subcommand form
  • Includes proper timeout handling and edge case testing

Impact Analysis

  • Blast Radius: 139 files affected (all provider setup handlers receive these flags via delegateToProviderSetup)
  • Affected Flows: CLI parser → setup command → provider delegation chain
  • Breaking Changes: None (only adding optional parameters with defaults)
  • Security Concerns: None

Quality Assessment

✅ Type Safety: Properly typed, no any usage
✅ No Breaking Changes: Only additive changes
✅ Testing: Comprehensive test coverage added
✅ Code Quality: Follows existing patterns, clean implementation
✅ Documentation: Tests serve as documentation for expected behavior

Focus Areas Checked

  • ✅ Security: No issues
  • ✅ Architecture: No CLAUDE.md violations
  • ✅ Type Safety: Proper typing throughout
  • ✅ Testing: New tests verify the fix
  • ✅ Performance: No performance impact (pure flag forwarding)

Scope: This PR fixes a critical bug in CLI setup where important flags were being silently dropped, causing interactive prompts to hang or crash in CI environments. The fix is minimal, well-tested, and follows established patterns in the codebase.

@Tara-ag Tara-ag 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.

Review Summary for PR #1343

Decision: ✅ APPROVED

This is a clean, minimal bug fix that addresses the issue where --check and --non-interactive flags were being dropped when calling provider-specific setup commands.

Changes Reviewed

File 1: src/cli/commands/setup.ts

  • Added forwarding of argv.check and argv.nonInteractive to delegateToProviderSetup()
  • Updated hardcoded setupArgs object to use passed flags instead of always false
  • Clean implementation following existing patterns

File 2: src/lib/types/cli.ts

  • Added two optional fields to SetupArgs type: check?: boolean; and nonInteractive?: boolean;
  • No breaking change (only adding new optional properties)

File 3: test/continuous-test-suite-bugfixes.ts

  • Added 3 comprehensive test cases verifying the fix
  • Tests cover both flag form (--provider openai --check) and subcommand form
  • Includes proper timeout handling and edge case testing

Impact Analysis

  • Blast Radius: 139 files affected (all provider setup handlers receive these flags via delegateToProviderSetup)
  • Affected Flows: CLI parser → setup command → provider delegation chain
  • Breaking Changes: None (only adding optional parameters with defaults)
  • Security Concerns: None

Quality Assessment

✅ Type Safety: Properly typed, no any usage
✅ No Breaking Changes: Only additive changes
✅ Testing: Comprehensive test coverage added
✅ Code Quality: Follows existing patterns, clean implementation
✅ Documentation: Tests serve as documentation for expected behavior

Focus Areas Checked

  • ✅ Security: No issues
  • ✅ Architecture: No CLAUDE.md violations
  • ✅ Type Safety: Proper typing throughout
  • ✅ Testing: New tests verify the fix
  • ✅ Performance: No performance impact (pure flag forwarding)

Scope: This PR fixes a critical bug in CLI setup where important flags were being silently dropped, causing interactive prompts to hang or crash in CI environments. The fix is minimal, well-tested, and follows established patterns in the codebase.

…er delegation

neurolink setup --provider <p> --check silently ignored --check and
--non-interactive: delegateToProviderSetup() hardcoded both to false when
building the argv it hands to the per-provider setup handlers, so a
credential that was already configured fell through to an interactive
"reconfigure?" prompt instead of the check-only report. With no TTY
attached that prompt aborted and exited non-zero. SetupArgs also lacked
check/nonInteractive fields, so handleSetup had no typed way to read them
off argv in the first place.

delegateToProviderSetup now accepts the caller's flags (defaulting to the
previous hardcoded values so the interactive wizard path is unchanged),
and handleSetup forwards argv.check/argv.nonInteractive. The kebab-case
"non-interactive" duplicate is kept in sync since two provider handlers
read that key instead of the camelCase one.
@murdore
murdore force-pushed the fix/setup-flag-forwarding branch from 8c6345d to 93d9038 Compare August 18, 2026 07:53
@murdore
murdore merged commit 889dc7c into release Aug 18, 2026
13 of 14 checks passed
@murdore
murdore deleted the fix/setup-flag-forwarding branch August 18, 2026 07:53
@github-actions

Copy link
Copy Markdown
Contributor

🤖 AI Review & Build Compliance ✅

Status: AI analysis complete • Build rules validated • Ready for review

📊 View detailed analysis results

🛡️ Analysis Complete

  • ✅ Security scan (vulnerabilities, API keys)
  • ✅ TypeScript safety & code quality
  • ✅ Error handling & best practices
  • ✅ Build rule enforcement validated
  • ✅ Commit format & compliance checks

📋 Ready for Merge When

  • All CI checks passing
  • Manual review approved
  • Any AI-flagged issues resolved

🤖 AI analysis complete - check individual code comments for specific feedback

@Tara-ag

Tara-ag commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🔍 Code Review Summary for PR #1343

This PR fixes issue #1265 where --check and --non-interactive flags were being silently dropped when delegating to provider-specific setup commands (neurolink setup --provider openai --check).

Files Changed (3):

  1. src/cli/commands/setup.ts - Forward flags to provider setup
  2. src/lib/types/cli.ts - Add optional boolean fields to SetupArgs type
  3. test/continuous-test-suite-bugfixes.ts - Add 3 regression tests

Review Findings:

✅ No issues found - All changes are correct and well-implemented

Positive observations:

  • Clean, minimal implementation - only essential changes
  • Properly typed with optional boolean parameters
  • Comprehensive test coverage for all scenarios
  • Follows existing patterns in the codebase
  • No breaking changes
  • Self-contained within CLI path (no SDK impact)
  • No security concerns

Impact Assessment:

  • Blast radius: Minimal - affects only handleSetup and delegateToProviderSetup functions
  • Execution flows: CLI setup workflow (non-critical path)
  • Dependents: None outside of these two functions
  • Tests: 3 new tests added, covering deterministic scenarios

Verdict: APPROVED ✅

The bug fix is straightforward, well-tested, and follows NeuroLink standards. Ready to merge.

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 11.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants