AppSurface Search
API Reference

Cli

Type

CoverageCommand

Source

Provides the discoverable root for AppSurface coverage commands.

Remarks

The root command keeps the coverage workflow visible in appsurface --help. The stable v1 contract includes coverage run, which executes instrumented .NET test projects, coverage merge, which fans in existing Cobertura shards, and coverage gate, which evaluates the merged coverage without requiring a hosted coverage service.

Method

ExecuteAsync

ValueTask ExecuteAsync(IConsole console) Source

Prints the coverage command family summary.

Parameters

  • consoleCliFx console used for command output.

Returns

A completed task.

Type

AppSurfaceExportCommand

Source

Exports an AppSurface/RazorWire application through the product-facing appsurface export command.

Remarks

This command delegates crawling, hybrid split-origin rewriting, validation, and materialization to the shared RazorWire export engine while keeping the common AppSurface workflow discoverable from the AppSurface CLI.

Property

PublishRootExtrasPath

string? PublishRootExtrasPath { get; set; } Source

Gets or sets an optional path to a publish-root deployment extras manifest.

Remarks

The manifest declares explicit deployment-owned files, such as CNAME, that should be copied into the publish root after export proves they do not collide with generated output. This option is distinct from SeedRoutesPath, which contains routes to crawl.

Property

LiveOrigin

string? LiveOrigin { get; set; } Source

Gets or sets the optional live origin for RazorWire-managed split-origin hybrid interactions.

Remarks

The value must be an absolute http or https origin with no path, query string, fragment, or userinfo. Use this when the exported static files are served from one origin but RazorWire-owned live streams, islands, and lazy anti-forgery forms must call a different live app origin. Leave it unset for same-origin hybrid deployments.

Property

HybridCredentials

RazorWireHybridCredentialsMode HybridCredentials { get; set; } Source

Gets or sets credential behavior for RazorWire-managed live calls in hybrid output.

Remarks

Defaults to RazorWireHybridCredentialsMode.Auto, which includes credentials only when LiveOrigin is set. Use RazorWireHybridCredentialsMode.Include for cookie-backed cross-origin live apps and RazorWireHybridCredentialsMode.Omit for public live surfaces that do not depend on cookies or anti-forgery token refreshes.

Type

PwaVerifyCommand

Source

Verifies that a running web app exposes AppSurface-compatible PWA install metadata.

Property

Url

string? Url { get; set; } Source

Gets the app origin or URL to verify.

Property

BaseUrl

string? BaseUrl { get; set; } Source

Gets the app base URL to verify.

Property

EntryPath

string EntryPath { get; set; } Source

Gets the app-root-relative entry path whose HTML should expose the manifest link.

Property

ExpectedStartUrl

string? ExpectedStartUrl { get; set; } Source

Gets the expected manifest start_url value.

Property

ExpectedScope

string? ExpectedScope { get; set; } Source

Gets the expected manifest scope value.

Property

ExpectedDisplay

string? ExpectedDisplay { get; set; } Source

Gets the expected manifest display mode.

Property

ExpectedThemeColor

string? ExpectedThemeColor { get; set; } Source

Gets the expected manifest theme_color value.

Property

ExpectedBackgroundColor

string? ExpectedBackgroundColor { get; set; } Source

Gets the expected manifest background_color value.

Property

ExpectedIcons

string[] ExpectedIcons { get; set; } Source

Gets expected icon size tokens, optionally followed by a purpose after a colon.

Property

Json

bool Json { get; set; } Source

Gets a value indicating whether machine-readable JSON should be written.

Type

IPwaVerificationHttpClient

Source

Fetches verifier resources without automatically following redirects.

Remarks

Redirect custody stays with PwaVerifier so origin and path-base boundaries are checked before each hop.

Method

GetAsync

Task<PwaHttpResponse> GetAsync(Uri uri, int maxBodyBytes, CancellationToken cancellationToken) Source

Fetches one response and reads no more than the requested body limit.

Parameters

  • uriThe absolute resource URI.
  • maxBodyBytesThe maximum response-body bytes retained for evidence.
  • cancellationTokenCancels the network request and bounded body read.

Returns

The response metadata and bounded body.

Type

PwaVerificationHttpClient

Source

Adapts HttpClient to the verifier's bounded, redirect-aware fetch contract.

Parameters

  • httpClientA client configured with automatic redirect handling disabled.

Remarks

Enabling automatic redirects bypasses the verifier's same-origin and path-base checks.

Type

PwaHttpResponse

Source

Captures one bounded HTTP response before verifier-managed redirect handling.

Parameters

  • StatusCodeThe actual server status code.
  • ContentTypeThe response media type, or an empty string when absent.
  • BodyBytesThe retained response bytes, capped by the requested read limit.
  • RedirectLocationThe unmodified Location header value, when present.
  • BodyTruncatedWhether bytes beyond the configured read limit were discarded.
Property

IsSuccess

bool IsSuccess { get; } Source

Gets whether the actual response status is in the HTTP 2xx range.

Property

Body

string Body { get; } Source

Gets the retained body decoded as UTF-8 text.

Remarks

Binary consumers should use BodyBytes instead.

Type

PwaVerificationReport

Source

Represents schema-versioned PWA verification evidence written by the CLI.

Parameters

  • SchemaVersionThe JSON evidence schema version.
  • PassedWhether no error-severity diagnostics were recorded.
  • OriginThe verified scheme, host, and port without a path base.
  • BaseUrlThe verified application root, including its path base.
  • EntryPathThe app-root-relative entry path supplied to the verifier.
  • EntryUrlThe absolute entry URL resolved under BaseUrl.
  • ManifestPathThe app-origin-relative manifest path discovered or probed.
  • StartUrlThe manifest start_url value, when parsed.
  • ScopeThe manifest scope value, when parsed.
  • DisplayThe manifest display value, when parsed.
  • ThemeColorThe manifest theme_color value, when parsed.
  • BackgroundColorThe manifest background_color value, when parsed.
  • IconsBounded fetch and dimension evidence for manifest icons.
  • DiagnosticsStable diagnostics supporting the pass or failure result.

Remarks

Consumers should branch on SchemaVersion and diagnostic codes instead of parsing human-readable messages.

Type

PwaVerificationDiagnostic

Source

Represents one stable, structured PWA verification observation.

Parameters

  • CodeThe stable ASPWA2xx identifier.
  • SeverityThe lowercase error, warning, or info token.
  • MessageA human-readable explanation.
  • SubjectThe bounded manifest field or verifier surface involved.
  • ExpectedThe expected bounded value, when applicable.
  • ActualThe observed redacted value, when applicable.
  • FixA concise remediation, when known.
  • DocsUrlCanonical documentation for the diagnostic, when available.

Remarks

Do not place query strings, fragments, response bodies, or other secrets in structured evidence.

Type

PwaVerificationTarget

Source

Normalizes the trusted origin, application path base, and real entry route used by one verification run.

Parameters

  • OriginThe scheme, host, and port boundary.
  • BaseUriThe application root including its normalized path base.
  • BasePathThe normalized path base ending in a slash.
  • EntryPathThe validated app-root-relative entry path.
  • EntryUriThe entry path resolved beneath BaseUri.

Remarks

Query strings and fragments belong in neither the base URL nor entry path because verifier evidence intentionally excludes them.

Method

Create

PwaVerificationTarget Create(Uri url, string entryPath = "/") Source

Creates a normalized verification target after enforcing the URL and entry-path boundaries.

Parameters

  • urlAn absolute HTTP or HTTPS application root without a query or fragment.
  • entryPathAn app-root-relative path without traversal, query, fragment, or absolute URL syntax.

Returns

The normalized target used for all verifier requests.

Exceptions

  • ArgumentExceptionThe URL or entry path violates a verifier boundary.
Type

PwaVerificationOptions

Source

Carries normalized CLI assertions into a PWA verification run.

Parameters

  • BaseUrlThe absolute app root to verify.
  • EntryPathThe app-root-relative HTML entry route.
  • ExpectedStartUrlAn optional exact manifest start_url assertion.
  • ExpectedScopeAn optional exact manifest scope assertion.
  • ExpectedDisplayAn optional exact manifest display assertion.
  • ExpectedThemeColorAn optional exact manifest theme_color assertion.
  • ExpectedBackgroundColorAn optional exact manifest background_color assertion.
  • ExpectedIconsParsed icon size and purpose assertions.

Remarks

Target safety is enforced by PwaVerificationTarget.Create(Uri, string) before network access.

Method

Create

PwaVerificationOptions Create(Uri baseUrl, string entryPath = "/", string? expectedStartUrl = null, string? expectedScope = null, string? expectedDisplay = null, string? expectedThemeColor = null, string? expectedBackgroundColor = null, IReadOnlyList<string>? expectedIcons = null) Source

Creates verification options and parses repeated icon assertions.

Parameters

  • baseUrlThe absolute app root to verify.
  • entryPathThe app-root-relative entry route; blank values normalize to root.
  • expectedStartUrlAn optional exact start_url assertion.
  • expectedScopeAn optional exact scope assertion.
  • expectedDisplayAn optional exact display assertion.
  • expectedThemeColorAn optional exact theme_color assertion.
  • expectedBackgroundColorAn optional exact background_color assertion.
  • expectedIconsRepeated WIDTHxHEIGHT or WIDTHxHEIGHT:purpose assertions.

Returns

Normalized options for PwaVerifier.

Exceptions

  • ArgumentExceptionAn icon assertion is malformed.
Type

PwaExpectedIcon

Source

Represents one explicit manifest icon size and optional purpose assertion.

Parameters

  • SizeA positive WIDTHxHEIGHT token.
  • PurposeAn optional manifest purpose token such as maskable.
Method

Parse

PwaExpectedIcon Parse(string value) Source

Parses a command-line icon assertion.

Parameters

  • valueWIDTHxHEIGHT or WIDTHxHEIGHT:purpose.

Returns

The parsed assertion.

Exceptions

  • ArgumentExceptionThe size or purpose token is malformed.
Method

ToString

string ToString() Source

Formats the assertion using its command-line token shape.

Returns

WIDTHxHEIGHT or WIDTHxHEIGHT:purpose.

Type

PwaFetchedResponse

Source

Captures the final verifier-managed fetch state after zero or more accepted redirects.

Parameters

  • FinalUriThe URI that produced Response.
  • ResponseThe actual final response without fabricated sentinel status codes.
  • RedirectLimitExceededWhether this response was an unfollowed redirect beyond the hop limit.

Remarks

Callers must not reinterpret Response as a terminal HTTP failure when RedirectLimitExceeded is true; ASPWA264 is the authoritative failure.

Property

StatusCode

HttpStatusCode StatusCode { get; } Source

Gets the actual final response status code.

Property

ContentType

string ContentType { get; } Source

Gets the actual final response media type.

Property

Body

string Body { get; } Source

Gets the retained final response body decoded as UTF-8.

Property

BodyBytes

byte[] BodyBytes { get; } Source

Gets the retained final response bytes.

Property

IsSuccess

bool IsSuccess { get; } Source

Gets whether the actual final response is in the HTTP 2xx range.

Type

PwaImageDimensions

Source

Represents dimensions decoded directly from a bounded PNG response.

Parameters

  • WidthThe positive pixel width.
  • HeightThe positive pixel height.
Type

PwaIconEvidence

Source

Represents privacy-safe fetch and optional PNG dimension evidence for one manifest icon.

Parameters

  • SourceThe manifest src value.
  • SizesThe manifest sizes token list.
  • TypeThe declared media type.
  • PurposeThe declared purpose token list.
  • PathThe fetched app-origin-relative path without query or fragment.
  • ContentTypeThe observed response media type.
  • WidthThe decoded PNG width, when available.
  • HeightThe decoded PNG height, when available.
  • FetchedWhether the icon returned an HTTP 2xx response.
Type

PwaManifestProbe

Source

Models the manifest fields required for install-readiness verification.

Parameters

  • NameThe manifest name.
  • ShortNameThe manifest short_name.
  • StartUrlThe manifest start_url.
  • ScopeThe manifest scope.
  • DisplayThe manifest display mode.
  • ThemeColorThe manifest theme_color.
  • BackgroundColorThe manifest background_color.
  • IconsThe manifest icon declarations.
Type

PwaIconProbe

Source

Models one manifest icon declaration without trusting it as fetched evidence.

Parameters

  • SourceThe manifest src value.
  • SizesThe space-delimited manifest sizes tokens.
  • TypeThe declared media type.
  • PurposeThe space-delimited manifest purpose tokens.
Type

PwaStatusProbe

Source

Models the server-known AppSurface PWA diagnostics used for install, worker, offline, and push posture checks.

Parameters

  • EnabledWhether AppSurface PWA metadata is enabled.
  • OfflineEnabledWhether the offline strategy is enabled.
  • ServiceWorkerPathThe active service-worker path when offline is enabled.
  • OfflineFallbackPathThe active offline fallback path when offline is enabled.
  • ConfiguredServiceWorkerPathThe configured worker path used to prove absence when offline is disabled.
  • WorkerEnabledWhether either offline or push configuration activates the shared service worker.
  • WorkerPathThe active shared service-worker path when a worker capability is enabled.
  • PushEnabledWhether push event handling is enabled in the shared service worker.
  • WorkerScopeThe effective registration scope for the shared service worker.
  • RegistrationHelperPathThe registration-helper path exposed when push is enabled.

Remarks

These server-known values do not prove browser runtime capability or registration state.

Type

CoverageRunCommand

Source

Runs .NET test projects with Coverlet and produces merged private coverage artifacts.

Remarks

The command is a public package-consumer orchestrator for repositories that already own their test instrumentation. It discovers or accepts test projects, runs dotnet test with Coverlet MSBuild properties, preserves logs and per-project Cobertura files, merges coverage via AppSurface's package-owned ReportGenerator dependency, and writes artifacts that appsurface coverage gate can evaluate without additional path translation.

Method

ExecuteAsync

ValueTask ExecuteAsync(IConsole console, CancellationToken cancellationToken) Source

Executes the coverage run with an explicit cancellation token.

Parameters

  • consoleConsole used for user-visible output.
  • cancellationTokenCancellation token for process and artifact IO.

Returns

A task that completes when the run finishes.

Property

SolutionPath

string? SolutionPath { get; set; } Source

Gets or sets the solution used for discovery. Supports .sln and .slnx.

Property

TestProjects

string[] TestProjects { get; set; } Source

Gets or sets explicit test project paths. Repeat this option to skip solution discovery.

Property

OutputDirectory

string OutputDirectory { get; set; } Source

Gets or sets the coverage output directory.

Property

Configuration

string Configuration { get; set; } Source

Gets or sets the build and test configuration.

Property

Parallelism

int Parallelism { get; set; } Source

Gets or sets the maximum number of non-exclusive projects that may run at once.

Property

Schedule

string Schedule { get; set; } Source

Gets or sets the project scheduling mode.

Property

ScheduleTimings

string? ScheduleTimings { get; set; } Source

Gets or sets an explicit timings file used by --schedule longest-first.

Property

PriorityTestProjects

string[] PriorityTestProjects { get; set; } Source

Gets or sets non-exclusive projects that should be scheduled before duration-sorted projects.

Property

NoRestore

bool NoRestore { get; set; } Source

Gets or sets a value indicating whether build and test commands should pass --no-restore.

Property

Build

bool Build { get; set; } Source

Gets or sets a value indicating whether to build once before running tests.

Property

NoBuild

bool NoBuild { get; set; } Source

Gets or sets a value indicating whether to skip the solution build before tests.

Property

IncludeFilter

string? IncludeFilter { get; set; } Source

Gets or sets the optional Coverlet include filter.

Property

ExcludeFilter

string? ExcludeFilter { get; set; } Source

Gets or sets the Coverlet exclude filter.

Property

DryRun

bool DryRun { get; set; } Source

Gets or sets a value indicating whether discovery and scheduling should be printed without running tests.

Property

ListProjects

bool ListProjects { get; set; } Source

Gets or sets a value indicating whether projects should be listed without running tests.

Property

NoDiscoverExclusive

bool NoDiscoverExclusive { get; set; } Source

Gets or sets a value indicating whether automatic integration/Playwright exclusive classification is disabled.

Property

ExclusiveTestProjects

string[] ExclusiveTestProjects { get; set; } Source

Gets or sets projects that should run exclusively. Repeat this option for multiple projects.

Property

Loggers

string[] Loggers { get; set; } Source

Gets or sets test logger arguments forwarded to dotnet test. Repeat this option for multiple loggers.

Property

TestArguments

string[] TestArguments { get; set; } Source

Gets or sets extra arguments appended to every dotnet test invocation.

Property

TestResults

string? TestResults { get; set; } Source

Gets or sets the managed test result artifact format.

Property

SlowTestDiagnostics

bool SlowTestDiagnostics { get; set; } Source

Gets or sets a value indicating whether slow-test diagnostic artifacts should be written.

Property

NoClean

bool NoClean { get; set; } Source

Gets or sets a value indicating whether existing owned output should not be cleaned before the run.

Property

Verbosity

string Verbosity { get; set; } Source

Gets or sets the dotnet test verbosity.

Type

CoverageRunRequest

Source

Request for running and merging coverage from one or more .NET test projects.

Parameters

  • SolutionPathOptional .sln or .slnx path used for discovery.
  • TestProjectsExplicit test project paths. Supplying at least one path skips solution discovery.
  • OutputDirectoryCoverage artifact directory. Existing content must be AppSurface-owned unless cleaning is disabled.
  • ConfigurationBuild and test configuration forwarded to dotnet build and dotnet test.
  • ParallelismMaximum concurrent non-exclusive test projects.
  • ScheduleModeProject scheduling mode used before process execution.
  • ScheduleTimingsPathOptional explicit timings file for duration-aware scheduling.
  • PriorityTestProjectsNon-exclusive project path or file-name matches scheduled ahead of duration-sorted projects.
  • NoRestoreWhether build and test commands should pass --no-restore.
  • BuildWhether to build once before tests, including explicit-project runs.
  • NoBuildWhether to skip AppSurface's build phase and forward --no-build to dotnet test.
  • IncludeFilterOptional Coverlet include filter.
  • ExcludeFilterCoverlet exclude filter. Commas are escaped before forwarding to MSBuild.
  • DryRunWhether to print discovery and artifact paths without running tests or cleaning output.
  • NoDiscoverExclusiveWhether automatic integration/Playwright exclusive classification is disabled.
  • ExclusiveTestProjectsExplicit project path or file-name matches that should run exclusively.
  • LoggersLogger values forwarded to dotnet test as repeatable --logger: arguments.
  • TestArgumentsExtra tokens appended to each dotnet test invocation.
  • TestResultsManaged test result artifact format.
  • SlowTestDiagnosticsWhether slow-test diagnostic artifacts should be written.
  • CleanWhether AppSurface-owned output is cleaned before writing new artifacts.
  • VerbosityVerbosity forwarded to dotnet test.

Remarks

The request is the internal contract behind the public coverage run command. Paths are interpreted relative to the current working directory for explicit-project runs, or relative to the solution directory after solution discovery. The workflow never mutates consumer projects: Coverlet must already be referenced by each selected test project, logger arguments are forwarded verbatim, and extra test arguments are appended after AppSurface's required coverage properties.

Type

CoverageRunResult

Source

Result of a public coverage run.

Parameters

  • SuccessWhether all required test, merge, and artifact steps succeeded.
  • OutputDirectoryAbsolute output directory.
  • CoveragePathAbsolute merged Cobertura path.
  • FailureLogPathPrimary failing project log path, when a project failed.

Remarks

A result is returned only after discovery, test execution, merge, summary, and timings steps have finished. Diagnostic failures throw CommandException before this result is created. When tests fail after writing coverage, Success is false while merged artifacts are still available for inspection.

Type

CoverageRunWorkflow

Source

Coordinates public coverage run discovery, scheduling, test execution, merge, and artifacts.

Method

RunAsync

Task<CoverageRunResult> RunAsync(CoverageRunRequest request, IConsole console, CancellationToken cancellationToken) Source

Runs the coverage workflow.

Parameters

  • requestCoverage run request.
  • consoleConsole used for user-visible output.
  • cancellationTokenCancellation token for process and artifact IO.

Returns

Coverage run result.

Type

CoverageRunSchedulePlan

Source

Planned project execution order for a coverage run.

Parameters

  • ModePublic scheduling mode name written to console output and timings.
  • TimingSourceSource used to load prior project durations.
  • WarningsNon-fatal scheduling warnings.
  • EntriesExecution entries in original-index-compatible project space.
Type

CoverageRunScheduleTimingSource

Source

Prior-duration source used to build a schedule.

Parameters

  • KindSource kind: none, inferred, or explicit.
  • PathTimings file path when one was considered.
  • StatusRead status for the source.
Type

CoverageRunScheduleEntry

Source

One project's execution slot in the schedule.

Parameters

  • OriginalIndexProject index from discovery or explicit input order.
  • ExecutionIndexIndex used to launch the process.
  • ProjectProject scheduled for this slot.
  • ScheduledSecondsPrior duration used for sorting, when available.
  • DurationSourceWhere ScheduledSeconds came from.
  • ScheduleReasonHuman-readable reason for the chosen slot.
Type

CoverageRunPriorTimingLoad

Source

Prior timing data loaded before output cleanup.

Parameters

  • KindSource kind: inferred or explicit.
  • PathSource file path.
  • StatusLoad status.
  • DurationSourcePer-project duration source value.
  • TimingsByProjectProject durations keyed by normalized relative project path.
  • WarningsNon-fatal load warnings.
Type

CoverageRunIndexedProject

Source

Project paired with its discovery/input index.

Parameters

  • OriginalIndexProject index from discovery or explicit input order.
  • ProjectProject metadata.
Type

CoverageProjectResolution

Source

Resolved project set used by the coverage runner after discovery or explicit selection.

Parameters

  • SolutionPathAbsolute solution path when discovery was solution-based; otherwise null.
  • SolutionDirectoryDirectory used as the working directory for build, test, and discovery commands.
  • ProjectsSelected test projects in scheduled order.
  • SkippedProjectsProjects discovered from the solution but excluded from coverage execution.
Type

CoverageRunProject

Source

Selected test project and scheduling metadata.

Parameters

  • RelativePathProject path as displayed to users and recorded in timings.
  • FullPathAbsolute project path passed to dotnet test.
  • SlugStable artifact directory segment allocated from the project path.
  • IsExclusiveWhether the project must run outside parallel batches.
Type

CoverageSkippedProject

Source

Project that solution discovery intentionally did not include.

Parameters

  • ProjectPathPath reported by dotnet sln list.
  • ReasonHuman-readable reason the project was skipped.
Type

CoverageProjectRunResult

Source

Per-project test execution result.

Parameters

  • IndexOriginal discovery or explicit input index.
  • ExecutionIndexProject process launch index.
  • ProjectProject metadata.
  • ScheduledSecondsPrior duration used for scheduling, when available.
  • DurationSourceSource used for ScheduledSeconds.
  • ScheduleReasonReason the project received its execution slot.
  • SecondsElapsed whole seconds for the project test command.
  • ExitCodeTest process exit code.
  • LogFilePer-project log file path.
  • TestResultsManaged test result artifacts requested for this project.
Type

CoverageRunTestResultArtifact

Source

Managed test result artifact requested by coverage run.

Parameters

  • FormatArtifact format.
  • ProjectProject that owns the artifact.
  • PathAbsolute artifact path.
  • ParserStatusBest-effort parser status recorded in timings.
Type

CoverageRunBuildResult

Source

Build phase result used to coordinate later dotnet test arguments.

Parameters

  • SecondsElapsed whole seconds spent in the AppSurface build phase.
  • TestsShouldSkipBuildWhether test commands should pass --no-build.
Type

CoverageLogPrefix

Source

Bounded prefix of a project log replayed to the console.

Parameters

  • TextLog text prefix.
  • TruncatedWhether additional log content remains on disk.
Type

ICoverageRunProcessRunner

Source

Runs external processes for the coverage run workflow.

Remarks

Implementations must preserve command output for diagnostics and honor cancellation promptly. When outputFile is supplied, implementations should stream output to that file during process execution and may return an empty CoverageRunProcessResult.Output.

Method

RunAsync

Task<CoverageRunProcessResult> RunAsync(string fileName, IReadOnlyList<string> arguments, string workingDirectory, CancellationToken cancellationToken, string? outputFile = null) Source

Runs a process and returns its exit code plus captured output.

Parameters

  • fileNameExecutable name or path.
  • argumentsArgument tokens passed without shell interpolation.
  • workingDirectoryWorking directory for the child process.
  • cancellationTokenCancellation token that should terminate the process tree.
  • outputFileOptional log file that receives captured standard output and error.

Returns

Process exit code and captured output.

Type

CoverageRunProcessResult

Source

Result of running a coverage workflow process.

Parameters

  • ExitCodeChild process exit code.
  • OutputCaptured standard output followed by captured standard error.
Type

CliWrapCoverageRunProcessRunner

Source

Default process runner used by the public coverage command.

Remarks

The runner delegates tokenized argument escaping and cancellation to CliWrap. It buffers short-lived discovery/build commands, streams per-project test logs to disk, and disables non-zero exit-code validation so coverage workflow failures remain ordinary command results.

Type

ICoverageRunReportGenerator

Source

Runs AppSurface's package-owned ReportGenerator dependency.

Remarks

The merge contract accepts one or more per-project Cobertura files and writes ReportGenerator output into a caller-owned directory. Implementations must not read consumer tool manifests or require repositories to install ReportGenerator themselves.

Method

MergeAsync

Task<CoverageRunMergeResult> MergeAsync(IReadOnlyList<string> coverageFiles, string outputDirectory, CancellationToken cancellationToken) Source

Merges Cobertura coverage files into one ReportGenerator output directory.

Parameters

  • coverageFilesCobertura files emitted by instrumented test projects.
  • outputDirectoryReportGenerator output directory for this run.
  • cancellationTokenCancellation token for the merge process.

Returns

Merge exit code plus expected Cobertura and text-summary paths.

Type

CoverageRunMergeResult

Source

Result of a ReportGenerator merge.

Parameters

  • ExitCodeReportGenerator process exit code.
  • CoberturaPathExpected merged Cobertura file path.
  • SummaryPathExpected ReportGenerator text summary path.
Type

CoverageRunReportGenerator

Source

ReportGenerator-backed merge implementation for coverage run.

Type

IReportGeneratorPackageLocator

Source

Locates the ReportGenerator package restored as a dependency of the AppSurface CLI package.

Remarks

Packaged local tools carry ReportGenerator under the CLI base directory. Source and development runs may instead rely on NuGet's package cache, so the locator probes the pinned dependency first and then other installed ReportGenerator package versions as a compatibility fallback.

Method

ResolveReportGeneratorDll

string ResolveReportGeneratorDll() Source

Resolves the ReportGenerator DLL entrypoint.

Enum

CoverageRunScheduleMode

Source

Scheduling modes supported by coverage run.

Enum

CoverageRunTestResultFormat

Source

Managed test result artifact format for coverage run.

Type

CoverageMergeCommand

Source

Merges existing Cobertura shards into AppSurface coverage artifacts.

Remarks

Use this command when another workflow already produced Cobertura files, such as a GitHub Actions matrix job that downloads shard artifacts into one fan-in directory. Repositories that want AppSurface to discover test projects and run Coverlet should use coverage run instead.

Method

ExecuteAsync

ValueTask ExecuteAsync(IConsole console, CancellationToken cancellationToken) Source

Executes the coverage merge with an explicit cancellation token.

Parameters

  • consoleConsole used for user-visible output.
  • cancellationTokenCancellation token for package and artifact IO.

Returns

A task that completes when the merge finishes.

Property

SourceDirectory

string? SourceDirectory { get; set; } Source

Gets or sets the directory that contains Cobertura shard files named coverage.cobertura.xml.

Property

OutputDirectory

string OutputDirectory { get; set; } Source

Gets or sets the merged coverage output directory.

Type

CoverageMergeRequest

Source

Request for merging existing Cobertura coverage shards.

Parameters

  • SourceDirectoryDirectory recursively searched for shard files named coverage.cobertura.xml.
  • OutputDirectoryDirectory that receives merged AppSurface coverage artifacts.
  • CleanWhether existing AppSurface-owned merge artifacts should be cleaned first.
Type

CoverageMergeResult

Source

Result of a public coverage merge.

Parameters

  • OutputDirectoryAbsolute output directory.
  • CoveragePathAbsolute merged Cobertura path.
  • SelectedReportsAbsolute selected input report paths.
Type

CoverageMergeWorkflow

Source

Coordinates public coverage merge source discovery, package-owned ReportGenerator execution, and artifacts.

Method

MergeAsync

Task<CoverageMergeResult> MergeAsync(CoverageMergeRequest request, IConsole console, CancellationToken cancellationToken) Source

Merges existing Cobertura shard files into AppSurface coverage artifacts.

Parameters

  • requestCoverage merge request.
  • consoleConsole used for user-visible output.
  • cancellationTokenCancellation token for package and artifact IO.

Returns

Coverage merge result.

Type

CoverageMergeSourceResolver

Source
Method

Resolve

IReadOnlyList<string> Resolve(string sourceDirectory, string outputDirectory) Source

Discovers and validates Cobertura shard inputs for coverage merge.

Parameters

  • sourceDirectoryExisting readable directory searched recursively for files named exactly coverage.cobertura.xml.
  • outputDirectoryMerge output directory whose resolved tree is excluded from discovery so reruns do not re-merge prior output.

Returns

Absolute selected Cobertura report paths sorted by ordinal path.

Remarks

Resolve expects the workflow to pass a non-empty existing sourceDirectory and a normalized outputDirectory. It rejects empty discovery results with ASCOV131, unreadable source traversal with ASCOV130, and malformed or unreadable selected Cobertura files with ASCOV132. The resolver ignores reports under the resolved output directory and any reportgenerator-input staging directory because those files are AppSurface-owned implementation details, not user-supplied shards. Existing symlinked path segments are compared through CoverageMergePathSafety.ResolvePhysicalPath(string); callers still need normal filesystem permissions, and concurrent writes can surface as IO diagnostics.

Type

CoverageMergeOutputGuard

Source
Method

Prepare

void Prepare(string outputDirectory, string sourceDirectory, bool clean) Source

Validates, creates, marks, and optionally cleans the coverage merge output directory.

Parameters

  • outputDirectoryDedicated output directory for merged coverage artifacts.
  • sourceDirectoryDirectory containing user-supplied Cobertura shards.
  • cleanWhether known AppSurface-owned merge artifacts should be removed before writing new output.

Remarks

Prepare rejects blank output paths, filesystem roots, the current working directory, the user home directory, files, source/output overlap in either direction, and populated directories that do not contain the .appsurface-coverage-output ownership marker. Missing or empty output directories are allowed. Marked directories are treated as AppSurface-owned; when clean is true, only known merge artifacts and staging directories are deleted, while unrelated directories such as legacy project coverage output are preserved. The method creates outputDirectory and writes the marker file as side effects, so callers need create/write/delete permissions and should avoid concurrent writers. Source/output overlap checks resolve existing symlink segments through CoverageMergePathSafety.ResolvePhysicalPath(string) to catch path aliases.

Type

CoverageMergePathSafety

Source
Method

ResolvePhysicalPath

string ResolvePhysicalPath(string path) Source

Resolves existing filesystem segments in a path to their physical targets for overlap checks.

Parameters

  • pathPath to normalize and resolve.

Returns

A full path where existing files, directories, and symlink targets have been resolved where possible; missing trailing segments are preserved as full paths.

Remarks

ResolvePhysicalPath(string) is used by merge source/output exclusion and output-guard overlap checks so aliases such as symlinked output directories are compared by physical location instead of lexical spelling. It does not create files or directories. Callers must pass a non-null path; invalid path shapes or inaccessible segments can raise platform filesystem exceptions before higher-level callers translate them to ASCOV138 or related diagnostics. Symlinks are resolved with FileSystemInfo.ResolveLinkTarget(bool) using returnFinalTarget: true; if no target is available, or if recursive target resolution reaches sixteen hops, the current full path is returned to avoid unbounded loops.

Type

CoverageMergeStaging

Source

Validates that coverage merge staging preserved the selected shard set before ReportGenerator sees the glob.

Method

EnsurePreservedSelectedShardCount

void EnsurePreservedSelectedShardCount(int selectedReportCount, int stagedReportCount) Source

Ensures that the staged ReportGenerator input tree contains one Cobertura file for each selected source shard.

Parameters

  • selectedReportCountNumber of source shards selected by discovery.
  • stagedReportCountNumber of staged Cobertura files visible to the ReportGenerator glob.
Type

CoverageGateCommand

Source

Evaluates a Cobertura coverage file against line and branch thresholds.

Remarks

This is the stable v1 coverage command. It reads a local Cobertura artifact, writes private JSON and Markdown reports, optionally appends the Markdown report to GitHub's step summary, and exits non-zero when the configured quality gate fails.

Method

ExecuteAsync

2 overloads
ValueTask ExecuteAsync(IConsole console) Source

Executes the coverage gate.

Parameters

  • consoleCliFx console used for command output.

Returns

A task that completes after report files are written.

ValueTask ExecuteAsync(IConsole console, CancellationToken cancellationToken) Source

Executes the coverage gate with an explicit cancellation token.

Parameters

  • consoleCliFx console used for command output.
  • cancellationTokenCancellation token for evaluator and report IO.

Returns

A task that completes after report files are written and gate outcome is emitted.

Property

CoveragePath

string CoveragePath { get; set; } Source

Gets or sets the Cobertura XML file to evaluate.

Property

MinLine

decimal MinLine { get; set; } Source

Gets or sets the minimum line coverage percentage from 0 to 100.

Property

MinBranch

decimal MinBranch { get; set; } Source

Gets or sets the minimum branch coverage percentage from 0 to 100.

Property

DiffBase

string? DiffBase { get; set; } Source

Gets or sets the git ref or commit used to compute changed-line coverage.

Property

DiffFile

string? DiffFile { get; set; } Source

Gets or sets a unified diff file used to compute changed-line coverage.

Property

DiffStdin

bool DiffStdin { get; set; } Source

Gets or sets a value indicating whether unified diff text should be read from stdin.

Property

DiffLabel

string? DiffLabel { get; set; } Source

Gets or sets an optional display label for the selected patch diff source.

Property

RepositoryRoot

string? RepositoryRoot { get; set; } Source

Gets or sets the repository root used for Cobertura and diff path matching.

Property

MinPatchLine

decimal? MinPatchLine { get; set; } Source

Gets or sets the minimum changed-line coverage percentage from 0 to 100.

Property

MinPatchBranch

decimal? MinPatchBranch { get; set; } Source

Gets or sets the minimum changed-branch coverage percentage from 0 to 100.

Property

OutputDirectory

string? OutputDirectory { get; set; } Source

Gets or sets the directory where coverage-gate.json and coverage-gate.md are written.

Property

GithubSummary

bool GithubSummary { get; set; } Source

Gets or sets a value indicating whether the Markdown report should be appended to $GITHUB_STEP_SUMMARY.

Property

NoGithubSummary

bool NoGithubSummary { get; set; } Source

Gets or sets a value indicating whether GitHub summary output should be suppressed.

Type

CoverageGateRequest

Source

Request for evaluating a Cobertura coverage quality gate.

Parameters

  • CoveragePathAbsolute path to the Cobertura XML file.
  • OutputDirectoryAbsolute directory where private report artifacts should be written.
  • MinLinePercentMinimum accepted line coverage percentage.
  • MinBranchPercentMinimum accepted branch coverage percentage.
  • WriteGithubSummaryWhether to append Markdown output to GithubStepSummaryPath.
  • GithubStepSummaryPathOptional GitHub step summary file path.
  • PatchCoverageOptional changed-line coverage request.
Type

CoveragePatchRequest

Source

Request for estimating coverage on lines changed by a patch diff source.

Parameters

  • RepositoryRootRepository root used for diff acquisition and path normalization.
  • DiffSourcePatch diff source used to acquire unified diff text.
  • MinPatchLinePercentOptional changed-line threshold.
  • MinPatchBranchPercentOptional changed-branch threshold.
Type

CoverageGateResult

Source

Result of evaluating coverage against line and branch thresholds.

Parameters

  • CoveragePathCobertura file that was evaluated.
  • LineCoverageLine coverage metric.
  • BranchCoverageBranch coverage metric.
  • MinLinePercentMinimum accepted line coverage percentage.
  • MinBranchPercentMinimum accepted branch coverage percentage.
  • PassedWhether both metrics met their thresholds.
  • JsonReportPathJSON report path.
  • MarkdownReportPathMarkdown report path.
  • MinPatchLinePercentOptional minimum accepted changed-line coverage percentage.
  • PatchLineCoverageOptional changed-line coverage metric.
  • MinPatchBranchPercentOptional minimum accepted changed-branch coverage percentage.
  • PatchBranchCoverageOptional changed-branch coverage metric.
  • PatchDiffSourceOptional patch diff source provenance.
Type

CoverageMetric

Source

One Cobertura coverage metric expressed as optional covered/valid counts and a percentage.

Parameters

  • CoveredCovered line or branch count, when Cobertura provides it.
  • ValidValid line or branch count, when Cobertura provides it.
  • PercentCoverage percentage from 0 to 100.
Type

PatchLineCoverageMetric

Source

Coverage estimate for changed lines from a git diff.

Parameters

  • DiffBaseGit ref or commit compared with HEAD.
  • ChangedLinesTotal added or modified lines in the diff.
  • MeasurableLinesChanged lines present in the Cobertura line map.
  • CoveredLinesMeasurable changed lines with at least one hit.
  • PercentChanged-line coverage percentage.
Type

PatchBranchCoverageMetric

Source

Coverage estimate for branch conditions on changed lines from a git diff.

Parameters

  • DiffBaseGit ref or commit compared with HEAD.
  • ChangedLinesTotal added or modified lines in the diff.
  • MeasurableBranchesChanged-line branch conditions present in the Cobertura line map.
  • CoveredBranchesMeasurable changed-line branch conditions that were covered.
  • PercentChanged-branch coverage percentage.
Type

PatchCoverageMetrics

Source

Coverage estimates for changed lines and changed-line branch conditions.

Parameters

  • SourceReportPatch diff source provenance captured during evaluation.
  • LineCoverageChanged-line coverage metric.
  • BranchCoverageChanged-branch coverage metric.
Type

CoverageGateEvaluator

Source

Parses Cobertura XML and evaluates coverage thresholds.

Remarks

XML parsing disables DTD processing and external resolution because coverage files are CI artifacts, not trusted configuration. The evaluator accepts either Cobertura rate attributes or covered/valid counts and validates that the resulting metrics are finite percentages.

Method

EvaluateAsync

Task<CoverageGateResult> EvaluateAsync(CoverageGateRequest request, CancellationToken cancellationToken) Source

Evaluates a Cobertura file against the requested line and branch thresholds.

Parameters

  • requestCoverage gate request.
  • cancellationTokenCancellation token for file IO.

Returns

The gate result.

Exceptions

  • CommandExceptionThrown when inputs are missing, unsafe, or unsupported.
Method

IsPercentInRange

bool IsPercentInRange(decimal value) Source

Gets whether a threshold percentage is in the valid inclusive range.

Parameters

  • valueCandidate percentage.

Returns

true when value is from 0 through 100.

Type

PatchCoverageEvaluator

Source

Estimates coverage for lines and branch conditions added or modified by a git diff.

Method

EvaluateAsync

2 overloads
Task<PatchCoverageMetrics> EvaluateAsync(string coveragePath, CoveragePatchRequest request, CancellationToken cancellationToken) Source

Evaluates changed-line and changed-branch coverage by reading git diff and the Cobertura line map.

Parameters

  • coveragePathCobertura XML file.
  • requestChanged-line coverage request.
  • cancellationTokenCancellation token.

Returns

Changed-line and changed-branch coverage metrics.

Task<PatchCoverageMetrics> EvaluateAsync(string coveragePath, CoveragePatchRequest request, string diffText, CancellationToken cancellationToken) Source

Evaluates changed-line and changed-branch coverage from supplied git diff text.

Parameters

  • coveragePathCobertura XML file.
  • requestChanged-line coverage request.
  • diffTextUnified git diff text.
  • cancellationTokenCancellation token.

Returns

Changed-line and changed-branch coverage metrics.

Type

GitDiffReader

Source

Reads changed lines from git.

Method

ReadDiffAsync

Task<string> ReadDiffAsync(string repositoryRoot, string diffBase, CancellationToken cancellationToken) Source

Reads a zero-context diff between diffBase and HEAD.

Parameters

  • repositoryRootRepository root where git should run.
  • diffBaseGit ref or commit compared with HEAD.
  • cancellationTokenCancellation token.

Returns

Unified diff text.

Type

CoverageGateReportWriter

Source

Writes private coverage gate report artifacts.

Method

WriteAsync

Task WriteAsync(CoverageGateResult result, CoverageGateRequest request, CancellationToken cancellationToken) Source

Writes JSON, Markdown, and optional GitHub summary output for a coverage gate result.

Parameters

  • resultGate result to render.
  • requestOriginal gate request.
  • cancellationTokenCancellation token for file IO.

Returns

A task that completes when output files are written.

Method

RenderMarkdown

string RenderMarkdown(CoverageGateResult result) Source

Renders the Markdown gate report.

Parameters

  • resultCoverage gate result.

Returns

Markdown report content.

Type

CoverageOutputPathPolicy

Source

Validates coverage report output paths before report writers create or replace files.

Remarks

The coverage gate writes only two report files, but it still refuses unsafe destinations so future run/merge cleanup behavior can share the same conservative policy.

Method

ValidateReportOutput

void ValidateReportOutput(string coveragePath, string outputDirectory) Source

Validates that the report output directory is distinct from the coverage file and safe to create.

Parameters

  • coveragePathCoverage file path being read.
  • outputDirectoryReport output directory to validate.

Exceptions

  • CommandExceptionThrown when the output path is dangerous or overlaps the input file.
Type

ProgramEntryPoint

Source

Internal CLI entry point that adds a scoped test seam around AppSurfaceCliApp.

Remarks

Production code uses RunAsync directly. Tests can use PushConfigureOptionsOverrideForTests to add temporary console or DI overrides without changing the top-level statement in Program.cs.

Method

RunAsync

Task RunAsync(string[] args, Action<ConsoleOptions>? configureOptions = null) Source

Runs the AppSurface CLI with the specified arguments and optional console configuration.

Parameters

  • argsCommand-line arguments to parse and execute.
  • configureOptionsOptional primary console-options callback for the current invocation.

Returns

A task that represents the CLI execution.

Method

PushConfigureOptionsOverrideForTests

IDisposable PushConfigureOptionsOverrideForTests(Action<ConsoleOptions> configureOptions) Source

Pushes a test-only console-options override for the current async context.

Parameters

  • configureOptionsOverride callback to apply after any direct invocation callback.

Returns

A disposable scope that restores the previous override when disposed.

Remarks

Always dispose the returned scope, typically with using var. Overrides compose with RunAsync callbacks in direct-then-override order so tests can replace services after production defaults are configured.

Type

RestoreOverrideScope

Source

Restores the previously active test override when disposed.

Parameters

  • previousOverride that was active before the current scope was pushed.
Type

SecretsCommand

Source

Provides the discoverable root for AppSurface local secret commands.

Method

ExecuteAsync

ValueTask ExecuteAsync(IConsole console) Source

Prints the local secrets command family summary.

Parameters

  • consoleCliFx console used for command output.

Returns

A completed task.

Type

SecretsInitCommand

Source

Initializes or verifies a LocalSecrets namespace.

Type

SecretsSetCommand

Source

Writes a local secret value.

Property

Value

string? Value { get; set; } Source

Gets or sets the secret value.

Property

ReadFromStandardInput

bool ReadFromStandardInput { get; set; } Source

Gets or sets a value indicating whether to read the secret value from standard input.

Type

SecretsGetCommand

Source

Verifies a local secret exists without printing its value.

Type

SecretsListCommand

Source

Lists currently retrievable local secret names in a namespace.

Property

NamesOnly

bool NamesOnly { get; set; } Source

Gets or sets a value indicating whether to print only secret names.

Type

SecretsDeleteCommand

Source

Deletes one local secret.

Type

SecretsDoctorCommand

Source

Diagnoses LocalSecrets platform availability.

Type

SecretsCommandBase

Source

Shared options and helpers for local secret commands.

Method

ExecuteAsync

ValueTask ExecuteAsync(IConsole console) Source

Executes the command.

Parameters

  • consoleCliFx console used for command output.

Returns

A value task that completes when the command finishes.

Method

BuildContext

SecretsCommandContext BuildContext() Source

Builds a normalized command context.

Returns

The command context.

Method

CreatePlatformStore

IAppSurfaceLocalSecretStore CreatePlatformStore(AppSurfaceLocalSecretsOptions options) Source

Creates the OS-backed LocalSecrets store for commands that do not use the deterministic file store.

Parameters

  • optionsOptions derived from the CLI command line.

Returns

The platform-backed local secret store.

Method

WriteResultAsync

ValueTask WriteResultAsync(IConsole console, AppSurfaceLocalSecretResult result, string successVerb) Source

Writes a command result.

Parameters

  • consoleCliFx console used for command output.
  • resultThe local secret result.
  • successVerbThe success verb to display.

Returns

A value task that completes when output is written.

Remarks

LocalSecrets treats LocalSecretResultStatus.Missing as failure everywhere except doctor-style readiness probes that return a ready-class posture diagnostic. Keep that exception explicit when adding commands so ordinary missing secrets do not report success.

Property

ApplicationName

string ApplicationName { get; set; } Source

Gets or sets the AppSurface application identity.

Property

EnvironmentName

string EnvironmentName { get; set; } Source

Gets or sets the AppSurface environment identity.

Property

KeyPrefix

string? KeyPrefix { get; set; } Source

Gets or sets an optional LocalSecrets key prefix.

Property

StoreFile

string? StoreFile { get; set; } Source

Gets or sets an optional file-backed store path for deterministic examples and tests.

Property

SecretToolPath

string? SecretToolPath { get; set; } Source

Gets or sets an explicit Linux secret-tool executable path for nonstandard trusted installs.

Type

SecretsKeyCommandBase

Source

Shared options for commands that target one local secret key.

Method

Normalize

AppSurfaceLocalSecretIdentity Normalize(SecretsCommandContext context) Source

Normalizes the configured key into a local secret identity.

Parameters

  • contextThe command context.

Returns

The local secret identity.

Property

Key

string Key { get; set; } Source

Gets or sets the AppSurface config key.

Type

SecretsCommandContext

Source

Captures normalized command state.

Parameters

  • NormalizerIdentity normalizer.
  • StoreLocal secret store.
  • ApplicationNameNormalized application identity.
  • EnvironmentNormalized environment identity.
  • KeyPrefixNormalized optional key prefix.
Type

DocsCommand

Source

Previews AppSurface Docs for a local repository through the public appsurface docs command.

Remarks

This command starts the AppSurface Docs standalone host with CLI-friendly defaults and delegates option validation and argument construction to AppSurfaceDocsPreviewCommand.

Type

DocsPreviewCommand

Source

Previews AppSurface Docs for a local repository through the appsurface docs preview alias.

Remarks

Use this alias when a command hierarchy reads better in scripts. It has the same options and behavior as DocsCommand.

Type

DocsExportCommand

Source

Exports AppSurface Docs for a local repository through the appsurface docs export command.

Remarks

This command owns the AppSurface Docs source-host lifecycle and delegates static crawling, URL rewriting, CDN validation, and materialization to the RazorWire export engine.

Method

ExecuteAsync

2 overloads
ValueTask ExecuteAsync(IConsole console) Source

Executes the command through the CliFx console integration.

Parameters

  • consoleConsole abstraction used to register cancellation handling.

Returns

A value task that completes when export finishes or command validation fails.

ValueTask ExecuteAsync(CancellationToken cancellationToken) Source

Executes the command using an explicit cancellation token.

Parameters

  • cancellationTokenToken observed while starting the host and exporting static output.

Returns

A value task that completes when export finishes.

Method

BuildExportArgs

AppSurfaceDocsExportArgs BuildExportArgs() Source

Translates CLI options into an AppSurface Docs export invocation.

Returns

The export runner arguments.

Remarks

Export defaults to Production and binds a loopback ephemeral port internally. It does not expose preview's --urls or --port options because humans and CI should not manage export listener ports.

Method

BuildDefaultSeedRoutes

IReadOnlyList<string> BuildDefaultSeedRoutes() Source

Builds the default export seed routes from the resolved AppSurface Docs routing options.

Returns

The root route plus the live docs root, with duplicates removed.

Property

OutputPath

string OutputPath { get; set; } Source

Gets the directory where static docs files will be written.

Remarks

Defaults to dist/docs for local use. CI should pass an explicit output path so upload artifacts and export output stay tied together.

Property

Mode

ExportMode Mode { get; set; } Source

Gets the export mode used by the underlying RazorWire exporter.

Remarks

ExportMode.Cdn validates and rewrites output for static CDN hosting. ExportMode.Hybrid preserves application-style internal URLs for server-backed deployments.

Property

LiveOrigin

string? LiveOrigin { get; set; } Source

Gets the live origin used for RazorWire-managed live references in hybrid exports.

Remarks

This option is only needed for split-origin hybrid output. The value must be an absolute http or https origin with no path, query string, fragment, or userinfo. When configured, RazorWire-owned live surfaces such as streams, islands, and lazy anti-forgery form posts are rewritten to this origin while docs navigation and canonical routes remain on the static docs host. Leave it unset when the published docs and live app share an origin.

Property

HybridCredentials

RazorWireHybridCredentialsMode HybridCredentials { get; set; } Source

Gets credential behavior for RazorWire-managed live references.

Remarks

Defaults to RazorWireHybridCredentialsMode.Auto, which includes credentials when LiveOrigin is set and omits them otherwise. Choose RazorWireHybridCredentialsMode.Include for cookie-backed live docs interactions across origins. Choose RazorWireHybridCredentialsMode.Omit only for public live endpoints that do not need cookies or lazy anti-forgery token refresh.

Property

RedirectStrategy

ExportRedirectStrategy RedirectStrategy { get; set; } Source

Gets the redirect alias materialization strategy used by the underlying RazorWire exporter.

Remarks

ExportRedirectStrategy.Html is the default and works on GitHub Pages and generic static hosts by writing alias HTML fallback files. ExportRedirectStrategy.Netlify writes a root _redirects file for Netlify-compatible CDN hosting and is valid only with ExportMode.Cdn.

Property

SeedRoutesPath

string? SeedRoutesPath { get; set; } Source

Gets an optional path to a seed-route file.

Remarks

This option is long-only because -r is reserved for --repo across AppSurface docs commands. When omitted, export derives default seeds from the configured docs routing surface.

Type

DocsVerifyArchiveCommand

Source

Verifies one catalog-pinned AppSurface Docs release archive without starting a web host.

Remarks

This command exercises the same catalog and archive verification path used at runtime so operators can diagnose manifest, digest, and file drift locally before deploying a version catalog change.

Method

ExecuteAsync

ValueTask ExecuteAsync(IConsole console) Source

Executes the command through the CliFx console integration.

Parameters

  • consoleConsole abstraction used to register cancellation handling.

Returns

A value task that completes after archive verification.

Property

CatalogPath

string? CatalogPath { get; set; } Source

Gets the path to the AppSurface Docs version catalog JSON file.

Property

Version

string? Version { get; set; } Source

Gets the version identifier to verify from the catalog.

Property

TrustedReleaseRootPath

string? TrustedReleaseRootPath { get; set; } Source

Gets the trusted release root used to resolve catalog exactTreePath entries.

Type

DocsVerifyHealthCommand

Source

Verifies AppSurface Docs harvest health for CI and release gates.

Remarks

This command loads the standalone docs host service graph, reads the same redacted health response shape as the JSON endpoint, and fails when the machine-checkable health response is not OK.

Method

ExecuteAsync

2 overloads
ValueTask ExecuteAsync(IConsole console) Source

Executes the command through the CliFx console integration.

Parameters

  • consoleConsole abstraction used to register cancellation handling.

Returns

A value task that completes when verification finishes.

ValueTask ExecuteAsync(CancellationToken cancellationToken) Source

Executes the command using an explicit cancellation token.

Parameters

  • cancellationTokenToken observed while loading host services and reading harvest health.

Returns

A value task that completes when verification finishes.

Method

BuildVerifyArgs

AppSurfaceDocsHealthVerifyArgs BuildVerifyArgs() Source

Translates CLI options into a one-shot harvest-health verification invocation.

Returns

The health verification runner arguments.

Property

RequireCompleteEventDoclets

bool RequireCompleteEventDoclets { get; set; } Source

Gets a value indicating whether public JavaScript event doclets must include complete event contract fields.

Remarks

This forwards AppSurfaceDocs:Harvest:JavaScript:RequireCompleteEventDoclets=true into the verification host without changing runtime startup failure semantics.

Property

VerifyEventDispatches

bool VerifyEventDispatches { get; set; } Source

Gets a value indicating whether public JavaScript event doclets should be compared with literal CustomEvent dispatch evidence.

Remarks

This forwards AppSurfaceDocs:Harvest:JavaScript:VerifyEventDispatches=true into the verification host. Mismatches remain warning-only diagnostics; the command prints them on successful verification runs.

Type

AppSurfaceDocsPreviewCommand

Source

Shared implementation for AppSurface Docs preview commands.

Remarks

The base command translates CLI options into AppSurface Docs standalone host arguments. It keeps command parsing separate from process hosting so tests can verify validation and argument forwarding without starting Kestrel.

Method

ExecuteAsync

2 overloads
ValueTask ExecuteAsync(IConsole console) Source

Executes the command through the CliFx console integration.

Parameters

  • consoleConsole abstraction used to register cancellation handling.

Returns

A value task that completes when the preview host exits or command validation fails.

ValueTask ExecuteAsync(CancellationToken cancellationToken) Source

Executes the command using an explicit cancellation token.

Parameters

  • cancellationTokenToken observed before the host runner starts.

Returns

A value task that completes when the preview host exits.

Remarks

This overload exists for tests and shared command execution paths that already own cancellation registration.

Property

Urls

string? Urls { get; set; } Source

Gets the explicit URL binding forwarded to the AppSurface Docs host.

Remarks

Use this for a full Kestrel binding such as http://127.0.0.1:5189. Prefer Port when only the port needs to change.

Property

Port

int? Port { get; set; } Source

Gets the port shortcut forwarded to the AppSurface Docs host.

Remarks

Use this for local preview scripts that only need a port override. Use Urls for explicit host, scheme, or multi-binding scenarios.

Property

AllHosts

bool AllHosts { get; set; } Source

Gets a value indicating whether the port shortcut should bind all hosts instead of localhost only.

Remarks

Use this only with Port when LAN, container, or other non-loopback preview access is intentional.

Type

AppSurfaceDocsRepositoryCommand

Source

Shared repository, routing, environment, and startup-timeout options for AppSurface docs commands.

Remarks

Preview and export share these options so route and source configuration cannot drift. Preview adds listener binding options, while export keeps listener management internal and adds output/export options instead.

Method

BuildHostArgs

2 overloads
AppSurfaceDocsHostArgs BuildHostArgs(string? defaultEnvironmentName) Source

Translates shared CLI options into standalone AppSurface Docs host arguments.

Parameters

  • defaultEnvironmentNameEnvironment to use when EnvironmentName is blank.

Returns

The repository root, forwarded host arguments, startup timeout, and resolved environment.

AppSurfaceDocsHostArgs BuildHostArgs(string? urls, int? port, bool allHosts, string? defaultEnvironmentName) Source

Translates shared and preview-only CLI options into standalone AppSurface Docs host arguments.

Parameters

  • urlsOptional explicit preview URL binding.
  • portOptional preview port shortcut.
  • allHostsWhether the preview port shortcut should bind all hosts instead of localhost only.
  • defaultEnvironmentNameEnvironment to use when EnvironmentName is blank.

Returns

The repository root, forwarded host arguments, startup timeout, and resolved environment.

Property

RepositoryRoot

string RepositoryRoot { get; set; } Source

Gets the repository root to harvest.

Remarks

Defaults to the current directory. Use this when running the CLI from a parent directory, script workspace, or package output folder. The value must resolve to an existing directory.

Property

StrictHarvest

bool StrictHarvest { get; } Source

Gets a value indicating whether startup should fail when every configured AppSurface Docs harvester fails.

Property

RouteRootPath

string? RouteRootPath { get; set; } Source

Gets the route-family root for AppSurface Docs version and archive routes.

Remarks

Use this when the docs route family is mounted somewhere other than /docs, for example --route-root /reference. Pair it with DocsRootPath when the live docs path should differ from archive/version routes.

Property

DocsRootPath

string? DocsRootPath { get; set; } Source

Gets the live docs root path.

Remarks

Use this to serve current docs under a nested route, for example --route-root /reference --docs-root /reference/next. Leave unset to use AppSurface Docs defaults.

Property

PublicOrigin

string? PublicOrigin { get; set; } Source

Gets the public origin used for absolute AppSurface Docs canonical metadata.

Remarks

Use this for published docs exports when the public host is known, for example --public-origin https://docs.example.com. Configure only the origin; route paths such as /docs come from RouteRootPath and DocsRootPath.

Property

EnvironmentName

string? EnvironmentName { get; set; } Source

Gets the host environment forwarded to the AppSurface Docs standalone host.

Remarks

Preview defaults to Development so the host can use deterministic per-workspace local endpoints. Export defaults to Production before starting the in-process host.

Property

StartupTimeoutSeconds

double StartupTimeoutSeconds { get; set; } Source

Gets the number of seconds to wait for the web host to start before failing fast.

Remarks

Defaults to 10 seconds. Set to 0 to disable the startup watchdog. Negative, infinite, and NaN values are rejected before the host starts.

Type

CurrentDirectoryScope

Source

Restores the previous process current directory when disposed.

Remarks

The standalone host resolves some relative paths from the current directory, so preview and export temporarily scope it to the repository root while the host runs.

Method

ChangeTo

CurrentDirectoryScope ChangeTo(string directory) Source

Changes the process current directory and returns a scope that restores the previous value.

Parameters

  • directoryDirectory to make current for the scope lifetime.

Returns

A disposable scope that restores the previous current directory.

Method

Dispose

void Dispose() Source

Restores the current directory captured when the scope was created.

Type

AppSurfaceDocsStrictRepositoryCommand

Source

Shared repository command options for AppSurface docs commands that expose strict harvest startup behavior.

Property

StrictHarvestEnabled

bool StrictHarvestEnabled { get; set; } Source

Gets or sets a value indicating whether startup should fail when every configured AppSurface Docs harvester fails.

Remarks

This is a source-harvest fail-closed gate. Static artifact validation is controlled separately by docs export --mode cdn. The option is intentionally omitted from docs verify-health, which keeps startup permissive and evaluates the health endpoint response instead.

Type

AppSurfaceDocsHostArgs

Source

Describes the AppSurface Docs host invocation produced by the CLI option translator.

Parameters

  • RepositoryRootAbsolute repository root that the AppSurface Docs host should harvest.
  • ArgsCommand-line arguments forwarded to the standalone AppSurface Docs host.
  • StartupTimeoutStartup watchdog timeout, or null when disabled.
  • EnvironmentNameResolved host environment, or null when the host should use its default.
Type

AppSurfaceDocsExportArgs

Source

Describes a one-shot AppSurface Docs static export request.

Parameters

  • HostArgsStandalone AppSurface Docs host arguments.
  • OutputPathAbsolute output directory for exported files.
  • SeedRoutesPathOptional absolute seed-route file path.
  • InitialSeedRoutesOptional in-memory seed routes used when SeedRoutesPath is null.
  • ModeRazorWire static export mode.
  • RedirectStrategyRedirect alias materialization strategy carried into the RazorWire export context. ExportRedirectStrategy.Html is the command default and writes portable fallback HTML pages for source-shaped aliases. Use ExportRedirectStrategy.Netlify only with ExportMode.Cdn when publishing to Netlify or a compatible host that reads a root _redirects file; export rejects that provider strategy with ExportMode.Hybrid because the generated rules target publish-root static routes. The selected strategy affects only alias materialization after the loopback host is crawled from RequestedBaseUrl.
  • RequestedBaseUrlLoopback URL passed to Kestrel. The default uses port 0 so the OS chooses a free port.
  • HybridOptionsOptional split-origin hybrid settings forwarded into the RazorWire export context.
Type

AppSurfaceDocsHealthVerifyArgs

Source

Describes a one-shot AppSurface Docs harvest-health verification request.

Parameters

  • HostArgsStandalone AppSurface Docs host arguments.
  • HealthJsonPathApp-relative health JSON path represented by this verification run.
  • RequestedBaseUrlLoopback URL passed to Kestrel. The default uses port 0 so the OS chooses a free port.
Type

AppSurfaceDocsHealthVerificationResult

Source

Result returned by the AppSurface Docs harvest-health verification runner.

Parameters

  • HealthParsed health response from the docs host.
  • HttpStatusCodeHTTP status code that the health endpoint would return for this health response.
Type

AppSurfaceDocsHealthHttpResponse

Source

Raw HTTP response returned by the AppSurface Docs harvest-health client seam.

Parameters

  • StatusCodeHTTP status returned by the health endpoint.
  • BodyResponse body read from the health endpoint.
Type

AppSurfaceDocsCliHost

Source

Applies shared host options required by packaged AppSurface docs tooling.

Method

ConfigurePackagedToolHost

void ConfigurePackagedToolHost(WebOptions options, TimeSpan? startupTimeout) Source

Configures the standalone AppSurface Docs host shape used by packaged preview and export commands.

Parameters

  • optionsWeb startup options to mutate.
  • startupTimeoutStartup watchdog timeout, or null when disabled.
Method

ConfigureQuietPreviewLogging

void ConfigureQuietPreviewLogging(ILoggingBuilder logging) Source

Suppresses routine ASP.NET Core host lifecycle output for interactive AppSurface Docs preview runs.

Parameters

  • loggingLogging builder for the preview host.

Remarks

The CLI prints the resolved docs URL itself after Kestrel starts, so routine messages such as Now listening on, Application started, AppSurface Web's endpoint fallback note, and routine docs harvest summaries would duplicate that command-owned status. Warnings and errors remain visible so startup and request failures are not hidden.

Type

IAppSurfaceDocsHostRunner

Source

Starts a AppSurface Docs host for CLI preview commands.

Remarks

This seam keeps command parsing and validation testable without starting a real web host. Production implementations should honor cancellation before delegating into long-running host lifetimes.

Method

RunAsync

Task RunAsync(string[] args, TimeSpan? startupTimeout, CancellationToken cancellationToken) Source

Runs the AppSurface Docs host with translated command-line arguments.

Parameters

  • argsArguments forwarded to the standalone AppSurface Docs host.
  • startupTimeoutStartup watchdog timeout, or null to disable it.
  • cancellationTokenToken that cancels before the host is started.

Returns

A task that completes when the host exits.

Type

IAppSurfaceDocsExportRunner

Source

Starts the AppSurface Docs host and exports it to static files.

Method

ExportAsync

Task ExportAsync(AppSurfaceDocsExportArgs args, CancellationToken cancellationToken) Source

Starts the docs host, runs static export, and stops the host.

Parameters

  • argsResolved export arguments.
  • cancellationTokenToken observed during host startup and export.

Returns

A task that completes when export finishes.

Type

IAppSurfaceDocsHealthVerifyRunner

Source

Loads the AppSurface Docs host service graph and verifies the redacted harvest-health response.

Method

VerifyAsync

Task<AppSurfaceDocsHealthVerificationResult> VerifyAsync(AppSurfaceDocsHealthVerifyArgs args, CancellationToken cancellationToken) Source

Starts the docs host, reads harvest health, and stops the host.

Parameters

  • argsResolved verification arguments.
  • cancellationTokenToken observed during host startup and health retrieval.

Returns

The parsed harvest-health verification result.

Type

IAppSurfaceDocsHealthHttpClient

Source

Reads the AppSurface Docs harvest-health JSON endpoint.

Method

GetAsync

Task<AppSurfaceDocsHealthHttpResponse> GetAsync(string url, CancellationToken cancellationToken) Source

Requests a redacted health JSON URL and returns the body regardless of success or failure HTTP status.

Parameters

  • urlAbsolute health JSON URL.
  • cancellationTokenToken observed by the HTTP request.

Returns

The HTTP status and body.

Type

IAppSurfaceDocsHealthHostStarter

Source

Builds and starts the AppSurface Docs host used by harvest-health verification.

Method

BuildAndStartAsync

Task<IHost> BuildAndStartAsync(AppSurfaceDocsHealthVerifyArgs args, string environmentName, CancellationToken cancellationToken) Source

Builds the standalone docs host, starts Kestrel, and returns the started host for health verification.

Parameters

  • argsResolved verification arguments.
  • environmentNameResolved host environment.
  • cancellationTokenToken observed while starting the host.

Returns

The started host.

Type

IRazorWireStaticExporter

Source

Adapts the RazorWire static exporter behind a small AppSurface CLI test seam.

Method

ExportAsync

Task ExportAsync(ExportContext context, CancellationToken cancellationToken) Source

Exports the started docs host described by context.

Parameters

  • contextRazorWire export context.
  • cancellationTokenToken observed by the export operation.

Returns

A task that completes when export finishes.

Type

IAppSurfaceDocsExportContextConfigurator

Source

Adds AppSurface Docs-specific export graph state after the host starts and before RazorWire crawls it.

Method

ConfigureAsync

Task ConfigureAsync(IHost host, ExportContext context, CancellationToken cancellationToken) Source

Configures the export context using services from the started docs host.

Parameters

  • hostStarted AppSurface Docs host.
  • contextExport context to configure.
  • cancellationTokenToken observed while resolving host state.

Returns

A task that completes after context configuration.

Type

AppSurfaceDocsStandaloneHostRunner

Source

Production IAppSurfaceDocsHostRunner that delegates to the standalone AppSurface Docs web host.

Remarks

Use this adapter for the packaged AppSurface CLI path. Tests should prefer fake runners so they can verify argument translation without starting Kestrel. The type is internal and sealed because callers should depend on IAppSurfaceDocsHostRunner rather than subclassing host lifetime behavior.

Type

ExceptionFilters

Source

Shared exception classification helpers used by command cleanup and best-effort diagnostics.

Method

IsNonFatal

bool IsNonFatal(Exception ex) Source

Determines whether an exception is safe to catch for cleanup, fallback logging, or diagnostic reporting.

Parameters

  • exException to classify.

Returns

true when the exception is non-fatal and can be handled locally.

Type

IAppSurfaceDocsHarvestSummaryReader

Source

Reads a command-owned harvest summary from a started AppSurface Docs preview host.

Method

ReadAsync

Task<AppSurfaceDocsHarvestSummary?> ReadAsync(IHost host, CancellationToken cancellationToken) Source

Reads the current docs harvest summary if the started host exposes the AppSurface Docs aggregator.

Parameters

  • hostStarted preview host.
  • cancellationTokenToken observed while waiting for the first cached docs snapshot.

Returns

A summary when available; otherwise null.

Type

AppSurfaceDocsHarvestSummary

Source

Concise harvest summary emitted by the AppSurface Docs CLI preview command.

Parameters

  • StatusAggregate harvest status.
  • TotalDocsNumber of final documentation nodes in the cached snapshot.
  • TotalHarvestersNumber of active harvesters that participated in the snapshot.
  • SuccessfulHarvestersNumber of harvesters that completed successfully.
  • DiagnosticCountNumber of structured harvest diagnostics in the snapshot.
Type

AppSurfaceDocsHarvestSummaryReader

Source

Production IAppSurfaceDocsHarvestSummaryReader that reads DocAggregator health.

Type

AppSurfaceDocsPreviewHostArgs

Source

Describes a preview AppSurface Docs host startup request.

Parameters

  • ArgsArguments forwarded to the standalone AppSurface Docs host.
  • StartupTimeoutStartup watchdog timeout, or null when disabled.
Type

IAppSurfaceDocsPreviewHostStarter

Source

Builds and starts the AppSurface Docs preview host.

Method

BuildAndStartAsync

Task<IHost> BuildAndStartAsync(AppSurfaceDocsPreviewHostArgs args, CancellationToken cancellationToken) Source

Builds the standalone docs host, starts Kestrel, and returns the started host for preview.

Parameters

  • argsResolved preview arguments.
  • cancellationTokenToken observed while starting the host.

Returns

The started host.

Type

AppSurfaceDocsStandalonePreviewHostStarter

Source

Production IAppSurfaceDocsPreviewHostStarter that uses the AppSurface Docs standalone host builder.

Type

IAppSurfaceDocsBrowserLauncher

Source

Attempts to open the preview docs URL in the user's browser.

Method

TryOpenAsync

Task<AppSurfaceDocsBrowserLaunchResult> TryOpenAsync(Uri url, CancellationToken cancellationToken) Source

Attempts to open url in the user's browser without failing the preview command.

Parameters

  • urlAbsolute docs URL to open.
  • cancellationTokenToken observed before launch.

Returns

The browser launch outcome.

Type

AppSurfaceDocsBrowserLaunchResult

Source

Describes the outcome of an attempted browser launch.

Parameters

  • SucceededWhether a platform launch command was started successfully.
  • FailureReasonUser-facing failure detail when Succeeded is false.
Method

Failure

AppSurfaceDocsBrowserLaunchResult Failure(string reason) Source

Creates a failed browser-launch result.

Parameters

  • reasonUser-facing failure detail.

Returns

A failed browser-launch result.

Property

Success

AppSurfaceDocsBrowserLaunchResult Success { get; } Source

Gets a successful browser-launch result.

Type

SystemAppSurfaceDocsBrowserLauncher

Source

Browser launcher that uses the current operating system's conventional URL opener.

Type

IAppSurfaceDocsBrowserOpenCommandRunner

Source

Runs the platform command that asks the operating system to open a browser URL.

Method

OpenAsync

Task OpenAsync(Uri url, CancellationToken cancellationToken) Source

Opens the given URL with the platform opener command.

Parameters

  • urlAbsolute URL to open.
  • cancellationTokenToken observed while starting the opener command.

Returns

A task that completes when the opener command exits.

Type

CliWrapAppSurfaceDocsBrowserOpenCommandRunner

Source

CliWrap-backed IAppSurfaceDocsBrowserOpenCommandRunner implementation.

Type

AppSurfaceDocsPreviewUrlResolver

Source

Resolves browser-facing URLs for AppSurface Docs preview hosts.

Method

ResolveRepositoryRoot

string ResolveRepositoryRoot(IReadOnlyList<string> args, string fallbackRoot) Source

Resolves the repository root forwarded to the standalone host.

Parameters

  • argsArguments forwarded to the standalone host.
  • fallbackRootFallback root used when the forwarded arguments do not contain a repository root.

Returns

The forwarded repository root when present; otherwise fallbackRoot.

Method

ResolveDefaultPreviewUrl

string? ResolveDefaultPreviewUrl(IReadOnlyList<string> args, string repositoryRoot) Source

Resolves the default preview listener when the CLI invocation did not configure an endpoint explicitly.

Parameters

  • argsArguments forwarded to the standalone host.
  • repositoryRootRepository root used as the deterministic-port seed.

Returns

A localhost URL, or null when explicit endpoint configuration should win.

Method

ResolveBoundBaseUrl

2 overloads
string ResolveBoundBaseUrl(IHost host) Source

Resolves the browser-facing base URL from Kestrel's published server addresses.

Parameters

  • hostStarted host that exposes Kestrel server addresses.

Returns

The scheme and authority that should be opened in the browser.

string ResolveBoundBaseUrl(ICollection<string>? addresses) Source

Resolves the browser-facing base URL from Kestrel's published server addresses.

Parameters

  • addressesPublished server addresses.

Returns

The scheme and authority that should be opened in the browser.

Method

ResolveDocsUrl

Uri ResolveDocsUrl(string baseUrl, IReadOnlyList<string> args) Source

Combines the bound host base URL with the configured AppSurface Docs root path.

Parameters

  • baseUrlBound host base URL.
  • argsArguments forwarded to the standalone host.

Returns

The absolute docs page URL to open.

Type

AppSurfaceDocsInProcessExportRunner

Source

Production export runner that starts the standalone AppSurface Docs host in-process and exports it over real loopback HTTP.

Method

ResolveBoundBaseUrl

2 overloads
string ResolveBoundBaseUrl(IHost host) Source

Resolves the single bound loopback base URL published by the started export host.

Parameters

  • hostStarted host that exposes Kestrel server addresses.

Returns

The scheme and authority used by the export crawler.

Exceptions

  • InvalidOperationExceptionThrown when the host does not publish exactly one valid loopback URL.
string ResolveBoundBaseUrl(ICollection<string>? addresses) Source

Resolves the crawler base URL from a Kestrel address collection.

Parameters

  • addressesPublished server addresses.

Returns

The absolute URL authority to crawl.

Exceptions

  • InvalidOperationExceptionThrown when no URL, multiple URLs, an invalid URL, or a non-loopback URL is published.
Method

BuildAndStartHostWithTimeoutAsync

Task<IHost> BuildAndStartHostWithTimeoutAsync(AppSurfaceDocsExportArgs args, string environmentName, CancellationToken cancellationToken) Source

Builds and starts the docs host while enforcing the configured startup watchdog.

Parameters

  • argsResolved export arguments.
  • environmentNameEnvironment name applied to the standalone host.
  • cancellationTokenExternal cancellation token for the export operation.

Returns

The started host.

Exceptions

  • TimeoutExceptionThrown when the host does not start before the startup timeout.
Method

CreateStartupTimeout

StartupTimeoutCancellationLease CreateStartupTimeout(TimeSpan startupTimeout, CancellationToken cancellationToken) Source

Creates the linked cancellation source used to distinguish startup timeout from external cancellation.

Parameters

  • startupTimeoutStartup timeout to enforce.
  • cancellationTokenExternal cancellation token to link.

Returns

A disposable lease for the linked startup cancellation source.

Method

ObserveTimedOutStartupTask

void ObserveTimedOutStartupTask(Task<IHost> startTask, CancellationTokenSource startupTimeoutCts) Source

Observes a startup task that outlived the configured timeout so late completion can stop or log the host.

Parameters

  • startTaskBackground startup task to observe.
  • startupTimeoutCtsCancellation source transferred from the timeout branch.
Method

ObserveCanceledStartupTask

void ObserveCanceledStartupTask(Task<IHost> startTask, CancellationTokenSource startupTimeoutCts) Source

Observes a startup task that outlived external cancellation so late completion can stop or log the host.

Parameters

  • startTaskBackground startup task to observe.
  • startupTimeoutCtsCancellation source transferred from the external cancellation branch.
Method

ObserveStartupTaskAsync

Task ObserveStartupTaskAsync(Task<IHost> startTask, CancellationTokenSource startupTimeoutCts, string lateCompletionMessage) Source

Awaits a late startup task and disposes the host if startup eventually succeeds.

Parameters

  • startTaskBackground startup task to observe.
  • startupTimeoutCtsCancellation source owned by the observation task.
  • lateCompletionMessageDebug message used when late startup faults.

Returns

A task that completes after the late startup task is observed.

Method

CreateStartupTimeoutException

TimeoutException CreateStartupTimeoutException(TimeSpan startupTimeout, Exception? innerException) Source

Creates the user-facing timeout exception for a host that failed to start in time.

Parameters

  • startupTimeoutTimeout that elapsed.
  • innerExceptionOptional cancellation exception that came from the startup token.

Returns

The timeout exception reported to command execution.

Method

StopAndDisposeHostAsync

Task StopAndDisposeHostAsync(IHost host) Source

Stops the export host and always disposes it, logging non-fatal shutdown failures.

Parameters

  • hostHost to stop and dispose.

Returns

A task that completes after shutdown and disposal.

Type

StartupTimeoutCancellationLease

Source

Owns a startup cancellation source until timeout observation needs to transfer that ownership.

Method

CancelAsync

Task CancelAsync() Source

Requests cancellation of the owned startup cancellation source.

Returns

A task that completes after cancellation callbacks have run.

Method

Transfer

CancellationTokenSource Transfer() Source

Transfers cancellation source ownership to a late-startup observer.

Returns

The owned cancellation source.

Method

Dispose

void Dispose() Source

Disposes the owned cancellation source unless ownership has been transferred.

Property

Token

CancellationToken Token { get; } Source

Gets the token exposed by the owned startup cancellation source.

Type

AppSurfaceDocsHealthHttpClient

Source

Production harvest-health HTTP client used by AppSurfaceDocsInProcessHealthVerifyRunner.

Type

AppSurfaceDocsStandaloneHealthHostStarter

Source

Production IAppSurfaceDocsHealthHostStarter that uses the AppSurface Docs standalone host builder.

Type

FixedEnvironmentProvider

Source

Provides a fixed environment name to the standalone host builder during health verification startup.

Method

GetEnvironmentVariable

string? GetEnvironmentVariable(string name, string? defaultValue = null) Source

Gets environment variable values while overriding ASP.NET and .NET environment variables.

Parameters

  • nameEnvironment variable name.
  • defaultValueFallback value when the variable is not set.

Returns

The fixed host environment for environment-name variables, otherwise the process value or fallback.

Property

Environment

string Environment { get; } Source

Gets the fixed environment name.

Property

IsDevelopment

bool IsDevelopment { get; } Source

Gets a value indicating whether the fixed environment is Development.

Type

AppSurfaceDocsInProcessHealthVerifyRunner

Source

Starts AppSurface Docs in-process and verifies the redacted harvest-health response over loopback HTTP.

Type

AppSurfaceDocsExportContextConfigurator

Source

Default AppSurface Docs export configurator that publishes docs route aliases into RazorWire's export graph and captures the frozen route manifest alongside the static output.

Type

NoOpAppSurfaceDocsExportContextConfigurator

Source

Test-seam configurator used when unit tests provide a fake host that does not contain AppSurface Docs services.

Type

IAppSurfaceDocsExportHostStarter

Source

Builds and starts the in-process AppSurface Docs export host.

Method

BuildAndStartAsync

Task<IHost> BuildAndStartAsync(AppSurfaceDocsExportArgs args, string environmentName, CancellationToken cancellationToken) Source

Builds the standalone docs host, starts Kestrel, and returns the started host for export.

Parameters

  • argsResolved export arguments.
  • environmentNameResolved host environment.
  • cancellationTokenToken observed while starting the host.

Returns

The started host.

Type

AppSurfaceDocsStandaloneExportHostStarter

Source

Production IAppSurfaceDocsExportHostStarter that uses the AppSurface Docs standalone host builder.

Type

FixedEnvironmentProvider

Source

Provides a fixed environment name to the standalone host builder during export startup.

Method

GetEnvironmentVariable

string? GetEnvironmentVariable(string name, string? defaultValue = null) Source

Gets environment variable values while overriding ASP.NET and .NET environment variables.

Parameters

  • nameEnvironment variable name.
  • defaultValueFallback value when the variable is not set.

Returns

The fixed host environment for environment-name variables, otherwise the process value or fallback.

Property

Environment

string Environment { get; } Source

Gets the fixed environment name.

Property

IsDevelopment

bool IsDevelopment { get; } Source

Gets a value indicating whether the fixed environment is Development.

Type

RazorWireExportEngineAdapter

Source

Production IRazorWireStaticExporter that delegates to RazorWire's ExportEngine.

Type

AppSurfaceCliModule

Source

Represents the AppSurface CLI root module used to bootstrap command execution.

Remarks

The module is intentionally empty today: the CLI owns command registration in AppSurfaceCliApp and delegates web-host behavior to AppSurface Docs-specific runners. Add dependencies here only when every AppSurface CLI command needs the same module-level dependency graph or host lifecycle hook. Prefer command-local services or custom test registrations for isolated behavior, and do not place runtime command logic in this module.

Method

ConfigureServices

void ConfigureServices(StartupContext context, IServiceCollection services) Source

Configures shared CLI services after the default command runtime registrations have been added.

Parameters

  • contextStartup context for the CLI run.
  • servicesService collection that will back command construction.

Remarks

The default implementation is a no-op. Keep it empty unless a service truly applies to the whole CLI surface.

Method

ConfigureHostBeforeServices

void ConfigureHostBeforeServices(StartupContext context, IHostBuilder builder) Source

Configures a Generic Host builder before services are registered.

Parameters

  • contextStartup context for the CLI run.
  • builderHost builder that would be configured by host-based startup paths.

Remarks

The command runtime does not currently build a Generic Host through this module, so this hook is intentionally a no-op and exists to satisfy the shared AppSurface host-module contract.

Method

ConfigureHostAfterServices

void ConfigureHostAfterServices(StartupContext context, IHostBuilder builder) Source

Configures a Generic Host builder after services are registered.

Parameters

  • contextStartup context for the CLI run.
  • builderHost builder that would be configured by host-based startup paths.

Remarks

Keep this empty until the CLI adopts a host-backed lifecycle. Command behavior should stay in command classes.

Method

RegisterDependentModules

void RegisterDependentModules(ModuleDependencyBuilder builder) Source

Registers root-module dependencies for the AppSurface CLI module graph.

Parameters

  • builderDependency builder used by AppSurface startup composition.

Remarks

The CLI has no module dependencies by default. Add dependencies here only for cross-command infrastructure that must participate in AppSurface module ordering.

Type

AppSurfaceCliApp

Source

Provides the DI-backed execution runtime for AppSurface CLI commands.

Remarks

This internal runtime exists so the top-level tool entry point stays thin while command discovery, dependency registration, logging defaults, and CliFx execution stay testable. It discovers commands from the AppSurface CLI entry assembly, applies module and caller-provided service registrations, temporarily assigns CommandService.PrimaryServiceProvider for constructor-injected command dependencies, and always restores the previous provider after command execution.

Method

RunAsync

Task RunAsync(string[] args, Action<ConsoleOptions>? configureOptions = null) Source

Runs the AppSurface CLI with the provided command-line arguments.

Parameters

  • argsCommand-line arguments to parse and execute.
  • configureOptionsOptional callback that customizes ConsoleOptions before execution. Defaults start from ConsoleOptions.Default with ConsoleOutputMode.CommandFirst so command output remains the primary console experience.

Returns

A task that completes when the selected command finishes.

Remarks

Use this seam from process entry points and tests that need the real command pipeline without shelling out. The method builds and disposes a fresh service provider for each run, registers AppSurface CLI defaults, then applies custom registrations last so tests or future host integrations can replace defaults intentionally.

Method

AddExportEngineServices

void AddExportEngineServices(IServiceCollection services) Source

Registers the RazorWire export engine dependencies used by AppSurface-owned export commands.

Parameters

  • servicesThe service collection to populate.

Remarks

The named ExportEngine HTTP client disables automatic redirects so artifact-producing requests are surfaced to ExportEngine. The engine then applies its explicit redirect boundary checks before reading or writing redirected response bodies, while source and readiness probes continue to treat surfaced HTTP redirect responses as evidence that an app endpoint is reachable.

Method

AddPwaVerifierServices

void AddPwaVerifierServices(IServiceCollection services) Source

Registers the HTTP client used by appsurface pwa verify.

Parameters

  • servicesThe service collection to populate.

Remarks

Automatic redirects are disabled so the verifier observes the requested manifest, icon, diagnostics, and offline fallback URLs directly. That keeps the verifier's same-origin and base-path checks authoritative instead of letting HttpClient silently follow a redirect outside the app being verified.

Type

CoverageRunSlowTestDiagnosticsWriter

Source

Writes best-effort slow-test diagnostic artifacts for coverage run.

Remarks

The writer consumes AppSurface-managed JUnit files only. Parser problems are preserved as diagnostic warnings so slow-test reporting cannot change the coverage result.
  • Only the first managed JUnit artifact for a project is parsed; additional JUnit artifacts emit warnings.
  • WriteAsync may write artifacts twice when aggregation timing changes during the initial write.
  • Legacy or externally managed test-result files are not consumed.
  • Missing files and parser failures are reported as warnings instead of failing coverage.
Method

CollectAsync

Task<CoverageRunSlowTestDiagnosticsReport> CollectAsync(IReadOnlyList<CoverageProjectRunResult> results, CancellationToken cancellationToken) Source

Parses managed JUnit files and builds a diagnostic report.

Parameters

  • resultsProject run results with managed test result artifact paths.
  • cancellationTokenCancellation token for artifact reads.

Returns

Slow-test diagnostic report model.

Method

WriteAsync

Task<CoverageRunSlowTestDiagnosticsRun> WriteAsync(string outputDirectory, CoverageRunSlowTestDiagnosticsReport report, Func<long> getAggregationSeconds, Func<long, decimal> calculateAggregationPercent, CancellationToken cancellationToken) Source

Writes diagnostic artifacts with measured aggregation overhead.

Parameters

  • outputDirectoryCoverage output directory.
  • reportReport model returned by CollectAsync.
  • getAggregationSecondsReads elapsed diagnostic aggregation seconds.
  • calculateAggregationPercentCalculates aggregation overhead as a percent of runner time.
  • cancellationTokenCancellation token for artifact writes.

Returns

Written artifact paths and high-level metadata.

Remarks

WriteAsync may call WriteArtifactsAsync twice when aggregationSeconds differs from finalAggregationSeconds. The single re-write includes the first file-write cost in reported aggregation overhead; later timing drift is not captured.

Type

CoverageRunSlowTestDiagnosticsRun

Source

Written slow-test diagnostic artifact metadata.

Type

CoverageRunSlowTestDiagnosticsReport

Source

Slow-test diagnostic report before overhead fields are finalized.

Type

CoverageRunSlowTestProject

Source

Project timing metadata included in slow-test diagnostics.

Type

CoverageRunJunitReadResult

Source

Best-effort parse result for one managed JUnit file.

Type

CoverageRunSlowTestCase

Source

Parsed JUnit test case timing included in slow-test diagnostics.

Type

AppSurfaceCliVersion

Source

Resolves the AppSurface CLI version string shown by appsurface --version.

Remarks

The .NET tool package version is the user-facing release identity. Runtime assemblies carry that value through AssemblyInformationalVersionAttribute, sometimes with a leading release-tag v or build metadata. This helper normalizes the display value while preserving prerelease labels so RC installs remain distinguishable from stable packages.

Method

ResolveDisplayVersion

string ResolveDisplayVersion(Assembly assembly) Source

Resolves the display version from the supplied assembly metadata.

Parameters

  • assemblyAssembly whose informational version carries the package identity.

Returns

A single-line printable version suitable for CliFx --version output.

Method

NormalizeDisplayVersion

string NormalizeDisplayVersion(string? informationalVersion) Source

Normalizes package identity metadata for user-facing CLI version output.

Parameters

  • informationalVersionRaw assembly informational version.

Returns

The package SemVer display value without a leading release-tag v or build metadata, or a truthful fallback when package identity metadata is unavailable.