Table of Contents

Class JDAIToolkit

Namespace
JD.AI.Core.Installation
Assembly
JD.AI.Core.dll

Provides unified multi-tool detection, version checking, and updating for all JD.AI global tools installed via dotnet tool.

public static class JDAIToolkit
Inheritance
JDAIToolkit
Inherited Members

Methods

ApplyAllAsync(UpdatePlan, bool, Action<InstalledTool, InstallResult>?, CancellationToken)

Applies updates for all tools that have a newer version available, in sequence. Stops on first failure unless continueOnError is true.

public static Task ApplyAllAsync(UpdatePlan plan, bool continueOnError = false, Action<InstalledTool, InstallResult>? onToolUpdated = null, CancellationToken ct = default)

Parameters

plan UpdatePlan
continueOnError bool
onToolUpdated Action<InstalledTool, InstallResult>
ct CancellationToken

Returns

Task

ApplyAsync(string, string?, CancellationToken)

Applies an update to a single tool by package ID.

public static Task<InstallResult> ApplyAsync(string packageId, string? targetVersion = null, CancellationToken ct = default)

Parameters

packageId string
targetVersion string
ct CancellationToken

Returns

Task<InstallResult>

CheckAllAsync(IReadOnlyList<InstalledTool>?, CancellationToken)

Checks all detected tools for available updates from NuGet, in parallel. Returns an UpdatePlan describing the current state of each tool.

public static Task<UpdatePlan> CheckAllAsync(IReadOnlyList<InstalledTool>? tools = null, CancellationToken ct = default)

Parameters

tools IReadOnlyList<InstalledTool>
ct CancellationToken

Returns

Task<UpdatePlan>

CompareVersions(string, string)

Compares two semver-ish version strings. Returns positive if latest > current.

public static int CompareVersions(string latest, string current)

Parameters

latest string
current string

Returns

int

GetInstalledToolsAsync(CancellationToken)

Detects all installed JD.AI dotnet global tools by parsing dotnet tool list -g output and filtering by known package prefixes. Falls back to checking each known package ID individually if the list is unavailable.

public static Task<IReadOnlyList<InstalledTool>> GetInstalledToolsAsync(CancellationToken ct = default)

Parameters

ct CancellationToken

Returns

Task<IReadOnlyList<InstalledTool>>

GetLatestVersionAsync(string, CancellationToken)

Checks the latest version of a single package from NuGet.

public static Task<string?> GetLatestVersionAsync(string packageId, CancellationToken ct = default)

Parameters

packageId string
ct CancellationToken

Returns

Task<string>