fimo 0.12.0 → 0.13.0-staging.1

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 (46) 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 +9 -9
  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/branches.md +1 -0
  11. package/assets/skills/fimo-cli/references/content.md +16 -30
  12. package/assets/skills/fimo-cli/references/deploy.md +5 -3
  13. package/assets/skills/fimo-cli/references/describe.md +1 -1
  14. package/assets/skills/fimo-cli/references/forms.md +8 -8
  15. package/assets/skills/fimo-cli/references/init.md +5 -4
  16. package/assets/skills/fimo-cli/references/labels.md +4 -4
  17. package/assets/skills/fimo-cli/references/locales.md +21 -6
  18. package/assets/skills/fimo-cli/references/project-vars-and-secrets.md +1 -1
  19. package/assets/skills/fimo-code/SKILL.md +40 -50
  20. package/assets/skills/fimo-code/references/assets.md +6 -4
  21. package/assets/skills/fimo-code/references/content/clients.md +130 -0
  22. package/assets/skills/fimo-code/references/content/primitives.md +5 -0
  23. package/assets/skills/fimo-code/references/content/richtext.md +48 -0
  24. package/assets/skills/fimo-code/references/content/schema.md +122 -0
  25. package/assets/skills/fimo-code/references/content.md +12 -597
  26. package/assets/skills/fimo-code/references/design.md +1 -1
  27. package/assets/skills/fimo-code/references/frameworks/next/app-router.md +116 -0
  28. package/assets/skills/fimo-code/references/frameworks/next/locales.md +59 -0
  29. package/assets/skills/fimo-code/references/frameworks/next/pages-router.md +99 -0
  30. package/assets/skills/fimo-code/references/frameworks/next.md +116 -0
  31. package/assets/skills/fimo-code/references/frameworks/react-router.md +295 -0
  32. package/assets/skills/fimo-code/references/frameworks/vite-react.md +225 -0
  33. package/assets/skills/fimo-code/references/labels.md +24 -83
  34. package/assets/skills/fimo-code/references/locales.md +22 -111
  35. package/assets/skills/fimo-code/references/setup-plain-vite.md +3 -227
  36. package/assets/skills/fimo-code/references/setup-react-router.md +3 -276
  37. package/assets/skills/fimo-code/references/ui.md +32 -78
  38. package/assets/skills/fimo-studio/references/billing-and-credits.md +10 -0
  39. package/dist/cli/bundle.json +2 -2
  40. package/dist/cli/index.js +102 -86
  41. package/dist/scripts/extract-translations.js +8 -1
  42. package/package.json +1 -1
  43. package/release.json +2 -2
  44. package/templates/react-router/AGENTS.md +10 -10
  45. package/templates/react-router/package.json +1 -1
  46. 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
 
@@ -34,7 +34,7 @@ Every command accepts a global `--json` flag (or `FIMO_OUTPUT=json` env) and emi
34
34
 
35
35
  Branch on `error.code`, never on `error.message`. The envelope shape is versioned — `schema_version: 1` is stable; any breaking change bumps the version. Per-command `data` shapes are documented in `apps/cli/CLAUDE.md` (consumers of this skill don't normally need to read it, but it's the source of truth).
36
36
 
37
- For shell composition use plain pretty mode (`cd $(fimo …)`); for structured parsing use `--json`. JSON mode disables interactive prompts — commands that need a confirmation will fail fast with `NON_INTERACTIVE_REFUSAL` unless every required arg is on the command line (`--yes`, `--org`, etc.).
37
+ For shell composition use plain pretty mode (`cd $(fimo …)`); for structured parsing use `--json`. JSON mode disables interactive prompts — commands that need a confirmation fail fast unless every required arg is on the command line (`--yes`, `--org`, etc.). Locale lifecycle commands use `CONFIRMATION_REQUIRED` and require `--yes`; other older commands may use `NON_INTERACTIVE_REFUSAL`.
38
38
 
39
39
  Pretty output may hide URLs behind clickable labels. Agents should use `--json` and read `data`.
40
40
 
@@ -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.
@@ -17,6 +17,7 @@ fimo --env <name> <command> # peek at another env for one command (does not
17
17
  ```
18
18
 
19
19
  - **`--env <name>`** is a global override. `fimo --env main status` inspects `main` while you stay checked out on your feature branch.
20
+ - Git-changing commands use the current branch; cross-branch status only reports the mismatch.
20
21
  - If the branch maps to no env, the CLI errors with a hint (`fimo branch` to list, `fimo branch <name>` to create) rather than guessing.
21
22
  - **`main`** is the default env and cannot be deleted.
22
23
  - **`release/*`** envs are **read-only** — they're tags produced by `fimo publish`, not branches you push to. `fimo deploy` refuses them.
@@ -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
 
@@ -6,7 +6,9 @@
6
6
 
7
7
  > **Local vs hosted.** The local dev server is localhost only. The Fimo **dashboard preview** and the **shareable preview URL** are served by the deployed sandbox — so if the developer wants to see the site in the dashboard or send someone a link, that requires a `fimo deploy`.
8
8
 
9
- `fimo deploy` is **env-aware**: it targets the env of the current git branch (the same one `fimo status` reports on) and prints a one-line banner saying which. New projects are on `main`. It refuses to deploy to read-only `release/*` envs, and `--publish` only runs from `main`. The full multi-env workflow is in `references/branches.md`.
9
+ `fimo deploy` uses the current branch. New projects start on `main`; `release/*` is read-only, and `--publish` only runs from `main`. See `references/branches.md` for the multi-env workflow.
10
+
11
+ Before deploying, Fimo fast-forwards a clean checkout that is behind and stops on dirty-behind or diverged branches. This syncs the whole branch, including config commits from Studio or locale commands.
10
12
 
11
13
  > **Just need the current preview URL?** That's `fimo preview url` — sub-second, no commit, no push. See `references/preview.md`. `fimo deploy` is only for pushing code changes.
12
14
 
@@ -106,9 +108,9 @@ curl -H 'Accept: text/markdown' https://your-site/ # content negotiation
106
108
  curl https://your-site/?format=md # query param
107
109
  ```
108
110
 
109
- ## Recovering from a failed push
111
+ ## Recovering from Git drift
110
112
 
111
- If the push fails because the remote is ahead:
113
+ Most stale states are caught before deploy changes or commits files. Follow the emitted hint: clean a dirty checkout, or reconcile a diverged branch. A push can still lose a race if the remote advances after preflight:
112
114
 
113
115
  ```bash
114
116
  git pull --rebase fimo <env> # <env> = the branch you're deploying (e.g. main)
@@ -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,11 +2,24 @@
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
 
9
- Edit `.fimo/config.json`. Keep one locale unless the user asks for multilingual or localized output:
9
+ Keep one locale unless the user asks for multilingual or localized output. Use typed lifecycle commands for the locale set and default:
10
+
11
+ ```bash
12
+ fimo locales list --json
13
+ fimo locales add es --yes --json
14
+ fimo locales set-default es --yes --json
15
+ fimo locales remove es --yes --json
16
+ ```
17
+
18
+ These commands update the selected environment through the locale lifecycle API. The API commits `.fimo/config.json` to the Fimo branch, then the CLI synchronizes the **whole local branch** to that commit. They refuse a dirty config, a local-ahead branch, or a diverged branch before applying the remote change. `--yes` bypasses only the explanatory prompt.
19
+
20
+ If a mutation exits with code `2` and `data.code` is `LOCALE_APPLIED_SYNC_REQUIRED`, the remote operation succeeded (`data.applied` is `true`) but the local fast-forward did not. **Do not retry the locale command.** Run the commands in `data.sync.recovery`, resolve the checkout, and confirm with `fimo status` or `fimo locales list`.
21
+
22
+ Edit `.fimo/config.json` only for declarative routing behavior:
10
23
 
11
24
  ```jsonc
12
25
  {
@@ -21,12 +34,14 @@ Edit `.fimo/config.json`. Keep one locale unless the user asks for multilingual
21
34
  }
22
35
  ```
23
36
 
24
- - `defaultLocale` is the locale used by `fimo validate`, `fimo labels set` without `--locale`, and content commands without `--locale`.
25
- - `locales` must include `defaultLocale`. Do not add non-default locales unless the user asks for multiple languages, localized routes, translations, or a specific locale.
37
+ - `defaultLocale` is the locale used by `fimo validate`, `fimo labels set` without `--locale`, and content commands without `--locale`. Change it with `fimo locales set-default`.
38
+ - `locales` must include `defaultLocale`. Add and remove values with `fimo locales add` and `fimo locales remove`.
26
39
  - Locale tags should be structurally valid, for example `en`, `es`, `pt-BR`, or `zh-Hans`.
27
40
  - `routing.strategy` currently supports `path-prefix`.
28
41
  - If multiple locales are configured, create or update labels and localized content for every configured locale. Create schemas with `i18n: { "enabled": false }` only once.
29
42
 
43
+ `fimo locales remove` permanently deletes that locale's stored entries and labels.
44
+
30
45
  ## Validate
31
46
 
32
47
  Run:
@@ -65,13 +80,13 @@ Do not add `/es/pricing` as a second Fimo route. The route selector localizes ca
65
80
  import { fimoRoutes } from 'fimo/react-router/routes';
66
81
  ```
67
82
 
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.
83
+ 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
84
 
70
85
  ## Migrate An Existing Locale System
71
86
 
72
87
  Inspect the existing locale provider, route table, switcher, redirects, and public URLs before editing configuration. Preserve working URL behavior during the migration.
73
88
 
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.
89
+ 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
90
 
76
91
  ## Labels And Content
77
92
 
@@ -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