/** * Version detection for Senpi skills. * * Reads the installed SKILL.md version from disk and the remote version from * raw.githubusercontent.com, then uses the existing semver helpers from * src/runtime/auto-update/policy.ts to classify the delta. */ import type { LoggerLike, SkillVersionInfo } from "./types.js"; /** * Normalise a version string before passing it to parseSemver / classifyUpdate. * * Accepts two-part versions used in production skills (e.g. "1.0", "v2.3") * and expands them to the full three-part form ("1.0.0", "v2.3.0") that * parseSemver requires. All other strings are returned unchanged. */ export declare function normalizeVersion(v: string): string; /** * Extract the `version` value from a SKILL.md YAML frontmatter block. * * Handles both nested form: * metadata: * version: 1.2.3 * and flat form: * version: "1.2.3" * * Returns null when the frontmatter block is absent or the field is missing. */ export declare function parseSkillMdVersion(content: string): string | null; /** * Read the installed version for a skill from its local SKILL.md. * * Accepts either a single dir (legacy callers) or an array of dirs (the * multi-dir search path). When given an array, tries each entry in order and * returns the first readable SKILL.md's parsed version — this mirrors the * documented behaviour that `skillsDir[0]` is the *primary* (writes go here) * and the remaining entries are read-only fallbacks scanned during version * checks. * * The first readable SKILL.md wins even if its version field is absent — a * present-but-versionless file is meaningful state (skill predates versioning), * not a "not found" signal that should let the next dir override it. Returns * null when no readable SKILL.md is found across any candidate dir, or when the * version field is absent. Logs a warning per dir for unexpected errors * (anything other than ENOENT). */ export declare function readLocalVersion(skillsDir: string | readonly string[], skillName: string, logger?: LoggerLike): Promise; /** * Fetch the remote SKILL.md for a skill and return its version. * * Returns null when the skill does not exist in the remote repo (HTTP 404) — * that's a legitimate state ("skill removed or not yet published"), not an * error, so it should not pollute failure counters. Also null when the remote * SKILL.md is present but its frontmatter omits the version field. * * Throws on transient/operational failures (network errors, timeouts, 5xx * responses, body-parse failures) so the caller's failure-recording path can * fire. * * @param remotePath Subdirectory inside the repo holding the skill (manifest * `path`); defaults to the skill name (monorepo convention). * @param fetchImpl Injectable for unit testing — defaults to global `fetch`. */ export declare function fetchRemoteVersion(skillName: string, rawBaseUrl?: string, fetchImpl?: typeof fetch, remotePath?: string): Promise; /** * Compare the local and remote versions for a skill and return a classified diff. * * Special cases: * - Local version is null (skill predates versioning) + valid remote → "minor" * so the update is auto-applied without manual major-version approval. * - Local version exists but is not valid semver (e.g. "latest") → "unknown", * skip safely. * - Remote version is absent or unparseable → "unknown", caller should log and * skip. */ export declare function checkSkillVersion(skillsDir: string | readonly string[], skillName: string, rawBaseUrl?: string, fetchImpl?: typeof fetch, logger?: LoggerLike, remotePath?: string): Promise; //# sourceMappingURL=version-manager.d.ts.map