Skip to content

Add Apps in Toss devtools workflow - #23

Merged
imjlk merged 9 commits into
mainfrom
codex/ait-community-tooling
Jul 7, 2026
Merged

imjlk merged 9 commits into
mainfrom
codex/ait-community-tooling

Conversation

@imjlk

@imjlk imjlk commented Jul 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Add @ait-co/devtools to the private Apps in Toss wrapper dev flow only.
  • Enable the devtools Vite plugin during local serve, with MPGD_AIT_DEVTOOLS=0 as an escape hatch, while production builds stay clean.
  • Add generated Phaser starter AIT dev/build/smoke wrapper helper scripts and README guidance.
  • Add a Sampo changeset for the generated starter template contract.

Validation

  • pnpm --dir apps/target-ait check
  • pnpm --dir apps/target-ait build
  • pnpm validate:starter-workflow
  • pnpm validate:target-config
  • pnpm validate:targets
  • pnpm smoke:adapter-effective-config
  • pnpm smoke:effective-config
  • MPGD_AIT_PACKAGE_MODE=skip pnpm build:ait
  • pnpm smoke:target ait
  • pnpm check
  • ocr review --audience agent ... (working diff, re-run after patch): 0 comments
  • ocr review --audience agent --commit HEAD ...: 0 comments

Summary by CodeRabbit

  • New Features
    • Added AIT-target development shortcuts for local work, including plain/devtools-off and phone/tunnel modes.
    • Added target-aware build and smoke-test commands for the Phaser game template.
  • Bug Fixes
    • Improved runtime handling for loading the generated game bundle, with safer script/asset injection and clearer error fallback when loading fails.
  • Documentation
    • Expanded template and target docs with the updated “Apps in Toss” workflow and local command guidance.
  • Chores / Config
    • Updated Node.js engine requirement, workspace/install behavior, asset mirroring for the wrapper, and tightened generated-asset tracking rules.

@imjlk

imjlk commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

@imjlk: Sure, I'll review the changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eb2dbaf1-c9f3-4f58-b48c-c6842c9d712e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds AIT devtools workflow wiring, target-ait runtime bundle loading, wrapper asset mirroring, and related docs, ignore, validation, and release metadata updates.

Changes

AIT devtools workflow

Layer / File(s) Summary
Devtools plugin and scripts
apps/target-ait/vite.config.ts, apps/target-ait/package.json, packages/cli/templates/phaser-game/package.json
Vite conditionally enables the AIT devtools plugin during serve, target-ait adds AIT dev scripts and the devtools dependency, and the phaser-game template adds AIT wrapper and MCP scripts.
Tooling, docs, and release metadata
packages/cli/templates/phaser-game/README.md, pnpm-workspace.yaml, .mise.toml, .sampo/changesets/ait-devtools-workflow.md
The template README documents the Apps in Toss workflow, cloudflared build output stays disabled by default, the Node tool version changes, and a patch changeset is added.

AIT target bundle runtime

Layer / File(s) Summary
Bundle loader and injection
apps/target-ait/src/main.ts
The target now fetches and mounts /game/index.html, rewrites and injects bundle links and scripts, traps runtime errors, and falls back to a missing-bundle shell on failure.
Wrapper assets and readiness
tools/target/build-target.ts, apps/target-ait/README.md, .gitignore, tools/validate-public-readiness.ts
Apps-in-toss builds mirror runtime assets into public/assets, the README describes the bundle and asset mapping, generated AIT paths are ignored, and readiness validation blocks tracked public assets.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • imjlk/mpgd-kit#15: Shares the same tools/target/build-target.ts apps-in-toss asset/build pipeline changes.
  • imjlk/mpgd-kit#20: Also changes .sampo/changesets for the npm/@mpgd/cli release flow.

Poem

I hop through /game/ with a curious ear,
Scripts and devtools now gather near.
I load the bundle, neat and bright,
Mirror the assets, make the paths right.
🐰 The burrow hums with AIT cheer.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding the Apps in Toss devtools workflow.
Description check ✅ Passed The description covers Summary and Validation, and only omits the optional Notes section from the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ait-community-tooling

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/target-ait/vite.config.ts (1)

5-9: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Consider excluding devtools during vite preview too.

Vite resolves command as 'serve' for both vite dev and vite preview, differentiated only by the separate isPreview flag. As written, running vite preview (a production-build smoke check) would still load aitDevtools.vite() unless MPGD_AIT_DEVTOOLS=0 is explicitly set, since only command === 'serve' is checked here.

♻️ Proposed guard against preview
-export default defineConfig(({ command }) => ({
+export default defineConfig(({ command, isPreview }) => ({
   plugins: [
-    ...(command === 'serve' && process.env.MPGD_AIT_DEVTOOLS !== '0'
+    ...(command === 'serve' && !isPreview && process.env.MPGD_AIT_DEVTOOLS !== '0'
       ? [aitDevtools.vite()]
       : []),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/target-ait/vite.config.ts` around lines 5 - 9, The Vite config currently
enables aitDevtools.vite() whenever command is serve, which also includes vite
preview and can unintentionally load devtools in a production smoke check.
Update the defineConfig callback to also check the preview flag from Vite’s
config context, and only include the aitDevtools.vite() plugin when it is not a
preview run and MPGD_AIT_DEVTOOLS is not set to 0.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/templates/phaser-game/README.md`:
- Around line 112-124: The README example command block is missing the
`ait:wrapper:dev:plain` script that the surrounding prose describes. Update the
command list in the phaser-game README so it includes `ait:wrapper:dev:plain`
alongside the existing `ait:wrapper:dev`, `ait:wrapper:dev:phone`, and
`ait:devtools:mcp` entries, keeping the wording consistent with the explanation
of `ait:wrapper:dev` and the plain no-devtools variant.

---

Nitpick comments:
In `@apps/target-ait/vite.config.ts`:
- Around line 5-9: The Vite config currently enables aitDevtools.vite() whenever
command is serve, which also includes vite preview and can unintentionally load
devtools in a production smoke check. Update the defineConfig callback to also
check the preview flag from Vite’s config context, and only include the
aitDevtools.vite() plugin when it is not a preview run and MPGD_AIT_DEVTOOLS is
not set to 0.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 12f63cb9-21c5-4cf7-a95d-58e7b95cd355

📥 Commits

Reviewing files that changed from the base of the PR and between 11e5573 and 46534cd.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • .sampo/changesets/ait-devtools-workflow.md
  • apps/target-ait/package.json
  • apps/target-ait/vite.config.ts
  • packages/cli/templates/phaser-game/README.md
  • packages/cli/templates/phaser-game/package.json
  • pnpm-workspace.yaml

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46534cd466

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"@apps-in-toss/web-framework": "^2.10.4"
},
"devDependencies": {
"@ait-co/devtools": "^0.1.137",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve Node 22 support when adding devtools

@ait-co/devtools@0.1.137 declares engines: { node: '>=24' } in the updated lockfile, but the repo root still advertises Node >=22.0.0. On a documented Node 22 setup, installing or running these new AIT wrapper dev scripts either fails under engine-strict pnpm or runs an unsupported dependency before the wrapper app loads, so this should either use a Node-22-compatible devtools version or raise the workspace engine requirement.

Useful? React with 👍 / 👎.

Comment thread apps/target-ait/package.json Outdated
"scripts": {
"dev": "vite --host 0.0.0.0",
"dev:plain": "MPGD_AIT_DEVTOOLS=0 vite --host 0.0.0.0",
"dev:phone": "AIT_TUNNEL=1 vite --host 0.0.0.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enable CDP when advertising phone MCP debugging

For the documented local phone debugging flow, this script only sets AIT_TUNNEL=1, which the devtools plugin treats as a screen-preview tunnel; the CDP relay used by devtools-mcp is only added when CDP is enabled (AIT_TUNNEL_CDP=1 or an explicit tunnel: { cdp: true }). As a result, users running pnpm ait:wrapper:dev:phone alongside the new MCP command get a QR preview but no relay/page for the MCP server to attach to, so the phone debugging shortcut needs to opt into CDP or the docs need a separate CDP script.

Useful? React with 👍 / 👎.

"dev": "__WORKSPACE_I18N_BUILD_PREFIX__vite --host 0.0.0.0",
"dev:ait": "APP_TARGET=ait APP_VERSION=0.0.0-dev BUILD_ID=ait-sandbox sh -c '__WORKSPACE_I18N_BUILD_PREFIX__vite --host 0.0.0.0'",
"build": "__WORKSPACE_I18N_BUILD_PREFIX__vite build",
"build:ait": "pnpm exec mpgd target build ait production --targets-file ./mpgd.targets.json --kit-path ${MPGD_KIT_PATH:-__DEFAULT_KIT_PATH__}",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the wrapper variant for the AIT shortcut

In a freshly generated game following the new pnpm build:ait shortcut, this invokes mpgd target build ait without --variant wrapper; with the default generated target file, that path points at the shared kit wrapper and tools/target/build-target.ts only skips ait:build when the wrapper variant sets MPGD_AIT_PACKAGE_MODE=skip. The shortcut therefore attempts a real .ait package from the kit demo wrapper instead of the documented smoke wrapper path, which requires AIT CLI state and can use shared app metadata; add the wrapper variant here or document the real packaging prerequisites.

Useful? React with 👍 / 👎.

Comment thread pnpm-lock.yaml Outdated
typia:
specifier: rc
version: 13.0.0-rc.1(@types/node@24.13.2)
version: 13.0.1-dev.20260703.1(@types/node@24.13.2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Revert unrelated typia dev snapshot

This lockfile-only drift changes the workspace typia resolution from 13.0.0-rc.1 to 13.0.1-dev.20260703.1 across multiple importers even though no package manifest or changeset in this PR mentions a typia upgrade. Because typia is a runtime/generator dependency of publishable packages, frozen installs after this commit silently change validator/runtime output for consumers in an AIT devtools workflow PR; please revert these entries or make the typia update explicit with validation and release notes.

Useful? React with 👍 / 👎.

@imjlk

imjlk commented Jul 7, 2026 •

Copy link
Copy Markdown
Owner Author

Addressed the CodeRabbit feedback in 5ab5fe5:

  • Added ait:wrapper:dev:plain to the generated template README command block.
  • Guarded the AIT devtools Vite plugin with !isPreview so vite preview does not load devtools.

Validation:

  • pnpm --dir apps/target-ait check
  • pnpm --dir apps/target-ait build
  • pnpm validate:starter-workflow
  • MPGD_AIT_PACKAGE_MODE=skip pnpm build:ait
  • pnpm smoke:target ait
  • Open Code Review working diff: 0 comments
  • Open Code Review commit HEAD: 0 comments

@codex review
@coderabbitai review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5ab5fe56e2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"dev": "__WORKSPACE_I18N_BUILD_PREFIX__vite --host 0.0.0.0",
"dev:ait": "APP_TARGET=ait APP_VERSION=0.0.0-dev BUILD_ID=ait-sandbox sh -c '__WORKSPACE_I18N_BUILD_PREFIX__vite --host 0.0.0.0'",
"build": "__WORKSPACE_I18N_BUILD_PREFIX__vite build",
"build:ait": "pnpm exec mpgd target build ait production --targets-file ./mpgd.targets.json --kit-path ${MPGD_KIT_PATH:-__DEFAULT_KIT_PATH__}",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add wrapper variant to the AIT build shortcut

For generated games that still use the kit reference Apps in Toss wrapper, this shortcut takes the single-target CLI path without the wrapper variant, so runTargetCommand never sets MPGD_AIT_PACKAGE_MODE=skip and tools/target/build-target.ts falls through to pnpm --dir <kit>/apps/target-ait ait:build. That makes the advertised local pnpm build:ait loop try to produce a real .ait package from the shared kit wrapper instead of the wrapper-web artifact used by the documented build-all --ait-variant wrapper flow, which is the path intended for game-owned starters before they create their own AIT wrapper/config.

Useful? React with 👍 / 👎.

Comment thread apps/target-ait/package.json Outdated
"scripts": {
"dev": "vite --host 0.0.0.0",
"dev:plain": "MPGD_AIT_DEVTOOLS=0 vite --host 0.0.0.0",
"dev:phone": "AIT_TUNNEL=1 vite --host 0.0.0.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enable CDP when advertising MCP phone debugging

When users run the new phone tunnel together with devtools:mcp, this script only sets AIT_TUNNEL=1; the devtools plugin resolves that to a screen-preview tunnel, and only starts the CDP/MCP relay when AIT_TUNNEL_CDP=1 (or tunnel: { cdp: true }) is set. As a result the documented on-device MCP debugging flow has no relay URL for the MCP bridge to attach to, even though pnpm ait:wrapper:dev:phone appears to be the paired setup command.

Useful? React with 👍 / 👎.

Comment thread pnpm-lock.yaml

'@ait-co/devtools@0.1.137':
resolution: {integrity: sha512-HMf5bDscKkto1ZqIT5Iu5HtvGXDQfJ/lrqo0a6hNpLEfQtD6fSGeyD/PjwUbG5v7Erh5lDVORnhAt31qRSPl5Q==}
engines: {node: '>=24'}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align devtools with the repo's Node engine

This added package declares engines: { node: '>=24' }, while the root package still advertises support for Node >=22.0.0. In a supported Node 22 checkout, the new AIT devtools workflow is now outside the declared runtime support (and installs fail under engine-strict), so either the repo engine needs to move to Node 24 or this dependency should stay compatible with Node 22 before it is part of the default workspace.

Useful? React with 👍 / 👎.

Comment thread pnpm-workspace.yaml Outdated
allowBuilds:
'@sentry/cli': true
'@swc/core': true
cloudflared: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid approving cloudflared globally

The cloudflared package's postinstall runs node lib/cloudflared.js bin install latest, so approving its build script here makes every workspace pnpm install --frozen-lockfile download an unpinned external binary even for CI jobs and developers that never use the phone tunnel. The devtools path already lazy-installs cloudflared when the tunnel is actually started, so this turns an optional local-debug feature into a network-dependent install step that can break restricted or reproducible installs.

Useful? React with 👍 / 👎.

Comment thread pnpm-lock.yaml Outdated
typia:
specifier: rc
version: 13.0.0-rc.1(@types/node@24.13.2)
version: 13.0.1-dev.20260703.1(@types/node@24.13.2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Revert the unrelated typia dev snapshot bump

This lockfile-only change moves the root and multiple runtime packages from typia@13.0.0-rc.1 to 13.0.1-dev.20260703.1 even though their package manifests still only say typia: rc and this PR is scoped to AIT devtools. Because typia drives runtime validation/schema generation in packages like bridge, catalog, target-config, and release-manifest, publishing this PR would also ship a dev snapshot dependency change unrelated to the reviewed feature; please revert it or make the bump explicit with the corresponding package/config updates.

Useful? React with 👍 / 👎.

@imjlk

imjlk commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Addressed the Codex review feedback in e233812:

  • Raised the workspace Node engine to >=24.0.0 to match @ait-co/devtools official engine requirements.
  • Enabled AIT_TUNNEL_CDP=1 for dev:phone so the MCP debugging flow has a CDP relay.
  • Updated generated build:ait to use --variant wrapper and avoid accidental real kit-wrapper packaging.
  • Removed the unrelated typia@13.0.1-dev.20260703.1 lockfile drift; PR diff now keeps typia on 13.0.0-rc.1.

Validation:

  • pnpm install --frozen-lockfile --ignore-scripts
  • pnpm --dir apps/target-ait check
  • pnpm --dir apps/target-ait build
  • pnpm validate:starter-workflow
  • pnpm validate:targets
  • MPGD_AIT_PACKAGE_MODE=skip pnpm build:ait
  • pnpm smoke:target ait
  • pnpm check
  • Open Code Review working diff: 0 comments
  • Open Code Review commit HEAD: 0 comments

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

@imjlk: Thanks for the update — I'll review the latest changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@imjlk

imjlk commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Addressed the remaining Codex feedback in 78ec15d:

  • Changed allowBuilds.cloudflared to false so workspace installs do not run the optional tunnel package postinstall or download an external binary by default.

Additional validation:

  • pnpm install --frozen-lockfile
  • pnpm validate:starter-workflow
  • Open Code Review working diff: 0 comments
  • Open Code Review commit HEAD: 0 comments

Earlier validation for this patch stack remains green:

  • pnpm check
  • MPGD_AIT_PACKAGE_MODE=skip pnpm build:ait
  • pnpm smoke:target ait

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

@imjlk: Thanks for the update — I'll review the latest changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 78ec15d8b4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json
"packageManager": "pnpm@11.7.0",
"engines": {
"node": ">=22.0.0"
"node": ">=24.0.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align mise with the new Node engine

When developers use the repo's mise environment, .mise.toml still selects Node 22.23.1, but this change now declares the workspace requires Node >=24 and the added @ait-co/devtools lock entry also has engines: {node: '>=24'}. That leaves the documented local toolchain running under an unsupported Node version for installs/builds; update .mise.toml in the same change so the checked-in environment satisfies the new engine.

Useful? React with 👍 / 👎.

"scripts": {
"dev": "vite --host 0.0.0.0",
"dev:plain": "MPGD_AIT_DEVTOOLS=0 vite --host 0.0.0.0",
"dev:phone": "AIT_TUNNEL=1 AIT_TUNNEL_CDP=1 vite --host 0.0.0.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Ignore generated AIT relay secrets

When dev:phone is used, the devtools CDP path creates project-local .ait_relay (the relay TOTP secret) and .ait_urls discovery files under apps/target-ait, but the repo only ignores *.ait and not these generated files. This leaves a secret-bearing file as an untracked change that can be accidentally committed after following the new phone workflow; add the generated relay files to .gitignore before exposing this script.

Useful? React with 👍 / 👎.

@imjlk

imjlk commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest Codex review feedback in 35cb0b1:

  • Updated .mise.toml to Node 24.11.0 so the checked-in mise environment satisfies the new workspace Node >=24 engine and @ait-co/devtools engine requirement.
  • Ignored apps/target-ait/.ait_relay and apps/target-ait/.ait_urls so the phone devtools relay/discovery files cannot be accidentally committed.

Validation:

  • pnpm install --frozen-lockfile
  • pnpm validate:starter-workflow
  • ocr review --audience agent ... on working diff
  • ocr review --audience agent ... --commit HEAD

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

@imjlk: Thanks for the update — I'll review the latest changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35cb0b10ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/target-ait/vite.config.ts Outdated
export default defineConfig(({ command, isPreview }) => ({
plugins: [
...(command === 'serve' && !isPreview && process.env.MPGD_AIT_DEVTOOLS !== '0'
? [aitDevtools.vite()]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Wire dev:phone env into the devtools tunnel option

When the new dev:phone script is used, it only sets AIT_TUNNEL=1 AIT_TUNNEL_CDP=1, but this config still calls aitDevtools.vite() with no tunnel option. The devtools plugin documents tunnel as defaulting to false and its own fixture maps these env vars to tunnel: process.env.AIT_TUNNEL_CDP ? { cdp: true } : !!process.env.AIT_TUNNEL; without that wiring, pnpm dev:phone just starts the normal Vite server and never prints the trycloudflare URL/QR or starts the CDP relay, so the documented phone debugging flow is nonfunctional.

Useful? React with 👍 / 👎.

@imjlk

imjlk commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest Codex review feedback in 0fe4c97:

  • Explicitly maps AIT_TUNNEL / AIT_TUNNEL_CDP into aitDevtools.vite({ tunnel }), so pnpm dev:phone starts the real-device preview tunnel and CDP relay when requested.
  • Kept the existing dev-only/preview guard unchanged, so production build and vite preview remain unaffected.

Validation:

  • pnpm --dir apps/target-ait check
  • pnpm --dir apps/target-ait build
  • pnpm validate:starter-workflow
  • ocr review --audience agent ... on working diff
  • ocr review --audience agent ... --commit HEAD

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

@imjlk: Thanks for the update — I'll review the latest changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0fe4c97e7e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pnpm-workspace.yaml
allowBuilds:
'@sentry/cli': true
'@swc/core': true
cloudflared: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow cloudflared to build for the phone tunnel

On a fresh pnpm 11 install, this false entry denies the cloudflared install script (pnpm documents that unapproved packages are saved with false: https://pnpm.io/cli/approve-builds), but the new dev:phone tunnel path depends on @ait-co/devtools, which pulls in cloudflared in pnpm-lock.yaml. Because this is the binary dependency used for the requested Cloudflare tunnel, pnpm --dir apps/target-ait run dev:phone can install without preparing the tunnel binary and then fail to start the real-device preview tunnel; approve this dependency or avoid relying on its package-installed binary.

Useful? React with 👍 / 👎.

Comment thread apps/target-ait/vite.config.ts Outdated
Comment on lines +5 to +6
const aitDevtoolsTunnel = process.env.AIT_TUNNEL
? { cdp: Boolean(process.env.AIT_TUNNEL_CDP) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3 Badge Treat '0' tunnel env values as disabled

The tunnel flags are exposed as opt-in environment switches, but this mapping treats any non-empty string as true. If a developer or CI job uses the common AIT_TUNNEL=0 or AIT_TUNNEL_CDP=0 override, pnpm --dir apps/target-ait dev still starts the public tunnel and/or CDP relay, which also conflicts with the adjacent MPGD_AIT_DEVTOOLS !== '0' guard. Parse these flags with the same explicit 0 handling so they can actually be disabled without unsetting them.

Useful? React with 👍 / 👎.

"build": "vite build",
"ait:build": "ait build",
"ait:deploy": "ait deploy --api-key \"$AIT_API_KEY\"",
"devtools:mcp": "pnpm exec devtools-mcp",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Start MCP in the mobile tunnel mode

When this script is used with the new dev:phone CDP relay, it starts devtools-mcp in its default relay-staging mode and does not provide the Vite tunnel/relay URLs. The devtools env-2 flow requires --target=mobile plus AIT_RELAY_BASE_URL and AIT_TUNNEL_BASE_URL from the Vite banner, so the documented ait:wrapper:dev:phone + ait:devtools:mcp path cannot attach to the phone preview and will target the wrong debugging mode. Please either read/pass the generated URLs here or document a separate mobile MCP command.

Useful? React with 👍 / 👎.

@imjlk

imjlk commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest Codex review feedback in bf72beb:

  • Added explicit env flag parsing so AIT_TUNNEL=0 / AIT_TUNNEL_CDP=0 disable the phone tunnel/CDP relay instead of being treated as truthy strings.
  • Added devtools:mcp:mobile and exposed ait:devtools:mcp:mobile in the starter template for the env-2 phone tunnel MCP flow.
  • Kept cloudflared postinstall disabled intentionally and documented why: @ait-co/devtools lazily installs the tunnel binary when the phone tunnel starts, keeping ordinary workspace installs free of external binary downloads.

Validation:

  • pnpm install --frozen-lockfile
  • pnpm --dir apps/target-ait check
  • pnpm --dir apps/target-ait build
  • pnpm validate:starter-workflow
  • pnpm --dir apps/target-ait exec devtools-mcp --help
  • ocr review --audience agent ... on working diff
  • ocr review --audience agent ... --commit HEAD

OCR note: it asked to confirm whether devtools-mcp is provided by @ait-co/devtools; confirmed @ait-co/devtools@0.1.137 declares bin.devtools-mcp and pnpm --dir apps/target-ait exec which devtools-mcp resolves it.

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

@imjlk: Thanks for the update — I'll review the latest changes now.


✏️ Learnings added
Learnt from: imjlk
URL: https://github.com/imjlk/mpgd-kit/pull/23

Timestamp: 2026-07-07T17:33:26.133Z
Learning: In imjlk/mpgd-kit, `pnpm-workspace.yaml`'s `allowBuilds.cloudflared` is intentionally kept `false`. `ait-co/devtools` lazily installs the `cloudflared` tunnel binary only when the phone tunnel (`AIT_TUNNEL=1`) actually starts, so keeping the postinstall disabled avoids downloading an external binary during ordinary workspace installs. This is expected behavior, not an oversight.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf72bebf90

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"build": "__WORKSPACE_I18N_BUILD_PREFIX__vite build",
"build:ait": "pnpm exec mpgd target build ait production --variant wrapper --targets-file ./mpgd.targets.json --kit-path ${MPGD_KIT_PATH:-__DEFAULT_KIT_PATH__}",
"smoke:ait": "pnpm exec mpgd target smoke ait --targets-file ./mpgd.targets.json --kit-path ${MPGD_KIT_PATH:-__DEFAULT_KIT_PATH__}",
"ait:wrapper:dev": "pnpm --dir ${MPGD_KIT_PATH:-__DEFAULT_KIT_PATH__}/apps/target-ait run dev",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Point wrapper dev scripts at the game bundle

When a generated game runs this new ait:wrapper:* flow, the command only starts the kit checkout's apps/target-ait Vite app. That wrapper currently renders its placeholder shell (apps/target-ait/index.html loads only /src/main.ts), and apps/target-ait/README.md still says the copied public/game bundle is not wired into the wrapper, so the documented phone/devtools tunnel never exercises the generated game even after pnpm build:ait. Wire the wrapper to serve/load public/game, or avoid exposing these starter debugging scripts until that handoff exists.

Useful? React with 👍 / 👎.

@imjlk

imjlk commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Patched the latest Codex review on commit bf72beb. The AIT wrapper now loads the copied generated game bundle from /game in the same WebView document after installing the bridge, instead of showing the placeholder shell.

What changed:

  • Loads only the game bundle's #game mount plus explicit link/script assets; no iframe and no full body HTML import.
  • Rewrites and validates game asset URLs under /game, rejecting external, protocol-relative, traversal, and double-encoded traversal paths.
  • Rejects inline scripts, waits for stylesheet and entry script load, treats modulepreload as a non-blocking hint, and narrows runtime error trapping to same-origin /game script filenames.
  • Updated the AIT wrapper README and starter README so the wrapper devtools flow points at the last bundle copied by pnpm build:ait.

Validation:

  • pnpm check
  • pnpm --dir apps/target-ait check
  • pnpm --dir apps/target-ait build
  • MPGD_AIT_PACKAGE_MODE=skip pnpm build:ait
  • pnpm smoke:target ait
  • open-code-review commit-level review was run repeatedly; latest completed run's medium findings were patched. A final retry after c7fe8d4 hit provider/response issues after LLM connectivity passed, so I stopped after the local validations above remained green.

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

@imjlk: Thanks for the detailed update — the WebView loading approach (mounting #game with validated same-origin assets instead of iframe/full-body import, plus the traversal/protocol-relative rejection and inline-script guard) sounds like a solid hardening of the wrapper. I'll review the latest changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7fe8d4383

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

document.title = bundleDocument.title || document.title;
app.replaceChildren(createGameMount(gameMount));

await appendBundleScripts(scripts);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rewrite runtime asset URLs from copied game

When the copied game uses root-absolute runtime assets, the wrapper loads the entry script but still leaves those URLs pointing at the wrapper root. For example the checked kit AIT target builds apps/game-phaser, whose manifest requests /assets/ui/orb.svg, while build-target copies the game output under apps/target-ait/public/game/assets; after this script runs, Phaser fetches /assets/ui/orb.svg instead of /game/assets/ui/orb.svg, so the copied game loses its assets in wrapper/devtools sessions and packaged wrapper-web output. The wrapper needs to build/rewrite runtime asset paths as relative to /game or serve /assets from the copied bundle as well.

Useful? React with 👍 / 👎.

const normalizedPath = path.startsWith('/') && !path.startsWith(gameBundleBasePath)
? path.slice(1)
: path;
const resolvedUrl = new URL(normalizedPath, `${window.location.origin}${gameBundleBasePath}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject encoded traversal before URL normalization

Because new URL() canonicalizes encoded dot segments before encodedPathname is inspected, a bundle asset like assets/%2e%2e/secret.js is accepted as /game/secret.js instead of being rejected by the encoded-traversal check. If a copied bundle is malformed or tampered with, this bypasses the intended traversal validation and can load a different file under /game; inspect the raw path segments before resolving the URL.

Useful? React with 👍 / 👎.

Comment thread apps/target-ait/vite.config.ts Outdated
export default defineConfig(({ command, isPreview }) => ({
plugins: [
...(command === 'serve' && !isPreview && process.env.MPGD_AIT_DEVTOOLS !== '0'
? [aitDevtools.vite({ tunnel: aitDevtoolsTunnel })]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Enable the MCP endpoint for local devtools

When using the newly added devtools:mcp / ait:devtools:mcp command for the documented local devtools flow, this plugin instance never registers the devtools state endpoint: @ait-co/devtools defaults mcp to false, and the endpoint that the MCP server reads is only added with mcp: true. The command can start the MCP process, but a wrapper served by this config has no /api/ait-devtools/state endpoint for local browser mock-state debugging, so pass mcp: true when devtools are enabled.

Useful? React with 👍 / 👎.

@imjlk

imjlk commented Jul 7, 2026

Copy link
Copy Markdown
Owner Author

Patched the latest Codex review feedback on c7fe8d4 in 2cd0de5.

What changed:

  • Enabled the AIT devtools MCP endpoint with aitDevtools.vite({ mcp: true, ... }).
  • Mirrored copied game dist/assets into the AIT wrapper public assets so runtime root-absolute /assets/* requests from the copied game resolve in local devtools, phone tunnel, and wrapper-web output.
  • Rejected encoded traversal before URL normalization in game bundle asset rewriting.
  • Marked generated AIT public asset mirrors as ignored/blocked from tracked output and updated the AIT README.

Validation:

  • pnpm --dir apps/target-ait check && pnpm --dir apps/target-ait build
  • pnpm exec ttsc --noEmit -p tsconfig.tools.json
  • git diff --check
  • ocr review --audience agent --commit HEAD --concurrency 4 --timeout 15 ... (5 files reviewed, 0 comments)

@codex review
@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 7, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the update — the MCP endpoint enablement, asset mirroring for root-absolute /assets/* resolution, and the tightened traversal rejection (before URL normalization) all sound like solid follow-ups. I'll review the latest changes now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 2cd0de5240

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@imjlk
imjlk merged commit 3069720 into main Jul 7, 2026
6 checks passed
@imjlk
imjlk deleted the codex/ait-community-tooling branch July 15, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant