From 86a340c49dcf01d95b42e61e7c0cb3e912e47edb Mon Sep 17 00:00:00 2001 From: alanw Date: Wed, 25 Feb 2026 08:20:27 +0000 Subject: [PATCH] fix(registryClient): handle relative file paths more robustly First attempt to resolve relative paths against current working directory before falling back to rootPath. This provides better flexibility when files are not located relative to rootPath. --- packages/config-yaml/src/registryClient.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/config-yaml/src/registryClient.ts b/packages/config-yaml/src/registryClient.ts index e889f76d7fd..afaddd2d9a4 100644 --- a/packages/config-yaml/src/registryClient.ts +++ b/packages/config-yaml/src/registryClient.ts @@ -48,9 +48,16 @@ export class RegistryClient implements Registry { return fs.readFileSync(new URL(filepath), "utf8"); } else if (path.isAbsolute(filepath)) { return fs.readFileSync(filepath, "utf8"); - } else if (this.rootPath) { - return fs.readFileSync(path.join(this.rootPath, filepath), "utf8"); } else { + // Try to resolve relative to current working directory first + const resolvedPath = path.resolve(filepath); + if (fs.existsSync(resolvedPath)) { + return fs.readFileSync(resolvedPath, "utf8"); + } + // Fall back to rootPath if file doesn't exist relative to cwd + if (this.rootPath) { + return fs.readFileSync(path.join(this.rootPath, filepath), "utf8"); + } throw new Error("No rootPath provided for relative file path"); } }