Skip to content

fix(install): three quality issues affecting generated AI tooling files#790

Open
barrytarter wants to merge 1 commit intolaravel:mainfrom
barrytarter:fix/install-quality-issues
Open

fix(install): three quality issues affecting generated AI tooling files#790
barrytarter wants to merge 1 commit intolaravel:mainfrom
barrytarter:fix/install-quality-issues

Conversation

@barrytarter
Copy link
Copy Markdown

Summary

Three independent generator-quality bugs in Boost v2 that surfaced via PR reviews on multiple downstream projects after composer require --dev laravel/boost:^2.0 && php artisan boost:install. All are tooling-quality issues — no behavioral or breaking changes.

# Bug File
1 GuidelineAssist::appPath() outputs mixed path separators on Windows (e.g., app\Http/Kernel.php) src/Install/GuidelineAssist.php
2 @boostsnippet directive renders captions as <!-- Name --> HTML comments instead of Markdown sub-headings src/Concerns/RendersBladeGuidelines.php
3 Skill files written without a trailing newline (SkillWriter::copyFile calls trim() then writes without restoring) src/Install/SkillWriter.php

Bug 1 — Path separators

GuidelineAssist::appPath('Http/Kernel.php') does:

ltrim(Str::after(app_path($path), base_path()), DIRECTORY_SEPARATOR);

On Windows, app_path() and base_path() concatenate with \ while the caller-supplied sub-path uses /. The result is app\Http/Kernel.php — mixed separators that leak into generated CLAUDE.md content (notably the laravel/v12 guideline lines like app\Console/Kernel.php). Display paths in Markdown should always use forward slashes regardless of host OS.

Fix: normalize \/ on the result.

Bug 2 — HTML comment captions

@boostsnippet("Basic Vue Page Component", "vue") ... @endboostsnippet previously rendered as:

<!-- Basic Vue Page Component -->
```vue
<script setup>...

HTML comments render as visible text in some Markdown processors, don't contribute to TOC/navigation, and are unconventional. Now renders as:

Basic Vue Page Component

<script setup>...

— proper sub-heading that integrates with the document structure.

### Bug 3 — Trailing newlines

`SkillWriter::copyFile` calls `MarkdownFormatter::format(trim(...))` and then `file_put_contents(...)`. The `trim()` strips the trailing newline; nothing restores it. Result: every generated `.md` file under `.claude/skills/`, `.cursor/skills/`, `.github/skills/`, `.junie/skills/` ends without `\n`, creating "no newline at end of file" diffs forever.

One downstream project saw this on **92 skill files** in a single Boost v2 install. Fix: append `"\n"` if missing before writing.

## Tests

- Updated existing `appPath` tests to assert forward-slash output (the previous `DIRECTORY_SEPARATOR` assertions accidentally masked the Windows bug on Linux CI).
- Added a new test covering the Windows-style mixed-separator input case.
- Updated existing `boostsnippet` tests (3 assertions) to expect `#### Name` instead of `<!-- Name -->`.
- Added a new `SkillWriter` test using a fixture that intentionally lacks a trailing newline, verifying the writer restores it.

Tests: 10 passed (23 assertions) on the touched test files


Pre-existing `ToolExecutor` test failures observed when running the full suite on Windows are unrelated and present on `upstream/main` as well.

## Test plan

- [ ] CI green on `ubuntu-latest`
- [ ] Manual: run `php artisan boost:install` on a fresh Laravel 12 project, verify generated skill files end with `\n` and `inertia-vue-development/SKILL.md` uses `#### Caption` instead of `<!-- Caption -->`
- [ ] Manual on Windows: verify `CLAUDE.md` `laravel/v12` section emits `app/Http/Kernel.php` (not `app\Http/Kernel.php`)

## Out of scope

A fourth issue surfaced — Boost generates the `volt/core` guideline saying `IMPORTANT: Activate volt-development every time...`, but the `volt-development` skill bundle in `.ai/volt/skill/volt-development/SKILL.blade.php` doesn't always materialize for projects that have `livewire/volt` installed. This needs deeper investigation into the SkillComposer detection path and is out of scope for this PR — happy to file as a separate issue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Three independent generator bugs surfaced via PR reviews after upgrading
projects from Boost v1 → v2. All three are tooling-quality issues; no
behavioral or breaking changes.

1) GuidelineAssist::appPath() now normalizes path separators to '/'

   On Windows, app_path()/base_path() concatenation injects DIRECTORY_SEPARATOR
   ('\') into the result, while caller-supplied sub-paths use '/'. Without
   normalization, $assist->appPath('Http/Kernel.php') returned the mixed
   "app\Http/Kernel.php", which then leaked into generated CLAUDE.md content
   (e.g. the laravel/v12 guideline). Display paths in markdown should always
   use forward slashes regardless of host OS.

2) RendersBladeGuidelines::processBoostSnippets renders captions as #### headings

   @boostsnippet("Name", "lang") previously emitted "<!-- Name -->" before the
   fenced code block. HTML comments render as visible text in some Markdown
   processors, don't contribute to TOC/navigation, and are unconventional in
   skill files. Now emits "#### Name" — proper sub-heading that integrates
   with the document structure.

3) SkillWriter::copyFile ensures trailing newline on generated skill files

   Both .blade.php-rendered and .md-source paths called trim() on content
   before writing, stripping the trailing newline. file_put_contents then
   wrote the content without restoring it, producing skill files that ended
   without "\n" — creating noisy "no newline at end of file" diffs every time
   anyone touched the file. Now appends "\n" if missing before writing.

Tests:

- Updated existing appPath tests to assert forward-slash output (was
  DIRECTORY_SEPARATOR which masked the Windows bug on Linux CI).
- Added new test "appPath always uses forward-slash separators for guideline
  output" covering Windows-style mixed-separator inputs.
- Updated existing boostsnippet tests (3 assertions) to expect "#### Name"
  instead of "<!-- Name -->".
- Added new test "writes skill files with a trailing newline" using a fixture
  that intentionally lacks a trailing newline, verifying SkillWriter restores
  it.

All 10 directly affected tests pass. Pre-existing ToolExecutor failures on
Windows are independent of these changes (verified on upstream/main).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant