Skip to content

feat: replace azure-prepare Aspire detection sequence with a script#2576

Open
tmeschter wants to merge 8 commits into
microsoft:mainfrom
tmeschter:260605-Issue2949
Open

feat: replace azure-prepare Aspire detection sequence with a script#2576
tmeschter wants to merge 8 commits into
microsoft:mainfrom
tmeschter:260605-Issue2949

Conversation

@tmeschter

@tmeschter tmeschter commented Jun 5, 2026

Copy link
Copy Markdown
Member

Replaces the duplicated .NET Aspire detection sequence in the azure-prepare skill with cross-platform detect-aspire.sh/detect-aspire.ps1 scripts.

The scripts live at plugin/skills/azure-prepare/references/scripts/ and are invoked from the reference docs via doc-relative links.

  • Scripts run the full detection in one pass and emit key=value fields (isAspire, appHostPath, appHostDir, hasExcludeFromManifest, hasFunctions, secretStorageConfigured) plus an informational summary.
  • aspire.md, generate.md, and scan.md now invoke the script instead of re-deriving find/grep commands; all decision-making stays in the reference files.

Review-feedback fixes

  • Normalize appHostPath/appHostDir to workspace-relative, forward-slash paths in both shells (consistent cross-shell contract).
  • Replace GNU-only grep --include with portable find -exec grep (macOS/BSD-safe).
  • Use -LiteralPath in PowerShell Get-ChildItem to avoid wildcard interpretation of [, ], *, ?.
  • 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 (scripts + scan.md/aspire.md).

Fixes #2494

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>
Copilot AI review requested due to automatic review settings June 5, 2026 21:45

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

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.sh and detect-aspire.ps1 to perform Aspire detection in one pass and emit key=value fields (isAspire, appHostPath, appHostDir, hasExcludeFromManifest, hasFunctions, secretStorageConfigured) plus a summary.
  • Updated scan.md, generate.md, and aspire.md to use the detection scripts instead of re-describing the detection command sequence.
  • Documented the script output fields and integrated the hasFunctions / secretStorageConfigured gating 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

Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.sh Outdated
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.sh
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.sh Outdated
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.ps1 Outdated
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.ps1
Comment thread plugin/skills/azure-prepare/references/scan.md Outdated
Comment thread plugin/skills/azure-prepare/references/aspire.md Outdated
Comment thread plugin/skills/azure-prepare/references/scan.md Outdated
Comment thread plugin/skills/azure-prepare/references/generate.md Outdated
Comment thread plugin/skills/azure-prepare/references/aspire.md Outdated
…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 wbreza left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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=value contract plus a separate Summary: 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 by azure-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.

  1. [High] appHostPath / appHostDir format diverges between bash (relative) and PowerShell (absolute, backslashes). Source: consensus (both models). See inline on detect-aspire.sh and detect-aspire.ps1.
  2. [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 on detect-aspire.sh.
  3. [Medium] PowerShell uses wildcard-interpreting -Path instead of -LiteralPath (workspaces with [, ], *, ? silently return zero files). Source: single-source (claude-opus-4.7). See inline on detect-aspire.ps1.
  4. [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.
  5. [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.
  6. [Low — Description Alignment] PR description and file-tree summary state the scripts land at plugin/skills/azure-prepare/scripts/, but they actually land in plugin/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).

Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.sh Outdated
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.ps1
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.sh Outdated
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.ps1 Outdated
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.ps1 Outdated
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.sh Outdated
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.ps1 Outdated
Comment thread plugin/skills/azure-prepare/references/scripts/detect-aspire.sh Outdated
- 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>
@tmeschter tmeschter requested a review from wbreza June 8, 2026 17:08
JasonYeMSFT
JasonYeMSFT previously approved these changes Jun 8, 2026
@tmeschter

Copy link
Copy Markdown
Member Author

@wbreza This is ready for another look.

tmeschter and others added 3 commits June 9, 2026 09:40
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>
@tmeschter

tmeschter commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

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.

@tmeschter tmeschter marked this pull request as draft June 10, 2026 18:47
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.
@tmeschter tmeschter marked this pull request as ready for review June 15, 2026 17:57
@tmeschter tmeschter requested a review from JasonYeMSFT June 17, 2026 17:17
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.

Replace azure-prepare skill .NET Aspire detection sequence with a script

4 participants