feat: replace azure-prepare Aspire detection sequence with a script#2576
feat: replace azure-prepare Aspire detection sequence with a script#2576tmeschter wants to merge 8 commits into
Conversation
Add cross-platform detect-aspire.sh/.ps1 scripts that run the .NET Aspire detection sequence in one pass and emit key=value fields plus an informational summary. Update aspire.md, generate.md, and scan.md to invoke the script instead of re-deriving find/grep commands, keeping decision-making in the reference files. Fixes microsoft#2494 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the azure-prepare skill’s .NET Aspire detection by introducing dedicated cross-platform detection scripts and updating the Aspire-related reference docs to invoke them, reducing duplicated “find/grep” guidance across multiple references.
Changes:
- Added
detect-aspire.shanddetect-aspire.ps1to perform Aspire detection in one pass and emitkey=valuefields (isAspire,appHostPath,appHostDir,hasExcludeFromManifest,hasFunctions,secretStorageConfigured) plus a summary. - Updated
scan.md,generate.md, andaspire.mdto use the detection scripts instead of re-describing the detection command sequence. - Documented the script output fields and integrated the
hasFunctions/secretStorageConfiguredgating for the Functions secret-storage guidance.
Show a summary per file
| File | Description |
|---|---|
| plugin/skills/azure-prepare/references/scripts/detect-aspire.sh | New bash-based Aspire detection script emitting structured fields + summary. |
| plugin/skills/azure-prepare/references/scripts/detect-aspire.ps1 | New PowerShell Aspire detection script emitting structured fields + summary. |
| plugin/skills/azure-prepare/references/scan.md | Updates scan guidance to run the detection script and branch on isAspire / Functions signals. |
| plugin/skills/azure-prepare/references/generate.md | Updates “check Aspire first” step to invoke the script and branch on isAspire. |
| plugin/skills/azure-prepare/references/aspire.md | Replaces duplicated detection/scanning steps with script invocation and field-based guidance. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 11
…ield tests Assert via matchesCommand that the agent invokes detect-aspire.sh/.ps1 rather than re-deriving the find/grep detection sequence inline, in the two aspire-brownfield integration tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
wbreza
left a comment
There was a problem hiding this comment.
Code Review — PR #2576
Automated multi-model review (Standard, 2 models: claude-opus-4.7 + gpt-5.3-codex). Posted as COMMENT at author's discretion; findings include 2 High-priority items the author may want to address before merge.
Summary
| Priority | Count |
|---|---|
| Critical | 0 |
| High | 2 |
| Medium | 3 |
| Low | 1 |
| Total | 6 |
Overall Assessment: Comment — does not block, but 2 High findings (cross-shell appHostPath contract divergence; macOS-incompatible grep --include) are worth resolving in this PR or a quick follow-up.
✅ What Looks Good
- Single-pass detection with a flat
key=valuecontract plus a separateSummary:block is a clean, LLM-friendly shape; field names are namespaced and extensible. - Both scripts validate the workspace input, exit non-zero with a clear stderr message; bash uses
set -euo pipefail; PS sets$ErrorActionPreference = 'Stop'. - Doc updates correctly collapse three duplicated detection blocks into references to the script; within-skill markdown links stay inside the skill directory (no link-validator regression).
- Script invocation pattern (
./scripts/<name>.{sh,ps1}shown in dual bash + PowerShell fences) matches the established convention used byazure-quotas/check-quota.{sh,ps1}.
Findings Index
Inline comments are attached to specific lines for each finding. Where multiple files/lines are involved, one inline comment is posted per location.
- [High]
appHostPath/appHostDirformat diverges between bash (relative) and PowerShell (absolute, backslashes). Source: consensus (both models). See inline ondetect-aspire.shanddetect-aspire.ps1. - [High] Bash script uses GNU-only
grep --include, which is unsupported by default BSD grep on macOS. Source: single-source (gpt-5.3-codex). See inline ondetect-aspire.sh. - [Medium] PowerShell uses wildcard-interpreting
-Pathinstead of-LiteralPath(workspaces with[,],*,?silently return zero files). Source: single-source (claude-opus-4.7). See inline ondetect-aspire.ps1. - [Medium] New scripts recurse through
bin//obj/— behavioral change vs. prior non-recursive inline commands; widens false-positive surface and increases scan cost. Source: single-source (claude-opus-4.7). See inline on both scripts. - [Medium] Multiple AppHost projects handled nondeterministically (first match wins, varies by traversal order). Source: single-source (
gpt-5.3-codex). See inline on both scripts. - [Low — Description Alignment] PR description and file-tree summary state the scripts land at
plugin/skills/azure-prepare/scripts/, but they actually land inplugin/skills/azure-prepare/references/scripts/. The doc-relative markdown links inside the skill are correct — only the PR body is wrong. Suggested fix: update the PR description.
Reviewed with 2 models in parallel. Tags: source: consensus = flagged by both; single-source: <model> = flagged by one. Priority for finding #1 was claude-opus-4.7=High, gpt-5.3-codex=Medium → promoted to High based on impact (directly contradicts the PR's stated determinism goal).
- Normalize appHostPath/appHostDir to workspace-relative forward-slash paths in both shells - Replace GNU-only grep --include with portable find -exec grep (macOS/BSD safe) - Use -LiteralPath in PowerShell Get-ChildItem to avoid wildcard interpretation - Prune bin/obj from *.cs scans - Sort AppHost candidates (case-insensitive) for deterministic, cross-shell-consistent selection - Treat Aspire.AppHost.Sdk as an Aspire indicator; update summaries and scan.md/aspire.md docs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@wbreza This is ready for another look. |
Update azure-prepare reference docs to consistently point to the bundled detect-aspire.sh/.ps1 scripts for .NET Aspire detection, and fix the relative script links in recipes/azd/README.md. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
I'm converting this back to a draft. While the limited data from my integration test runs gives me reason to believe this reduces token counts, the script is not being invoked consistently. |
Separate Aspire detection into two purpose-built scripts:
- detect-aspire.{sh,ps1}: presence-only (isAspire + appHostPath) for
detection/routing points (scan.md, recipe-selection.md, generate.md,
recipes/azd/README.md)
- gather-aspire-info.{sh,ps1}: full facts (appHostDir, hasExcludeFromManifest,
hasFunctions, secretStorageConfigured) for Aspire-specific reference files
(aspire.md, recipes/azd/aspire.md, services/functions/aspire-containerapps.md)
Add gather-aspire-info invocations to the two Aspire-specific files that
previously referenced no detection script. Update the integration test regex
to accept either script name.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make some further updates to encourage the LLM to call the detect-aspire scripts.
Replaces the duplicated .NET Aspire detection sequence in the
azure-prepareskill with cross-platformdetect-aspire.sh/detect-aspire.ps1scripts.The scripts live at
plugin/skills/azure-prepare/references/scripts/and are invoked from the reference docs via doc-relative links.key=valuefields (isAspire,appHostPath,appHostDir,hasExcludeFromManifest,hasFunctions,secretStorageConfigured) plus an informational summary.aspire.md,generate.md, andscan.mdnow invoke the script instead of re-deriving find/grep commands; all decision-making stays in the reference files.Review-feedback fixes
appHostPath/appHostDirto workspace-relative, forward-slash paths in both shells (consistent cross-shell contract).grep --includewith portablefind -exec grep(macOS/BSD-safe).-LiteralPathin PowerShellGet-ChildItemto avoid wildcard interpretation of[,],*,?.bin//obj/from*.csscans.Aspire.AppHost.Sdkas an Aspire indicator (scripts +scan.md/aspire.md).Fixes #2494