refactor(cli): reorganize commands — add test, alias orchestrate to o, extract shared options

- Add `test` / `t` command mirroring unity-test-runner (EditMode, PlayMode, All,
  code coverage, test filters)
- Add `o` short alias for `orchestrate` command
- Extract shared option builders (project, docker, android, orchestrator) to
  eliminate duplication across build/test/orchestrate
- Make `build` local-only — remove --provider-strategy (use `orchestrate` for
  remote builds)
- Absorb `cache` command into `status` (--cache-dir flag) — remove standalone
  cache command that was half-implemented
- Fix `list-worfklow` typo in internal CLI → `list-workflow`
- Add test-related fields to CliArguments input mapper
- Update all unit and integration tests (64 passing)

Command structure is now:
  game-ci build          Local build (Docker/macOS)
  game-ci test / t       Run Unity tests
  game-ci orchestrate / o  Remote build (AWS/K8s/etc)
  game-ci activate       License validation
  game-ci status         Project info + cache status
  game-ci version        Version info
  game-ci update         Self-update

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
frostebite
2026-03-07 00:16:52 +00:00
parent 664cffa80c
commit f0aca9e727
13 changed files with 632 additions and 582 deletions
+80 -23
View File
@@ -1,7 +1,7 @@
import buildCommand from '../commands/build';
import testCommand from '../commands/test';
import activateCommand from '../commands/activate';
import orchestrateCommand from '../commands/orchestrate';
import cacheCommand from '../commands/cache';
import statusCommand from '../commands/status';
import versionCommand from '../commands/version';
import updateCommand from '../commands/update';
@@ -54,7 +54,7 @@ describe('CLI commands', () => {
(buildCommand.builder as Function)(yargs);
// Core build flags
// Core build flags (from shared + build-specific)
expect(options['target-platform']).toBeDefined();
expect(options['target-platform'].demandOption).toStrictEqual(true);
expect(options['unity-version']).toBeDefined();
@@ -88,10 +88,10 @@ describe('CLI commands', () => {
expect(options['run-as-host-user']).toBeDefined();
expect(options['chown-files-to']).toBeDefined();
// Provider flags
expect(options['provider-strategy']).toBeDefined();
expect(options['skip-activation']).toBeDefined();
expect(options['unity-licensing-server']).toBeDefined();
// Build should NOT have orchestrator-specific flags
expect(options['provider-strategy']).toBeUndefined();
expect(options['aws-stack-name']).toBeUndefined();
expect(options['kube-config']).toBeUndefined();
});
it('sets correct default values', () => {
@@ -107,7 +107,6 @@ describe('CLI commands', () => {
expect(options['enable-gpu'].default).toStrictEqual(false);
expect(options['android-export-type'].default).toStrictEqual('androidPackage');
expect(options['android-symbol-type'].default).toStrictEqual('none');
expect(options['provider-strategy'].default).toStrictEqual('local');
});
it('provides camelCase aliases for kebab-case options', () => {
@@ -124,6 +123,62 @@ describe('CLI commands', () => {
});
});
describe('test command', () => {
it('exports command with alias', () => {
expect(testCommand.command).toStrictEqual(['test', 't']);
});
it('has a description', () => {
expect(testCommand.describe).toBeTruthy();
});
it('has a builder function', () => {
expect(typeof testCommand.builder).toStrictEqual('function');
});
it('has a handler function', () => {
expect(typeof testCommand.handler).toStrictEqual('function');
});
it('defines test-specific flags', () => {
const { yargs, options } = createFakeYargs();
(testCommand.builder as Function)(yargs);
expect(options['test-mode']).toBeDefined();
expect(options['test-mode'].default).toStrictEqual('All');
expect(options['test-mode'].choices).toStrictEqual(['EditMode', 'PlayMode', 'All']);
expect(options['test-results-path']).toBeDefined();
expect(options['test-category']).toBeDefined();
expect(options['test-filter']).toBeDefined();
expect(options['enable-code-coverage']).toBeDefined();
expect(options['coverage-options']).toBeDefined();
});
it('includes shared project options', () => {
const { yargs, options } = createFakeYargs();
(testCommand.builder as Function)(yargs);
expect(options['target-platform']).toBeDefined();
expect(options['target-platform'].demandOption).toStrictEqual(true);
expect(options['unity-version']).toBeDefined();
expect(options['project-path']).toBeDefined();
expect(options['custom-image']).toBeDefined();
});
it('includes docker options but not orchestrator options', () => {
const { yargs, options } = createFakeYargs();
(testCommand.builder as Function)(yargs);
expect(options['docker-cpu-limit']).toBeDefined();
expect(options['docker-memory-limit']).toBeDefined();
expect(options['provider-strategy']).toBeUndefined();
expect(options['aws-stack-name']).toBeUndefined();
});
});
describe('activate command', () => {
it('exports the correct command name', () => {
expect(activateCommand.command).toStrictEqual('activate');
@@ -143,8 +198,8 @@ describe('CLI commands', () => {
});
describe('orchestrate command', () => {
it('exports the correct command name', () => {
expect(orchestrateCommand.command).toStrictEqual('orchestrate');
it('exports command with alias', () => {
expect(orchestrateCommand.command).toStrictEqual(['orchestrate', 'o']);
});
it('has a description', () => {
@@ -175,23 +230,16 @@ describe('CLI commands', () => {
expect(options['watch-to-end']).toBeDefined();
expect(options['clone-depth']).toBeDefined();
});
});
describe('cache command', () => {
it('exports the correct command name', () => {
expect(cacheCommand.command).toStrictEqual('cache <action>');
});
it('does not include build-only options', () => {
const { yargs, options } = createFakeYargs();
it('has a description', () => {
expect(cacheCommand.describe).toBeTruthy();
});
(orchestrateCommand.builder as Function)(yargs);
it('has a builder function', () => {
expect(typeof cacheCommand.builder).toStrictEqual('function');
});
it('has a handler function', () => {
expect(typeof cacheCommand.handler).toStrictEqual('function');
expect(options['build-profile']).toBeUndefined();
expect(options['manual-exit']).toBeUndefined();
expect(options['enable-gpu']).toBeUndefined();
expect(options['android-version-code']).toBeUndefined();
});
});
@@ -207,6 +255,15 @@ describe('CLI commands', () => {
it('has a handler function', () => {
expect(typeof statusCommand.handler).toStrictEqual('function');
});
it('includes cache-dir option', () => {
const { yargs, options } = createFakeYargs();
(statusCommand.builder as Function)(yargs);
expect(options['cache-dir']).toBeDefined();
expect(options['project-path']).toBeDefined();
});
});
describe('version command', () => {