@netlify/agent-runner-cli 1.66.0-alpha.1 → 1.67.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,306 +0,0 @@
1
- ---
2
- name: netlify-forms
3
- description:
4
- Build and configure Netlify Forms for serverless form handling. Use when implementing contact forms, feedback forms,
5
- file uploads, or any form that collects user submissions without backend code.
6
- ---
7
-
8
- # Netlify Forms
9
-
10
- Netlify Forms is a serverless form-handling service. The build system parses HTML at deploy time to detect forms and
11
- automatically creates submission endpoints.
12
-
13
- ## Quick Start
14
-
15
- Add `data-netlify="true"` or `netlify` attribute to any `<form>` tag:
16
-
17
- ```html
18
- <form name="contact" method="POST" data-netlify="true">
19
- <input type="text" name="name" required />
20
- <input type="email" name="email" required />
21
- <textarea name="message"></textarea>
22
- <button type="submit">Send</button>
23
- </form>
24
- ```
25
-
26
- **Key requirements:**
27
-
28
- - The `name` attribute identifies the form in Netlify UI (must be unique per site)
29
- - Method must be `POST`
30
- - Netlify injects a hidden `form-name` field during build
31
-
32
- ## AJAX / JavaScript Submission
33
-
34
- Submit forms without page reload:
35
-
36
- ```javascript
37
- const form = document.getElementById('contact-form')
38
-
39
- form.addEventListener('submit', async (e) => {
40
- e.preventDefault()
41
-
42
- const response = await fetch('/', {
43
- method: 'POST',
44
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
45
- body: new URLSearchParams(new FormData(form)).toString(),
46
- })
47
-
48
- if (response.ok) {
49
- // Handle success
50
- }
51
- })
52
- ```
53
-
54
- **Critical AJAX requirements:**
55
-
56
- 1. Content-Type MUST be `application/x-www-form-urlencoded`
57
- 2. Include hidden `form-name` field in your HTML:
58
- ```html
59
- <input type="hidden" name="form-name" value="contact" />
60
- ```
61
-
62
- ## JavaScript Frameworks (React, Vue, Next.js)
63
-
64
- Netlify's build bot cannot detect forms rendered client-side. You MUST create a static HTML version.
65
-
66
- ### Next.js Runtime v5
67
-
68
- If using Netlify Forms with Next.js Runtime v5, you **must**:
69
-
70
- 1. Extract form definitions to a dedicated static HTML file (e.g., `public/__forms.html`)
71
- 2. Submit forms using AJAX — full-page navigation won't work
72
-
73
- ### Solution: Hidden HTML Skeleton
74
-
75
- Create `public/__forms.html` (or include in your static HTML):
76
-
77
- ```html
78
- <!-- This file is only for Netlify's build bot detection -->
79
- <form name="contact" netlify hidden>
80
- <input name="name" />
81
- <input name="email" />
82
- <textarea name="message"></textarea>
83
- </form>
84
- ```
85
-
86
- ### React Example
87
-
88
- ```jsx
89
- function ContactForm() {
90
- const handleSubmit = async (e) => {
91
- e.preventDefault()
92
- const formData = new FormData(e.target)
93
-
94
- await fetch('/', {
95
- method: 'POST',
96
- headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
97
- body: new URLSearchParams(formData).toString(),
98
- })
99
- }
100
-
101
- return (
102
- <form name="contact" method="POST" onSubmit={handleSubmit}>
103
- {/* Hidden field required for AJAX */}
104
- <input type="hidden" name="form-name" value="contact" />
105
- <input name="name" required />
106
- <input name="email" type="email" required />
107
- <textarea name="message" />
108
- <button type="submit">Send</button>
109
- </form>
110
- )
111
- }
112
- ```
113
-
114
- ## File Uploads
115
-
116
- ```html
117
- <form name="upload" method="POST" data-netlify="true" enctype="multipart/form-data">
118
- <input type="file" name="attachment" />
119
- <button type="submit">Upload</button>
120
- </form>
121
- ```
122
-
123
- **Limits:**
124
-
125
- - Maximum request size: **8 MB**
126
- - Timeout: **30 seconds**
127
- - One file per input field (use multiple inputs for multiple files)
128
-
129
- **Security:** For file uploads containing PII (personally identifiable information), use the
130
- [Very Good Security (VGS)](https://www.netlify.com/integrations/very-good-security/) integration for additional
131
- protection.
132
-
133
- **AJAX file uploads:** Do NOT set Content-Type header - let browser set `multipart/form-data` with boundary:
134
-
135
- ```javascript
136
- // Correct - no Content-Type header
137
- fetch('/', {
138
- method: 'POST',
139
- body: new FormData(form), // Browser sets correct Content-Type
140
- })
141
- ```
142
-
143
- ## Spam Protection
144
-
145
- ### Honeypot Field (Recommended)
146
-
147
- ```html
148
- <form name="contact" method="POST" data-netlify="true" netlify-honeypot="bot-field">
149
- <!-- Hidden from humans, filled by bots -->
150
- <p style="display:none">
151
- <label>Don't fill this: <input name="bot-field" /></label>
152
- </p>
153
-
154
- <!-- Visible fields -->
155
- <input name="name" required />
156
- <button type="submit">Send</button>
157
- </form>
158
- ```
159
-
160
- ### reCAPTCHA v2 (Netlify-provided)
161
-
162
- ```html
163
- <form name="contact" method="POST" data-netlify="true" data-netlify-recaptcha="true">
164
- <input name="name" required />
165
-
166
- <!-- Netlify injects reCAPTCHA here -->
167
- <div data-netlify-recaptcha="true"></div>
168
-
169
- <button type="submit">Send</button>
170
- </form>
171
- ```
172
-
173
- Only one Netlify-provided reCAPTCHA per page. For multiple CAPTCHAs on one page, use custom reCAPTCHA.
174
-
175
- ### Custom reCAPTCHA v2
176
-
177
- Use your own reCAPTCHA 2 code with Netlify validation:
178
-
179
- 1. Sign up for a [reCAPTCHA API key pair](http://www.google.com/recaptcha/admin) and add the reCAPTCHA script/widget to
180
- your form.
181
- 2. Set environment variables in Netlify (UI, CLI, or API):
182
- - `SITE_RECAPTCHA_KEY` — your reCAPTCHA site key (scopes: Builds + Runtime)
183
- - `SITE_RECAPTCHA_SECRET` — your reCAPTCHA secret key (scope: Runtime)
184
- 3. Add `data-netlify-recaptcha="true"` to your `<form>` tag.
185
-
186
- Netlify validates the `g-recaptcha-response` server-side on each submission.
187
-
188
- **For AJAX with reCAPTCHA:** Include `g-recaptcha-response` in POST body (automatic if using `FormData()`).
189
-
190
- ## Success Redirects
191
-
192
- ```html
193
- <!-- Redirect to custom thank-you page -->
194
- <form name="contact" method="POST" data-netlify="true" action="/thank-you"></form>
195
- ```
196
-
197
- The `action` path must:
198
-
199
- - Start with `/`
200
- - Be relative to site root
201
- - Point to an existing page
202
-
203
- ## Notifications
204
-
205
- ### Email Notifications
206
-
207
- Configure in Netlify UI: **Project configuration > Notifications > Emails and webhooks > Form submission notifications**
208
-
209
- - Include `<input name="email">` to set reply-to address automatically
210
- - Custom subject line:
211
- ```html
212
- <input type="hidden" name="subject" value="New inquiry from %{formName}" />
213
- ```
214
- - Available variables: `%{formName}`, `%{siteName}`, `%{submissionId}`
215
- - For forms created before May 5, 2023: remove `[Netlify]` prefix from subject by adding `data-remove-prefix`:
216
- ```html
217
- <input type="hidden" name="subject" data-remove-prefix value="Sales inquiry" />
218
- ```
219
-
220
- ### Webhooks
221
-
222
- Configure in Netlify UI: **Project configuration > Notifications > Emails and webhooks > Form submission notifications**
223
-
224
- Sends JSON payload on each verified submission.
225
-
226
- ## Function Triggers
227
-
228
- Trigger serverless functions on submissions:
229
-
230
- ```typescript
231
- // netlify/functions/submission-created.mts
232
- import type { Context } from '@netlify/functions'
233
-
234
- interface FormPayload {
235
- form_name: string
236
- data: Record<string, string>
237
- created_at: string
238
- }
239
-
240
- export default async (req: Request, context: Context) => {
241
- const { payload } = (await req.json()) as { payload: FormPayload }
242
-
243
- console.log('Form:', payload.form_name)
244
- console.log('Data:', payload.data)
245
-
246
- // Process submission (send to CRM, Slack, etc.)
247
-
248
- return new Response('OK')
249
- }
250
- ```
251
-
252
- **Event name:** `submission-created` (filename must match)
253
-
254
- ## Limits
255
-
256
- | Feature | Free Tier | Paid Tier |
257
- | ------------ | ----------- | ---------- |
258
- | Submissions | 100/month | Metered |
259
- | File Storage | 10 MB/month | Scalable |
260
- | Request Size | 8 MB | 8 MB |
261
- | Timeout | 30 seconds | 30 seconds |
262
-
263
- ## Common Errors & Solutions
264
-
265
- ### "404 on submit"
266
-
267
- **Cause:** Build bot didn't detect the form. **Fix:**
268
-
269
- 1. Ensure static HTML version exists for JS frameworks
270
- 2. Verify `form-name` hidden input is present
271
- 3. Check form has `name` attribute
272
-
273
- ### Submissions not appearing
274
-
275
- **Check:**
276
-
277
- 1. Look in **Spam** folder in Netlify UI (Akismet filtering)
278
- 2. Avoid test values like "test@test.com" or "asdf" — use real email and full sentences
279
- 3. Verify form was included in the latest deploy
280
-
281
- ### AJAX submission fails silently
282
-
283
- **Ensure:**
284
-
285
- 1. Content-Type is `application/x-www-form-urlencoded` (not JSON)
286
- 2. `form-name` field is included in body
287
- 3. Check browser Network tab for actual response
288
-
289
- ### File upload fails
290
-
291
- **Check:**
292
-
293
- 1. Total request size under 8 MB
294
- 2. Not setting Content-Type header manually
295
- 3. Using `enctype="multipart/form-data"` on form
296
-
297
- ## API Access
298
-
299
- List submissions programmatically:
300
-
301
- ```bash
302
- curl -H "Authorization: Bearer $NETLIFY_AUTH_TOKEN" \
303
- https://api.netlify.com/api/v1/forms/{form_id}/submissions
304
- ```
305
-
306
- Export available as CSV from Netlify UI.