Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Jan 8, 2026

Link issues

fixes #895

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

Add a configurable output folder to the LLMs documentation generator tool and update documentation generation paths accordingly.

New Features:

  • Introduce an --output command-line option to specify the publish/output folder for the LLMs docs generator.

Enhancements:

  • Update the docs generation logic to use the provided output folder instead of a hardcoded publish path.

Copilot AI review requested due to automatic review settings January 8, 2026 00:59
@bb-auto bb-auto bot added the chore label Jan 8, 2026
@bb-auto bb-auto bot added this to the v9.2.0 milestone Jan 8, 2026
@sourcery-ai
Copy link

sourcery-ai bot commented Jan 8, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a configurable output folder parameter to the LLMs docs generator tool and adjusts documentation generation paths to use it instead of a hard‑coded publish path.

Sequence diagram for LLMs docs generator CLI with output parameter

sequenceDiagram
    actor Developer
    participant CLI as ArgumentsHelper
    participant RootCommand
    participant DocsGenerator

    Developer->>CLI: Parse(args)
    CLI->>RootCommand: Configure rootFolderOption and outputFolderOption
    Developer->>RootCommand: Execute with --root and --output
    RootCommand->>RootCommand: SetAction callback invoked
    RootCommand->>RootCommand: GetValue(rootFolderOption)
    alt rootFolder is null or empty
        RootCommand-->>Developer: Exit without generating docs
    else rootFolder is valid
        RootCommand->>RootCommand: GetValue(outputFolderOption)
        alt outputFolder is null or empty
            RootCommand-->>Developer: Exit without generating docs
        else outputFolder is valid
            RootCommand->>DocsGenerator: GenerateAllAsync(rootFolder, outputFolder)
            DocsGenerator-->>RootCommand: Generation completed
            RootCommand-->>Developer: Return success
        end
    end
Loading

Class diagram for updated LLMs docs generator arguments and generator

classDiagram
    class ArgumentsHelper {
        +static ParseResult Parse(string[] args)
    }

    class DocsGenerator {
        +static Task GenerateAllAsync(string rootFolder, string outputFolder)
    }

    class RootCommand {
        +RootCommand(string description)
        +void SetAction(Func<InvocationContext, Task> action)
        +ParseResult Parse(string[] args)
    }

    class Option_string_nullable_ {
        +Option_string_nullable_(string alias)
        +string Description
    }

    class ParseResult {
    }

    class InvocationContext {
        +T GetValue~T~(Option_T_ option)
    }

    ArgumentsHelper ..> RootCommand : uses
    ArgumentsHelper ..> Option_string_nullable_ : uses
    ArgumentsHelper ..> ParseResult : returns
    ArgumentsHelper ..> InvocationContext : action parameter
    InvocationContext ..> Option_string_nullable_ : uses
    RootCommand ..> ParseResult : returns
    DocsGenerator <.. ArgumentsHelper : called by
Loading

File-Level Changes

Change Details Files
Introduce an --output CLI option and require it for docs generation.
  • Add an --output option to the root command with a description for the publish folder.
  • Bind the new option into the RootCommand so it is parsed from CLI args.
  • Retrieve the outputFolder from parse results and short‑circuit execution if it is null or empty.
  • Update the DocsGenerator.GenerateAllAsync call site to pass both rootFolder and outputFolder.
tools/BootstrapBlazor.LLMsDocsGenerator/ArgumentsHelper.cs
Update DocsGenerator to use the provided output folder when computing output paths.
  • Change GenerateAllAsync signature to accept outputFolder in addition to rootFolder.
  • Replace the hard‑coded publish/bin path with Path.Combine(outputFolder, "wwwroot", "llms").
  • Keep source path resolution based on rootFolder while redirecting output to the new output folder hierarchy.
tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#895 Add an --output parameter to the LLMs docs generator CLI so the publish/output folder can be provided instead of using a hardcoded output path.
#895 Bump the version of the LLMs docs generator tool/package to 10.0.2.

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • In ArgumentsHelper, returning silently when --output is missing makes the tool harder to use; consider either keeping the previous default publish path when --output is not supplied or emitting a clear error/help message instead of just returning.
  • The new --output option description is a bit ambiguous given that DocsGenerator appends wwwroot/llms; it may be clearer to describe it explicitly as the publish root (or similar) so users know what directory level to pass.
  • When using the provided outputFolder in DocsGenerator, consider validating/creating the target directory and logging if it doesn't exist, so failures are explicit rather than resulting in downstream IO errors.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `ArgumentsHelper`, returning silently when `--output` is missing makes the tool harder to use; consider either keeping the previous default publish path when `--output` is not supplied or emitting a clear error/help message instead of just returning.
- The new `--output` option description is a bit ambiguous given that `DocsGenerator` appends `wwwroot/llms`; it may be clearer to describe it explicitly as the publish root (or similar) so users know what directory level to pass.
- When using the provided `outputFolder` in `DocsGenerator`, consider validating/creating the target directory and logging if it doesn't exist, so failures are explicit rather than resulting in downstream IO errors.

## Individual Comments

### Comment 1
<location> `tools/BootstrapBlazor.LLMsDocsGenerator/ArgumentsHelper.cs:15-23` </location>
<code_context>
     public static ParseResult Parse(string[] args)
     {
         var rootFolderOption = new Option<string?>("--root") { Description = "Set the root folder of project" };
+        var outputFolderOption = new Option<string?>("--output") { Description = "Set the publish folder of project" };

         var rootCommand = new RootCommand("BootstrapBlazor LLMs Documentation Generator")
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Consider making `--root`/`--output` required or surfacing an error instead of silently returning.

Right now the command effectively requires both `rootFolder` and `outputFolder`, but just `return`s if either is missing, so the user gets no feedback. Instead, either declare these options as required in the command configuration or emit an explicit error and non‑zero exit code when one is omitted, so a call like `llms-docs-generator --root ...` without `--output` doesn’t silently do nothing.

Suggested implementation:

```csharp
    public static ParseResult Parse(string[] args)
    {
        var rootFolderOption = new Option<string>("--root")
        {
            Description = "Set the root folder of project",
            IsRequired = true
        };
        var outputFolderOption = new Option<string>("--output")
        {
            Description = "Set the publish folder of project",
            IsRequired = true
        };

        var rootCommand = new RootCommand("BootstrapBlazor LLMs Documentation Generator")
        {
            rootFolderOption,
            outputFolderOption
        };

        rootCommand.SetAction(async result =>
        {
            var rootFolder = result.GetValueForOption(rootFolderOption);
            var outputFolder = result.GetValueForOption(outputFolderOption);

            // existing logic that previously ran after the null-checks goes here,
            // now guaranteed to have non-null rootFolder and outputFolder
        });

```

I can only see part of the `SetAction` body. To fully implement the behavior without silent returns you should:

1. Remove any `if (rootFolder is null) { return; }` / `if (outputFolder is null) { return; }` guards that existed before.
2. Move the existing logic that used `rootFolder`/`outputFolder` into the new action body after the `GetValueForOption` calls.
3. If you want more user-friendly output in addition to the built-in System.CommandLine error for missing required options, you can also:
   - Add examples to the command description, or
   - Use `rootCommand.TreatUnmatchedTokensAsErrors = true;` if not already set, to ensure bad invocations fail with non-zero exit codes.

With `IsRequired = true`, invocations like `llms-docs-generator --root ...` (without `--output`) will now emit an explicit error and a non-zero exit code instead of silently doing nothing.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang ArgoZhang merged commit 1035e03 into master Jan 8, 2026
6 checks passed
@ArgoZhang ArgoZhang deleted the chore-llms branch January 8, 2026 01:06
Copy link

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

This PR adds a new --output parameter to the LLMs documentation generator tool, allowing users to specify a custom output folder instead of using a hardcoded path. The change replaces the previously hardcoded output path (bin/Release/net10.0/publish/wwwroot/llms) with a configurable parameter and bumps the tool version from 10.0.1 to 10.0.2.

Key changes:

  • Added --output command-line parameter to specify the publish folder
  • Modified GenerateAllAsync to accept an output folder parameter
  • Updated path construction to use the configurable output folder

Reviewed changes

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

File Description
tools/BootstrapBlazor.LLMsDocsGenerator/DocsGenerator.cs Added outputFolder parameter to GenerateAllAsync method and updated output path construction
tools/BootstrapBlazor.LLMsDocsGenerator/ArgumentsHelper.cs Added --output option definition and validation logic for the new parameter
tools/BootstrapBlazor.LLMsDocsGenerator/BootstrapBlazor.LLMsDocsGenerator.csproj Incremented version from 10.0.1 to 10.0.2

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

public static ParseResult Parse(string[] args)
{
var rootFolderOption = new Option<string?>("--root") { Description = "Set the root folder of project" };
var outputFolderOption = new Option<string?>("--output") { Description = "Set the publish folder of project" };
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The outputFolderOption should be marked as required since the code will silently fail if it's not provided. Without making this parameter required, users won't get proper command-line help indicating this is a mandatory parameter. Consider adding .IsRequired = true to the option definition to make the requirement explicit and provide better CLI usability.

Suggested change
var outputFolderOption = new Option<string?>("--output") { Description = "Set the publish folder of project" };
var outputFolderOption = new Option<string?>("--output") { Description = "Set the publish folder of project", IsRequired = true };

Copilot uses AI. Check for mistakes.

internal static class DocsGenerator
{
/// <summary>
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

This change introduces a breaking API change by making the output folder parameter mandatory, but the existing documentation in README.md shows that the tool can be called without parameters (e.g., 'llms-docs' or 'dotnet run --project tools/LlmsDocsGenerator'). These examples will no longer work with the new changes. The documentation should be updated to reflect that both --root and --output parameters are now required, or the parameters should be made optional with sensible defaults to maintain backward compatibility.

Suggested change
/// <summary>
/// <summary>
/// Generate all documentation files using the current directory
/// as both the root and output folder.
/// </summary>
public static Task GenerateAllAsync()
{
var currentDirectory = Directory.GetCurrentDirectory();
return GenerateAllAsync(currentDirectory, currentDirectory);
}
/// <summary>
/// Generate all documentation files using the specified root folder
/// as both the source root and the output root.
/// </summary>
public static Task GenerateAllAsync(string rootFolder)
{
return GenerateAllAsync(rootFolder, rootFolder);
}
/// <summary>

Copilot uses AI. Check for mistakes.
{
public static ParseResult Parse(string[] args)
{
var rootFolderOption = new Option<string?>("--root") { Description = "Set the root folder of project" };
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The rootFolderOption should be marked as required since the code will silently fail if it's not provided. Without making this parameter required, users won't get proper command-line help indicating this is a mandatory parameter. Consider adding .IsRequired = true to the option definition to make the requirement explicit and provide better CLI usability.

Suggested change
var rootFolderOption = new Option<string?>("--root") { Description = "Set the root folder of project" };
var rootFolderOption = new Option<string?>("--root")
{
Description = "Set the root folder of project",
IsRequired = true
};

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +35
var outputFolder = result.GetValue(outputFolderOption);
if (string.IsNullOrEmpty(outputFolder))
{
return;
}
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

When the output folder parameter is missing or empty, the function silently returns without providing any feedback to the user. This creates a poor user experience as the user won't know why the tool didn't execute. Consider logging an error message or providing usage information before returning, similar to how other command-line tools behave when required parameters are missing.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(LLMs): add output parameter

2 participants