|
// 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 AI agent integrations. Contains subcommands for MCP server and initialization.
/// </summary>
internal sealed class AgentCommand : BaseCommand
{
public AgentCommand(
AgentMcpCommand mcpCommand,
AgentInitCommand initCommand,
IInteractionService interactionService,
IFeatures features,
ICliUpdateNotifier updateNotifier,
CliExecutionContext executionContext,
AspireCliTelemetry telemetry)
: base("agent", AgentCommandStrings.Description, features, updateNotifier, executionContext, interactionService, telemetry)
{
ArgumentNullException.ThrowIfNull(mcpCommand);
ArgumentNullException.ThrowIfNull(initCommand);
Subcommands.Add(mcpCommand);
Subcommands.Add(initCommand);
}
protected override bool UpdateNotificationsEnabled => false;
protected override Task<int> ExecuteAsync(ParseResult parseResult, CancellationToken cancellationToken)
{
new HelpAction().Invoke(parseResult);
return Task.FromResult(ExitCodeConstants.InvalidCommand);
}
}
|