|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics.CodeAnalysis;
namespace Aspire.Hosting.Ats;
/// <summary>
/// Specifies the runtime execution configuration for a language.
/// </summary>
[Experimental("ASPIREATS001")]
public sealed class RuntimeSpec
{
/// <summary>
/// Gets the language identifier (e.g., "TypeScript", "Python").
/// </summary>
public required string Language { get; init; }
/// <summary>
/// Gets the display name for the language (e.g., "TypeScript (Node.js)").
/// </summary>
public required string DisplayName { get; init; }
/// <summary>
/// Gets the code generation language identifier for the generateCode RPC.
/// </summary>
public required string CodeGenLanguage { get; init; }
/// <summary>
/// Gets the file patterns used to detect this language (e.g., ["apphost.ts"]).
/// </summary>
public required string[] DetectionPatterns { get; init; }
/// <summary>
/// Gets the command to install dependencies. Null if no dependencies to install.
/// </summary>
public CommandSpec? InstallDependencies { get; init; }
/// <summary>
/// Gets the command to execute the AppHost for run.
/// </summary>
public required CommandSpec Execute { get; init; }
/// <summary>
/// Gets the command to execute the AppHost in watch mode. Null if watch mode not supported.
/// </summary>
public CommandSpec? WatchExecute { get; init; }
/// <summary>
/// Gets the command to execute the AppHost for publish. Null to use Execute with args appended.
/// </summary>
public CommandSpec? PublishExecute { get; init; }
}
/// <summary>
/// Specifies a command to execute.
/// </summary>
[Experimental("ASPIREATS001")]
public sealed class CommandSpec
{
/// <summary>
/// Gets the command to execute (e.g., "npm", "npx", "python").
/// </summary>
public required string Command { get; init; }
/// <summary>
/// Gets the arguments for the command.
/// Supports placeholders: {appHostFile}, {appHostDir}, {args}
/// </summary>
public required string[] Args { get; init; }
/// <summary>
/// Gets the environment variables to set when executing the command.
/// These are merged with any environment variables provided by the caller.
/// </summary>
public Dictionary<string, string>? EnvironmentVariables { get; init; }
}
|