CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-autorest--system-requirements

System requirement validation and resolution for autorest.

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

java-requirements.mddocs/

Java Requirements Resolution

Java runtime detection and version validation for AutoRest Java-based extensions. Provides simple Java availability checking with version parsing from the standard java -version command output.

Capabilities

Java Requirement Resolution

Resolves Java runtime requirements by executing java -version and parsing the version output.

/**
 * Resolve Java runtime requirement
 * @param requirement - Java requirement configuration
 * @returns Resolution with Java command and version, or error details
 */
function resolveJavaRequirement(
  requirement: SystemRequirement
): Promise<SystemRequirementResolution | SystemRequirementError>;

Usage Example:

import { resolveJavaRequirement } from "@autorest/system-requirements";

// Basic Java requirement
const result = await resolveJavaRequirement({ version: ">=11" });
if ("error" in result) {
  console.error("Java not found or version incompatible:", result.message);
} else {
  console.log(`Java resolved: ${result.command}`);
  console.log(`Java name: ${result.name}`); // "java"
}

// Using custom Java path via environment variable
const customResult = await resolveJavaRequirement({
  version: ">=17",
  environmentVariable: "JAVA_HOME_PATH"
});

Java Detection Logic

The Java resolver follows this detection process:

  1. Environment Variable: If environmentVariable is specified in the requirement, uses that path
  2. System Java: Falls back to java command in system PATH
  3. Version Parsing: Executes java -version and parses output using regex pattern
  4. Version Validation: Compares parsed version against requirement using semantic versioning

Version Detection

Java version detection parses the output of java -version command, which typically looks like:

java version "11.0.12"
OpenJDK Runtime Environment...

The version string is extracted using the regex pattern: /java version "(.*)"/

Constants

/** Java executable name used in system requirement resolution */
const JavaExeName = "java";

Error Handling

Common Java resolution errors include:

  • Command not found: java executable is not in PATH and no environment variable specified
  • Version incompatible: Java version doesn't satisfy the requirement
  • Version parsing failed: Unable to parse version from java -version output
  • Execution failed: java -version command failed to execute

The resolver provides detailed error messages to help diagnose Java installation and configuration issues.

docs

core-resolution.md

dotnet-requirements.md

generic-resolution.md

index.md

java-requirements.md

python-requirements.md

tile.json