From 065ed7d3d12f3e20bc79b7e8fc07ec637f1aace4 Mon Sep 17 00:00:00 2001 From: emileta Date: Mon, 27 Apr 2026 11:48:16 -0300 Subject: [PATCH 1/3] feat: add --verbose and --concise flags to agent publish authoring-bundle --- messages/agent.publish.authoring-bundle.md | 16 +++++ schemas/agent-publish-authoring__bundle.json | 25 ++++++++ .../agent/publish/authoring-bundle.ts | 62 +++++++++++++++++++ 3 files changed, 103 insertions(+) diff --git a/messages/agent.publish.authoring-bundle.md b/messages/agent.publish.authoring-bundle.md index f5c40e83..dc4eab1b 100644 --- a/messages/agent.publish.authoring-bundle.md +++ b/messages/agent.publish.authoring-bundle.md @@ -20,6 +20,14 @@ This command uses the API name of the authoring bundle. <%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --target-org my-dev-org +- Publish with verbose output to see all retrieved and deployed metadata components: + + <%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --verbose + +- Publish with concise output showing only essential information: + + <%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --concise + # flags.api-name.summary API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from. @@ -32,6 +40,14 @@ API name of the authoring bundle to publish Don't retrieve the metadata associated with the agent to your DX project. +# flags.verbose.summary + +Display detailed output showing all metadata components retrieved and deployed during the publish process. + +# flags.concise.summary + +Display minimal output with only essential information about the publish operation. + # error.missingRequiredFlags Required flag(s) missing: %s. diff --git a/schemas/agent-publish-authoring__bundle.json b/schemas/agent-publish-authoring__bundle.json index 33b3777b..3a5df5c6 100644 --- a/schemas/agent-publish-authoring__bundle.json +++ b/schemas/agent-publish-authoring__bundle.json @@ -16,6 +16,31 @@ "items": { "type": "string" } + }, + "retrievedComponents": { + "type": "array", + "items": { + "type": "string" + } + }, + "deployedComponents": { + "type": "array", + "items": { + "type": "string" + } + }, + "summary": { + "type": "object", + "properties": { + "retrieved": { + "type": "number" + }, + "deployed": { + "type": "number" + } + }, + "required": ["retrieved", "deployed"], + "additionalProperties": false } }, "required": ["success"], diff --git a/src/commands/agent/publish/authoring-bundle.ts b/src/commands/agent/publish/authoring-bundle.ts index b7e3cf5d..8375b833 100644 --- a/src/commands/agent/publish/authoring-bundle.ts +++ b/src/commands/agent/publish/authoring-bundle.ts @@ -30,6 +30,12 @@ export type AgentPublishAuthoringBundleResult = { success: boolean; botDeveloperName?: string; errors?: string[]; + retrievedComponents?: string[]; + deployedComponents?: string[]; + summary?: { + retrieved: number; + deployed: number; + }; }; export default class AgentPublishAuthoringBundle extends SfCommand { @@ -48,6 +54,15 @@ export default class AgentPublishAuthoringBundle extends SfCommand({ stages: ['Validate Bundle', 'Publish Agent', 'Retrieve Metadata', 'Deploy Metadata'], @@ -137,11 +157,42 @@ export default class AgentPublishAuthoringBundle extends SfCommand { + const componentName = `${fp.type}${fp.fullName ? `:${fp.fullName}` : ''}`; + retrievedComponents.push(componentName); + }); + + // Display retrieved components based on output mode + if (outputMode === 'verbose' && !this.jsonEnabled()) { + this.log(`${EOL}Retrieved metadata components:`); + retrievedComponents.forEach((comp) => this.log(` • ${comp}`)); + } else if (outputMode === 'normal' && !this.jsonEnabled()) { + this.log(`${EOL}Retrieved ${retrievedComponents.length} metadata component(s)`); + } + return Promise.resolve(); }); Lifecycle.getInstance().on('scopedPostDeploy', (result: ScopedPostDeploy) => { if (result.deployResult.response.status === RequestStatus.Succeeded) { + // Capture deployed components + const deployedFiles = ensureArray(result.deployResult.response.details?.componentSuccesses ?? []); + deployedFiles.forEach((comp) => { + const componentName = `${String(comp.componentType)}${comp.fullName ? `:${String(comp.fullName)}` : ''}`; + deployedComponents.push(componentName); + }); + + // Display deployed components based on output mode + if (outputMode === 'verbose' && !this.jsonEnabled()) { + this.log(`${EOL}Deployed metadata components:`); + deployedComponents.forEach((comp) => this.log(` • ${comp}`)); + } else if (outputMode === 'normal' && !this.jsonEnabled()) { + this.log(`${EOL}Deployed ${deployedComponents.length} metadata component(s)`); + } + mso.stop(); } else { const deployResponse = result.deployResult.response; @@ -159,9 +210,20 @@ export default class AgentPublishAuthoringBundle extends SfCommand Date: Mon, 27 Apr 2026 12:23:03 -0300 Subject: [PATCH 2/3] chore: update command snapshot for --verbose and --concise flags --- command-snapshot.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command-snapshot.json b/command-snapshot.json index 050e1343..2fb042a4 100644 --- a/command-snapshot.json +++ b/command-snapshot.json @@ -157,8 +157,8 @@ "alias": [], "command": "agent:publish:authoring-bundle", "flagAliases": [], - "flagChars": ["n", "o"], - "flags": ["api-name", "api-version", "flags-dir", "json", "skip-retrieve", "target-org"], + "flagChars": ["n", "o", "v"], + "flags": ["api-name", "api-version", "concise", "flags-dir", "json", "skip-retrieve", "target-org", "verbose"], "plugin": "@salesforce/plugin-agent" }, { From 28fe2f1eddc66cbcd6397743bbb1b47fbcbc9d34 Mon Sep 17 00:00:00 2001 From: emileta Date: Tue, 28 Apr 2026 16:41:01 -0300 Subject: [PATCH 3/3] test: add NUTs for --verbose and --concise flags on agent publish authoring-bundle --- test/nuts/z2.agent.publish.nut.ts | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/test/nuts/z2.agent.publish.nut.ts b/test/nuts/z2.agent.publish.nut.ts index 133edb44..3ed76f01 100644 --- a/test/nuts/z2.agent.publish.nut.ts +++ b/test/nuts/z2.agent.publish.nut.ts @@ -218,4 +218,51 @@ describe('agent publish authoring-bundle NUTs', function () { expect(output).to.include('Deploy Metadata'); expect(output).to.include(`Agent Name: ${bundleApiName}`); }); + + it('should display detailed component listing with --verbose flag', async function () { + this.timeout(30 * 60 * 1000); + this.retries(1); + + const result = execCmd( + `agent publish authoring-bundle --api-name ${bundleApiName} --target-org ${getUsername()} --verbose`, + { ensureExitCode: 0 } + ); + + const output = result.shellOutput.stdout; + expect(output).to.include('Retrieved metadata components:'); + expect(output).to.include('Deployed metadata components:'); + expect(output).to.match(/•\s+\w/); + }); + + it('should include retrievedComponents and deployedComponents in JSON output with --verbose flag', async function () { + this.timeout(30 * 60 * 1000); + this.retries(1); + + const result = execCmd( + `agent publish authoring-bundle --api-name ${bundleApiName} --target-org ${getUsername()} --verbose --json`, + { ensureExitCode: 0 } + ).jsonOutput?.result; + + expect(result).to.be.ok; + expect(result?.success).to.be.true; + expect(result?.retrievedComponents).to.be.an('array'); + expect(result?.deployedComponents).to.be.an('array'); + expect(result?.retrievedComponents?.length).to.be.greaterThan(0); + expect(result?.deployedComponents?.length).to.be.greaterThan(0); + }); + + it('should suppress component counts and success message with --concise flag', async function () { + this.timeout(30 * 60 * 1000); + this.retries(1); + + const result = execCmd( + `agent publish authoring-bundle --api-name ${bundleApiName} --target-org ${getUsername()} --concise`, + { ensureExitCode: 0 } + ); + + const output = result.shellOutput.stdout; + expect(output).to.not.match(/Retrieved \d+ metadata component/); + expect(output).to.not.match(/Deployed \d+ metadata component/); + expect(output).to.not.include('published successfully'); + }); });