Merge pull request #2649 from plind-dm/fix/import-ceo-role-default

fix(import): read agent role from frontmatter before defaulting to "a…
This commit is contained in:
Dotta 2026-04-06 08:56:38 -05:00 committed by GitHub
commit 73e7007e7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 45 additions and 1 deletions

View file

@ -1638,6 +1638,50 @@ describe("company portability", () => {
}));
});
it("preserves agent role from frontmatter when extension block omits it", async () => {
const portability = companyPortabilityService({} as any);
const preview = await portability.previewImport({
source: {
type: "inline",
rootPath: "ceo-package",
files: {
"COMPANY.md": [
"---",
'schema: "agentcompanies/v1"',
'name: "CEO Role Test"',
"---",
"",
].join("\n"),
"agents/ceo/AGENTS.md": [
"---",
'name: "CEO"',
'role: "ceo"',
"---",
"",
"# CEO",
"",
"You run the company.",
"",
].join("\n"),
},
},
include: { company: true, agents: true, projects: false, issues: false },
target: { mode: "new_company", newCompanyName: "CEO Role Test" },
agents: "all",
collisionStrategy: "rename",
});
expect(preview.errors).toEqual([]);
expect(preview.manifest.agents).toEqual([
expect.objectContaining({
slug: "ceo",
name: "CEO",
role: "ceo",
}),
]);
});
it("treats no-separator auth and api key env names as secrets during export", async () => {
const portability = companyPortabilityService({} as any);

View file

@ -2393,7 +2393,7 @@ function buildManifestFromPackageFiles(
name: asString(frontmatter.name) ?? title ?? slug,
path: agentPath,
skills: readAgentSkillRefs(frontmatter),
role: asString(extension.role) ?? "agent",
role: asString(extension.role) ?? asString(frontmatter.role) ?? "agent",
title,
icon: asString(extension.icon),
capabilities: asString(extension.capabilities),