Skip to content

Commit 683e4cc

Browse files
iruoypushpak1300
andauthored
Add Gemini (#360)
* Add Gemini CodeEnvironment * Implement missing McpClient interface * Remove the redundant mcpInstallationStrategy method Signed-off-by: Pushpak Chhajed <[email protected]> --------- Signed-off-by: Pushpak Chhajed <[email protected]> Co-authored-by: Pushpak Chhajed <[email protected]> Co-authored-by: Pushpak Chhajed <[email protected]>
1 parent 9c7cc9a commit 683e4cc

File tree

4 files changed

+64
-2
lines changed

4 files changed

+64
-2
lines changed

src/BoostManager.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Laravel\Boost\Install\CodeEnvironment\Codex;
1111
use Laravel\Boost\Install\CodeEnvironment\Copilot;
1212
use Laravel\Boost\Install\CodeEnvironment\Cursor;
13+
use Laravel\Boost\Install\CodeEnvironment\Gemini;
1314
use Laravel\Boost\Install\CodeEnvironment\OpenCode;
1415
use Laravel\Boost\Install\CodeEnvironment\PhpStorm;
1516
use Laravel\Boost\Install\CodeEnvironment\VSCode;
@@ -25,6 +26,7 @@ class BoostManager
2526
'codex' => Codex::class,
2627
'copilot' => Copilot::class,
2728
'opencode' => OpenCode::class,
29+
'gemini' => Gemini::class,
2830
];
2931

3032
/**
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Laravel\Boost\Install\CodeEnvironment;
6+
7+
use Laravel\Boost\Contracts\Agent;
8+
use Laravel\Boost\Contracts\McpClient;
9+
use Laravel\Boost\Install\Enums\McpInstallationStrategy;
10+
use Laravel\Boost\Install\Enums\Platform;
11+
12+
class Gemini extends CodeEnvironment implements Agent, McpClient
13+
{
14+
public function name(): string
15+
{
16+
return 'gemini';
17+
}
18+
19+
public function displayName(): string
20+
{
21+
return 'Gemini';
22+
}
23+
24+
public function systemDetectionConfig(Platform $platform): array
25+
{
26+
return match ($platform) {
27+
Platform::Darwin, Platform::Linux => [
28+
'command' => 'command -v gemini',
29+
],
30+
Platform::Windows => [
31+
'command' => 'where gemini 2>nul',
32+
],
33+
};
34+
}
35+
36+
public function projectDetectionConfig(): array
37+
{
38+
return [
39+
'paths' => ['.gemini'],
40+
'files' => ['GEMINI.md'],
41+
];
42+
}
43+
44+
public function mcpConfigPath(): string
45+
{
46+
return '.gemini/settings.json';
47+
}
48+
49+
public function guidelinesPath(): string
50+
{
51+
return 'GEMINI.md';
52+
}
53+
}

tests/Unit/BoostManagerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Laravel\Boost\Install\CodeEnvironment\Codex;
88
use Laravel\Boost\Install\CodeEnvironment\Copilot;
99
use Laravel\Boost\Install\CodeEnvironment\Cursor;
10+
use Laravel\Boost\Install\CodeEnvironment\Gemini;
1011
use Laravel\Boost\Install\CodeEnvironment\OpenCode;
1112
use Laravel\Boost\Install\CodeEnvironment\PhpStorm;
1213
use Laravel\Boost\Install\CodeEnvironment\VSCode;
@@ -24,6 +25,7 @@
2425
'codex' => Codex::class,
2526
'copilot' => Copilot::class,
2627
'opencode' => OpenCode::class,
28+
'gemini' => Gemini::class,
2729
]);
2830
});
2931

tests/Unit/Install/CodeEnvironmentsDetectorTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Laravel\Boost\Install\CodeEnvironment\Codex;
1111
use Laravel\Boost\Install\CodeEnvironment\Copilot;
1212
use Laravel\Boost\Install\CodeEnvironment\Cursor;
13+
use Laravel\Boost\Install\CodeEnvironment\Gemini;
1314
use Laravel\Boost\Install\CodeEnvironment\OpenCode;
1415
use Laravel\Boost\Install\CodeEnvironment\PhpStorm;
1516
use Laravel\Boost\Install\CodeEnvironment\VSCode;
@@ -30,9 +31,9 @@
3031
$codeEnvironments = $this->detector->getCodeEnvironments();
3132

3233
expect($codeEnvironments)->toBeInstanceOf(Collection::class)
33-
->and($codeEnvironments->count())->toBe(7)
34+
->and($codeEnvironments->count())->toBe(8)
3435
->and($codeEnvironments->keys()->toArray())->toBe([
35-
'phpstorm', 'vscode', 'cursor', 'claudecode', 'codex', 'copilot', 'opencode',
36+
'phpstorm', 'vscode', 'cursor', 'claudecode', 'codex', 'copilot', 'opencode', 'gemini',
3637
]);
3738

3839
$codeEnvironments->each(function ($environment): void {
@@ -64,6 +65,7 @@
6465
$this->container->bind(Codex::class, fn () => $mockOther);
6566
$this->container->bind(Copilot::class, fn () => $mockOther);
6667
$this->container->bind(OpenCode::class, fn () => $mockOther);
68+
$this->container->bind(Gemini::class, fn () => $mockOther);
6769

6870
$detector = new CodeEnvironmentsDetector($this->container, $this->boostManager);
6971
$detected = $detector->discoverSystemInstalledCodeEnvironments();
@@ -83,6 +85,7 @@
8385
$this->container->bind(Codex::class, fn () => $mockEnvironment);
8486
$this->container->bind(Copilot::class, fn () => $mockEnvironment);
8587
$this->container->bind(OpenCode::class, fn () => $mockEnvironment);
88+
$this->container->bind(Gemini::class, fn () => $mockEnvironment);
8689

8790
$detector = new CodeEnvironmentsDetector($this->container, $this->boostManager);
8891
$detected = $detector->discoverSystemInstalledCodeEnvironments();
@@ -116,6 +119,7 @@
116119
$this->container->bind(Codex::class, fn () => $mockOther);
117120
$this->container->bind(Copilot::class, fn () => $mockOther);
118121
$this->container->bind(OpenCode::class, fn () => $mockOther);
122+
$this->container->bind(Gemini::class, fn () => $mockOther);
119123

120124
$detector = new CodeEnvironmentsDetector($this->container, $this->boostManager);
121125
$detected = $detector->discoverProjectInstalledCodeEnvironments($basePath);
@@ -137,6 +141,7 @@
137141
$this->container->bind(Codex::class, fn () => $mockEnvironment);
138142
$this->container->bind(Copilot::class, fn () => $mockEnvironment);
139143
$this->container->bind(OpenCode::class, fn () => $mockEnvironment);
144+
$this->container->bind(Gemini::class, fn () => $mockEnvironment);
140145

141146
$detector = new CodeEnvironmentsDetector($this->container, $this->boostManager);
142147
$detected = $detector->discoverProjectInstalledCodeEnvironments($basePath);

0 commit comments

Comments
 (0)