Skip to content

Commit a270ad0

Browse files
fix: update agent generate command for new method
1 parent ef21b23 commit a270ad0

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

src/commands/agent/generate/authoring-bundle.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
import { join, resolve } from 'node:path';
18-
import { mkdirSync, writeFileSync, readFileSync, existsSync } from 'node:fs';
18+
import { readFileSync, existsSync } from 'node:fs';
1919
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
2020
import { generateApiName, Messages, SfError } from '@salesforce/core';
2121
import { Agent, AgentJobSpec } from '@salesforce/agents';
@@ -135,22 +135,12 @@ export default class AgentGenerateAuthoringBundle extends SfCommand<AgentGenerat
135135
// Write Agent file
136136
const conn = targetOrg.getConnection(flags['api-version']);
137137
const specContents = YAML.parse(readFileSync(spec, 'utf8')) as AgentJobSpec;
138-
const agent = await Agent.createAgentScript(conn, { ...specContents, ...{ name, developerName: bundleApiName } });
139-
// Create output directory if it doesn't exist
140-
mkdirSync(targetOutputDir, { recursive: true });
141-
writeFileSync(agentPath, agent);
142-
143-
// Write meta.xml file
144-
const metaXml = `<?xml version="1.0" encoding="UTF-8"?>
145-
<aiAuthoringBundle>
146-
<Label>${specContents.role}</Label>
147-
<BundleType>${specContents.agentType}</BundleType>
148-
<VersionTag>Spring2026</VersionTag>
149-
<VersionDescription>Initial release for ${bundleApiName}</VersionDescription>
150-
<SourceBundleVersion></SourceBundleVersion>
151-
<Target></Target>
152-
</aiAuthoringBundle>`;
153-
writeFileSync(metaXmlPath, metaXml);
138+
await Agent.createAuthoringBundle({
139+
connection: conn,
140+
agentSpec: { ...specContents, ...{ name, developerName: bundleApiName } },
141+
project: this.project!,
142+
bundleApiName,
143+
});
154144

155145
this.logSuccess(`Successfully generated ${bundleApiName} Authoring Bundle`);
156146

0 commit comments

Comments
 (0)