Skip to content

Commit 8696dcf

Browse files
Allow configurable guideline paths for AI agents (#392)
* Allow configurable guideline paths for AI agents This adds the ability to customize where Boost writes AI guideline files (CLAUDE.md, AGENTS.md, etc.) via config and environment variables. * Refactor guideline paths configuration Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Formatting Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> --------- Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> Co-authored-by: Pushpak Chhajed <pushpak1300@gmail.com>
1 parent 7f4306e commit 8696dcf

File tree

14 files changed

+297
-7
lines changed

14 files changed

+297
-7
lines changed

src/Install/CodeEnvironment/ClaudeCode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ public function mcpConfigPath(): string
5353

5454
public function guidelinesPath(): string
5555
{
56-
return 'CLAUDE.md';
56+
return config('boost.code_environments.claude_code.guidelines_path', 'CLAUDE.md');
5757
}
5858
}

src/Install/CodeEnvironment/Codex.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function projectDetectionConfig(): array
4343

4444
public function guidelinesPath(): string
4545
{
46-
return 'AGENTS.md';
46+
return config('boost.code_environments.codex.guidelines_path', 'AGENTS.md');
4747
}
4848

4949
public function mcpInstallationStrategy(): McpInstallationStrategy

src/Install/CodeEnvironment/Copilot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ public function mcpClientName(): ?string
4646

4747
public function guidelinesPath(): string
4848
{
49-
return '.github/copilot-instructions.md';
49+
return config('boost.code_environments.copilot.guidelines_path', '.github/copilot-instructions.md');
5050
}
5151
}

src/Install/CodeEnvironment/Cursor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function mcpConfigPath(): string
5656

5757
public function guidelinesPath(): string
5858
{
59-
return '.cursor/rules/laravel-boost.mdc';
59+
return config('boost.code_environments.cursor.guidelines_path', '.cursor/rules/laravel-boost.mdc');
6060
}
6161

6262
public function frontmatter(): bool

src/Install/CodeEnvironment/Gemini.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ public function mcpConfigPath(): string
4747

4848
public function guidelinesPath(): string
4949
{
50-
return 'GEMINI.md';
50+
return config('boost.code_environments.gemini.guidelines_path', 'GEMINI.md');
5151
}
5252
}

src/Install/CodeEnvironment/OpenCode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function mcpConfigPath(): string
5252

5353
public function guidelinesPath(): string
5454
{
55-
return 'AGENTS.md';
55+
return config('boost.code_environments.opencode.guidelines_path', 'AGENTS.md');
5656
}
5757

5858
public function mcpConfigKey(): string

src/Install/CodeEnvironment/PhpStorm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ public function mcpConfigPath(): string
6565

6666
public function guidelinesPath(): string
6767
{
68-
return '.junie/guidelines.md';
68+
return config('boost.code_environments.phpstorm.guidelines_path', '.junie/guidelines.md');
6969
}
7070
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Unit\Install\CodeEnvironment;
6+
7+
use Laravel\Boost\Install\CodeEnvironment\ClaudeCode;
8+
use Laravel\Boost\Install\Detection\DetectionStrategyFactory;
9+
use Laravel\Boost\Install\Enums\Platform;
10+
use Mockery;
11+
12+
beforeEach(function (): void {
13+
$this->strategyFactory = Mockery::mock(DetectionStrategyFactory::class);
14+
});
15+
16+
test('systemDetectionConfig returns command-based detection for all platforms', function (): void {
17+
$claude = new ClaudeCode($this->strategyFactory);
18+
19+
expect($claude->systemDetectionConfig(Platform::Darwin))
20+
->toHaveKey('command')
21+
->and($claude->systemDetectionConfig(Platform::Linux))
22+
->toHaveKey('command')
23+
->and($claude->systemDetectionConfig(Platform::Windows))
24+
->toHaveKey('command');
25+
});
26+
27+
test('guidelinesPath returns default CLAUDE.md when no config set', function (): void {
28+
$claude = new ClaudeCode($this->strategyFactory);
29+
30+
expect($claude->guidelinesPath())->toBe('CLAUDE.md');
31+
});
32+
33+
test('guidelinesPath returns a custom path from config', function (): void {
34+
config(['boost.code_environments.claude_code.guidelines_path' => '.claude/CLAUDE.md']);
35+
36+
$claude = new ClaudeCode($this->strategyFactory);
37+
38+
expect($claude->guidelinesPath())->toBe('.claude/CLAUDE.md');
39+
});
40+
41+
test('guidelinesPath returns a nested custom path from config', function (): void {
42+
config(['boost.code_environments.claude_code.guidelines_path' => 'docs/ai/CLAUDE.md']);
43+
44+
$claude = new ClaudeCode($this->strategyFactory);
45+
46+
expect($claude->guidelinesPath())->toBe('docs/ai/CLAUDE.md');
47+
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Unit\Install\CodeEnvironment;
6+
7+
use Laravel\Boost\Install\CodeEnvironment\Codex;
8+
use Laravel\Boost\Install\Detection\DetectionStrategyFactory;
9+
use Laravel\Boost\Install\Enums\Platform;
10+
use Mockery;
11+
12+
beforeEach(function (): void {
13+
$this->strategyFactory = Mockery::mock(DetectionStrategyFactory::class);
14+
});
15+
16+
test('systemDetectionConfig returns command-based detection for all platforms', function (): void {
17+
$codex = new Codex($this->strategyFactory);
18+
19+
expect($codex->systemDetectionConfig(Platform::Darwin))
20+
->toHaveKey('command')
21+
->and($codex->systemDetectionConfig(Platform::Linux))
22+
->toHaveKey('command')
23+
->and($codex->systemDetectionConfig(Platform::Windows))
24+
->toHaveKey('command');
25+
});
26+
27+
test('guidelinesPath returns default AGENTS.md when no config set', function (): void {
28+
$codex = new Codex($this->strategyFactory);
29+
30+
expect($codex->guidelinesPath())->toBe('AGENTS.md');
31+
});
32+
33+
test('guidelinesPath returns a custom path from config', function (): void {
34+
config(['boost.code_environments.codex.guidelines_path' => 'docs/AGENTS.md']);
35+
36+
$codex = new Codex($this->strategyFactory);
37+
38+
expect($codex->guidelinesPath())->toBe('docs/AGENTS.md');
39+
});
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Tests\Unit\Install\CodeEnvironment;
6+
7+
use Laravel\Boost\Install\CodeEnvironment\Copilot;
8+
use Laravel\Boost\Install\Detection\DetectionStrategyFactory;
9+
use Laravel\Boost\Install\Enums\Platform;
10+
use Mockery;
11+
12+
beforeEach(function (): void {
13+
$this->strategyFactory = Mockery::mock(DetectionStrategyFactory::class);
14+
});
15+
16+
test('detectOnSystem always returns false', function (): void {
17+
$copilot = new Copilot($this->strategyFactory);
18+
19+
expect($copilot->detectOnSystem(Platform::Darwin))->toBeFalse()
20+
->and($copilot->detectOnSystem(Platform::Linux))->toBeFalse()
21+
->and($copilot->detectOnSystem(Platform::Windows))->toBeFalse();
22+
});
23+
24+
test('guidelinesPath returns a default path when no config set', function (): void {
25+
$copilot = new Copilot($this->strategyFactory);
26+
27+
expect($copilot->guidelinesPath())->toBe('.github/copilot-instructions.md');
28+
});
29+
30+
test('guidelinesPath returns a custom path from config', function (): void {
31+
config(['boost.code_environments.copilot.guidelines_path' => 'docs/copilot.md']);
32+
33+
$copilot = new Copilot($this->strategyFactory);
34+
35+
expect($copilot->guidelinesPath())->toBe('docs/copilot.md');
36+
});

0 commit comments

Comments
 (0)