feat: Official CLI Support — game-ci - #813
Conversation
…commands Introduces a yargs-based CLI entry point (src/cli.ts) distributed as the `game-ci` command. The CLI reuses existing unity-builder modules — Input, BuildParameters, Orchestrator, Docker, MacBuilder — so the same build engine powers both the GitHub Action and the standalone CLI. Commands: build, activate, orchestrate, cache (list/restore/clear), status, version. Closes #812 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds an official CLI ("game-ci") with yargs-based commands, input mapping, packaging/release workflows, cross-platform installers, and tests; introduces command implementations for build, activate, orchestrate, cache, status, version, and update, plus packaging and release automation. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI as "CLI\n(src/cli.ts)"
participant InputMapper as "Input Mapper\n(mapCliArgumentsToInput)"
participant BuildParams as "BuildParameters"
participant PlatformSetup as "PlatformSetup"
participant LocalBuilder as "Local Builder\n(Docker/Mac)"
participant Orchestrator as "Orchestrator"
User->>CLI: game-ci build [flags]
CLI->>InputMapper: mapCliArgumentsToInput(cliArguments)
Note right of InputMapper: Cli.options set,\nmode='cli'
InputMapper-->>CLI: mapped options
CLI->>BuildParams: create BuildParameters / ImageTag
alt providerStrategy == 'local'
CLI->>PlatformSetup: setup()
PlatformSetup-->>CLI: environment ready
alt platform == macOS
CLI->>LocalBuilder: MacBuilder.build(params)
else
CLI->>LocalBuilder: Docker.build(params, image)
end
LocalBuilder-->>CLI: build results
else
CLI->>Orchestrator: Orchestrator.run(buildParameters, image)
Orchestrator-->>CLI: orchestration result
end
CLI->>User: output metadata (exit code, path, version)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add .github/workflows/publish-cli.yml for publishing the CLI to npm on release or via manual workflow_dispatch with dry-run support. Add comprehensive test coverage for the CLI: - input-mapper.test.ts: 16 tests covering argument mapping, boolean conversion, yargs internal property filtering, and Cli.options population - commands.test.ts: 26 tests verifying command exports, builder flags, default values, and camelCase aliases for all six commands - cli-integration.test.ts: 8 integration tests spawning the CLI process to verify help output, version info, and error handling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (2)
src/cli/commands/orchestrate.ts (1)
14-149: Consider extracting shared CLI option registration.This option block largely duplicates
src/cli/commands/build.ts. A shared helper would reduce drift and keep defaults/descriptions consistent across commands.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli/commands/orchestrate.ts` around lines 14 - 149, The CLI option block duplicated in the builder function in orchestrate.ts should be extracted into a shared helper (e.g., registerCommonBuildOptions or addOrchestrateOptions) that encapsulates the repeated .option(...) calls and defaults; move that helper into a new module (e.g., cli/options.ts) and replace the large option chains in builder of orchestrate.ts and the equivalent builder in build.ts with a call to this helper (pass the yargs instance and any command-specific overrides like providerStrategy defaults), ensuring unique symbols referenced are the builder function in orchestrate.ts, the corresponding builder in build.ts, and the new registerCommonBuildOptions helper so both commands import and call it.src/cli/commands/cache.ts (1)
57-61: Avoid double failure reporting in CLI error flow.Calling
core.setFailed(...)and rethrowing can produce duplicate error output/noisy stacks in yargs CLIs. Prefer normalizing the message and returning after setting failure state.Proposed refactor
- } catch (error: any) { - core.setFailed(`Cache operation failed: ${error.message}`); - - throw error; + } catch (error: unknown) { + const message = error instanceof Error ? error.message : String(error); + core.setFailed(`Cache operation failed: ${message}`); + return; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli/commands/cache.ts` around lines 57 - 61, The catch block in src/cli/commands/cache.ts currently calls core.setFailed(...) and then rethrows the error, causing duplicate/noisy output; update the error handling in that catch (the code using core.setFailed and throw error) to instead normalize the error message, call core.setFailed(normalizedMessage) and then return (or set a non-zero exit/return code) without rethrowing; remove the throw error to avoid double reporting while preserving the failure state.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package.json`:
- Around line 62-70: The package.json currently pins "yargs" at "^18.0.0", which
is incompatible with the repository's Node engine (>=18.x); change the "yargs"
dependency entry in package.json to "17.7.2" (or "^17.7.2") to match Node >=12
compatibility, then regenerate lockfiles by running your package manager (npm
install or yarn install) so package-lock.json / yarn.lock reflects the
downgrade; ensure any related type package "@types/yargs" remains compatible
after the change and adjust it only if type errors appear.
In `@src/cli.ts`:
- Line 4: Remove the stale eslint-disable directive "eslint-disable-next-line
import/no-unresolved" from the top of the file; locate the exact comment and
delete that line so eslint-comments/no-unused-disable no longer flags it, and
only re-add a disable if an actual unresolved-import warning later reappears.
- Around line 29-36: In the main function's catch block (around cli.parse()),
detect YError cases and ensure they exit with code 2: when error.name ===
'YError' call core.error with the error message (or the error itself) and then
invoke process.exit(2); keep the existing behavior for non-YError errors (log
with core.error) but ensure they still exit (e.g., process.exit(1) or propagate)
as appropriate so parser/configuration errors from cli.parse() are mapped to
exit code 2.
In `@src/cli/commands/activate.ts`:
- Around line 42-45: Replace the direct environment/CLI reads for unitySerial,
unityLicense, and licensingServer with the unified Input accessors so activation
goes through the same input resolution pipeline as other commands: stop using
process.env.UNITY_SERIAL, process.env.UNITY_LICENSE and
cliArguments.unityLicensingServer and instead read those values via the
project's Input API (e.g., Input.get / Input.getOptional or the project's
equivalent) for the keys used by the rest of the CLI (UNITY_SERIAL,
UNITY_LICENSE, UNITY_LICENSING_SERVER); update the variables unitySerial,
unityLicense, and licensingServer in activate.ts to pull from Input and preserve
the same fallback/empty-string behavior.
In `@src/cli/commands/cache.ts`:
- Around line 33-35: The file always sets cacheDirectory to
(cliArguments.cacheDir as string) || path.join(projectPath, 'Library'), making
the restoreCache guard dead and causing restore/clear to silently use
<project>/Library; change this so --cache-dir is action-specific: do not default
cacheDirectory to 'Library' at the top-level — only resolve a default when
handling the specific actions that need it (e.g., inside the restore and clear
command handlers or inside restoreCache), or keep cacheDir undefined unless
provided and then in restoreCache (function restoreCache) compute
path.join(projectPath, 'Library') only when cacheDir is missing and the action
is restore/clear; update references to projectPath and cacheDirectory
accordingly so other actions ignore the default.
- Around line 122-137: The cache restore command currently only lists archives
and exits successfully; change the behavior to fail fast until restore is
implemented: after computing sorted (using cacheFiles, cacheDirectory, sorted),
replace the final core.info guidance messages with a non-success exit (e.g.,
call core.setFailed('cache restore not implemented - no restore performed') or
throw an Error or set process.exitCode = 1) so CI/automation surfaces the
missing restore step instead of succeeding silently.
---
Nitpick comments:
In `@src/cli/commands/cache.ts`:
- Around line 57-61: The catch block in src/cli/commands/cache.ts currently
calls core.setFailed(...) and then rethrows the error, causing duplicate/noisy
output; update the error handling in that catch (the code using core.setFailed
and throw error) to instead normalize the error message, call
core.setFailed(normalizedMessage) and then return (or set a non-zero exit/return
code) without rethrowing; remove the throw error to avoid double reporting while
preserving the failure state.
In `@src/cli/commands/orchestrate.ts`:
- Around line 14-149: The CLI option block duplicated in the builder function in
orchestrate.ts should be extracted into a shared helper (e.g.,
registerCommonBuildOptions or addOrchestrateOptions) that encapsulates the
repeated .option(...) calls and defaults; move that helper into a new module
(e.g., cli/options.ts) and replace the large option chains in builder of
orchestrate.ts and the equivalent builder in build.ts with a call to this helper
(pass the yargs instance and any command-specific overrides like
providerStrategy defaults), ensuring unique symbols referenced are the builder
function in orchestrate.ts, the corresponding builder in build.ts, and the new
registerCommonBuildOptions helper so both commands import and call it.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: ae38484e-46f1-444b-b655-b92b497e7fd8
⛔ Files ignored due to path filters (2)
dist/index.js.mapis excluded by!**/dist/**,!**/*.mapyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
package.jsonsrc/cli.tssrc/cli/commands/activate.tssrc/cli/commands/build.tssrc/cli/commands/cache.tssrc/cli/commands/orchestrate.tssrc/cli/commands/status.tssrc/cli/commands/version.tssrc/cli/input-mapper.ts
| #!/usr/bin/env node | ||
|
|
||
| import yargs from 'yargs'; | ||
| // eslint-disable-next-line import/no-unresolved |
There was a problem hiding this comment.
Remove the stale eslint-disable directive.
Line 4 triggers eslint-comments/no-unused-disable and should be deleted unless a real unresolved-import warning is reintroduced.
🧰 Tools
🪛 ESLint
[error] 4-4: 'import/no-unresolved' rule is disabled but never reported.
(eslint-comments/no-unused-disable)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/cli.ts` at line 4, Remove the stale eslint-disable directive
"eslint-disable-next-line import/no-unresolved" from the top of the file; locate
the exact comment and delete that line so eslint-comments/no-unused-disable no
longer flags it, and only re-add a disable if an actual unresolved-import
warning later reappears.
| async function main() { | ||
| try { | ||
| await cli.parse(); | ||
| } catch (error: any) { | ||
| if (error.name !== 'YError') { | ||
| core.error(`Error: ${error.message}`); | ||
| } | ||
| } |
There was a problem hiding this comment.
Map parser/configuration errors to exit code 2.
The current YError path does not enforce the config-error exit code contract.
🔧 Proposed fix
async function main() {
try {
await cli.parse();
} catch (error: any) {
- if (error.name !== 'YError') {
- core.error(`Error: ${error.message}`);
- }
+ if (error?.name === 'YError') {
+ process.exitCode = 2;
+ return;
+ }
+ process.exitCode = process.exitCode || 1;
+ core.error(`Error: ${error?.message ?? String(error)}`);
}
}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/cli.ts` around lines 29 - 36, In the main function's catch block (around
cli.parse()), detect YError cases and ensure they exit with code 2: when
error.name === 'YError' call core.error with the error message (or the error
itself) and then invoke process.exit(2); keep the existing behavior for
non-YError errors (log with core.error) but ensure they still exit (e.g.,
process.exit(1) or propagate) as appropriate so parser/configuration errors from
cli.parse() are mapped to exit code 2.
| const unitySerial = process.env.UNITY_SERIAL; | ||
| const unityLicense = process.env.UNITY_LICENSE; | ||
| const licensingServer = cliArguments.unityLicensingServer || process.env.UNITY_LICENSING_SERVER || ''; | ||
|
|
There was a problem hiding this comment.
Use unified Input accessors instead of direct env reads.
At Line 42-Line 45, activation bypasses the mapped CLI input pipeline and can behave differently from build/orchestrate input resolution.
🔧 Proposed fix
import type { CommandModule } from 'yargs';
import * as core from '@actions/core';
import { mapCliArgumentsToInput, CliArguments } from '../input-mapper';
+import Input from '../../model/input';
@@
- const unitySerial = process.env.UNITY_SERIAL;
- const unityLicense = process.env.UNITY_LICENSE;
- const licensingServer = cliArguments.unityLicensingServer || process.env.UNITY_LICENSING_SERVER || '';
+ const unitySerial = Input.unitySerial;
+ const unityLicense = Input.unityLicense;
+ const licensingServer = Input.unityLicensingServer || '';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const unitySerial = process.env.UNITY_SERIAL; | |
| const unityLicense = process.env.UNITY_LICENSE; | |
| const licensingServer = cliArguments.unityLicensingServer || process.env.UNITY_LICENSING_SERVER || ''; | |
| import type { CommandModule } from 'yargs'; | |
| import * as core from '@actions/core'; | |
| import { mapCliArgumentsToInput, CliArguments } from '../input-mapper'; | |
| import Input from '../../model/input'; | |
| const unitySerial = Input.unitySerial; | |
| const unityLicense = Input.unityLicense; | |
| const licensingServer = Input.unityLicensingServer || ''; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/cli/commands/activate.ts` around lines 42 - 45, Replace the direct
environment/CLI reads for unitySerial, unityLicense, and licensingServer with
the unified Input accessors so activation goes through the same input resolution
pipeline as other commands: stop using process.env.UNITY_SERIAL,
process.env.UNITY_LICENSE and cliArguments.unityLicensingServer and instead read
those values via the project's Input API (e.g., Input.get / Input.getOptional or
the project's equivalent) for the keys used by the rest of the CLI
(UNITY_SERIAL, UNITY_LICENSE, UNITY_LICENSING_SERVER); update the variables
unitySerial, unityLicense, and licensingServer in activate.ts to pull from Input
and preserve the same fallback/empty-string behavior.
| const projectPath = (cliArguments.projectPath as string) || '.'; | ||
| const cacheDirectory = (cliArguments.cacheDir as string) || path.join(projectPath, 'Library'); | ||
|
|
There was a problem hiding this comment.
Make --cache-dir action-specific instead of globally defaulting to Library.
cacheDirectory is always populated (Line 34), so the guard in restoreCache (Line 111) is effectively dead. This causes restore/clear to silently target <project>/Library, which doesn’t match the command intent or examples.
Proposed fix
- const projectPath = (cliArguments.projectPath as string) || '.';
- const cacheDirectory = (cliArguments.cacheDir as string) || path.join(projectPath, 'Library');
+ const projectPath = (cliArguments.projectPath as string) || '.';
+ const cacheDirectory = (cliArguments.cacheDir as string) || '';
try {
switch (action) {
case 'list': {
- await listCache(cacheDirectory, projectPath);
+ await listCache(cacheDirectory || path.join(projectPath, 'Library'), projectPath);
break;
}
case 'restore': {
+ if (!cacheDirectory) {
+ throw new Error('--cache-dir is required for restore');
+ }
await restoreCache(cacheDirectory);
break;
}
case 'clear': {
+ if (!cacheDirectory) {
+ throw new Error('--cache-dir is required for clear');
+ }
await clearCache(cacheDirectory);
break;
}Also applies to: 110-113
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/cli/commands/cache.ts` around lines 33 - 35, The file always sets
cacheDirectory to (cliArguments.cacheDir as string) || path.join(projectPath,
'Library'), making the restoreCache guard dead and causing restore/clear to
silently use <project>/Library; change this so --cache-dir is action-specific:
do not default cacheDirectory to 'Library' at the top-level — only resolve a
default when handling the specific actions that need it (e.g., inside the
restore and clear command handlers or inside restoreCache), or keep cacheDir
undefined unless provided and then in restoreCache (function restoreCache)
compute path.join(projectPath, 'Library') only when cacheDir is missing and the
action is restore/clear; update references to projectPath and cacheDirectory
accordingly so other actions ignore the default.
| const cacheFiles = fs.readdirSync(cacheDirectory).filter((f) => f.endsWith('.tar') || f.endsWith('.tar.lz4')); | ||
| if (cacheFiles.length === 0) { | ||
| core.info('No cache archives found to restore.'); | ||
|
|
||
| return; | ||
| } | ||
|
|
||
| // Sort by modification time, newest first | ||
| const sorted = cacheFiles | ||
| .map((f) => ({ name: f, mtime: fs.statSync(path.join(cacheDirectory, f)).mtime })) | ||
| .sort((a, b) => b.mtime.getTime() - a.mtime.getTime()); | ||
|
|
||
| core.info(`Found ${sorted.length} cache archive(s). Latest: ${sorted[0].name}`); | ||
| core.info('Use the orchestrator cache system for full restore functionality:'); | ||
| core.info(' game-ci orchestrate --cache-key <key> ...'); | ||
| } |
There was a problem hiding this comment.
cache restore currently succeeds without restoring anything.
The command only discovers archives and prints guidance, then exits successfully. This is misleading for automation and can mask a missing restore step.
Minimal safe behavior until restore is implemented
- core.info(`Found ${sorted.length} cache archive(s). Latest: ${sorted[0].name}`);
- core.info('Use the orchestrator cache system for full restore functionality:');
- core.info(' game-ci orchestrate --cache-key <key> ...');
+ core.info(`Found ${sorted.length} cache archive(s). Latest: ${sorted[0].name}`);
+ throw new Error(
+ 'cache restore is not implemented yet in this command. Use `game-ci orchestrate --cache-key <key> ...`.'
+ );📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const cacheFiles = fs.readdirSync(cacheDirectory).filter((f) => f.endsWith('.tar') || f.endsWith('.tar.lz4')); | |
| if (cacheFiles.length === 0) { | |
| core.info('No cache archives found to restore.'); | |
| return; | |
| } | |
| // Sort by modification time, newest first | |
| const sorted = cacheFiles | |
| .map((f) => ({ name: f, mtime: fs.statSync(path.join(cacheDirectory, f)).mtime })) | |
| .sort((a, b) => b.mtime.getTime() - a.mtime.getTime()); | |
| core.info(`Found ${sorted.length} cache archive(s). Latest: ${sorted[0].name}`); | |
| core.info('Use the orchestrator cache system for full restore functionality:'); | |
| core.info(' game-ci orchestrate --cache-key <key> ...'); | |
| } | |
| const cacheFiles = fs.readdirSync(cacheDirectory).filter((f) => f.endsWith('.tar') || f.endsWith('.tar.lz4')); | |
| if (cacheFiles.length === 0) { | |
| core.info('No cache archives found to restore.'); | |
| return; | |
| } | |
| // Sort by modification time, newest first | |
| const sorted = cacheFiles | |
| .map((f) => ({ name: f, mtime: fs.statSync(path.join(cacheDirectory, f)).mtime })) | |
| .sort((a, b) => b.mtime.getTime() - a.mtime.getTime()); | |
| core.info(`Found ${sorted.length} cache archive(s). Latest: ${sorted[0].name}`); | |
| throw new Error( | |
| 'cache restore is not implemented yet in this command. Use `game-ci orchestrate --cache-key <key> ...`.' | |
| ); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/cli/commands/cache.ts` around lines 122 - 137, The cache restore command
currently only lists archives and exits successfully; change the behavior to
fail fast until restore is implemented: after computing sorted (using
cacheFiles, cacheDirectory, sorted), replace the final core.info guidance
messages with a non-success exit (e.g., call core.setFailed('cache restore not
implemented - no restore performed') or throw an Error or set process.exitCode =
1) so CI/automation surfaces the missing restore step instead of succeeding
silently.
…mand Replace the npm-only publish-cli.yml with a comprehensive release-cli.yml that builds standalone binaries via pkg for all platforms (Linux/macOS/Windows, x64/arm64), uploads them as GitHub Release assets with SHA256 checksums, and retains npm publish as an optional job. Add curl-pipe-sh installer (install.sh) and PowerShell installer (install.ps1) for one-liner installation from GitHub Releases. Both scripts auto-detect platform/architecture, verify checksums, and guide PATH configuration. Add `game-ci update` command for self-updating standalone binaries: checks GitHub releases for newer versions, downloads the correct platform binary, verifies it, and atomically replaces the running executable. Distribution strategy: GitHub Releases (primary), npm (optional), with winget/Homebrew/Chocolatey/Scoop as future providers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
.github/workflows/publish-cli.yml (1)
48-55: Simplify boolean input comparison using the moderninputscontext.Lines 48 and 54 use string comparison (
== 'true'/== 'false') with theinputscontext. Theinputscontext (the recommended approach forworkflow_dispatchinputs) handles boolean conversion automatically, so the string comparisons are unnecessary. Use the inputs directly:inputs['dry-run']and!inputs['dry-run'].Suggested refactor
- name: Publish (dry run) - if: github.event_name == 'workflow_dispatch' && inputs.dry-run == 'true' + if: github.event_name == 'workflow_dispatch' && inputs['dry-run'] run: npm publish --dry-run env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Publish - if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.dry-run == 'false') + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && !inputs['dry-run']) run: npm publish --provenance --access public🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/publish-cli.yml around lines 48 - 55, Replace the string boolean comparisons against the workflow_dispatch input with direct boolean checks using the inputs context: update the dry-run step condition from "github.event_name == 'workflow_dispatch' && inputs.dry-run == 'true'" to use "github.event_name == 'workflow_dispatch' && inputs['dry-run']" and update the Publish step condition from "... && inputs.dry-run == 'false'" to use "... && !inputs['dry-run']"; ensure you modify the conditions that guard the npm publish --dry-run and npm publish --provenance steps (the steps currently using inputs.dry-run string comparisons).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/publish-cli.yml:
- Around line 4-5: The workflow file path is wrong and the release trigger and
publish step need hardening: rename `.github/workflows/publish-cli.yml` to
`.github/workflows/release-cli.yml`, update the workflow so the `release`
trigger distinguishes prereleases (e.g., use `types: [published]` plus a
condition checking `github.event.release.prerelease`), and modify the npm
publish step (the step running `npm publish`) to publish prereleases with `--tag
next` while only publishing non-prereleases without an explicit tag (or with
`--tag latest`) so prereleases are not promoted to latest.
In `@src/cli/__tests__/input-mapper.test.ts`:
- Around line 5-8: The teardown in afterEach currently restores mocks and
Cli.options but doesn't reset the global flag GitHub.githubInputEnabled modified
by mapCliArgumentsToInput; update the afterEach block to also reset
GitHub.githubInputEnabled (e.g., set GitHub.githubInputEnabled = undefined or
its default) after jest.restoreAllMocks() and Cli.options = undefined so tests
don't leak state between runs.
---
Nitpick comments:
In @.github/workflows/publish-cli.yml:
- Around line 48-55: Replace the string boolean comparisons against the
workflow_dispatch input with direct boolean checks using the inputs context:
update the dry-run step condition from "github.event_name == 'workflow_dispatch'
&& inputs.dry-run == 'true'" to use "github.event_name == 'workflow_dispatch' &&
inputs['dry-run']" and update the Publish step condition from "... &&
inputs.dry-run == 'false'" to use "... && !inputs['dry-run']"; ensure you modify
the conditions that guard the npm publish --dry-run and npm publish --provenance
steps (the steps currently using inputs.dry-run string comparisons).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f9eb4f67-7105-46c1-976d-d30991a1c862
📒 Files selected for processing (4)
.github/workflows/publish-cli.ymlsrc/cli/__tests__/cli-integration.test.tssrc/cli/__tests__/commands.test.tssrc/cli/__tests__/input-mapper.test.ts
| release: | ||
| types: [published] |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
cat -n .github/workflows/publish-cli.ymlRepository: game-ci/unity-builder
Length of output: 130
🌐 Web query:
npm publish default dist-tag prerelease versions recommended approach
💡 Result:
- Default behavior:
npm publish(with no--tag) publishes your version under thelatestdist-tag. That meansnpm install your-pkg(with no version/tag) will install whatever is taggedlatest. [1], [2] - Problem: If you publish a SemVer prerelease like
1.2.0-beta.1without--tag, you’ll still movelatestto that prerelease, and users doing a normal install may get it. [1], [3] - Recommended approach (common practice):
- Publish prereleases to a non-latest tag (often
next,beta,alpha,rc):npm publish --tag next[3]
- Tell testers to install explicitly:
npm install your-pkg@next(or@beta, etc.) [2], [3]
- When ready, publish the stable release without
--tagso it becomeslatest:npm publish[1], [3]
- Publish prereleases to a non-latest tag (often
- If you need to adjust tags after publishing: use dist-tag commands (e.g.,
npm dist-tag add your-pkg@1.2.0 latest,npm dist-tag rm your-pkg next). [2]
Sources: npm dist-tags docs and guidance on publishing prereleases with explicit tags. [1], [2], [3], [4]
🏁 Script executed:
find .github/workflows -type f -name "*.yml" -o -name "*.yaml" | head -20Repository: game-ci/unity-builder
Length of output: 443
🏁 Script executed:
ls -la .github/workflows/ 2>/dev/null || echo "Directory not found"Repository: game-ci/unity-builder
Length of output: 878
🏁 Script executed:
cat -n .github/workflows/release-cli.ymlRepository: game-ci/unity-builder
Length of output: 6284
Correct file path and handle prerelease publication separately to prevent accidental promotion to latest.
The workflow file is .github/workflows/release-cli.yml (not publish-cli.yml). The trigger release: types: [published] fires for both stable releases and prereleases, and the npm publish command at line 168 does not specify a dist-tag, defaulting to latest. This causes prerelease versions to be tagged as latest, which users will receive on standard installations.
Separate prerelease publishing to use --tag next and add a condition to prevent prereleases from being tagged as latest:
Proposed hardening
+ - name: Publish prerelease
+ if: github.event_name == 'release' && github.event.release.prerelease
+ run: npm publish --provenance --access public --tag next
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
+
- name: Publish to npm
- if: >-
- (github.event_name == 'release') || (github.event_name == 'workflow_dispatch' && inputs.publish-npm)
+ if: (github.event_name == 'release' && !github.event.release.prerelease) || (github.event_name == 'workflow_dispatch' && inputs.publish-npm)
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/publish-cli.yml around lines 4 - 5, The workflow file path
is wrong and the release trigger and publish step need hardening: rename
`.github/workflows/publish-cli.yml` to `.github/workflows/release-cli.yml`,
update the workflow so the `release` trigger distinguishes prereleases (e.g.,
use `types: [published]` plus a condition checking
`github.event.release.prerelease`), and modify the npm publish step (the step
running `npm publish`) to publish prereleases with `--tag next` while only
publishing non-prereleases without an explicit tag (or with `--tag latest`) so
prereleases are not promoted to latest.
| afterEach(() => { | ||
| jest.restoreAllMocks(); | ||
| Cli.options = undefined; | ||
| }); |
There was a problem hiding this comment.
Reset GitHub.githubInputEnabled in teardown to avoid cross-test state leakage.
mapCliArgumentsToInput disables GitHub input globally, but teardown currently restores only Cli.options. This can make other tests order-dependent.
✅ Suggested fix
afterEach(() => {
jest.restoreAllMocks();
Cli.options = undefined;
+ GitHub.githubInputEnabled = true;
});📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| afterEach(() => { | |
| jest.restoreAllMocks(); | |
| Cli.options = undefined; | |
| }); | |
| afterEach(() => { | |
| jest.restoreAllMocks(); | |
| Cli.options = undefined; | |
| GitHub.githubInputEnabled = true; | |
| }); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/cli/__tests__/input-mapper.test.ts` around lines 5 - 8, The teardown in
afterEach currently restores mocks and Cli.options but doesn't reset the global
flag GitHub.githubInputEnabled modified by mapCliArgumentsToInput; update the
afterEach block to also reset GitHub.githubInputEnabled (e.g., set
GitHub.githubInputEnabled = undefined or its default) after
jest.restoreAllMocks() and Cli.options = undefined so tests don't leak state
between runs.
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
src/cli/commands/update.ts (2)
31-76: Inconsistent redirect limits betweenfetchJson(5) anddownloadFile(10).Both functions follow redirects, but
fetchJsonallows 5 whiledownloadFileallows 10. For consistency and since GitHub's asset downloads may involve multiple redirects, consider aligning both to 10.♻️ Proposed fix
function fetchJson(url: string): Promise<any> { return new Promise((resolve, reject) => { const get = (targetUrl: string, redirectCount: number) => { - if (redirectCount > 5) { + if (redirectCount > 10) { reject(new Error('Too many redirects'));Also applies to: 81-116
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli/commands/update.ts` around lines 31 - 76, fetchJson currently stops after 5 redirects while downloadFile allows 10, causing inconsistent behavior and potential failures for GitHub asset downloads; update the redirect limit in fetchJson (inside the inner get function) from 5 to 10 to match downloadFile and ensure both functions follow the same redirect policy, keeping the same error message logic but changing the numeric threshold and any related condition checks that reference that limit; verify the change in the fetchJson function definition and its get(targetUrl: string, redirectCount: number) implementation.
210-235: Semver comparison ignores pre-release suffixes.
parseVersionPartsstrips non-numeric suffixes, sov2.0.0-beta.1andv2.0.0compare as equal. If pre-release versions are used, this could cause unexpected behavior (e.g., not updating from beta to stable).Consider using the existing
semverpackage (already a dependency in package.json line 71) for robust comparison:♻️ Proposed fix using semver package
+import semver from 'semver'; -function parseVersionParts(version: string): number[] { - return version - .replace(/^v/, '') - .split('.') - .map((part) => Number(part)); -} - -function compareSemver(a: string, b: string): number { - const partsA = parseVersionParts(a); - const partsB = parseVersionParts(b); - - for (let index = 0; index < 3; index++) { - const x = partsA[index] || 0; - const y = partsB[index] || 0; - if (x < y) return -1; - if (x > y) return 1; - } - - return 0; -} +function compareSemver(a: string, b: string): number { + const cleanA = a.replace(/^v/, ''); + const cleanB = b.replace(/^v/, ''); + return semver.compare(cleanA, cleanB); +}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli/commands/update.ts` around lines 210 - 235, The current parseVersionParts/compareSemver pair strips pre-release suffixes and treats "v2.0.0-beta.1" as equal to "v2.0.0"; replace this custom logic with the semver package to correctly handle pre-release and other semver edge cases: import/require the existing semver dependency and update compareSemver to delegate to semver.compare (or semver.rcompare as appropriate) returning -1/0/1, and remove or stop using parseVersionParts so pre-release tags (e.g., "-beta.1") are preserved in comparisons.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@install.ps1`:
- Around line 85-87: The empty catch block after the checksum download silently
swallows errors; update that catch to log a clear warning or informational
message (including the caught error's message) so users know checksum
verification was skipped — in the catch following the checksum fetch/download
logic, call Write-Warning or Write-Host with a descriptive message and include
$_ or $_.Exception.Message to surface the failure details.
- Around line 112-119: The interactive Read-Host prompt can hang when the script
is piped; update the block around Read-Host/$AddToPath to first detect
non-interactive execution (e.g. check if $Host.Name -ne 'ConsoleHost' or wrap a
test of [Console]::KeyAvailable in a try/catch) and, when non-interactive or an
exception occurs, default $AddToPath to 'n' (do not modify PATH); otherwise
proceed with the current logic that calls
[Environment]::SetEnvironmentVariable('PATH', "$InstallDir;$UserPath", 'User'),
updates $env:PATH and calls Write-Info — ensure the detection and fallback are
applied before calling Read-Host so piped/redirected runs never hang.
In `@install.sh`:
- Around line 141-144: The PROFILE assignments in the shell case block (the
lines setting PROFILE in the zsh/bash/fish/* branches) use quoted tildes which
won't expand; update those assignments to use $HOME (e.g.,
PROFILE="$HOME/.zshrc", PROFILE="$HOME/.bashrc",
PROFILE="$HOME/.config/fish/config.fish", PROFILE="$HOME/.profile") so the path
expands correctly when used later in the script.
- Around line 192-196: The install flow currently calls install before
verify_checksum so a potentially tampered binary can be placed and made
executable; modify the flow so checksum verification occurs before making the
binary final: either (A) adjust the sequence to call verify_checksum immediately
after get_latest_version and before install makes the file executable, or (B)
change install to download to a temporary file, run verify_checksum against that
temp file, and only move/rename it into place and set permissions if
verification succeeds; if verification fails, ensure the temp file is removed
and the script exits non‑zero (also add cleanup in the install failure path).
Reference the functions detect_platform, get_latest_version, install and
verify_checksum when updating the flow.
---
Nitpick comments:
In `@src/cli/commands/update.ts`:
- Around line 31-76: fetchJson currently stops after 5 redirects while
downloadFile allows 10, causing inconsistent behavior and potential failures for
GitHub asset downloads; update the redirect limit in fetchJson (inside the inner
get function) from 5 to 10 to match downloadFile and ensure both functions
follow the same redirect policy, keeping the same error message logic but
changing the numeric threshold and any related condition checks that reference
that limit; verify the change in the fetchJson function definition and its
get(targetUrl: string, redirectCount: number) implementation.
- Around line 210-235: The current parseVersionParts/compareSemver pair strips
pre-release suffixes and treats "v2.0.0-beta.1" as equal to "v2.0.0"; replace
this custom logic with the semver package to correctly handle pre-release and
other semver edge cases: import/require the existing semver dependency and
update compareSemver to delegate to semver.compare (or semver.rcompare as
appropriate) returning -1/0/1, and remove or stop using parseVersionParts so
pre-release tags (e.g., "-beta.1") are preserved in comparisons.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: d88889dc-4419-4e14-b1c9-82dea49dde25
⛔ Files ignored due to path filters (3)
dist/index.jsis excluded by!**/dist/**dist/index.js.mapis excluded by!**/dist/**,!**/*.mapyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (8)
.github/workflows/release-cli.ymlinstall.ps1install.shpackage.jsonsrc/cli.tssrc/cli/__tests__/cli-integration.test.tssrc/cli/__tests__/commands.test.tssrc/cli/commands/update.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/cli/tests/cli-integration.test.ts
- src/cli/tests/commands.test.ts
| } catch { | ||
| # Checksums not available for this release; continue without verification | ||
| } |
There was a problem hiding this comment.
Empty catch block silently swallows checksum fetch errors.
When the checksum file download fails, the script continues without any indication. Add a message for transparency.
🔧 Proposed fix
} catch {
# Checksums not available for this release; continue without verification
+ Write-Warn "Checksum file not available; skipping verification."
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| } catch { | |
| # Checksums not available for this release; continue without verification | |
| } | |
| } catch { | |
| # Checksums not available for this release; continue without verification | |
| Write-Warning "Checksum file not available; skipping verification." | |
| } |
🧰 Tools
🪛 PSScriptAnalyzer (1.24.0)
[warning] 85-87: Empty catch block is used. Please use Write-Error or throw statements in catch blocks.
(PSAvoidUsingEmptyCatchBlock)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@install.ps1` around lines 85 - 87, The empty catch block after the checksum
download silently swallows errors; update that catch to log a clear warning or
informational message (including the caught error's message) so users know
checksum verification was skipped — in the catch following the checksum
fetch/download logic, call Write-Warning or Write-Host with a descriptive
message and include $_ or $_.Exception.Message to surface the failure details.
| # Offer to add automatically | ||
| Write-Host "" | ||
| $AddToPath = Read-Host "Add to PATH now? (Y/n)" | ||
| if ($AddToPath -ne 'n' -and $AddToPath -ne 'N') { | ||
| [Environment]::SetEnvironmentVariable('PATH', "$InstallDir;$UserPath", 'User') | ||
| $env:PATH = "$InstallDir;$env:PATH" | ||
| Write-Info "Added to PATH. You can now run: game-ci --help" | ||
| } |
There was a problem hiding this comment.
Interactive Read-Host may fail or hang when script is piped.
The documented usage (irm ... | iex) pipes the script, which can cause Read-Host to behave unexpectedly (hang or return empty). Consider detecting non-interactive mode or defaulting to not modifying PATH when piped.
🔧 Proposed fix
# Offer to add automatically
Write-Host ""
- $AddToPath = Read-Host "Add to PATH now? (Y/n)"
- if ($AddToPath -ne 'n' -and $AddToPath -ne 'N') {
+ # Check if running interactively
+ if ([Environment]::UserInteractive -and [Console]::KeyAvailable -ne $null) {
+ $AddToPath = Read-Host "Add to PATH now? (Y/n)"
+ if ($AddToPath -ne 'n' -and $AddToPath -ne 'N') {
+ [Environment]::SetEnvironmentVariable('PATH', "$InstallDir;$UserPath", 'User')
+ $env:PATH = "$InstallDir;$env:PATH"
+ Write-Info "Added to PATH. You can now run: game-ci --help"
+ }
+ } else {
+ Write-Info "Run the command above to add game-ci to your PATH."
+ }Alternatively, wrap in a try/catch to handle the piped scenario gracefully.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Offer to add automatically | |
| Write-Host "" | |
| $AddToPath = Read-Host "Add to PATH now? (Y/n)" | |
| if ($AddToPath -ne 'n' -and $AddToPath -ne 'N') { | |
| [Environment]::SetEnvironmentVariable('PATH', "$InstallDir;$UserPath", 'User') | |
| $env:PATH = "$InstallDir;$env:PATH" | |
| Write-Info "Added to PATH. You can now run: game-ci --help" | |
| } | |
| # Offer to add automatically | |
| Write-Host "" | |
| # Check if running interactively | |
| if ([Environment]::UserInteractive -and [Console]::KeyAvailable -ne $null) { | |
| $AddToPath = Read-Host "Add to PATH now? (Y/n)" | |
| if ($AddToPath -ne 'n' -and $AddToPath -ne 'N') { | |
| [Environment]::SetEnvironmentVariable('PATH', "$InstallDir;$UserPath", 'User') | |
| $env:PATH = "$InstallDir;$env:PATH" | |
| Write-Info "Added to PATH. You can now run: game-ci --help" | |
| } | |
| } else { | |
| Write-Info "Run the command above to add game-ci to your PATH." | |
| } |
🧰 Tools
🪛 PSScriptAnalyzer (1.24.0)
[warning] 113-113: File 'install.ps1' uses Write-Host. Avoid using Write-Host because it might not work in all hosts, does not work when there is no host, and (prior to PS 5.0) cannot be suppressed, captured, or redirected. Instead, use Write-Output, Write-Verbose, or Write-Information.
(PSAvoidUsingWriteHost)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@install.ps1` around lines 112 - 119, The interactive Read-Host prompt can
hang when the script is piped; update the block around Read-Host/$AddToPath to
first detect non-interactive execution (e.g. check if $Host.Name -ne
'ConsoleHost' or wrap a test of [Console]::KeyAvailable in a try/catch) and,
when non-interactive or an exception occurs, default $AddToPath to 'n' (do not
modify PATH); otherwise proceed with the current logic that calls
[Environment]::SetEnvironmentVariable('PATH', "$InstallDir;$UserPath", 'User'),
updates $env:PATH and calls Write-Info — ensure the detection and fallback are
applied before calling Read-Host so piped/redirected runs never hang.
| zsh) PROFILE="~/.zshrc" ;; | ||
| bash) PROFILE="~/.bashrc" ;; | ||
| fish) PROFILE="~/.config/fish/config.fish" ;; | ||
| *) PROFILE="~/.profile" ;; |
There was a problem hiding this comment.
Tilde does not expand inside quotes; use $HOME instead.
The PROFILE assignments use quoted tildes (e.g., "~/.zshrc"), which won't expand to the user's home directory when printed or used.
🔧 Proposed fix
case "$SHELL_NAME" in
- zsh) PROFILE="~/.zshrc" ;;
- bash) PROFILE="~/.bashrc" ;;
- fish) PROFILE="~/.config/fish/config.fish" ;;
- *) PROFILE="~/.profile" ;;
+ zsh) PROFILE="$HOME/.zshrc" ;;
+ bash) PROFILE="$HOME/.bashrc" ;;
+ fish) PROFILE="$HOME/.config/fish/config.fish" ;;
+ *) PROFILE="$HOME/.profile" ;;
esac📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| zsh) PROFILE="~/.zshrc" ;; | |
| bash) PROFILE="~/.bashrc" ;; | |
| fish) PROFILE="~/.config/fish/config.fish" ;; | |
| *) PROFILE="~/.profile" ;; | |
| zsh) PROFILE="$HOME/.zshrc" ;; | |
| bash) PROFILE="$HOME/.bashrc" ;; | |
| fish) PROFILE="$HOME/.config/fish/config.fish" ;; | |
| *) PROFILE="$HOME/.profile" ;; |
🧰 Tools
🪛 Shellcheck (0.11.0)
[warning] 141-141: Tilde does not expand in quotes. Use $HOME.
(SC2088)
[warning] 142-142: Tilde does not expand in quotes. Use $HOME.
(SC2088)
[warning] 143-143: Tilde does not expand in quotes. Use $HOME.
(SC2088)
[warning] 144-144: Tilde does not expand in quotes. Use $HOME.
(SC2088)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@install.sh` around lines 141 - 144, The PROFILE assignments in the shell case
block (the lines setting PROFILE in the zsh/bash/fish/* branches) use quoted
tildes which won't expand; update those assignments to use $HOME (e.g.,
PROFILE="$HOME/.zshrc", PROFILE="$HOME/.bashrc",
PROFILE="$HOME/.config/fish/config.fish", PROFILE="$HOME/.profile") so the path
expands correctly when used later in the script.
| # Main | ||
| detect_platform | ||
| get_latest_version | ||
| install | ||
| verify_checksum |
There was a problem hiding this comment.
Checksum verification occurs after binary is already installed.
The verify_checksum function is called after install, meaning a potentially corrupted or tampered binary is already written to disk and made executable before verification. If checksum verification fails, the binary remains installed.
Reorder to verify checksum before making the binary executable, or clean up on failure:
🔧 Proposed fix
# Main
detect_platform
get_latest_version
install
-verify_checksum
+verify_checksum || {
+ rm -f "${INSTALL_DIR}/${BINARY_NAME}"
+ error "Checksum verification failed. Binary removed."
+}Alternatively, restructure to download to a temp file first, verify, then move to final location (similar to how install.ps1 handles this with Remove-Item on failure at line 81).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Main | |
| detect_platform | |
| get_latest_version | |
| install | |
| verify_checksum | |
| # Main | |
| detect_platform | |
| get_latest_version | |
| install | |
| verify_checksum || { | |
| rm -f "${INSTALL_DIR}/${BINARY_NAME}" | |
| error "Checksum verification failed. Binary removed." | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@install.sh` around lines 192 - 196, The install flow currently calls install
before verify_checksum so a potentially tampered binary can be placed and made
executable; modify the flow so checksum verification occurs before making the
binary final: either (A) adjust the sequence to call verify_checksum immediately
after get_latest_version and before install makes the file executable, or (B)
change install to download to a temporary file, run verify_checksum against that
temp file, and only move/rename it into place and set permissions if
verification succeeds; if verification fails, ensure the temp file is removed
and the script exits non‑zero (also add cleanup in the install failure path).
Reference the functions detect_platform, get_latest_version, install and
verify_checksum when updating the flow.
…safety - Add process.exit(1) in cli.ts catch block so failures produce non-zero exit codes - Add 6 missing build inputs: containerRegistryRepository, containerRegistryImageVersion, dockerIsolationMode, sshPublicKeysDirectoryPath, cacheUnityInstallationOnMac, unityHubVersionOnMac - Add 6 missing orchestrate inputs: kubeStorageClass, readInputFromOverrideList, readInputOverrideCommand, postBuildSteps, preBuildSteps, customJob - Fix activate command description to accurately reflect verification behavior - Add null check before accessing result.BuildResults in orchestrate handler Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
♻️ Duplicate comments (3)
src/cli.ts (2)
34-38:⚠️ Potential issue | 🟠 MajorMap
YErrorto exit code2in the top-level catch.Line 35 currently skips
YErrorentirely, so parser/configuration failures can miss the documented config-error exit code.Suggested fix
} catch (error: any) { - if (error.name !== 'YError') { - core.error(`Error: ${error.message}`); - process.exit(1); - } + if (error?.name === 'YError') { + core.error(`Error: ${error?.message ?? String(error)}`); + process.exit(2); + } + core.error(`Error: ${error?.message ?? String(error)}`); + process.exit(1); }#!/bin/bash # Verify current top-level error mapping and related tests. rg -n -C3 "YError|process\\.exit\\(|cli\\.parse\\(" src/cli.ts rg -n -C3 "exit code|YError|parse" src/cli/__tests__🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli.ts` around lines 34 - 38, The top-level catch in main CLI (catch block around cli.parse in src/cli.ts) currently ignores errors with error.name === 'YError', causing config/parse failures to not trigger the documented config-error exit code; update that catch to detect YError and map it to process.exit(2) (and emit a clear error via core.error or similar before exiting), while preserving the existing behavior for non-YError cases (still logging error.message and exiting with code 1).
4-4:⚠️ Potential issue | 🟡 MinorRemove the stale eslint-disable directive.
Line 4 still suppresses
import/no-unresolvedwithout an active violation and triggerseslint-comments/no-unused-disable.Suggested fix
import yargs from 'yargs'; -// eslint-disable-next-line import/no-unresolved import { hideBin } from 'yargs/helpers';🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli.ts` at line 4, Remove the stale ESLint disable comment "// eslint-disable-next-line import/no-unresolved" at the top of src/cli.ts (the unused inline eslint-disable directive) so eslint-comments/no-unused-disable no longer flags it; simply delete that line (or replace it with a contextual, valid comment only if an actual import/no-unresolved violation exists), leaving the rest of the file and imports unchanged.src/cli/commands/activate.ts (1)
42-45:⚠️ Potential issue | 🟠 MajorUse unified
Inputaccessors for activation inputs.Lines 42-45 bypass the mapped CLI input pipeline, so activation resolution can diverge from build/orchestrate behavior.
Suggested fix
import type { CommandModule } from 'yargs'; import * as core from '@actions/core'; import { mapCliArgumentsToInput, CliArguments } from '../input-mapper'; +import Input from '../../model/input'; @@ - const unitySerial = process.env.UNITY_SERIAL; - const unityLicense = process.env.UNITY_LICENSE; - const licensingServer = cliArguments.unityLicensingServer || process.env.UNITY_LICENSING_SERVER || ''; + const unitySerial = Input.unitySerial; + const unityLicense = Input.unityLicense; + const licensingServer = Input.unityLicensingServer || '';🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli/commands/activate.ts` around lines 42 - 45, The activation code is reading environment/cli args directly (unitySerial, unityLicense, licensingServer) instead of the project's unified Input accessors; replace those direct reads with the mapped Input API (e.g., use Input.get or the project's Input.resolve accessor for the keys used elsewhere such as "unitySerial", "unityLicense", and "unityLicensingServer"), preserve the fallback/default behavior (empty string) and ensure Input is imported where activate.ts declares const unitySerial/const unityLicense/const licensingServer so activation uses the same input pipeline as build/orchestrate.
🧹 Nitpick comments (1)
src/cli/commands/build.ts (1)
167-172: Convertrun-as-host-userandskip-activationflags to boolean type for improved CLI ergonomics.These options are currently defined as strings, which requires users to pass
--skip-activation=trueinstead of just--skip-activation. Converting to boolean types aligns with their semantic meaning and the existinginput-mapperalready handles conversion to strings (line 96) for downstream compatibility.Apply to:
src/cli/commands/build.ts:run-as-host-user(lines 167–172) andskip-activation(lines 197–202)src/cli/commands/orchestrate.ts:skip-activation(lines 135–140)src/cli/input-mapper.ts: UpdateCliArgumentsinterface to declarerunAsHostUserandskipActivationas boolean (lines 44, 62)Suggested refactor for build.ts
.option('run-as-host-user', { alias: 'runAsHostUser', - type: 'string', + type: 'boolean', description: 'Whether to run as a user that matches the host system', - default: 'false', + default: false, }) @@ .option('skip-activation', { alias: 'skipActivation', - type: 'string', + type: 'boolean', description: 'Skip the activation/deactivation of Unity', - default: 'false', + default: false, })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/cli/commands/build.ts` around lines 167 - 172, Change the CLI flags from string to boolean: update the .option entries for 'run-as-host-user' and 'skip-activation' in the build command (the .option calls with alias runAsHostUser and skipActivation) and the 'skip-activation' option in the orchestrate command to use type: 'boolean' and default: false (leave aliases unchanged). Also update the CliArguments interface in input-mapper (fields runAsHostUser and skipActivation) to be boolean types so downstream code and the existing string conversion remain compatible. Ensure no other logic expects string values for these flags (adjust any parsing that assumes strings if present).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/cli.ts`:
- Around line 34-38: The top-level catch in main CLI (catch block around
cli.parse in src/cli.ts) currently ignores errors with error.name === 'YError',
causing config/parse failures to not trigger the documented config-error exit
code; update that catch to detect YError and map it to process.exit(2) (and emit
a clear error via core.error or similar before exiting), while preserving the
existing behavior for non-YError cases (still logging error.message and exiting
with code 1).
- Line 4: Remove the stale ESLint disable comment "// eslint-disable-next-line
import/no-unresolved" at the top of src/cli.ts (the unused inline eslint-disable
directive) so eslint-comments/no-unused-disable no longer flags it; simply
delete that line (or replace it with a contextual, valid comment only if an
actual import/no-unresolved violation exists), leaving the rest of the file and
imports unchanged.
In `@src/cli/commands/activate.ts`:
- Around line 42-45: The activation code is reading environment/cli args
directly (unitySerial, unityLicense, licensingServer) instead of the project's
unified Input accessors; replace those direct reads with the mapped Input API
(e.g., use Input.get or the project's Input.resolve accessor for the keys used
elsewhere such as "unitySerial", "unityLicense", and "unityLicensingServer"),
preserve the fallback/default behavior (empty string) and ensure Input is
imported where activate.ts declares const unitySerial/const unityLicense/const
licensingServer so activation uses the same input pipeline as build/orchestrate.
---
Nitpick comments:
In `@src/cli/commands/build.ts`:
- Around line 167-172: Change the CLI flags from string to boolean: update the
.option entries for 'run-as-host-user' and 'skip-activation' in the build
command (the .option calls with alias runAsHostUser and skipActivation) and the
'skip-activation' option in the orchestrate command to use type: 'boolean' and
default: false (leave aliases unchanged). Also update the CliArguments interface
in input-mapper (fields runAsHostUser and skipActivation) to be boolean types so
downstream code and the existing string conversion remain compatible. Ensure no
other logic expects string values for these flags (adjust any parsing that
assumes strings if present).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 8ea8550a-1f3b-4d29-bc10-148f4b7f603e
📒 Files selected for processing (5)
src/cli.tssrc/cli/commands/activate.tssrc/cli/commands/build.tssrc/cli/commands/orchestrate.tssrc/cli/input-mapper.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/cli/commands/orchestrate.ts
| name: Build ${{ matrix.target }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - target: linux-x64 | ||
| os: ubuntu-latest | ||
| pkg-target: node20-linux-x64 | ||
| binary-name: game-ci-linux-x64 | ||
| - target: linux-arm64 | ||
| os: ubuntu-latest | ||
| pkg-target: node20-linux-arm64 | ||
| binary-name: game-ci-linux-arm64 | ||
| - target: macos-x64 | ||
| os: macos-latest | ||
| pkg-target: node20-macos-x64 | ||
| binary-name: game-ci-macos-x64 | ||
| - target: macos-arm64 | ||
| os: macos-latest | ||
| pkg-target: node20-macos-arm64 | ||
| binary-name: game-ci-macos-arm64 | ||
| - target: windows-x64 | ||
| os: windows-latest | ||
| pkg-target: node20-win-x64 | ||
| binary-name: game-ci-windows-x64.exe | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.release.tag_name || inputs.tag || github.ref }} | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install dependencies | ||
| run: yarn install --frozen-lockfile | ||
|
|
||
| - name: Build TypeScript | ||
| run: yarn build | ||
|
|
||
| - name: Verify CLI before packaging | ||
| run: node lib/cli.js version | ||
|
|
||
| - name: Build standalone binary | ||
| run: npx pkg lib/cli.js --target ${{ matrix.pkg-target }} --output ${{ matrix.binary-name }} --compress GZip | ||
|
|
||
| - name: Verify standalone binary (non-cross-compiled) | ||
| if: | | ||
| (matrix.target == 'linux-x64' && runner.os == 'Linux') || | ||
| (matrix.target == 'macos-arm64' && runner.os == 'macOS' && runner.arch == 'ARM64') || | ||
| (matrix.target == 'macos-x64' && runner.os == 'macOS' && runner.arch == 'X64') || | ||
| (matrix.target == 'windows-x64' && runner.os == 'Windows') | ||
| run: ./${{ matrix.binary-name }} version | ||
| shell: bash | ||
|
|
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: binary-${{ matrix.target }} | ||
| path: ${{ matrix.binary-name }} | ||
| retention-days: 5 | ||
|
|
||
| create-checksums-and-upload: |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 5 months ago
Generally, the fix is to explicitly set least-privilege permissions for any job (or workflow) that uses the default GITHUB_TOKEN permissions. For this workflow, the build-binaries job only needs to read repository contents and interact with artifacts; it does not write to the repository, issues, or releases. Therefore, we should give it contents: read.
The best minimal fix without changing functionality is to add a permissions block under the build-binaries job, similar to the other jobs. Concretely, in .github/workflows/release-cli.yml, under jobs:, within the build-binaries: job definition and alongside runs-on and strategy, insert:
permissions:
contents: readNo additional imports, methods, or definitions are needed; this is purely a YAML configuration change in the workflow file.
| @@ -23,6 +23,8 @@ | ||
| build-binaries: | ||
| name: Build ${{ matrix.target }} | ||
| runs-on: ${{ matrix.os }} | ||
| permissions: | ||
| contents: read | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: |
yargs@18.0.0 requires Node.js >=20.19.0 but the integrity-check workflow was using Node 18, causing `yarn install` to fail with an engine incompatibility error. Updated the workflow to Node 20 (matching volta config and all other workflows) and aligned the engines field in package.json accordingly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
package.json (1)
48-49:⚠️ Potential issue | 🟠 MajorTighten the Node floor to match
yargs@18requirements.Line 48 (
>=20.x) still allows unsupported Node 20 minors (20.0–20.18) for Line 77 (yargs@^18). This can break installs for valid-on-paper environments (including current Volta pin at Line 109).Proposed fix
"engines": { - "node": ">=20.x" + "node": ">=20.19.0" }, @@ "volta": { - "node": "20.5.1", + "node": "20.19.0", "yarn": "1.22.19" }#!/bin/bash set -euo pipefail echo "Project engine:" jq -r '.engines.node' package.json echo "Volta node pin:" jq -r '.volta.node' package.json echo "yargs dependency range:" jq -r '.dependencies.yargs' package.json echo "yargs@18.0.0 engine metadata:" npm view yargs@18.0.0 engines --jsonExpected verification result:
yargs@18.0.0requires Node^20.19.0 || ^22.12.0 || >=23, so project constraints should not permit lower 20.x versions.Also applies to: 77-77
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@package.json` around lines 48 - 49, The project Node engine floor ("engines.node") is too loose (">=20.x") for yargs@18 which requires Node >=20.19.0; update package.json to tighten engines.node to at least ">=20.19.0" (or mirror yargs' engines string "^20.19.0 || ^22.12.0 || >=23") and also update the Volta pin ("volta.node") to a matching minimum (e.g., "20.19.0") so installs cannot select unsupported 20.x minors; ensure you verify changes against dependencies.yargs (which is ^18) to keep constraints consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@package.json`:
- Around line 48-49: The project Node engine floor ("engines.node") is too loose
(">=20.x") for yargs@18 which requires Node >=20.19.0; update package.json to
tighten engines.node to at least ">=20.19.0" (or mirror yargs' engines string
"^20.19.0 || ^22.12.0 || >=23") and also update the Volta pin ("volta.node") to
a matching minimum (e.g., "20.19.0") so installs cannot select unsupported 20.x
minors; ensure you verify changes against dependencies.yargs (which is ^18) to
keep constraints consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: e7851364-63cd-4f42-88f5-99ca8a729d47
📒 Files selected for processing (2)
.github/workflows/integrity-check.ymlpackage.json
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #813 +/- ##
==========================================
- Coverage 31.25% 29.64% -1.61%
==========================================
Files 84 100 +16
Lines 4563 5188 +625
Branches 1103 1241 +138
==========================================
+ Hits 1426 1538 +112
- Misses 3137 3650 +513
🚀 New features to boost your workflow:
|
…, 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>
Use the Checks API to flip failed macOS build conclusions to neutral (gray dash) so unstable builds don't show red X marks on PRs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Stop modifying the macOS build workflow — leave it identical to main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ility yargs@18 requires Node >=20.19.0 which is incompatible with CI's Node 18. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The orchestrator-develop branch no longer exists. Update all fallback clone commands and test fixtures to use main instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Delete src/cli.ts, src/cli/ (commands, tests, input-mapper) — moved to game-ci/orchestrator repo (PR #813 reference) - Delete .github/workflows/release-cli.yml — moved to orchestrator - Remove bin, pkg, yargs, @types/yargs, pkg from package.json - Fix validate-orchestrator.yml: - Build TypeScript before running require() smoke tests - Remove || echo fallback that swallowed errors - Add smoke test that installs orchestrator via npm pack and verifies loadOrchestrator() returns defined exports Legacy src/model/cli/ (Cli class, CliFunctionsRepository) preserved — used by Input.getInput() and build-parameters.ts on main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Closing — CLI has been moved to the standalone All CLI commands (build, orchestrate, activate, status, version, update, cache), input-mapper, tests, and release-cli.yml workflow are present in the orchestrator repo. See PR #819 for the extraction. |
…#819) * feat(orchestrator): enterprise feature support — CLI provider, submodule profiles, caching, LFS, hooks Add generic enterprise-grade features to the orchestrator, enabling Unity projects with complex CI/CD pipelines to adopt game-ci/unity-builder with built-in support for: - CLI provider protocol: JSON-over-stdin/stdout bridge enabling providers in any language (Go, Python, Rust, shell) via the `providerExecutable` input - Submodule profiles: YAML-based selective submodule initialization with glob patterns and variant overlays (`submoduleProfilePath`, `submoduleVariantPath`) - Local build caching: Filesystem-based Library and LFS caching for local builds without external cache actions (`localCacheEnabled`, `localCacheRoot`) - Custom LFS transfer agents: Register external transfer agents like elastic-git-storage (`lfsTransferAgent`, `lfsTransferAgentArgs`, `lfsStoragePaths`) - Git hooks support: Detect and install lefthook/husky with configurable skip lists (`gitHooksEnabled`, `gitHooksSkipList`) Also removes all `orchestrator-develop` branch references, replacing with `main`. 13 new action inputs, 13 new files, 14 new CLI provider tests, 17 submodule tests, plus cache/LFS/hooks unit tests. All 452 tests pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): add experimental GCP Cloud Run and Azure ACI providers Add two new cloud provider implementations for the orchestrator, both marked as experimental: - **GCP Cloud Run Jobs** (`providerStrategy: gcp-cloud-run`): Executes Unity builds as Cloud Run Jobs with GCS FUSE for large artifact storage. Supports configurable machine types, service accounts, and VPC connectors. 7 new inputs (gcpProject, gcpRegion, gcpBucket, gcpMachineType, gcpDiskSizeGb, gcpServiceAccount, gcpVpcConnector). - **Azure Container Instances** (`providerStrategy: azure-aci`): Executes Unity builds as ACI containers with Azure File Shares (Premium FileStorage) for large artifact storage up to 100 TiB. Supports configurable CPU/memory, VNet integration, and subscription targeting. 9 new inputs (azureResourceGroup, azureLocation, azureStorageAccount, azureFileShareName, azureSubscriptionId, azureCpu, azureMemoryGb, azureDiskSizeGb, azureSubnetId). Both providers use their respective CLIs (gcloud, az) for infrastructure management and support garbage collection of old build resources. No tests included as these require real cloud infrastructure to validate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): multi-storage support for GCP and Azure providers Both providers now support four storage backends via gcpStorageType / azureStorageType: GCP Cloud Run: - gcs-fuse: Mount GCS bucket as POSIX filesystem (unlimited, best for large sequential I/O) - gcs-copy: Copy artifacts in/out via gsutil (simpler, no FUSE overhead) - nfs: Filestore NFS mount (true POSIX, good random I/O, up to 100 TiB) - in-memory: tmpfs (fastest, volatile, up to 32 GiB) Azure ACI: - azure-files: SMB file share mount (up to 100 TiB, premium throughput) - blob-copy: Copy artifacts in/out via az storage blob (no mount overhead) - azure-files-nfs: NFS 4.1 file share mount (true POSIX, no SMB lock overhead) - in-memory: emptyDir tmpfs (fastest, volatile, limited by container memory) New inputs: gcpStorageType, gcpFilestoreIp, gcpFilestoreShare, azureStorageType, azureBlobContainer. Constructor validates storage config and warns on missing prerequisites (e.g. NFS requires VPC connector/subnet). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): automatic provider fallback with runner availability check Adds built-in load balancing: check GitHub runner availability before builds start, auto-route to a fallback provider when runners are busy or offline. Eliminates the need for a separate check-runner job. New inputs: fallbackProviderStrategy, runnerCheckEnabled, runnerCheckLabels, runnerCheckMinAvailable. Outputs providerFallbackUsed and providerFallbackReason for workflow visibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): add retry-on-fallback and provider init timeout Adds retryOnFallback (retry failed builds on alternate provider) and providerInitTimeout (swap provider if init takes too long). Refactors run() into run()/runWithProvider() to support retry loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: format changed files with prettier Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test(orchestrator): expand local cache service test coverage Adds tests for cache hit restore (picks latest tar), LFS cache restore/save, garbage collection age filtering, and edge cases like permission errors and empty directories. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test(orchestrator): add runner availability service tests Covers: no token skip, no runners fallback, busy/offline runners, label filtering (case-insensitive), minAvailable threshold, fail-open on API error, mixed runner states. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test(orchestrator): add unit tests for untested core services Adds 64 new mock-based unit tests covering orchestrator services that previously had zero test coverage: - TaskParameterSerializer: env var format conversion, round-trip, uniqBy deduplication, blocked params, default secrets - FollowLogStreamService: build output message parsing — end of transmission, build success/failure detection, error accumulation, Library rebuild detection - OrchestratorNamespace (guid): GUID generation format, platform name normalization, nanoid uniqueness - OrchestratorFolders: path computation for all folder getters, ToLinuxFolder conversion, repo URL generation, purge flag detection All tests are pure mock-based and run without any external infrastructure (no LocalStack, K8s, Docker, or AWS). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci(orchestrator): add fast unit test gate to integrity workflow Adds a fast-fail unit test step at the top of orchestrator-integrity, right after yarn install and before any infrastructure setup (k3d, LocalStack). Runs 113 mock-based orchestrator tests in ~5 seconds. If serialization, path computation, log parsing, or provider loading is broken, the workflow fails immediately instead of spending 30+ minutes setting up LocalStack and k3d clusters. Tests included: orchestrator-guid, orchestrator-folders, task-parameter-serializer, follow-log-stream-service, runner-availability-service, provider-url-parser, provider-loader, provider-git-manager, orchestrator-image, orchestrator-hooks, orchestrator-github-checks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test(orchestrator): expand unit tests for enterprise services Add comprehensive tests for CLI provider (cleanupWorkflow, garbageCollect, listWorkflow, watchWorkflow, stderr forwarding, timeout handling), local cache service (saveLfsCache full path and error handling), git hooks service (husky install, failure logging, edge cases), and LFS agent service (empty storagePaths, validate logging). 73 tests across 4 test files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(orchestrator): use http.extraHeader for secure git authentication Replace token-in-URL pattern with http.extraHeader for git clone and LFS operations. The token no longer appears in clone URLs, git remote config, or process command lines. Add gitAuthMode input (default: 'header', legacy: 'url') so users can fall back to the old behavior if needed. Closes #785 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): add premade secret sources and YAML definitions Add SecretSourceService with premade secret source integrations: - aws-secrets-manager (with --query SecretString for direct value) - aws-parameter-store (with --with-decryption) - gcp-secret-manager (latest version) - azure-key-vault (via $AZURE_VAULT_NAME env var) - env (environment variables, no shell command needed) - Custom commands (any string with {0} placeholder) - YAML file definitions for custom sources Add secretSource input that takes precedence over inputPullCommand. Backward compatible — existing inputPullCommand behavior unchanged. Closes #776 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(secrets): add HashiCorp Vault as first-class premade secret source Adds three Vault entries: hashicorp-vault (KV v2), hashicorp-vault-kv1 (KV v1), and vault (short alias). Uses VAULT_ADDR for server address and VAULT_MOUNT env var for configurable mount path (defaults to 'secret'). Refs #776 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(lfs): add built-in elastic-git-storage support with auto-install First-class support for elastic-git-storage as a custom LFS transfer agent. When lfsTransferAgent is set to "elastic-git-storage" (or "elastic-git-storage@v1.0.0" for a specific version), the service automatically finds or installs the agent from GitHub releases, then configures it via git config. Supports version pinning via @Version suffix in the agent value, eliminating the need for a separate version parameter. Platform and architecture detection handles linux/darwin/windows on amd64/arm64. 37 unit tests covering detection, PATH lookup, installation, version parsing, and configuration delegation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(hooks): add Unity Git Hooks integration and runHookGroups Built-in support for Unity Git Hooks (com.frostebite.unitygithooks): - Auto-detect UPM package in Packages/manifest.json - Run init-unity-lefthook.js before hook installation - Set CI-friendly env vars (disable background project mode) New gitHooksRunBeforeBuild input runs specific lefthook groups before the Unity build, allowing CI to trigger pre-commit or pre-push checks that normally only fire on git events. 35 unit tests covering detection, init, CI env, group execution, and failure handling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): add test workflow engine placeholder Initial scaffold for the test workflow engine service directory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): add hot runner protocol placeholder Initial scaffold for the runner registration and hot editor provider module. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): generic artifact system — output types, manifests, and collection service Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): incremental sync protocol — git delta, direct input, and storage-backed sync Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: community plugin validation workflow (#800) Add scheduled workflow that validates community Unity packages compile and build correctly using unity-builder. Runs weekly on Sunday. Includes: - YAML plugin registry (community-plugins.yml) for package listings - Matrix expansion across plugins and platforms - Automatic failure reporting via GitHub issues - Manual trigger with plugin filter and Unity version override Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): CI platform providers — Remote PowerShell, GitHub Actions, GitLab CI, Ansible Add four new providers that delegate builds to external CI platforms: - remote-powershell: Execute on remote machines via WinRM/SSH - github-actions: Dispatch workflow_dispatch on target repository - gitlab-ci: Trigger pipeline via GitLab API - ansible: Run playbooks against managed inventory Each follows the CI-as-a-provider pattern: trigger remote job, pass build parameters, stream logs, report status. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix prettier formatting and eslint errors on test files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(orchestrator): build reliability features — git integrity, reserved filename cleanup, archival Add three optional reliability features for hardening CI pipelines: - Git corruption detection & recovery (fsck, stale lock cleanup, submodule backing store validation, auto-recovery) - Reserved filename cleanup (removes Windows device names that cause Unity asset importer infinite loops) - Build output archival with configurable retention policy All features are opt-in and fail gracefully with warnings only. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(reliability): implement build reliability service with git integrity, reserved filename cleanup, and build archival Adds BuildReliabilityService with the following capabilities: - checkGitIntegrity(): runs git fsck --no-dangling and parses output for corruption - cleanStaleLockFiles(): removes stale .lock files older than 10 minutes - validateSubmoduleBackingStores(): validates .git files point to valid backing stores - recoverCorruptedRepo(): orchestrates fsck, lock cleanup, re-fetch, retry fsck - cleanReservedFilenames(): removes Windows reserved filenames (con, prn, aux, nul, com1-9, lpt1-9) - archiveBuildOutput(): creates tar.gz archive of build output - enforceRetention(): deletes archives older than retention period - configureGitEnvironment(): sets GIT_TERMINAL_PROMPT=0, http.postBuffer, core.longpaths Wired into action.yml as opt-in inputs, with pre-build integrity checks and post-build archival in the main entry point. Includes 29 unit tests covering success and failure cases for all methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test(providers): add comprehensive unit tests for GitHub Actions, GitLab CI, PowerShell, and Ansible providers (#806) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(hot-runner): implement hot runner protocol with registry, health monitoring, and job dispatch (#791) Adds persistent Unity editor instance support to reduce build iteration time by eliminating cold-start overhead. Includes: - HotRunnerTypes: interfaces for config, status, job request/result, transport - HotRunnerRegistry: in-memory runner management with file-based persistence - HotRunnerHealthMonitor: periodic health checks, idle recycling, job-count recycling - HotRunnerDispatcher: job routing with wait-for-runner, timeout, and output streaming - HotRunnerService: high-level API integrating registry, health, and dispatch - 34 unit tests covering registration, filtering, health, dispatch, timeout, fallback - action.yml inputs for hot runner configuration (7 new inputs) - Input/BuildParameters integration for hot runner settings - index.ts wiring with cold-build fallback when hot runner unavailable Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(artifacts): complete generic artifact system with upload handlers, tests, and action integration (#798) - Add ArtifactUploadHandler with support for github-artifacts, storage (rclone), and local copy upload targets, including large file chunking for GitHub Artifacts - Add 44 unit tests covering OutputTypeRegistry, OutputService, and ArtifactUploadHandler (config parsing, upload coordination, file collection) - Add 6 new action.yml inputs for artifact configuration - Add artifactManifestPath action output - Wire artifact collection and upload into index.ts post-build flow Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(testing): implement test workflow engine with YAML suites, taxonomy filtering, and structured results (#790) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(sync): complete incremental sync protocol with storage-pull, state management, and tests (#799) - Add storage-pull strategy: rclone-based sync from remote storage with overlay and clean modes, URI parsing (storage://remote:bucket/path), transfer parallelism, and automatic rclone availability checking - Add SyncStateManager: persistent state load/save with configurable paths, workspace hash calculation via SHA-256 of key project files, and drift detection for external modification awareness - Add action.yml inputs: syncStrategy, syncInputRef, syncStorageRemote, syncRevertAfter, syncStatePath with sensible defaults - Wire sync into Input (5 getters), BuildParameters (5 fields), index.ts (local build path), and RemoteClient (orchestrator path) with post-job overlay revert when syncRevertAfter is true - Add 42 unit tests covering all strategies, URI parsing, state management, hash calculation, drift detection, error handling, and edge cases (missing rclone, invalid URIs, absent state, empty diffs) - Add root:true to eslintrc to prevent plugin resolution conflicts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(cache): add child workspace isolation for multi-product CI builds (#777) Implement two-level workspace isolation pattern for enterprise-scale CI: - Atomic O(1) workspace restore via filesystem move (no tar/download/extract) - Separate Library caching for independent restore - .git preservation for delta operations - Stale workspace cleanup with configurable retention policies - 5 new action inputs: childWorkspacesEnabled, childWorkspaceName, childWorkspaceCacheRoot, childWorkspacePreserveGit, childWorkspaceSeparateLibrary - 28 unit tests covering all service methods This enables enterprise CI where workspaces are 50GB+ and traditional caching via actions/cache is impractical. On NTFS, workspace restore is O(1) via atomic rename when source and destination are on the same volume. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(testing): use async exec for parallel test group execution Replace execSync with promisified exec so Promise.all actually runs test groups in parallel. Add native timeout support via exec options. Add 50MB maxBuffer for large Unity output. Fix ESLint violations (variable naming, padding lines, array push consolidation). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(cli-provider): add timeout protection for external CLI processes Prevent builds from hanging indefinitely when CLI provider subprocess is unresponsive. Default 2h for runTaskInWorkflow, 1h for watchWorkflow. Graceful SIGTERM with 10s grace before SIGKILL. - Added RUN_TASK_TIMEOUT_MS (2 hours) and WATCH_WORKFLOW_TIMEOUT_MS (1 hour) - Added gracefulKill helper: SIGTERM first, SIGKILL after 10s grace period - runTaskInWorkflow and watchWorkflow now have timeout protection - Existing execute() method upgraded to use gracefulKill - core.error() called with clear human-readable timeout message - Added comprehensive tests: timeout triggers, SIGKILL escalation, grace period cancellation on voluntary exit, normal completion Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(secrets): prevent shell injection in secret key names and mask values - Validate secret key names against alphanumeric allowlist before shell interpolation - Apply validation in both SecretSourceService.fetchSecret() and legacy queryOverride() - Mask fetched secret values with core.setSecret() to prevent log exposure - Add 20 new tests for validation and masking Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: rebuild dist for cli-provider timeout changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(artifacts): validate rclone availability before storage upload Check for rclone binary before attempting storage-based uploads. Validate storage destination URI format (remoteName:path). Provide clear error message with install link when rclone is missing. Fail gracefully instead of cryptic ENOENT crash. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(load-balancing): add pagination limits and rate-limit detection Cap pagination at 100 pages (10,000 runners max), detect GitHub API rate limiting (403/429) with reset time reporting, add 30-second total timeout for pagination loop. Log clear diagnostic when no runners found suggesting possible causes (token permissions, runner registration). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(reliability): add disk space validation before build archival Check available disk space (cross-platform: wmic/df) before archive operations to prevent data loss on full disks. Skip archival with warning if insufficient space (10% safety margin). Clean up partial archives on tar failure. Proceed with warning when space check fails. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(hot-runner): validate persisted registry state and add dispatcher safeguards Validate runner entries when loading from hot-runners.json. Discard corrupted entries with warnings. Add validateAndRepair() method for runtime recovery. Validate data before persisting to prevent writing corrupt state. Handle corrupt persistence files (invalid JSON) gracefully. Rewrite executeWithTimeout using Promise.race to clean up transport connections on timeout. Fix pre-existing ESLint violations in dispatcher and test files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(providers): add polling timeouts, fix credential parsing, validate dependencies - GitHub Actions: max 4-hour polling with clear timeout error including run URL - GitLab CI: max 4-hour polling with clear timeout error including pipeline URL - Remote PowerShell: fix credential split to preserve passwords with colons (split on first colon only instead of all colons) - Remote PowerShell: throw clear error when credential format is invalid - Ansible: validate ansible-playbook binary exists in setupWorkflow (separate from ansible --version check) - All timeout errors use core.error() for GitHub Actions annotation visibility Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: rebuild dist for provider timeout and credential fixes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: prettier formatting for orchestrator-folders-auth test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: split orchestrator integrity into parallel jobs for faster validation Rewrite the monolith orchestrator-integrity.yml (1110 lines, single job, 3+ hour sequential execution) into 4 parallel jobs that run on separate runners: - k8s-tests: k3d cluster + LocalStack, 5 tests - aws-provider-tests: LocalStack only, 10 tests - local-docker-tests: Docker + LocalStack for S3 tests, 9 tests - rclone-tests: rclone + LocalStack, 1 test Key improvements: - Wall-clock time drops from ~3h to ~1h (longest single job) - Disk exhaustion eliminated: each job gets its own fresh 14GB runner - Cleanup logic deduplicated via sourced shell functions instead of 15 copy-pasted 30-line blocks - K3d node image cleanup only runs in the k8s job (where it matters) - Light cleanup (cache + docker prune -f) between tests; heavy cleanup (prune -af --volumes) only at job boundaries - workflow_call interface unchanged; integrity-check.yml needs no changes Ref: #794 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix prettier formatting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix prettier formatting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix prettier formatting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix prettier formatting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix prettier formatting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add official game-ci CLI with build, activate, and orchestrate commands Introduces a yargs-based CLI entry point (src/cli.ts) distributed as the `game-ci` command. The CLI reuses existing unity-builder modules — Input, BuildParameters, Orchestrator, Docker, MacBuilder — so the same build engine powers both the GitHub Action and the standalone CLI. Commands: build, activate, orchestrate, cache (list/restore/clear), status, version. Closes #812 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(cli): add npm publish workflow and CLI tests Add .github/workflows/publish-cli.yml for publishing the CLI to npm on release or via manual workflow_dispatch with dry-run support. Add comprehensive test coverage for the CLI: - input-mapper.test.ts: 16 tests covering argument mapping, boolean conversion, yargs internal property filtering, and Cli.options population - commands.test.ts: 26 tests verifying command exports, builder flags, default values, and camelCase aliases for all six commands - cli-integration.test.ts: 8 integration tests spawning the CLI process to verify help output, version info, and error handling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(cli): add release workflow, install scripts, and self-update command Replace the npm-only publish-cli.yml with a comprehensive release-cli.yml that builds standalone binaries via pkg for all platforms (Linux/macOS/Windows, x64/arm64), uploads them as GitHub Release assets with SHA256 checksums, and retains npm publish as an optional job. Add curl-pipe-sh installer (install.sh) and PowerShell installer (install.ps1) for one-liner installation from GitHub Releases. Both scripts auto-detect platform/architecture, verify checksums, and guide PATH configuration. Add `game-ci update` command for self-updating standalone binaries: checks GitHub releases for newer versions, downloads the correct platform binary, verifies it, and atomically replaces the running executable. Distribution strategy: GitHub Releases (primary), npm (optional), with winget/Homebrew/Chocolatey/Scoop as future providers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(cli): address review findings — exit codes, missing inputs, null safety - Add process.exit(1) in cli.ts catch block so failures produce non-zero exit codes - Add 6 missing build inputs: containerRegistryRepository, containerRegistryImageVersion, dockerIsolationMode, sshPublicKeysDirectoryPath, cacheUnityInstallationOnMac, unityHubVersionOnMac - Add 6 missing orchestrate inputs: kubeStorageClass, readInputFromOverrideList, readInputOverrideCommand, postBuildSteps, preBuildSteps, customJob - Fix activate command description to accurately reflect verification behavior - Add null check before accessing result.BuildResults in orchestrate handler Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: split orchestrator integrity into 4 parallel jobs to fix timeout The monolithic orchestrator-integrity workflow runs 25+ tests sequentially in a single job, consistently hitting the 60-minute timeout on PR runs. Split into 4 parallel jobs (k8s, aws-provider, local-docker, rclone) each on its own runner, cutting wall-clock time from 3+ hours to ~1 hour and eliminating disk space exhaustion from shared runner contention. Adopts the parallel architecture from PR #809. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: add integration branch update scripts for release/lts-2.0.0 * ci: set macOS builds to continue-on-error Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: add release/lts-infrastructure to update-all script * ci: set macOS builds to continue-on-error Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: make git hooks opt-in only — do not modify hooks when disabled Remove the else branch that actively called GitHooksService.disableHooks() for every user where gitHooksEnabled was false (the default). This was a breaking change that silently modified core.hooksPath to point at an empty directory, disabling any existing git hooks (husky, lefthook, pre-commit, etc.). When gitHooksEnabled is false (default), the action now does nothing regarding hooks — exactly matching the behavior on main before the hooks feature was added. The hooks feature only activates when users explicitly set gitHooksEnabled: true. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add integration wiring and input parsing tests for enterprise features Add three test files covering the two highest-priority gaps in PR #777: 1. src/index-enterprise-features.test.ts (21 tests) - Integration wiring tests for index.ts that verify conditional gating of all enterprise services (GitHooks, LocalCache, ChildWorkspace, SubmoduleProfile, LfsAgent). Tests that disabled features (default) are never invoked, enabled features call the correct service methods, and the order of operations is correct (restore before build, save after build). Also tests non-local provider strategy skips all enterprise features. 2. src/model/enterprise-inputs.test.ts (103 tests) - Input/BuildParameters wiring tests for all 20 new enterprise properties. Covers defaults, explicit values, and boolean string parsing edge cases (the #1 source of bugs: 'false' as truthy, 'TRUE' case sensitivity, '1', 'yes'). Verifies BuildParameters.create() correctly maps all Input getters. 3. src/model/orchestrator/services/submodule/submodule-profile-service.test.ts (5 new tests) - Command construction safety tests for execute(), documenting how paths, branches, and tokens are passed into git commands and verifying the expected command strings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: mark failed macOS builds as neutral instead of failure Use the Checks API to flip failed macOS build conclusions to neutral (gray dash) so unstable builds don't show red X marks on PRs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * revert: restore build-tests-mac.yml to match main Stop modifying the macOS build workflow — leave it identical to main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(test): add gitAuthMode to orchestrator-folders test mock The test mock was missing gitAuthMode, causing useHeaderAuth to default to true and strip the token from repo URLs. Adding gitAuthMode: 'url' restores the expected URL-mode behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(ci): bump node version to 20 in integrity-check yargs@18.0.0 requires Node >=20.19.0, so Node 18 is no longer compatible. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: downgrade yargs to ^17.7.2 and revert Node to 18 for CI compatibility yargs@18 requires Node >=20.19.0 which is incompatible with CI's Node 18. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(cli): move cache command under orchestrate subcommand Cache is an orchestrator feature, so it belongs under `game-ci orchestrate cache` rather than as a top-level `game-ci cache` command. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: add orchestrator compatibility validation workflow Runs on PRs that touch orchestrator source or bridge files. Validates: - Orchestrator source files are in sync with standalone repo - Bridge file exports exist in both repos - Orchestrator tests pass in both unity-builder and standalone contexts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: route orchestrator through plugin loader Replace 8 direct orchestrator service imports with a thin plugin loader. - loadOrchestrator(): loads remote build orchestration - loadEnterpriseServices(): loads enterprise features for local builds All functionality is preserved; only the import mechanism changes. This is the first step toward making orchestrator an optional dependency. Includes comprehensive integration tests for enterprise feature wiring that verify gating logic, call ordering, and provider strategy routing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: extract orchestrator — delete 30k lines, decouple all imports Remove the entire src/model/orchestrator/ directory (148 files, ~30k lines) and refactor all dependent code to use the plugin loader pattern. Key changes: - build-parameters.ts: replace OrchestratorOptions with Input.getInput() - input.ts: remove OrchestratorQueryOverride input source - github.ts: strip to minimal class (only githubInputEnabled remains) - cli/cli.ts: remove orchestrator CLI commands, simplify to core structure - input-readers/*: replace OrchestratorSystem.Run with child_process.exec - orchestrator-plugin.ts: import from @game-ci/orchestrator package - orchestrate.ts, build.ts: use plugin loader instead of direct imports - index.ts: inline SyncStrategy type, fix implicit any types - Add type declarations for @game-ci/orchestrator - Remove orchestrator-only npm dependencies (AWS SDK, K8s, etc.) - Remove orchestrator-specific npm scripts and CI workflows - Update validate-orchestrator.yml for external repo validation All enterprise features gracefully degrade when @game-ci/orchestrator is not installed — the plugin loader returns undefined and optional chaining in index.ts skips all enterprise service calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: move CLI to orchestrator, fix validate-orchestrator workflow - Delete src/cli.ts, src/cli/ (commands, tests, input-mapper) — moved to game-ci/orchestrator repo (PR #813 reference) - Delete .github/workflows/release-cli.yml — moved to orchestrator - Remove bin, pkg, yargs, @types/yargs, pkg from package.json - Fix validate-orchestrator.yml: - Build TypeScript before running require() smoke tests - Remove || echo fallback that swallowed errors - Add smoke test that installs orchestrator via npm pack and verifies loadOrchestrator() returns defined exports Legacy src/model/cli/ (Cli class, CliFunctionsRepository) preserved — used by Input.getInput() and build-parameters.ts on main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(ci): remove reference to deleted orchestrator-integrity.yml The orchestrator job in integrity-check.yml called the deleted orchestrator-integrity.yml workflow, causing CI failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(ci): use --legacy-peer-deps for orchestrator install in validation The orchestrator package brings eslint dependencies that conflict with unity-builder's peer deps. Since this install is only for smoke-testing the plugin loader, --legacy-peer-deps is safe here. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: remove temporary delete-me scripts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(ci): add orchestrator integration tests and plugin interface tests - Add validate-orchestrator-integration.yml with 3 parallel jobs: plugin-interface (unit tests + smoke tests), k8s-integration (k3d + localstack), and aws-integration (localstack only) - Add orchestrator-plugin.test.ts with 15 unit tests covering loadOrchestrator() and loadEnterpriseServices() for both installed and not-installed states - Disk space management follows proven patterns from orchestrator repo (parallel jobs, aggressive cleanup between tests) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(ci): add build step to k8s and aws integration jobs The orchestrator tests need compiled output (dist/index.js) to exist before running integration tests that spawn containers/k8s jobs. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(ci): add refactor/** branch pattern and workflow_dispatch to orchestrator workflows The refactor/orchestrator-extraction branch was not matching the feature/** pattern, preventing the integration workflow from running after fix commits were pushed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(ci): split orchestrator tests into per-PR health checks and nightly exhaustive suite validate-orchestrator.yml (per-PR, ~5 min): - Plugin architecture health: compilation, unit tests, plugin loader graceful degradation, installed service validation, type declaration checks validate-orchestrator-integration.yml (daily 3 AM UTC cron, ~1-2h): - 5 parallel jobs mirroring orchestrator-integrity.yml: plugin-interface, k8s (5 tests), aws (10 tests), local-docker (9 tests), rclone (1 test) - Full LocalStack + k3d integration coverage - continue-on-error on known flaky end2end tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: add yarn.lock to validate-orchestrator path filters Ensure orchestrator validation runs when yarn.lock changes, since dependency updates can affect plugin compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: move install scripts to orchestrator repo Install scripts now live at game-ci/orchestrator where the CLI releases are published. Removed from unity-builder to avoid duplication. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Potential fix for code scanning alert no. 78: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * refactor: rename enterprise services to plugin services The orchestrator is a plugin, not an enterprise feature. Renamed loadEnterpriseServices -> loadPluginServices and all related variables, types, log messages, and test descriptions to use "plugin" terminology. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(ci): update workflow references from loadEnterpriseServices to loadPluginServices CI workflows still referenced the old function name after the rename. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: remove (Nightly) from integration tests workflow name Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: only suppress module-not-found errors in plugin loader Previously both loadOrchestrator() and loadPluginServices() caught all errors, masking real failures like syntax errors or missing transitive dependencies. Now only MODULE_NOT_FOUND / ERR_MODULE_NOT_FOUND errors are suppressed; all other exceptions are rethrown. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: add smoke test for orchestrator build wiring Verifies end-to-end that loadOrchestrator().run() is correctly wired to Orchestrator.run(), BuildParameters.create() produces valid config, and plugin services resolve to real implementations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: wire orchestrator integration tests into integrity check - Add workflow_call trigger to validate-orchestrator-integration.yml so other workflows can invoke the exhaustive test suite - Add orchestrator-integration job to integrity-check.yml that runs on pushes to main (skipped on PRs to avoid 1-2h CI time) - Daily cron + manual dispatch remain as fallback triggers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(ci): pin LocalStack to v3.8.1 for AWS SDK v3 compatibility localstack:latest (v4.14+) returns JSON responses for some S3 operations, but @aws-sdk/client-s3 v3.779+ uses AwsRestXmlProtocol which expects XML. This breaks all SharedWorkspaceLocking tests (locking, e2e caching, retaining). Pin to v3.8.1 (last v3 release) where the S3 provider returns proper XML responses. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * revert: restore localstack:latest now that SDK is pinned The S3 deserialization issue was caused by @aws-sdk/client-s3 v3.1005 (schema-based AwsRestXmlProtocol), not LocalStack's version. The SDK is now pinned to ~3.779.0 in the orchestrator repo, so localstack:latest works correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: reorder AWS integration tests to prevent workspace corruption Move mandatory tests (caching, locking-core, locking-get-locked) before continue-on-error e2e tests. The e2e tests can corrupt the workspace (delete package.json), which was causing subsequent mandatory tests to fail with "Couldn't find a package.json". Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: plugin lifecycle interface for orchestrator extraction Replace hardcoded orchestrator params with a lifecycle-based plugin interface. The orchestrator reads its own config from env vars — unity-builder just calls 6 hooks (initialize, canHandleBuild, handleBuild, beforeLocalBuild, afterLocalBuild, handlePostBuild). Removes ~2900 lines from unity-builder (93 BuildParameters fields, 346 Input getters, 70 action.yml inputs, 400 lines of service orchestration in index.ts). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: align CI workflow with actual loadOrchestratorPlugin export The validate-orchestrator workflows referenced loadOrchestrator and loadPluginServices which don't exist — the source exports loadOrchestratorPlugin. Updated all CI steps to use the correct function name and test the actual OrchestratorPlugin lifecycle interface. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: checkout matching orchestrator branch in CI validation The validate-orchestrator workflow was always checking out the main branch of game-ci/orchestrator. When both repos have changes on a feature branch (e.g. refactor/orchestrator-extraction), the CI needs to use the matching branch. Falls back to main if the branch doesn't exist in the orchestrator repo. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: add run-integration label to trigger full integration tests on PRs PRs labeled `run-integration` now run the full orchestrator integration suite (K8s, AWS, local-docker, rclone via LocalStack + k3d). Without the label, integration tests only run on push to main and the daily cron. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: checkout matching orchestrator branch in integration tests Try the matching branch name (e.g. refactor/orchestrator-extraction) from game-ci/orchestrator first, falling back to main. This allows testing cross-repo changes before merging to orchestrator main. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: switch from LocalStack to MiniStack for AWS mock services LocalStack community edition was discontinued (2026.03.0+) and now requires a paid license for ECS, CloudFormation, Kinesis, and other services used in integration tests. Switch to MiniStack (MIT, free, ministackorg/ministack) which provides all 40+ AWS services on the same port 4566 with backward-compatible health endpoints. ~10x smaller image, ~2s startup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * feat: add sync-secrets workflow for sibling repositories Manually-triggered workflow that copies secrets (Unity credentials, AWS/GCP tokens, Codecov) from unity-builder to orchestrator or cli repos. Supports dry-run mode. Folded from PR #825. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Potential fix for pull request finding 'CodeQL / Workflow does not contain permissions' Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * fix: add UNITY_LICENSE and NPM_TOKEN to sync-secrets, don't block on failures Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove LOCALSTACK_AUTH_TOKEN from sync-secrets workflow MiniStack doesn't require an auth token. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Summary
Adds official CLI support to unity-builder, distributed as the
game-cicommand. Resolves #812.Commands
game-ci build— Build a Unity project locally or via Docker, mirroring all action inputs as CLI flagsgame-ci test/game-ci t— Run Unity tests (EditMode, PlayMode, or All)game-ci activate— Verify Unity license configuration (serial, license file, or floating license server)game-ci orchestrate/game-ci o— Run builds via orchestrator providers (AWS ECS, Kubernetes, local-docker)game-ci orchestrate cache list|restore|clear— Inspect and manage orchestrator build cachesgame-ci status— Show workspace info, Unity version detection, environment, cache status, and Docker availabilitygame-ci version— Show version infogame-ci update— Self-update to the latest release (standalone binary only)Distribution Strategy
Primary: GitHub Releases with Standalone Binaries
Every release builds standalone binaries (no Node.js required) for:
game-ci-linux-x64game-ci-linux-arm64game-ci-macos-x64game-ci-macos-arm64game-ci-windows-x64.exeAll binaries are uploaded as release assets with SHA256 checksums (
checksums.txt).Install Scripts
Linux / macOS:
curl -fsSL https://raw.githubusercontent.com/game-ci/unity-builder/main/install.sh | shWindows (PowerShell):
Environment variables:
GAME_CI_VERSION— Install a specific version (e.g.,v2.0.0)GAME_CI_INSTALL— Custom install directory (default:~/.game-ci/bin)Self-Update
npm (Optional, enabled on release)
Future Providers
Design
The CLI reuses the existing unity-builder modules —
Input,BuildParameters,Orchestrator,Docker,MacBuilder— rather than duplicating logic. A thininput-mapperlayer bridges yargs CLI flags into the existingCli.optionsmechanism thatInput.getInput()andOrchestratorOptions.getInput()already query.Key files
src/cli.tssrc/cli/input-mapper.tssrc/cli/commands/build.tssrc/cli/commands/test.tssrc/cli/commands/activate.tssrc/cli/commands/orchestrate.tssrc/cli/commands/shared-options.tssrc/cli/commands/status.tssrc/cli/commands/version.tssrc/cli/commands/update.ts.github/workflows/release-cli.ymlinstall.shinstall.ps1src/cli/__tests__/input-mapper.test.tssrc/cli/__tests__/commands.test.tssrc/cli/__tests__/cli-integration.test.tsRelease Workflow (
release-cli.yml)Triggers on GitHub Release published or manual workflow_dispatch.
pkgTracking
Test plan
npx tsc --noEmitpasses (zero TypeScript errors)game-ci --helpdisplays all commandsgame-ci build --helpshows all build flags with descriptionsgame-ci test --helpshows test mode, filter, and coverage flagsgame-ci versionshows correct version infogame-ci statusshows workspace detection, environment, and cache statusgame-ci orchestrate cache listreports orchestrator cache statusgame-ci activatecorrectly reports missing license with exit code 2game-ci update --helpshows force and version flags