Skip to content

feat(cli): add init, the compute config formalizer#108

Open
AmanVarshney01 wants to merge 2 commits into
mainfrom
feat/init-command
Open

feat(cli): add init, the compute config formalizer#108
AmanVarshney01 wants to merge 2 commits into
mainfrom
feat/init-command

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Jul 2, 2026

Copy link
Copy Markdown
Member

prisma-cli init writes a committed prisma.compute.ts for the app in the current directory. Deploy stays zero-config; init pins what deploy would infer so the setup is reviewable and stable for teammates and CI. It never overwrites an existing config, never scaffolds code (that's create-prisma's job), and needs no auth except for the optional link step.

$ prisma-cli init
  app        acme-web  package.json
  framework  Next.js   detected from package.json
  http port  3000      framework default

✔ Wrote prisma.compute.ts
? Link this directory to a Prisma Project now? (Y/n)

Next steps:
- prisma-cli app deploy
// generated prisma.compute.ts
import { defineComputeConfig } from "@prisma/compute-sdk/config";

export default defineComputeConfig({
  app: {
    name: "acme-web",
    framework: "nextjs",
    httpPort: 3000,
  },
});

More examples:

prisma-cli init --framework hono --entry src/index.ts   # explicit framework
prisma-cli init --project proj_123                      # write + link, no prompts
prisma-cli init --no-link --json                        # pure file generator (CI/agents)

Design notes

  • Pins identity only (name, framework, httpPort, entry for entrypoint frameworks, region only when passed). No build block, so build-command inference stays live until a user opts into owning it. --framework custom appends a commented build stub since custom artifacts require it.
  • INIT_CONFIG_EXISTS when any config exists up to the repo root (nested configs refused, steering monorepos to one root config); INIT_DETECTION_FAILED with the framework list in --json, an interactive picker otherwise.
  • Link failures after the write downgrade to warnings; the config stands and init exits 0.
  • app deploy success output now hints Config prisma-cli init when the deploy ran on inferred settings.

Testing: 10 new integration tests (572 total green), lint/typecheck/build clean, plus a live run shown above.

init writes a committed prisma.compute.ts for the app in the invocation
directory: it detects the framework with the same registry deploy uses,
previews every value with its source, and pins the app's identity
(name, framework, httpPort, entry for entrypoint frameworks, region
only when passed). It never writes a build block, never overwrites an
existing config anywhere up to the repo root (INIT_CONFIG_EXISTS), and
never scaffolds code; create-prisma owns scaffolding.

Writing the config needs no auth. The optional link step reuses the
project link flow (interactive question, --link/--no-link/--project),
and link failures after the write downgrade to warnings so the config
stands. Detection failure prompts interactively and fails with
INIT_DETECTION_FAILED plus the framework list in JSON mode.

app deploy success output now hints "Config  prisma-cli init" when
the deploy ran on inferred settings without a config file.
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d9b4752c-252d-4ada-ae89-f6aed42421e5

📥 Commits

Reviewing files that changed from the base of the PR and between 8080a05 and 7008a46.

📒 Files selected for processing (6)
  • docs/product/command-spec.md
  • packages/cli/src/controllers/init.ts
  • packages/cli/src/presenters/app.ts
  • packages/cli/src/presenters/init.ts
  • packages/cli/src/shell/command-meta.ts
  • packages/cli/tests/init.test.ts
👮 Files not reviewed due to content moderation or server errors (6)
  • packages/cli/tests/init.test.ts
  • docs/product/command-spec.md
  • packages/cli/src/controllers/init.ts
  • packages/cli/src/presenters/init.ts
  • packages/cli/src/presenters/app.ts
  • packages/cli/src/shell/command-meta.ts

Warning

Walkthrough skipped

File diffs could not be summarized.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/init-command
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/init-command

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

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 2, 2026
init's next steps, link hints, error recovery commands, and the deploy
Config hint now render through the project's detected package runner
(pnpm dlx / bunx / yarn dlx / npx -y with @prisma/cli@latest), matching
the agent group's convention, instead of hardcoding the prisma-cli bin
name. Descriptor examples switch to the runner-aware form.
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