fix(companies.sh): navigate into slug subdirectory for multi-company repos
When importing from companies.sh, the repo may be a multi-company monorepo (e.g. paperclipai/companies) where each company is a subdirectory. The code was parsing the repo root which has no COMPANY.md, resulting in 'no agents found'. Now detects this and descends into the slug-matched subdirectory. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
@@ -9736,8 +9736,19 @@ export function createApiRoutes(store: TaskStore, options?: ServerOptions): Rout
|
||||
throw badRequest("Archive did not extract to a directory");
|
||||
}
|
||||
|
||||
// Parse the extracted company
|
||||
pkg = parseCompanyDirectory(extractedDir);
|
||||
// Parse the extracted company.
|
||||
// Multi-company repos (e.g. paperclipai/companies) contain multiple company
|
||||
// subdirectories. If the extracted root doesn't contain COMPANY.md but has a
|
||||
// subdirectory matching the requested slug, descend into it.
|
||||
let companyDir = extractedDir;
|
||||
if (!existsSync(join(extractedDir, "COMPANY.md"))) {
|
||||
const slugDir = join(extractedDir, importCompanySlug);
|
||||
if (existsSync(slugDir) && nodeFs.statSync(slugDir).isDirectory()) {
|
||||
companyDir = slugDir;
|
||||
}
|
||||
}
|
||||
|
||||
pkg = parseCompanyDirectory(companyDir);
|
||||
|
||||
// Override company info if available from API
|
||||
if (companyInfo) {
|
||||
|
||||
Reference in New Issue
Block a user