From 0bc470306e8258db42ca4f4839e7c84e999f978c Mon Sep 17 00:00:00 2001 From: Kastriot Salihu Date: Thu, 25 Jun 2026 15:19:03 +0200 Subject: [PATCH] SP-1233: Deprecate Studio package push/pull/list commands Mark the Studio package commands that have clear config counterparts as deprecated, pointing users at the config equivalents (never t2tc): - pull package -> config package export - push package -> config package import - push packages -> config package import (single package) - list packages -> config package list Each command now shows a [Deprecated] help prefix and emits a runtime deprecation notice via the existing CommandConfig.deprecationNotice mechanism. Adds a studio module test covering the four notices and asserting none of them point at t2tc. Includes-AI-Code: true Co-authored-by: Cursor --- src/commands/studio/module.ts | 12 +++-- tests/commands/studio/module.spec.ts | 76 ++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 tests/commands/studio/module.spec.ts diff --git a/src/commands/studio/module.ts b/src/commands/studio/module.ts index 13616de7..7bd99e3d 100644 --- a/src/commands/studio/module.ts +++ b/src/commands/studio/module.ts @@ -15,7 +15,8 @@ class Module extends IModule { public register(context: Context, configurator: Configurator): void { const listCommand = configurator.command("list"); listCommand.command("packages") - .description("Command to list all packages") + .description("[Deprecated] Use 'config package list' instead. Command to list all packages") + .deprecationNotice("'list packages' is deprecated and will be removed in a future release. Use 'config package list' instead.") .option("--json", "Return response as json type", "") .option("--includeDependencies", "Include variables and dependencies", "") .option("--packageKeys ", "Lists only given package keys") @@ -39,7 +40,8 @@ class Module extends IModule { .action(this.pullAsset); pullCommand.command("package") - .description("Command to pull a package") + .description("[Deprecated] Use 'config package export' instead. Command to pull a package") + .deprecationNotice("'pull package' is deprecated and will be removed in a future release. Use 'config package export' instead.") .requiredOption("--key ", "Key of the package you want to pull") .option("--store", "Pull package with store deployment metadata") .option("--newKey ", "Define a new key for your package") @@ -59,7 +61,8 @@ class Module extends IModule { .action(this.pushAssets); pushCommand.command("package") - .description("Command to push a package to Studio") + .description("[Deprecated] Use 'config package import' instead. Command to push a package to Studio") + .deprecationNotice("'push package' is deprecated and will be removed in a future release. Use 'config package import' instead.") .option("--newKey ", "Define a new key for your package") .option("--overwrite", "Overwrite package and its assets") .requiredOption("-f, --file ", "The file you want to push") @@ -67,7 +70,8 @@ class Module extends IModule { .action(this.pushPackage); pushCommand.command("packages") - .description("Command to push packages to Studio") + .description("[Deprecated] Use 'config package import' (single package) instead. Command to push packages to Studio") + .deprecationNotice("'push packages' is deprecated and will be removed in a future release. Use 'config package import' (single package) instead.") .requiredOption("--spaceKey ", "The key of the destination space") .action(this.pushPackages); diff --git a/tests/commands/studio/module.spec.ts b/tests/commands/studio/module.spec.ts new file mode 100644 index 00000000..5f0b89cf --- /dev/null +++ b/tests/commands/studio/module.spec.ts @@ -0,0 +1,76 @@ +import Module = require("../../../src/commands/studio/module"); +import { testContext } from "../../utls/test-context"; +import { createMockConfigurator } from "../../utls/configurator-mock"; + +describe("Studio Module", () => { + describe("register", () => { + it("registers the studio command groups without throwing", () => { + const mockConfigurator = createMockConfigurator(); + + expect(() => new Module().register(testContext, mockConfigurator)).not.toThrow(); + + expect(mockConfigurator.command).toHaveBeenCalledWith("list"); + expect(mockConfigurator.command).toHaveBeenCalledWith("pull"); + expect(mockConfigurator.command).toHaveBeenCalledWith("push"); + expect(mockConfigurator.command).toHaveBeenCalledWith("package"); + expect(mockConfigurator.command).toHaveBeenCalledWith("packages"); + expect(mockConfigurator.command).toHaveBeenCalledWith("widget"); + }); + + it("wires an action handler for every leaf subcommand", () => { + const mockConfigurator = createMockConfigurator(); + + new Module().register(testContext, mockConfigurator); + + // list (packages/spaces/assets) + pull (asset/package) + push (asset/assets/package/packages/widget) + const expectedLeafCommands = 10; + expect(mockConfigurator.action).toHaveBeenCalledTimes(expectedLeafCommands); + for (const call of mockConfigurator.action.mock.calls) { + expect(typeof call[0]).toBe("function"); + } + }); + + it("deprecates the package push/pull/list commands, pointing at their config counterparts (never t2tc)", () => { + const mockConfigurator = createMockConfigurator(); + + new Module().register(testContext, mockConfigurator); + + expect(mockConfigurator.deprecationNotice).toHaveBeenCalledTimes(4); + expect(mockConfigurator.deprecationNotice).toHaveBeenCalledWith( + "'pull package' is deprecated and will be removed in a future release. Use 'config package export' instead." + ); + expect(mockConfigurator.deprecationNotice).toHaveBeenCalledWith( + "'push package' is deprecated and will be removed in a future release. Use 'config package import' instead." + ); + expect(mockConfigurator.deprecationNotice).toHaveBeenCalledWith( + "'push packages' is deprecated and will be removed in a future release. Use 'config package import' (single package) instead." + ); + expect(mockConfigurator.deprecationNotice).toHaveBeenCalledWith( + "'list packages' is deprecated and will be removed in a future release. Use 'config package list' instead." + ); + + for (const call of mockConfigurator.deprecationNotice.mock.calls) { + expect(call[0]).not.toMatch(/t2tc/); + } + }); + + it("prefixes the deprecated commands' descriptions with the recommended replacement", () => { + const mockConfigurator = createMockConfigurator(); + + new Module().register(testContext, mockConfigurator); + + expect(mockConfigurator.description).toHaveBeenCalledWith( + "[Deprecated] Use 'config package export' instead. Command to pull a package" + ); + expect(mockConfigurator.description).toHaveBeenCalledWith( + "[Deprecated] Use 'config package import' instead. Command to push a package to Studio" + ); + expect(mockConfigurator.description).toHaveBeenCalledWith( + "[Deprecated] Use 'config package list' instead. Command to list all packages" + ); + expect(mockConfigurator.description).toHaveBeenCalledWith( + "[Deprecated] Use 'config package import' (single package) instead. Command to push packages to Studio" + ); + }); + }); +});