@trayai/tray-sync-cli 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -17,6 +17,7 @@ import { computeNextVersionNumber, createProjectVersion, getLatestProjectVersion
17
17
  import { resolveToken } from "../lib/tokenResolution.js";
18
18
  import { isUuid } from "../lib/uuid.js";
19
19
  import { OutputFormats, parseFormat } from "../lib/outputFormat.js";
20
+ import { parseVersionNumber } from "../lib/versionNumber.js";
20
21
  import { checkProjectDrift, DriftStatuses } from "./status.js";
21
22
  import { printError, printInvalidAuthMappings, printLocalDrift, printMutuallyExclusiveMajorAndVersion, printMutuallyExclusiveResumeAndProject, printNoTargetProjectMapped, printProjectError, printProjectImportImpact, printProjectNoStateFile, printProjectNotPulledLocally, printPromoted, printTargetEnvNotFound, printTrayYamlNotFound, printUnresolvedRequirements, printVersionCreationFailed, printWouldBePromoted, } from "../views/promote/promote.v2.js";
22
23
  import { printPromoteResultJson } from "../views/promote/shared.js";
@@ -289,7 +290,9 @@ export const promoteCommand = new Command("promote")
289
290
  .option("--auto-create-projects", "create the target project when no mapping exists yet")
290
291
  .addOption(new Option("--no-version", "skip creating a target project version after import").helpGroup("Version options:"))
291
292
  .addOption(new Option("--major", "bump the major version instead of minor").helpGroup("Version options:"))
292
- .addOption(new Option("--version-number <major.minor>", "explicit target version number (overrides --major)").helpGroup("Version options:"))
293
+ .addOption(new Option("--version-number <major.minor>", "explicit target version number (overrides --major)")
294
+ .argParser(parseVersionNumber)
295
+ .helpGroup("Version options:"))
293
296
  .addOption(new Option("--version-title <title>", "title for the created version").helpGroup("Version options:"))
294
297
  .addOption(new Option("--version-description <description>", "description for the created version (auto-generated from promotion impact if omitted)").helpGroup("Version options:"))
295
298
  .option("-t, --token <token>", "Tray API token (used for both source and target)")
@@ -0,0 +1,12 @@
1
+ import { InvalidArgumentError } from "commander";
2
+ const VERSION_NUMBER_RE = /^\d+\.\d+$/;
3
+ export function isVersionNumber(value) {
4
+ return VERSION_NUMBER_RE.test(value);
5
+ }
6
+ export function parseVersionNumber(value) {
7
+ if (!isVersionNumber(value)) {
8
+ throw new InvalidArgumentError("version must be in major.minor format (e.g. 1.0)");
9
+ }
10
+ return value;
11
+ }
12
+ //# sourceMappingURL=versionNumber.js.map
@@ -5,7 +5,7 @@ export function printMutuallyExclusiveResumeAndProject(stderr) {
5
5
  stderr(`${FAILURE_ICON} ${ansis.bold("--resume")} and ${ansis.bold("--project")} are mutually exclusive.`);
6
6
  }
7
7
  export function printMutuallyExclusiveMajorAndVersion(stderr) {
8
- stderr(`${FAILURE_ICON} ${ansis.bold("--major")} and ${ansis.bold("--version")} are mutually exclusive.`);
8
+ stderr(`${FAILURE_ICON} ${ansis.bold("--major")} and ${ansis.bold("--version-number")} are mutually exclusive.`);
9
9
  }
10
10
  export function printTrayYamlNotFound(stderr) {
11
11
  stderr(`${FAILURE_ICON} tray.yaml not found. Run \`${ansis.bold("tray init")}\` first.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayai/tray-sync-cli",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "CLI tool to clone Tray projects and related assets to a local directory, and promote them between Tray environments",
5
5
  "bin": {
6
6
  "tray": "dist/cli.js"