From 9f630a51e80fdef276891ddba0530c7497e40915 Mon Sep 17 00:00:00 2001 From: zgjimhaziri Date: Mon, 23 Mar 2026 17:23:21 +0100 Subject: [PATCH] TA-5130: Rename reserved "--version" option to "--packageVersion" --- docs/user-guide/config-commands.md | 12 +++++++----- .../configuration-management/module.ts | 10 +++++----- .../configuration-management/module.spec.ts | 18 +++++++++--------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/docs/user-guide/config-commands.md b/docs/user-guide/config-commands.md index 922bdb7..c0dd5d0 100644 --- a/docs/user-guide/config-commands.md +++ b/docs/user-guide/config-commands.md @@ -235,13 +235,13 @@ content-cli config versions get --packageKey --packageVersion --version +content-cli config versions create --packageKey --packageVersion ``` For example, to create version 1.2.0 with a summary of changes: ```bash -content-cli config versions create --packageKey my-package --version 1.2.0 --summaryOfChanges "Added new analysis views" +content-cli config versions create --packageKey my-package --packageVersion 1.2.0 --summaryOfChanges "Added new analysis views" ``` The command will display the created version details in the console: @@ -263,14 +263,16 @@ Instead of specifying an explicit version, you can use `--versionBumpOption PATC content-cli config versions create --packageKey my-package --versionBumpOption PATCH --summaryOfChanges "Bug fixes" ``` -When using `--versionBumpOption PATCH`, the `--version` option is ignored and the patch version is automatically incremented. The default value for `--versionBumpOption` is `NONE`, which requires the `--version` option to be provided. +When using `--versionBumpOption PATCH`, the `--packageVersion` option is ignored and the patch version is automatically incremented. The default value for `--versionBumpOption` is `NONE`, which requires the `--packageVersion` option to be provided. + +Note: You must provide either `--packageVersion` or `--versionBumpOption PATCH`, but not both. #### Node Filter By default, all nodes in the package are included in the created version. To selectively include only specific nodes, use the `--nodeFilterKeys` option: ```bash -content-cli config versions create --packageKey my-package --version 2.0.0 --nodeFilterKeys node-key-1 node-key-2 +content-cli config versions create --packageKey my-package --packageVersion 2.0.0 --nodeFilterKeys node-key-1 node-key-2 ``` #### Export Created Version as JSON @@ -278,7 +280,7 @@ content-cli config versions create --packageKey my-package --version 2.0.0 --nod To export the created version response as a JSON file instead of displaying it in the console, use the `--json` option: ```bash -content-cli config versions create --packageKey --version --json +content-cli config versions create --packageKey --packageVersion --json ``` ## Finding Nodes diff --git a/src/commands/configuration-management/module.ts b/src/commands/configuration-management/module.ts index a5b93bc..b6fbb35 100644 --- a/src/commands/configuration-management/module.ts +++ b/src/commands/configuration-management/module.ts @@ -76,7 +76,7 @@ class Module extends IModule { configVersionCommand.command("create") .description("Create a new version for a package") .requiredOption("--packageKey ", "Identifier of the package") - .option("--version ", "Version string (required if versionBumpOption is NONE)") + .option("--packageVersion ", "Version string (required if versionBumpOption is NONE)") .option("--versionBumpOption ", "Version bump option: NONE or PATCH", "NONE") .option("--summaryOfChanges ", "Summary of changes for this version") .option("--nodeFilterKeys ", "Node keys to include in the version. If omitted, all nodes of the package are included.") @@ -171,19 +171,19 @@ class Module extends IModule { } private async createPackageVersion(context: Context, command: Command, options: OptionValues): Promise { - const hasExplicitVersion = !!options.version; + const hasExplicitVersion = !!options.packageVersion; const hasVersionBump = options.versionBumpOption && options.versionBumpOption !== "NONE"; if (hasExplicitVersion && hasVersionBump) { - throw new Error("Please provide either --version or --versionBumpOption, but not both."); + throw new Error("Please provide either --packageVersion or --versionBumpOption, but not both."); } if (!hasExplicitVersion && !hasVersionBump) { - throw new Error("Please provide either --version or --versionBumpOption PATCH."); + throw new Error("Please provide either --packageVersion or --versionBumpOption PATCH."); } await new PackageVersionCommandService(context).createPackageVersion( options.packageKey, - options.version, + options.packageVersion, options.versionBumpOption, options.summaryOfChanges, options.nodeFilterKeys, diff --git a/tests/commands/configuration-management/module.spec.ts b/tests/commands/configuration-management/module.spec.ts index 1d674dc..c990e5e 100644 --- a/tests/commands/configuration-management/module.spec.ts +++ b/tests/commands/configuration-management/module.spec.ts @@ -417,21 +417,21 @@ describe("Configuration Management Module - Action Validations", () => { (PackageVersionCommandService as jest.MockedClass).mockImplementation(() => mockPackageVersionCommandService); }); - it("should throw error when both --version and --versionBumpOption PATCH are provided", async () => { + it("should throw error when both --packageVersion and --versionBumpOption PATCH are provided", async () => { const options: OptionValues = { packageKey: "my-package", - version: "1.2.0", + packageVersion: "1.2.0", versionBumpOption: "PATCH", }; await expect( (module as any).createPackageVersion(testContext, mockCommand, options) - ).rejects.toThrow("Please provide either --version or --versionBumpOption, but not both."); + ).rejects.toThrow("Please provide either --packageVersion or --versionBumpOption, but not both."); expect(mockPackageVersionCommandService.createPackageVersion).not.toHaveBeenCalled(); }); - it("should throw error when neither --version nor --versionBumpOption PATCH are provided", async () => { + it("should throw error when neither --packageVersion nor --versionBumpOption PATCH are provided", async () => { const options: OptionValues = { packageKey: "my-package", versionBumpOption: "NONE", @@ -439,27 +439,27 @@ describe("Configuration Management Module - Action Validations", () => { await expect( (module as any).createPackageVersion(testContext, mockCommand, options) - ).rejects.toThrow("Please provide either --version or --versionBumpOption PATCH."); + ).rejects.toThrow("Please provide either --packageVersion or --versionBumpOption PATCH."); expect(mockPackageVersionCommandService.createPackageVersion).not.toHaveBeenCalled(); }); - it("should throw error when --version is missing and --versionBumpOption is not provided (defaults to NONE)", async () => { + it("should throw error when --packageVersion is missing and --versionBumpOption is not provided (defaults to NONE)", async () => { const options: OptionValues = { packageKey: "my-package", }; await expect( (module as any).createPackageVersion(testContext, mockCommand, options) - ).rejects.toThrow("Please provide either --version or --versionBumpOption PATCH."); + ).rejects.toThrow("Please provide either --packageVersion or --versionBumpOption PATCH."); expect(mockPackageVersionCommandService.createPackageVersion).not.toHaveBeenCalled(); }); - it("should pass validation when only --version is provided", async () => { + it("should pass validation when only --packageVersion is provided", async () => { const options: OptionValues = { packageKey: "my-package", - version: "1.2.0", + packageVersion: "1.2.0", versionBumpOption: "NONE", summaryOfChanges: "New features", };