Skip to content

Commit 6fb5a8b

Browse files
committed
feat: remove indentation removal from guidelinecomposer
1 parent 26a937d commit 6fb5a8b

File tree

7 files changed

+146
-202
lines changed

7 files changed

+146
-202
lines changed

.ai/inertia-laravel/2/core.blade.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515
## Inertia Forms Core
1616
@if($assist->inertia()->hasFormComponent())
17-
- The recommended way to build forms when using Inertia is with the `<Form>` component, a useful example is below. Use `search-docs` with the `form component` query for guidance.
18-
- Forms can also be built using the `useForm` helper for more programmatic control, or to follow existing conventions. Use `search-docs` with the `useForm helper` query for guidance.
19-
@if($assist->inertia()->hasFormComponentResets())
20-
- `resetOnError`, `resetOnSuccess`, and `setDefaultsOnSuccess` are available on the `<Form>` component. Use `search-docs` with 'form component resetting' for explicit guidance.
21-
@else
22-
- This version of Inertia does NOT support `resetOnError`, `resetOnSuccess`, or `setDefaultsOnSuccess` on the `<Form>` component. Using these will cause errors.
23-
@endif
17+
- The recommended way to build forms when using Inertia is with the `<Form>` component, a useful example is below. Use `search-docs` with the `form component` query for guidance.
18+
- Forms can also be built using the `useForm` helper for more programmatic control, or to follow existing conventions. Use `search-docs` with the `useForm helper` query for guidance.
19+
@if($assist->inertia()->hasFormComponentResets())
20+
- `resetOnError`, `resetOnSuccess`, and `setDefaultsOnSuccess` are available on the `<Form>` component. Use `search-docs` with 'form component resetting' for explicit guidance.
2421
@else
25-
- Build forms using the `useForm` helper. Use the code examples and `search-docs` tool with the `useForm helper` query for guidance.
22+
- This version of Inertia does NOT support `resetOnError`, `resetOnSuccess`, or `setDefaultsOnSuccess` on the `<Form>` component. Using these will cause errors.
23+
@endif
24+
@else
25+
- Build forms using the `useForm` helper. Use the code examples and `search-docs` tool with the `useForm helper` query for guidance.
2626
@endif

.ai/inertia-react/2/forms.blade.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,29 @@
3838

3939
@if($assist->inertia()->hasFormComponent() === false)
4040
{{-- Inertia 2.0.x, not 2.1.0 or higher. So they still need to use 'useForm' --}}
41-
@boostsnippet("Inertia React useForm example", "react")
42-
import { useForm } from '@inertiajs/react'
41+
@boostsnippet("Inertia React useForm example", "react")
42+
import { useForm } from '@inertiajs/react'
4343

44-
const { data, setData, post, processing, errors } = useForm({
45-
email: '',
46-
password: '',
47-
remember: false,
48-
})
44+
const { data, setData, post, processing, errors } = useForm({
45+
email: '',
46+
password: '',
47+
remember: false,
48+
})
4949

50-
function submit(e) {
51-
e.preventDefault()
52-
post('/login')
53-
}
50+
function submit(e) {
51+
e.preventDefault()
52+
post('/login')
53+
}
5454

55-
return (
56-
<form onSubmit={submit}>
57-
<input type="text" value={data.email} onChange={e => setData('email', e.target.value)} />
58-
{errors.email && <div>{errors.email}</div>}
59-
<input type="password" value={data.password} onChange={e => setData('password', e.target.value)} />
60-
{errors.password && <div>{errors.password}</div>}
61-
<input type="checkbox" checked={data.remember} onChange={e => setData('remember', e.target.checked)} /> Remember Me
62-
<button type="submit" disabled={processing}>Login</button>
63-
</form>
64-
)
65-
@endboostsnippet
55+
return (
56+
<form onSubmit={submit}>
57+
<input type="text" value={data.email} onChange={e => setData('email', e.target.value)} />
58+
{errors.email && <div>{errors.email}</div>}
59+
<input type="password" value={data.password} onChange={e => setData('password', e.target.value)} />
60+
{errors.password && <div>{errors.password}</div>}
61+
<input type="checkbox" checked={data.remember} onChange={e => setData('remember', e.target.checked)} /> Remember Me
62+
<button type="submit" disabled={processing}>Login</button>
63+
</form>
64+
)
65+
@endboostsnippet
6666
@endif

.ai/inertia-svelte/2/forms.blade.php

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,70 +4,70 @@
44
## Forms in Inertia
55
- There are critical differences between Svelte 4 and 5, use the `search-docs` tool for up-to-date guidance.
66
@if($assist->inertia()->hasFormComponent())
7-
@boostsnippet("Example form using the `<Form>` component", "svelte5")
8-
<Form action="/users" method="post">
9-
{#snippet children({
10-
errors,
11-
hasErrors,
12-
processing,
13-
progress,
14-
wasSuccessful,
15-
recentlySuccessful,
16-
setError,
17-
clearErrors,
18-
resetAndClearErrors,
19-
defaults,
20-
isDirty,
21-
reset,
22-
submit,
23-
})}
24-
<input type="text" name="name" />
7+
@boostsnippet("Example form using the `<Form>` component", "svelte5")
8+
<Form action="/users" method="post">
9+
{#snippet children({
10+
errors,
11+
hasErrors,
12+
processing,
13+
progress,
14+
wasSuccessful,
15+
recentlySuccessful,
16+
setError,
17+
clearErrors,
18+
resetAndClearErrors,
19+
defaults,
20+
isDirty,
21+
reset,
22+
submit,
23+
})}
24+
<input type="text" name="name" />
2525

26-
{#if errors.name}
27-
<div>{errors.name}</div>
28-
{/if}
26+
{#if errors.name}
27+
<div>{errors.name}</div>
28+
{/if}
2929

30-
<button type="submit" disabled={processing}>
31-
{processing ? 'Creating...' : 'Create User'}
32-
</button>
30+
<button type="submit" disabled={processing}>
31+
{processing ? 'Creating...' : 'Create User'}
32+
</button>
3333

34-
{#if wasSuccessful}
35-
<div>User created successfully!</div>
36-
{/if}
37-
{/snippet}
38-
</Form>
39-
@endboostsnippet
34+
{#if wasSuccessful}
35+
<div>User created successfully!</div>
36+
{/if}
37+
{/snippet}
38+
</Form>
39+
@endboostsnippet
4040
@endif
4141

4242
@if($assist->inertia()->hasFormComponent() === false)
43-
{{-- Inertia 2.0.x, not 2.1.0 or higher. So they still need to use 'useForm' --}}
44-
@boostsnippet("Inertia React useForm example", "svelte")
45-
<script>
46-
import { useForm } from '@inertiajs/svelte'
43+
{{-- Inertia 2.0.x, not 2.1.0 or higher. So they still need to use 'useForm' --}}
44+
@boostsnippet("Inertia React useForm example", "svelte")
45+
<script>
46+
import { useForm } from '@inertiajs/svelte'
4747
48-
const form = useForm({
49-
email: null,
50-
password: null,
51-
remember: false,
52-
})
48+
const form = useForm({
49+
email: null,
50+
password: null,
51+
remember: false,
52+
})
5353
54-
function submit(e) {
55-
e.preventDefault() /* Only required with Svelte 5 */
56-
$form.post('/login')
57-
}
58-
</script>
54+
function submit(e) {
55+
e.preventDefault() /* Only required with Svelte 5 */
56+
$form.post('/login')
57+
}
58+
</script>
5959

60-
<form onsubmit={submit}>
61-
<input type="text" bind:value={$form.email} />
62-
{#if $form.errors.email}
63-
<div class="form-error">{$form.errors.email}</div>
64-
{/if}
65-
<input type="password" bind:value={$form.password} />
66-
{#if $form.errors.password}
67-
<div class="form-error">{$form.errors.password}</div>
68-
{/if}
69-
<input type="checkbox" bind:checked={$form.remember} /> Remember Me
70-
<button type="submit" disabled={$form.processing}>Submit</button>
71-
</form>
72-
@endboostsnippet
60+
<form onsubmit={submit}>
61+
<input type="text" bind:value={$form.email} />
62+
{#if $form.errors.email}
63+
<div class="form-error">{$form.errors.email}</div>
64+
{/if}
65+
<input type="password" bind:value={$form.password} />
66+
{#if $form.errors.password}
67+
<div class="form-error">{$form.errors.password}</div>
68+
{/if}
69+
<input type="checkbox" bind:checked={$form.remember} /> Remember Me
70+
<button type="submit" disabled={$form.processing}>Submit</button>
71+
</form>
72+
@endboostsnippet
7373
@endif

.ai/inertia-vue/2/forms.blade.php

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4,67 +4,67 @@
44
## Forms in Inertia
55

66
@if($assist->inertia()->hasFormComponent())
7-
@boostsnippet("Example form using the `<Form>` component", "vue")
8-
<Form
9-
action="/users"
10-
method="post"
11-
#default="{
12-
errors,
13-
hasErrors,
14-
processing,
15-
progress,
16-
wasSuccessful,
17-
recentlySuccessful,
18-
setError,
19-
clearErrors,
20-
resetAndClearErrors,
21-
defaults,
22-
isDirty,
23-
reset,
24-
submit,
25-
}"
26-
>
27-
<input type="text" name="name" />
7+
@boostsnippet("Example form using the `<Form>` component", "vue")
8+
<Form
9+
action="/users"
10+
method="post"
11+
#default="{
12+
errors,
13+
hasErrors,
14+
processing,
15+
progress,
16+
wasSuccessful,
17+
recentlySuccessful,
18+
setError,
19+
clearErrors,
20+
resetAndClearErrors,
21+
defaults,
22+
isDirty,
23+
reset,
24+
submit,
25+
}"
26+
>
27+
<input type="text" name="name" />
2828

29-
<div v-if="errors.name">
30-
{{ errors.name }}
31-
</div>
29+
<div v-if="errors.name">
30+
{{ errors.name }}
31+
</div>
3232

33-
<button type="submit" :disabled="processing">
34-
{{ processing ? 'Creating...' : 'Create User' }}
35-
</button>
33+
<button type="submit" :disabled="processing">
34+
{{ processing ? 'Creating...' : 'Create User' }}
35+
</button>
3636

37-
<div v-if="wasSuccessful">User created successfully!</div>
38-
</Form>
39-
@endboostsnippet
37+
<div v-if="wasSuccessful">User created successfully!</div>
38+
</Form>
39+
@endboostsnippet
4040
@endif
4141

4242
@if($assist->inertia()->hasFormComponent() === false)
43-
{{-- Inertia 2.0.x, not 2.1.0 or higher. So they still need to use 'useForm' --}}
44-
@boostsnippet("Inertia React useForm example", "vue")
45-
<script setup>
46-
import { useForm } from '@inertiajs/vue3'
43+
{{-- Inertia 2.0.x, not 2.1.0 or higher. So they still need to use 'useForm' --}}
44+
@boostsnippet("Inertia React useForm example", "vue")
45+
<script setup>
46+
import { useForm } from '@inertiajs/vue3'
4747
48-
const form = useForm({
49-
email: null,
50-
password: null,
51-
remember: false,
52-
})
53-
</script>
48+
const form = useForm({
49+
email: null,
50+
password: null,
51+
remember: false,
52+
})
53+
</script>
5454

55-
<template>
56-
<form @submit.prevent="form.post('/login')">
57-
<!-- email -->
58-
<input type="text" v-model="form.email">
59-
<div v-if="form.errors.email">{{ form.errors.email }}</div>
60-
<!-- password -->
61-
<input type="password" v-model="form.password">
62-
<div v-if="form.errors.password">{{ form.errors.password }}</div>
63-
<!-- remember me -->
64-
<input type="checkbox" v-model="form.remember"> Remember Me
65-
<!-- submit -->
66-
<button type="submit" :disabled="form.processing">Login</button>
67-
</form>
68-
</template>
69-
@endboostsnippet
55+
<template>
56+
<form @submit.prevent="form.post('/login')">
57+
<!-- email -->
58+
<input type="text" v-model="form.email">
59+
<div v-if="form.errors.email">{{ form.errors.email }}</div>
60+
<!-- password -->
61+
<input type="password" v-model="form.password">
62+
<div v-if="form.errors.password">{{ form.errors.password }}</div>
63+
<!-- remember me -->
64+
<input type="checkbox" v-model="form.remember"> Remember Me
65+
<!-- submit -->
66+
<button type="submit" :disabled="form.processing">Login</button>
67+
</form>
68+
</template>
69+
@endboostsnippet
7070
@endif

.ai/phpunit/core.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99

1010
### Running Tests
1111
- 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).
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).

src/Install/GuidelineComposer.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,9 @@ public function compose(): string
5050
*/
5151
public static function composeGuidelines(Collection $guidelines): string
5252
{
53-
// We want to allow indentation in the guideline blade files
54-
// But we don't want the indentation in the outputted file
55-
5653
return str_replace("\n\n\n\n", "\n\n", trim($guidelines
5754
->filter(fn ($content) => ! empty(trim($content)))
58-
->map(function ($content, $key) {
59-
// Remove preceding indentation from `- guidelines`
60-
$content = collect(explode("\n", trim($content)))
61-
->map(fn ($line) => preg_replace('/\s+-/', '-', $line))
62-
->join("\n");
63-
64-
return "\n=== {$key} rules ===\n\n".trim($content);
65-
})
55+
->map(fn ($content, $key) => "\n=== {$key} rules ===\n\n".trim($content))
6656
->join("\n\n")));
6757
}
6858

0 commit comments

Comments
 (0)