forked from laravel/boost
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodex.php
More file actions
90 lines (76 loc) · 2.25 KB
/
Codex.php
File metadata and controls
90 lines (76 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
declare(strict_types=1);
namespace Laravel\Boost\Install\Agents;
use Laravel\Boost\Contracts\SupportsGuidelines;
use Laravel\Boost\Contracts\SupportsMcp;
use Laravel\Boost\Contracts\SupportsSkills;
use Laravel\Boost\Install\Enums\McpInstallationStrategy;
use Laravel\Boost\Install\Enums\Platform;
class Codex extends Agent implements SupportsGuidelines, SupportsMcp, SupportsSkills
{
public function name(): string
{
return 'codex';
}
public function displayName(): string
{
return 'Codex';
}
public function systemDetectionConfig(Platform $platform): array
{
return match ($platform) {
Platform::Darwin, Platform::Linux => [
'command' => 'which codex',
],
Platform::Windows => [
'command' => 'cmd /c where codex 2>nul',
],
};
}
public function projectDetectionConfig(): array
{
return [
'paths' => ['.codex'],
'files' => ['AGENTS.md', '.codex/config.toml'],
];
}
public function guidelinesPath(): string
{
return config('boost.agents.codex.guidelines_path', 'AGENTS.md');
}
public function mcpInstallationStrategy(): McpInstallationStrategy
{
return McpInstallationStrategy::FILE;
}
public function mcpConfigPath(): string
{
return '.codex/config.toml';
}
public function mcpConfigKey(): string
{
return 'mcp_servers';
}
/** {@inheritDoc} */
public function httpMcpServerConfig(string $url): array
{
return [
'command' => 'npx',
'args' => ['-y', 'mcp-remote', $url],
];
}
/** {@inheritDoc} */
public function mcpServerConfig(string $command, array $args = [], array $env = []): array
{
return collect([
'command' => $command,
'args' => $args,
'cwd' => config('boost.executable_paths.current_directory', base_path()),
'env' => $env,
])->filter(fn ($value): bool => ! in_array($value, [[], null, ''], true))
->toArray();
}
public function skillsPath(): string
{
return config('boost.agents.codex.skills_path', '.agents/skills');
}
}