Skip to content

Generate game-owned Devvit starter targets - #9

Merged
imjlk merged 6 commits into
mainfrom
codex/game-owned-devvit-template
Jul 5, 2026
Merged

imjlk merged 6 commits into
mainfrom
codex/game-owned-devvit-template

Conversation

@imjlk

@imjlk imjlk commented Jul 5, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Generate a game-owned apps/target-devvit app root in Phaser starters, including devvit.json, server bridge, scripts, README, and workspace install metadata.
  • Point generated Reddit target config at the game-owned Devvit root and include Reddit in the default target matrix.
  • Derive generated @mpgd/* package ranges from the released @mpgd/cli version, add a Sampo changeset, and document AIT/Capacitor reference-shell ownership limits.

Validation

  • pnpm create:game /tmp/mpgd-template-smoke-workspace --title "Workspace Game" --workspace --kit-path /Users/imjlk/repos/imjlk/mpgd-kit
  • pnpm install --filter . --filter ./apps/target-devvit in the generated workspace starter
  • pnpm check, pnpm build, pnpm build:devvit, pnpm smoke:devvit, pnpm --dir apps/target-devvit run check in the generated workspace starter
  • pnpm exec mpgd target build-all --targets-file ./mpgd.targets.json --targets web,ait,reddit --ait-variant wrapper --kit-path /Users/imjlk/repos/imjlk/mpgd-kit in the generated starter
  • pnpm exec mpgd target smoke-all --targets-file ./mpgd.targets.json --targets web,ait,reddit --kit-path /Users/imjlk/repos/imjlk/mpgd-kit in the generated starter
  • pnpm create:game /tmp/mpgd-template-smoke-nonworkspace --title "Smoke Game"
  • pnpm create:game /tmp/mpgd-template-smoke-autodetect --title "Auto Detect Game" --workspace
  • pnpm validate:starter-workflow
  • pnpm --filter @mpgd/cli check
  • pnpm check
  • pnpm graph:preflight
  • pnpm pack:packages
  • ocr review --audience agent --background "Update mpgd create-game/CLI templates so generated Phaser games own apps/target-devvit, add Devvit init/playtest scripts/docs, derive starter @mpgd dependency pins from the @mpgd/cli release version, and document AIT/Capacitor as kit reference shells for smoke only." --commit cdef365
  • ocr review --audience agent --background "Follow-up fix after OCR: in create-game workspace mode, generated Devvit scripts should use the auto-detected mpgd-kit path fallback when --kit-path is omitted." --commit 56cc05a

Notes

  • pnpm sampo:release:dry-run was attempted but is intentionally blocked on this branch: Sampo releases are configured for main only.
  • Other target review: AIT and Capacitor still use kit reference shells for smoke artifacts; docs now call out that production submissions should move app metadata into game-owned wrappers.

Summary by CodeRabbit

  • New Features

    • Added Reddit target support to game creation, builds, and smoke tests.
    • Generated Phaser starters now include a Devvit app root with ready-to-use Reddit setup commands.
    • Updated starter workflows to use simpler in-project commands and pnpm filters.
  • Bug Fixes

    • Improved path handling during game setup so generated apps are created in the correct location.
    • Standardized generated file naming and workspace settings for smoother template setup.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@imjlk, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 6 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 07cb1ec7-884d-41c3-bfab-e140a78de5bc

📥 Commits

Reviewing files that changed from the base of the PR and between 60a725a and a3dd6fc.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • apps/target-devvit/package.json
  • packages/cli/src/index.ts
  • packages/cli/templates/phaser-game/apps/target-devvit/package.json
  • packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts
📝 Walkthrough

Walkthrough

Adds a game-owned Reddit Devvit app root template (apps/target-devvit) with config, scripts, and an Express bridge server; updates CLI defaults, directory resolution, and template rendering; updates the existing repo-level Devvit server for oRPC/express.raw and async display-name handling; and updates documentation across the repo to reference the new reddit target and CLI-version-derived dependency pins.

Changes

Reddit Devvit App Root Integration

Layer / File(s) Summary
CLI defaults, directory resolution, and template context
packages/cli/src/index.ts
Default targets now include reddit; dependency version derives from ^${cliVersion}; adds resolveAppDirectory, toDevvitAppName, templateOutputPath helpers; extends template context/rendering with devvitAppName, defaultKitPath, pnpmWorkspaceKitPackages placeholders; updates "Next steps" output.
Devvit app root scaffolding files
packages/cli/templates/phaser-game/apps/target-devvit/{devvit.json,package.json,tsconfig.json,vite.server.config.ts}, .../pnpm-workspace.yaml, .../gitignore, .../mpgd.targets.json
Adds new template config files for the Devvit app (schema, permissions, build outputs, dependencies) and updates workspace/target/gitignore paths to reference apps/target-devvit.
Devvit Express bridge server implementation (template)
packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts
New server implementing menu-triggered post creation, bridge RPC dispatch, Redis lock-protected leaderboard score updates, JSON storage load/save, and request/response translation helpers.
Existing target-devvit server bridge and script updates
apps/target-devvit/src/server/index.ts, apps/target-devvit/package.json, apps/target-devvit/devvit.json
Switches to assertBridgeRequest/express.raw for oRPC wiring, resolves displayName asynchronously, normalizes request bodies, removes old parser, and adds dev:client/dev:server/dev:watch scripts.
Template wiring: manifest ownership, targets, and npm scripts
packages/cli/templates/phaser-game/agent/game-manifest.json, .../package.json
Adds a platform.devvit.app-root manifest block and Devvit init/login/playtest/build scripts plus @mpgd/cli dependency.
Documentation updates
.sampo/changesets/*, README.md, docs/*, packages/cli/templates/phaser-game/{README.md,agent/*}
Documents Reddit Devvit app-root ownership, updated build/smoke target lists including reddit, and CLI-version-derived dependency pinning.

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

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Express as Devvit Express Server
  participant Handler as handleBridgeRequest
  participant Redis
  participant Reddit as Devvit Reddit API

  Client->>Express: POST /api/mpgd/bridge
  Express->>Express: assertBridgeRequest(body)
  Express->>Handler: dispatch(method, payload)
  alt leaderboard.submitScore
    Handler->>Redis: acquire lock, zScore, WATCH/MULTI/EXEC
    Redis-->>Handler: submitted/failed result
  else storage.load / storage.save
    Handler->>Redis: GET/SET stored JSON
    Redis-->>Handler: value / saved status
  else identity.getPlayer
    Handler->>Reddit: getCurrentUsername()
    Reddit-->>Handler: displayName / fallback
  end
  Handler-->>Express: BridgeResponse
  Express-->>Client: response
Loading

Possibly related PRs

  • imjlk/mpgd-kit#1: Introduces the same agentic workflow documentation layer that this PR further updates for Reddit Devvit ownership/boundary details.
  • imjlk/mpgd-kit#4: Implements the same Reddit/Devvit target workflow and bridge-server/target enablement that this PR extends via generated templates and CLI defaults.
  • imjlk/mpgd-kit#6: Introduces the oRPC bridge transport/router that this PR's server wiring changes (bridgeRpcFetchHandler, express.raw) directly build on.

Poem

A burrow dug deep in "target-devvit" soil,
Redis locks turning, scores worth the toil.
The CLI hops fast with a version-pinned trail,
Bridges now humming, requests never fail. 🐇
Docs updated too — hop, build, and prevail!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: generating game-owned Devvit starter targets.
Description check ✅ Passed The description follows the required Summary, Validation, and Notes template and covers the main changes well.
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/game-owned-devvit-template

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: 3

🧹 Nitpick comments (3)
packages/cli/src/index.ts (1)

23-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicate target list instead of reusing defaultMatrixTargets.

defaultMatrixTargets (Line 23) was updated to 'web,ait,reddit', but the "Next steps" guidance at Line 595 hardcodes the same list as a separate string literal. Future changes to defaultMatrixTargets (adding/removing a target) won't automatically propagate here, risking guidance drifting out of sync with actual CLI defaults.

♻️ Reuse the constant
-      `--targets-file ${path.join(appDir, 'mpgd.targets.json')}`,
-      '--targets web,ait,reddit',
+      `--targets-file ${path.join(appDir, 'mpgd.targets.json')}`,
+      `--targets ${defaultMatrixTargets}`,

Also applies to: 592-596

🤖 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 `@packages/cli/src/index.ts` around lines 23 - 24, The “Next steps” guidance is
duplicating the target list instead of reusing the shared default, so update the
logic in index.ts to reference defaultMatrixTargets wherever the matrix targets
are shown or composed. In the section that builds the guidance text near the
Next steps message, replace the hardcoded web,ait,reddit string with the
defaultMatrixTargets constant so future target changes stay in sync. Keep the
fix localized to the existing Next steps/help text path and the
defaultMatrixTargets symbol.
packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts (1)

609-634: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Redundant parse→stringify→parse round trip for the oRPC path.

request.body is already parsed by express.json() and then re-serialized here via JSON.stringify(request.body ?? null) just to be re-parsed inside the oRPC fetch handler. This is a minor inefficiency on a hot path but not incorrect; could be avoided by using a raw body parser for this specific endpoint and forwarding the raw bytes instead.

🤖 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 `@packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts`
around lines 609 - 634, The oRPC request conversion in
expressRequestToFetchRequest is doing an unnecessary parse→stringify→parse round
trip by re-serializing request.body after express.json() already parsed it.
Update the server path that builds the Request to preserve and forward the raw
request bytes for this endpoint instead of using JSON.stringify(request.body ??
null), so the fetch handler can consume the original body directly without
re-parsing.
packages/cli/templates/phaser-game/package.json (1)

39-39: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider moving @mpgd/cli to devDependencies.

@mpgd/cli is only used for the build:devvit*/smoke:devvit scripts (build/test tooling), not runtime game code. As per README guidance that Target builds use the mpgd CLI because it knows how to turn this game into platform-specific artifacts, this is a dev-time tool; placing it in dependencies rather than devDependencies is a minor convention deviation that could affect production install footprint.

🤖 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 `@packages/cli/templates/phaser-game/package.json` at line 39, Move `@mpgd/cli`
from dependencies to devDependencies in the phaser-game package.json template,
since it is only referenced by the build:devvit* and smoke:devvit tooling.
Update the package manifest entry so the CLI remains available for build-time
scripts while avoiding treating it as a runtime dependency, and keep the
existing script references unchanged.
🤖 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/agent/brief.md`:
- Line 19: Replace the kit-specific checkout example in the Phaser agent brief
with the standalone project flow used by the README. Update the command shown in
the brief to use the mpgd CLI via pnpm exec with --kit-path instead of pnpm
--dir ../mpgd-kit, and keep the rest of the build-all arguments aligned with the
existing target/variant example.

In `@packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts`:
- Around line 337-359: The custom parseBridgeRequest logic is bypassing the
canonical BridgeRequest validation and fabricating default payload/meta values,
so bridge traffic can diverge from the oRPC path. Remove or replace this manual
parser in server/index.ts and route requests through
createBridgeRpcRouter/createBridgeRpcFetchHandler so assertBridgeRequest handles
runtime validation and invalid inputs become INVALID_BRIDGE_REQUEST responses.
Keep handleBridgeRequest as the downstream handler, but ensure it only receives
validated BridgeRequest data from the shared bridge schema path.
- Around line 575-589: `currentDisplayName` is reading `context.username`, but
that field is not available on the exposed Devvit context; update this helper to
use the Reddit client instead. Make `currentDisplayName` async, fetch the name
via `reddit.getCurrentUsername()`, and fall back to the passed display name or
player id only when the Reddit username is empty. Keep `currentPlayerId`
unchanged and make sure any callers of `currentDisplayName` are updated to await
the async result.

---

Nitpick comments:
In `@packages/cli/src/index.ts`:
- Around line 23-24: The “Next steps” guidance is duplicating the target list
instead of reusing the shared default, so update the logic in index.ts to
reference defaultMatrixTargets wherever the matrix targets are shown or
composed. In the section that builds the guidance text near the Next steps
message, replace the hardcoded web,ait,reddit string with the
defaultMatrixTargets constant so future target changes stay in sync. Keep the
fix localized to the existing Next steps/help text path and the
defaultMatrixTargets symbol.

In `@packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts`:
- Around line 609-634: The oRPC request conversion in
expressRequestToFetchRequest is doing an unnecessary parse→stringify→parse round
trip by re-serializing request.body after express.json() already parsed it.
Update the server path that builds the Request to preserve and forward the raw
request bytes for this endpoint instead of using JSON.stringify(request.body ??
null), so the fetch handler can consume the original body directly without
re-parsing.

In `@packages/cli/templates/phaser-game/package.json`:
- Line 39: Move `@mpgd/cli` from dependencies to devDependencies in the
phaser-game package.json template, since it is only referenced by the
build:devvit* and smoke:devvit tooling. Update the package manifest entry so the
CLI remains available for build-time scripts while avoiding treating it as a
runtime dependency, and keep the existing script references unchanged.
🪄 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: 0ec8c94a-e819-46b4-9643-cf05fcfc145f

📥 Commits

Reviewing files that changed from the base of the PR and between fda5ac9 and 56cc05a.

📒 Files selected for processing (20)
  • .sampo/changesets/game-owned-devvit-template.md
  • README.md
  • docs/AGENTIC_GAME_WORKFLOW.md
  • docs/GAME_DEVELOPMENT.md
  • docs/PUBLIC_RELEASE_CHECKLIST.md
  • packages/cli/src/index.ts
  • packages/cli/templates/phaser-game/.gitignore
  • packages/cli/templates/phaser-game/README.md
  • packages/cli/templates/phaser-game/agent/acceptance.md
  • packages/cli/templates/phaser-game/agent/brief.md
  • packages/cli/templates/phaser-game/agent/game-manifest.json
  • packages/cli/templates/phaser-game/apps/target-devvit/README.md
  • packages/cli/templates/phaser-game/apps/target-devvit/devvit.json
  • packages/cli/templates/phaser-game/apps/target-devvit/package.json
  • packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts
  • packages/cli/templates/phaser-game/apps/target-devvit/tsconfig.json
  • packages/cli/templates/phaser-game/apps/target-devvit/vite.server.config.ts
  • packages/cli/templates/phaser-game/mpgd.targets.json
  • packages/cli/templates/phaser-game/package.json
  • packages/cli/templates/phaser-game/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: 56cc05a8ea

ℹ️ 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".

@@ -0,0 +1,12 @@
node_modules/

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 Ship the generated gitignore in the CLI package

When @mpgd/cli is packed, npm omits files named .gitignore even though templates is listed in files (checked with npm pack --dry-run --json from packages/cli, and this file was absent). As a result, starters created from the published package will not get these ignore rules, so the new Devvit build outputs under apps/*/dist, artifacts, and .mpgd.targets.generated.json can be accidentally committed despite the template adding protections here. Consider templating this as a non-dotfile name and writing it out as .gitignore during generation.

Useful? React with 👍 / 👎.

@@ -0,0 +1,40 @@
{
"$schema": "https://developers.reddit.com/schema/config-file.v1.json",
"name": "__GAME_NAME__",

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 Constrain generated Devvit app names

For generated games whose directory basename is shorter than 3 or longer than 16 characters, this placeholder is filled with a value that passes assertValidGameName but violates Devvit's required name constraints, so pnpm devvit:init/upload rejects the app before playtest; the Devvit config docs require the app name to be 3-16 characters and match the lowercase/hyphen slug pattern (https://developers.reddit.com/docs/capabilities/devvit-web/devvit_web_configuration#required-properties). Please validate the game basename against the Devvit limit or derive a separate valid Devvit slug for this field.

Useful? React with 👍 / 👎.

]
},
"scripts": {
"dev": "pnpm dev:prepare && pnpm build:server -- --watch",

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 Watch the Phaser client during playtest

pnpm devvit:playtest relies on Devvit's scripts.dev command; the Devvit config docs describe this as the command devvit playtest uses to build or watch artifacts (https://developers.reddit.com/docs/capabilities/devvit-web/devvit_web_configuration#scripts-configuration). This command runs the full client build only once via dev:prepare and then watches only vite.server.config.ts, so editing the generated game's Phaser client under src/** during an active playtest leaves dist/client stale until the user stops and restarts playtest. Please run a client vite build --watch or equivalent alongside the server watcher.

Useful? React with 👍 / 👎.

@imjlk

imjlk commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest review feedback in 20a48c5:

  • Render the packaged gitignore template source as generated .gitignore, so npm pack no longer drops the ignore rules.
  • Derive a Devvit-safe devvit.json app name slug with the 3-16 character limit.
  • Use canonical assertBridgeRequest validation for the legacy bridge endpoint and remove the custom parser.
  • Use reddit.getCurrentUsername() for display names.
  • Preserve raw oRPC request bytes and avoid the parse/stringify round trip.
  • Add client + server watch scripts for Devvit playtest.
  • Reuse defaultMatrixTargets in CLI next-step output.
  • Update the generated agent brief to use pnpm exec mpgd ... --kit-path.

Validation run:

  • pnpm --filter @mpgd/cli check
  • pnpm --dir apps/target-devvit check
  • pnpm validate:starter-workflow
  • generated starter install/check/nested Devvit check/build:devvit/smoke:devvit
  • pnpm graph:preflight
  • pnpm check
  • pnpm build:devvit && pnpm smoke:target reddit
  • pnpm pack:packages
  • ocr review --audience agent --commit HEAD (0 comments)

@mpgd/cli was already in devDependencies in the template, so that review item was stale.

Re-review requested when you have a moment.

@imjlk

imjlk commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

Review feedback has been addressed in 20a48c5; please re-review the latest head when rate limits allow.

@imjlk

imjlk commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please re-review the latest head (20a48c5) after the Devvit starter review fixes.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026 •

Copy link
Copy Markdown

@imjlk Understood, I'll re-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: 20a48c589a

ℹ️ 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-devvit/package.json Outdated
"scripts": {
"dev": "devvit playtest",
"dev:prepare": "pnpm --dir ../.. build:target reddit staging",
"dev:client": "APP_TARGET=reddit APP_VERSION=0.0.0-dev BUILD_ID=devvit-watch pnpm --dir ../.. exec vite build --mode staging --watch --outDir apps/target-devvit/dist/client",

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 the Devvit client watcher at the game app

In the in-repo Devvit target, ../.. is the repository root, not the Phaser app; the Vite config and index.html for this target live under apps/game-phaser. When apps/target-devvit/devvit.json invokes pnpm dev:watch, this command runs Vite from the root and either fails to resolve an entry or watches/builds the wrong directory, so Devvit playtest no longer rebuilds the game client after the initial dev:prepare.

Useful? React with 👍 / 👎.

"version": "0.0.0",
"type": "module",
"scripts": {
"init": "devvit init --config devvit.json",

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 upload for Devvit initialization

For generated games following the new README's pnpm devvit:init step, this script runs devvit init --config devvit.json. I checked the Devvit 0.13 CLI docs: they document devvit new for creating projects and devvit upload [--bump ...] for uploading/registering app versions, and Reddit's own Bolt starter implements its devvit:init script as devvit upload --copy-paste; there is no documented init --config path, so first-time generated starters can fail before users can playtest or upload. Use the supported upload/link flow from the target app directory instead.

Useful? React with 👍 / 👎.

@imjlk

imjlk commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest Devvit playtest review feedback in 60a725a:

  • Pointed the in-repo Devvit target client watcher at apps/game-phaser, with output back to apps/target-devvit/dist/client.
  • Changed generated starter devvit:init to devvit upload --copy-paste --config devvit.json.
  • Updated generated README wording so new users understand devvit:init as the first App Directory upload/link step.

Validation run:

  • pnpm --dir apps/target-devvit check
  • pnpm --filter @mpgd/cli check
  • pnpm validate:starter-workflow
  • pnpm --dir apps/target-devvit run dev:client smoke-started Vite watch and confirmed output path
  • pnpm build:devvit
  • pnpm smoke:target reddit
  • pnpm graph:preflight
  • ocr review --audience agent --commit HEAD (0 comments)

@codex review
@coderabbitai review

Please re-review the latest head when available.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026 •

Copy link
Copy Markdown

@imjlk Understood, I'll re-review the latest changes in commit 60a725a 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 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.

🧹 Nitpick comments (1)
apps/target-devvit/package.json (1)

11-11: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

dev:watch masks watcher failures.

sh -c '... & ... & wait' returns exit status 0 even if dev:client or dev:server crashes (bare wait ignores child exit codes), so a failed watcher goes unnoticed while the other keeps running. Consider a runner like concurrently/npm-run-all -p that propagates failures and terminates siblings on exit.

🤖 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-devvit/package.json` at line 11, The dev:watch script in
package.json currently backgrounds dev:client and dev:server with a bare wait,
which can hide watcher crashes and leave the other process running. Replace the
shell-based parallel execution with a process runner such as concurrently or
npm-run-all in the dev:watch script so failures from either dev:client or
dev:server are propagated and sibling processes are terminated on exit.
🤖 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.

Nitpick comments:
In `@apps/target-devvit/package.json`:
- Line 11: The dev:watch script in package.json currently backgrounds dev:client
and dev:server with a bare wait, which can hide watcher crashes and leave the
other process running. Replace the shell-based parallel execution with a process
runner such as concurrently or npm-run-all in the dev:watch script so failures
from either dev:client or dev:server are propagated and sibling processes are
terminated on exit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f1c1a20c-c2aa-4731-9081-cd1a4b43c123

📥 Commits

Reviewing files that changed from the base of the PR and between 56cc05a and 60a725a.

📒 Files selected for processing (11)
  • apps/target-devvit/devvit.json
  • apps/target-devvit/package.json
  • apps/target-devvit/src/server/index.ts
  • packages/cli/src/index.ts
  • packages/cli/templates/phaser-game/README.md
  • packages/cli/templates/phaser-game/agent/brief.md
  • packages/cli/templates/phaser-game/apps/target-devvit/README.md
  • packages/cli/templates/phaser-game/apps/target-devvit/devvit.json
  • packages/cli/templates/phaser-game/apps/target-devvit/package.json
  • packages/cli/templates/phaser-game/apps/target-devvit/src/server/index.ts
  • packages/cli/templates/phaser-game/gitignore
💤 Files with no reviewable changes (1)
  • packages/cli/templates/phaser-game/gitignore
✅ Files skipped from review due to trivial changes (3)
  • packages/cli/templates/phaser-game/apps/target-devvit/README.md
  • packages/cli/templates/phaser-game/agent/brief.md
  • packages/cli/templates/phaser-game/README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/cli/templates/phaser-game/apps/target-devvit/package.json

@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: 60a725a947

ℹ️ 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".


response.status(200).json({
showToast: {
text: `Created __GAME_TITLE__ post ${post.id}.`,

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 Escape title before inserting it into template literals

When a user runs mpgd game create with a title containing a backtick or ${...}, assertValidGameTitle still accepts it, and the raw title is rendered into this Devvit server template literal. That produces generated TypeScript with an unterminated template string or unintended interpolation, so an otherwise accepted starter title can make pnpm check/Devvit builds fail or change the success toast at runtime. Escape the title for TypeScript output or avoid embedding the placeholder inside a template literal here.

Useful? React with 👍 / 👎.

@imjlk

imjlk commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

Addressed the latest watcher failure-propagation feedback in fe43b95:

  • Replaced the shell & wait Devvit watcher runner with concurrently --kill-others --success first so watcher failures are not hidden and sibling processes are terminated.
  • Applied the same watcher runner to both the in-repo apps/target-devvit package and the generated Phaser Devvit target template.
  • Fixed dev:server to pass Vite --watch directly; validation showed the previous pnpm build:server -- --watch form exited after one build.
  • Added the matching concurrently@10.0.3 dev dependency and lockfile update.

Validation run:

  • pnpm --dir apps/target-devvit exec concurrently --help
  • dummy failure propagation check with concurrently --kill-others --success first
  • pnpm --dir apps/target-devvit run dev:watch smoke-started both client/server watchers and confirmed both stayed in watch mode
  • pnpm --dir apps/target-devvit check
  • pnpm --filter @mpgd/cli check
  • pnpm validate:starter-workflow
  • pnpm install --frozen-lockfile --ignore-scripts
  • pnpm build:devvit
  • pnpm smoke:target reddit
  • pnpm graph:preflight
  • pnpm pack:packages
  • ocr review --audience agent --commit HEAD (0 comments)

@codex review
@coderabbitai review

Please re-review the latest head when available.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the update — the switch to concurrently --kill-others --success first addresses the failure-propagation concern properly, and the dev:server --watch fix and validation coverage look solid. I'll re-review the latest head 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. What shall we delve into next?

Reviewed commit: fe43b950af

ℹ️ 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 commented Jul 5, 2026

Copy link
Copy Markdown
Owner Author

Addressed the newly surfaced Devvit title escaping feedback in a3dd6fc:

  • Added a generated TypeScript string-literal placeholder for game titles, backed by JSON.stringify(title).
  • Updated the generated Devvit server to use gameName and gameTitle constants instead of placing title/name placeholders directly in runtime template strings.
  • Confirmed a title containing both a backtick and ${post.id} renders as a literal string, not executable template syntax.
  • While validating generated workspace install, fixed the starter workspace include list to include ${MPGD_KIT_PATH}/backend/*, matching the kit root workspace and resolving missing backend workspace packages.

Validation run:

  • pnpm --filter @mpgd/cli check
  • pnpm validate:starter-workflow
  • pnpm graph:preflight
  • generated starter render smoke with title Tick \ and ${post.id}`
  • generated workspace install/check smoke for apps/target-devvit
  • pnpm pack:packages
  • ocr review --audience agent --commit HEAD after amendments (0 comments)

@codex review
@coderabbitai review

Please re-review the latest head when available.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026 •

Copy link
Copy Markdown

@imjlk Thanks for the detailed update — the JSON.stringify(title)-backed string-literal placeholder approach and switching to gameName/gameTitle constants is a solid fix for the title-escaping issue, and validating with a title containing both a backtick and ${post.id} is good coverage. The ${MPGD_KIT_PATH}/backend/* workspace include fix also makes sense to keep the generated workspace in sync with the kit root. I'll re-review the latest head 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. Keep it up!

Reviewed commit: a3dd6fcacf

ℹ️ 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 12fb9df into main Jul 5, 2026
6 checks passed
@imjlk
imjlk deleted the codex/game-owned-devvit-template branch July 5, 2026 23:10
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