Skip to content

Fix: winapp init crashing in non-interactive shells (use defaults behavior if non interactive)#559

Merged
Jaylyn-Barbee merged 11 commits into
mainfrom
zt/556-noninteractive-init
Jun 1, 2026
Merged

Fix: winapp init crashing in non-interactive shells (use defaults behavior if non interactive)#559
Jaylyn-Barbee merged 11 commits into
mainfrom
zt/556-noninteractive-init

Conversation

@zateutsch
Copy link
Copy Markdown
Contributor

fixes #556

Add check for non-interactive shells that uses --use-defaults behavior and displays a warning.

Copilot AI review requested due to automatic review settings May 31, 2026 23:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes winapp init behavior in non-interactive shells by detecting non-interactive console capabilities and automatically switching to default-value behavior to avoid Spectre.Console prompt exceptions.

Changes:

  • Adds a non-interactive guard in InitCommand that logs a warning and enables useDefaults.
  • Updates the shared CLI test base so existing prompt-driven tests continue to run as interactive.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/winapp-CLI/WinApp.Cli/Commands/InitCommand.cs Adds non-interactive detection and fallback to default initialization behavior.
src/winapp-CLI/WinApp.Cli.Tests/BaseCommandTests.cs Marks the shared TestConsole as interactive to preserve existing prompt test behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +93 to +96
if (!useDefaults && !ansiConsole.Profile.Capabilities.Interactive)
{
logger.LogWarning("{Warning} Non-interactive environment detected. Using default values.", UiSymbols.Warning);
useDefaults = true;
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Build in progress — metrics below are from a previous commit and will update when the current build finishes.

Build Metrics Report

Binary Sizes

Artifact Baseline Current Delta
CLI (ARM64) 31.45 MB 31.45 MB ✅ 0.0 KB (0.00%)
CLI (x64) 31.79 MB 31.79 MB 📈 +0.5 KB (+0.00%)
MSIX (ARM64) N/A 13.21 MB N/A
MSIX (x64) N/A 14.05 MB N/A
NPM Package N/A 27.50 MB N/A
NuGet Package N/A 27.59 MB N/A
VS Code Extension N/A 20.31 MB N/A

Test Results

1192 passed, 1 skipped out of 1193 tests in 520.7s (+2 tests, +57.8s vs. baseline)

Test Coverage

17.2% line coverage, 36.3% branch coverage · ✅ no change vs. baseline

CLI Startup Time

34ms median (x64, winapp --version) · ✅ -10ms vs. baseline


Updated 2026-06-01 18:28:42 UTC · commit f4aea73 · workflow run

Copy link
Copy Markdown
Contributor

@Jaylyn-Barbee Jaylyn-Barbee left a comment

Choose a reason for hiding this comment

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

LGTM

@Jaylyn-Barbee Jaylyn-Barbee enabled auto-merge (squash) June 1, 2026 18:34
@Jaylyn-Barbee Jaylyn-Barbee merged commit 972e1d5 into main Jun 1, 2026
21 checks passed
@Jaylyn-Barbee Jaylyn-Barbee deleted the zt/556-noninteractive-init branch June 1, 2026 18:48
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.

winapp init crashes with unhandled InvalidOperationException in non-interactive shells (no TTY)

3 participants