Skip to content

feat(segments): Add Aspire segment#7436

Open
maddymontaquila wants to merge 2 commits intoJanDeDobbeleer:mainfrom
maddymontaquila:feat/aspire-segment
Open

feat(segments): Add Aspire segment#7436
maddymontaquila wants to merge 2 commits intoJanDeDobbeleer:mainfrom
maddymontaquila:feat/aspire-segment

Conversation

@maddymontaquila
Copy link
Copy Markdown

@maddymontaquila maddymontaquila commented Apr 7, 2026

Summary

  • add a new Aspire segment that resolves the apphost via Aspire CLI with file-based fallback
  • detect running apphosts via aspire ps with optional fetch_running control
  • document and register the segment in docs, sidebar, and schema

Testing

  • go test ./segments/ -run TestAspire -v
  • go build -v

Copilot AI review requested due to automatic review settings April 7, 2026 16:11
@maddymontaquila maddymontaquila changed the title Add Aspire segment feat(segments): Add Aspire segment Apr 7, 2026
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

Adds a new Aspire CLI segment to show the resolved Aspire AppHost (via Aspire CLI with file fallback) and optionally whether it’s currently running (via aspire ps), including documentation and schema/sidebar registration.

Changes:

  • Implemented the new aspire segment, including AppHost resolution, running detection, and version extraction.
  • Added unit tests covering CLI resolution, running detection, CLI flag fallback behavior, and file-based fallback.
  • Registered the segment in the website sidebar and JSON schema, and added end-user documentation.

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
website/sidebars.js Adds Aspire to the CLI segments docs navigation.
website/docs/segments/cli/aspire.mdx Introduces user documentation for the Aspire segment (config/options/template/properties).
themes/schema.json Registers aspire in the segment type enum and adds schema for fetch_running.
src/segments/aspire.go Implements the Aspire segment logic (resolve AppHost, detect running, extract version).
src/segments/aspire_test.go Adds test coverage for the new Aspire segment behaviors.
src/config/segment_types.go Registers the Aspire segment type for config/segment instantiation and gob decoding.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 7, 2026 16: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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment on lines +193 to +201
func sameFilePath(left, right string) bool {
cleanLeft := filepath.Clean(left)
cleanRight := filepath.Clean(right)

if cleanLeft == cleanRight {
return true
}

return strings.EqualFold(cleanLeft, cleanRight)
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

sameFilePath falls back to strings.EqualFold on all platforms, which can report a match for paths that differ only by case on case-sensitive filesystems (common on Linux). This can cause .Running to be true for the wrong AppHost. Consider making the case-insensitive comparison conditional on OS (e.g., Windows/macOS) or removing the case-folded comparison entirely.

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +36
| Name | Type | Description | Default |
| --------------- | --------- | ------------------------------------------------------------- | ------- |
| `fetch_running` | `boolean` | query `aspire ps` to determine whether the resolved AppHost is running | `true` |

Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

The tables in this doc use || at the start of each row (e.g., || Name | ... |), which does not match standard Markdown table syntax used in other segment docs and may render incorrectly. Switch these to single leading/trailing | like the other docs under website/docs/segments/*.

Copilot uses AI. Check for mistakes.
Comment on lines +49 to +56
| Name | Type | Description |
| -------------- | --------- | ------------------------------------------------------------------- |
| `.AppHostPath` | `string` | the resolved AppHost path reported by the Aspire CLI or file search |
| `.Name` | `string` | the Aspire AppHost display name |
| `.Version` | `string` | the Aspire Hosting version from `Directory.Packages.props` |
| `.Lang` | `string` | the detected single-file AppHost language (`cs` or `ts`) |
| `.Running` | `boolean` | whether the resolved AppHost currently appears in `aspire ps` |

Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

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

Same Markdown table issue here: the Properties table rows start with || instead of |, which is inconsistent with other docs and likely breaks rendering.

Copilot uses AI. Check for mistakes.
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.

2 participants