@iqai/adk-cli
Version:
CLI tool for creating, running, and testing ADK-TS agents
32 lines • 1.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseTsConfigPaths = parseTsConfigPaths;
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const agent_loader_types_1 = require("../agent-loader.types");
function parseTsConfigPaths(projectRoot, logger) {
const tsconfigPath = (0, node_path_1.join)(projectRoot, "tsconfig.json");
if (!(0, node_fs_1.existsSync)(tsconfigPath)) {
return {};
}
try {
const tsconfigContent = (0, node_fs_1.readFileSync)(tsconfigPath, "utf-8");
const tsconfigJson = JSON.parse(tsconfigContent);
const parsed = agent_loader_types_1.TsConfigSchema.safeParse(tsconfigJson);
if (!parsed.success) {
logger?.warn(`Invalid tsconfig.json structure: ${parsed.error.message}`);
return {};
}
const compilerOptions = parsed.data.compilerOptions || {};
return {
baseUrl: compilerOptions.baseUrl,
paths: compilerOptions.paths,
};
}
catch (error) {
const msg = error instanceof Error ? error.message : String(error);
logger?.warn(`Failed to parse tsconfig.json: ${msg}`);
return {};
}
}
//# sourceMappingURL=tsconfig.js.map