fimo 0.16.0-staging.5 → 0.16.0-staging.7
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.
- package/assets/skills/fimo-cli/SKILL.md +1 -0
- package/assets/skills/fimo-cli/references/deploy.md +3 -0
- package/assets/skills/fimo-cli/references/hosting.md +114 -0
- package/assets/skills/fimo-studio/references/ai-chat.md +1 -1
- package/dist/cli/bundle.json +1 -1
- package/dist/cli/index.js +100 -95
- package/dist/runtime/templates.d.ts +19 -0
- package/dist/runtime/templates.js +33 -0
- package/package.json +1 -1
- package/templates/react-router/package.json +1 -1
|
@@ -85,6 +85,7 @@ Load the matching reference when the user's request fires its trigger. Recipes t
|
|
|
85
85
|
- "Enable locales / configure default locale / integrate an existing locale system" → `references/locales.md` **+ run `fimo skills get fimo-code --ref locales` and load the detected framework locale reference**
|
|
86
86
|
- "What's in this project / show the project structure / describe the project / what schemas does it have / how many routes / project tree / show me what's here" → `references/describe.md`
|
|
87
87
|
- "Deploy / publish / go live / push my changes" → `references/deploy.md`
|
|
88
|
+
- "Add a redirect / security headers / CSP / HSTS / clean URLs / trailing slash" → `references/hosting.md`
|
|
88
89
|
- "Get the preview URL / open the preview / what's the URL for this Branch / refresh the preview link / I just want to see the site / the preview URL stopped working" → `references/preview.md`
|
|
89
90
|
- "Schedule a command / cron / nightly publish / recurring checks / `fimo schedules`" → `references/schedules.md`
|
|
90
91
|
- "Set env vars / configure API keys / add project secrets / local `.env.local` / `fimo vars` / `fimo secrets`" → `references/project-vars-and-secrets.md`
|
|
@@ -60,6 +60,9 @@ needed, load the `fimo-code` skill's framework reference:
|
|
|
60
60
|
connector and the explicit catch-all used only by plain Vite `BrowserRouter`
|
|
61
61
|
SPAs; Astro's `fimo()` integration lives in `references/frameworks/astro.md`.
|
|
62
62
|
|
|
63
|
+
Redirects, response headers, and URL shape belong in
|
|
64
|
+
`.fimo/config.json#hosting` — see `references/hosting.md`.
|
|
65
|
+
|
|
63
66
|
## Warm the sandbox early in a session (optional)
|
|
64
67
|
|
|
65
68
|
This is a **performance optimization, only worth doing when you already know a deploy is coming** (the developer asked to publish, or you're confident they'll want a hosted preview soon). If you're just iterating locally, skip it — don't deploy pre-emptively. New-project onboarding never needs it: its automatic first preview deploy is the warm-up.
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# Hosting: how a published project is served
|
|
2
|
+
|
|
3
|
+
Declare redirects, headers, rewrites, and URL shape in
|
|
4
|
+
`.fimo/config.json#hosting`. This is the only place Fimo reads them from.
|
|
5
|
+
|
|
6
|
+
## Fields
|
|
7
|
+
|
|
8
|
+
```json
|
|
9
|
+
{
|
|
10
|
+
"hosting": {
|
|
11
|
+
"redirects": [{ "source": "/", "destination": "/fr", "permanent": false }],
|
|
12
|
+
"rewrites": [{ "source": "/blog/:slug", "destination": "/posts/:slug" }],
|
|
13
|
+
"headers": [
|
|
14
|
+
{
|
|
15
|
+
"source": "/(.*)",
|
|
16
|
+
"headers": [{ "key": "X-Frame-Options", "value": "DENY" }]
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"cleanUrls": true,
|
|
20
|
+
"trailingSlash": false
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
| Field | Effect |
|
|
26
|
+
| --------------- | ------------------------------------------------------------------- |
|
|
27
|
+
| `redirects` | Send the browser elsewhere. `permanent: true` is 308, otherwise 307 |
|
|
28
|
+
| ↳ `statusCode` | Use instead of `permanent` for an exact 301, 302, 307, or 308 |
|
|
29
|
+
| `rewrites` | Serve a different path without changing the URL |
|
|
30
|
+
| `headers` | Add response headers on matching paths |
|
|
31
|
+
| `cleanUrls` | Serve `/about` for `/about.html` and 308 the extension away |
|
|
32
|
+
| `trailingSlash` | `true` requires a trailing slash, `false` forbids one |
|
|
33
|
+
|
|
34
|
+
Every field is optional. Only what you declare is emitted.
|
|
35
|
+
|
|
36
|
+
## Matching
|
|
37
|
+
|
|
38
|
+
`source` matches the pathname only, never the query string.
|
|
39
|
+
|
|
40
|
+
| Pattern | Matches |
|
|
41
|
+
| --------------- | -------------------------------------- |
|
|
42
|
+
| `/about` | exactly that path |
|
|
43
|
+
| `/blog/:slug` | one segment, captured as `slug` |
|
|
44
|
+
| `/proxy/:rest*` | any number of segments, including none |
|
|
45
|
+
| `/(.*)` | everything |
|
|
46
|
+
|
|
47
|
+
Captured names are reusable in `destination`: `/blog/:slug` →
|
|
48
|
+
`/posts/:slug`. `destination` may be an absolute path or an external URL.
|
|
49
|
+
|
|
50
|
+
## Conditions
|
|
51
|
+
|
|
52
|
+
Any redirect, rewrite, or header rule can require more than a path match. `has`
|
|
53
|
+
applies the rule only when every condition holds; `missing` only when none of
|
|
54
|
+
them are present.
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"redirects": [
|
|
59
|
+
{
|
|
60
|
+
"source": "/(.*)",
|
|
61
|
+
"has": [{ "type": "header", "key": "x-vercel-ip-country", "value": "GB" }],
|
|
62
|
+
"destination": "/uk/:path*"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"rewrites": [
|
|
66
|
+
{
|
|
67
|
+
"source": "/",
|
|
68
|
+
"missing": [{ "type": "cookie", "key": "consent" }],
|
|
69
|
+
"destination": "/consent"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
| `type` | Matches on |
|
|
76
|
+
| -------- | ---------------------------------------------------- |
|
|
77
|
+
| `header` | a request header, including CDN-injected geo headers |
|
|
78
|
+
| `cookie` | a cookie |
|
|
79
|
+
| `query` | a query parameter |
|
|
80
|
+
| `host` | the hostname the request arrived on — takes no `key` |
|
|
81
|
+
|
|
82
|
+
Omit `value` to match on presence alone, as the `consent` cookie above does.
|
|
83
|
+
|
|
84
|
+
**Prefer doing this in the application when it can.** Middleware, a loader, or a
|
|
85
|
+
server component can be run and tested locally; a condition here only takes
|
|
86
|
+
effect once published, so a mistake is found in production. Reach for `has` when
|
|
87
|
+
the app cannot act — a redirect that must happen before any code runs, or a
|
|
88
|
+
header on a static asset.
|
|
89
|
+
|
|
90
|
+
## Rules
|
|
91
|
+
|
|
92
|
+
- **Prefer the framework's own router.** Use `hosting` for what the router
|
|
93
|
+
cannot express: cross-origin moves, security headers, host-level URL shape.
|
|
94
|
+
Do not mirror `.fimo/config.json#routes` here.
|
|
95
|
+
- **`permanent: true` is cached by browsers and hard to take back.** Omitting it
|
|
96
|
+
gives a temporary redirect, which is the one you can change your mind about.
|
|
97
|
+
Set it only when the old URL is genuinely retired. Reach for `statusCode` only
|
|
98
|
+
when you need a literal 301 or 302; it wins over `permanent`.
|
|
99
|
+
- **With `cleanUrls: true`, drop the extension everywhere.** A `source` or
|
|
100
|
+
`destination` of `/about.html` will not match; write `/about`.
|
|
101
|
+
- **Set `trailingSlash` on any site with more than one page.** Leaving it unset
|
|
102
|
+
serves `/about` and `/about/` as separate URLs, which search engines index as
|
|
103
|
+
duplicates.
|
|
104
|
+
- **An empty `hosting: {}` means no platform routing**, which is different from
|
|
105
|
+
omitting `hosting` entirely — that leaves legacy SPA behaviour untouched.
|
|
106
|
+
- **Not supported:** cron jobs (use `fimo schedules`), image optimization (use
|
|
107
|
+
Fimo media), per-function runtime settings, deployment regions.
|
|
108
|
+
|
|
109
|
+
## Verify
|
|
110
|
+
|
|
111
|
+
`fimo validate` rejects an unknown `hosting` key, so a typo fails locally
|
|
112
|
+
rather than silently doing nothing in production. Behaviour itself only takes
|
|
113
|
+
effect once published — check the live URL after `fimo deploy --publish`, not
|
|
114
|
+
the preview.
|
|
@@ -22,7 +22,7 @@ Give the AI more to work with:
|
|
|
22
22
|
- **+ button**: Opens a dropdown with options:
|
|
23
23
|
- **Attach Assets** -- browse your media library and attach files.
|
|
24
24
|
- **Attach Entries** -- attach CMS content for the AI to reference.
|
|
25
|
-
- **Upload from Computer** -- upload a
|
|
25
|
+
- **Upload from Computer** -- upload a file directly. ZIP archives are supported up to 20 MiB; the AI can download and inspect them under `/tmp` in its sandbox while the original stays attached to the conversation.
|
|
26
26
|
- **Draw** -- opens the drawing tool where you can sketch a wireframe or layout idea for the AI to follow.
|
|
27
27
|
- **@ mentions**: Type **@** in the chat to reference specific files, pages, or content inline.
|
|
28
28
|
|