System requirement validation and resolution for autorest.
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Pending
The risk profile of this skill
Generic command availability checking for any executable in the system PATH. Provides simple existence validation for commands that don't have specialized resolvers.
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");
}The generic resolver:
command-exists library to check if the command is available in PATHGeneric resolution is automatically used for:
git, curl, make, etc.Generic resolution has these limitations:
For commands that require version checking, consider implementing a specialized resolver using the defineKnownRequirement utility from the common module.
Generic resolution errors are straightforward:
Error messages follow the format: "Couldn't find executable '{name}' in path. Make sure it is installed."
The generic resolver uses the command-exists npm package internally, which: