or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

core-resolution.mddotnet-requirements.mdgeneric-resolution.mdindex.mdjava-requirements.mdpython-requirements.md
tile.json

generic-resolution.mddocs/

Generic Command Resolution

Generic command availability checking for any executable in the system PATH. Provides simple existence validation for commands that don't have specialized resolvers.

Capabilities

Generic System Requirement Resolution

Checks if a named command is available in the system PATH without version validation.

/**
 * Resolve generic command availability in system PATH
 * @param name - Name of the command to check
 * @returns Resolution if command exists, or error if not found
 */
function resolveGenericSystemRequirement(
  name: string
): Promise<SystemRequirementResolution | SystemRequirementError>;

Usage Example:

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

// Check if git is available
const gitResult = await resolveGenericSystemRequirement("git");
if ("error" in gitResult) {
  console.error("Git not found:", gitResult.message);
} else {
  console.log(`Git available: ${gitResult.command}`);
  // Output: "Git available: git"
}

// Check if a custom tool is available
const toolResult = await resolveGenericSystemRequirement("my-custom-tool");
if ("error" in toolResult) {
  console.log("Custom tool not installed");
} else {
  console.log("Custom tool is available");
}

Generic Resolution Logic

The generic resolver:

  1. Command Existence Check: Uses the command-exists library to check if the command is available in PATH
  2. Simple Resolution: If found, returns a basic resolution with the command name
  3. No Version Checking: Does not attempt to detect or validate versions
  4. Cross-Platform: Works on Windows, macOS, and Linux

Use Cases

Generic resolution is automatically used for:

  • Commands that don't have specialized resolvers (not Python, Java, or .NET)
  • Custom tools and utilities
  • System commands like git, curl, make, etc.
  • Build tools and scripts

Limitations

Generic resolution has these limitations:

  • No Version Validation: Cannot check if the command meets version requirements
  • No Path Resolution: Only confirms existence, doesn't resolve full paths
  • No Arguments: Cannot determine if additional arguments are needed

For commands that require version checking, consider implementing a specialized resolver using the defineKnownRequirement utility from the common module.

Error Handling

Generic resolution errors are straightforward:

  • Command Not Found: The specified command is not available in the system PATH

Error messages follow the format: "Couldn't find executable '{name}' in path. Make sure it is installed."

Implementation Details

The generic resolver uses the command-exists npm package internally, which:

  • Checks the system PATH for the command
  • Handles platform-specific executable extensions (.exe on Windows)
  • Returns quickly without executing the command
  • Works reliably across different shell environments