@@ -95,7 +95,7 @@ protected function detect()
9595 {
9696 $ this ->installedIdes = $ this ->detectInstalledIdes ();
9797 $ this ->detectedProjectIdes = $ this ->detectIdesUsedInProject ();
98- // $this->detectedProjectAgents = $this->detectProjectAgents(); // TODO: Roo, Cline, Copilot
98+ $ this ->detectedProjectAgents = $ this ->detectProjectAgents (); // TODO: Roo, Cline, Copilot
9999 // TODO: Should we create all agents to start, add a 'detected' prop to them that's set on construct
100100 // Maybe add a trait 'DetectsInstalled' and 'DetectsUsed' (in this project)
101101 }
@@ -144,6 +144,7 @@ protected function detectInstalledIdes(): array
144144 'phpstorm ' => '/Applications/PhpStorm.app ' ,
145145 'cursor ' => '/Applications/Cursor.app ' ,
146146 'zed ' => '/Applications/Zed.app ' ,
147+ 'vscode ' => '/Applications/Visual Studio Code.app ' ,
147148 ];
148149
149150 foreach ($ macDetect as $ ideKey => $ path ) {
@@ -153,7 +154,7 @@ protected function detectInstalledIdes(): array
153154 }
154155
155156 if (Process::run ('which claude ' )->successful ()) {
156- $ detected [] = 'claude_code ' ;
157+ $ detected [] = 'claudecode ' ;
157158 }
158159 }
159160
@@ -304,7 +305,26 @@ protected function boostToolsToDisable(): array
304305
305306 protected function detectProjectAgents (): array
306307 {
307- return [];
308+ $ agents = [];
309+ if (file_exists (base_path ('CLAUDE.md ' )) || is_dir (base_path ('.claude ' ))) {
310+ $ agents [] = 'claudecode ' ;
311+ } elseif (Process::run ('which claude ' )->successful ()) {
312+ $ agents [] = 'claudecode ' ;
313+ }
314+
315+ if (is_dir (base_path ('.cursor ' )) || array_key_exists ('cursor ' , $ this ->installedIdes )) {
316+ $ agents [] = 'cursor ' ;
317+ }
318+
319+ if (is_dir (base_path ('.junie ' )) || array_key_exists ('phpstorm ' , $ this ->installedIdes )) {
320+ $ agents [] = 'junie ' ;
321+ }
322+
323+ if (file_exists (base_path ('.github/copilot-instructions.md ' ))) {
324+ $ agents [] = 'copilot ' ;
325+ }
326+
327+ return $ agents ;
308328 }
309329
310330 /**
@@ -392,10 +412,21 @@ protected function agentsToInstallTo(): Collection
392412
393413 ksort ($ agents );
394414
415+ // Map detected agent keys to class names
416+ $ detectedClasses = [];
417+ foreach ($ this ->detectedProjectAgents as $ agentKey ) {
418+ foreach ($ agents as $ className => $ displayName ) {
419+ if (strtolower ($ agentKey ) === strtolower (class_basename ($ className ))) {
420+ $ detectedClasses [] = $ className ;
421+ break ;
422+ }
423+ }
424+ }
425+
395426 $ selectedAgentClasses = collect (multiselect (
396427 label: sprintf ('Which agents need AI guidelines for %s? ' , $ this ->projectName ),
397428 options: $ agents ,
398- default: [ ' Laravel \\ Boost \\ Install \\ Agents \\ ClaudeCode ' ], // array_keys($agents) ,
429+ default: $ detectedClasses ,
399430 scroll: 4 , // TODO: use detection to auto-select
400431 ));
401432
0 commit comments