Skip to content
Merged
Show file tree
Hide file tree
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 Apr 2, 2026
b3a9869
Fix formatting of C# header in API docs commands
IEvangelist Apr 7, 2026
d9c1f5f
Enhance API documentation caching and fetching with sitemap URL rebas…
IEvangelist Apr 7, 2026
4e31cfe
Add test for TypeScript direct route item retrieval in API docs service
IEvangelist Apr 8, 2026
6d218ba
Refresh docs indexes when source content changes
IEvangelist Apr 8, 2026
abecfcc
Move API docs under docs command
IEvangelist Apr 9, 2026
549e8ce
Finish API docs feedback fixes
IEvangelist Apr 9, 2026
ae77d09
Restore API command XLF generation
IEvangelist Apr 9, 2026
e76e564
Fix docs cache naming and list parsing
IEvangelist Apr 9, 2026
0dd3e49
Simplify docs and API cache filenames
IEvangelist Apr 9, 2026
763b5cd
Add cached C# API member search
IEvangelist Apr 10, 2026
820503f
Generalize API member index search
IEvangelist Apr 10, 2026
0b2cb84
Make API member loading incremental
IEvangelist Apr 10, 2026
917e5a0
Refine API docs search results
IEvangelist Apr 10, 2026
1034358
Fix API markdown link rendering
IEvangelist Apr 10, 2026
a98aee9
Move docs source URLs into config
IEvangelist Apr 10, 2026
f324969
Refine docs and api docs sources
IEvangelist Apr 10, 2026
9864148
Restore markdown docs output
IEvangelist Apr 10, 2026
b3ff9ef
Render docs get through markdown display
IEvangelist Apr 10, 2026
8dc856b
Format minified docs code blocks
IEvangelist Apr 10, 2026
5f95928
Expand minified docs formatter languages
IEvangelist Apr 10, 2026
19694a7
Fix Linux docs cache and API link handling
IEvangelist Apr 10, 2026
bf4ee3c
Remove docs code block reformatting
IEvangelist Apr 10, 2026
0268a36
Remove unshipped API language scaffolding
IEvangelist Apr 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .agents/skills/aspire/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ Resources are typically defined in an AppHost such as, `AppHost.cs`, `apphost.ts
2. Start the app with `aspire start`. Use `--isolated` in git worktrees or whenever shared local state would be risky.
3. Use `aspire wait <resource>` before interacting with a resource that needs to be healthy.
4. Inspect state with `aspire describe`, then use `aspire otel logs`, `aspire logs`, `aspire otel traces`, and `aspire export` before making code changes.
5. Before adding an integration, introducing a custom dashboard/resource command, or using an unfamiliar AppHost API, run `aspire docs search <topic>` and then `aspire docs get <slug>` for the pattern or API you plan to implement.
5. Before adding an integration, introducing a custom dashboard/resource command, or using an unfamiliar AppHost API, use `aspire docs search <topic>` and `aspire docs get <slug>` for workflow guidance, then use `aspire api search <query> --language csharp|typescript` and `aspire api get <id>` when you need the API reference entry itself.
6. Re-run `aspire start` after AppHost changes. In git worktrees, re-run `aspire start --isolated` instead of switching to `aspire run`.

## C# AppHosts

When the AppHost is implemented in C# such as `AppHost.cs`, `apphost.cs`, or a `Program.cs`-based AppHost, use Aspire docs to understand the documented API or pattern before editing.
When the AppHost is implemented in C# such as `AppHost.cs`, `apphost.cs`, or a `Program.cs`-based AppHost, use Aspire docs for workflow guidance and Aspire API docs for the reference entry before editing.

- Use `aspire docs search <topic>` and `aspire docs get <slug>` when you need official guidance for an unfamiliar C# API, resource builder pattern, or command shape.
- Use `aspire docs search <topic>` and `aspire docs get <slug>` when you need the documented workflow or pattern.
- Use `aspire api search <query> --language csharp` and `aspire api get <id>` when you need the C# API reference entry for a resource builder, extension method, or member.
- If the `dotnet-inspect` skill is available, use it to inspect local C# APIs, overloads, and builder chains when you need help understanding how the API surface is exposed in code.
- Keep `dotnet-inspect` scoped to understanding APIs and symbols; use Aspire docs for the documented workflow and recommended pattern.

Expand All @@ -60,8 +61,8 @@ When the AppHost is `apphost.ts`, the `.modules/` folder at the project root con
- Re-running `aspire start` is the restart path. In git worktrees, `aspire start --isolated` is both the start and restart command. Do not combine `aspire stop` and `aspire run`.
- Use `--apphost <path>` when the workspace has multiple AppHosts or discovery is ambiguous.
- Use `--format Json` when another tool or script needs machine-readable output.
- Do not guess the integration or command shape for unfamiliar AppHost changes. Use `aspire docs search` first, then `aspire docs get` before editing AppHost code for integrations, `WithCommand`, or other non-trivial Aspire APIs.
- For unfamiliar C# AppHost APIs, use Aspire docs as the primary API reference and, if available, use `dotnet-inspect` only to inspect local symbols, overloads, and builder chains.
- Do not guess the integration or command shape for unfamiliar AppHost changes. Use `aspire docs search` and `aspire docs get` for the documented pattern, then use `aspire api search` and `aspire api get` when you need the specific reference entry.
- For unfamiliar C# AppHost APIs, use Aspire API docs as the primary reference and, if available, use `dotnet-inspect` only to inspect local symbols, overloads, and builder chains.
- Never install the obsolete Aspire workload.
- When a TypeScript AppHost uses `.modules/`, do not edit generated files directly. Use `aspire add` to regenerate APIs and inspect `.modules/aspire.ts` afterward.
- Prefer official docs from `aspire.dev`.
Expand Down
12 changes: 8 additions & 4 deletions .agents/skills/aspire/references/agent-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,29 @@ Inspect the live app before editing code:

## Scenario: I Need To Add An Integration, Understand An API, Or Add A Custom Command Safely

Use the docs commands first, then add the integration or edit the AppHost:
Use the docs commands first for the workflow, then use the API reference commands if you need the concrete API entry:

```bash
aspire docs search postgres
aspire docs get <slug>
aspire api search postgres --language csharp
aspire api get <id>
aspire add <package>
```

For dashboard or custom resource commands, use the docs first:
For dashboard or custom resource commands, use docs for the pattern and API docs for the specific entry:

```bash
aspire docs search "custom resource commands"
aspire docs get custom-resource-commands
aspire api search WithCommand --language csharp
```

Keep these points in mind:

- Read the docs before editing the AppHost so the implementation follows a documented Aspire pattern instead of guessing the API shape.
- If the AppHost is C# and you need to understand local overloads or builder chains, use the `dotnet-inspect` skill if it is available, but keep Aspire docs as the primary source of documented guidance.
- Read the docs before editing the AppHost so the implementation follows a documented Aspire pattern instead of guessing the workflow.
- Use `aspire api` when you need the C# or TypeScript reference entry for the exact API you are about to call.
- If the AppHost is C# and you need to understand local overloads or builder chains, use the `dotnet-inspect` skill if it is available after checking the Aspire API reference.
- After adding an integration, restart with `aspire start` so the updated AppHost takes effect.

## Scenario: The AppHost Is TypeScript And Generated APIs Matter
Expand Down
8 changes: 5 additions & 3 deletions .agents/skills/aspire/references/csharp-apphosts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ Use this when the AppHost is implemented in C# and the task involves understandi

## Scenario: I Need Official Docs For An Unfamiliar C# AppHost API

Use these commands when you need the documented Aspire pattern before changing C# AppHost code.
Use these commands when you need the documented Aspire pattern and the C# API reference before changing AppHost code.

```bash
aspire docs search <query>
aspire docs get <slug>
aspire api search <query> --language csharp
aspire api get <id>
```

Keep these points in mind:

- Use Aspire docs first when the task is about understanding an unfamiliar resource builder API, extension method, dashboard command pattern, or integration workflow.
- Use Aspire docs first when the task is about understanding an unfamiliar integration workflow or dashboard command pattern.
- Use `aspire api` when the task is about finding the C# reference entry for a resource builder API, extension method, or member.
- Search for the resource or pattern name before guessing the C# API shape.
- Use the docs to confirm the recommended pattern before editing the AppHost.

## Scenario: I Need To Read The Local C# API Surface More Closely

Expand Down
18 changes: 10 additions & 8 deletions .agents/skills/aspire/references/tools-and-configuration.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# Tools And Configuration

Use this when the task is about docs lookup, secrets, CLI configuration, diagnostics, cache cleanup, or local certificates.
Use this when the task is about docs lookup, API reference lookup, secrets, CLI configuration, diagnostics, cache cleanup, or local certificates.

## Scenario: I Need Docs Before I Change The AppHost Or Use An Unfamiliar API
## Scenario: I Need Docs Or API Reference Before I Change The AppHost

Use these commands when the task is to confirm the right Aspire workflow before editing code.
Use these commands when the task is to confirm the right Aspire workflow before editing code or retrieve a specific API reference entry.

```bash
aspire docs search <query>
aspire docs list
aspire docs get <slug>
aspire api search <query> --language csharp|typescript
aspire api list <scope>
aspire api get <id>
```

Keep these points in mind:

- Use docs commands before changing integrations when you need to confirm the supported path.
- Use docs commands before implementing custom resource commands or unfamiliar AppHost APIs such as `WithCommand`.
- Use docs commands when the user needs help understanding an Aspire API, not just when they need a task workflow.
- Use `aspire docs list` when you need to browse the available doc set before narrowing to a specific page.
- Use docs commands before changing integrations when you need to confirm the supported path or recommended workflow.
- Use docs commands before implementing custom resource commands or unfamiliar AppHost patterns such as `WithCommand`.
- Use API commands when the user needs the C# or TypeScript reference entry for a specific Aspire API.
- Use `aspire api list <scope>` to browse children under a language, package, module, type, or symbol.

## Scenario: I Need To Inspect Or Change AppHost Secrets

Expand Down
203 changes: 203 additions & 0 deletions docs/specs/api-docs-commands.md
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
Comment thread
IEvangelist marked this conversation as resolved.
Resolved

## 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`
2 changes: 1 addition & 1 deletion src/Aspire.Cli/Commands/AgentMcpCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Aspire.Cli.Configuration;
using Aspire.Cli.Interaction;
using Aspire.Cli.Mcp;
using Aspire.Cli.Mcp.Docs;
using Aspire.Cli.Documentation.Docs;
using Aspire.Cli.Mcp.Tools;
using Aspire.Cli.Packaging;
using Aspire.Cli.Resources;
Expand Down
55 changes: 55 additions & 0 deletions src/Aspire.Cli/Commands/ApiCommand.cs
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);
}
}
Loading
Loading