{"version":3,"file":"project-config.d.ts","sourceRoot":"","sources":["../src/project-config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,aAAa;IAC7B,yEAAyE;IACzE,aAAa,EAAE,OAAO,CAAC;IACvB,qFAAqF;IACrF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAUnE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAKhF","sourcesContent":["import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface ProjectConfig {\n\t/** The product is the whole repository root, not per-task workspaces. */\n\tproductAtRoot: boolean;\n\t/** Product directory relative to the project root, or null when no marker exists. */\n\tproductDir: string | null;\n}\n\n/**\n * Marker file: when `.agora-product` exists at the project root, agents work\n * in the product instead of per-task workspace directories. The file may be\n * empty (or `.`) for a product at the root, or contain the product directory\n * relative to the project root, e.g. `tasks/product/workspace`.\n */\nexport function readProjectConfig(projectDir: string): ProjectConfig {\n\tconst markerPath = join(projectDir, \".agora-product\");\n\tif (!existsSync(markerPath)) {\n\t\treturn { productAtRoot: false, productDir: null };\n\t}\n\tconst productDir = readFileSync(markerPath, \"utf8\").trim();\n\tif (productDir === \"\" || productDir === \".\") {\n\t\treturn { productAtRoot: true, productDir: \".\" };\n\t}\n\treturn { productAtRoot: false, productDir };\n}\n\n/**\n * Write the product marker when absent, so generated projects pin their\n * product directory explicitly. Existing markers are never overwritten.\n */\nexport function ensureProductMarker(projectDir: string, productDir: string): void {\n\tconst markerPath = join(projectDir, \".agora-product\");\n\tif (!existsSync(markerPath)) {\n\t\twriteFileSync(markerPath, `${productDir}\\n`);\n\t}\n}\n"]}