Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/commands/agent/generate/authoring-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,14 @@ export default class AgentGenerateAuthoringBundle extends SfCommand<AgentGenerat
const metaXmlPath = join(targetOutputDir, `${bundleApiName}.bundle-meta.xml`);

// Write Agent file
const parsedSpec = spec ? (YAML.parse(readFileSync(spec, 'utf8')) as AgentJobSpec) : undefined;
await ScriptAgent.createAuthoringBundle({
agentSpec: spec
? { ...(YAML.parse(readFileSync(spec, 'utf8')) as AgentJobSpec), ...{ name, developerName: bundleApiName } }
: undefined,
agentSpec: {
...parsedSpec,
name,
developerName: bundleApiName,
role: parsedSpec?.role ?? `${name} description`,
} as AgentJobSpec & { name: string; developerName: string },
project: this.project!,
bundleApiName,
});
Expand Down
4 changes: 4 additions & 0 deletions test/nuts/agent.generate.authoring-bundle.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ describe('agent generate authoring-bundle NUTs', function () {
expect(metaXml).to.include('<AiAuthoringBundle');
expect(metaXml).to.include('<bundleType>AGENT</bundleType>');
expect(agent).to.include(`developer_name: "${bundleName}"`);
expect(agent).to.include(`agent_label: "${bundleName}"`);
expect(agent).to.include('description: "test agent role"');
});

it('should generate authoring bundle with --no-spec', async () => {
Expand All @@ -80,6 +82,8 @@ describe('agent generate authoring-bundle NUTs', function () {
expect(metaXml).to.include('<AiAuthoringBundle');
expect(metaXml).to.include('<bundleType>AGENT</bundleType>');
expect(agent).to.include(`developer_name: "${bundleName}"`);
expect(agent).to.include(`agent_label: "${bundleName}"`);
expect(agent).to.include(`description: "${bundleName} description"`);
});

it('should fail when both --spec and --no-spec are provided', async () => {
Expand Down
Loading