added double check for root turbo.json

This commit is contained in:
Nate Kelley 2025-09-23 22:50:36 -06:00
parent de54e28f2e
commit d539d7e190
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
2 changed files with 7 additions and 4 deletions

View File

@ -357,7 +357,7 @@ export const analystAgentTask: ReturnType<
dataSourceId: dataSource.dataSourceId,
dataSourceSyntax: dataSource.dataSourceSyntax,
datasetsCount: datasets.length,
datasets: datasets.map((d) => ({
datasets: datasets.map((d: PermissionedDataset) => ({
id: d.id,
name: d.name,
})),

View File

@ -7,16 +7,19 @@ import { config } from 'dotenv';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Find the root of the monorepo (where turbo.json is)
// Find the root of the monorepo (where turbo.json and pnpm-workspace.yaml are)
function findMonorepoRoot(): string {
let currentDir = __dirname;
while (currentDir !== '/') {
if (existsSync(path.join(currentDir, 'turbo.json'))) {
const turboPath = path.join(currentDir, 'turbo.json');
const pnpmWorkspacePath = path.join(currentDir, 'pnpm-workspace.yaml');
// Look for both turbo.json AND pnpm-workspace.yaml to ensure we find the actual root
if (existsSync(turboPath) && existsSync(pnpmWorkspacePath)) {
return currentDir;
}
currentDir = path.dirname(currentDir);
}
throw new Error('Could not find monorepo root (turbo.json)');
throw new Error('Could not find monorepo root (turbo.json + pnpm-workspace.yaml)');
}
// Load environment variables from root .env file