Skip to content

fix(cli): honor explicit --entry under auto build-type; report loaded config path#112

Merged
AmanVarshney01 merged 1 commit into
mainfrom
fix/cli-entry-and-config-path
Jul 6, 2026
Merged

fix(cli): honor explicit --entry under auto build-type; report loaded config path#112
AmanVarshney01 merged 1 commit into
mainfrom
fix/cli-entry-and-config-path

Conversation

@AmanVarshney01

Copy link
Copy Markdown
Member

Two reported CLI quirks turned out to be misdiagnoses of real, narrower issues. This fixes the real ones.

What was reported vs. what's actually true

"prisma.compute.ts never loads (config.path: null wherever I put it)" — the config does load; its framework/app/region/env flow through and are visible in deploySettings.framework.source (set by prisma.compute.ts). The misleading part: deploySettings.config.path was null whenever the config had no build block, because that field tracked the build-settings block, not "was a config in effect."

"--framework/--entry are silently ignored when a framework is detected from deps" — false for app deploy, which resolves --framework--entry → detection (flags win). The real bug is in local app build/app run: an explicit --entry under --build-type auto was silently overridden by framework detection (e.g. Next.js), even though assertSupportedEntrypoint documents "auto may fall back to Bun" and deploy already resolves --entry to a Bun build.

Changes

1. Honor explicit --entry under auto (build + run).
resolveAppBuildStrategy (the single app build chokepoint) and resolveLocalRunFramework (app run) now resolve an explicit entrypoint to a Bun build before framework auto-detection, matching how app deploy resolves --entry. app deploy is unaffected (it always passes a concrete build type, never auto).

2. Report the loaded config path in deploy output.
deploySettings.config.path now reports the compute config file in effect whenever one loaded, even without a build block. path: null now means "no config loaded" rather than "no build block"; status still distinguishes whether the build block owned the build settings ("config") or they were inferred ("inferred").

Testing

  • New: resolveAppBuildStrategy resolves an explicit entrypoint to Bun even when Next.js is detectable (resolution-level, no build execution).
  • New: app run resolves an explicit entrypoint to Bun even when Next.js is detectable (asserts the local runner is invoked with buildType: "bun").
  • Extended: the config-region deploy test now asserts deploySettings.config = { path: "prisma.compute.ts", status: "inferred" } for a loaded config with no build block.
  • All three new/changed assertions were verified to fail without the source changes and pass with them. Full suite: 609 passing; tsc clean; spec (command-spec.md) updated for build, run, and deploy output.

… config path

Local 'app build'/'app run' with an explicit --entry and --build-type auto
silently let framework detection (e.g. Next.js) override the entrypoint,
contradicting deploy's resolution and the assertSupportedEntrypoint contract
('auto may fall back to Bun'). Resolve an explicit entrypoint to a Bun build
before detection, matching 'app deploy'.

Also report deploySettings.config.path as the compute config file in effect
whenever one loaded, even without a build block, so 'path: null' means 'no
config loaded' rather than 'no build-settings block'; status still conveys
build-block ownership.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • Behavior Changes

    • app build and app run now prefer an explicit entrypoint when --build-type auto is used, using Bun even if another framework is detected.
    • app deploy now reports clearer config metadata, including whether a compute config was loaded and how build settings were determined.
  • Documentation

    • Clarified command behavior and deployment metadata fields in the product docs.
  • Tests

    • Added and updated coverage for entrypoint precedence and deploy config reporting.

Walkthrough

This PR updates CLI build and run resolution so an explicit --entry forces a Bun build/run type when --build-type auto is set, overriding project-shape detection. resolveAppBuildStrategy and resolveLocalRunFramework were changed accordingly, with runAppRun now passing the entrypoint through. The app.deploy JSON result's deploySettings.config.path now derives from the loaded compute config rather than build settings resolution, distinguishing "no config loaded" from other cases. Tests were added covering these scenarios, and docs/product/command-spec.md was updated to document the new precedence and config metadata semantics.

Changes

Cohort: Explicit entry precedence and deploy config reporting

  • resolveAppBuildStrategy forces buildType: "bun" when an explicit entrypoint is provided and buildType is "auto".
  • resolveLocalRunFramework accepts an optional entrypoint and returns Bun early under the same condition; runAppRun passes entrypoint to it.
  • app.deploy result's deploySettings.config.path now uses computeConfig.config?.relativeConfigPath ?? null.
  • Added tests covering entrypoint-forced Bun resolution in build strategy, local run, and updated deploy config assertions.
  • Updated docs/product/command-spec.md for app build, app run, and app deploy behavior.

Sequence Diagram(s)

sequenceDiagram
  participant runAppRun
  participant resolveLocalRunFramework
  participant runLocalApp
  runAppRun->>resolveLocalRunFramework: entrypoint, requestedBuildType=auto
  resolveLocalRunFramework->>resolveLocalRunFramework: check entrypoint and buildType
  resolveLocalRunFramework-->>runAppRun: return Bun framework
  runAppRun->>runLocalApp: buildType bun, entrypoint
Loading

Related PRs: None identified.

Suggested labels: cli, documentation

Suggested reviewers: None identified.

Poem
A rabbit typed --entry with glee,
"Auto detect? Not for me!"
Bun springs forth, precedence clear,
No Next.js shadow to interfere.
Docs updated, tests all green,
The tidiest build you've ever seen. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the two main CLI fixes: honoring --entry under auto and reporting the loaded config path.
Description check ✅ Passed The description is directly related to the changeset and accurately describes the build, run, deploy, and docs updates.
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 fix/cli-entry-and-config-path
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/cli-entry-and-config-path

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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/cli/src/controllers/app.ts (1)

4643-4657: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Consider covering config-declared framework interaction with the new early-return.

The new early return (requestedBuildType === "auto" && options.entrypoint → force "bun") runs before the branch that preserves a configured framework identity (e.g. hono) for local dev at Lines 4665-4674. If merged.buildType can remain "auto" while compute.target.framework is set (e.g., explicit --build-type auto --entry ... alongside a prisma.compute.ts framework declaration), this would silently discard the configured framework identity in favor of a generic "bun" annotation ("set by --entry"), which changes the reported framework value and its annotation. Worth adding a test case for this combination to confirm intended precedence (explicit --entry overriding config framework identity, not just detection).

🤖 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/controllers/app.ts` around lines 4643 - 4657, The new early
return in resolveLocalRunFramework now forces a Bun framework for any auto build
with an entrypoint, which can override a config-declared framework identity from
configFramework/compute.target.framework. Update the precedence logic so the
explicit --entry case still respects the intended local-dev framework identity
path handled later in resolveLocalRunFramework, or otherwise preserve the
configured framework annotation instead of always returning
frameworkFromUserFacingValue("bun", "set by --entry"). Add a test covering
requestedBuildType = "auto", entrypoint set, and a declared framework (for
example hono) to verify the chosen framework and annotation match the intended
precedence.
🤖 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.

Outside diff comments:
In `@packages/cli/src/controllers/app.ts`:
- Around line 4643-4657: The new early return in resolveLocalRunFramework now
forces a Bun framework for any auto build with an entrypoint, which can override
a config-declared framework identity from
configFramework/compute.target.framework. Update the precedence logic so the
explicit --entry case still respects the intended local-dev framework identity
path handled later in resolveLocalRunFramework, or otherwise preserve the
configured framework annotation instead of always returning
frameworkFromUserFacingValue("bun", "set by --entry"). Add a test covering
requestedBuildType = "auto", entrypoint set, and a declared framework (for
example hono) to verify the chosen framework and annotation match the intended
precedence.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 630c2122-a23f-47f9-b937-d8946ddf6ba2

📥 Commits

Reviewing files that changed from the base of the PR and between 8fa526b and 67978e4.

📒 Files selected for processing (6)
  • docs/product/command-spec.md
  • packages/cli/src/controllers/app.ts
  • packages/cli/src/lib/app/build.ts
  • packages/cli/tests/app-build.test.ts
  • packages/cli/tests/app-controller.test.ts
  • packages/cli/tests/app-local-dev.test.ts

@AmanVarshney01 AmanVarshney01 merged commit e9b491a into main Jul 6, 2026
10 checks passed
@AmanVarshney01 AmanVarshney01 deleted the fix/cli-entry-and-config-path branch July 6, 2026 09:39
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