Skip to content

Surface dotnet new post-action output under --verbose for new command - #755

Open
Zach Teutsch (zateutsch) wants to merge 4 commits into
mainfrom
zateutsch-753-surface-new-dotnet-output
Open

Surface dotnet new post-action output under --verbose for new command#755
Zach Teutsch (zateutsch) wants to merge 4 commits into
mainfrom
zateutsch-753-surface-new-dotnet-output

Conversation

@zateutsch

Copy link
Copy Markdown
Contributor

Summary

Surfaces dotnet new post-creation action output (restore, package add, etc.) under --verbose for the winapp new command. Previously this output was buffered silently behind a spinner and only dumped after the command finished, which made dotnet new failures during scaffolding hard to diagnose.

Fixes #753.

Problem

The final scaffold step of winapp new runs dotnet new, whose post-creation actions (NuGet restore, package add, etc.) can fail. That output was captured behind a Spectre spinner and surfaced only after completion, so a user hitting a restore failure had no live insight into what dotnet was actually doing.

Change

  • Under --verbose (Debug log level), the scaffold step now streams dotnet new's stdout/stderr live via logger.LogDebug, plus logs the invoked dotnet args and the exit code.
  • The non-verbose path is unchanged: it keeps the spinner and existing buffered logging.
  • Added optional onOutputLine / onErrorLine callbacks to the injection-safe ArgumentList overload of RunDotnetCommandAsync (and threaded them through RunDotnetProcessAsync). Output is still captured to buffers, so the failure-detail message (stderr ?? stdout) is preserved.

Why this approach

The scaffold needs both (a) the injection-safe ArgumentList form (args include a user-derived project name / output path) and (b) captured stdout/stderr for the failure detail. The existing RunDotnetStreamingAsync takes a raw string (not injection-safe) and returns no buffers, so adding tee-style callbacks to the buffered ArgumentList path was the smallest correct reuse.

Testing

  • dotnet build clean (0 warnings / 0 errors).
  • WinApp.Cli.Tests — 60/60 NewCommandHandlerTests pass, including 2 new tests:
    • Handler_Verbose_StreamsScaffoldPostActionOutput — verifies post-creation output streams live under --verbose.
    • Handler_ScaffoldFails_SurfacesPostActionErrorDetail — verifies the underlying dotnet error detail is surfaced on failure.

Docs

  • Updated plugins/winapp/skills/winapp-setup/SKILL.md with a --verbose diagnose example and a troubleshooting row.
  • No CLI grammar change, so docs/cli-schema.json, npm forwarding, and version.json are intentionally untouched.

Notes

  • --verbose + --json remains a rejected conflict, so streamed Debug lines never pollute JSON output.
  • dotnet new args continue to use ProcessStartInfo.ArgumentList; streamed lines are passed as a structured {Output} logging argument (no format-string/injection risk).

The final scaffold step of 'winapp new' runs dotnet new, whose post-creation
actions (restore, package add, etc.) were buffered behind a spinner and only
dumped after completion, making post-action failures hard to diagnose.

Under --verbose, stream the scaffold's dotnet output live so those post actions
are visible as they run. Output is still captured so a non-zero exit surfaces a
concise failure detail. Adds optional line callbacks to the injection-safe
ArgumentList RunDotnetCommandAsync overload.

Fixes #753

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5fc9fa39-42fe-4531-9fa3-037d80c1f5c9
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Build Metrics Report

Binary Sizes

Artifact Baseline Current Delta
CLI (ARM64) 38.62 MB 38.62 MB 📈 +1.5 KB (+0.00%)
CLI (x64) 38.74 MB 38.74 MB 📈 +1.5 KB (+0.00%)
MSIX (ARM64) 16.02 MB 16.02 MB 📈 +0.1 KB (+0.00%)
MSIX (x64) 17.02 MB 17.02 MB 📈 +1.5 KB (+0.01%)
NPM Package 33.42 MB 33.42 MB 📈 +2.3 KB (+0.01%)
NuGet Package 33.46 MB 33.46 MB 📈 +0.8 KB (+0.00%)

Test Results

4579 passed, 5 skipped out of 4584 tests in 575.3s (+3 tests, -38.5s vs. baseline)

Test Coverage

89.2% line coverage, 82.4% branch coverage · ✅ +0.1% vs. baseline

CLI Startup Time

51ms median (x64, winapp --version) · ✅ +5ms vs. baseline

Try This Build

Installs the MSIX for your architecture, replacing any previously installed build. Needs the GitHub CLI — the command offers to install it and sign you in if it is missing.

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) 755
Switching between builds often?

Put the tool on your PATH once:

& ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) -AddToPath

Then this build is just:

winapp-pr 755

Run winapp-pr with no arguments to pick from a list of open PRs.


Updated 2026-08-14 21:20:34 UTC · commit cda6afb · workflow run

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 5fc9fa39-42fe-4531-9fa3-037d80c1f5c9

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

Pull request overview

Streams dotnet new post-action diagnostics during verbose scaffolding while preserving buffered failure details.

Changes:

  • Adds live stdout/stderr callbacks to buffered dotnet execution.
  • Uses callbacks for verbose winapp new scaffolding.
  • Adds tests, fake-service support, and troubleshooting guidance.

Reviewed changes

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

Show a summary per file
File Description
IDotNetService.cs Defines optional line callbacks.
DotNetService.cs Captures and forwards process output.
NewCommand.cs Streams verbose scaffold diagnostics.
NewCommandHandlerTests.cs Tests verbose output and failure details.
FakeDotNetService.cs Replays buffered output through callbacks.
SKILL.md Documents verbose troubleshooting.

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

Comment thread src/winapp-CLI/WinApp.Cli.Tests/NewCommandHandlerTests.cs
FakeDotNetService replays lines synchronously after the run completes, so it cannot catch a regression where the real OutputDataReceived/ErrorDataReceived callbacks stop firing live or stderr stops being forwarded. Add a DotNetService process test whose child emits stdout and stderr, then blocks on stdin, verifying both callbacks fire while the run task is still pending and the same text remains in the returned buffers.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 5fc9fa39-42fe-4531-9fa3-037d80c1f5c9
@zateutsch
Zach Teutsch (zateutsch) marked this pull request as ready for review August 15, 2026 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Show dotnet output with --verbose for new command during post actions (restore, package add, etc)

2 participants