Skip to content

[#1639] Added AI agentic instructions selection to the installer.#1722

Merged
AlexSkrypnyk merged 1 commit into
developfrom
feature/1639-ai-instructions
Jun 4, 2025
Merged

[#1639] Added AI agentic instructions selection to the installer.#1722
AlexSkrypnyk merged 1 commit into
developfrom
feature/1639-ai-instructions

Conversation

@AlexSkrypnyk
Copy link
Copy Markdown
Member

@AlexSkrypnyk AlexSkrypnyk commented Jun 4, 2025

Closes #1639

Summary by CodeRabbit

  • New Features

    • Added an AI code assistant instructions prompt, allowing users to select between "Anthropic Claude" and "None" during setup.
    • Progress indicators are now shown on all prompt labels to help track setup steps.
  • Documentation

    • Overhauled the CLAUDE.md file for improved clarity, structure, and readability, with updated development and troubleshooting instructions.
  • User Interface

    • Enhanced installer header with clearer guidance, new navigation instructions, and improved visual separators using Unicode box-drawing characters.
  • Tests

    • Expanded test coverage to include the new AI code instructions prompt and its discovery logic.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2025

Walkthrough

This change introduces an "AI code assistant instructions" prompt to the installer, allowing users to select between "Anthropic Claude" and "None." It adds a new handler, integrates the prompt into the flow, updates labels with progress tracking, and adjusts tests accordingly. Documentation and formatting updates are also included.

Changes

File(s) Change Summary
.gitattributes Adjusted whitespace formatting for .vortex entry under export-ignore.
.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php Added new AiCodeInstructions handler class with discovery and process logic for AI code assistant selection.
.vortex/installer/src/Prompts/PromptManager.php Integrated AI prompt, added progress-tracking label method, updated prompt labels, and included AI in summary.
.vortex/installer/tests/Functional/InstallTest.php Updated test data provider to set AI code instructions env variable; added cases for CLAUDE and NONE.
.vortex/installer/tests/Unit/PromptManagerTest.php Added/updated tests for AI instructions prompt, coverage, and adjusted related test cases.
CLAUDE.md Restructured and clarified documentation, standardized command examples, removed outdated content.
.vortex/installer/src/Command/InstallCommand.php Updated header display with Unicode box-drawing characters and revised user instructions messaging.
.vortex/installer/src/Utils/Tui.php Changed underline character in box titles from hyphen to Unicode box-drawing character for visual consistency.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PromptManager
    participant AiCodeInstructions
    participant FileSystem

    User->>PromptManager: Start installation
    PromptManager->>AiCodeInstructions: discover()
    AiCodeInstructions->>FileSystem: Check for CLAUDE.md
    FileSystem-->>AiCodeInstructions: Exists/Readable?
    AiCodeInstructions-->>PromptManager: Return CLAUDE/NONE
    PromptManager->>User: Show "AI code assistant instructions" prompt
    User-->>PromptManager: Select option (Claude/None)
    PromptManager->>AiCodeInstructions: process()
    AiCodeInstructions->>FileSystem: Delete CLAUDE.md if not CLAUDE (optional)
    PromptManager->>User: Continue with next prompt
Loading

Assessment against linked issues

Objective Addressed Explanation
Add agentic AI instructions prompt as one of the latest questions (#1639)
Update installer to allow selecting which AI code assistant to use (#1639)
Update installed/discovery logic to recognize CLAUDE.md and set AI instructions accordingly (#1639)
Integrate AI instructions prompt and logic into installer tests (#1639)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Extensive documentation restructuring and cleanup (CLAUDE.md) While related to AI instructions, the full scope of documentation restructuring exceeds the specific objective of adding an AI prompt and handler.

Possibly related PRs

Poem

In the warren, prompts abound,
With AI choices newly found.
Claude or None, you now select,
Progress tracked—each step is checked.
Docs are tidy, tests in line,
This rabbit thinks the code’s divine!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions Bot temporarily deployed to commit June 4, 2025 06:11 Inactive
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c8f94bc and d0669b9.

⛔ Files ignored due to path filters (18)
  • .vortex/installer/tests/Fixtures/install/ai_instructions_claude/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/ai_instructions_none/.ignorecontent is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/ciprovider_circleci/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/ciprovider_gha/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/db_download_source_container_registry/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/deploy_type_all_circleci/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/deploy_type_none_circleci/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/deps_updates_provider_ci_circleci/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/deps_updates_provider_none/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/hosting_acquia/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/hosting_lagoon/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/provision_database_lagoon/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/provision_profile/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/services_no_clamav/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/services_no_solr/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/services_no_valkey/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/services_none/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/theme_absent/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (6)
  • .gitattributes (1 hunks)
  • .vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (1 hunks)
  • .vortex/installer/src/Prompts/PromptManager.php (25 hunks)
  • .vortex/installer/tests/Functional/InstallTest.php (7 hunks)
  • .vortex/installer/tests/Unit/PromptManagerTest.php (7 hunks)
  • CLAUDE.md (12 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
.vortex/installer/tests/Functional/InstallTest.php (5)
.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (1)
  • AiCodeInstructions (7-40)
.vortex/installer/src/Utils/Env.php (2)
  • Env (7-124)
  • put (24-26)
.vortex/installer/src/Prompts/PromptManager.php (2)
  • PromptManager (57-743)
  • makeEnvName (586-588)
.vortex/installer/src/Utils/Converter.php (1)
  • Converter (9-17)
.vortex/installer/tests/Functional/FunctionalTestCase.php (2)
  • FunctionalTestCase (22-141)
  • assertSutNotContains (131-139)
.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (2)
.vortex/installer/src/Prompts/Handlers/AbstractHandler.php (3)
  • AbstractHandler (10-158)
  • isInstalled (103-105)
  • getResponseAsString (116-122)
.vortex/installer/src/Prompts/PromptManager.php (1)
  • process (524-565)
⏰ Context from checks skipped due to timeout of 90000ms (11)
  • GitHub Check: build (1)
  • GitHub Check: build (0)
  • GitHub Check: vortex-test-deployment (0)
  • GitHub Check: vortex-test-workflow (3)
  • GitHub Check: vortex-test-deployment (1)
  • GitHub Check: vortex-test-workflow (0)
  • GitHub Check: vortex-test-workflow (2)
  • GitHub Check: vortex-test-workflow (1)
  • GitHub Check: vortex-test-common
  • GitHub Check: vortex-test-installer (8.3)
  • GitHub Check: vortex-test-installer (8.2)
🔇 Additional comments (21)
.gitattributes (1)

8-8: LGTM: Formatting improvement for consistency

The whitespace alignment improves consistency in the export-ignore entries without changing functionality.

.vortex/installer/tests/Functional/InstallTest.php (3)

8-8: LGTM: Import added for new AI instructions handler

The import correctly adds the new AiCodeInstructions class needed for the test cases.


177-180: LGTM: Systematic integration of AI instructions in test cases

The conversion from arrow functions to full anonymous functions is necessary to accommodate setting multiple environment variables. The pattern is consistent and the AI instructions environment variable is appropriately set to CLAUDE for comprehensive testing coverage.

Also applies to: 194-197, 201-204, 208-211, 224-227, 230-233, 253-254, 295-296, 299-302, 306-309, 312-315


362-367: LGTM: Dedicated test cases for AI instructions

The new test cases provide explicit coverage for both CLAUDE and NONE values of the AI instructions feature, ensuring the handler works correctly for all supported options.

.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (2)

16-26: LGTM: Discovery logic is sound

The discovery method correctly checks installation status and file existence, returning appropriate constants based on the presence of CLAUDE.md.


31-38:

Details

❌ Incorrect review comment

Review directory consistency and error handling

There's a potential inconsistency: discover() checks for CLAUDE.md in $this->dstDir but process() deletes it from $this->tmpDir. Also, the suppressed error on unlink could hide important issues.

Please verify this is the intended behavior. If files are copied from temp to destination during installation, this could be correct. However, consider logging failed deletions:

 public function process(): void {
   $v = $this->getResponseAsString();
   $t = $this->tmpDir;

   if ($v !== self::CLAUDE) {
-    @unlink($t . '/CLAUDE.md');
+    if (file_exists($t . '/CLAUDE.md') && !unlink($t . '/CLAUDE.md')) {
+      // Log warning but don't fail installation
+      error_log("Warning: Could not remove {$t}/CLAUDE.md");
+    }
   }
 }

Let me verify the file handling pattern across other handlers:


🏁 Script executed:

#!/bin/bash
# Check how other handlers manage files between tmpDir and dstDir
ast-grep --pattern $'class $_ extends AbstractHandler {
  $$$
  public function process(): void {
    $$$
    unlink($$$)
    $$$
  }
  $$$
}'

Length of output: 143


🏁 Script executed:

#!/bin/bash
set -e

echo "=== tmpDir references across handlers ==="
rg -n "tmpDir" .vortex/installer/src/Prompts/Handlers

echo
echo "=== dstDir references across handlers ==="
rg -n "dstDir" .vortex/installer/src/Prompts/Handlers

echo
echo "=== Contents of AiCodeInstructions.php ==="
sed -n '1,200p' .vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php

Length of output: 11284


No directory inconsistency in AiCodeInstructions
The discover() method checks for CLAUDE.md in the destination ($this->dstDir) to see what was previously installed, while process() removes the template file from the temporary folder ($this->tmpDir) so it isn’t copied into the project. This mirrors every other handler’s pattern (all use @unlink($this->tmpDir…)), so both the path usage and error‐suppression are intentional and consistent.
No changes needed.

Likely an incorrect or invalid review comment.

CLAUDE.md (3)

28-82: LGTM: Excellent restructuring of development commands

The reorganization into clear subsections (Environment management, Site building, Database operations, etc.) with consistent fenced code blocks significantly improves readability and usability of the development guide.


131-143: LGTM: Updated theme development commands

The switch from npm to yarn commands is consistent and the clear command examples improve the development workflow documentation.


330-330: LGTM: Professional documentation conclusion

The closing statement appropriately summarizes the guide's purpose and encourages project-specific expansion, providing a good foundation for development teams.

.vortex/installer/src/Prompts/PromptManager.php (7)

8-8: LGTM: Import addition is correct.

The AiCodeInstructions handler import is properly placed in alphabetical order.


64-76: LGTM: Progress tracking properties are well-documented.

The new properties for tracking prompt progress are clearly documented and appropriately typed.


118-491: LGTM: Consistent label standardization across all prompts.

All existing prompt labels have been systematically updated to use the new label() method, providing consistent progress indicators throughout the installer flow.


482-492: LGTM: AI prompt section integration is well-structured.

The new AI code assistant instructions prompt follows the established pattern with appropriate options (Anthropic Claude, None) and sensible defaults.


530-530: LGTM: Handler processing order is correctly maintained.

The AiCodeInstructions handler is properly added to the processing order in the correct position.


644-645: LGTM: Summary section addition is consistent.

The AI section is properly added to the responses summary following the established pattern.


656-675: LGTM: Progress indicator implementation is robust.

The label method correctly implements progress tracking with proper handling of sub-prompts through the suffix parameter. The logic ensures the counter only increments for main prompts.

.vortex/installer/tests/Unit/PromptManagerTest.php (5)

8-8: LGTM: Import addition is correctly placed.

The AiCodeInstructions import maintains alphabetical ordering.


50-81: LGTM: Comprehensive test coverage attributes.

The coverage attributes are properly updated to include all relevant classes for the new AI functionality.


177-178: LGTM: Default answer correctly added.

The default answer for AiCodeInstructions::id() is properly set to use the default UI handling.


208-208: LGTM: Expected default value is correct.

The AI instructions are properly included in the expected defaults with the NONE value.


829-836: LGTM: AI discovery test case is well-structured.

The new test case correctly verifies that the presence of a CLAUDE.md file is properly detected and results in the CLAUDE instruction state.


namespace DrevOps\VortexInstaller\Prompts\Handlers;

class AiCodeInstructions extends AbstractHandler {
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 (assertive)

Add class-level documentation

The class lacks a docblock describing its purpose and functionality. Consider adding documentation explaining that this handler manages AI code assistant instruction preferences.

+/**
+ * Handler for AI code assistant instructions selection.
+ *
+ * Manages the presence of AI instruction files like CLAUDE.md based on user
+ * selection during installation.
+ */
 class AiCodeInstructions extends AbstractHandler {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
class AiCodeInstructions extends AbstractHandler {
/**
* Handler for AI code assistant instructions selection.
*
* Manages the presence of AI instruction files like CLAUDE.md based on user
* selection during installation.
*/
class AiCodeInstructions extends AbstractHandler {
// ...
}
🤖 Prompt for AI Agents
In .vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php at line 7, add
a class-level docblock above the class declaration. The docblock should briefly
describe that this class is a handler responsible for managing AI code assistant
instruction preferences, outlining its purpose and main functionality.

Comment thread .vortex/installer/tests/Unit/PromptManagerTest.php Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2025

Codecov Report

Attention: Patch coverage is 84.81013% with 12 lines in your changes missing coverage. Please review.

Project coverage is 71.81%. Comparing base (c8f94bc) to head (26bb5bd).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
.vortex/installer/src/Command/InstallCommand.php 12.50% 7 Missing ⚠️
...taller/src/Prompts/Handlers/AiCodeInstructions.php 55.55% 4 Missing ⚠️
.vortex/installer/src/Prompts/PromptManager.php 98.36% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1722      +/-   ##
===========================================
+ Coverage    71.75%   71.81%   +0.05%     
===========================================
  Files           77       78       +1     
  Lines         4376     4403      +27     
===========================================
+ Hits          3140     3162      +22     
- Misses        1236     1241       +5     

☔ View full report in Codecov by Sentry.
📢 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 force-pushed the feature/1639-ai-instructions branch from d0669b9 to cfb47c1 Compare June 4, 2025 06:32
@github-actions github-actions Bot temporarily deployed to commit June 4, 2025 06:33 Inactive
@AlexSkrypnyk AlexSkrypnyk force-pushed the feature/1639-ai-instructions branch from cfb47c1 to 26bb5bd Compare June 4, 2025 06:34
@github-actions github-actions Bot temporarily deployed to commit June 4, 2025 06:35 Inactive
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 6

🔭 Outside diff range comments (1)
.vortex/installer/src/Command/InstallCommand.php (1)

353-365: 🧹 Nitpick (assertive)

Be mindful of terminal compatibility when switching to heavy Unicode box-drawing characters
Some minimal terminals (e.g. Alpine busybox, old Windows consoles, CI logs) still default to legacy code pages that cannot render the U+2500 range and will display mojibake. Consider:

-if (Tui::terminalWidth() >= 80) {
+// Fallback: render ASCII if UTF-8 is not detected or terminal is narrower.
+if (Tui::terminalWidth() >= 80 && mb_detect_encoding($logo, 'UTF-8', true)) {

Or keep the ASCII fallback in a separate heredoc.

♻️ Duplicate comments (2)
.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (1)

7-7: Add class-level documentation

The class lacks a docblock describing its purpose and functionality. Consider adding documentation explaining that this handler manages AI code assistant instruction preferences.

.vortex/installer/tests/Unit/PromptManagerTest.php (1)

837-850: Fix inconsistent test case comments (duplicate issue).

The test case comments still reference "preserve onboarding checklist" but these tests have been modified to test AI instructions functionality. This creates confusion about what the tests actually verify.

Apply this diff to fix the misleading comments:

-      'preserve onboarding checklist - discovery - removed' => [
+      'ai instructions - discovery - removed' => [
         [],
         [AiCodeInstructions::id() => AiCodeInstructions::NONE] + $expected_installed,
         function (PromptManagerTest $test, Config $config): void {
           $test->stubVortexProject($config);
         },
       ],
-      'preserve onboarding checklist - discovery - non-Vortex' => [
+      'ai instructions - discovery - non-Vortex' => [
         [],
         [AiCodeInstructions::id() => AiCodeInstructions::NONE] + $expected_defaults,
         function (PromptManagerTest $test, Config $config): void {
           File::dump(static::$sut . '/CLAUDE.md');
         },
       ],
🛑 Comments failed to post (6)
.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (2)

21-22: ⚠️ Potential issue

Directory inconsistency between discover and process methods.

The discover() method checks for CLAUDE.md in $this->dstDir but process() deletes it from $this->tmpDir. This inconsistency could lead to unexpected behavior where the file exists in the destination but process tries to delete it from a different location.

Consider aligning the directory usage:

  public function process(): void {
    $v = $this->getResponseAsString();
-   $t = $this->tmpDir;

    if ($v !== self::CLAUDE) {
-     @unlink($t . '/CLAUDE.md');
+     @unlink($this->dstDir . '/CLAUDE.md');
    }
  }

Also applies to: 35-36

🤖 Prompt for AI Agents
In .vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php around lines
21-22 and 35-36, the discover() method checks for the existence of CLAUDE.md in
$this->dstDir, but the process() method attempts to delete CLAUDE.md from
$this->tmpDir, causing directory inconsistency. To fix this, ensure both methods
reference the same directory variable consistently, either both using
$this->dstDir or both using $this->tmpDir, so that file existence checks and
deletions operate on the same path.

36-36: 🛠️ Refactor suggestion

Avoid error suppression in file operations.

Using @ to suppress errors in unlink() can hide legitimate issues like permission problems or file system errors. Consider proper error handling instead.

- @unlink($t . '/CLAUDE.md');
+ if (file_exists($t . '/CLAUDE.md') && !unlink($t . '/CLAUDE.md')) {
+   // Log warning or handle the error appropriately
+ }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      if (file_exists($t . '/CLAUDE.md') && ! unlink($t . '/CLAUDE.md')) {
        // Log a warning or handle the error appropriately
      }
🤖 Prompt for AI Agents
In .vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php at line 36,
remove the error suppression operator '@' from the unlink() call. Instead,
implement proper error handling by checking if the file exists before attempting
to unlink it and handle any potential errors or exceptions that may occur during
the file deletion process to avoid silently ignoring issues.
.vortex/installer/src/Command/InstallCommand.php (1)

402-408: 🧹 Nitpick (assertive)

Typographical & UX nits in the new interactive instructions

  1. “You’ll be asked a few questions …” → apostrophe is a smart quote, which can break some console fonts – use straight '.
  2. The phrase “some committed files may be modified after confirmation” duplicates “after confirmation” context from the previous sentence; consider shortening.
  3. Ctrl+U is widely used for “clear line” in many shells; using it for “previous step” may surprise users.

Minor but worth polishing for a smoother installer UX.

🤖 Prompt for AI Agents
In .vortex/installer/src/Command/InstallCommand.php around lines 402 to 408,
replace the smart apostrophe in "You’ll" with a straight single quote to avoid
console font issues, rephrase the sentence about file modifications to remove
the redundant "after confirmation" phrase for clarity, and change the "Ctrl+U"
shortcut for going back to the previous step to a less common key combination to
prevent conflicts with standard shell behavior.
.vortex/installer/src/Prompts/PromptManager.php (3)

64-77: 🛠️ Refactor suggestion

$totalResponses is now off by one – progress indicator breaks for the new AI prompt
A new top-level prompt was added but $totalResponses is still 21. The label will end up showing “22/21”. Either:

  1. Increment the constant to 22, or
  2. (preferred) drop the hard-coded value and derive it dynamically:
-  protected int $totalResponses = 21;
+  /** @var int Populated automatically once prompts are built. */
+  protected int $totalResponses = 0;

then, at the end of prompt() just before $this->responses = $responses; add:

$this->totalResponses = $this->currentResponse;

This keeps the counter accurate regardless of future additions/removals.

🤖 Prompt for AI Agents
In .vortex/installer/src/Prompts/PromptManager.php around lines 64 to 77, the
$totalResponses property is hard-coded to 21, which is now incorrect due to the
addition of a new top-level prompt, causing the progress indicator to display an
invalid count. To fix this, remove the hard-coded value and instead dynamically
set $totalResponses to the value of $currentResponse at the end of the prompt()
method, just before assigning $this->responses = $responses;. This ensures the
total response count stays accurate as prompts are added or removed.

266-273: ⚠️ Potential issue

Typo: “assest” → “assets”

-          label: $this->label('Compile theme assest during build using a task runner?'),
+          label: $this->label('Compile theme assets during build using a task runner?'),
🤖 Prompt for AI Agents
In .vortex/installer/src/Prompts/PromptManager.php around lines 266 to 273,
correct the typo in the label text by changing "Compile theme assest during
build using a task runner?" to "Compile theme assets during build using a task
runner?" to fix the spelling error.

644-646: 🧹 Nitpick (assertive)

Consistency: prefix AI summary lines with the same emoji used in the prompt
Elsewhere the summary keys mirror prompt labels (e.g., ‘🚚 Deployment types’). For consistency:

-    $values['AI code assistant instructions'] = $responses[AiCodeInstructions::id()];
+    $values['🤖 AI code assistant instructions'] = $responses[AiCodeInstructions::id()];
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    $values['AI'] = Tui::LIST_SECTION_TITLE;
    $values['🤖 AI code assistant instructions'] = $responses[AiCodeInstructions::id()];
🤖 Prompt for AI Agents
In .vortex/installer/src/Prompts/PromptManager.php around lines 644 to 646, the
summary keys for AI-related lines lack the emoji prefix used in other prompt
labels, causing inconsistency. Update the keys 'AI' and 'AI code assistant
instructions' to include the same emoji prefix as their corresponding prompt
labels to maintain consistent formatting throughout the summaries.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (1)

7-7: Add class-level documentation.

The class lacks a docblock describing its purpose and functionality. Consider adding documentation explaining that this handler manages AI code assistant instruction preferences.

+/**
+ * Handler for AI code assistant instructions selection.
+ *
+ * Manages the presence of AI instruction files like CLAUDE.md based on user
+ * selection during installation.
+ */
 class AiCodeInstructions extends AbstractHandler {
.vortex/installer/tests/Unit/PromptManagerTest.php (1)

829-850: Fix inconsistent test case comments.

The test case comments still reference "preserve onboarding checklist" but the tests are actually for AI instructions. The test logic appears correct, but the comments are misleading.

Apply this diff to fix the inconsistent comments:

-      'ai instructions - discovery - removed' => [
+      'ai instructions - discovery - removed' => [
         [],
         [AiCodeInstructions::id() => AiCodeInstructions::NONE] + $expected_installed,
         function (PromptManagerTest $test, Config $config): void {
           $test->stubVortexProject($config);
         },
       ],
-      'ai instructions - discovery - non-Vortex' => [
+      'ai instructions - discovery - non-Vortex' => [
         [],
         [AiCodeInstructions::id() => AiCodeInstructions::NONE] + $expected_defaults,
         function (PromptManagerTest $test, Config $config): void {
           File::dump(static::$sut . '/CLAUDE.md');
         },
       ],
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfb47c1 and 26bb5bd.

⛔ Files ignored due to path filters (18)
  • .vortex/installer/tests/Fixtures/install/ai_instructions_claude/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/ai_instructions_none/.ignorecontent is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/ciprovider_circleci/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/ciprovider_gha/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/db_download_source_container_registry/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/deploy_type_all_circleci/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/deploy_type_none_circleci/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/deps_updates_provider_ci_circleci/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/deps_updates_provider_none/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/hosting_acquia/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/hosting_lagoon/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/provision_database_lagoon/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/provision_profile/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/services_no_clamav/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/services_no_solr/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/services_no_valkey/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/services_none/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
  • .vortex/installer/tests/Fixtures/install/theme_absent/CLAUDE.md is excluded by !.vortex/installer/tests/Fixtures/**
📒 Files selected for processing (8)
  • .gitattributes (1 hunks)
  • .vortex/installer/src/Command/InstallCommand.php (4 hunks)
  • .vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (1 hunks)
  • .vortex/installer/src/Prompts/PromptManager.php (25 hunks)
  • .vortex/installer/src/Utils/Tui.php (1 hunks)
  • .vortex/installer/tests/Functional/InstallTest.php (7 hunks)
  • .vortex/installer/tests/Unit/PromptManagerTest.php (7 hunks)
  • CLAUDE.md (12 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (4)
.vortex/installer/src/Command/InstallCommand.php (1)
.vortex/installer/src/Utils/Downloader.php (1)
  • Downloader (10-160)
.vortex/installer/src/Utils/Tui.php (1)
.vortex/installer/src/Utils/Strings.php (2)
  • Strings (7-19)
  • strlenPlain (14-17)
.vortex/installer/tests/Functional/InstallTest.php (5)
.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (1)
  • AiCodeInstructions (7-40)
.vortex/installer/src/Utils/Env.php (2)
  • Env (7-124)
  • put (24-26)
.vortex/installer/src/Prompts/PromptManager.php (2)
  • PromptManager (57-743)
  • makeEnvName (586-588)
.vortex/installer/tests/Functional/FunctionalTestCase.php (2)
  • FunctionalTestCase (22-141)
  • assertSutNotContains (131-139)
.vortex/installer/src/Utils/Converter.php (1)
  • Converter (9-17)
.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (2)
.vortex/installer/src/Prompts/Handlers/AbstractHandler.php (3)
  • AbstractHandler (10-158)
  • isInstalled (103-105)
  • getResponseAsString (116-122)
.vortex/installer/src/Prompts/PromptManager.php (1)
  • process (524-565)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build (1)
  • GitHub Check: build (0)
  • GitHub Check: vortex-test-workflow (1)
  • GitHub Check: vortex-test-workflow (3)
  • GitHub Check: vortex-test-workflow (2)
  • GitHub Check: vortex-test-workflow (0)
🔇 Additional comments (13)
.gitattributes (1)

8-8: LGTM! Clean formatting improvement.

The additional spacing improves alignment of the export-ignore directive without any functional changes.

.vortex/installer/src/Utils/Tui.php (1)

93-93: Visual enhancement approved.

The change from ASCII hyphen to Unicode box drawing character improves the visual presentation of title underlines. The codebase already has proper UTF-8 handling via Strings::strlenPlain(), so terminal compatibility should be maintained.

.vortex/installer/tests/Functional/InstallTest.php (2)

8-8: Import addition is correct.

The new import for AiCodeInstructions is properly added and necessary for the test integration.


177-180: Comprehensive test integration looks good.

The systematic integration of AI instructions testing is well-executed:

  • Converting arrow functions to full anonymous functions allows setting multiple environment variables
  • Existing test cases are consistently updated to include AiCodeInstructions::CLAUDE
  • Two dedicated test cases properly cover both CLAUDE and NONE states
  • The exclusion of CLAUDE.md in assertions (line 185) is appropriate

The approach ensures comprehensive coverage of the new AI instructions functionality while maintaining test consistency.

Also applies to: 195-198, 202-205, 209-212, 225-228, 231-234, 254-254, 296-296, 300-303, 307-310, 313-316, 363-368

.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php (1)

16-26: Discovery logic is correct.

The discover() method properly checks installation status and file existence to determine the current AI instruction state. The logic flow is sound and returns appropriate values.

.vortex/installer/src/Command/InstallCommand.php (3)

353-353: LGTM: Enhanced visual presentation with Unicode box-drawing characters.

The replacement of ASCII dashes with Unicode box-drawing characters creates a cleaner, more professional appearance for the installer header.

Also applies to: 365-365


378-385: LGTM: Improved user-friendly messaging.

The updated text is more welcoming and clearly communicates that the tool will "guide you through installing" rather than just stating what it does. This creates a better user experience.


402-409: LGTM: Enhanced interactive mode instructions.

The updated instructions provide clearer guidance about the installation process and include the helpful Ctrl+U shortcut for going back to the previous step, improving the overall user experience.

CLAUDE.md (1)

1-331: LGTM: Well-structured development guide for Vortex projects.

The documentation is comprehensive and well-organized with clear sections for local development, configuration management, services integration, and deployment. The use of conditional comment markers allows for dynamic content generation based on project configuration, which aligns well with the AI code assistant instructions feature.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

85-85: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


206-206: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)


264-264: Lists should be surrounded by blank lines
null

(MD032, blanks-around-lists)


269-269: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


302-302: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


308-308: Fenced code blocks should be surrounded by blank lines
null

(MD031, blanks-around-fences)


316-316: Bare URL used
null

(MD034, no-bare-urls)


317-317: Bare URL used
null

(MD034, no-bare-urls)


318-318: Bare URL used
null

(MD034, no-bare-urls)


319-319: Bare URL used
null

(MD034, no-bare-urls)

.vortex/installer/src/Prompts/PromptManager.php (3)

64-76: LGTM: Progress tracking properties added for user experience enhancement.

The addition of totalResponses and currentResponse properties enables progress tracking during the prompt flow, which improves the user experience by showing how many steps remain.


482-492: LGTM: AI code assistant instructions prompt properly integrated.

The new AI instructions prompt is well-structured with clear options (Anthropic Claude/None) and helpful hint text. The integration follows the established pattern for other prompts.


530-530: LGTM: AI instructions properly integrated in processing and summary.

The AiCodeInstructions handler is correctly added to the processing order and included in the responses summary under the "AI" section.

Also applies to: 644-645

.vortex/installer/tests/Unit/PromptManagerTest.php (1)

8-8: LGTM: Comprehensive test coverage for AI instructions feature.

The test imports, coverage attributes, and default answers are properly updated to include the new AiCodeInstructions handler, ensuring complete test coverage for the AI code assistant instructions feature.

Also applies to: 50-50, 178-178, 208-208

Comment on lines +31 to +38
public function process(): void {
$v = $this->getResponseAsString();
$t = $this->tmpDir;

if ($v !== self::CLAUDE) {
@unlink($t . '/CLAUDE.md');
}
}
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 (assertive)

Improve error handling and variable naming.

The process logic is correct but can be enhanced:

  1. Error suppression with @ should be replaced with proper error handling
  2. Variable names $v and $t are not descriptive
 public function process(): void {
-  $v = $this->getResponseAsString();
-  $t = $this->tmpDir;
+  $response = $this->getResponseAsString();
+  $tmpDir = $this->tmpDir;

-  if ($v !== self::CLAUDE) {
-    @unlink($t . '/CLAUDE.md');
+  if ($response !== self::CLAUDE) {
+    $file = $tmpDir . '/CLAUDE.md';
+    if (file_exists($file)) {
+      unlink($file);
+    }
   }
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public function process(): void {
$v = $this->getResponseAsString();
$t = $this->tmpDir;
if ($v !== self::CLAUDE) {
@unlink($t . '/CLAUDE.md');
}
}
public function process(): void {
$response = $this->getResponseAsString();
$tmpDir = $this->tmpDir;
if ($response !== self::CLAUDE) {
$file = $tmpDir . '/CLAUDE.md';
if (file_exists($file)) {
unlink($file);
}
}
}
🤖 Prompt for AI Agents
In .vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php around lines 31
to 38, replace the error suppression operator '@' on unlink with proper error
handling to catch and log any failure when deleting the file. Rename variables
$v and $t to more descriptive names reflecting their purpose, such as
$responseType and $temporaryDirectory, to improve code readability and
maintainability.

Comment on lines +656 to +675
/**
* Generate a label for a prompt.
*
* @param string $text
* The text to display in the label.
* @param string|null $suffix
* An optional suffix to display in the label.
*
* @return string
* The formatted label text.
*/
protected function label(string $text, ?string $suffix = NULL): string {
if (is_null($suffix)) {
$this->currentResponse++;
}

$suffix = $suffix !== NULL ? $this->currentResponse . '.' . $suffix : $this->currentResponse;

return $text . ' ' . Tui::dim('(' . $suffix . '/' . $this->totalResponses . ')');
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify the progress tracking logic in the label method.

The label() method increments currentResponse unless a suffix is provided. Ensure that the total count of prompt calls without suffixes equals totalResponses (21) to maintain accurate progress tracking.


🏁 Script executed:

#!/bin/bash
# Count all label() method calls without suffix arguments in the prompt() method
rg -A 3 -B 1 'label\(' .vortex/installer/src/Prompts/PromptManager.php | grep -E 'label\(' | grep -v 'suffix' | wc -l

# Also check the total expected responses count
echo "Expected totalResponses: 21"

Length of output: 185


Could you break down how many label() calls pass two arguments versus just one? That will tell us exactly how many times currentResponse is incremented:


🏁 Script executed:

#!/bin/bash
# Count total label() calls
TOTAL=$(rg -c "label\(" .vortex/installer/src/Prompts/PromptManager.php)

# Count label() calls with two arguments
TWO_ARGS=$(rg -o "label\s*\(\s*[^,]\+,\s*[^)]\+\)" .vortex/installer/src/Prompts/PromptManager.php | wc -l)

# Derive one-argument calls
ONE_ARG=$((TOTAL - TWO_ARGS))

echo "Total label() calls: $TOTAL"
echo "Calls without suffix (one arg): $ONE_ARG"
echo "Calls with suffix (two args): $TWO_ARGS"
echo "Expected totalResponses: 21"

Length of output: 477


Synchronize label() calls with totalResponses

Your progress indicator will overflow: label() is called 33 times without a suffix (so currentResponse increments on every call), but totalResponses is 21.

  • All 33 invocations of label() currently bump the counter.
  • Either update totalResponses to 33, or pass a suffix (second argument) to any calls that shouldn’t increment.
  • Alternatively, adjust the increment logic to only count the 21 core prompts.

Please align the call count and total to ensure accurate progress tracking.

🤖 Prompt for AI Agents
In .vortex/installer/src/Prompts/PromptManager.php around lines 656 to 675, the
label() method increments currentResponse on every call without a suffix, but
totalResponses is set to 21 while there are 33 such calls, causing progress
overflow. To fix this, either update totalResponses to 33 to match all
increments, or modify calls that should not increment progress to pass a suffix
argument, or change the increment logic to only count the intended 21 core
prompts. Ensure the number of increments to currentResponse matches
totalResponses for accurate progress tracking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Add agentic AI instructions + update installed to allow selecting which one to use

1 participant