Repository navigation
chore: use .NET 11 Process APIs to simplify dev.cs - #6070
Conversation
Replaces the hand-rolled ProcessStartInfo plumbing and manual stream draining with Process.RunAsync, and passes arguments as lists instead of pre-quoted strings. Co-Authored-By: Claude <noreply@anthropic.com>
PR risk: lowFor commit This label is a hint for reviewers, not an approval. |
There was a problem hiding this comment.
Good to approve, with optional comments
Replaces the hand-rolled ProcessStartInfo plumbing in dev.cs with the .NET 11 Process.RunAsync overloads (GA in the pinned 11.0.100 SDK, so the preview caveat in #5363 no longer applies), and fixes cleanslate/aiup to install skills into the repo with dotagents --project install. This fully addresses #5363 at the cause.
- Optional:
dev.csRunProcessAsyncWindows branch (["/c", fileName, .. arguments]): passing a list tocmd.exerelies onArgumentListquoting, which only quotes arguments containing spaces or quotes. That matches the old string for current callers, but it hasn't been run on Windows yet. A quick./dev.cs wrestorsubupon Windows would confirm it. - Optional:
dev.cscleanslate/aiup:--projectbeforeinstallmatches the documenteddotagents [--project|--global|--user] <command>usage. Sincenpx @sentry/dotagentsisn't version-pinned, an older locally cached dotagents could reject or ignore the flag; pinning a minimum version (e.g.@sentry/dotagents@3) would make that deterministic. - Optional: no automated coverage for
dev.cs. Acceptable for a dev-only script;--dry-runpaths still print the expected commands.
This is an automated preliminary review.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6070 +/- ##
==========================================
+ Coverage 78.46% 78.52% +0.05%
==========================================
Files 537 539 +2
Lines 20167 20196 +29
Branches 4056 4064 +8
==========================================
+ Hits 15825 15859 +34
+ Misses 3494 3491 -3
+ Partials 848 846 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| ("git clean", "git", ["clean", "-dfx"]), | ||
| ("git submodule update", "git", ["submodule", "update", "--init", "--recursive"]), | ||
| ("dotnet restore", "dotnet", ["restore", solution]), | ||
| ("npx @sentry/dotagents install", "npx", ["@sentry/dotagents", "install"]) |
There was a problem hiding this comment.
Optional, and this was already broken before this PR. Since dotagents 3.0, a bare install writes to ~/.agents instead of the repo, so cleanslate never installs the skills in our agents.toml. Adding --project fixes it:
| ("npx @sentry/dotagents install", "npx", ["@sentry/dotagents", "install"]) | |
| ("npx @sentry/dotagents --project install", "npx", ["@sentry/dotagents", "--project", "install"]) |
| { | ||
| Console.WriteLine("[dev] Installing/updating AI agent files"); | ||
| return RunStepAsync("npx @sentry/dotagents install", "npx", "@sentry/dotagents install", options.DryRun); | ||
| return RunStepAsync("npx @sentry/dotagents install", "npx", ["@sentry/dotagents", "install"], options.DryRun); |
There was a problem hiding this comment.
Same fix for aiup:
| return RunStepAsync("npx @sentry/dotagents install", "npx", ["@sentry/dotagents", "install"], options.DryRun); | |
| return RunStepAsync("npx @sentry/dotagents --project install", "npx", ["@sentry/dotagents", "--project", "install"], options.DryRun); |
dotagents 3.0 defaults every command to global scope, so a bare `install` never installed the skills in agents.toml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
dev.csnow uses the .NET 11 one-shotProcess.RunAsyncAPI (the repo already pins the 11.0.100 GA SDK) instead of hand-rolled process plumbing:RunProcessAsynccallsProcess.RunAsync(fileName, arguments)rather than building aProcessStartInfoand waiting on it.IsCommandAvailableAsynccallsProcess.RunAsync(finder, [command], silent: true), which drops the manualTask.WhenAll(ReadToEndAsync, ReadToEndAsync, WaitForExitAsync)stream draining.cleanslateandaiupnow rundotagents --project install. Since dotagents 3.0 a bareinstalltargets~/.agents, so the skills inagents.tomlwere never installed into the repo.Checked on macOS:
cleanslate --dry-run,wrest -n(detectssudoviawhich),subup, andremove-hookswith the key already unset (git's exit code 5 is still treated as success). The Windowscmd.exe /cpath is unchanged in behaviour but wasn't run locally.#skip-changelog
Closes #5363
🤖 Generated with Claude Code