fimo 0.12.0-staging.3 → 0.12.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.
- package/assets/content-templates/types-template.eta +13 -7
- package/assets/skills/fimo/SKILL.md +2 -2
- package/assets/skills/fimo-cli/SKILL.md +8 -8
- package/assets/skills/fimo-cli/references/agent-setup.md +1 -1
- package/assets/skills/fimo-cli/references/assets.md +2 -2
- package/assets/skills/fimo-cli/references/content.md +16 -30
- package/assets/skills/fimo-cli/references/describe.md +1 -1
- package/assets/skills/fimo-cli/references/forms.md +8 -8
- package/assets/skills/fimo-cli/references/init.md +5 -4
- package/assets/skills/fimo-cli/references/labels.md +4 -4
- package/assets/skills/fimo-cli/references/locales.md +3 -3
- package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +1 -1
- package/assets/skills/fimo-code/SKILL.md +40 -50
- package/assets/skills/fimo-code/references/assets.md +6 -4
- package/assets/skills/fimo-code/references/content/clients.md +130 -0
- package/assets/skills/fimo-code/references/content/primitives.md +5 -0
- package/assets/skills/fimo-code/references/content/richtext.md +48 -0
- package/assets/skills/fimo-code/references/content/schema.md +122 -0
- package/assets/skills/fimo-code/references/content.md +12 -597
- package/assets/skills/fimo-code/references/design.md +1 -1
- package/assets/skills/fimo-code/references/frameworks/next/app-router.md +116 -0
- package/assets/skills/fimo-code/references/frameworks/next/locales.md +59 -0
- package/assets/skills/fimo-code/references/frameworks/next/pages-router.md +99 -0
- package/assets/skills/fimo-code/references/frameworks/next.md +116 -0
- package/assets/skills/fimo-code/references/frameworks/react-router.md +295 -0
- package/assets/skills/fimo-code/references/frameworks/vite-react.md +225 -0
- package/assets/skills/fimo-code/references/labels.md +24 -83
- package/assets/skills/fimo-code/references/locales.md +22 -111
- package/assets/skills/fimo-code/references/setup-plain-vite.md +3 -227
- package/assets/skills/fimo-code/references/setup-react-router.md +3 -276
- package/assets/skills/fimo-code/references/ui.md +32 -78
- package/dist/cli/bundle.json +1 -1
- package/dist/cli/index.js +15 -15
- package/dist/scripts/extract-translations.js +8 -1
- package/package.json +1 -1
- package/templates/react-router/AGENTS.md +10 -10
- package/templates/react-router/package.json +1 -1
- package/templates/react-router/react-router.config.ts +1 -1
|
@@ -225,15 +225,21 @@ function isOptionalOutputField(field) {
|
|
|
225
225
|
function isConditionalField(field) {
|
|
226
226
|
return field.showIf !== undefined || field.showIfAny !== undefined;
|
|
227
227
|
}
|
|
228
|
+
|
|
229
|
+
const populatedReferenceFields = Object.entries(model.fields || {}).filter(([, field]) => {
|
|
230
|
+
if (field.type !== 'reference') {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
return (Array.isArray(field.targetRefs) && field.targetRefs.length > 0) || typeof field.targetPascal === 'string';
|
|
234
|
+
});
|
|
228
235
|
-%>
|
|
229
236
|
|
|
237
|
+
<% if (populatedReferenceFields.length === 0) { -%>
|
|
238
|
+
export type <%= model.pascal %>References = Record<never, never>;
|
|
239
|
+
<% } else { -%>
|
|
230
240
|
export interface <%= model.pascal %>References {
|
|
231
241
|
<%
|
|
232
|
-
|
|
233
|
-
Object.entries(model.fields).forEach(([key, field]) => {
|
|
234
|
-
if (field.type !== 'reference') {
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
242
|
+
populatedReferenceFields.forEach(([key, field]) => {
|
|
237
243
|
// Polymorphic populated values form a discriminated union on $type —
|
|
238
244
|
// the generated wrapper stamps it, so `switch (item.$type)` narrows.
|
|
239
245
|
if (Array.isArray(field.targetRefs) && field.targetRefs.length > 0) {
|
|
@@ -252,10 +258,10 @@ if (model.fields) {
|
|
|
252
258
|
-%>
|
|
253
259
|
<%= key %>: <%= type %>;
|
|
254
260
|
<%
|
|
255
|
-
|
|
256
|
-
}
|
|
261
|
+
});
|
|
257
262
|
-%>
|
|
258
263
|
}
|
|
264
|
+
<% } -%>
|
|
259
265
|
|
|
260
266
|
export type <%= model.pascal %>Populate = Populate<<%= model.pascal %>>;
|
|
261
267
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: fimo
|
|
3
3
|
description: >-
|
|
4
4
|
Working in or with a Fimo project (a content + media + forms + analytics
|
|
5
|
-
platform for
|
|
5
|
+
platform for web applications). Load the current Fimo skills on demand through
|
|
6
6
|
the `fimo` CLI before doing Fimo work — writing schema-driven
|
|
7
7
|
code, running CLI/deploy workflows, using the dashboard, or migrating a site.
|
|
8
8
|
---
|
|
@@ -23,7 +23,7 @@ not files in the project. Load them through the CLI, for example
|
|
|
23
23
|
|
|
24
24
|
Pick by task:
|
|
25
25
|
|
|
26
|
-
- Writing code —
|
|
26
|
+
- Writing code — schemas/forms, generated clients, labels, framework adapters, rendering primitives → `fimo-code`
|
|
27
27
|
- CLI commands and workflows — push, deploy, sync, labels, domains, analytics → `fimo-cli`
|
|
28
28
|
- Fimo agents — create, configure, validate, deploy, run, or inspect them → `fimo-cli` (`references/agents.md`)
|
|
29
29
|
- AI agent setup — connect Claude Code, Codex, Cursor, or another agent → `fimo-cli` (`references/agent-setup.md`)
|
|
@@ -9,7 +9,7 @@ description: >-
|
|
|
9
9
|
|
|
10
10
|
# Fimo CLI
|
|
11
11
|
|
|
12
|
-
The `fimo` CLI is the workflow surface for Fimo. Fimo
|
|
12
|
+
The `fimo` CLI is the workflow surface for Fimo. Fimo connects content, media, forms, analytics, editing, and hosting to web applications. The CLI handles project creation, content / forms / media / labels / locale workflows, deploys, collaboration, account management, Fimo agents, AI credit inspection, and AI agent setup.
|
|
13
13
|
|
|
14
14
|
This skill describes **what the CLI does and the workflows it drives**. For the package surface used IN code (component props, generated hooks, JSON shapes, code-side rules), load the `fimo-code` skill on demand with `npx fimo@latest skills get fimo-code`.
|
|
15
15
|
|
|
@@ -73,13 +73,13 @@ The working loop is local: run the app with the project's package-manager `dev`
|
|
|
73
73
|
Load the matching reference when the user's request fires its trigger. Recipes that involve writing code also need the `fimo-code` skill's package references — they're called out where relevant.
|
|
74
74
|
|
|
75
75
|
- "Create a new Fimo project / scaffold a site / start a new website / add the opt-in content starter / link an existing project locally" → `references/init.md`
|
|
76
|
-
- "Add a content type / blog / products / pages / CMS" → `references/content.md` (workflow) **+
|
|
77
|
-
- "Add a contact / signup / feedback / newsletter form" → `references/forms.md` (workflow) **+
|
|
76
|
+
- "Add a content type / blog / products / pages / CMS" → `references/content.md` (workflow) **+ run `npx fimo@latest skills get fimo-code --ref content/schema` and load the detected framework reference**
|
|
77
|
+
- "Add a contact / signup / feedback / newsletter form" → `references/forms.md` (workflow) **+ run `npx fimo@latest skills get fimo-code --ref forms` for the JSON spec and generated client**
|
|
78
78
|
- "View form submissions / who filled out the contact form / inspect what users sent / how many signups" → `references/forms.md` § Reading submissions
|
|
79
|
-
- "Upload an image / hero / cover / existing media file" → `references/assets.md` (workflow: upload, browse, open, delete) **+
|
|
80
|
-
- "Generate AI image / video / draft preview / image edit / cover from a prompt" → `references/media.md` (task commands, quality, recipes, and verification) **+
|
|
81
|
-
- "Add labels / update static copy / fix missing `t()` values" → `references/labels.md` (workflow) **+
|
|
82
|
-
- "Enable locales / configure default locale /
|
|
79
|
+
- "Upload an image / hero / cover / existing media file" → `references/assets.md` (workflow: upload, browse, open, delete) **+ run `npx fimo@latest skills get fimo-code --ref assets` for the `FimoMedia` shape and rendering**
|
|
80
|
+
- "Generate AI image / video / draft preview / image edit / cover from a prompt" → `references/media.md` (task commands, quality, recipes, and verification) **+ run `npx fimo@latest skills get fimo-code --ref assets` for the `FimoMedia` shape if you'll plug the result into UI**
|
|
81
|
+
- "Add labels / update static copy / fix missing `t()` values" → `references/labels.md` (workflow) **+ run `npx fimo@latest skills get fimo-code --ref labels` and load the detected framework reference**
|
|
82
|
+
- "Enable locales / configure default locale / integrate an existing locale system" → `references/locales.md` **+ run `npx fimo@latest skills get fimo-code --ref locales` and load the detected framework locale reference**
|
|
83
83
|
- "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`
|
|
84
84
|
- "Deploy / publish / go live / push my changes" → `references/deploy.md`
|
|
85
85
|
- "Get the preview URL / open the preview / what's the URL for this env / refresh the preview link / I just want to see the site / the preview URL stopped working" → `references/preview.md`
|
|
@@ -111,7 +111,7 @@ Load the matching reference when the user's request fires its trigger. Recipes t
|
|
|
111
111
|
|
|
112
112
|
These fire at specific moments in the project lifecycle. **Surface them proactively** rather than waiting for the user to ask:
|
|
113
113
|
|
|
114
|
-
- **Right after `fimo init`** → `cd` into the new directory,
|
|
114
|
+
- **Right after `fimo init`** → `cd` into the new directory, read the project's `AGENTS.md` (or `CLAUDE.md` for Claude Code), run `fimo describe --json`, then load `fimo-code` and only the task/framework references it routes to. The rules file came into existence mid-session and may not be auto-loaded by the harness. See `references/init.md` § Load the project context.
|
|
115
115
|
- **Right after `fimo init`** → suggest `fimo rename "<Display Name>"` to set a human-readable name (the default post-init name is an auto-generated slug). Infer the name from what the user is building (e.g. "Acme Coffee" for a café, "Jane Doe Portfolio" for a personal site). See `references/init.md`.
|
|
116
116
|
- **Right after `fimo init`** → start the app locally with the project's package-manager `dev` script (`pnpm dev` / `npm run dev` / `yarn dev` / `bun dev`) in the background, then ask the developer what they want to build. This localhost server with live reload is your iteration loop — edit, show, repeat. No deploy is needed to see local changes.
|
|
117
117
|
- **When a user-visible unit of work looks done** → **offer** to deploy (`fimo deploy` for a hosted preview / shareable link, `fimo deploy --publish` to go live) and run it only after the developer confirms — or immediately if they ask. Never deploy on your own. See `references/deploy.md`.
|
|
@@ -11,7 +11,7 @@ The rich skills (`fimo-code`, `fimo-cli`, `fimo-studio`, `fimo-migration`) are *
|
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
13
|
npx fimo@latest skills list # what's available
|
|
14
|
-
npx fimo@latest skills get fimo-code # writing code: schemas,
|
|
14
|
+
npx fimo@latest skills get fimo-code # writing code: schemas, generated clients, labels, framework adapters
|
|
15
15
|
npx fimo@latest skills get fimo-cli # CLI + workflows (this skill)
|
|
16
16
|
npx fimo@latest skills get fimo-cli --ref deploy # a reference doc
|
|
17
17
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **Run via `npx fimo@latest <command>`** — always the latest CLI, no install needed.
|
|
4
4
|
|
|
5
|
-
> Package contract: run `npx fimo@latest skills get fimo-code --ref assets` for `FimoMedia`,
|
|
5
|
+
> Package contract: run `npx fimo@latest skills get fimo-code --ref assets` for `FimoMedia`, `--ref ui` for rendering primitives, and load the detected framework reference for framework-specific integration.
|
|
6
6
|
> For **generating** new images / videos with AI, see **`references/media.md`** for the task commands and recipes.
|
|
7
7
|
|
|
8
8
|
This file covers the **CLI workflow** for media that already exists: uploading files, browsing the library, opening an asset to inspect it, moving / deleting items.
|
|
@@ -129,4 +129,4 @@ fimo assets delete <asset-id>
|
|
|
129
129
|
|
|
130
130
|
1. Upload with `fimo assets upload` or generate with a task command such as `fimo image generate`.
|
|
131
131
|
2. Keep the returned `url` (for direct use) or `id` (to attach to a `media` content-type field).
|
|
132
|
-
3. To use in
|
|
132
|
+
3. To use in application code, run `npx fimo@latest skills get fimo-code --ref ui` and load the detected framework reference: schema media → `<Image>` / `<Video>`, deliberate non-schema URLs → `<StaticImage>`. Never use raw `<img src={asset.url}>` for tracked media.
|
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
> **Run via `npx fimo@latest <command>`** — always the latest CLI, no install needed.
|
|
4
4
|
|
|
5
|
-
> Package contract:
|
|
5
|
+
> Package contract: load the version-locked `fimo-code` skill with `npx fimo@latest skills get fimo-code`, then fetch its nested content and detected-framework references for schema JSON, entry values, generated clients, and imports.
|
|
6
6
|
|
|
7
7
|
This file covers the **CLI workflow** for content. Use it when the user wants to add a content type (blog, products, pages) or manage Singles and entries.
|
|
8
8
|
|
|
9
9
|
## Flow
|
|
10
10
|
|
|
11
|
-
1. Write `src/schemas/{Uid}.json` — PascalCase filename (e.g. `BlogPost.json`).
|
|
12
|
-
2. Run `fimo schemas push {Uid}`. It
|
|
13
|
-
3. App code imports
|
|
11
|
+
1. Write `src/schemas/{Uid}.json` — PascalCase filename (e.g. `BlogPost.json`). Run `npx fimo@latest skills get fimo-code --ref content/schema` for the JSON contract.
|
|
12
|
+
2. Run `fimo schemas push {Uid}`. It registers the schema and generates the framework-specific public modules. It does not run whole-project validation.
|
|
13
|
+
3. App code imports generated public modules, never `.types.ts` directly. Load the detected framework reference before choosing server modules, client modules, hooks, or a registry.
|
|
14
14
|
4. Seed collections via `fimo entries create`, or update one-off content via `fimo singles update`. Generate cover images first with `fimo image generate` if needed (see `media.md` / `assets.md`).
|
|
15
|
-
5.
|
|
15
|
+
5. Render tracked fields with the detected framework's Fimo primitives.
|
|
16
16
|
|
|
17
|
-
Steps 1, 3, and 5
|
|
17
|
+
Steps 1, 3, and 5 use `fimo-code`; steps 2 and 4 are CLI workflows documented here.
|
|
18
18
|
|
|
19
19
|
## Schema CLI commands
|
|
20
20
|
|
|
@@ -34,9 +34,9 @@ The command is `fimo schemas` (plural). There is no singular `fimo schema` alias
|
|
|
34
34
|
|
|
35
35
|
All commands accept `-C, --cwd <dir>` to point at a different project directory.
|
|
36
36
|
|
|
37
|
-
Blocks schemas support at most 7 nested `blocks` levels, 40 variants in one `schema.oneOf`, and `min` or `max` values up to 200 items per blocks field.
|
|
37
|
+
Blocks schemas support at most 7 nested `blocks` levels, 40 variants in one `schema.oneOf`, and `min` or `max` values up to 200 items per blocks field. Run `npx fimo@latest skills get fimo-code --ref content/schema` for the complete blocks JSON shape.
|
|
38
38
|
|
|
39
|
-
Schema transitions are automatic. Adding optional fields and changing labels preserve content. A new required field backfills its `default` only where existing values need it; the push fails safely when no default can satisfy existing content. Removing a nested field or block variant removes only those values. `string` and `text` preserve values in both directions. Other primitive changes convert safe values and reject unsafe ones without changing the schema or entries. Lowering block `max` trims from the end; raising `min` fills from the blocks `default` templates. A reference target change clears its connections. Use repeatable `--rename old.path=new.path` arguments when a field moved by name so the one-time migration preserves its values; the operation is not stored in schema JSON. Collection-to-Single removes that type's entries and cleans inbound references; Single-to-collection preserves its entry.
|
|
39
|
+
Schema transitions are automatic. Adding optional fields and changing labels preserve content. A new required field backfills its `default` only where existing values need it; the push fails safely when no default can satisfy existing content. Removing a nested field or block variant removes only those values. `string` and `text` preserve values in both directions. Other primitive changes convert safe values and reject unsafe ones without changing the schema or entries. Lowering block `max` trims from the end; raising `min` fills from the blocks `default` templates. A reference target change clears its connections. Use repeatable `--rename old.path=new.path` arguments when a field moved by name so the one-time migration preserves its values; the operation is not stored in schema JSON. Collection-to-Single removes that type's entries and cleans inbound references; Single-to-collection preserves its entry.
|
|
40
40
|
|
|
41
41
|
## Singles CLI commands
|
|
42
42
|
|
|
@@ -76,7 +76,7 @@ fimo entries bulk-update <TypeName> (--file <path> | --stdin)
|
|
|
76
76
|
fimo entries bulk-delete <TypeName> (--ids <id1>,<id2> | --where '<json>') [--locale es]
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
`--body` is a **required** option on `create` and `update`.
|
|
79
|
+
`--body` is a **required** option on `create` and `update`. Run `npx fimo@latest skills get fimo-code --ref content/richtext` before constructing an entry payload: slug belongs inside `data`, media has a specific shape, and richtext must be Tiptap JSONContent.
|
|
80
80
|
|
|
81
81
|
`entries list` accepts the same read query surface as generated hooks:
|
|
82
82
|
|
|
@@ -100,7 +100,7 @@ Reference filters take the target `id` string (`{"author":"750e..."}`). On a to-
|
|
|
100
100
|
|
|
101
101
|
Polymorphic references declare `targets: ["Post", "Product"]` instead of `target` (never both) and their values carry both parts: `{ "contentType": "Post", "id": "..." }`. Populate returns mixed full entries, and generated hooks expose `$type` on each populated value to branch on. `--where` on polymorphic fields is not supported yet and fails with a clear error.
|
|
102
102
|
|
|
103
|
-
In generated
|
|
103
|
+
In generated application code, the equivalent is `populate: ['author', 'contributors'] as const` in query params. Let the generated client infer the result when possible; if a named TypeScript shape is needed, use `BlogPostResult<TFields, TPopulate>` as documented by `npx fimo@latest skills get fimo-code --ref content/clients`. Writes use `BlogPostInput`.
|
|
104
104
|
|
|
105
105
|
### Read-only SQL
|
|
106
106
|
|
|
@@ -191,7 +191,7 @@ fimo entries bulk-delete BlogPost --where '{"archived":true}'
|
|
|
191
191
|
|
|
192
192
|
Each bulk request handles at most 1,000 entries. Missing requested IDs do not fail valid work: the CLI prints a warning, and `--json` includes both a top-level `warnings` array and the exact IDs in `data.meta.missing`. Bulk writes use the same validation, locale, reference, and content-change paths as singular entry writes. They apply entries one at a time. Recoverable create and update errors report how many earlier entries were already changed.
|
|
193
193
|
|
|
194
|
-
For reference schema JSON and entry value shape,
|
|
194
|
+
For reference schema JSON and entry value shape, run `npx fimo@latest skills get fimo-code --ref content/schema`. The short version:
|
|
195
195
|
|
|
196
196
|
```json
|
|
197
197
|
{
|
|
@@ -253,32 +253,18 @@ Rules:
|
|
|
253
253
|
|
|
254
254
|
Turning an existing field shared is destructive when the languages currently hold different values. The push collapses each document to its default-locale value and discards the others; there is no prompt and no undo. Most documents already agree, so most collapses change nothing — but tell the user what will happen before adding `"i18n": false` to a field that already holds content, and check whether the languages differ if you are unsure.
|
|
255
255
|
|
|
256
|
-
Use `"isSingleton": true` for a Single with exactly one set of content. Generated Single clients expose `get`/`update` and
|
|
256
|
+
Use `"isSingleton": true` for a Single with exactly one set of content. Generated Single clients expose `get`/`update` and client hooks where the framework supports them, not collection create/remove APIs.
|
|
257
257
|
|
|
258
258
|
## "Add a blog" recipe
|
|
259
259
|
|
|
260
|
-
1.
|
|
260
|
+
1. Run `npx fimo@latest skills get fimo-code --ref content/schema` for the JSON shape and field types.
|
|
261
261
|
2. Write `src/schemas/BlogPost.json` with fields `title`, `body` (richtext), `coverImage` (media), etc. Do NOT declare a `slug` field — `slug` (and `id`, `entryId`, `documentId`, `locale`, `createdAt`, `updatedAt`, `__fimo`) is reserved entry metadata and will be rejected; every entry gets a `slug` for free.
|
|
262
262
|
3. Run `fimo schemas push BlogPost`.
|
|
263
263
|
4. Generate cover images: `fimo image generate --prompt "..." --aspect-ratio 16:9` (see `media.md`).
|
|
264
264
|
5. Seed entries: `fimo entries create BlogPost --body '{"data": {"slug": "first-post", "title": "...", "coverImage": {...}}}'`.
|
|
265
|
-
6.
|
|
266
|
-
7.
|
|
267
|
-
8.
|
|
268
|
-
|
|
269
|
-
## When to run sync manually
|
|
270
|
-
|
|
271
|
-
`fimo schemas push`, `fimo validate`, and the `fimo/vite` development watcher all reuse the same schema generator. Production builds do not rewrite generated source files. `schemas push` does not run route, label, agent, form, or project-wide checks. For a full local validation and codegen pass without updating the remote schema, use:
|
|
272
|
-
|
|
273
|
-
```bash
|
|
274
|
-
fimo validate # runs all phases: codegen, lint, route validation, label checks
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
Advanced/internal (hidden from `fimo --help`) — for the bare regen phase:
|
|
278
|
-
|
|
279
|
-
```bash
|
|
280
|
-
fimo scripts sync-schemas # regenerate src/schemas/*.types.ts and src/schemas/*.ts
|
|
281
|
-
```
|
|
265
|
+
6. Run `npx fimo@latest skills get fimo-code --ref ui` and load the detected framework reference for rendering primitives.
|
|
266
|
+
7. Run `npx fimo@latest skills get fimo-code --ref labels` and load the detected framework reference for labels.
|
|
267
|
+
8. Load the detected framework reference, then build the page with its generated server or client surface.
|
|
282
268
|
|
|
283
269
|
## Non-interactive use
|
|
284
270
|
|
|
@@ -77,5 +77,5 @@ The scoped view still emits the project-level metadata header (name, framework,
|
|
|
77
77
|
## Notes for AI tools
|
|
78
78
|
|
|
79
79
|
- The JSON shape is stable; parse it rather than scraping the human output when you need a specific field.
|
|
80
|
-
- The `framework` field
|
|
80
|
+
- The `framework` field uses Fimo's shared Vercel filesystem detector, which considers package dependencies, configuration files, and framework-specific file layout. For unusual or deliberately mixed projects it may be `null`; inspect `package.json` and the application tree before choosing a framework reference.
|
|
81
81
|
- The command runs in any directory that contains `.fimo/project.json` or one of its ancestors. If you're not in a Fimo project, `describe` will run against whatever directory you point it at (it doesn't require Fimo credentials).
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
> **Run via `npx fimo@latest <command>`** — always the latest CLI, no install needed.
|
|
4
4
|
|
|
5
|
-
> Package contract: run `npx fimo@latest skills get fimo-code --ref forms` for the JSON spec, generated Zod schema, submit helper, and
|
|
5
|
+
> Package contract: run `npx fimo@latest skills get fimo-code --ref forms` for the JSON spec, generated Zod schema, submit helper, and application usage.
|
|
6
6
|
|
|
7
7
|
This file covers the **CLI workflow** for forms. Use it when the user wants to add a contact form, signup, feedback form, etc.
|
|
8
8
|
|
|
9
9
|
## Flow
|
|
10
10
|
|
|
11
|
-
1. Write `src/forms/{name}.json` — kebab-case filename (e.g. `contact-us.json`). For the JSON spec and field types,
|
|
11
|
+
1. Write `src/forms/{name}.json` — kebab-case filename (e.g. `contact-us.json`). For the JSON spec and field types, run `npx fimo@latest skills get fimo-code --ref forms`.
|
|
12
12
|
2. Register with `fimo forms push {name}` — creates the form, obtains its `id`, patches it back into the JSON file.
|
|
13
|
-
3. Pre-build generates `src/forms/{name}.ts` (Zod schema + `submitX` helper).
|
|
14
|
-
4. Write
|
|
13
|
+
3. Pre-build generates `src/forms/{name}.ts` (Zod schema + `submitX` helper). Use the same `fimo-code` reference for the generated API.
|
|
14
|
+
4. Write the application form using the generated `@/forms/{name}` module and the existing framework conventions.
|
|
15
15
|
|
|
16
16
|
Steps 1, 3, and 4 reference the `fimo-code` skill (`npx fimo@latest skills get fimo-code`). Step 2 is the CLI command.
|
|
17
17
|
|
|
@@ -45,12 +45,12 @@ Use this when the user asks "who filled out the contact form?", "how many signup
|
|
|
45
45
|
|
|
46
46
|
## "Add a contact form" recipe
|
|
47
47
|
|
|
48
|
-
1.
|
|
48
|
+
1. Run `npx fimo@latest skills get fimo-code --ref forms` for the JSON spec.
|
|
49
49
|
2. Write `src/forms/contact-us.json` with the required fields.
|
|
50
50
|
3. Run `fimo forms push contact-us` — the `id` is patched back into the JSON automatically.
|
|
51
|
-
4.
|
|
52
|
-
5.
|
|
53
|
-
6. Write the
|
|
51
|
+
4. Use the same `fimo-code` forms reference for the generated `submitContactUs` + `ContactUsSchema` API.
|
|
52
|
+
5. Run `npx fimo@latest skills get fimo-code --ref labels` and load the detected framework reference for form labels.
|
|
53
|
+
6. Write the application form using the generated `@/forms/contact-us` module.
|
|
54
54
|
|
|
55
55
|
**Register BEFORE writing app code that depends on the form** — otherwise the generated `.ts` doesn't exist and the runtime fetch 404s.
|
|
56
56
|
|
|
@@ -74,7 +74,7 @@ Pass `--project-id <id>` to link an EXISTING project instead of creating one. Th
|
|
|
74
74
|
- `.fimo/project.json` — links this directory to the remote project (read-only after creation)
|
|
75
75
|
- `.fimo/config.json` — project, route, locale, SEO, and agent policy
|
|
76
76
|
- `.fimo/agents/` — versioned agent bundles
|
|
77
|
-
- `.env` —
|
|
77
|
+
- `.env` — tenant content API URLs for Vite and Next runtimes
|
|
78
78
|
- `AGENTS.md` + `CLAUDE.md` — project rules (from the template) read by AGENTS.md-compatible tools and Claude Code. Both point the agent at `fimo skills get` to load the real skills on demand.
|
|
79
79
|
- A git repository with `fimo` as the remote, and — after dependencies install — an initial commit (including the lockfile) plus an initial push
|
|
80
80
|
|
|
@@ -119,10 +119,11 @@ After `fimo init` completes, the project root has `AGENTS.md` (universal) and `C
|
|
|
119
119
|
|
|
120
120
|
1. `cd <project-dir>` — switch into the new project.
|
|
121
121
|
2. `Read` the project rules file: `AGENTS.md` (or `CLAUDE.md` if you're Claude Code).
|
|
122
|
-
3.
|
|
123
|
-
4. Load
|
|
122
|
+
3. Run `npx fimo@latest describe --json` and read the detected framework, schemas, locales, and tree.
|
|
123
|
+
4. Load the code skill on demand: `npx fimo@latest skills get fimo-code`.
|
|
124
|
+
5. Follow its decision tree and load only the task reference plus the detected framework reference. For Next.js, start with `npx fimo@latest skills get fimo-code --ref frameworks/next`, then load App Router, Pages Router, or locales only when the project shape requires it.
|
|
124
125
|
|
|
125
|
-
|
|
126
|
+
Do not batch-load every reference. Progressive disclosure keeps unrelated framework and product guidance out of the coding context.
|
|
126
127
|
|
|
127
128
|
## Adding another AI tool to an existing project later
|
|
128
129
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
> **Run via `npx fimo@latest <command>`** — always the latest CLI, no install needed.
|
|
4
4
|
|
|
5
|
-
> Package contract: run `npx fimo@latest skills get fimo-code --ref labels` for `t()
|
|
5
|
+
> Package contract: run `npx fimo@latest skills get fimo-code --ref labels` for the `t()` contract and key rules, then load the detected framework reference for its label readers.
|
|
6
6
|
> For locale configuration and route-prefix validation, see **`references/locales.md`**.
|
|
7
7
|
|
|
8
8
|
This file covers the **CLI workflow** for labels: static UI copy such as nav items, buttons, headings, placeholders, alt text, and SEO strings.
|
|
9
9
|
|
|
10
10
|
## What validate does
|
|
11
11
|
|
|
12
|
-
`fimo validate` scans `src/**/*.{ts,tsx,js,jsx}` for `t('
|
|
12
|
+
`fimo validate` scans `src/**/*.{ts,tsx,js,jsx}` for literal `t('key')` calls, including server readers such as `labels.t('key')` (skipping `src/ui` and `node_modules`), and verifies every key has a value in the tenant DB for the default locale.
|
|
13
13
|
|
|
14
14
|
The database is the source of truth for visible label values. Code declares keys; it does not create visible copy.
|
|
15
15
|
|
|
@@ -61,9 +61,9 @@ Prefer `fimo validate` — this primitive is for narrow debugging/test use.
|
|
|
61
61
|
|
|
62
62
|
## Workflow
|
|
63
63
|
|
|
64
|
-
1. Write
|
|
64
|
+
1. Write code with literal `t('key')` calls. Run `npx fimo@latest skills get fimo-code --ref labels` and load the detected framework reference.
|
|
65
65
|
2. Run `fimo validate`.
|
|
66
66
|
3. Add missing values with `fimo labels set` or `fimo labels set-many`.
|
|
67
67
|
4. Editors can now change copy in the Fimo admin without code changes.
|
|
68
68
|
|
|
69
|
-
For
|
|
69
|
+
For helper signatures and code patterns, run `npx fimo@latest skills get fimo-code --ref labels` before writing code that uses `t()`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> **Run via `npx fimo@latest <command>`** — always the latest CLI, no install needed.
|
|
4
4
|
|
|
5
|
-
This file covers CLI-side locale configuration and validation. For code
|
|
5
|
+
This file covers CLI-side locale configuration and validation. For code integration, run `npx fimo@latest skills get fimo-code --ref locales` plus the detected framework's locale reference.
|
|
6
6
|
|
|
7
7
|
## Configure Locales
|
|
8
8
|
|
|
@@ -65,13 +65,13 @@ Do not add `/es/pricing` as a second Fimo route. The route selector localizes ca
|
|
|
65
65
|
import { fimoRoutes } from 'fimo/react-router/routes';
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
For
|
|
68
|
+
For every framework, the application owns its URL scheme and passes the resolved locale into Fimo. Canonical route metadata is optional unless the project wants Fimo Studio route selection/navigation.
|
|
69
69
|
|
|
70
70
|
## Migrate An Existing Locale System
|
|
71
71
|
|
|
72
72
|
Inspect the existing locale provider, route table, switcher, redirects, and public URLs before editing configuration. Preserve working URL behavior during the migration.
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Preserve the existing locale provider, router, switcher, redirects, and public URLs. Use framework helpers only when they fit that architecture. Next.js projects run `npx fimo@latest skills get fimo-code --ref frameworks/next/locales`; React Router projects load the React Router setup reference.
|
|
75
75
|
|
|
76
76
|
## Labels And Content
|
|
77
77
|
|
|
@@ -45,7 +45,7 @@ Secrets are not written to `.env.local`, preview app env files, browser bundles,
|
|
|
45
45
|
|
|
46
46
|
## Local Env Files
|
|
47
47
|
|
|
48
|
-
`fimo init` writes `.env`
|
|
48
|
+
`fimo init` writes `.env` with tenant content API URLs for Vite and Next runtimes. This lets the framework's normal dev command work without a Fimo wrapper.
|
|
49
49
|
|
|
50
50
|
`fimo vars add`, `fimo vars update`, and `fimo vars pull` write public project variables to a managed block in `.env.local`.
|
|
51
51
|
|
|
@@ -1,67 +1,57 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fimo-code
|
|
3
3
|
description: >-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Write schema-first application code with the installed `fimo` package.
|
|
5
|
+
Load when declaring content schemas or forms, using generated content
|
|
6
|
+
clients, rendering Fimo primitives, reading labels, or integrating Fimo
|
|
7
|
+
with Next.js, React Router, Vite, or another application framework. CLI
|
|
8
|
+
commands and operational workflows live in the `fimo-cli` skill.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
# Fimo
|
|
11
|
+
# Fimo code
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Use this skill for code that consumes the version-locked `fimo` package in the current project. Fimo connects content, labels, media, forms, editing metadata, and hosting to an application; the application continues to own routing, locale resolution, links, document language/direction, and SEO.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Use the project-installed CLI for local inspection, code generation, and validation (`pnpm exec fimo`, `npm exec fimo`, `yarn fimo`, or `bunx --no-install fimo`, matching the lockfile). If that runner tries to install packages even though dependencies already exist, invoke the local `node_modules/.bin/fimo` executable instead. Load the `fimo-cli` skill for remote operational workflows such as schema pushes, label writes, entry mutations, and deploys. If the skill is not already available locally, fetch it with `npx fimo@latest skills get fimo-cli`.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
## Orient before writing
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
1. Run the project-installed `fimo describe --json` in a linked project and read `data.framework.slug`, schemas, locales, and tree. If the project is not linked yet, inspect `package.json` and the app directory instead.
|
|
20
|
+
2. Load only the references required by the task.
|
|
21
|
+
3. Load the framework reference before choosing imports, providers, or rendering APIs.
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
Framework routing:
|
|
22
24
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
- **Forms** → use the generated Zod schema + `submitX` helper from `@/forms/<name>`. Never hand-roll fetch or validation.
|
|
25
|
+
- `nextjs` or an `app/`, `src/app/`, `pages/`, or `src/pages/` tree → `references/frameworks/next.md`, then the matching App Router or Pages Router reference.
|
|
26
|
+
- React Router framework mode (`react-router.config.ts`, `src/routes.ts`) → `references/frameworks/react-router.md`.
|
|
27
|
+
- Vite + React without framework mode → `references/frameworks/vite-react.md`.
|
|
27
28
|
|
|
28
|
-
|
|
29
|
+
## Durable content contract
|
|
30
|
+
|
|
31
|
+
- Declare editor-managed content in `src/schemas/<Uid>.json`; the PascalCase filename must match `uid`.
|
|
32
|
+
- Apply every schema change with `fimo schemas push <Uid>`; it validates the JSON, generates framework-specific clients, and updates the linked environment.
|
|
33
|
+
- Import generated public modules; never edit generated `.ts`, `.client.ts`, `.types.ts`, or `index.ts` files.
|
|
34
|
+
- Render tracked values with the framework's Fimo primitives so Studio can identify and edit their source.
|
|
35
|
+
- Keep migration-only adapters (`Wrapped*`, private loaders, fallback stores) out of greenfield application code.
|
|
29
36
|
|
|
30
37
|
## Load only the references the task needs
|
|
31
38
|
|
|
32
39
|
Each reference defines one package contract. Fetch it when the task reaches that surface; do not batch-load unrelated references:
|
|
33
40
|
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
- `
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
- `references/
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
- ANY user-facing string in code → `references/labels.md`
|
|
52
|
-
- Locale-aware routes, links, or framework adapters → `references/locales.md`
|
|
53
|
-
- ANY JSX rendering schema content or `t()` output → `references/ui.md`
|
|
54
|
-
- Major visual / redesign / hero section / brand → `references/design.md`
|
|
55
|
-
|
|
56
|
-
## Anti-Patterns
|
|
57
|
-
|
|
58
|
-
- **Hardcoding content in JSX** — `<h1>My Blog</h1>` + an array of posts in code. Use schemas + entries + `t()`.
|
|
59
|
-
- **Raw HTML for schema content** — `<img src={post.coverImage.url}>` instead of `<Image value={post.coverImage}>`. The `fimo/ui` components carry metadata for inline editing in the admin.
|
|
60
|
-
- **Raw `<a href>` for internal navigation** — causes full page reloads. Use `<FimoLink>` for locale-aware internal links or React Router `<Link>` when intentionally bypassing locale helpers. Reserve `<a>` for external links.
|
|
61
|
-
- **Pulling stock photos from external URLs** — editors can't manage them. Use a Fimo media task such as `fimo image generate`.
|
|
62
|
-
- **Editing generated `.ts` files** under `src/schemas/` or `src/forms/` — regenerate them through `fimo validate` or the matching push command.
|
|
63
|
-
- **Writing raw HTML in `richtext` fields** — must be Tiptap JSONContent.
|
|
64
|
-
- **Calling `t()` with a dynamic first argument** — the key must be a string literal so the extractor finds it.
|
|
65
|
-
- **Decorating the disposable starter** — `src/pages/Index.tsx` is throwaway scaffolding. On first real generation, replace it entirely.
|
|
66
|
-
- **Skipping legal pages** — `Privacy.tsx` + `Terms.tsx` are required for public sites; the template ships them.
|
|
67
|
-
- **Showing Fimo branding** in the generated site unless the user explicitly asks for it.
|
|
41
|
+
- Schema JSON, field types, blocks, references, `showIf` → `references/content/schema.md`
|
|
42
|
+
- Richtext/Tiptap, entry payloads, slugs → `references/content/richtext.md`
|
|
43
|
+
- Generated clients: `list`, `getBySlug`, `useList`, `where`, `sort`, `fields`, `populate` → `references/content/clients.md`
|
|
44
|
+
- Tracked rendering: `Text`, `RichText`, `Image`, `FimoString`, `FimoMedia` → `references/ui.md`
|
|
45
|
+
- Forms: JSON spec, generated Zod schema, `submit*` helpers → `references/forms.md`
|
|
46
|
+
- Media values, `<Image>`, `<StaticImage>` → `references/assets.md`
|
|
47
|
+
- Static editable copy: `t()`, `useLabels`, `getLabels` → `references/labels.md`
|
|
48
|
+
- Locale ownership and framework handoff → `references/locales.md`
|
|
49
|
+
- Major visual work → `references/design.md`
|
|
50
|
+
|
|
51
|
+
## Non-negotiable boundaries
|
|
52
|
+
|
|
53
|
+
- Do not hardcode editor-owned collections, page content, labels, or media in JSX.
|
|
54
|
+
- Do not hand-roll content API fetches when a generated client covers the read.
|
|
55
|
+
- Do not hand-construct `FimoString`, `FimoMedia`, or other tracked values.
|
|
56
|
+
- Do not replace an application's router, locale library, URL policy, or SEO integration merely to add Fimo.
|
|
57
|
+
- Do not teach one framework's imports as universal package APIs.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> For the CLI commands (`fimo assets upload`, `fimo image generate`, folder management) and the "when to generate AI images" workflow rules, see **`fimo-cli/references/assets.md`**.
|
|
4
4
|
|
|
5
|
-
This file covers the
|
|
5
|
+
This file covers the package surface for working with assets in code: the `media` field value shape, rendering primitives, and URL format.
|
|
6
6
|
|
|
7
7
|
## `media` field value (stored/wire shape)
|
|
8
8
|
|
|
@@ -20,11 +20,11 @@ Asset values returned from `fimo assets upload` or Fimo media tasks, and stored
|
|
|
20
20
|
- `url`: stable HTTPS URL, no auth required, safe to embed.
|
|
21
21
|
- `alt`: optional alt text.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Generated content reads wrap this stored value in `FimoMedia`, which exposes `url`, `alt`, `name`, `mime`, and optional `width`/`height`. It does not expose `source`; Fimo tracks that internally. Pass the whole entry value to `<Image>` / `<Video>`.
|
|
24
24
|
|
|
25
25
|
## Rendering in JSX
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Import the primitives from the active framework adapter: `fimo/next` on the Next server, `fimo/next/client` in Next Client Components, or `fimo/ui` in React Router/Vite.
|
|
28
28
|
|
|
29
29
|
| Asset source | Component | Pass via |
|
|
30
30
|
| --------------------------------------------------- | --------------------- | ------------------------- |
|
|
@@ -32,7 +32,7 @@ Always use the `fimo/ui` primitives — never raw HTML:
|
|
|
32
32
|
| Hard-coded URL or generated asset referenced inline | `<StaticImage>` | `src="https://..."` |
|
|
33
33
|
|
|
34
34
|
```tsx
|
|
35
|
-
import { Image, StaticImage, Video } from 'fimo/
|
|
35
|
+
import { Image, StaticImage, Video } from 'fimo/next';
|
|
36
36
|
|
|
37
37
|
// from a schema entry:
|
|
38
38
|
<Image value={post.coverImage} width={1200} height={630} fit="cover" />
|
|
@@ -41,6 +41,8 @@ import { Image, StaticImage, Video } from 'fimo/ui';
|
|
|
41
41
|
<StaticImage src="https://assets.fimo.ai/<project>/<id>.jpg" alt="Hero" width={1200} height={630} />
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
+
Fimo's `<Image>` is not Next's `next/image` component. Do not pass Next-only props such as `priority`, `fill`, `quality`, or `loader`; use only the props documented for the Fimo primitive. Preserve `next/image` for non-Fimo images when the application needs those Next-specific controls.
|
|
45
|
+
|
|
44
46
|
**Provide `width` and `height` when known** so Fimo can optimize the asset and reserve layout space (prevents CLS).
|
|
45
47
|
|
|
46
48
|
**Never hand-construct a `FimoMedia` object** to pass into `<Image>` — that bypasses inline-editing metadata. If you have a raw URL, use `<StaticImage>` instead.
|