From b9bce722fbe3369b757498b00d18fee045be9a0b Mon Sep 17 00:00:00 2001 From: Jesus Orosco Date: Tue, 24 Mar 2026 10:02:01 -0700 Subject: [PATCH 1/7] fix: version is reserved, move to package-version --- src/base/deployBase.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/base/deployBase.ts b/src/base/deployBase.ts index 7e00416..44be2ae 100644 --- a/src/base/deployBase.ts +++ b/src/base/deployBase.ts @@ -9,7 +9,7 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export type BaseDeployFlags = { name: string; - version: string; + 'package-version': string; description: string; 'package-dir': string; 'target-org': Org; @@ -37,8 +37,7 @@ export abstract class DeployBase Date: Tue, 24 Mar 2026 10:18:23 -0700 Subject: [PATCH 2/7] fix: add some function examples with the required function-invoke-option flag --- messages/deploy.md | 12 +++++++++++- src/commands/data-code-extension/function/deploy.ts | 6 ++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/messages/deploy.md b/messages/deploy.md index 2a10a1f..b6df57e 100644 --- a/messages/deploy.md +++ b/messages/deploy.md @@ -12,7 +12,7 @@ Deploys an initialized and packaged Data Cloud code extension to a Salesforce or <%= config.bin %> data-code-extension %s deploy --name my-package --package-version 1.0.0 --description "My package" --package-dir ./package --target-org myorg -- Deploy with specific a CPU size: +- Deploy with a specific CPU size: <%= config.bin %> data-code-extension %s deploy --name my-package --package-version 1.0.0 --description "My package" --package-dir ./package --target-org myorg --cpu-size CPU_4XL @@ -20,6 +20,16 @@ Deploys an initialized and packaged Data Cloud code extension to a Salesforce or <%= config.bin %> data-code-extension %s deploy --name my-package --package-version 1.0.0 --description "My package" --package-dir ./package --target-org myorg --network host +# examples.function + +- Deploy a function package to the org with alias "myorg": + + <%= config.bin %> data-code-extension function deploy --name my-package --package-version 1.0.0 --description "My package" --package-dir ./package --target-org myorg --function-invoke-opt UnstructuredChunking + +- Deploy with a specific CPU size: + + <%= config.bin %> data-code-extension function deploy --name my-package --package-version 1.0.0 --description "My package" --package-dir ./package --target-org myorg --cpu-size CPU_4XL --function-invoke-opt UnstructuredChunking + # info.checkingPython Checking Python version... diff --git a/src/commands/data-code-extension/function/deploy.ts b/src/commands/data-code-extension/function/deploy.ts index d5ebcb7..6e63157 100644 --- a/src/commands/data-code-extension/function/deploy.ts +++ b/src/commands/data-code-extension/function/deploy.ts @@ -13,10 +13,7 @@ export type FunctionDeployFlags = BaseDeployFlags & { export default class Deploy extends DeployBase { public static readonly summary = messages.getMessage('summary', ['function']); public static readonly description = messages.getMessage('description'); - public static readonly examples = messages - // eslint-disable-next-line sf-plugin/no-missing-messages - .getMessages('examples') - .map((example) => example.replace(/%s/g, 'function')); + public static readonly examples = messages.getMessages('examples.function'); public static readonly flags = { ...DeployBase.flags, @@ -24,6 +21,7 @@ export default class Deploy extends DeployBase { 'function-invoke-opt': Flags.string({ summary: messages.getMessage('flags.functionInvokeOpt.summary'), description: messages.getMessage('flags.functionInvokeOpt.description'), + options: ['UnstructuredChunking'], required: true, }), }; From 4167cb863e58f5b74f7365e116f1ed5ee2c820d3 Mon Sep 17 00:00:00 2001 From: Jesus Orosco Date: Tue, 24 Mar 2026 12:09:09 -0700 Subject: [PATCH 3/7] fix: token substitution --- src/commands/data-code-extension/function/init.ts | 9 +-------- src/commands/data-code-extension/function/run.ts | 5 +---- src/commands/data-code-extension/function/scan.ts | 12 ++++++++---- src/commands/data-code-extension/function/zip.ts | 11 +++++++---- src/commands/data-code-extension/script/init.ts | 9 +-------- src/commands/data-code-extension/script/run.ts | 3 +-- src/commands/data-code-extension/script/scan.ts | 10 ++++++++-- src/commands/data-code-extension/script/zip.ts | 9 +++++++-- 8 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/commands/data-code-extension/function/init.ts b/src/commands/data-code-extension/function/init.ts index 897f992..e0a1fdc 100644 --- a/src/commands/data-code-extension/function/init.ts +++ b/src/commands/data-code-extension/function/init.ts @@ -9,14 +9,7 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export default class Init extends InitBase { public static readonly summary = messages.getMessage('summary', ['function']); public static readonly description = messages.getMessage('description'); - public static readonly examples = ((): string[] => { - try { - // eslint-disable-next-line sf-plugin/no-missing-messages - return messages.getMessages('examples').map((example) => example.replace(/%s/g, 'function')); - } catch { - return []; - } - })(); + public static readonly examples = messages.getMessages('examples', ['function', 'function', 'function']); public static readonly flags = { ...InitBase.flags, diff --git a/src/commands/data-code-extension/function/run.ts b/src/commands/data-code-extension/function/run.ts index ae64a01..0e1827b 100644 --- a/src/commands/data-code-extension/function/run.ts +++ b/src/commands/data-code-extension/function/run.ts @@ -8,10 +8,7 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export default class Run extends RunBase { public static readonly summary = messages.getMessage('summary', ['function']); public static readonly description = messages.getMessage('description'); - public static readonly examples = messages - // eslint-disable-next-line sf-plugin/no-missing-messages - .getMessages('examples') - .map((example) => example.replace(/%s/g, 'function')); + public static readonly examples = messages.getMessages('examples', ['function', 'function', 'function', 'function']); public static readonly flags = { entrypoint: Flags.file({ diff --git a/src/commands/data-code-extension/function/scan.ts b/src/commands/data-code-extension/function/scan.ts index 3237f80..e221455 100644 --- a/src/commands/data-code-extension/function/scan.ts +++ b/src/commands/data-code-extension/function/scan.ts @@ -8,10 +8,14 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export default class Scan extends ScanBase { public static readonly summary = messages.getMessage('summary', ['function']); public static readonly description = messages.getMessage('description'); - public static readonly examples = messages - // eslint-disable-next-line sf-plugin/no-missing-messages - .getMessages('examples') - .map((example) => example.replace(/%s/g, 'function')); + public static readonly examples = messages.getMessages('examples', [ + 'function', + 'function', + 'function', + 'function', + 'function', + 'function', + ]); public static readonly flags = { entrypoint: Flags.string({ diff --git a/src/commands/data-code-extension/function/zip.ts b/src/commands/data-code-extension/function/zip.ts index c34c069..2929bfe 100644 --- a/src/commands/data-code-extension/function/zip.ts +++ b/src/commands/data-code-extension/function/zip.ts @@ -8,10 +8,13 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export default class Zip extends ZipBase { public static readonly summary = messages.getMessage('summary', ['function']); public static readonly description = messages.getMessage('description'); - public static readonly examples = messages - // eslint-disable-next-line sf-plugin/no-missing-messages - .getMessages('examples') - .map((example) => example.replace(/%s/g, 'function')); + public static readonly examples = messages.getMessages('examples', [ + 'function', + 'function', + 'function', + 'function', + 'function', + ]); public static readonly flags = { 'package-dir': Flags.directory({ diff --git a/src/commands/data-code-extension/script/init.ts b/src/commands/data-code-extension/script/init.ts index d7a624b..7343851 100644 --- a/src/commands/data-code-extension/script/init.ts +++ b/src/commands/data-code-extension/script/init.ts @@ -9,14 +9,7 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export default class Init extends InitBase { public static readonly summary = messages.getMessage('summary', ['script']); public static readonly description = messages.getMessage('description'); - public static readonly examples = ((): string[] => { - try { - // eslint-disable-next-line sf-plugin/no-missing-messages - return messages.getMessages('examples').map((example) => example.replace(/%s/g, 'script')); - } catch { - return []; - } - })(); + public static readonly examples = messages.getMessages('examples', ['script', 'script', 'script']); public static readonly flags = { ...InitBase.flags, diff --git a/src/commands/data-code-extension/script/run.ts b/src/commands/data-code-extension/script/run.ts index 91cffa4..5d4d5a8 100644 --- a/src/commands/data-code-extension/script/run.ts +++ b/src/commands/data-code-extension/script/run.ts @@ -8,8 +8,7 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export default class Run extends RunBase { public static readonly summary = messages.getMessage('summary', ['script']); public static readonly description = messages.getMessage('description'); - // eslint-disable-next-line sf-plugin/no-missing-messages - public static readonly examples = messages.getMessages('examples').map((example) => example.replace(/%s/g, 'script')); + public static readonly examples = messages.getMessages('examples', ['script', 'script', 'script', 'script']); public static readonly flags = { entrypoint: Flags.file({ diff --git a/src/commands/data-code-extension/script/scan.ts b/src/commands/data-code-extension/script/scan.ts index d3c05a3..2301cad 100644 --- a/src/commands/data-code-extension/script/scan.ts +++ b/src/commands/data-code-extension/script/scan.ts @@ -8,8 +8,14 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export default class Scan extends ScanBase { public static readonly summary = messages.getMessage('summary', ['script']); public static readonly description = messages.getMessage('description'); - // eslint-disable-next-line sf-plugin/no-missing-messages - public static readonly examples = messages.getMessages('examples').map((example) => example.replace(/%s/g, 'script')); + public static readonly examples = messages.getMessages('examples', [ + 'script', + 'script', + 'script', + 'script', + 'script', + 'script', + ]); public static readonly flags = { entrypoint: Flags.string({ diff --git a/src/commands/data-code-extension/script/zip.ts b/src/commands/data-code-extension/script/zip.ts index 3d4343a..c3eb6a6 100644 --- a/src/commands/data-code-extension/script/zip.ts +++ b/src/commands/data-code-extension/script/zip.ts @@ -8,8 +8,13 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export default class Zip extends ZipBase { public static readonly summary = messages.getMessage('summary', ['script']); public static readonly description = messages.getMessage('description'); - // eslint-disable-next-line sf-plugin/no-missing-messages - public static readonly examples = messages.getMessages('examples').map((example) => example.replace(/%s/g, 'script')); + public static readonly examples = messages.getMessages('examples', [ + 'script', + 'script', + 'script', + 'script', + 'script', + ]); public static readonly flags = { 'package-dir': Flags.directory({ From a446735a60d56468139ffb159d171b874933ebaa Mon Sep 17 00:00:00 2001 From: Jesus Orosco Date: Tue, 24 Mar 2026 12:17:10 -0700 Subject: [PATCH 4/7] fix: hide global variables the recommended way --- src/base/deployBase.ts | 5 ++--- src/base/initBase.ts | 5 ++--- src/base/runBase.ts | 5 ++--- src/base/scanBase.ts | 4 +--- src/base/types.ts | 16 ---------------- src/base/zipBase.ts | 5 ++--- 6 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/base/deployBase.ts b/src/base/deployBase.ts index 44be2ae..1702d72 100644 --- a/src/base/deployBase.ts +++ b/src/base/deployBase.ts @@ -2,7 +2,7 @@ import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; import { Messages, Org } from '@salesforce/core'; import { DatacodeBinaryExecutor, type DatacodeDeployExecutionResult } from '../utils/datacodeBinaryExecutor.js'; import { checkEnvironment } from '../utils/environmentChecker.js'; -import { sharedBaseFlags, type SharedResultProps } from './types.js'; +import { type SharedResultProps } from './types.js'; Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', 'deploy'); @@ -27,8 +27,7 @@ export type DeployResult = SharedResultProps & { // eslint-disable-next-line sf-plugin/command-summary, sf-plugin/command-example export abstract class DeployBase extends SfCommand { - // Override baseFlags to hide global flags - public static readonly baseFlags = sharedBaseFlags; + public static enableJsonFlag = false; public static readonly flags = { name: Flags.string({ diff --git a/src/base/initBase.ts b/src/base/initBase.ts index e8478d1..b9ef9d9 100644 --- a/src/base/initBase.ts +++ b/src/base/initBase.ts @@ -2,7 +2,7 @@ import { SfCommand } from '@salesforce/sf-plugins-core'; import { Messages } from '@salesforce/core'; import { DatacodeBinaryExecutor, type DatacodeInitExecutionResult } from '../utils/datacodeBinaryExecutor.js'; import { checkEnvironment } from '../utils/environmentChecker.js'; -import { sharedBaseFlags, type SharedResultProps } from './types.js'; +import { type SharedResultProps } from './types.js'; export type BaseInitFlags = { 'package-dir': string; @@ -14,8 +14,7 @@ export type InitResult = SharedResultProps & { // eslint-disable-next-line sf-plugin/command-summary, sf-plugin/command-example export abstract class InitBase extends SfCommand { - // Override baseFlags to hide global flags - public static readonly baseFlags = sharedBaseFlags; + public static enableJsonFlag = false; public async run(): Promise { const { flags } = (await this.parse(this.constructor as typeof InitBase)) as unknown as { flags: BaseInitFlags }; diff --git a/src/base/runBase.ts b/src/base/runBase.ts index 3c7c1d1..9a39078 100644 --- a/src/base/runBase.ts +++ b/src/base/runBase.ts @@ -2,7 +2,7 @@ import { SfCommand } from '@salesforce/sf-plugins-core'; import { Messages, Org } from '@salesforce/core'; import { DatacodeBinaryExecutor, type DatacodeRunExecutionResult } from '../utils/datacodeBinaryExecutor.js'; import { checkEnvironment } from '../utils/environmentChecker.js'; -import { sharedBaseFlags, type SharedResultProps } from './types.js'; +import { type SharedResultProps } from './types.js'; export type BaseRunFlags = { entrypoint: string; @@ -20,8 +20,7 @@ export type RunResult = SharedResultProps & { // eslint-disable-next-line sf-plugin/command-summary, sf-plugin/command-example export abstract class RunBase extends SfCommand { - // Override baseFlags to hide global flags - public static readonly baseFlags = sharedBaseFlags; + public static enableJsonFlag = false; public async run(): Promise { const { flags } = (await this.parse(this.constructor as typeof RunBase)) as unknown as { flags: BaseRunFlags }; diff --git a/src/base/scanBase.ts b/src/base/scanBase.ts index 013bc0e..fa55c6d 100644 --- a/src/base/scanBase.ts +++ b/src/base/scanBase.ts @@ -2,7 +2,6 @@ import { SfCommand } from '@salesforce/sf-plugins-core'; import { Messages } from '@salesforce/core'; import { DatacodeBinaryExecutor, type ScanResult } from '../utils/datacodeBinaryExecutor.js'; import { checkEnvironment } from '../utils/environmentChecker.js'; -import { sharedBaseFlags } from './types.js'; export type BaseScanFlags = { entrypoint?: string; @@ -13,8 +12,7 @@ export type BaseScanFlags = { // eslint-disable-next-line sf-plugin/command-summary, sf-plugin/command-example export abstract class ScanBase extends SfCommand { - // Override baseFlags to hide global flags - public static readonly baseFlags = sharedBaseFlags; + public static enableJsonFlag = false; public async run(): Promise { const { flags } = (await this.parse(this.constructor as typeof ScanBase)) as unknown as { flags: BaseScanFlags }; diff --git a/src/base/types.ts b/src/base/types.ts index 3c71ff4..d2ed8c5 100644 --- a/src/base/types.ts +++ b/src/base/types.ts @@ -1,23 +1,7 @@ -import { SfCommand, Flags } from '@salesforce/sf-plugins-core'; import { type PythonVersionInfo } from '../utils/pythonChecker.js'; import { type PipPackageInfo } from '../utils/pipChecker.js'; import { type DatacodeBinaryInfo } from '../utils/datacodeBinaryChecker.js'; -// eslint-disable-next-line sf-plugin/no-hardcoded-messages-flags, sf-plugin/no-json-flag -export const sharedBaseFlags = { - ...SfCommand.baseFlags, - 'flags-dir': Flags.directory({ - summary: 'Import flag values from a directory.', - helpGroup: 'GLOBAL', - hidden: false, - }), - json: Flags.boolean({ - summary: 'Format output as json.', - helpGroup: 'GLOBAL', - hidden: true, - }), -}; - export type SharedResultProps = { success: boolean; pythonVersion: PythonVersionInfo; diff --git a/src/base/zipBase.ts b/src/base/zipBase.ts index 8e6ade0..1b11e85 100644 --- a/src/base/zipBase.ts +++ b/src/base/zipBase.ts @@ -3,7 +3,7 @@ import { SfCommand } from '@salesforce/sf-plugins-core'; import { Messages, SfError } from '@salesforce/core'; import { DatacodeBinaryExecutor, type DatacodeZipExecutionResult } from '../utils/datacodeBinaryExecutor.js'; import { checkEnvironment } from '../utils/environmentChecker.js'; -import { sharedBaseFlags, type SharedResultProps } from './types.js'; +import { type SharedResultProps } from './types.js'; export type BaseZipFlags = { 'package-dir': string; @@ -17,8 +17,7 @@ export type ZipResult = SharedResultProps & { // eslint-disable-next-line sf-plugin/command-summary, sf-plugin/command-example export abstract class ZipBase extends SfCommand { - // Override baseFlags to hide global flags - public static readonly baseFlags = sharedBaseFlags; + public static enableJsonFlag = false; public async run(): Promise { const { flags } = (await this.parse(this.constructor as typeof ZipBase)) as unknown as { flags: BaseZipFlags }; From 3b04d8808db423e5283a5fd9e4ec80d10bc6532e Mon Sep 17 00:00:00 2001 From: Jesus Orosco Date: Tue, 24 Mar 2026 13:24:05 -0700 Subject: [PATCH 5/7] fix: failing tests after various changes --- src/base/deployBase.ts | 6 +-- .../data-code-extension/deploy.test.ts | 11 ++-- .../commands/data-code-extension/init.test.ts | 53 ++++++++++++++++--- .../commands/data-code-extension/scan.test.ts | 2 +- test/commands/data-code-extension/zip.test.ts | 41 ++++++++++---- 5 files changed, 87 insertions(+), 26 deletions(-) diff --git a/src/base/deployBase.ts b/src/base/deployBase.ts index 1702d72..c46d80b 100644 --- a/src/base/deployBase.ts +++ b/src/base/deployBase.ts @@ -9,7 +9,7 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export type BaseDeployFlags = { name: string; - 'package-version': string; + version: string; description: string; 'package-dir': string; 'target-org': Org; @@ -36,7 +36,7 @@ export abstract class DeployBase { '--target-org', 'test@example.com', '--function-invoke-opt', - 'sync', + 'UnstructuredChunking', ]); expect(sfCommandStubs.log.calledWith('Data Code Extension deployment completed successfully!')).to.be.true; @@ -233,10 +233,10 @@ describe('data-code-extension deploy', () => { '--target-org', 'test@example.com', '--function-invoke-opt', - 'sync', + 'UnstructuredChunking', ]); - expect(binaryDeployStub.firstCall.args[7]).to.equal('sync'); + expect(binaryDeployStub.firstCall.args[7]).to.equal('UnstructuredChunking'); }); it('should validate CPU size options', async () => { @@ -278,7 +278,7 @@ describe('data-code-extension deploy', () => { '--target-org', 'test@example.com', '--function-invoke-opt', - 'sync', + 'UnstructuredChunking', ]); expect.fail('Should have thrown an error'); } catch (error) { @@ -303,7 +303,7 @@ describe('data-code-extension deploy', () => { '--target-org', 'test@example.com', '--function-invoke-opt', - 'sync', + 'UnstructuredChunking', ]); expect.fail('Should have thrown an error'); } catch (error) { @@ -360,7 +360,6 @@ describe('data-code-extension deploy', () => { testDir, '--target-org', 'test@example.com', - '--json', ]); expect(result).to.have.property('success', true); diff --git a/test/commands/data-code-extension/init.test.ts b/test/commands/data-code-extension/init.test.ts index 845634a..4d31640 100644 --- a/test/commands/data-code-extension/init.test.ts +++ b/test/commands/data-code-extension/init.test.ts @@ -66,7 +66,17 @@ describe('data-code-extension init commands', () => { // If Python 3.11+ is not installed, pip package is missing, binary is not found, or init fails, verify the error is handled correctly expect(error).to.have.property('name'); if (error instanceof Error) { - expect(error.name).to.be.oneOf(['PythonNotFound', 'PythonVersionMismatch', 'PipNotFound', 'PackageNotInstalled', 'BinaryNotFound', 'BinaryNotExecutable', 'InitPermissionDenied', 'InitDirectoryExists', 'InitExecutionFailed']); + expect(error.name).to.be.oneOf([ + 'PythonNotFound', + 'PythonVersionMismatch', + 'PipNotFound', + 'PackageNotInstalled', + 'BinaryNotFound', + 'BinaryNotExecutable', + 'InitPermissionDenied', + 'InitDirectoryExists', + 'InitExecutionFailed', + ]); expect(error.message).to.be.a('string'); if ('actions' in error && error.actions) { expect(error.actions).to.be.an('array'); @@ -75,9 +85,9 @@ describe('data-code-extension init commands', () => { } }); - it('returns JSON result when --json flag is used for script init', async () => { + it('returns structured result for script init', async () => { try { - const result = await ScriptInit.run(['--json', '--package-dir', './test-json']); + const result = await ScriptInit.run(['--package-dir', './test-json']); // Should return a structured result expect(result).to.be.an('object'); @@ -86,7 +96,6 @@ describe('data-code-extension init commands', () => { expect(result).to.have.property('message'); // packageInfo may or may not be present depending on whether package is installed } catch (error) { - // Even errors should be structured when using --json expect(error).to.have.property('name'); if (error instanceof Error) { expect(error.name).to.be.a('string'); @@ -104,7 +113,17 @@ describe('data-code-extension init commands', () => { } catch (error) { // Handle case where Python is not installed if (error instanceof Error) { - expect(error.name).to.be.oneOf(['PythonNotFound', 'PythonVersionMismatch', 'PipNotFound', 'PackageNotInstalled', 'BinaryNotFound', 'BinaryNotExecutable', 'InitPermissionDenied', 'InitDirectoryExists', 'InitExecutionFailed']); + expect(error.name).to.be.oneOf([ + 'PythonNotFound', + 'PythonVersionMismatch', + 'PipNotFound', + 'PackageNotInstalled', + 'BinaryNotFound', + 'BinaryNotExecutable', + 'InitPermissionDenied', + 'InitDirectoryExists', + 'InitExecutionFailed', + ]); } } }); @@ -117,7 +136,17 @@ describe('data-code-extension init commands', () => { } catch (error) { // Handle case where Python is not installed if (error instanceof Error) { - expect(error.name).to.be.oneOf(['PythonNotFound', 'PythonVersionMismatch', 'PipNotFound', 'PackageNotInstalled', 'BinaryNotFound', 'BinaryNotExecutable', 'InitPermissionDenied', 'InitDirectoryExists', 'InitExecutionFailed']); + expect(error.name).to.be.oneOf([ + 'PythonNotFound', + 'PythonVersionMismatch', + 'PipNotFound', + 'PackageNotInstalled', + 'BinaryNotFound', + 'BinaryNotExecutable', + 'InitPermissionDenied', + 'InitDirectoryExists', + 'InitExecutionFailed', + ]); } } }); @@ -130,7 +159,17 @@ describe('data-code-extension init commands', () => { } catch (error) { // Handle case where Python is not installed if (error instanceof Error) { - expect(error.name).to.be.oneOf(['PythonNotFound', 'PythonVersionMismatch', 'PipNotFound', 'PackageNotInstalled', 'BinaryNotFound', 'BinaryNotExecutable', 'InitPermissionDenied', 'InitDirectoryExists', 'InitExecutionFailed']); + expect(error.name).to.be.oneOf([ + 'PythonNotFound', + 'PythonVersionMismatch', + 'PipNotFound', + 'PackageNotInstalled', + 'BinaryNotFound', + 'BinaryNotExecutable', + 'InitPermissionDenied', + 'InitDirectoryExists', + 'InitExecutionFailed', + ]); } } }); diff --git a/test/commands/data-code-extension/scan.test.ts b/test/commands/data-code-extension/scan.test.ts index 28e019a..ec6d45b 100644 --- a/test/commands/data-code-extension/scan.test.ts +++ b/test/commands/data-code-extension/scan.test.ts @@ -360,7 +360,7 @@ describe('data-code-extension scan commands', () => { filesScanned: ['main.py'], }); - const result = await ScriptScan.run(['--json']); + const result = await ScriptScan.run([]); expect(result).to.be.an('object'); expect(result.success).to.be.true; diff --git a/test/commands/data-code-extension/zip.test.ts b/test/commands/data-code-extension/zip.test.ts index 6cc34d2..4b1b1f7 100644 --- a/test/commands/data-code-extension/zip.test.ts +++ b/test/commands/data-code-extension/zip.test.ts @@ -71,7 +71,20 @@ describe('data-code-extension zip commands', () => { expect(error).to.have.property('name'); if (error instanceof Error) { // Check for various error types including generic Error from missing directory - expect(error.name).to.be.oneOf(['Error', 'PythonNotFound', 'PythonVersionMismatch', 'PipNotFound', 'PackageNotInstalled', 'BinaryNotFound', 'BinaryNotExecutable', 'ZipPermissionDenied', 'PackageDirNotFound', 'NotInitializedPackage', 'InsufficientDiskSpace', 'ZipExecutionFailed']); + expect(error.name).to.be.oneOf([ + 'Error', + 'PythonNotFound', + 'PythonVersionMismatch', + 'PipNotFound', + 'PackageNotInstalled', + 'BinaryNotFound', + 'BinaryNotExecutable', + 'ZipPermissionDenied', + 'PackageDirNotFound', + 'NotInitializedPackage', + 'InsufficientDiskSpace', + 'ZipExecutionFailed', + ]); expect(error.message).to.be.a('string'); if ('actions' in error && error.actions) { expect(error.actions).to.be.an('array'); @@ -94,9 +107,9 @@ describe('data-code-extension zip commands', () => { } }); - it('returns JSON result when --json flag is used for script zip', async () => { + it('returns structured result for script zip', async () => { try { - const result = await ScriptZip.run(['--json', '--package-dir', './test-json']); + const result = await ScriptZip.run(['--package-dir', './test-json']); // Should return a structured result expect(result).to.be.an('object'); @@ -106,7 +119,6 @@ describe('data-code-extension zip commands', () => { expect(result).to.have.property('packageDir'); // archivePath may or may not be present depending on whether zip succeeded } catch (error) { - // Even errors should be structured when using --json expect(error).to.have.property('name'); if (error instanceof Error) { expect(error.name).to.be.a('string'); @@ -153,7 +165,19 @@ describe('data-code-extension zip commands', () => { // Handle errors gracefully expect(error).to.have.property('name'); if (error instanceof Error) { - expect(error.name).to.be.oneOf(['PythonNotFound', 'PythonVersionMismatch', 'PipNotFound', 'PackageNotInstalled', 'BinaryNotFound', 'BinaryNotExecutable', 'ZipPermissionDenied', 'PackageDirNotFound', 'NotInitializedPackage', 'InsufficientDiskSpace', 'ZipExecutionFailed']); + expect(error.name).to.be.oneOf([ + 'PythonNotFound', + 'PythonVersionMismatch', + 'PipNotFound', + 'PackageNotInstalled', + 'BinaryNotFound', + 'BinaryNotExecutable', + 'ZipPermissionDenied', + 'PackageDirNotFound', + 'NotInitializedPackage', + 'InsufficientDiskSpace', + 'ZipExecutionFailed', + ]); expect(error.message).to.be.a('string'); } } @@ -173,9 +197,9 @@ describe('data-code-extension zip commands', () => { } }); - it('returns JSON result when --json flag is used for function zip', async () => { + it('returns structured result for function zip', async () => { try { - const result = await FunctionZip.run(['--json', '--package-dir', './test-function-json']); + const result = await FunctionZip.run(['--package-dir', './test-function-json']); // Should return a structured result expect(result).to.be.an('object'); @@ -184,7 +208,6 @@ describe('data-code-extension zip commands', () => { expect(result).to.have.property('message'); expect(result).to.have.property('packageDir'); } catch (error) { - // Even errors should be structured when using --json expect(error).to.have.property('name'); if (error instanceof Error) { expect(error.name).to.be.a('string'); @@ -192,4 +215,4 @@ describe('data-code-extension zip commands', () => { } } }); -}); \ No newline at end of file +}); From f11c67e9f4ca3f585512462804955e3b5dbf45ab Mon Sep 17 00:00:00 2001 From: Jesus Orosco Date: Tue, 24 Mar 2026 15:25:35 -0700 Subject: [PATCH 6/7] fix: package-version not version --- messages/deploy.md | 4 +-- src/base/deployBase.ts | 10 +++--- .../data-code-extension/deploy.test.ts | 34 +++++++++---------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/messages/deploy.md b/messages/deploy.md index b6df57e..b4125a6 100644 --- a/messages/deploy.md +++ b/messages/deploy.md @@ -98,11 +98,11 @@ Name of the package to deploy. The unique name identifier for your Data Cloud custom code package. This name is used to identify the deployment in your Salesforce org. -# flags.version.summary +# flags.packageVersion.summary Version of the package to deploy. -# flags.version.description +# flags.packageVersion.description The version string for your package deployment. Use semantic versioning (such as 1.0.0) to track different releases of your code. diff --git a/src/base/deployBase.ts b/src/base/deployBase.ts index c46d80b..5fe4e33 100644 --- a/src/base/deployBase.ts +++ b/src/base/deployBase.ts @@ -9,7 +9,7 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export type BaseDeployFlags = { name: string; - version: string; + 'package-version': string; description: string; 'package-dir': string; 'target-org': Org; @@ -36,9 +36,9 @@ export abstract class DeployBase { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -115,7 +115,7 @@ describe('data-code-extension deploy', () => { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -134,7 +134,7 @@ describe('data-code-extension deploy', () => { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -157,7 +157,7 @@ describe('data-code-extension deploy', () => { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -181,7 +181,7 @@ describe('data-code-extension deploy', () => { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -203,7 +203,7 @@ describe('data-code-extension deploy', () => { await FunctionDeploy.run([ '--name', 'test-function', - '--version', + '--package-version', '1.0.0', '--description', 'Test function deployment', @@ -224,7 +224,7 @@ describe('data-code-extension deploy', () => { await FunctionDeploy.run([ '--name', 'test-function', - '--version', + '--package-version', '1.0.0', '--description', 'Test function deployment', @@ -244,7 +244,7 @@ describe('data-code-extension deploy', () => { await FunctionDeploy.run([ '--name', 'test-function', - '--version', + '--package-version', '1.0.0', '--description', 'Test function deployment', @@ -269,7 +269,7 @@ describe('data-code-extension deploy', () => { await FunctionDeploy.run([ '--name', 'test-function', - '--version', + '--package-version', '1.0.0', '--description', 'Test function deployment', @@ -294,7 +294,7 @@ describe('data-code-extension deploy', () => { await FunctionDeploy.run([ '--name', 'test-function', - '--version', + '--package-version', '1.0.0', '--description', 'Test function deployment', @@ -318,7 +318,7 @@ describe('data-code-extension deploy', () => { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -335,7 +335,7 @@ describe('data-code-extension deploy', () => { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -352,7 +352,7 @@ describe('data-code-extension deploy', () => { const result = await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -378,7 +378,7 @@ describe('data-code-extension deploy', () => { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -410,7 +410,7 @@ describe('data-code-extension deploy', () => { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -441,7 +441,7 @@ describe('data-code-extension deploy', () => { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', @@ -472,7 +472,7 @@ describe('data-code-extension deploy', () => { await ScriptDeploy.run([ '--name', 'test-script', - '--version', + '--package-version', '1.0.0', '--description', 'Test script deployment', From 04ccd03a97d8d30bc1853f0ea910dab007c34108 Mon Sep 17 00:00:00 2001 From: Jesus Orosco Date: Tue, 24 Mar 2026 15:27:48 -0700 Subject: [PATCH 7/7] fix: token replace --- messages/deploy.md | 14 ++++++++++++++ src/commands/data-code-extension/script/deploy.ts | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/messages/deploy.md b/messages/deploy.md index b4125a6..40028ec 100644 --- a/messages/deploy.md +++ b/messages/deploy.md @@ -20,6 +20,20 @@ Deploys an initialized and packaged Data Cloud code extension to a Salesforce or <%= config.bin %> data-code-extension %s deploy --name my-package --package-version 1.0.0 --description "My package" --package-dir ./package --target-org myorg --network host +# examples.script + +- Deploy a script package to the org with alias "myorg": + + <%= config.bin %> data-code-extension script deploy --name my-package --package-version 1.0.0 --description "My package" --package-dir ./package --target-org myorg + +- Deploy with a specific CPU size: + + <%= config.bin %> data-code-extension script deploy --name my-package --package-version 1.0.0 --description "My package" --package-dir ./package --target-org myorg --cpu-size CPU_4XL + +- Deploy with network configuration for Jupyter notebooks: + + <%= config.bin %> data-code-extension script deploy --name my-package --package-version 1.0.0 --description "My package" --package-dir ./package --target-org myorg --network host + # examples.function - Deploy a function package to the org with alias "myorg": diff --git a/src/commands/data-code-extension/script/deploy.ts b/src/commands/data-code-extension/script/deploy.ts index 955b3eb..61c6d0c 100644 --- a/src/commands/data-code-extension/script/deploy.ts +++ b/src/commands/data-code-extension/script/deploy.ts @@ -8,8 +8,7 @@ const messages = Messages.loadMessages('@salesforce/plugin-data-code-extension', export default class Deploy extends DeployBase { public static readonly summary = messages.getMessage('summary', ['script']); public static readonly description = messages.getMessage('description'); - // eslint-disable-next-line sf-plugin/no-missing-messages - public static readonly examples = messages.getMessages('examples').map((example) => example.replace(/%s/g, 'script')); + public static readonly examples = messages.getMessages('examples.script'); public static readonly flags = { ...DeployBase.flags,