Skip to content

[#581] Rendered the Drupal version and command wrapper text in generated projects from the installer answers. - #589

Merged
AlexSkrypnyk merged 2 commits into
mainfrom
feature/581-render-install-text
Oct 12, 2026
Merged

AlexSkrypnyk merged 2 commits into
mainfrom
feature/581-render-install-text

Conversation

@AlexSkrypnyk

@AlexSkrypnyk AlexSkrypnyk commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Closes #581

Summary

install.php now writes the installer answers into the text that names the Drupal majors and the command wrappers, not only into which marker blocks stay. process() calls the new process_drupal_version_text() after the unselected DRUPAL_<major> blocks go and process_command_wrapper_text() after the unselected wrapper blocks go, and each replaces the template's every-option text with what core_version_requirement(), phpunit_config_comment() and command_wrapper_text() return for the selected options. Text that fits on whole lines sits in blocks instead: the AGENTS.md CI matrix in DRUPAL_<major> blocks, the commands for a project with no wrapper in DEV_NO_COMMAND_WRAPPER blocks, the template-only overview sentence in a META block, and the .ahoy.yml, Makefile and [Makefile*] entries of .gitattributes and .editorconfig in DEV_AHOY and DEV_MAKEFILE blocks.

With INSTALL_DRUPAL_VERSION=10,11 and INSTALL_COMMAND_WRAPPER=ahoy, the generated project still described every option. The *.info.yml kept core_version_requirement: ^10 || ^11 || ^12, which declares Drupal 12 compatibility to Drupal.org although the CI matrix never tests it, phpunit.xml opened with "Drupal 11 and 12 PHPUnit configuration", and AGENTS.md said "PHP 8.3-8.5, Drupal 10-12", told agents to extend "the make / ahoy target", listed make build, make lint and make test under Development Workflow, headed the Ahoy commands "Using Ahoy (alternative)", opened with "This is a Force Crystal template for creating contributed modules or themes" and held a double blank line after the HARD RULE paragraph and before "Using Ahoy". With no command wrapper selected, AGENTS.md kept a HARD RULE about wrappers the project doesn't have, 4 headings with no commands under them and the same make and ahoy workflow steps.

After the merge, that Drupal 10 and 11 Ahoy project declares core_version_requirement: ^10 || ^11, its phpunit.xml opens with <!-- Drupal 11 PHPUnit configuration. --> because Drupal 10 builds with phpunit.d10.xml, and its AGENTS.md lists "Drupal 10 on PHP 8.3-8.4" and "Drupal 11 on PHP 8.3-8.5", says "ahoy build" and "extend the ahoy target", and starts with "Force Crystal (force_crystal) is a Drupal module." ("theme" for a theme). A project with no wrapper gets scripts/eddy-tooling, the vendor/bin/eddy-* commands and a pointer to CONTRIBUTING.md under the same headings, and AGENTS.md, CONTRIBUTING.md and README.md hold no double blank line in any of the 8 selections that testProcessLeavesNoDoubleBlankLines() renders. README.dist.md, phpunit.d10.xml, .github/workflows/test.yml and the .eddy/tooling commands are unchanged, and the gaps that remain are listed under "Not in this PR".

Before / After

Generated with INSTALL_DRUPAL_VERSION=10,11 and INSTALL_COMMAND_WRAPPER=ahoy

Before
┌────────────────────────────────────────────────────────────────────────────┐
│ *.info.yml      core_version_requirement: ^10 || ^11 || ^12                │
│ phpunit.xml     <!-- Drupal 11 and 12 PHPUnit configuration. -->           │
│ AGENTS.md       This is a Force Crystal template for creating              │
│                 contributed modules or themes.                             │
│                 Matrix testing: PHP 8.3-8.5, Drupal 10-12                  │
│                 When `make` or `ahoy` exposes a command                    │
│                 Using Ahoy (alternative):                                  │
│                 1. Build environment: `make build` or `ahoy build`         │
│                 3. Check standards: `make lint` or `ahoy lint`             │
│                 double blank lines in 2 places                             │
│ .editorconfig   [Makefile*] section, with no Makefile                      │
│ .gitattributes  Makefile export-ignore, with no Makefile                   │
└────────────────────────────────────────────────────────────────────────────┘

After
┌────────────────────────────────────────────────────────────────────────────┐
│ *.info.yml      core_version_requirement: ^10 || ^11                       │
│ phpunit.xml     <!-- Drupal 11 PHPUnit configuration. -->                  │
│                 (Drupal 10 uses phpunit.d10.xml)                           │
│ AGENTS.md       Force Crystal (`force_crystal`) is a Drupal module.        │
│                 Drupal 10 on PHP 8.3-8.4                                   │
│                 Drupal 11 on PHP 8.3-8.5                                   │
│                 When `ahoy` exposes a command                              │
│                 Using Ahoy:                                                │
│                 1. Build environment: `ahoy build`                         │
│                 3. Check standards: `ahoy lint`                            │
│                 1 blank line in both places                                │
│ .editorconfig   no [Makefile*] section                                     │
│ .gitattributes  no Makefile export-ignore                                  │
└────────────────────────────────────────────────────────────────────────────┘
Generated with no command wrapper selected, AGENTS.md

Before
┌────────────────────────────────────────────────────────────────────────────┐
│ Development Commands                                                       │
│   HARD RULE - use the provided command wrappers                            │
│   Build and Environment Management: heading, no commands                   │
│   Code Quality: Linting and Testing headings, no commands                  │
│   Drupal Commands: heading, no commands                                    │
│   Diagnostics: heading, no commands                                        │
│ Development Workflow                                                       │
│   1. Build environment: `make build` or `ahoy build`                       │
│   3. Check standards: `make lint` or `ahoy lint`                           │
│   4. Run tests: `make test` or `ahoy test`                                 │
│ Project Structure                                                          │
│   scripts/eddy-tooling: "The command wrappers and CI run it"               │
└────────────────────────────────────────────────────────────────────────────┘

After
┌────────────────────────────────────────────────────────────────────────────┐
│ Development Commands                                                       │
│   HARD RULE - run each tool exactly as CONTRIBUTING.md shows               │
│   Build and Environment Management                                         │
│     scripts/eddy-tooling                                                   │
│     vendor/bin/eddy-assemble, eddy-start, eddy-stop, eddy-provision        │
│   Code Quality                                                             │
│     a pointer to the commands that CONTRIBUTING.md lists                   │
│   Drupal Commands                                                          │
│     build/vendor/bin/drush -l "$(vendor/bin/eddy-info site-url)" <command> │
│   Diagnostics                                                              │
│     vendor/bin/eddy-info                                                   │
│ Development Workflow                                                       │
│   1. Build environment: scripts/eddy-tooling, then vendor/bin/eddy-*       │
│   3. Check standards: run the linters that CONTRIBUTING.md lists           │
│   4. Run tests: run the tests that CONTRIBUTING.md lists                   │
│ Project Structure                                                          │
│   scripts/eddy-tooling: "CI runs it before the tooling commands"           │
└────────────────────────────────────────────────────────────────────────────┘

Changes

The installer

  • install.php, process(): process_drupal_version_text($selected_majors) runs right after the DRUPAL_<major> blocks of the unselected majors are removed, and process_command_wrapper_text($command_wrapper) runs right after the wrapper blocks are. Both call replace_string_content() with the renderer's output for every supported option as the needle and its output for the selected options as the replacement, so a template edit that drifts from the every-option text leaves a needle that matches nothing and the text ships unrendered. The new InstallProcessTest datasets render the real template for each selection, so that drift fails a test instead.
  • process_drupal_version_text() renders core_version_requirement in the extension's *.info.yml, such as ^10 || ^11, and the comment that opens phpunit.xml. The comment names only the selected majors that have no phpunit.d<major>.xml of their own, because eddy-assemble builds those majors with that file: Drupal 10 and 11 gives <!-- Drupal 11 PHPUnit configuration. -->, and Drupal 10 alone gives <!-- PHPUnit configuration. -->.
  • process_command_wrapper_text() renders "make or ahoy" and, for build, lint and test, "make build or ahoy build". Ahoy alone gives "ahoy" and "ahoy build". With no wrapper those phrases already sit in DEV_COMMAND_WRAPPER blocks, so the only replacement left is "The command wrappers and CI run it" becoming "CI runs it" in the scripts/eddy-tooling line of Project Structure.
  • Renderers: core_version_requirement(), phpunit_config_comment(), sort_drupal_majors() (numeric order with duplicates dropped, so a selection of 12,10 renders as ^10 || ^12), command_wrapper_binaries() (makefile to make and ahoy to ahoy, in the order the template names them), command_wrapper_text() and join_list() (A, B and C). They take arrays and return strings, with no filesystem access.
  • process_internal() replaces "is a Drupal module." with "is a Drupal theme." for a theme, next to the existing type: module replacement.

The template files

  • AGENTS.md, overview: the sentence about the scaffold, now followed by "install.php turns the example extension below into yours.", sits in a META block. The paragraph after it opens with "Your Extension (your_extension) is a Drupal module.", which the existing name replacements turn into " (<machine_name>) is a Drupal module."
  • AGENTS.md, CI matrix: "Matrix testing" is 1 line per major in DRUPAL_10, DRUPAL_11 and DRUPAL_12 blocks, each with the PHP range of that major in .github/workflows/test.yml: Drupal 10 on PHP 8.3-8.4, Drupal 11 on PHP 8.3-8.5 and Drupal 12 on PHP 8.5.
  • AGENTS.md, wrapper text: the HARD RULE paragraph says "the make or ahoy target" where it said "make / ahoy", so command_wrapper_text() can render it, and the "(default)" and "(alternative)" labels are gone, leaving "Using Make:" and "Using Ahoy:".
  • AGENTS.md, no command wrapper: DEV_COMMAND_WRAPPER blocks wrap the HARD RULE paragraph, the lint and test lists and Development Workflow steps 1, 3 and 4, and DEV_NO_COMMAND_WRAPPER blocks give the same headings their direct commands: scripts/eddy-tooling, vendor/bin/eddy-assemble, eddy-start, eddy-stop and eddy-provision, build/vendor/bin/drush -l "$(vendor/bin/eddy-info site-url)" for Drush and uli, and vendor/bin/eddy-info. The lint and test commands stay in CONTRIBUTING.md, where CONTRIBUTING.dist.md already lists them for this case, and the HARD RULE and workflow steps point there.
  • AGENTS.md, blank lines: every marker block opens with the blank line that separates it from the text above, as in CONTRIBUTING.dist.md, so a removed block takes its blank line with it. A blank line on both sides of a block left a double blank line when the block went.
  • .gitattributes and .editorconfig: the .ahoy.yml and Makefile export-ignore lines and the [Makefile*] section sit in DEV_AHOY and DEV_MAKEFILE blocks, the way the tool entries in those files already did, so a project without a Makefile or an .ahoy.yml no longer carries a line for it.

Docs

  • .eddy/CLAUDE.md: a new "Text rendered from the answers" section lists what core_version_requirement(), phpunit_config_comment() and command_wrapper_text() render and what happens when a replacement finds nothing, "Rules for a block" gains the blank-line convention for Markdown blocks, and "Adding a Drupal major" grows from 6 steps to 7, adding core_version_requirement, the phpunit.xml comment and the AGENTS.md matrix to what a new major needs.

Tests

  • .eddy/tests/src/Unit/InstallHelpersTest.php: data providers for sort_drupal_majors(), core_version_requirement(), phpunit_config_comment(), command_wrapper_text() and join_list(), plus process_drupal_version_text() and process_command_wrapper_text() run against scratch files. The datasets cover an unordered selection, a major with its own phpunit.d<major>.xml, text for other majors that has to stay, and a wrapper name the renderer doesn't know.
  • .eddy/tests/src/Unit/InstallProcessTest.php: renders the real template through process() for the 7 non-empty Drupal major selections plus an unordered selection (testProcessRendersDrupalVersionText()) and for Ahoy, Makefile, both and neither wrapper (testProcessRendersWrapperText()). It also asserts the overview for a module and a theme, the .gitattributes and .editorconfig wrapper entries, that AGENTS.md mentions make or ahoy only when that wrapper is selected, and that AGENTS.md, CONTRIBUTING.md and README.md hold no double blank line in 8 selections.
  • .eddy/tests/fixtures/install/: regenerated snapshots, not hand-edited, for the datasets whose AGENTS.md, *.info.yml, phpunit.xml or .editorconfig output changed.

Not in this PR

Follow-up candidates, left out on purpose:

  • README.dist.md: the PHP badges still show 8.3-8.5 for a Drupal 10-only or a Drupal 12-only project.
  • phpunit.d10.xml still ships in projects without Drupal 10.
  • AGENTS.md, "Code Quality Tools": the section is empty, with a double blank line, when every lint tool is removed.
  • The DRUPAL_VERSION examples in CONTRIBUTING.dist.md and AGENTS.md show the variable's syntax with sample versions rather than claiming support, so they stay as they are.
  • The Makefile comments that compare it with Ahoy.

Testing

  • composer --working-dir=.eddy/tests test -- --group=p0: 1324 tests and 5378 assertions pass.
  • composer --working-dir=.eddy/tests test -- --filter=InstallTest: 20 tests and 78 assertions pass against the regenerated snapshots.
  • composer --working-dir=.eddy/tests lint: PHPCS, PHPStan and Rector report 0 issues across 89 files.
  • ahoy lint (PHPCS, PHPStan, Rector, Twig CS Fixer, ESLint, Stylelint, CSpell) reports 0 issues, and ahoy test-unit passes its 4 tests.

Summary by CodeRabbit

  • New Features
    • The installer now tailors generated project guidance to the selected Drupal versions and available command tools, including compatible PHP testing targets and setup instructions.
    • Generated project descriptions now reflect whether the project is a Drupal module or theme.
  • Bug Fixes
    • Generated Markdown spacing is more consistent, and command examples and configuration references better match the selected project options.
  • Tests
    • Added coverage for generated version requirements, project guidance, command examples, and formatting.

@AlexSkrypnyk AlexSkrypnyk added this to the 5.0 milestone Oct 12, 2026
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: d25721c6-e4d5-4027-98b3-22b6db8ede6d
📥 Commits

Reviewing files that changed from the base of the PR and between 862ef6f and df9e303.

📒 Files selected for processing (34)
  • .eddy/CLAUDE.md
  • .eddy/tests/fixtures/install/_baseline/.editorconfig
  • .eddy/tests/fixtures/install/_baseline/AGENTS.md
  • .eddy/tests/fixtures/install/_baseline/force_crystal.info.yml
  • .eddy/tests/fixtures/install/_baseline/phpunit.xml
  • .eddy/tests/fixtures/install/d10_only/AGENTS.md
  • .eddy/tests/fixtures/install/d10_only/force_crystal.info.yml
  • .eddy/tests/fixtures/install/d10_only/phpunit.xml
  • .eddy/tests/fixtures/install/d11_only/AGENTS.md
  • .eddy/tests/fixtures/install/d11_only/force_crystal.info.yml
  • .eddy/tests/fixtures/install/d12_only/AGENTS.md
  • .eddy/tests/fixtures/install/d12_only/force_crystal.info.yml
  • .eddy/tests/fixtures/install/d12_only/phpunit.xml
  • .eddy/tests/fixtures/install/gha_both_wrappers/.editorconfig
  • .eddy/tests/fixtures/install/gha_both_wrappers/AGENTS.md
  • .eddy/tests/fixtures/install/gha_makefile/.editorconfig
  • .eddy/tests/fixtures/install/gha_makefile/AGENTS.md
  • .eddy/tests/fixtures/install/gha_no_command_wrapper/AGENTS.md
  • .eddy/tests/fixtures/install/no_cspell/AGENTS.md
  • .eddy/tests/fixtures/install/no_functional_javascript/AGENTS.md
  • .eddy/tests/fixtures/install/no_javascript_lint/AGENTS.md
  • .eddy/tests/fixtures/install/no_jest/AGENTS.md
  • .eddy/tests/fixtures/install/no_php_lint/AGENTS.md
  • .eddy/tests/fixtures/install/no_phpunit/AGENTS.md
  • .eddy/tests/fixtures/install/no_tools/.editorconfig
  • .eddy/tests/fixtures/install/no_tools/AGENTS.md
  • .eddy/tests/fixtures/install/theme/AGENTS.md
  • .eddy/tests/fixtures/install/theme/force_crystal.info.yml
  • .eddy/tests/src/Unit/InstallHelpersTest.php
  • .eddy/tests/src/Unit/InstallProcessTest.php
  • .editorconfig
  • .gitattributes
  • AGENTS.md
  • install.php
💤 Files with no reviewable changes (1)
  • .eddy/tests/fixtures/install/_baseline/.editorconfig

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

📝 Walkthrough

Walkthrough

The installer now adjusts generated scaffold text to match selected Drupal majors, command wrappers, and extension type. The template guidance and fixtures cover Make, Ahoy, and no-wrapper workflows, while tests check generated text and configuration across selections.

Changes

Installer scaffold rendering

Layer / File(s) Summary
Conditional scaffold guidance
.eddy/CLAUDE.md, AGENTS.md, .editorconfig, .gitattributes, .eddy/tests/fixtures/install/*
The guidance and fixtures describe command workflows for Make, Ahoy, or no wrapper. Wrapper-specific configuration uses markers, and fixtures cover omitted tools and commands.
Answer-dependent installer output
install.php, .eddy/tests/src/Unit/*, .eddy/tests/fixtures/install/*
The installer renders Drupal requirements, PHPUnit comments, wrapper wording, and extension descriptions from selected answers. Tests and fixtures cover version and wrapper combinations, generated Markdown spacing, and module or theme overviews.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Answers as Installer answers
  participant Process as process()
  participant Helpers as Rendering helpers
  participant Files as Generated scaffold files
  Answers->>Process: Selected Drupal majors, wrappers, and extension type
  Process->>Helpers: Render version and wrapper text
  Helpers->>Files: Replace template text
  Process->>Files: Substitute extension type
Loading

Merge Risk: ⚪ Minimal · up to df9e3

The change renders generated Drupal version and command wrapper text from the installer answers. No actionable merge-blocking risk was identified.

Pre-merge checks · Passed 4 · Failed 1

Failed Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 59.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 42 functions across 3 files. (30 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: rendering Drupal version and command-wrapper text from installer answers in generated projects.
Linked Issues check Passed Issue #581 is directly linked and remains open. The change renders core_version_requirement, the phpunit.xml opening comment, and the Drupal-specific AGENTS.md matrix from selected majors. It re…
Out of Scope Changes check Passed The changes stay within issue #581. The installer helpers implement answer-dependent rendering. Template marker blocks, regenerated fixtures, documentation, and automated tests support that rendering …
Full details: Docstring Coverage

Explanation

Docstring coverage is 59.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 42 functions across 3 files. (30 skipped: 30 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@codecov-commenter

codecov-commenter commented Oct 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.89%. Comparing base (862ef6f) to head (df9e303).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #589      +/-   ##
==========================================
+ Coverage   91.70%   91.89%   +0.19%     
==========================================
  Files           9        9              
  Lines        1579     1617      +38     
  Branches        4        4              
==========================================
+ Hits         1448     1486      +38     
  Misses        131      131              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AlexSkrypnyk AlexSkrypnyk added the Needs review Pull request needs a review from assigned developers label Oct 12, 2026
@AlexSkrypnyk
AlexSkrypnyk merged commit 4d775ef into main Oct 12, 2026
31 checks passed
@AlexSkrypnyk
AlexSkrypnyk deleted the feature/581-render-install-text branch October 12, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs review Pull request needs a review from assigned developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render Drupal version and command wrapper text from the installer answers

2 participants