Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

/.gitattributes export-ignore
/.github/FUNDING.yml export-ignore
/.vortex export-ignore
/.vortex export-ignore
19 changes: 10 additions & 9 deletions .vortex/installer/src/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@

protected function header(): void {
$logo = <<<EOT
-------------------------------------------------------------------------------
────────────────────────────────────────────────────────────────────────────────

██╗ ██╗ ██████╗ ██████╗ ████████╗ ███████╗ ██╗ ██╗
██║ ██║ ██╔═══██╗ ██╔══██╗ ╚══██╔══╝ ██╔════╝ ╚██╗██╔╝
Expand All @@ -362,7 +362,7 @@
Drupal project template

by DrevOps
-------------------------------------------------------------------------------
────────────────────────────────────────────────────────────────────────────────
EOT;

// Print the logo only if the terminal is wide enough.
Expand All @@ -375,13 +375,13 @@

$ref = $this->config->get(Config::REF);
if ($ref == Downloader::REF_STABLE) {
$content .= 'This will install the latest version of Vortex into your project.' . PHP_EOL;
$content .= 'This tool will guide you through installing the latest version of Vortex into your project.' . PHP_EOL;

Check warning on line 378 in .vortex/installer/src/Command/InstallCommand.php

View check run for this annotation

Codecov / codecov/patch

.vortex/installer/src/Command/InstallCommand.php#L378

Added line #L378 was not covered by tests
}
elseif ($ref == Downloader::REF_HEAD) {
$content .= 'This will install the latest development version of Vortex into your project.' . PHP_EOL;
$content .= 'This tool will guide you through installing the latest development version of Vortex into your project.' . PHP_EOL;
}
else {
$content .= sprintf('This will install Vortex into your project at commit "%s".', $ref) . PHP_EOL;
$content .= sprintf('This tool will guide you through installing the version of Vortex into your project at commit "%s".', $ref) . PHP_EOL;

Check warning on line 384 in .vortex/installer/src/Command/InstallCommand.php

View check run for this annotation

Codecov / codecov/patch

.vortex/installer/src/Command/InstallCommand.php#L384

Added line #L384 was not covered by tests
}

$content .= PHP_EOL;
Expand All @@ -399,12 +399,13 @@
$title = 'Welcome to Vortex non-interactive installer';
}
else {
$content .= 'Please answer the questions below to install configuration relevant to your site.' . PHP_EOL;
$content .= 'No changes will be applied until the last confirmation step.' . PHP_EOL;
$content .= 'You’ll be asked a few questions to tailor the configuration to your site.' . PHP_EOL;
$content .= 'No changes will be made until you confirm everything at the end.' . PHP_EOL;

Check warning on line 403 in .vortex/installer/src/Command/InstallCommand.php

View check run for this annotation

Codecov / codecov/patch

.vortex/installer/src/Command/InstallCommand.php#L402-L403

Added lines #L402 - L403 were not covered by tests
$content .= PHP_EOL;
$content .= 'Existing committed files may be modified. You will need to resolve any changes manually.' . PHP_EOL;
$content .= 'If you proceed, some committed files may be modified after confirmation, and you may need to resolve any changes manually.' . PHP_EOL;

Check warning on line 405 in .vortex/installer/src/Command/InstallCommand.php

View check run for this annotation

Codecov / codecov/patch

.vortex/installer/src/Command/InstallCommand.php#L405

Added line #L405 was not covered by tests
$content .= PHP_EOL;
$content .= 'Press Ctrl+C at any time to exit this installer.' . PHP_EOL;
$content .= 'Press Ctrl+C at any time to exit the installer.' . PHP_EOL;
$content .= 'Press Ctrl+U at any time to go back to the previous step.' . PHP_EOL;

Check warning on line 408 in .vortex/installer/src/Command/InstallCommand.php

View check run for this annotation

Codecov / codecov/patch

.vortex/installer/src/Command/InstallCommand.php#L407-L408

Added lines #L407 - L408 were not covered by tests
}

Tui::box($content, $title);
Expand Down
40 changes: 40 additions & 0 deletions .vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

declare(strict_types=1);

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.


const NONE = 'none';

const CLAUDE = 'claude';

/**
* {@inheritdoc}
*/
public function discover(): null|string|bool|array {
if (!$this->isInstalled()) {
return NULL;
}

if (is_readable($this->dstDir . '/CLAUDE.md')) {
return self::CLAUDE;
}

return self::NONE;
}

/**
* {@inheritdoc}
*/
public function process(): void {
$v = $this->getResponseAsString();
$t = $this->tmpDir;

Check warning on line 33 in .vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php

View check run for this annotation

Codecov / codecov/patch

.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php#L32-L33

Added lines #L32 - L33 were not covered by tests

if ($v !== self::CLAUDE) {
@unlink($t . '/CLAUDE.md');

Check warning on line 36 in .vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php

View check run for this annotation

Codecov / codecov/patch

.vortex/installer/src/Prompts/Handlers/AiCodeInstructions.php#L35-L36

Added lines #L35 - L36 were not covered by tests
}
}
Comment on lines +31 to +38
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.


}
Loading