Skip to content

feat(cli): choose the engine of the backend at init - #6

Open
Decipher wants to merge 26 commits into
feature/03-modules-readfrom
feature/04-engines
Open

Decipher wants to merge 26 commits into
feature/03-modules-readfrom
feature/04-engines

Conversation

@Decipher

Copy link
Copy Markdown
Member

What changed

drx init chooses the engine that runs the backend.

  • A starter entry can describe its engines. The quickstart entry describes local PHP with SQLite, DDEV and Lando. none is for a Drupal that already exists.
  • An engine adapter says how to run a backend tool, such as Composer or Drush, under that engine.
  • drx init takes --engine, or asks. It checks that the engine's commands are on the machine and removes the files of the engines not chosen. It then writes the backend URL and records the choice in drx.config.json.
  • The quickstart keeps its local tooling whatever engine is chosen.
  • drx.config.json is read from disk on each load, so a change made by one step is seen by the next.
  • The README and the changeset describe engines, the files init removes and the recorded choice.

Why

The quickstart holds the files of several ways to run Drupal, and a new site needs one of them. Choosing at init leaves a site with one engine's files, and gives later commands a recorded answer to "how is the backend run here".

How it was checked

  • npm run lint and npm run typecheck pass
  • npm test passes, and coverage did not drop
  • A changeset is included, if a published package changed
  • Nothing that resolves only on a private network reached a tracked file

Run from a clean npm ci: each run: line of the workflow's lint and test jobs, yamllint, actionlint and npm run build. npm test ran 403 tests, above the floor. The pack step ran as the workflow has it, from the installed binaries.

Not covered yet

  • No engine's setup steps have been run. The steps init prints follow the quickstart's README.
  • --setup answers "not available yet".
  • The end-to-end test was not run for this change.

A starter entry can describe the engines that run its backend: local
PHP with SQLite, DDEV, Lando, or a Drupal that already exists.

- drx init asks for the engine, or takes it from a flag, and checks
  that the engine's commands are on the machine.
- It removes the files of the engines not chosen, writes the backend
  URL, and records the choice in drx.config.json.
- The quickstart entry describes its three engines, and keeps its local
  tooling whatever engine is chosen.
- drx.config.json is read from disk on every load.
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 44 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dc238f8c-88c7-4522-bd56-03f1e3e5b0a0
Commits

Reviewing files that changed from the base of the PR and between cf2e1d0 and c0eb7ee.

Files selected for processing: 30

  • .changeset/first-release-cli.md
  • README.md
  • packages/cli/src/commands-on-path.ts
  • packages/cli/src/commands/info.ts
  • packages/cli/src/commands/init.ts
  • packages/cli/src/engines/backend-url.ts
  • packages/cli/src/engines/choose.ts
  • packages/cli/src/engines/ddev.ts
  • packages/cli/src/engines/engine.ts
  • packages/cli/src/engines/files.ts
  • packages/cli/src/engines/index.ts
  • packages/cli/src/engines/lando.ts
  • packages/cli/src/engines/none.ts
  • packages/cli/src/engines/php.ts
  • packages/cli/src/parts.ts
  • packages/cli/src/registry/entry.ts
  • packages/cli/src/validate.ts
  • packages/cli/test/commands/init-engines.test.ts
  • packages/cli/test/commands/init.test.ts
  • packages/cli/test/e2e/quickstart.test.ts
  • packages/cli/test/engines/engines.test.ts
  • packages/cli/test/engines/files.test.ts
  • packages/cli/test/helpers/engines.ts
  • packages/cli/test/helpers/server.ts
  • packages/cli/test/project.test.ts
  • packages/cli/test/registry/entry.test.ts
  • packages/cli/test/registry/registry.test.ts
  • packages/cli/test/seams.test.ts
  • starters/index.json
  • starters/quickstart.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@Decipher
Decipher added this pull request to stack #9 November 18, 2026 03:31
The quoted `cd` line meets the engine's steps this branch prints after
it, and keeps both. The repeated read of drx.config.json was already
here, with its test.
- The quickstart's note printed after `drx init --install` said the dev
  server starts the backend again. That is so for the `php` engine
  only, and the note now says so and where the other backends start.
- The README says that `install.runs` also applies to the steps of an
  engine, and a test covers it.
…ry that holds files

`drx init --force` into a directory that was not empty removed the
paths of the engines not chosen, whoever had put them there. A
`.lando.yml` or a `.ddev` directory of the user's own went with them.

- `init` looks at the directory before the download. When it held
  files, no engine file is removed, and a warning lists the paths that
  were left. `--force` is a yes to writing the starter's files, and to
  nothing else.
- A directory that is new or empty is handled as before.
- The README says what `--force` does in a project that exists.
# Conflicts:
#	packages/cli/src/commands/init.ts
The entries gained fields at this level, so a build from it has to prefer
its bundled copy over a published registry that does not have them yet.
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