Repository navigation
Add aspire docs api * sub-commands to expose aspire.dev reference material
#15814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
David Pine (IEvangelist)
merged 24 commits into
main
from
dapine/aspire-api-docs-commands
Apr 14, 2026
Merged
Changes from 5 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
548e396
Add localization support and API command enhancements
IEvangelist b3a9869
Fix formatting of C# header in API docs commands
IEvangelist d9c1f5f
Enhance API documentation caching and fetching with sitemap URL rebas…
IEvangelist 4e31cfe
Add test for TypeScript direct route item retrieval in API docs service
IEvangelist 6d218ba
Refresh docs indexes when source content changes
IEvangelist abecfcc
Move API docs under docs command
IEvangelist 549e8ce
Finish API docs feedback fixes
IEvangelist ae77d09
Restore API command XLF generation
IEvangelist e76e564
Fix docs cache naming and list parsing
IEvangelist 0dd3e49
Simplify docs and API cache filenames
IEvangelist 763b5cd
Add cached C# API member search
IEvangelist 820503f
Generalize API member index search
IEvangelist 0b2cb84
Make API member loading incremental
IEvangelist 917e5a0
Refine API docs search results
IEvangelist 1034358
Fix API markdown link rendering
IEvangelist a98aee9
Move docs source URLs into config
IEvangelist f324969
Refine docs and api docs sources
IEvangelist 9864148
Restore markdown docs output
IEvangelist b3ff9ef
Render docs get through markdown display
IEvangelist 8dc856b
Format minified docs code blocks
IEvangelist 5f95928
Expand minified docs formatter languages
IEvangelist 19694a7
Fix Linux docs cache and API link handling
IEvangelist bf4ee3c
Remove docs code block reformatting
IEvangelist 0268a36
Remove unshipped API language scaffolding
IEvangelist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 10 additions & 8 deletions
18
.agents/skills/aspire/references/tools-and-configuration.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,203 @@ | ||
| # Aspire CLI API docs commands | ||
|
|
||
| ## Overview | ||
|
|
||
| This specification describes a new `aspire api` command group for browsing, searching, and retrieving Aspire API reference documentation from `aspire.dev`. | ||
|
|
||
| The new command group is parallel to `aspire docs`, but it uses a different ingestion pipeline: | ||
|
|
||
| - `aspire docs` indexes `llms-small.txt` | ||
| - `aspire api` indexes `sitemap-0.xml` and uses direct API page routes as addressable items | ||
|
|
||
| ## Goals | ||
|
|
||
| 1. Expose API reference content through the Aspire CLI. | ||
| 2. Reuse the existing fetch, ETag, and disk-cache patterns where possible. | ||
| 3. Preserve API hierarchy so the CLI can browse the catalog without dumping every API at once. | ||
| 4. Support C# and TypeScript API reference pages today, while also modeling Java, Go, Rust, and Python language roots for future expansion. | ||
| 5. Return markdown for `get` operations. | ||
|
|
||
| ## Non-goals | ||
|
|
||
| - Full unscoped catalog listing. | ||
| - A general-purpose web crawler for all `aspire.dev` content. | ||
| - Cross-language identifier normalization beyond the Aspire API route structure. | ||
|
|
||
| ## Command surface | ||
|
|
||
| ```text | ||
| aspire api list <scope> [--format json] | ||
| aspire api search <query> [--language <language>] [--limit|-n <count>] [--format json] | ||
| aspire api get <id> [--format json] | ||
| ``` | ||
|
|
||
| ## Browse model | ||
|
|
||
| `list` is a scoped browse command. It never returns the entire API catalog. | ||
|
|
||
| ### Supported scopes | ||
|
|
||
| ```text | ||
| aspire api list csharp | ||
| aspire api list csharp/<package> | ||
| aspire api list csharp/<package>/<type> | ||
|
|
||
| aspire api list typescript | ||
| aspire api list typescript/<module> | ||
| aspire api list typescript/<module>/<symbol> | ||
|
|
||
| aspire api list java | ||
| aspire api list go | ||
| aspire api list rust | ||
| aspire api list python | ||
| ``` | ||
|
|
||
| ### Scope semantics | ||
|
|
||
| | Scope | Returns | | ||
| | --- | --- | | ||
| | `csharp` | Top-level C# packages | | ||
| | `csharp/<package>` | Types in the package | | ||
| | `csharp/<package>/<type>` | Member-group pages for the type such as `methods`, `properties`, and `constructors` | | ||
| | `typescript` | Top-level TypeScript modules | | ||
| | `typescript/<module>` | Direct symbols in the module | | ||
| | `typescript/<module>/<symbol>` | Members under the symbol | | ||
|
|
||
| If a scope has no children, `list` returns no results instead of expanding sideways or returning sibling scopes. | ||
|
|
||
| The additional modeled language roots (`java`, `go`, `rust`, and `python`) are valid scopes even though `aspire.dev` does not currently publish API pages for them. | ||
|
|
||
| ## Identifier model | ||
|
|
||
| The CLI uses stable path-like identifiers derived from the API route structure. | ||
|
|
||
| ### Base rule | ||
|
|
||
| For sitemap-backed pages, the identifier is the route path after `/reference/api/`, without a trailing slash. | ||
|
|
||
| Examples: | ||
|
|
||
| ```text | ||
| csharp/aspire.azure.ai.inference | ||
| csharp/aspire.azure.ai.inference/aspireazureaiinferenceextensions | ||
| typescript/aspire.hosting.azure.appconfiguration | ||
| typescript/aspire.hosting.azure.appconfiguration/azureappconfigurationresource | ||
| typescript/aspire.hosting.azure.appconfiguration/azureappconfigurationresource/runasemulator | ||
| ``` | ||
|
|
||
| ## Hierarchy model | ||
|
|
||
| ### C\# | ||
|
|
||
| The CLI exposes the following user-facing hierarchy: | ||
|
|
||
| ```text | ||
| language -> package -> type -> member-group page | ||
| ``` | ||
|
|
||
| ### TypeScript | ||
|
|
||
| The CLI exposes the following hierarchy: | ||
|
|
||
| ```text | ||
| language -> module -> symbol -> member | ||
| ``` | ||
|
|
||
| This aligns with the sitemap more directly: | ||
|
|
||
| ```text | ||
| module -> symbol -> member | ||
| ``` | ||
|
|
||
| ## Search behavior | ||
|
|
||
| `search` performs weighted lexical matching over the indexed API map. | ||
|
|
||
| The index should prioritize: | ||
|
|
||
| 1. Exact identifier matches | ||
| 2. Exact API name matches | ||
| 3. Package or module matches | ||
| 4. Type or symbol matches | ||
| 5. Member-group matches | ||
| 6. Summary and description snippets when available from future index metadata | ||
|
|
||
| The `--language` option limits results to a supported API language. Today the modeled language set is `csharp`, `typescript`, `java`, `go`, `rust`, and `python`. | ||
|
|
||
| Search results should include enough metadata for the user to copy the returned identifier directly into `aspire api get`. | ||
|
|
||
| ## Get behavior | ||
|
|
||
| `get` resolves an exact API identifier and returns markdown content. | ||
|
|
||
| ### Direct-route items | ||
|
|
||
| For items whose identifier maps directly to a page route, `get` fetches the markdown for that API page. | ||
|
|
||
| ## Source and caching | ||
|
|
||
| The implementation uses: | ||
|
|
||
| - `https://aspire.dev/sitemap-0.xml` as the API catalog source | ||
| - A fixed markdown resolution rule that appends `.md` to the canonical API page URL | ||
| - ETag-based caching and disk persistence for both the sitemap and page content | ||
|
|
||
| The implementation should not hardcode the sitemap and markdown endpoints directly into the command handlers. | ||
|
|
||
| ## Parsing strategy | ||
|
|
||
| The API pipeline consists of: | ||
|
|
||
| 1. Fetch sitemap | ||
| 2. Parse API routes for the modeled language set | ||
| 3. Build a hierarchical API map | ||
| 4. Persist the built index to disk | ||
| 5. Use the index to serve `list`, `search`, and `get` | ||
|
|
||
| ## Output models | ||
|
|
||
| ### List | ||
|
|
||
| List output includes: | ||
|
|
||
| - `id` | ||
| - `name` | ||
| - `language` | ||
| - `kind` | ||
| - `parentId` | ||
|
|
||
| ### Search | ||
|
|
||
| Search output includes: | ||
|
|
||
| - `id` | ||
| - `name` | ||
| - `language` | ||
| - `kind` | ||
| - `parentId` | ||
| - `score` | ||
|
|
||
| ### Get | ||
|
|
||
| Get output includes: | ||
|
|
||
| - `id` | ||
| - `name` | ||
| - `language` | ||
| - `kind` | ||
| - `parentId` | ||
| - `url` | ||
| - `content` | ||
|
|
||
| ## Testing | ||
|
|
||
| The feature requires tests for: | ||
|
|
||
| - sitemap parsing and filtering | ||
| - C# member-group page indexing | ||
| - TypeScript hierarchy parsing | ||
| - ETag-aware fetch behavior | ||
| - disk-persisted API index caching | ||
| - scoped `list` | ||
| - language-filtered `search` | ||
| - identifier-based `get` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.CommandLine; | ||
| using System.CommandLine.Help; | ||
| using Aspire.Cli.Configuration; | ||
| using Aspire.Cli.Interaction; | ||
| using Aspire.Cli.Resources; | ||
| using Aspire.Cli.Telemetry; | ||
| using Aspire.Cli.Utils; | ||
|
|
||
| namespace Aspire.Cli.Commands; | ||
|
|
||
| /// <summary> | ||
| /// Parent command for API documentation operations. | ||
| /// </summary> | ||
| internal sealed class ApiCommand : BaseCommand | ||
| { | ||
| internal override HelpGroup HelpGroup => HelpGroup.ToolsAndConfiguration; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ApiCommand"/> class. | ||
| /// </summary> | ||
| /// <param name="listCommand">The scoped browse command.</param> | ||
| /// <param name="searchCommand">The search command.</param> | ||
| /// <param name="getCommand">The content retrieval command.</param> | ||
| /// <param name="interactionService">The interaction service.</param> | ||
| /// <param name="features">The feature flag service.</param> | ||
| /// <param name="updateNotifier">The update notifier.</param> | ||
| /// <param name="executionContext">The CLI execution context.</param> | ||
| /// <param name="telemetry">The telemetry service.</param> | ||
| public ApiCommand( | ||
| ApiListCommand listCommand, | ||
| ApiSearchCommand searchCommand, | ||
| ApiGetCommand getCommand, | ||
| IInteractionService interactionService, | ||
| IFeatures features, | ||
| ICliUpdateNotifier updateNotifier, | ||
| CliExecutionContext executionContext, | ||
| AspireCliTelemetry telemetry) | ||
| : base("api", ApiCommandStrings.Description, features, updateNotifier, executionContext, interactionService, telemetry) | ||
| { | ||
| Subcommands.Add(listCommand); | ||
| Subcommands.Add(searchCommand); | ||
| Subcommands.Add(getCommand); | ||
| } | ||
|
|
||
| protected override bool UpdateNotificationsEnabled => false; | ||
|
|
||
| protected override Task<int> ExecuteAsync(ParseResult parseResult, CancellationToken cancellationToken) | ||
| { | ||
| new HelpAction().Invoke(parseResult); | ||
| return Task.FromResult(ExitCodeConstants.InvalidCommand); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.