MCPcopy Create free account
hub / github.com/backnotprop/plannotator / resolveSem

Function resolveSem

packages/shared/semantic-diff.ts:228–260  ·  view source on GitHub ↗
(runtime: SemanticDiffRuntime)

Source from the content-addressed store, hash-verified

226}
227
228async function resolveSem(runtime: SemanticDiffRuntime): Promise<ResolvedSem | SemResolveFailure> {
229 for (const candidate of semCandidates(runtime)) {
230 if (candidate.explicit && isPathLike(candidate.command) && !runtime.fileExists(candidate.command)) {
231 return {
232 status: "unavailable",
233 reason: "sem-path-missing",
234 message: `PLANNOTATOR_SEM_PATH points to a missing file: ${candidate.command}`,
235 };
236 }
237
238 const versionResult = await runtime.runCommand(candidate.command, ["--version"], {
239 timeoutMs: SEM_VERSION_TIMEOUT_MS,
240 });
241 const version = parseSemVersion(versionResult.stdout);
242 if (versionResult.exitCode === 0 && version) {
243 return { command: candidate.command, source: candidate.source, version };
244 }
245
246 if (candidate.explicit) {
247 return {
248 status: "unavailable",
249 reason: "invalid-sem-binary",
250 message: `PLANNOTATOR_SEM_PATH did not resolve to the Ataraxy sem CLI.`,
251 };
252 }
253 }
254
255 return {
256 status: "unavailable",
257 reason: "sem-not-found",
258 message: "Semantic diff is unavailable because the Ataraxy sem CLI was not found.",
259 };
260}
261
262export async function getSemanticDiffAvailability(
263 runtime: SemanticDiffRuntime = createDefaultSemanticDiffRuntime(),

Callers 2

runSemanticDiffFunction · 0.85

Calls 3

semCandidatesFunction · 0.85
parseSemVersionFunction · 0.85
isPathLikeFunction · 0.70

Tested by

no test coverage detected