From 9dbe552c3990d7ac8d2c5947c41b4ec9ff8d90be Mon Sep 17 00:00:00 2001 From: frostebite Date: Wed, 6 May 2026 22:29:43 +0100 Subject: [PATCH] chore: remove legacy CLI bootstrap and unused deps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove InitCliMode/RunCli, @CliFunction decorator, and CliFunctionsRepository. The only registered CLI mode was `print-input` which is unused — all real CLI functionality lives in the orchestrator repo now. This drops 3 dependencies: - commander-ts (decorator-based CLI, needed reflect-metadata) - reflect-metadata (peer dep of commander-ts) - commander (only used for OptionValues type) Cli.options, Cli.isCliMode, and Cli.query remain — the orchestrator plugin sets these directly without commander. Co-Authored-By: Claude Opus 4.6 (1M context) --- package.json | 3 - src/index-plugin-features.test.ts | 6 -- src/index.ts | 6 -- src/model/cli/cli-functions-repository.ts | 45 ------------ src/model/cli/cli.ts | 86 +---------------------- yarn.lock | 28 -------- 6 files changed, 1 insertion(+), 173 deletions(-) delete mode 100644 src/model/cli/cli-functions-repository.ts diff --git a/package.json b/package.json index daf7dee5..aa7eab96 100644 --- a/package.json +++ b/package.json @@ -36,11 +36,8 @@ "@actions/core": "^1.11.1", "@actions/exec": "^1.1.1", "@actions/github": "^6.0.0", - "commander": "^9.0.0", - "commander-ts": "^0.2.0", "md5": "^2.3.0", "nanoid": "^3.3.1", - "reflect-metadata": "^0.1.13", "semver": "^7.5.2", "ts-md5": "^1.3.1", "unity-changeset": "^3.1.0", diff --git a/src/index-plugin-features.test.ts b/src/index-plugin-features.test.ts index c5dbfe75..ccd3dbd9 100644 --- a/src/index-plugin-features.test.ts +++ b/src/index-plugin-features.test.ts @@ -66,12 +66,6 @@ vi.mock('./model', () => ({ }, })); -vi.mock('./model/cli/cli', () => ({ - Cli: { - InitCliMode: vi.fn().mockReturnValue(false), - }, -})); - vi.mock('./model/mac-builder', () => ({ __esModule: true, default: { diff --git a/src/index.ts b/src/index.ts index a45974a8..cec5070e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,5 @@ import * as core from '@actions/core'; import { Action, BuildParameters, Cache, Docker, ImageTag, Output } from './model'; -import { Cli } from './model/cli/cli'; import MacBuilder from './model/mac-builder'; import PlatformSetup from './model/platform-setup'; import { Plugin, loadPlugin } from './model/plugin'; @@ -9,11 +8,6 @@ import { Plugin, loadPlugin } from './model/plugin'; // vitest's module re-loading (which changed in vitest 4). export async function runMain() { try { - if (Cli.InitCliMode()) { - await Cli.RunCli(); - - return; - } Action.checkCompatibility(); Cache.verify(); diff --git a/src/model/cli/cli-functions-repository.ts b/src/model/cli/cli-functions-repository.ts deleted file mode 100644 index 62d119cf..00000000 --- a/src/model/cli/cli-functions-repository.ts +++ /dev/null @@ -1,45 +0,0 @@ -export class CliFunctionsRepository { - private static targets: any[] = []; - public static PushCliFunction( - target: any, - propertyKey: string, - descriptor: PropertyDescriptor, - key: string, - description: string, - ) { - CliFunctionsRepository.targets.push({ - target, - propertyKey, - descriptor, - key, - description, - }); - } - - public static GetCliFunctions(key: any) { - const results = CliFunctionsRepository.targets.find((x) => x.key === key); - if (results === undefined || results.length === 0) { - throw new Error(`no CLI mode found for ${key}`); - } - - return results; - } - - public static GetAllCliModes() { - return CliFunctionsRepository.targets.map((x) => { - return { - key: x.key, - description: x.description, - }; - }); - } - - // eslint-disable-next-line no-unused-vars - public static PushCliFunctionSource(cliFunction: any) {} -} - -export function CliFunction(key: string, description: string) { - return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => { - CliFunctionsRepository.PushCliFunction(target, propertyKey, descriptor, key, description); - }; -} diff --git a/src/model/cli/cli.ts b/src/model/cli/cli.ts index 356e22fa..1182f250 100644 --- a/src/model/cli/cli.ts +++ b/src/model/cli/cli.ts @@ -1,13 +1,5 @@ -import { Command } from 'commander-ts'; -import { Input } from '..'; -import * as core from '@actions/core'; -import { ActionYamlReader } from '../input-readers/action-yaml'; -import { CliFunction, CliFunctionsRepository } from './cli-functions-repository'; -import { OptionValues } from 'commander'; -import { InputKey } from '../input'; - export class Cli { - public static options: OptionValues | undefined; + public static options: Record | undefined; static get isCliMode() { return Cli.options !== undefined && Cli.options.mode !== undefined && Cli.options.mode !== ''; } @@ -21,80 +13,4 @@ export class Cli { return; } - - public static InitCliMode() { - const program = new Command(); - program.version('0.0.1'); - - const actionYamlReader: ActionYamlReader = new ActionYamlReader(); - const properties = Object.getOwnPropertyNames(Input).filter( - (p) => p !== 'length' && p !== 'prototype' && p !== 'name', - ); - for (const element of properties) { - program.option(`--${element} <${element}>`, actionYamlReader.GetActionYamlValue(element)); - } - program.option( - '-m, --mode ', - CliFunctionsRepository.GetAllCliModes() - .map((x) => `${x.key} (${x.description})`) - .join(` | `), - ); - program.option( - '--populateOverride ', - 'should use override query to pull input false by default', - ); - program.option('--cachePushFrom ', 'cache push from source folder'); - program.option('--cachePushTo ', 'cache push to caching folder'); - program.option('--artifactName ', 'caching artifact name'); - program.option('--select