-
-
Notifications
You must be signed in to change notification settings - Fork 307
feat: add CLAUDE.md for AI-assisted development #818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # Unity-Builder | ||
|
|
||
| GitHub Action and CLI that builds Unity projects for multiple platforms. Part of the [GameCI](https://game.ci) project. | ||
|
|
||
| ## Quick Reference | ||
|
|
||
| ```bash | ||
| yarn # install dependencies | ||
| yarn build # full build: tsc → ncc bundle (src/ → lib/ → dist/index.js) | ||
| yarn test # run all tests (jest) | ||
| yarn test:ci # run tests in CI mode (single-threaded, 2min timeout) | ||
| yarn lint # prettier + eslint check | ||
| yarn format # auto-format with prettier | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| **Entry point:** `src/index.ts` → decides between CLI mode and GitHub Action mode. | ||
|
|
||
| **Two execution paths:** | ||
| 1. **Local builds** — Docker container or native macOS (`src/model/docker.ts`, `src/model/mac-builder.ts`) | ||
| 2. **Orchestrator builds** — Remote execution on AWS ECS, Kubernetes, or other providers (`src/model/orchestrator/`) | ||
|
|
||
| **Key modules:** | ||
|
|
||
| | Path | Purpose | | ||
| |---|---| | ||
| | `src/model/build-parameters.ts` | Central config object — all build settings flow through here | | ||
| | `src/model/input.ts` | Input resolution with priority: Action inputs → CLI flags → env override → env vars | | ||
| | `src/model/orchestrator/orchestrator.ts` | Remote build orchestration — provider selection, workflow execution | | ||
| | `src/model/orchestrator/providers/` | Provider plugin system (AWS, K8s, Docker, Local, Test) | | ||
| | `src/model/orchestrator/remote-client/` | Code that runs inside remote containers (caching, hooks, artifacts) | | ||
| | `src/model/orchestrator/workflows/` | Build workflow types (standard, custom, async) | | ||
| | `src/model/orchestrator/services/` | Logging, locking, resource tracking | | ||
| | `src/model/cli/` | CLI mode using commander — dispatches to `@CliFunction`-decorated methods | | ||
| | `action.yml` | GitHub Action manifest — all inputs/outputs defined here | | ||
| | `dist/index.js` | Bundled output (committed to repo, used by action.yml at runtime) | | ||
|
|
||
| **Provider interface:** All providers implement `ProviderInterface` (`providers/provider-interface.ts`) with methods: `setupWorkflow`, `runTaskInWorkflow`, `cleanupWorkflow`, `garbageCollect`, `listResources`, `listWorkflow`, `watchWorkflow`. | ||
|
|
||
| **Provider loading:** Providers can be built-in, loaded from npm, cloned from GitHub repos, or loaded from local paths (`provider-loader.ts`). | ||
|
|
||
| ## Build System | ||
|
|
||
| The build pipeline is: `yarn` → `tsc` (src/ → lib/) → `ncc build lib` (lib/ → dist/index.js). | ||
|
|
||
| - **dist/ is committed** — GitHub Actions loads `dist/index.js` directly, no install step on runners | ||
| - **Pre-commit hooks** (lefthook) auto-run formatting, linting, related tests, and `yarn build` to keep dist/ in sync | ||
| - Runtime: Node 20 (configured via Volta and action.yml `runs.using: node20`) | ||
|
|
||
| ## Code Conventions | ||
|
|
||
| - **Files:** kebab-case (enforced by eslint `unicorn/filename-case`) | ||
| - **Code:** camelCase variables/functions, PascalCase classes/types | ||
| - **Formatting:** Prettier — 120 char width, single quotes, trailing commas, semicolons | ||
| - **Linting:** ESLint with unicorn, github, prettier, jest plugins | ||
| - **TypeScript:** strict mode, ES2020 target, CommonJS modules, experimental decorators enabled | ||
| - **Blank line before return statements** (enforced) | ||
| - **Blank line before block/line comments** (enforced) | ||
| - **No `for...in` loops** — use `for...of` | ||
|
|
||
| ## Testing | ||
|
|
||
| - **Framework:** Jest 27 with ts-jest | ||
| - **Pattern:** `**/*.test.ts` files colocated with source | ||
| - **Orchestrator tests:** Concentrated in `src/model/orchestrator/tests/` | ||
| - **Run specific tests:** `yarn test -t "pattern"` or `yarn jest path/to/file.test.ts` | ||
| - **Orchestrator integration tests** require `orchestratorTests=true` env var: `cross-env orchestratorTests=true yarn test -i -t "orchestrator"` | ||
|
|
||
| ## Security | ||
|
|
||
| - **Never log, output, or hardcode credentials** — cloud provider secrets (AWS, GCP, K8s), Unity serial keys, keystores, and private tokens must stay in secret inputs | ||
| - **Input validation matters** — user-supplied hook commands and custom parameters can be injection vectors; use `shell-quote` for shell escaping | ||
| - **Keystore/license data** is base64-encoded in inputs and written to temp files at build time | ||
|
|
||
| ## CI Workflows | ||
|
|
||
| - `integrity-check.yml` — lint, test, build on every push/PR | ||
| - `build-tests-{ubuntu,windows,mac}.yml` — matrix builds across Unity versions and platforms | ||
| - `orchestrator-integrity.yml` / `orchestrator-async-checks.yml` — orchestrator-specific validation |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clone the dispatched ref before falling back to
main.workflow_dispatchcan run from a feature branch, but this always pullsmain, sochecks-updateignores the branch the workflow was launched from. That makes branch-specific orchestrator changes impossible to validate here.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents