Always prefer parent torch-config in repo/torch mode

This commit is contained in:
thePR0M3TH3AN committed 2026-02-25 15:06:55 -05:00
1 parent f56bbb5a0f
commit 8894d40a01
1 file changed
+1 -14
+1 -14
View File
@@ -71,21 +71,8 @@ export function getTorchConfigPath() {
const localPath = path.resolve(process.cwd(), DEFAULT_CONFIG_PATH);
const parentPath = path.resolve(process.cwd(), '..', DEFAULT_CONFIG_PATH);
const cwdBaseName = path.basename(process.cwd());
const parentPkgPath = path.resolve(process.cwd(), '..', 'package.json');
let parentLooksLikeHostRepo = false;
try {
if (fs.existsSync(parentPkgPath)) {
const parentPkgRaw = fs.readFileSync(parentPkgPath, 'utf8');
const parentPkg = JSON.parse(parentPkgRaw);
parentLooksLikeHostRepo = parentPkg && typeof parentPkg.name === 'string' && parentPkg.name !== 'torch-lock';
}
} catch {
parentLooksLikeHostRepo = false;
}
// Host-repo mode: when running from "<repo>/torch", prefer parent config.
if (cwdBaseName === 'torch' && parentLooksLikeHostRepo && fs.existsSync(parentPath)) {
if (cwdBaseName === 'torch' && fs.existsSync(parentPath)) {
return parentPath;
}