feat(segments): Add Aspire segment#7436
feat(segments): Add Aspire segment#7436maddymontaquila wants to merge 2 commits intoJanDeDobbeleer:mainfrom
Conversation
There was a problem hiding this comment.
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
aspiresegment, 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>
| func sameFilePath(left, right string) bool { | ||
| cleanLeft := filepath.Clean(left) | ||
| cleanRight := filepath.Clean(right) | ||
|
|
||
| if cleanLeft == cleanRight { | ||
| return true | ||
| } | ||
|
|
||
| return strings.EqualFold(cleanLeft, cleanRight) |
There was a problem hiding this comment.
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.
| | Name | Type | Description | Default | | ||
| | --------------- | --------- | ------------------------------------------------------------- | ------- | | ||
| | `fetch_running` | `boolean` | query `aspire ps` to determine whether the resolved AppHost is running | `true` | | ||
|
|
There was a problem hiding this comment.
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/*.
| | 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` | | ||
|
|
There was a problem hiding this comment.
Same Markdown table issue here: the Properties table rows start with || instead of |, which is inconsistent with other docs and likely breaks rendering.
Summary
aspire pswith optionalfetch_runningcontrolTesting