Skip to content

feat(LLMsDocsGenerator): support Extensions components - #1269

Merged
ArgoZhang merged 3 commits into
masterfrom
dev-llms-docs
Oct 30, 2026
Merged

ArgoZhang merged 3 commits into
masterfrom
dev-llms-docs

Conversation

@ArgoZhang

@ArgoZhang ArgoZhang commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Link issues

fixes #1268

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Extend the LLM documentation generator to analyze BootstrapBlazor.Extensions sources and produce validated, package-aware documentation alongside core component docs.

New Features:

  • Add generation of LLM documentation for BootstrapBlazor.Extensions components and services, including package-specific service registration guidance.
  • Support analysis of Razor-only components and extension projects discovered from the extensions solution.

Bug Fixes:

  • Return nonzero process results and clear errors for invalid paths, missing documentation configuration, unavailable extension sources, and unresolved configured types.
  • Remove stale generated documentation while preserving unrelated files.

Enhancements:

  • Improve source analysis with project-level using directives, per-package registration resolution, and stricter validation of extension configuration.
  • Make generator paths optional by defaulting both root and output to the current directory.

CI:

  • Update documented CI generation to check out and analyze both core and extensions repositories.

Documentation:

  • Document extension documentation generation, repository layout, configuration, command usage, output, limitations, and verification procedures in English and Chinese.

Tests:

  • Document the integration verification script for generation checks.

Chores:

  • Update extension repository links and project metadata for the revised generator workflow.

@sourcery-ai

sourcery-ai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Extends the LLM documentation generator to discover and document configured BootstrapBlazor.Extensions components and services from solution-listed projects, while adding Razor-only analysis, package-specific DI registration output, safer validation and nonzero failures, stale-file cleanup, and updated usage documentation.

Sequence diagram for extension documentation generation

sequenceDiagram
    participant CLI
    participant DocsGenerator
    participant CategoryProvider
    participant ComponentAnalyzer
    participant ExtensionSources
    participant MarkdownBuilder

    CLI->>DocsGenerator: GenerateAllAsync(rootFolder, outputFolder)
    DocsGenerator->>CategoryProvider: ParseExtensions()
    DocsGenerator->>ExtensionSources: ReadExtensionProjects(repositoryRoot)
    ExtensionSources-->>DocsGenerator: solution-listed projects
    DocsGenerator->>ComponentAnalyzer: AnalyzeTypesByNameAsync(typeNames, resolveRegistration, registrationPackages)
    ComponentAnalyzer->>ExtensionSources: EnsureCompilationAsync()
    ExtensionSources-->>ComponentAnalyzer: core and extension syntax trees
    ComponentAnalyzer-->>DocsGenerator: extension components and services
    DocsGenerator->>MarkdownBuilder: BuildComponentSection(component)
    MarkdownBuilder-->>DocsGenerator: package-specific registration markdown
    DocsGenerator->>DocsGenerator: RemoveStaleDocuments(directory, types)
Loading

Flow diagram for extension documentation generation

flowchart LR
    A["docs.json extension packages"] --> B["Read BootstrapBlazor.Extensions.slnx"]
    B --> C["Filter solution-listed projects"]
    C --> D["Compile core and extension sources"]
    D --> E["Analyze Razor-only components and services"]
    E --> F["Resolve package-specific registrations"]
    F --> G["Generate extensions documentation"]
    G --> H["Remove stale generated files"]
Loading

File-Level Changes

Change Details Files
Adds end-to-end discovery and documentation generation for BootstrapBlazor.Extensions components and services.
  • Reads extension projects from the extension solution and limits analysis to listed source projects.
  • Analyzes Razor-only components and synthesizes inheritance metadata for source analysis.
  • Resolves extension types and service registrations across packages, including project-level using directives and multiple registration methods.
  • Generates extension documentation under a dedicated output directory and removes stale generated files.
tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs
tools/BootstrapBlazor.LLMsDocsGenerator/ComponentInfo.cs
tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs
tools/BootstrapBlazor.LLMsDocsGenerator/MarkdownBuilder.cs
Makes generator CLI failures explicit and improves default path handling.
  • Defaults root and output arguments to the current directory.
  • Throws errors for missing or empty paths and propagates the invocation exit code.
  • Adds validation for missing documentation configuration, core sources, extension sources, projects, and unresolved configured types.
tools/BootstrapBlazor.LLMsDocsGenerator/ArgumentsHelper.cs
tools/BootstrapBlazor.LLMsDocsGenerator/CategoryProvider.cs
tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs
tools/BootstrapBlazor.LLMsDocsGenerator/Program.cs
tools/BootstrapBlazor.LLMsDocsGenerator/Runner.cs
Documents the new extension workflow, repository layout, limitations, and verification process.
  • Updates English and Chinese usage instructions for sibling checkouts, optional arguments, extension output, CI setup, and source-analysis limitations.
  • Adds guidance for package/type configuration, stale-document cleanup, and extension service registration.
tools/BootstrapBlazor.LLMsDocsGenerator/README.md
tools/BootstrapBlazor.LLMsDocsGenerator/README.zh-CN.md
Updates the generator project configuration for the new implementation.
  • Adjusts project metadata or dependencies required by the extension-analysis changes.
tools/BootstrapBlazor.LLMsDocsGenerator/BootstrapBlazor.LLMsDocsGenerator.csproj

Assessment against linked issues

Issue Objective Addressed Explanation
#1268 Generate documentation for configured BootstrapBlazor.Extensions components, including discovering their source types and producing extension documentation output. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto Bot added the enhancement New feature or request label Oct 30, 2026
@bb-auto bb-auto Bot added this to the v10.0.0 milestone Oct 30, 2026

@bb-auto bb-auto Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Auto approved by bb-auto

@ArgoZhang
ArgoZhang merged commit 2a16e35 into master Oct 30, 2026
3 checks passed
@ArgoZhang
ArgoZhang deleted the dev-llms-docs branch October 30, 2026 04:15

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 6 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs" line_range="127" />
<code_context>
         }

+        RemoveStaleDocuments(componentsOutputPath, components.Concat(services));
+        RemoveStaleDocuments(Path.Combine(_outputPath, "extensions"), extComponents.Concat(extServices));
+
         Logger("Documentation generation complete!");
</code_context>
<issue_to_address>
**Previously generated docs are deleted**

When `docs.json` contains an `extensions` entry with a malformed package or component/service array, `RemoveStaleDocuments` treats the empty parsed package list as authoritative and deletes marked extension documents, so a malformed package entry can silently remove previously generated documentation.

Reject malformed extension configuration before generation or stale-file cleanup.
</issue_to_address>

### Comment 2
<location path="tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs" line_range="126-127" />
<code_context>
             Logger($"Generated {extComponents.Count + extServices.Count} extension files in {extOutputPath}");
         }

+        RemoveStaleDocuments(componentsOutputPath, components.Concat(services));
+        RemoveStaleDocuments(Path.Combine(_outputPath, "extensions"), extComponents.Concat(extServices));
+
         Logger("Documentation generation complete!");
</code_context>
<issue_to_address>
**Newer documentation files disappear**

When two generator processes target the same output directory using different source or configuration snapshots, `RemoveStaleDocuments` compares the shared output against each run’s own expected-name set, so one run deletes files generated by the other and the surviving index links to missing documentation.

Serialize generation and stale-document cleanup per output directory, or publish each run’s output atomically from an isolated staging directory.
</issue_to_address>

### Comment 3
<location path="tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs" line_range="161" />
<code_context>
     /// must include both the extension sources and the core library (for base types).
     /// </summary>
-    public async Task<List<ComponentInfo>> AnalyzeTypesByNameAsync(IEnumerable<string> typeNames, bool resolveRegistration = false)
+    public async Task<List<ComponentInfo>> AnalyzeTypesByNameAsync(IEnumerable<string> typeNames,
+        bool resolveRegistration = false, IReadOnlyList<ExtensionPackage>? registrationPackages = null)
     {
</code_context>
<issue_to_address>
**Extension docs describe the wrong type**

When a configured extension type shares a short name with a core or another extension type, or two configured packages use the same short type name, `Distinct()` collapses duplicate configured names and `AnalyzeTypesByNameAsync` resolves names with `GetSymbolsWithName(...).FirstOrDefault()` across the combined compilation, so the generator documents the wrong declaration, can overwrite another package’s document, and produces incorrect or missing registration guidance.

Keep each configured name associated with its package and resolve it within the owning extension project instead of selecting the first symbol from the combined compilation.

Also at `tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs:162`, `tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs:333`, `tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs:69`.
</issue_to_address>

### Comment 4
<location path="tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs" line_range="79-80" />
<code_context>
+        // Razor-only components use the synthesized @inherits declaration.
         var entryFiles = Directory.GetFiles(_componentsPath, "*.razor.cs", SearchOption.AllDirectories)
             .Concat(Directory.GetFiles(_componentsPath, "*Base.cs", SearchOption.AllDirectories))
+            .Concat(Directory.GetFiles(_componentsPath, "*.razor", SearchOption.AllDirectories)
+                .Where(file => !File.Exists(file + ".cs") && _treeByPath.ContainsKey(Path.GetFullPath(file))))
             .Distinct(StringComparer.OrdinalIgnoreCase);

</code_context>
<issue_to_address>
**Inherited component details disappear**

When a Razor-only component uses an unqualified `@inherits` base type supplied by `_Imports.razor` or project-level usings, `BuildInheritsShimAsync` parses the synthesized class without those imports, so Roslyn cannot resolve the base type and the analyzer omits inherited parameters and methods or excludes the component from the generated docs.

Include the applicable Razor imports and project-level usings when building the synthesized shim.

Also at `tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs:381`.
</issue_to_address>

### Comment 5
<location path="tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs" line_range="286" />
<code_context>
+                    // First writer wins within each package so the most direct registration method sticks.
+                    if (!registrations.Any(reg => reg.PackageName == packageName))
+                    {
+                        registrations.Add(new ServiceRegistration
                         {
+                            PackageName = packageName,
</code_context>
<issue_to_address>
**Registration guidance is omitted**

When a configured extension service uses a non-generic registration overload such as `AddScoped(typeof(IDataService<>), ...)`, `BuildRegistrationIndex` only recognizes generic registration calls and their type arguments, so `ResolveRegistrations` finds no registration and the generated extension documentation omits the package’s registration instructions.

Teach `BuildRegistrationIndex` to extract service types from non-generic registration overloads that use `typeof`.

Also at `tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs:72-73`.
</issue_to_address>

### Comment 6
<location path="tools/BootstrapBlazor.LLMsDocsGenerator/README.md" line_range="146" />
<code_context>
+Run the integration checks with PowerShell:
+
+```powershell
+.\tools\BootstrapBlazor.LLMsDocsGenerator\tests\Verify-Generation.ps1
+```

</code_context>
<issue_to_address>
**Documented verification command fails**

When a user follows the README’s PowerShell verification instructions, the command targets `tests/Verify-Generation.ps1`, which is absent from the repository, so it fails before any integration checks run.

Add the referenced script or change the README command to point to an existing verification script.

Also at `tools/BootstrapBlazor.LLMsDocsGenerator/README.zh-CN.md:146`.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

}

RemoveStaleDocuments(componentsOutputPath, components.Concat(services));
RemoveStaleDocuments(Path.Combine(_outputPath, "extensions"), extComponents.Concat(extServices));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Previously generated docs are deleted

When docs.json contains an extensions entry with a malformed package or component/service array, RemoveStaleDocuments treats the empty parsed package list as authoritative and deletes marked extension documents, so a malformed package entry can silently remove previously generated documentation.

Reject malformed extension configuration before generation or stale-file cleanup.

Prompt for AI agents
In `tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs` at line 127:

**Previously generated docs are deleted**

When `docs.json` contains an `extensions` entry with a malformed package or component/service array, `RemoveStaleDocuments` treats the empty parsed package list as authoritative and deletes marked extension documents, so a malformed package entry can silently remove previously generated documentation.

Reject malformed extension configuration before generation or stale-file cleanup.

Comment on lines +126 to +127
RemoveStaleDocuments(componentsOutputPath, components.Concat(services));
RemoveStaleDocuments(Path.Combine(_outputPath, "extensions"), extComponents.Concat(extServices));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Newer documentation files disappear

When two generator processes target the same output directory using different source or configuration snapshots, RemoveStaleDocuments compares the shared output against each run’s own expected-name set, so one run deletes files generated by the other and the surviving index links to missing documentation.

Serialize generation and stale-document cleanup per output directory, or publish each run’s output atomically from an isolated staging directory.

Prompt for AI agents
In `tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs` at lines 126-127:

**Newer documentation files disappear**

When two generator processes target the same output directory using different source or configuration snapshots, `RemoveStaleDocuments` compares the shared output against each run’s own expected-name set, so one run deletes files generated by the other and the surviving index links to missing documentation.

Serialize generation and stale-document cleanup per output directory, or publish each run’s output atomically from an isolated staging directory.

/// must include both the extension sources and the core library (for base types).
/// </summary>
public async Task<List<ComponentInfo>> AnalyzeTypesByNameAsync(IEnumerable<string> typeNames, bool resolveRegistration = false)
public async Task<List<ComponentInfo>> AnalyzeTypesByNameAsync(IEnumerable<string> typeNames,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Extension docs describe the wrong type

When a configured extension type shares a short name with a core or another extension type, or two configured packages use the same short type name, Distinct() collapses duplicate configured names and AnalyzeTypesByNameAsync resolves names with GetSymbolsWithName(...).FirstOrDefault() across the combined compilation, so the generator documents the wrong declaration, can overwrite another package’s document, and produces incorrect or missing registration guidance.

Keep each configured name associated with its package and resolve it within the owning extension project instead of selecting the first symbol from the combined compilation.

Also at tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs:162, tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs:333, tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs:69.

Prompt for AI agents
In `tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs` at line 161:

**Extension docs describe the wrong type**

When a configured extension type shares a short name with a core or another extension type, or two configured packages use the same short type name, `Distinct()` collapses duplicate configured names and `AnalyzeTypesByNameAsync` resolves names with `GetSymbolsWithName(...).FirstOrDefault()` across the combined compilation, so the generator documents the wrong declaration, can overwrite another package’s document, and produces incorrect or missing registration guidance.

Keep each configured name associated with its package and resolve it within the owning extension project instead of selecting the first symbol from the combined compilation.

Also at `tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs:162`, `tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs:333`, `tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs:69`.

Comment on lines +79 to +80
.Concat(Directory.GetFiles(_componentsPath, "*.razor", SearchOption.AllDirectories)
.Where(file => !File.Exists(file + ".cs") && _treeByPath.ContainsKey(Path.GetFullPath(file))))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Inherited component details disappear

When a Razor-only component uses an unqualified @inherits base type supplied by _Imports.razor or project-level usings, BuildInheritsShimAsync parses the synthesized class without those imports, so Roslyn cannot resolve the base type and the analyzer omits inherited parameters and methods or excludes the component from the generated docs.

Include the applicable Razor imports and project-level usings when building the synthesized shim.

Also at tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs:381.

Prompt for AI agents
In `tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs` at lines 79-80:

**Inherited component details disappear**

When a Razor-only component uses an unqualified `@inherits` base type supplied by `_Imports.razor` or project-level usings, `BuildInheritsShimAsync` parses the synthesized class without those imports, so Roslyn cannot resolve the base type and the analyzer omits inherited parameters and methods or excludes the component from the generated docs.

Include the applicable Razor imports and project-level usings when building the synthesized shim.

Also at `tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs:381`.

// First writer wins within each package so the most direct registration method sticks.
if (!registrations.Any(reg => reg.PackageName == packageName))
{
registrations.Add(new ServiceRegistration

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Registration guidance is omitted

When a configured extension service uses a non-generic registration overload such as AddScoped(typeof(IDataService<>), ...), BuildRegistrationIndex only recognizes generic registration calls and their type arguments, so ResolveRegistrations finds no registration and the generated extension documentation omits the package’s registration instructions.

Teach BuildRegistrationIndex to extract service types from non-generic registration overloads that use typeof.

Also at tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs:72-73.

Prompt for AI agents
In `tools/BootstrapBlazor.LLMsDocsGenerator/ComponentAnalyzer.cs` at line 286:

**Registration guidance is omitted**

When a configured extension service uses a non-generic registration overload such as `AddScoped(typeof(IDataService<>), ...)`, `BuildRegistrationIndex` only recognizes generic registration calls and their type arguments, so `ResolveRegistrations` finds no registration and the generated extension documentation omits the package’s registration instructions.

Teach `BuildRegistrationIndex` to extract service types from non-generic registration overloads that use `typeof`.

Also at `tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs:72-73`.

Run the integration checks with PowerShell:

```powershell
.\tools\BootstrapBlazor.LLMsDocsGenerator\tests\Verify-Generation.ps1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Medium · Documented verification command fails

When a user follows the README’s PowerShell verification instructions, the command targets tests/Verify-Generation.ps1, which is absent from the repository, so it fails before any integration checks run.

Add the referenced script or change the README command to point to an existing verification script.

Also at tools/BootstrapBlazor.LLMsDocsGenerator/README.zh-CN.md:146.

Prompt for AI agents
In `tools/BootstrapBlazor.LLMsDocsGenerator/README.md` at line 146:

**Documented verification command fails**

When a user follows the README’s PowerShell verification instructions, the command targets `tests/Verify-Generation.ps1`, which is absent from the repository, so it fails before any integration checks run.

Add the referenced script or change the README command to point to an existing verification script.

Also at `tools/BootstrapBlazor.LLMsDocsGenerator/README.zh-CN.md:146`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(LLMsDocsGenerator): support Extensions components

1 participant