Skip to content
Open
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
9 changes: 7 additions & 2 deletions src/Install/CodeEnvironment/Copilot.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function systemDetectionConfig(Platform $platform): array
public function projectDetectionConfig(): array
{
return [
'files' => ['.github/copilot-instructions.md'],
'files' => ['.github/instructions/laravel-boost.instructions.md'],
];
}

Expand All @@ -46,6 +46,11 @@ public function mcpClientName(): ?string

public function guidelinesPath(): string
{
return '.github/copilot-instructions.md';
return '.github/instructions/laravel-boost.instructions.md';
}

public function frontmatter(): bool
{
return true;
}
}
7 changes: 6 additions & 1 deletion src/Install/GuidelineWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Laravel\Boost\Install;

use Laravel\Boost\Contracts\Agent;
use Laravel\Boost\Install\CodeEnvironment\Copilot;
use RuntimeException;

class GuidelineWriter
Expand Down Expand Up @@ -60,7 +61,11 @@ public function write(string $guidelines): int
// No existing Boost guidelines found, append to end of existing file
$frontMatter = '';
if ($this->agent->frontmatter() && ! str_contains($content, "\n---\n")) {
$frontMatter = "---\nalwaysApply: true\n---\n";
if ($this->agent instanceof Copilot) {
$frontMatter = "---\napplyTo: \"**\"\n---\n";
} else {
$frontMatter = "---\nalwaysApply: true\n---\n";
}
}

$existingContent = rtrim($content);
Expand Down
7 changes: 4 additions & 3 deletions tests/Unit/Install/CodeEnvironmentsDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,16 @@
test('discoverProjectInstalledCodeEnvironments detects copilot with nested file path', function (): void {
$tempDir = sys_get_temp_dir().'/boost_test_'.uniqid();
mkdir($tempDir);
mkdir($tempDir.'/.github');
file_put_contents($tempDir.'/.github/copilot-instructions.md', 'test');
mkdir($tempDir.'/.github/instructions', recursive: true);
file_put_contents($tempDir.'/.github/instructions/laravel-boost.instructions.md', 'test');

$detected = $this->detector->discoverProjectInstalledCodeEnvironments($tempDir);

expect($detected)->toContain('copilot');

// Cleanup
unlink($tempDir.'/.github/copilot-instructions.md');
unlink($tempDir.'/.github/instructions/laravel-boost.instructions.md');
rmdir($tempDir.'/.github/instructions');
rmdir($tempDir.'/.github');
rmdir($tempDir);
});
Expand Down