|
15 | 15 | */ |
16 | 16 |
|
17 | 17 | import { join, resolve } from 'node:path'; |
18 | | -import { mkdirSync, writeFileSync, readFileSync, existsSync } from 'node:fs'; |
| 18 | +import { readFileSync, existsSync } from 'node:fs'; |
19 | 19 | import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; |
20 | 20 | import { generateApiName, Messages, SfError } from '@salesforce/core'; |
21 | 21 | import { Agent, AgentJobSpec } from '@salesforce/agents'; |
@@ -135,22 +135,12 @@ export default class AgentGenerateAuthoringBundle extends SfCommand<AgentGenerat |
135 | 135 | // Write Agent file |
136 | 136 | const conn = targetOrg.getConnection(flags['api-version']); |
137 | 137 | 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 | + }); |
154 | 144 |
|
155 | 145 | this.logSuccess(`Successfully generated ${bundleApiName} Authoring Bundle`); |
156 | 146 |
|
|
0 commit comments