fimo 0.12.0-staging.3 → 0.12.0-staging.5

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 (42) hide show
  1. package/assets/agent-templates/broken-link-sweeper/capabilities.yaml +0 -4
  2. package/assets/agent-templates/content-translator/capabilities.yaml +0 -2
  3. package/assets/agent-templates/seo-audit/capabilities.yaml +0 -1
  4. package/assets/content-templates/types-template.eta +13 -7
  5. package/assets/skills/fimo/SKILL.md +2 -2
  6. package/assets/skills/fimo-cli/SKILL.md +8 -8
  7. package/assets/skills/fimo-cli/references/agent-setup.md +1 -1
  8. package/assets/skills/fimo-cli/references/agents.md +5 -12
  9. package/assets/skills/fimo-cli/references/assets.md +2 -2
  10. package/assets/skills/fimo-cli/references/content.md +16 -30
  11. package/assets/skills/fimo-cli/references/describe.md +1 -1
  12. package/assets/skills/fimo-cli/references/forms.md +8 -8
  13. package/assets/skills/fimo-cli/references/init.md +5 -4
  14. package/assets/skills/fimo-cli/references/labels.md +4 -4
  15. package/assets/skills/fimo-cli/references/locales.md +3 -3
  16. package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +1 -1
  17. package/assets/skills/fimo-code/SKILL.md +40 -50
  18. package/assets/skills/fimo-code/references/assets.md +6 -4
  19. package/assets/skills/fimo-code/references/content/clients.md +130 -0
  20. package/assets/skills/fimo-code/references/content/primitives.md +5 -0
  21. package/assets/skills/fimo-code/references/content/richtext.md +48 -0
  22. package/assets/skills/fimo-code/references/content/schema.md +122 -0
  23. package/assets/skills/fimo-code/references/content.md +12 -597
  24. package/assets/skills/fimo-code/references/design.md +1 -1
  25. package/assets/skills/fimo-code/references/frameworks/next/app-router.md +116 -0
  26. package/assets/skills/fimo-code/references/frameworks/next/locales.md +59 -0
  27. package/assets/skills/fimo-code/references/frameworks/next/pages-router.md +99 -0
  28. package/assets/skills/fimo-code/references/frameworks/next.md +116 -0
  29. package/assets/skills/fimo-code/references/frameworks/react-router.md +295 -0
  30. package/assets/skills/fimo-code/references/frameworks/vite-react.md +225 -0
  31. package/assets/skills/fimo-code/references/labels.md +24 -83
  32. package/assets/skills/fimo-code/references/locales.md +22 -111
  33. package/assets/skills/fimo-code/references/setup-plain-vite.md +3 -227
  34. package/assets/skills/fimo-code/references/setup-react-router.md +3 -276
  35. package/assets/skills/fimo-code/references/ui.md +32 -78
  36. package/dist/cli/bundle.json +1 -1
  37. package/dist/cli/index.js +16 -16
  38. package/dist/scripts/extract-translations.js +8 -1
  39. package/package.json +1 -1
  40. package/templates/react-router/AGENTS.md +10 -10
  41. package/templates/react-router/package.json +1 -1
  42. package/templates/react-router/react-router.config.ts +1 -1
@@ -1,6 +1,2 @@
1
1
  - net:fetch
2
- - files:read
3
- - files:write
4
- - git:branch
5
- - git:commit
6
2
  - fimo:analytics:read
@@ -4,5 +4,3 @@
4
4
  - i18n:read
5
5
  - i18n:write
6
6
  - net:fetch
7
- - git:branch
8
- - git:commit
@@ -1,5 +1,4 @@
1
1
  # Read-only audit — no writes to project files or CMS.
2
- - files:read
3
2
  - cms:read
4
3
  - net:fetch
5
4
  - fimo:analytics:read
@@ -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
- if (model.fields) {
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 React websites). Load the current Fimo skills on demand through
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 — schema-driven JSX, schemas/forms JSON, `t()` labels, `fimo/ui` media → `fimo-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 is a content + media + forms + analytics platform for React websites with a CMS dashboard. The CLI handles project creation, content / forms / media / labels / locale workflows, deploys, collaboration, account management, Fimo agents, and AI agent setup.
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) **+ load `fimo-code/references/content.md` for the JSON shape and React hooks**
77
- - "Add a contact / signup / feedback / newsletter form" → `references/forms.md` (workflow) **+ load `fimo-code/references/forms.md` for the JSON spec and generated client**
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) **+ load `fimo-code/references/assets.md` 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) **+ load `fimo-code/references/assets.md` 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) **+ load `fimo-code/references/labels.md` for the `t()` helper and wrap rules**
82
- - "Enable locales / configure default locale / route by locale prefix / fix locale route validation" → `references/locales.md` **+ load `fimo-code/references/locales.md` for code helpers**
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, then `Read` the project's `AGENTS.md` (or `CLAUDE.md` for Claude Code) to load the project context, and run `npx fimo@latest skills get fimo-code` to load the code skill before generating any code. The `AGENTS.md`/`CLAUDE.md` came into existence mid-session and may not be auto-loaded by the harness. See `references/init.md` § Load the project context.
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, forms, labels, fimo/ui
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
  ```
@@ -60,15 +60,14 @@ used. See `references/integrations.md` for project setup, auth, and provider-spe
60
60
 
61
61
  ## Capabilities
62
62
 
63
- Capabilities describe the non-integration actions an agent may take. Start with the smallest set that matches the goal.
64
- If `capabilities.yaml` is absent or empty, the agent gets the read-only defaults: `files:read`, `cms:read`, and
65
- `assets:read`. Once you add a capabilities file, list every extra capability the agent needs.
63
+ Capabilities describe the opt-in Fimo and network actions an agent may take. Managed agents always receive project
64
+ filesystem access, a shell, and the ability to commit their task-environment changes; Fimo owns branch creation and
65
+ publication. If `capabilities.yaml` is absent or empty, the agent has those project-worker tools but no Fimo API
66
+ permissions or web-fetch tool. Once you add a capabilities file, list every Fimo or network permission the agent needs.
66
67
  There is no all-capabilities wildcard; keeping the list explicit makes each agent's power reviewable.
67
68
 
68
69
  | Capability | Allows the agent to | Risk |
69
70
  | ---------------------------- | ------------------------------------------- | ------------ |
70
- | `files:read` | Read project files | Low |
71
- | `files:write` | Write or delete project files | Medium |
72
71
  | `cms:read` | Read CMS content | Low |
73
72
  | `cms:write` | Create, update, or delete CMS entries | Medium |
74
73
  | `cms:schema:read` | Read CMS schemas | Low |
@@ -81,16 +80,11 @@ There is no all-capabilities wildcard; keeping the list explicit makes each agen
81
80
  | `webhooks:write` | Create, modify, delete, or trigger webhooks | High |
82
81
  | `schedules:read` | Read schedule configs and run history | Low |
83
82
  | `schedules:write` | Create, change, or trigger scheduled runs | Critical |
84
- | `git:read` | Read git state | Low |
85
- | `git:branch` | Create an agent branch | Medium |
86
- | `git:commit` | Commit changes to the agent branch | Medium |
87
- | `git:push` | Push changes to the project remote | High |
88
83
  | `fimo:logs:read` | Read production logs | Low |
89
84
  | `fimo:analytics:read` | Read analytics data | Low |
90
85
  | `fimo:preview:read` | Read a current preview URL | Low |
91
86
  | `fimo:deploy` | Trigger a production deploy | Critical |
92
87
  | `net:fetch` | Make outbound HTTP requests | Medium |
93
- | `shell:exec` | Run arbitrary shell commands in the sandbox | High |
94
88
  | `agent:delegate` | Invoke declared sub-agents | Medium |
95
89
  | `runtime:long_running` | Run beyond the default time limit | High |
96
90
  | `runtime:auto_merge` | Auto-merge trivial proposed branches | Critical |
@@ -99,10 +93,9 @@ If a capability is missing, the related command is denied and the agent should c
99
93
  blocker. Add the capability to `capabilities.yaml`, run `fimo agents validate <name>`, deploy the bundle, and start a
100
94
  new run. A denied capability does not grant access to anything else.
101
95
 
102
- Example for a content editor that can read and update entries but cannot change schemas or run shell commands:
96
+ Example for a content editor that can read and update entries but cannot change schemas:
103
97
 
104
98
  ```yaml
105
- - files:read
106
99
  - cms:read
107
100
  - cms:write
108
101
  ```
@@ -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`, and `--ref ui` for component integration.
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 JSX, load the `fimo-code` UI reference — schema media → `<Image>` / `<Video>`, hardcoded URLs → `<StaticImage>`. **Never** use raw `<img src={asset.url}>`.
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: run `npx fimo@latest skills get fimo-code --ref content` for the JSON shape, field types, Tiptap nodes, slug rules, and generated React Query hooks.
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`). For the JSON shape and field types, load the `fimo-code` content reference.
12
- 2. Run `fimo schemas push {Uid}`. It generates `src/schemas/{Uid}.types.ts` and `src/schemas/{Uid}.ts`, then registers the schema with Fimo. It does not run whole-project validation.
13
- 3. App code imports the generated client from `@/schemas/{Uid}`, not from `.types.ts` directly. See the `fimo-code` content reference for the hook API.
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. Write React pages that import from `@/schemas/{Uid}` and render with `fimo/ui` components.
15
+ 5. Render tracked fields with the detected framework's Fimo primitives.
16
16
 
17
- Steps 1, 3, and 5 reference the `fimo-code` skill (`npx fimo@latest skills get fimo-code`) for shape and React API. Steps 2 and 4 are CLI commands documented here.
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. Load the `fimo-code` content reference for the complete blocks JSON shape.
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. Run `fimo validate` after pushing.
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`. Its JSON shape (where `slug` goes, how `media` fields look, Tiptap richtext format) lives in the `fimo-code` content reference. **Always read that first before constructing an entry payload — slug must be inside `data`, media has a specific shape, richtext must be Tiptap JSONContent.**
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 React code, the equivalent is `populate: ['author', 'contributors'] as const` in the schema hook/query params. Let hooks infer the result when possible; if a named TypeScript shape is needed, use the generated `BlogPostResult<TFields, TPopulate>` type documented in the `fimo-code` content reference. Writes use the separate generated `BlogPostInput` type.
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, load the `fimo-code` content reference § Reference fields. The short version:
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 their React Query hooks, not collection create/remove APIs.
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. Load the `fimo-code` content reference for the JSON shape and field types.
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. Load the `fimo-code` UI reference for the `<Text>`, `<Image>`, `<RichText>` components.
266
- 7. Load the `fimo-code` labels reference for wrapping labels in `t()`.
267
- 8. Write the React page using the generated `useGet()` hook from `@/schemas/BlogPost`.
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 is detected from `package.json#dependencies` (v1 detector). For multi-framework projects or unusual setups, the field may be `null` — fall back to reading `package.json` yourself.
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 React usage.
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, load the `fimo-code` forms reference.
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). See the `fimo-code` forms reference for the generated API.
14
- 4. Write a React component that imports from `@/forms/{name}`.
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. Load the `fimo-code` forms reference for the JSON spec.
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. Load the `fimo-code` forms reference for the generated `submitContactUs` + `ContactUsSchema` API.
52
- 5. Load the `fimo-code` labels reference for wrapping form labels in `t()`.
53
- 6. Write the React form component that imports from `@/forms/contact-us`.
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` — initial env vars (currently just `VITE_API_URL`)
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. Load the code skill on demand: `npx fimo@latest skills get fimo-code`.
123
- 4. Load only the `fimo-code` references needed for the first task, using `npx fimo@latest skills get fimo-code --ref <doc>`.
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
- Once those are in context, generation respects the project's conventions (schemas, `t()`, `fimo/ui` components, asset handling).
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()`, `useLabels()`, key naming, and wrapping rules.
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('literal-key')` calls (skipping `src/ui` and `node_modules`) and verifies every key has a value in the tenant DB for the default locale.
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 JSX with `t('key')` calls. Load the `fimo-code` labels reference for the rules.
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 the helper signatures, hooks, and code patterns, **always** load the `fimo-code` labels reference before writing code that uses `t()`.
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 helpers such as `fimoRoutes()` and `FimoLink`, run `npx fimo@latest skills get fimo-code --ref locales`.
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 custom frameworks, the project may implement its own URL scheme, but it still needs to pass the active locale into Fimo and keep canonical route metadata if it wants Fimo Studio route selection to work.
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
- For React Router projects, prefer one contract based on `.fimo/config.json`, `fimoRoutes()`, and `FimoLink`; migrate existing wrappers into the framework root instead of layering a second locale context. If that would change established URLs, keep the custom router temporarily, pass its active locale to `FimoProviders`, and ask the user to choose canonical URLs and redirects before rewriting routes.
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` for bootstrap app runtime values such as `VITE_API_URL`. This lets `pnpm dev` work without a Fimo wrapper.
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
- How to write code in a Fimo project — the npm package surface. Load when
5
- writing JSX that renders schema content, defining schemas or forms (JSON),
6
- using `t()` for labels, plugging media into `fimo/ui` components,
7
- or applying the project's code conventions. CLI commands and workflows
8
- (push, deploy, sync, etc.) live in the `fimo-cli` skill.
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
- You are writing code in a Fimo project — a content + media + forms + analytics platform for React websites with a CMS dashboard. This skill describes the **`fimo` npm package surface** as installed in this specific project: what's exported from `fimo`, `fimo/ui`, `fimo/vite`; the JSON shapes you write; the generated React Query hooks and Zod schemas you import; and the code conventions for using them.
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
- This skill is version-locked to this project's installed `fimo` package — the shapes here match what your code can actually use.
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
- For CLI commands and workflows (creating a project, pushing schemas/forms, deploying, managing labels, etc.), the **`fimo-cli`** skill is the source of truth. Run every CLI command as `npx fimo@latest <command>` (always the latest, no global install). Load it on demand with `npx fimo@latest skills get fimo-cli`.
17
+ ## Orient before writing
18
18
 
19
- ## Critical: NEVER hardcode user-facing things
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
- This is the load-bearing rule for every code change. **Fimo's whole point is that content editors edit content in the dashboard, not in code.** Anything hardcoded breaks that.
23
+ Framework routing:
22
24
 
23
- - **Content** (posts, products, pages, lists, anything structured) → declare a schema, render collections with generated `useList()` or `useInfiniteList()` hooks + `fimo/ui` components. Use `useGet()` only for legacy fixed array queries. **Never** write `const posts = [...]` in JSX.
24
- - **Strings** (labels, CTAs, headings, descriptions, any visible text) → wrap in `t('key')` and create the default-locale value with `fimo labels set`. Use `--locale <locale>` only when intentionally writing a non-default locale. **Never** write `<h1>Welcome</h1>` directly — write `<Text value={t('home.title')} as="h1" />`.
25
- - **Media** (images, videos, files) → use `<Image>` / `<Video>` from `fimo/ui` for schema media, `<StaticImage>` for hard-coded URLs. **Never** use `<img src={...}>`.
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
- If you find yourself about to hardcode anything user-facing, **stop and use the appropriate Fimo primitive instead.** For pushing the schema/form/asset to the backend, that's CLI territory — see the `fimo-cli` skill.
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
- - `references/content.md` — schema JSON shape, field types, Tiptap nodes, generated React Query hooks
35
- - `references/forms.md` — form JSON spec, generated Zod + `submitX` helper
36
- - `references/assets.md` — `FimoMedia` shape, how to render assets
37
- - `references/labels.md` — `t()` helper, `useLabels()`, wrap rules
38
- - `references/locales.md` — locale routing helpers, `FimoLink`, custom-framework contract
39
- - `references/ui.md` — `fimo/ui` components + JSX code conventions + app code rules
40
-
41
- Workflow / CLI-side concerns (pushing schemas, generating images, managing labels, deploying) live in the **`fimo-cli`** skill's matching references.
42
-
43
- ## Decision Tree (specific tasks)
44
-
45
- - **Setting up Fimo in a new project** — pick the framework:
46
- - React Router framework mode (new projects use React Router 8) → `references/setup-react-router.md`
47
- - Plain Vite + React (or upgrading a legacy v3 project) → `references/setup-plain-vite.md`
48
- - Writing schema JSON / picking field types / Tiptap richtext → `references/content.md`
49
- - Writing form JSON / generated form client / form code → `references/forms.md`
50
- - Plugging media into a component / `FimoMedia` shape → `references/assets.md`
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.