Skip to content

Commit 7e676d7

Browse files
Add Sail Support in Guidelines (#329)
* Add Sail Support in Guideline Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Fix Markdown Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Refactor Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * move method Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * rename variables Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Refactor GuidelineComposer.php Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Refactor Sail Command Usage Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Refactor shouldUseSail method to handle empty selectedBoostFeatures case Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * More controlled guideliens Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Refactor command name Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Refactor core.blade.php Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Refactor core.blade.php Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Formatting Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Formatting Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Formatting Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * Add nodePackageManager for backward support Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> * single quotes for consistency * spaces around brackets for consistency * spaces around brackets for consistency * extract commands to `command` method * wip --------- Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com> Co-authored-by: Joe Tannenbaum <joe.tannenbaum@laravel.com>
1 parent f86e780 commit 7e676d7

File tree

21 files changed

+269
-196
lines changed

21 files changed

+269
-196
lines changed

.ai/enforce-tests.blade.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
@php
2+
/** @var \Laravel\Boost\Install\GuidelineAssist $assist */
3+
@endphp
14
## Test Enforcement
25

36
- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
4-
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test` with a specific filename or filter.
7+
- Run the minimum number of tests needed to ensure code quality and speed. Use `{{ $assist->artisanCommand('test') }}` with a specific filename or filter.

.ai/folio/core.blade.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1+
@php
2+
/** @var \Laravel\Boost\Install\GuidelineAssist $assist */
3+
@endphp
14
## Laravel Folio
25

36
- Laravel Folio is a file based router. With Laravel Folio, a new route is created for every Blade file within the configured Folio directory. For example, pages are usually in in `resources/views/pages/` and the file structure determines routes:
47
- `pages/index.blade.php` → `/`
58
- `pages/profile/index.blade.php` → `/profile`
69
- `pages/auth/login.blade.php` → `/auth/login`
7-
- You may list available Folio routes using `php artisan folio:list` or using Boost's `list-routes` tool.
10+
- You may list available Folio routes using `{{ $assist->artisanCommand('folio:list') }}` or using Boost's `list-routes` tool.
811

912
### New Pages & Routes
10-
- Always create new `folio` pages and routes using `artisan folio:page [name]` following existing naming conventions.
13+
- Always create new `folio` pages and routes using `{{ $assist->artisanCommand('folio:page [name]') }}` following existing naming conventions.
1114

12-
@verbatim
1315
<code-snippet name="Example folio:page Commands for Automatic Routing" lang="shell">
1416
// Creates: resources/views/pages/products.blade.php → /products
15-
php artisan folio:page 'products'
17+
{!! $assist->artisanCommand('folio:page "products"') !!}
1618

1719
// Creates: resources/views/pages/products/[id].blade.php → /products/{id}
18-
php artisan folio:page 'products/[id]'
20+
{!! $assist->artisanCommand('folio:page "products/[id]"') !!}
1921
</code-snippet>
20-
@endverbatim
2122

2223
- Add a 'name' to each new Folio page at the very top of the file so it has a named route available for other parts of the codebase to use.
2324

.ai/foundation.blade.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
@php
2+
/** @var \Laravel\Boost\Install\GuidelineAssist $assist */
3+
@endphp
14
# Laravel Boost Guidelines
25

36
The Laravel Boost guidelines are specifically curated by Laravel maintainers for this application. These guidelines should be followed closely to enhance the user's satisfaction building Laravel applications.
@@ -27,7 +30,7 @@
2730
- Do not change the application's dependencies without approval.
2831

2932
## Frontend Bundling
30-
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `{{ $assist->nodePackageManager() }} run build`, `{{ $assist->nodePackageManager() }} run dev`, or `composer run dev`. Ask them.
33+
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `{{ $assist->nodePackageManagerCommand('run build') }}`, `{{ $assist->nodePackageManagerCommand('run dev') }}`, or `{{ $assist->composerCommand('run dev') }}`. Ask them.
3134

3235
## Replies
3336
- Be concise in your explanations - focus on what's important rather than explaining obvious details.

.ai/laravel/11/core.blade.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
@php
2+
/** @var \Laravel\Boost\Install\GuidelineAssist $assist */
3+
@endphp
14
## Laravel 11
25

36
- Use the `search-docs` tool to get version specific documentation.
@@ -32,6 +35,6 @@
3235

3336
### New Artisan Commands
3437
- List Artisan commands using Boost's MCP tool, if available. New commands available in Laravel 11:
35-
- `php artisan make:enum`
36-
- `php artisan make:class`
37-
- `php artisan make:interface`
38+
- `{{ $assist->artisanCommand('make:enum') }}`
39+
- `{{ $assist->artisanCommand('make:class') }} `
40+
- `{{ $assist->artisanCommand('make:interface') }} `

.ai/laravel/core.blade.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
@php
2+
/** @var \Laravel\Boost\Install\GuidelineAssist $assist */
3+
@endphp
14
## Do Things the Laravel Way
25

3-
- Use `php artisan make:` commands to create new files (i.e. migrations, controllers, models, etc.). You can list available Artisan commands using the `list-artisan-commands` tool.
4-
- If you're creating a generic PHP class, use `artisan make:class`.
6+
- Use `{{ $assist->artisanCommand('make:') }}` commands to create new files (i.e. migrations, controllers, models, etc.). You can list available Artisan commands using the `list-artisan-commands` tool.
7+
- If you're creating a generic PHP class, use `{{ $assist->artisanCommand('make:class') }}`.
58
- Pass `--no-interaction` to all Artisan commands to ensure they work without user input. You should also pass the correct `--options` to ensure correct behavior.
69

710
### Database
@@ -12,7 +15,7 @@
1215
- Use Laravel's query builder for very complex database operations.
1316

1417
### Model Creation
15-
- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, using `list-artisan-commands` to check the available options to `php artisan make:model`.
18+
- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, using `list-artisan-commands` to check the available options to `{{ $assist->artisanCommand('make:model') }}`.
1619

1720
### APIs & Eloquent Resources
1821
- For APIs, default to using Eloquent API Resources and API versioning unless existing API routes do not, then you should follow existing application convention.
@@ -36,7 +39,7 @@
3639
### Testing
3740
- When creating models for tests, use the factories for the models. Check if the factory has custom states that can be used before manually setting up the model.
3841
- Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`.
39-
- When creating tests, make use of `php artisan make:test [options] <name>` to create a feature test, and pass `--unit` to create a unit test. Most tests should be feature tests.
42+
- When creating tests, make use of `{{ $assist->artisanCommand('make:test [options] {name}') }}` to create a feature test, and pass `--unit` to create a unit test. Most tests should be feature tests.
4043

4144
### Vite Error
42-
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `{{ $assist->nodePackageManager() }} run build` or ask the user to run `{{ $assist->nodePackageManager() }} run dev` or `composer run dev`.
45+
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `{{ $assist->nodePackageManagerCommand('run build') }}` or ask the user to run `{{ $assist->nodePackageManagerCommand('run dev') }}` or `{{ $assist->composerCommand('run dev') }}`.

.ai/livewire/core.blade.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
@php
2+
/** @var \Laravel\Boost\Install\GuidelineAssist $assist */
3+
@endphp
14
## Livewire Core
25
- Use the `search-docs` tool to find exact version specific documentation for how to write Livewire & Livewire tests.
3-
- Use the `php artisan make:livewire [Posts\\CreatePost]` artisan command to create new components
6+
- Use the `{{ $assist->artisanCommand('make:livewire [Posts\\CreatePost]') }}` artisan command to create new components
47
- State should live on the server, with the UI reflecting it.
58
- All Livewire requests hit the Laravel backend, they're like regular HTTP requests. Always validate form data, and run authorization checks in Livewire actions.
69

.ai/pest/core.blade.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
## Pest
2-
2+
@php
3+
/** @var \Laravel\Boost\Install\GuidelineAssist $assist */
4+
@endphp
35
### Testing
46
- If you need to verify a feature is working, write or update a Unit / Feature test.
57

68
### Pest Tests
7-
- All tests must be written using Pest. Use `php artisan make:test --pest <name>`.
9+
- All tests must be written using Pest. Use `{{ $assist->artisanCommand('make:test --pest {name}') }}`.
810
- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files - these are core to the application.
911
- Tests should test all of the happy paths, failure paths, and weird paths.
1012
- Tests live in the `tests/Feature` and `tests/Unit` directories.
@@ -17,9 +19,9 @@
1719

1820
### Running Tests
1921
- Run the minimal number of tests using an appropriate filter before finalizing code edits.
20-
- To run all tests: `php artisan test`.
21-
- To run all tests in a file: `php artisan test tests/Feature/ExampleTest.php`.
22-
- To filter on a particular test name: `php artisan test --filter=testName` (recommended after making a change to a related file).
22+
- To run all tests: `{{ $assist->artisanCommand('test') }}`.
23+
- To run all tests in a file: `{{ $assist->artisanCommand('test tests/Feature/ExampleTest.php') }}`.
24+
- To filter on a particular test name: `{{ $assist->artisanCommand('test --filter=testName') }}` (recommended after making a change to a related file).
2325
- When the tests relating to your changes are passing, ask the user if they would like to run the entire test suite to ensure everything is still passing.
2426

2527
### Pest Assertions

.ai/phpunit/core.blade.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
@php
2+
/** @var \Laravel\Boost\Install\GuidelineAssist $assist */
3+
@endphp
14
## PHPUnit Core
25

3-
- This application uses PHPUnit for testing. All tests must be written as PHPUnit classes. Use `php artisan make:test --phpunit <name>` to create a new test.
6+
- This application uses PHPUnit for testing. All tests must be written as PHPUnit classes. Use `{{ $assist->artisanCommand('make:test --phpunit {name}') }}` to create a new test.
47
- If you see a test using "Pest", convert it to PHPUnit.
58
- Every time a test has been updated, run that singular test.
69
- When the tests relating to your feature are passing, ask the user if they would like to also run the entire test suite to make sure everything is still passing.
@@ -9,6 +12,6 @@
912

1013
### Running Tests
1114
- Run the minimal number of tests, using an appropriate filter, before finalizing.
12-
- To run all tests: `php artisan test`.
13-
- To run all tests in a file: `php artisan test tests/Feature/ExampleTest.php`.
14-
- To filter on a particular test name: `php artisan test --filter=testName` (recommended after making a change to a related file).
15+
- To run all tests: `{{ $assist->artisanCommand('test') }}`.
16+
- To run all tests in a file: `{{ $assist->artisanCommand('test tests/Feature/ExampleTest.php') }}`.
17+
- To filter on a particular test name: `{{ $assist->artisanCommand('test --filter=testName') }}` (recommended after making a change to a related file).

.ai/pint/core.blade.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
@php
2+
/** @var \Laravel\Boost\Install\GuidelineAssist $assist */
3+
@endphp
14
## Laravel Pint Code Formatter
25

3-
- You must run `vendor/bin/pint --dirty` before finalizing changes to ensure your code matches the project's expected style.
4-
- Do not run `vendor/bin/pint --test`, simply run `vendor/bin/pint` to fix any formatting issues.
6+
- You must run `{{ $assist->binCommand('pint') }} --dirty` before finalizing changes to ensure your code matches the project's expected style.
7+
- Do not run `{{ $assist->binCommand('pint') }} --test`, simply run `{{ $assist->binCommand('pint') }}` to fix any formatting issues.

.ai/sail/core.blade.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@php
2+
/** @var \Laravel\Boost\Install\GuidelineAssist $assist */
3+
@endphp
4+
## Laravel Sail
5+
6+
- This project runs inside Laravel Sail's Docker containers. You MUST execute all commands through Sail.
7+
- Start services using `{{ $assist->sailBinaryPath() }} up -d` and stop them with `{{ $assist->sailBinaryPath() }} stop`.
8+
- Open the application in the browser by running `{{ $assist->sailBinaryPath() }} open`.
9+
- Always prefix PHP, Artisan, Composer, and Node commands** with `{{ $assist->sailBinaryPath() }}`. Examples:
10+
- Run Artisan Commands: `{{ $assist->artisanCommand('migrate') }}`
11+
- Install Composer packages: `{{ $assist->composerCommand('install') }}`
12+
- Execute node commands: `{{ $assist->nodePackageManagerCommand('run dev') }}`
13+
- Execute PHP scripts: `{{ $assist->sailBinaryPath() }} php [script]`
14+
- View all available Sail commands by running `{{ $assist->sailBinaryPath() }}` without arguments.

0 commit comments

Comments
 (0)