fimo 2.11.0-staging.2 → 2.11.0-staging.4

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.
Files changed (40) hide show
  1. package/assets/skills/fimo-cli/references/content.md +1 -0
  2. package/assets/skills/fimo-cli/references/media.md +9 -1
  3. package/assets/skills/fimo-code/references/best-practices/next.md +1 -1
  4. package/assets/skills/fimo-code/references/content/schema.md +5 -1
  5. package/assets/skills/fimo-code/references/forms.md +2 -3
  6. package/assets/skills/fimo-code/references/frameworks/next/app-router.md +4 -1
  7. package/assets/skills/fimo-code/references/frameworks/next/pages-router.md +2 -0
  8. package/assets/skills/fimo-code/references/frameworks/next/seo.md +2 -2
  9. package/assets/skills/fimo-code/references/frameworks/next.md +3 -1
  10. package/assets/skills/fimo-code/references/frameworks/react-router.md +1 -1
  11. package/assets/skills/fimo-code/references/frameworks/seo-head.md +5 -0
  12. package/assets/skills/fimo-code/references/frameworks/sveltekit.md +3 -1
  13. package/assets/skills/fimo-code/references/frameworks/vite-react.md +1 -1
  14. package/assets/skills/fimo-studio/references/ai-chat/agents.md +3 -1
  15. package/assets/skills/fimo-studio/references/ai-chat/default-agents.md +2 -2
  16. package/assets/skills/fimo-studio/references/ai-chat/routines.md +1 -1
  17. package/dist/build/vite/plugins/runtime-env.d.ts +0 -19
  18. package/dist/build/vite/plugins/runtime-env.js +23 -1
  19. package/dist/cli/bundle.json +1 -1
  20. package/dist/cli/index.js +7 -7
  21. package/dist/runtime/seo/resolver.d.ts +9 -1
  22. package/dist/runtime/seo/resolver.js +16 -2
  23. package/dist/runtime/seo/schemas.d.ts +1 -1
  24. package/dist/runtime/seo/schemas.js +6 -4
  25. package/dist/runtime/seo/server.js +3 -2
  26. package/dist/scripts/sync-schemas.js +1 -0
  27. package/dist/scripts/validate-schemas.js +8 -1
  28. package/package.json +9 -9
  29. package/templates/astro/package.json +3 -3
  30. package/templates/nextjs/package.json +4 -4
  31. package/templates/nextjs/src/app/globals.css +1 -7
  32. package/templates/react-router/.fimo/config.json +0 -3
  33. package/templates/react-router/package.json +5 -5
  34. package/templates/react-router/src/index.css +1 -8
  35. package/templates/react-router/vite.config.ts +1 -1
  36. package/templates/sveltekit/package.json +3 -3
  37. package/templates/vite/.fimo/config.json +0 -3
  38. package/templates/vite/package.json +5 -5
  39. package/templates/vite/src/index.css +1 -7
  40. package/templates/react-router/public/robots.txt +0 -4
@@ -30,6 +30,7 @@ fimo singles get <Type> [--locale es]
30
30
  fimo singles update <Type> [--locale es] (--body '<json>' | --file <path> | --stdin)
31
31
  ```
32
32
 
33
+ - Before you write content of a type, read `fimo schemas get <Type>`. The `description` of the schema and of each field are the rules for that content: make what you write meet them.
33
34
  - `--body` is always a `{"data":{...}}` envelope, also for `singles update`. Put `slug` inside `data`.
34
35
  - `entries create` and `entries update` require exactly one of `--body '<json>'`, `--file <path>`, or `--stdin`. Files and stdin use the same `{"data":{...}}` envelope.
35
36
  - Before you write a body, load fimo-code `content/richtext`. Rich text is Tiptap JSON (`{"type":"doc","content":[...]}`), a reference is `{"id":"<id>"}`, and media has its own shape.
@@ -69,7 +69,15 @@ fimo image edit \
69
69
  --aspect-ratio 16:9
70
70
  ```
71
71
 
72
- Repeat `--images` to provide up to five references.
72
+ Repeat `--images` to provide up to five references. To make a new image that matches the ones a content field already holds, pass two or three of them and say what to draw:
73
+
74
+ ```bash
75
+ fimo image edit \
76
+ --prompt "a new cover in exactly the style of these images: a lighthouse at night" \
77
+ --images <asset-id-or-url> \
78
+ --images <asset-id-or-url> \
79
+ --aspect-ratio 16:9
80
+ ```
73
81
 
74
82
  ### Remove a background
75
83
 
@@ -12,8 +12,8 @@ Load `references/frameworks/next.md` and the matching router reference first. In
12
12
  ## Instant Navigations
13
13
 
14
14
  ```ts
15
- import type { NextConfig } from 'next';
16
15
  import { withFimo } from 'fimo-next/config';
16
+ import type { NextConfig } from 'next';
17
17
 
18
18
  const nextConfig: NextConfig = {
19
19
  cacheComponents: true,
@@ -36,6 +36,10 @@ Design schemas around what content editors need to see and change in Fimo Studio
36
36
 
37
37
  Keep routing, layout, computed values, and external system data in code. Load `fimo-cli/references/content.md` for the Single and collection write workflows.
38
38
 
39
+ ## Rules for this content
40
+
41
+ Use `description`, at the root for the whole type or on a field, to say what good content looks like. Fimo agents follow it when they write or generate that content, and Studio shows it to editors. A site-wide rule belongs in the project knowledge.
42
+
39
43
  ## Group fields in Studio
40
44
 
41
45
  Use optional top-level `groups` when an entry has meaningful editing areas, such as Overview, Tickets, SEO, or Scheduling. They work best for longer forms where editors regularly work on one area at a time. Usually skip groups for short forms, one-field groups, or vague buckets such as General and Other. Prefer two to five groups organized around editor tasks. This is guidance, not a schema limit.
@@ -155,7 +159,7 @@ Use `targets: ["Post", "Video"]` instead of `target` only for genuinely polymorp
155
159
 
156
160
  After writing or changing `src/schemas/<Uid>.json`, run `fimo schemas push <Uid>` before building against that schema. The push validates the JSON, generates its public clients, and updates the linked environment.
157
161
 
158
- - Optional additions and label changes preserve entries.
162
+ - Optional additions and label or `description` changes preserve entries.
159
163
  - Required additions need a valid default when existing objects require backfill.
160
164
  - Removing a field or block variant removes only that value.
161
165
  - String/text changes and safe primitive conversions preserve values.
@@ -47,9 +47,7 @@ After `fimo forms push` and the next validation/build, `src/forms/{name}.ts` exi
47
47
 
48
48
  ```ts
49
49
  export const FORM_ID = '<uuid>';
50
- export const ContactUsSchema = z.object({
51
- /* fields */
52
- });
50
+ export const ContactUsSchema = z.object({/* fields */});
53
51
  export type ContactUsData = z.infer<typeof ContactUsSchema>;
54
52
  export function parseContactUsFormData(formData: FormData): ContactUsData;
55
53
  export function submitContactUs(
@@ -72,6 +70,7 @@ Always import the generated module. Keep the native form and pending/error state
72
70
 
73
71
  ```tsx
74
72
  import { useState } from 'react';
73
+
75
74
  import { ContactUsSchema, parseContactUsFormData, submitContactUs } from '@/forms/contact-us';
76
75
  import type { ContactUsData } from '@/forms/contact-us';
77
76
 
@@ -31,6 +31,7 @@ Server Components may read generated clients directly. Omit `locale` to use the
31
31
 
32
32
  ```tsx
33
33
  import { createFimo, RichText, Text } from 'fimo-next';
34
+
34
35
  import { content } from '@/schemas';
35
36
 
36
37
  export const revalidate = 60;
@@ -57,8 +58,9 @@ Static builds read Fimo through the same server connection (linked project + bra
57
58
  Use normal Next request APIs and pass the resulting locale/query values to Fimo:
58
59
 
59
60
  ```tsx
60
- import { headers } from 'next/headers';
61
61
  import { createFimo, Text } from 'fimo-next';
62
+ import { headers } from 'next/headers';
63
+
62
64
  import { content } from '@/schemas';
63
65
 
64
66
  export const dynamic = 'force-dynamic';
@@ -87,6 +89,7 @@ Client Components use the generated `.client` module and `fimo-next/client`:
87
89
  'use client';
88
90
 
89
91
  import { Text, useLabels } from 'fimo-next/client';
92
+
90
93
  import * as Article from '@/schemas/Article.client';
91
94
 
92
95
  export function FeaturedArticles() {
@@ -63,6 +63,7 @@ export default function Page({ article: serialized }: InferGetStaticPropsType<ty
63
63
  ```tsx
64
64
  import { getLabels } from 'fimo-next';
65
65
  import type { GetServerSideProps, InferGetServerSidePropsType } from 'next';
66
+
66
67
  import * as Article from '@/schemas/Article';
67
68
  import * as ArticleClient from '@/schemas/Article.client';
68
69
 
@@ -87,6 +88,7 @@ Interactive components import hooks and primitives from the client surfaces:
87
88
 
88
89
  ```tsx
89
90
  import { Text, useLabels } from 'fimo-next/client';
91
+
90
92
  import * as Article from '@/schemas/Article.client';
91
93
 
92
94
  export function SearchResults() {
@@ -6,8 +6,8 @@ rendering mode. Fimo supplies editable values, not a router or a merge policy.
6
6
  ## Read, resolve, convert
7
7
 
8
8
  ```ts
9
- import { getFimoSeo } from 'fimo/seo/server';
10
9
  import { toNextMetadata, toNextViewport } from 'fimo-next/seo';
10
+ import { getFimoSeo } from 'fimo/seo/server';
11
11
 
12
12
  // Root layout: global defaults, never implicitly Home.
13
13
  export const generateMetadata = () => toNextMetadata(getFimoSeo());
@@ -60,8 +60,8 @@ For bundled data or Edge, supply config yourself to the pure resolver instead
60
60
  of importing the Node reader:
61
61
 
62
62
  ```ts
63
- import { resolveSeoForPath } from 'fimo/seo';
64
63
  import { toNextMetadata } from 'fimo-next/seo';
64
+ import { resolveSeoForPath } from 'fimo/seo';
65
65
 
66
66
  const seo = resolveSeoForPath(pathname, publicSeoConfig, { article });
67
67
  const metadata = toNextMetadata(seo);
@@ -50,8 +50,8 @@ Keep the generated `FimoProvider` and `withFimo` integration to render Fimo
50
50
  Preview in Fimo Studio and enable Edit Mode. Wrap the existing Next config once:
51
51
 
52
52
  ```ts
53
- import type { NextConfig } from 'next';
54
53
  import { withFimo } from 'fimo-next/config';
54
+ import type { NextConfig } from 'next';
55
55
 
56
56
  const nextConfig: NextConfig = {};
57
57
  export default withFimo(nextConfig);
@@ -124,6 +124,7 @@ Server Components, route handlers, `getStaticProps`, and `getServerSideProps` im
124
124
 
125
125
  ```ts
126
126
  import { createFimo, getLabels, Text } from 'fimo-next';
127
+
127
128
  import { content } from '@/schemas';
128
129
 
129
130
  const fimo = createFimo({ content, locale });
@@ -139,6 +140,7 @@ Client Components import from `fimo-next/client` and generated `.client` modules
139
140
  'use client';
140
141
 
141
142
  import { Text, useLabels } from 'fimo-next/client';
143
+
142
144
  import * as Article from '@/schemas/Article.client';
143
145
 
144
146
  export function ArticleList() {
@@ -21,8 +21,8 @@ Keep the project's React Router Vite plugin explicit:
21
21
 
22
22
  ```ts
23
23
  import { reactRouter } from '@react-router/dev/vite';
24
- import { defineConfig } from 'vite';
25
24
  import { fimo } from 'fimo-react-router/vite';
25
+ import { defineConfig } from 'vite';
26
26
 
27
27
  export default defineConfig({
28
28
  plugins: [reactRouter(), fimo({ sitemap: true })],
@@ -6,6 +6,7 @@ sets framework caching. Use the installed package's exports.
6
6
 
7
7
  ```ts
8
8
  import { resolveSeoForPath, toSeoHead, type FimoSEO } from 'fimo/seo';
9
+
9
10
  import config from '../../.fimo/config.json'; // adjust to the actual file
10
11
 
11
12
  const resolved = resolveSeoForPath(pathname, config, { article });
@@ -52,6 +53,10 @@ explicit `undefined` in a spread removes a field; use conditional spreads to
52
53
  retain defaults for missing optional overrides. Resolve once, then compose;
53
54
  do not resolve again after applying policy.
54
55
 
56
+ A resolved `seo.url` is the site's address: the platform's `FIMO_SITE_URL` when
57
+ set, otherwise the value in `.fimo/config.json` for local and self-hosted builds.
58
+ Read it from the resolved SEO, not from the imported config.
59
+
55
60
  Pass a final absolute canonical URL from the app's production URL policy.
56
61
  `new URL(pathname, seo.url).href` fits a root-hosted starter; preserve existing
57
62
  base paths, domains, trailing slashes and query policy in other apps. Never use
@@ -59,6 +59,7 @@ SvelteKit's request-aware `fetch`:
59
59
  ```ts
60
60
  // src/routes/articles/+page.server.ts
61
61
  import { createFimo } from 'fimo-sveltekit';
62
+
62
63
  import { content } from '../../../schemas';
63
64
 
64
65
  export async function load(event) {
@@ -122,6 +123,7 @@ overrides, and returns its complete `seoHead` using `toSeoHead`.
122
123
  ```ts
123
124
  // src/routes/+layout.server.ts, or a content page's +page.server.ts
124
125
  import { resolveSeoForPath, toSeoHead } from 'fimo/seo';
126
+
125
127
  import config from '../../.fimo/config.json';
126
128
 
127
129
  export function load({ url }) {
@@ -176,8 +178,8 @@ Use a `+page.server` action so SvelteKit owns the request and redirect. Pass its
176
178
  event to `createFimoFormClient` and use the generated parser/helper:
177
179
 
178
180
  ```ts
179
- import { createFimoFormClient } from 'fimo-sveltekit';
180
181
  import { parseContactUsFormData, submitContactUs } from '$lib/forms/contact-us';
182
+ import { createFimoFormClient } from 'fimo-sveltekit';
181
183
 
182
184
  export const actions = {
183
185
  default: async (event) => {
@@ -13,8 +13,8 @@ Add Fimo's Vite plugins without replacing the application's existing plugins:
13
13
 
14
14
  ```ts
15
15
  import react from '@vitejs/plugin-react';
16
- import { defineConfig } from 'vite';
17
16
  import { fimo } from 'fimo-react-router/vite';
17
+ import { defineConfig } from 'vite';
18
18
 
19
19
  export default defineConfig({
20
20
  plugins: [react(), ...fimo({ seo: true })],
@@ -23,12 +23,14 @@ An agent is a chat with a job: a name, a one-line summary for people, and instru
23
23
 
24
24
  Until then, only its creator sees it (**New agent**, **Setting up…**), its routines do not run, and its chat changes nothing on the site: it reads the site, its data and the web, with no CLI, files, work sessions or publish. It goes live only after the person saw its latest draft. When the person names no exact time for a routine, Fimo keeps the hour and picks the minute. Anyone can set up a draft; below Pro, **Create agent** opens the plans.
25
25
 
26
+ A chat can also create an agent on Pro, live at once, when a person asks for one or says yes to an offer that names a new one.
27
+
26
28
  ## Use and change an agent
27
29
 
28
30
  - In an agent, the header shows its name alone and the message box reads **Message <name>**. An empty default agent greets in its own words and offers starter requests; its description stays in its settings. A starter is sent as shown, by anyone who can send messages.
29
31
  - Ask the agent to change its instructions; it uses its `agent` tool, and the chat shows **Updated instructions** with **View change** (before and after).
30
32
  - The agent's settings have **Summary** and **Instructions** (shared with everyone; empty means none) and an **Instruction history**, where **Restore previous** puts back the text a change replaced.
31
- - A default agent is Fimo's: its name, summary, instructions and portrait cannot change on any plan. Its routines can be switched off and on, or deleted (a deleted one stays deleted); nothing is added to it (`routine_is_default`). Routines of your own live in an agent of your own, on Pro (`routine_needs_pro`). A routine Fimo retires stops running and leaves the list.
33
+ - A default agent is Fimo's: its name, summary, instructions and portrait cannot change on any plan. Fimo's routines on it can be switched off and on, or deleted (a deleted one stays deleted), but not changed (`routine_is_default`). On Pro, the team can add routines of its own to a default agent or to an agent of its own (`routine_needs_pro` below Pro); any chat can create one on the agent whose work it is. A routine Fimo retires stops running and leaves the list.
32
34
  - In text, an agent links another as `[Name](agent://id)`, shown as a chip that opens it.
33
35
 
34
36
  ## Default agents
@@ -11,7 +11,7 @@ Plans, setup and the rules every default agent follows are in `ai-chat/agents`.
11
11
  - **Hreflang:** on a site in more than one language, each version lists the others.
12
12
  - **Internal linking:** orphan pages, pages more than three clicks deep, and articles with no link to a hub or product page or more than eight links. Runs on changes and every Monday.
13
13
  - **Keyword optimization** (every Tuesday, needs Search Console): for pages ranking 8th to 20th it writes a title and headings from the searches that bring visitors, keeps the old words, and checks 8 weeks later whether they helped; on a clear loss it puts the old words back.
14
- - **Keyword research** (2nd of each month): writes at most five briefs to the site knowledge and asks which to write; the Content agent's Writing routine writes the approved ones.
14
+ - **Keyword research** (2nd of each month): proposes at most five pages and asks which to write; the Content agent's Writing routine writes the ones picked.
15
15
 
16
16
  The Monday runs of Technical SEO, Meta tags and Internal linking read every page of main's hosted preview, for what no single change shows (pages out of the sitemap, shared titles, title shape, orphan and deep pages). A run that a change started checks only the pages it touches, its first run too.
17
17
 
@@ -32,7 +32,7 @@ Alone, it writes a missing llms.txt and keeps its lines in step with the pages a
32
32
  - **Content lifecycle** (new content pages, and every three months): thin pages, pages that repeat another, and pages nothing links to that are also thin or out of date.
33
33
  - **Translation:** CMS entries missing in a locale, or older than their source. On a one-language site it stops at once.
34
34
  - **Editable copy:** off until someone switches it on, or runs once with **Run now**. It moves words typed in the code into labels, and lists into the CMS.
35
- - **Competitors** (1 January, April, July, October) and **Writing** (Fridays, and when a brief is approved: it writes the page in a work session and asks for review; it never publishes).
35
+ - **Competitors** (1 January, April, July, October) and **Writing** (when a person picks a page or asks for one: it writes the page in a work session and asks for review; it never publishes).
36
36
 
37
37
  Alone, it translates missing entries only for a type the team already keeps in that locale, and outdated entries, in the site's tone, keeping slugs, dates, numbers, references and media. A new locale or type, a price and a legal page are translated only after a person agreed. It renders a copyright year from the date when the year is typed in the code of one component or layout; a year in a CMS entry or in several places is proposed. Any other sentence a visitor reads is asked, quoting the exact words. Merging, redirecting or retiring a page is only proposed.
38
38
 
@@ -4,7 +4,7 @@ A routine is saved instructions that an agent runs in a thread of its own: by ha
4
4
 
5
5
  ## Create and change
6
6
 
7
- The agent creates, changes, runs and deletes its routines with its `routines` tool. A person asks in the agent's chat ("check the prices every Monday", "run after each publish", "pause the link sweep"). Studio only shows routines. Routines of your own need an agent of your own on Pro; a default routine can only be switched off and on, or deleted.
7
+ Any chat, an agent's or a regular one, creates, changes, runs and deletes the project's routines with its `routines` tool. A person asks in any chat ("check the prices every Monday", "run after each publish", "pause the link sweep"), and the routine goes on the agent whose job it is. Studio only shows routines. Routines of your own need Pro; a default routine can only be switched off and on, or deleted.
8
8
 
9
9
  ## Triggers
10
10
 
@@ -1,22 +1,3 @@
1
1
  import type { Plugin } from 'vite';
2
- /**
3
- * Point the app at the Fimo env of the current git branch.
4
- *
5
- * One rule, per variable: anything already set — by the process env (sandbox,
6
- * shell) or the user's own `.env*` files, read through Vite's `loadEnv` — is
7
- * left alone; derivation fills only what is missing. A value a user wrote by
8
- * hand is an override, and this plugin must never win over it. Empty or
9
- * `undefined` `define` placeholders generated from a missing env are not values.
10
- *
11
- * Two injection paths, both needed:
12
- * - `process.env`, so Vite's own `VITE_*` exposure, `loadEnv`, and server-side
13
- * code (`getFimoPaths`, SSR) all see the value.
14
- * - `define` for the public runtime keys, explicit or derived. Fimo's own
15
- * template `define`s two of them from `loadEnv` at user-config time — before
16
- * any plugin can run — which yields `undefined` on a bare checkout; a
17
- * plugin's `define` merges over the user's, so this is what makes the client
18
- * see the URL. Never over a non-empty user `define`, which stays
19
- * authoritative.
20
- */
21
2
  export default function runtimeEnvPlugin(): Plugin;
22
3
  //# sourceMappingURL=runtime-env.d.ts.map
@@ -20,6 +20,25 @@ import { findStaleFimoOverride, resolveLocalRuntimeEnv, staleOverrideMessage, }
20
20
  * see the URL. Never over a non-empty user `define`, which stays
21
21
  * authoritative.
22
22
  */
23
+ // A dev restart after a `.env` change reruns the plugin in the same process, where
24
+ // `process.env` still holds the old value, and `loadEnv` lets `process.env` win.
25
+ let siteUrlFromDotenv;
26
+ function forgetSiteUrlFromDotenv() {
27
+ if (siteUrlFromDotenv !== undefined && process.env.FIMO_SITE_URL === siteUrlFromDotenv) {
28
+ delete process.env.FIMO_SITE_URL;
29
+ }
30
+ siteUrlFromDotenv = undefined;
31
+ }
32
+ /**
33
+ * Server code reads `FIMO_SITE_URL` from `process.env`, which Vite does not fill
34
+ * from `.env`, the only place a dev server or hosted preview gets a public variable.
35
+ */
36
+ function fillSiteUrlFromDotenv(dotenv) {
37
+ if (!process.env.FIMO_SITE_URL && dotenv.FIMO_SITE_URL) {
38
+ siteUrlFromDotenv = dotenv.FIMO_SITE_URL;
39
+ process.env.FIMO_SITE_URL = siteUrlFromDotenv;
40
+ }
41
+ }
23
42
  export default function runtimeEnvPlugin() {
24
43
  // External SSR dependencies bypass Vite's define replacements.
25
44
  const ssr = { noExternal: ['fimo', 'fimo-react', 'fimo-sveltekit'] };
@@ -44,7 +63,10 @@ export default function runtimeEnvPlugin() {
44
63
  // plugin, but `import('fimo/vite/runtime-env')` is also a valid package
45
64
  // boundary probe for projects that only install the core runtime.
46
65
  const { loadEnv } = await import('vite');
47
- const explicit = { ...loadEnv(mode, config.envDir ?? cwd, ''), ...process.env };
66
+ forgetSiteUrlFromDotenv();
67
+ const dotenv = loadEnv(mode, config.envDir ?? cwd, '');
68
+ fillSiteUrlFromDotenv(dotenv);
69
+ const explicit = { ...dotenv, ...process.env };
48
70
  const define = {
49
71
  'process.env.FIMO_EDITING_METADATA': JSON.stringify(String(resolveFimoEditingMetadata(command === 'serve' && mode !== 'production' && explicit.NODE_ENV !== 'production'
50
72
  ? 'development'
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "bundled": true,
3
3
  "bundler": "esbuild",
4
- "bundledAt": "2026-11-04T17:56:30.123Z",
4
+ "bundledAt": "2026-11-05T16:22:27.808Z",
5
5
  "cliVersion": "2.10.3",
6
6
  "external": [
7
7
  "oxc-parser",