Skip to content

Commit 8c7c686

Browse files
committed
Fix skill sync skipping when .ai/skills exists but skills not in config
1 parent 95ca8de commit 8c7c686

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

src/Console/AddSkillCommand.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use InvalidArgumentException;
1313
use Laravel\Boost\Concerns\DisplayHelper;
1414
use Laravel\Boost\Skills\Remote\GitHubRepository;
15-
use Laravel\Boost\Support\Config;
1615
use Laravel\Boost\Skills\Remote\GitHubSkillProvider;
1716
use Laravel\Boost\Skills\Remote\RemoteSkill;
1817
use Laravel\Prompts\Terminal;
@@ -168,7 +167,6 @@ protected function installSkills(): int
168167

169168
grid($results['installedNames']);
170169

171-
$this->registerInstalledSkills($results['installedNames']);
172170
$this->runBoostUpdate();
173171
$this->showOutro();
174172
}
@@ -275,23 +273,6 @@ protected function addSkills(Collection $skills, string $absoluteSkillsPath, boo
275273
return $results;
276274
}
277275

278-
/**
279-
* Register newly installed skill names in boost.json so that
280-
* boost:update knows skills are enabled and syncs them to
281-
* agent-specific directories (.claude/skills/, .cursor/skills/, etc.).
282-
*
283-
* @param array<int, string> $installedNames
284-
*/
285-
protected function registerInstalledSkills(array $installedNames): void
286-
{
287-
$config = app(Config::class);
288-
289-
$existing = $config->getSkills();
290-
$merged = array_values(array_unique(array_merge($existing, $installedNames)));
291-
292-
$config->setSkills($merged);
293-
}
294-
295276
protected function runBoostUpdate(): void
296277
{
297278
$this->callSilently(UpdateCommand::class);

src/Console/UpdateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function handle(Config $config): int
2020
}
2121

2222
$guidelines = $config->getGuidelines();
23-
$hasSkills = $config->hasSkills();
23+
$hasSkills = $config->hasSkills() || is_dir(base_path('.ai/skills'));
2424

2525
if (! $guidelines && ! $hasSkills) {
2626
return self::SUCCESS;

tests/Feature/Console/UpdateCommandTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
if (file_exists(base_path('CLAUDE.md'))) {
2424
unlink(base_path('CLAUDE.md'));
2525
}
26+
27+
if (is_dir(base_path('.ai/skills'))) {
28+
rmdir(base_path('.ai/skills'));
29+
}
2630
});
2731

2832
it('it shows an error when boost.json does not exist', function (): void {
@@ -212,6 +216,32 @@
212216
->and($config->getSail())->toBeTrue();
213217
});
214218

219+
it('calls install command with skills flag when .ai/skills directory exists but skills are not in config', function (): void {
220+
$config = new Config;
221+
$config->setAgents(['claude_code']);
222+
$config->setGuidelines(false);
223+
224+
mkdir(base_path('.ai/skills'), 0755, true);
225+
226+
$command = Mockery::mock(UpdateCommand::class)->makePartial();
227+
$command->shouldReceive('callSilently')
228+
->once()
229+
->with(InstallCommand::class, [
230+
'--no-interaction' => true,
231+
'--guidelines' => false,
232+
'--skills' => true,
233+
])
234+
->andReturn(0);
235+
236+
$input = new ArrayInput([]);
237+
$output = new OutputStyle($input, new BufferedOutput);
238+
239+
$command->setLaravel($this->app);
240+
$command->setOutput($output);
241+
242+
expect($command->handle($config))->toBe(0);
243+
});
244+
215245
it('defaults to non-sail when config is missing', function (): void {
216246
file_put_contents(base_path('boost.json'), json_encode([
217247
'agents' => ['claude_code'],

0 commit comments

Comments
 (0)