fimo 0.21.0-staging.1 → 0.21.0-staging.3

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 (66) hide show
  1. package/README.md +1 -1
  2. package/assets/agent-templates/_default/GOAL.md +10 -0
  3. package/assets/agent-templates/_default/capabilities.yaml +10 -0
  4. package/assets/content-templates/shared/types.eta +1 -1
  5. package/assets/skills/fimo-cli/SKILL.md +2 -1
  6. package/assets/skills/fimo-cli/references/agents.md +136 -36
  7. package/assets/skills/fimo-cli/references/branches.md +4 -4
  8. package/assets/skills/fimo-cli/references/deploy.md +11 -2
  9. package/assets/skills/fimo-cli/references/domains.md +12 -0
  10. package/assets/skills/fimo-cli/references/init.md +4 -0
  11. package/assets/skills/fimo-cli/references/locales.md +1 -1
  12. package/assets/skills/fimo-cli/references/mcp.md +1 -1
  13. package/assets/skills/fimo-cli/references/media.md +18 -1
  14. package/assets/skills/fimo-cli/references/projects.md +7 -7
  15. package/assets/skills/fimo-code/references/frameworks/next/locales.md +4 -4
  16. package/assets/skills/fimo-code/references/frameworks/react-router.md +2 -1
  17. package/assets/skills/fimo-code/references/frameworks/sveltekit.md +3 -5
  18. package/assets/skills/fimo-code/references/locales.md +2 -2
  19. package/assets/skills/fimo-migration/SKILL.md +21 -15
  20. package/assets/skills/fimo-migration/references/media.md +12 -8
  21. package/assets/skills/fimo-migration/references/qa.md +4 -3
  22. package/assets/skills/fimo-migration/references/workers/content-planner.md +33 -4
  23. package/assets/skills/fimo-migration/references/workers/validator.md +10 -0
  24. package/assets/skills/fimo-migration/references/workers.md +19 -10
  25. package/assets/skills/fimo-migration/references/workflow.md +29 -11
  26. package/assets/skills/fimo-studio/references/billing-and-credits.md +18 -1
  27. package/assets/skills/fimo-studio/references/preview-and-responsive.md +1 -0
  28. package/dist/cli/bundle.json +1 -1
  29. package/dist/cli/index.js +107 -106
  30. package/dist/runtime/app/FimoProviders.js +8 -1
  31. package/dist/runtime/app/FimoScripts.d.ts +0 -1
  32. package/dist/runtime/app/FimoScripts.js +1 -4
  33. package/dist/runtime/next/client.d.ts +2 -2
  34. package/dist/runtime/next/client.js +1 -1
  35. package/dist/runtime/next/provider.d.ts +0 -5
  36. package/dist/runtime/next/provider.js +21 -6
  37. package/dist/runtime/preview/script.d.ts +3 -0
  38. package/dist/runtime/preview/script.js +14 -0
  39. package/dist/runtime/react/primitives/contracts.d.ts +7 -1
  40. package/dist/runtime/sveltekit/preview.d.ts +1 -2
  41. package/dist/runtime/sveltekit/preview.js +1 -14
  42. package/dist/scripts/sync-schemas.js +81 -0
  43. package/package.json +6 -1
  44. package/templates/astro/AGENTS.md +1 -1
  45. package/templates/astro/package.json +2 -1
  46. package/templates/astro/pnpm-workspace.yaml +6 -2
  47. package/templates/nextjs/.fimo/config.json +1 -2
  48. package/templates/nextjs/AGENTS.md +5 -15
  49. package/templates/nextjs/next.config.ts +3 -1
  50. package/templates/nextjs/package.json +2 -1
  51. package/templates/nextjs/pnpm-workspace.yaml +6 -2
  52. package/templates/nextjs/src/app/layout.tsx +16 -0
  53. package/templates/nextjs/src/locales.ts +3 -6
  54. package/templates/react-router/AGENTS.md +1 -1
  55. package/templates/react-router/package.json +3 -2
  56. package/templates/react-router/pnpm-workspace.yaml +6 -6
  57. package/templates/react-router/src/vite-env.d.ts +0 -1
  58. package/templates/sveltekit/AGENTS.md +1 -1
  59. package/templates/sveltekit/package.json +2 -1
  60. package/templates/sveltekit/pnpm-workspace.yaml +6 -2
  61. package/templates/nextjs/src/app/(default)/layout.tsx +0 -10
  62. package/templates/nextjs/src/app/[locale]/layout.tsx +0 -22
  63. package/templates/nextjs/src/app/[locale]/page.tsx +0 -1
  64. package/templates/nextjs/src/components/Document.tsx +0 -26
  65. package/templates/nextjs/src/components/FimoPreviewBridge.tsx +0 -13
  66. /package/templates/nextjs/src/app/{(default)/page.tsx → page.tsx} +0 -0
package/README.md CHANGED
@@ -74,7 +74,7 @@ fimo deploy -m "your message"
74
74
  Go live to production:
75
75
 
76
76
  ```bash
77
- fimo publish --version 1.0.0
77
+ fimo publish --label "Homepage launch"
78
78
  ```
79
79
 
80
80
  Environments work like git branches:
@@ -9,3 +9,13 @@ Some good things to include:
9
9
  - Inputs the agent should expect (CLI args, files, API responses)
10
10
  - Anything the agent should **not** do
11
11
  - The format of the report / output the agent should produce
12
+
13
+ ## Decision policy
14
+
15
+ Adapt these defaults to the risk and scope of this agent:
16
+
17
+ - Proceed without asking when the work is within scope and a safe, reversible choice exists.
18
+ - Ask when a missing human decision changes what the correct result should be.
19
+ - Retain when the work is complete but all changes should be reviewed before merge.
20
+ - Request merge only when the result is complete, verified, and clearly safe for this agent's scope.
21
+ - Discard when the run produced no useful changes or deliberately abandoned them.
@@ -0,0 +1,10 @@
1
+ - cms:*
2
+ - assets:*
3
+ - i18n:*
4
+ - forms:*
5
+ - webhooks:read
6
+ - schedules:read
7
+ - fimo:analytics:read
8
+ - fimo:history:read
9
+ - fimo:logs:read
10
+ - fimo:preview:read
@@ -9,7 +9,7 @@
9
9
  */
10
10
  %>
11
11
  // AUTO-GENERATED ⚠️ – do not edit by hand
12
- import { type Fields, type FimoBoolean, type FimoMedia, type FimoPolymorphicReference, type FimoReference, type FimoRichText, type FimoRichTextContent, type FimoString, type Populate, type PopulatedResult, type ProjectedWithPopulate, type Query, type Sort, type Where, type WithReferences } from "<%= runtimeImport %>";
12
+ import { <%= model.runtimeTypeImports.map((typeImport) => `type ${typeImport}`).join(', ') %> } from "<%= runtimeImport %>";
13
13
  <%
14
14
  if (model.referenceImports && model.referenceImports.length > 0) {
15
15
  model.referenceImports.forEach((referenceImport) => {
@@ -128,7 +128,8 @@ These fire at specific moments in the project lifecycle. **Surface them proactiv
128
128
  - **When the user wants to try something risky / explore a redesign without touching the live site** → suggest a feature Branch: `fimo checkout -b <name>` gives an isolated Branch + DB + preview. Deploy previews there, then `fimo merge` it back and `fimo publish`. See `references/branches.md`.
129
129
  - **After completing or safely preserving the user's main work, when a confirmed Fimo platform failure still materially blocks the task after one safe recovery attempt, or a confirmed missing capability blocks completion or forces a fragile or heavily manual workaround** → use the built-in `supportReport` tool. Do not wait for the user to ask and do not stop after only describing the gap. See `references/support.md`.
130
130
  - **After the first successful `fimo deploy`** → suggest `fimo invite` if the project involves multiple people. Typical roles: `edit` for developers/content editors, `view` or `comment` for clients/stakeholders, `full` for project leads. See `references/invite.md`.
131
- - **When the user wants to modify the URL of their website** → walk through `references/domains.md`. The CLI surface covers renaming the Fimo-provided subdomain (`fimo domains rename-default`, free), attaching a domain they already own (`fimo domains add`, Premium), and buying a new domain through Fimo (`fimo domains buy`, Premium). The auto-generated default URL on every project is a fallback, not a final choice — proactively offer this after `fimo deploy --publish` if the user mentioned a real brand or domain.
131
+ - **After the automatic first-preview deploy on the create-new path, before the project has been published** → if there is no custom domain and the free default `*.fimo.site` slug still looks generated or was never explicitly chosen, offer to find a cleaner free subdomain. It needs no DNS. Never claim one without explicit user confirmation: suggest candidates, let the user choose, then rename it. Choosing the slug does not publish the site; the URL starts resolving only after the first successful `fimo deploy --publish`. Skip this nudge if the user already chose the default slug, attached a custom domain, or declined. See `references/domains.md` § Offer a cleaner default URL before first publish.
132
+ - **When the user wants to modify the URL of their website** → walk through `references/domains.md`. The CLI surface covers renaming the Fimo-provided subdomain (`fimo domains rename-default`, free), attaching a domain they already own (`fimo domains add`, Premium), and buying a new domain through Fimo (`fimo domains buy`, Premium).
132
133
 
133
134
  ## Anti-Patterns
134
135
 
@@ -22,7 +22,7 @@ fimo validate # project build and codegen checks
22
22
  fimo deploy # push to main — this also wires the declared triggers
23
23
  fimo agents run <name> # trigger a manual run → sessionId
24
24
  fimo agents runs <name> # see past sessions
25
- fimo agents report <name> # print a run's report (the agent's final message)
25
+ fimo agents report <name> # print a run's outcome summary
26
26
  fimo agents logs <name> # stream a session's log
27
27
  ```
28
28
 
@@ -56,44 +56,144 @@ integrations:
56
56
  An explicit map is restrictive: only entries set to `true` are available. An omitted or disabled integration cannot be
57
57
  used. See `references/integrations.md` for project setup, auth, and provider-specific commands.
58
58
 
59
+ ## How a cloud run ends
60
+
61
+ Fimo creates one task Branch and environment for a cloud run, tells the agent their names, and manages their lifecycle.
62
+ The agent works only in that checkout. Extra branches, worktrees, and `git push` are unsupported and cannot be cleaned up
63
+ or handed off correctly.
64
+
65
+ - **Merge** when the work is ready for the target Branch. Fimo applies the complete task environment or, if it conflicts,
66
+ leaves the target unchanged and keeps the work for review without choosing a side.
67
+ - **Retain** when the completed work should be reviewed before merge, or when the run stops, fails, or may need recovery.
68
+ Fimo leaves the target unchanged, keeps the complete task Branch, and sends an Inbox notification asking a person to
69
+ review all of its changes. A later follow-up can continue from that retained work.
70
+ - **Discard** when none of the run's work should be applied, including when it made no useful changes or deliberately
71
+ abandoned an approach. This permanently deletes the task Branch and every change in it without review.
72
+
73
+ If the agent exits without a decision, Fimo retains the task Branch. `fimo deploy` inside a run may build a preview of
74
+ that Branch for inspection or screenshots; it does not finish or hand off the run.
75
+
76
+ The run report is a concise outcome summary: what changed, what was verified, and what is still blocked. It is not a
77
+ chronological account, and it should not use decorative emoji.
78
+
79
+ ## Define the agent's decision policy
80
+
81
+ When authoring or editing an agent, add a short **Decision policy** to its `GOAL.md`. Describe the domain conditions for
82
+ acting, asking, review, and merge; do not copy Fimo's tool protocol. Use this shape and replace the examples with rules
83
+ specific to the agent:
84
+
85
+ ```md
86
+ ## Decision policy
87
+
88
+ - Proceed without asking when the work is within scope and a safe, reversible choice exists.
89
+ - Ask when a missing human decision changes what the correct result should be.
90
+ - Retain when the work is complete but all changes should be reviewed before merge.
91
+ - Request merge only when the result is complete, verified, and clearly safe for this agent's scope.
92
+ - Discard when the run produced no useful changes or deliberately abandoned them.
93
+ ```
94
+
95
+ Asking and review are different: `ask_user` is for a decision required before correct work can continue; `retain` ends
96
+ the run with its complete proposal waiting for review and does not ask a question.
97
+
98
+ Make those rules concrete enough that the agent can decide without guessing. For example:
99
+
100
+ - **Broken-link sweeper:** fix and request merge for up to ten internal links when each replacement is unambiguous and
101
+ the link check passes. Ask when two plausible destinations change the page's meaning. Retain useful fixes if complete
102
+ verification is blocked. Discard when the scan is clean or exploratory edits were reverted.
103
+ - **Launch-copy agent:** draft from an approved brief without asking about routine wording. Ask before choosing pricing,
104
+ product promises, brand direction, or deletions. Retain every completed draft for human review; never request merge.
105
+ - **Read-only auditor:** inspect and report autonomously. Ask only when the requested scope cannot be inferred. Discard
106
+ the unchanged task environment after recording the report.
107
+ - **Missing capability:** ask once for the exact capability and explain which operation it unlocks. Do not retain partial
108
+ work as a substitute for the blocking permission decision.
109
+
110
+ A review-first content agent could use this complete policy:
111
+
112
+ ```md
113
+ ## Decision policy
114
+
115
+ - Draft all requested copy without asking when the brief and approved source material answer the content decisions.
116
+ - Ask before inventing a price, product promise, legal claim, brand direction, or deleting existing content.
117
+ - Group every blocking decision and missing capability into one question.
118
+ - Retain every completed draft so a person reviews all changes before merge. Never request merge directly.
119
+ - Discard only when no useful draft was produced or the attempted approach was fully abandoned.
120
+ ```
121
+
122
+ When a run cannot continue correctly without a decision from a project member, it may call `ask_user` instead. The
123
+ question goes to the Fimo Inbox, the current invocation ends, and Fimo keeps the same task Branch and environment until
124
+ an authorized member answers. The answer starts one ordinary continuation in the same run thread; the original model
125
+ process does not wait.
126
+
127
+ Use `ask_user` sparingly, especially from scheduled agents:
128
+
129
+ - Ask only for a genuinely blocking human decision. Prefer a safe reversible default when one exists.
130
+ - Group every known blocker into one form with 1–4 related steps. Give it a 1–3 sentence description that says where
131
+ the work stands and why the decision matters or what it unlocks; keep implementation detail in the run.
132
+ - Use choices for compact text options. Use cards only when an option benefits from an image or a richer title and
133
+ subtitle. Use assets when the image itself is the answer, and tables when options need the same structured comparison.
134
+ - Do not repeat a question or request already waiting in prior run history.
135
+ - Use `finish_run` with `retain` when the work is ready for review but no answer is required.
136
+
137
+ An agent may include one multi-select `capabilities` step in that same form to request public Fimo capabilities it does
138
+ not currently hold. Group related tokens in one request. Selected tokens apply only to the continuation started by that
139
+ answer; unselected tokens are denied, selecting none is valid, and the blocked invocation never gains new authority.
140
+ Internal runtime abilities, integration setup, and OAuth are not capability requests.
141
+
142
+ At the start of a run, `run_history` provides bounded summaries of earlier outcomes and work still awaiting a person. An agent
143
+ may also maintain `.fimo/agents/<name>/MEMORY.md` as an ordinary reviewed file for durable facts that change future
144
+ behavior. Keep it under 4 KB, record no secrets or run log, and prune stale entries before adding new ones.
145
+
146
+ When three or more earlier runs still await a question answer, review, conflict resolution, or recovery, the agent
147
+ normally starts no new independent work. Unless the current trigger explicitly asks it to proceed anyway, it makes no
148
+ changes and finishes with `discard` and a brief report of what is waiting.
149
+
59
150
  ## Capabilities
60
151
 
61
152
  Capabilities describe the opt-in Fimo and network actions an agent may take. Managed agents always receive project
62
153
  filesystem access, a shell, and the ability to commit their task-environment changes; Fimo owns branch creation and
63
- publication. If `capabilities.yaml` is absent or empty, the agent has those project-worker tools but no Fimo API
64
- permissions or web-fetch tool. Once you add a capabilities file, list every Fimo or network permission the agent needs.
65
- There is no all-capabilities wildcard; keeping the list explicit makes each agent's power reviewable.
66
-
67
- | Capability | Allows the agent to | Risk |
68
- | ---------------------------- | ------------------------------------------- | ------------ |
69
- | `cms:read` | Read CMS content | Low |
70
- | `cms:write` | Create, update, or delete CMS entries | Medium |
71
- | `cms:schema:read` | Read CMS schemas | Low |
72
- | `cms:schema:write` | Modify CMS schemas | High |
73
- | `assets:read` | Read uploaded media | Low |
74
- | `assets:write` | Upload, replace, or delete media | Medium |
75
- | `i18n:read` / `i18n:write` | Read / modify translation catalogs | Low / Medium |
76
- | `forms:read` / `forms:write` | Read / modify form schemas and submissions | Low / Medium |
77
- | `webhooks:read` | Read webhook configs and deliveries | Low |
78
- | `webhooks:write` | Create, modify, delete, or trigger webhooks | High |
79
- | `schedules:read` | Read schedule configs and run history | Low |
80
- | `schedules:write` | Create, change, or trigger scheduled runs | Critical |
81
- | `fimo:logs:read` | Read project deployment logs | Low |
82
- | `fimo:analytics:read` | Read analytics data | Low |
83
- | `fimo:preview:read` | Read a current preview URL | Low |
84
- | `fimo:history:read` | Read project restore points | Low |
85
- | `fimo:deploy` | Trigger a production deploy | Critical |
86
- | `net:fetch` | Make outbound HTTP requests | Medium |
87
- | `agent:delegate` | Invoke declared sub-agents | Medium |
88
- | `runtime:long_running` | Run beyond the default time limit | High |
89
- | `runtime:auto_merge` | Auto-merge trivial proposed branches | Critical |
90
-
91
- If a capability is missing, the related command is denied and the agent should choose another path or report the
92
- blocker. Add the capability to `capabilities.yaml`, run `fimo agents validate <name>`, deploy the bundle, and start a
93
- new run. A denied capability does not grant access to anything else.
94
-
95
- Studio chat and project-bound Slack turns receive `fimo:logs:read`. Autonomous agents receive it only when their
96
- `capabilities.yaml` declares it; use `fimo logs` with the deploy guidance when diagnosing a failed preview.
154
+ publication. If `capabilities.yaml` is absent or empty, the agent keeps baseline project reads such as agent run history,
155
+ but receives no CMS, asset, or other domain-operation scope and no web-fetch tool. Once you add a capabilities file,
156
+ list every Fimo or network permission the agent needs.
157
+ Namespace selectors such as `cms:*`, `assets:*`, `i18n:*`, and `forms:*` grant every current and future declarable capability
158
+ in that namespace. Fimo expands selectors to concrete grants when a run starts. Use exact tokens for narrower agents.
159
+ The default template includes those four selectors plus read access to analytics, deployment logs, history, previews,
160
+ webhooks, and schedules; remove entries when an agent should have less access.
161
+
162
+ | Capability | Allows the agent to | Risk |
163
+ | ------------------------------------------- | ------------------------------------------------------------------------- | ------------ |
164
+ | `cms:read` | Read CMS content | Low |
165
+ | `cms:write` | Create, update, or delete CMS entries | Medium |
166
+ | `cms:schema:read` | Read CMS schemas | Low |
167
+ | `cms:schema:write` | Modify CMS schemas | High |
168
+ | `assets:read` | Read uploaded media | Low |
169
+ | `assets:write` | Upload, replace, or delete media | Medium |
170
+ | `i18n:read` / `i18n:write` | Read / modify translation catalogs | Low / Medium |
171
+ | `cms:*` / `assets:*` / `i18n:*` / `forms:*` | Every declarable capability in that namespace, including future additions | Mixed |
172
+ | `forms:read` / `forms:write` | Read / modify form schemas and submissions | Low / Medium |
173
+ | `webhooks:read` | Read webhook configs and deliveries | Low |
174
+ | `webhooks:write` | Create, modify, delete, or trigger webhooks | High |
175
+ | `schedules:read` | Read schedule configs and run history | Low |
176
+ | `schedules:write` | Create, change, or trigger scheduled runs | Critical |
177
+ | `fimo:logs:read` | Read project deployment logs | Low |
178
+ | `fimo:analytics:read` | Read analytics data | Low |
179
+ | `fimo:preview:read` | Read a current preview URL | Low |
180
+ | `fimo:history:read` | Read project restore points | Low |
181
+ | `fimo:deploy` | Trigger a production deploy | Critical |
182
+ | `net:fetch` | Make outbound HTTP requests | Medium |
183
+ | `agent:delegate` | Invoke declared sub-agents | Medium |
184
+ | `runtime:long_running` | Run beyond the default time limit | High |
185
+ | `runtime:auto_merge` | Auto-merge trivial proposed branches | Critical |
186
+
187
+ If a public Fimo capability is missing and the work is genuinely blocked, the agent can request it through `ask_user`.
188
+ Fimo grants only the selected subset to the next invocation in that run thread. Unknown capabilities, internal runtime
189
+ abilities, and capabilities the run already holds are refused before the question is stored. For durable access on
190
+ ordinary future runs, add the capability to `capabilities.yaml`, validate, and deploy the bundle.
191
+
192
+ Managed agents can list project agents and read their run history through baseline project access. This does not
193
+ require `fimo:agents:run`; that capability is only required to dispatch another agent.
194
+
195
+ Studio chat and project-bound Slack turns receive `fimo:logs:read`. The default autonomous-agent template now declares
196
+ it too; custom templates still need to declare it before using `fimo logs` to diagnose a failed preview.
97
197
 
98
198
  Example for a content editor that can read and update entries but cannot change schemas:
99
199
 
@@ -113,7 +213,7 @@ fimo agents logs <name> [--session <id>] [--project <id>] [-C <dir>]
113
213
 
114
214
  - **`run <name>`** — fire the agent's `manual` trigger on the server; prints a `sessionId` on success. Skips with `no-manual-trigger` when `config.yaml` declares none, or `trigger-not-wired` when the push-to-main sync recorded the trigger but refused to wire it (see the wiring note below). **Pre-flight drift check**: if `.fimo/agents/<name>/` (or the legacy root bundle) has uncommitted git changes, the command refuses — the server would dispatch the _deployed_ version, so deploy first. Pass `--skip-drift-check` to dispatch the deployed bundle anyway. Defaults `--branch` to `main`; legacy `--env` remains an alias.
115
215
  - **`runs <name>`** — list past run sessions for the agent in a compact table (id, started, duration, status, trigger, Branch, cost). Default `--limit 20`; `--branch` filters to one Branch. The response's legacy `env` field is still present for API compatibility.
116
- - **`report <name>`** — print a run's **report**: the agent's final message, captured when the run finishes (for a read-only agent like `seo-audit` this _is_ the audit; for a write agent it's a "what I changed" summary). With no `--session`, the most recent run for `<name>` is used (combine with `--branch` to scope); `--session <id>` targets a specific run. Output is raw markdown, so it stays readable in the terminal and pipes cleanly (e.g. `fimo agents report seo-audit | glow`). If the run hasn't finished, or produced no message, it says so (and shows the stop reason when there is one). This is the command to read what a run actually produced — see the `logs` note below.
216
+ - **`report <name>`** — print a run's **report**: its durable outcome summary (for a read-only agent like `seo-audit` this _is_ the audit; for a write agent it's a "what I changed" summary). A run that never finalised falls back to its last message. With no `--session`, the most recent run for `<name>` is used (combine with `--branch` to scope); `--session <id>` targets a specific run. Output is raw markdown, so it stays readable in the terminal and pipes cleanly (e.g. `fimo agents report seo-audit | glow`). If the run hasn't finished, or produced no message, it says so (and shows the stop reason when there is one). This is the command to read what a run actually produced — see the `logs` note below.
117
217
  - **`logs <name>`** — stream a run's log (defaults to the latest session; `--session <id>` targets one). **Note:** the log-streaming endpoint is still a server-side stub at time of writing — the command prints a placeholder rather than real log lines. To read a finished run's output today, use `report`.
118
218
 
119
219
  ## How triggers get wired
@@ -35,7 +35,7 @@ fimo --branch <name> <command> # peek at another Branch for one command (does n
35
35
  | `fimo diff [from] [to]` | `git diff` | Two-Branch diff across all surfaces. Defaults `from` = current Branch, `to` = `main`. `--surface <name>` limits to one; `--json`; `--no-color`. |
36
36
  | `fimo status` | `git status` | Multi-surface status for the current Branch vs its parent. See below. |
37
37
  | `fimo merge <from>` | `git merge` | Merge another Branch into the current one (multi-surface, atomic, interactive conflict resolver). See below. |
38
- | `fimo publish` | — | Tag `main@HEAD` as `release/<version>` and trigger the prod swap. See "Publishing" below. |
38
+ | `fimo publish` | — | Publish the already-synced `main` revision with a stable Fimo publication ID. See "Publishing" below. |
39
39
 
40
40
  All of these accept the global `--branch` override; legacy `--env` remains an alias. `diff`, `status`, `merge`, and `publish` additionally accept `-C, --cwd <dir>` to point at a project directory.
41
41
 
@@ -59,7 +59,7 @@ fimo preview url # canonical URL to open / screenshot the feat/s
59
59
  fimo status # see what changed vs main, surface by surface
60
60
  fimo checkout main # back to main
61
61
  fimo merge feat/seo # merge the Branch back into main (resolve conflicts)
62
- fimo publish --version 1.4.0 # tag a release + prod swap
62
+ fimo publish --label "Homepage launch" --notes "Initial production publish"
63
63
  fimo branch -d feat/seo # tear down the feature Branch
64
64
  ```
65
65
 
@@ -97,10 +97,10 @@ Syncs the current Branch's data plane from its parent (or `--from <ancestor>`).
97
97
 
98
98
  Two different "go live" mechanisms — don't confuse them:
99
99
 
100
- - **`fimo publish --version <ver> [--notes <md>]`** — the release path. Runs from `main` only, validates, tags `main@HEAD` as `release/<ver>`, and triggers the prod swap. `--skip-validate` is an operator override. This is the versioned, prod-facing publish.
100
+ - **`fimo publish [--label <text>] [--notes <md>]`** — publishes the already-synced `main` revision. Fimo assigns the immutable publication ID; the label and notes are optional annotations. `--skip-validate` is an operator override.
101
101
  - **`fimo deploy --publish`** — the project-publish path. Pushes the current `main` code and flips the project live in one shot. See `references/deploy.md`.
102
102
 
103
- Use `fimo publish` for versioned prod releases; use `fimo deploy --publish` for the simple "ship what's on main now" flow. Both only run from `main`.
103
+ Use `fimo publish` when `main` is already synced; use `fimo deploy --publish` when the local revision still needs to be pushed first. Both only run from `main`.
104
104
 
105
105
  ## Anti-patterns
106
106
 
@@ -56,6 +56,15 @@ Use the publication ID returned by the failed command: run `fimo publish inspect
56
56
 
57
57
  If the sandbox fails to install dependencies or start the app, run `fimo logs --json` before retrying. Read the newest install and dev-server events first; when the response is truncated, use its `previousCursor` as `fimo logs --before <cursor> --json` to fetch the preceding page. Do not recreate or replace the sandbox before collecting logs, because that can discard the failure evidence.
58
58
 
59
+ When Preview reports blocked dependency build scripts, treat that as a project security-policy repair, not a transient sandbox failure. Review every named package before approving it, then use the package manager's narrow project-owned mechanism:
60
+
61
+ - **pnpm:** add each approved package to `allowBuilds` in `pnpm-workspace.yaml`.
62
+ - **Yarn:** set `dependenciesMeta.<package>.built` in `package.json` for each approved package.
63
+ - **Bun:** add approved packages to `trustedDependencies` in `package.json`, or run the exact `bun pm trust <packages>` command Preview reports.
64
+ - **npm:** npm has no equivalent per-package approval error. Diagnose the failing lifecycle script itself; do not turn a generic npm script failure into a trust-policy change.
65
+
66
+ Run the same plain install locally and commit the policy plus lockfile before retrying Preview. Never bypass the error with `dangerouslyAllowAllBuilds`, `enableScripts`, or another global allow-all switch: Preview and publishing intentionally consume the committed project policy.
67
+
59
68
  ## Framework hosting
60
69
 
61
70
  Fimo preview resolves `runtime.commands` override → package script → detected
@@ -113,9 +122,9 @@ There's nothing special about this — it's the same `fimo deploy` you'd run lat
113
122
  Two different "go live" mechanisms — pick deliberately:
114
123
 
115
124
  - **`fimo deploy --publish`** — push what's on `main` now and flip the project live in one shot. The simple "ship it" path. Runs from `main` only.
116
- - **`fimo publish --version <ver> [--notes <md>]`** — the **versioned release** path. From `main`, it validates, tags `main@HEAD` as `release/<ver>`, and triggers the prod swap. Use this when the user wants a real, tagged production release (e.g. "cut v1.4.0", "publish a new version"). See `references/branches.md`.
125
+ - **`fimo publish [--label <text>] [--notes <md>]`** — publish the already-synced `main` revision without pushing. Fimo assigns the immutable publication ID; a label and notes are optional human annotations. See `references/branches.md`.
117
126
 
118
- When unsure, `fimo deploy --publish` is the lighter-weight default; reach for `fimo publish` only when versioning/release semantics are wanted.
127
+ When unsure, use `fimo deploy --publish` so the local revision is pushed before it goes live. Use `fimo publish` when `main` is already synced.
119
128
 
120
129
  ## Markdown for AI agents
121
130
 
@@ -56,6 +56,18 @@ When a user says "I want to change my website's URL," ask which case fits:
56
56
 
57
57
  If they aren't sure, run `fimo domains suggest-default` first — it's free, takes one step, and a good fallback if they don't want to commit to a domain purchase.
58
58
 
59
+ ## Offer a cleaner default URL before first publish
60
+
61
+ After the automatic first-preview deploy on a newly created project, offer a cleaner free `*.fimo.site` URL before the first public publish when there is no custom domain and the current default slug still looks generated or was never explicitly chosen. Choosing it now lets the first public launch use the clean URL. Skip the offer if the user already chose the default slug, attached a custom domain, or declined.
62
+
63
+ The default URL is free and needs no DNS. A custom domain is the separate Premium workflow above. A default slug can be reserved before publication, but it returns "Project Not Found" until the site is published. Renaming changes the address that will become public, so never silently claim a suggestion:
64
+
65
+ 1. Run `fimo domains suggest-default --base "<brand>" --json` to get candidates.
66
+ 2. Show the candidates and ask the user to choose one explicitly.
67
+ 3. After confirmation, run `fimo domains rename-default <slug>` or `fimo domains suggest-default --pick <slug>`.
68
+
69
+ Choosing the slug does not publish the site. The first successful `fimo deploy --publish` makes the renamed URL resolve.
70
+
59
71
  ## Pricing & how money moves
60
72
 
61
73
  The CLI never charges directly. Two distinct money paths:
@@ -15,6 +15,8 @@ fimo init [dir] [options]
15
15
  3. **Installs dependencies** — prompts for the package manager, or honor `--package-manager <pm>` / `--no-install`.
16
16
  4. **Optionally sets up Fimo skills** — confirm prompt, or `--skills` / `--no-skills`.
17
17
 
18
+ Generated pnpm projects pin `pnpm@10.26.0` and carry project-owned `pnpm-workspace.yaml#strictDepBuilds: true` and `#allowBuilds` settings. Generated Bun projects trust the same required packages through `package.json#trustedDependencies`. Keep the selected package manager's policy committed. When adding a dependency with an install script, review it before extending that policy; never replace it with a blanket allow-all install.
19
+
18
20
  | Flag | Required | Purpose |
19
21
  | ---------------------------- | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
20
22
  | `[dir]` positional | yes in non-TTY for create-new | Target directory (e.g. `my-site`) |
@@ -163,6 +165,8 @@ fimo deploy -m "chore: first preview" --json
163
165
 
164
166
  This first deploy creates a preview only — never add `--publish`, and treat every later deploy as offer-then-confirm. The rule does not apply when `init` cloned a project with existing code or when the work is a migration; those paths keep their normal deployment approval rules.
165
167
 
168
+ After the preview succeeds, follow `references/domains.md` § Offer a cleaner default URL before first publish. Reserve a slug only after the user chooses it; the URL will not resolve until the site is published.
169
+
166
170
  ## Adding another AI tool to an existing project later
167
171
 
168
172
  If a teammate joins on a different AI tool (e.g. Cursor) after the project was scaffolded for claude-code only:
@@ -104,7 +104,7 @@ These canonical entries are also the optional metadata used by Studio Pages. See
104
104
 
105
105
  For every framework, the application owns its URL scheme, resolves the locale, and passes it into Fimo. Studio stores the locale the app reports for the current location — including when only the locale changed — and reads content in it. Route metadata is optional unless the project wants Fimo Studio route selection/navigation.
106
106
 
107
- Astro and Next express the same optional-locale semantic with paired native filesystem route trees: an unprefixed default-locale tree and a prefixed non-default tree. Neither framework supports an optional single-segment filesystem folder.
107
+ Neither Astro nor Next supports an optional single-segment filesystem folder. Astro's starter expresses an optional-locale semantic with paired native filesystem route trees. The Next starter is default-only; a Next application adds a `[locale]` tree or another application-owned strategy only when the product requires locale URLs.
108
108
 
109
109
  ## Migrate An Existing Locale System
110
110
 
@@ -60,7 +60,7 @@ The Project MCP catalog covers:
60
60
  - **Identity and navigation** — current user, projects, and Branches.
61
61
  - **Content** — schemas, collection entries, search, create/update/delete, bounded bulk operations, and Singles.
62
62
  - **Labels** — list, read, set, batch-set, and delete localized labels.
63
- - **Media** — list and inspect assets, generate images or videos, create folders, move, and delete assets. Binary
63
+ - **Media** — list and inspect assets, read canonical pages or ask one targeted question with `assets_read`, generate images or videos, create folders, move, and delete assets. Binary
64
64
  upload remains `fimo assets upload`.
65
65
  - **Forms** — create, read, update, and delete forms; inspect submissions and statistics.
66
66
  - **Files** — read, glob, grep, write, edit, and delete project files within the scoped Branch. Sensitive files
@@ -159,11 +159,28 @@ Do not generate when:
159
159
 
160
160
  Upload real files with `fimo assets upload`. Browse reusable media with `fimo assets list` before spending credits.
161
161
 
162
+ ## Inspect an existing asset
163
+
164
+ Open the original when visual or binary inspection is required. Read canonical text when exact portable understanding
165
+ is required:
166
+
167
+ ```bash
168
+ fimo assets open <asset-id> --download
169
+ fimo assets read <asset-id>
170
+ fimo assets read <asset-id> --cursor <next-cursor>
171
+ fimo assets read <asset-id> --query "<one targeted question>"
172
+ ```
173
+
174
+ For a complete exact read, keep following `nextCursor` until `complete` is `true`. Never combine `--cursor` and
175
+ `--query`. Complete readable interpretation is lazy and cached, separately from compact Media Library alt/caption
176
+ metadata. A 3D read includes four reusable rendered views. Download ZIP archives and inspect them in the sandbox; do
177
+ not expect server-side extraction.
178
+
162
179
  ## Verification
163
180
 
164
181
  After generation:
165
182
 
166
183
  1. Confirm the command exited successfully and returned an asset ID.
167
- 2. Open or download the asset with `fimo assets open <id>`.
184
+ 2. Open the original with `fimo assets open <id>`, or read its canonical understanding with `fimo assets read <id>`.
168
185
  3. Verify it matches the request before inserting it into content or UI.
169
186
  4. Use the whole media value with Fimo's `<Image>` or `<Video>` components rather than raw HTML elements.
@@ -18,7 +18,7 @@ fimo projects rename <name> [projectId] [-C <dir>] # set seo.siteName in the l
18
18
  - **`create`** — identical to `fimo init` (create-new path); see `references/init.md`.
19
19
  - **`clone`** — clone a remote Fimo project's git repo to your machine and write the local `.fimo/project.json` and agent files. Use `fimo clone <projectId>` when scripting or when the ID is known. In an interactive terminal, bare `fimo clone` opens a project picker for the active org; JSON mode and non-TTY shells require an explicit project ID and fail fast instead of prompting. By default it clones `main`; pass `--branch <name>` to clone a specific Branch. The legacy `--env <name>` spelling remains a compatibility alias. The target directory defaults to the project display name/name, or pass `[dir]` explicitly.
20
20
  - **`delete`** — destructive; prompts unless `-y`. Removes the remote project.
21
- - **`publish` / `unpublish`** — toggle the project's public visibility. `publish` flips the current `main` state live (the same "go live" as `fimo deploy --publish`, minus the git push). This is **not** the versioned release path — for that, see `fimo publish` in `references/branches.md`.
21
+ - **`publish` / `unpublish`** — toggle the project's public visibility. `publish` flips the current `main` state live (the same "go live" as `fimo deploy --publish`, minus the git push).
22
22
  - **`rename`** — edits only the linked local project immediately. It requires a project marker in the cwd, and if you pass a `[projectId]` that doesn't match the linked project it errors and exits 1 (so you can't rename a different project). It writes `seo.siteName` into the current or legacy project config; commit and run `fimo deploy` to reconcile the remote `displayName` and deploy the new site name.
23
23
 
24
24
  ## Top-level clone shortcut
@@ -41,12 +41,12 @@ fimo rename "<Site Name>" # local edit: set seo.siteName in the project c
41
41
 
42
42
  `fimo rename` sets the **site name** (`seo.siteName`) in the local project config — it is a local edit, not an immediate remote update, so it requires a follow-up commit + `fimo deploy` to take effect. Deploy reconciles the project's remote `displayName` with the committed site name while pushing the config. See `references/init.md` and `references/deploy.md`.
43
43
 
44
- ## Three "publish" verbs — don't confuse them
44
+ ## Publish commands
45
45
 
46
- | Command | Effect |
47
- | ---------------------------- | -------------------------------------------------------------- |
48
- | `fimo deploy --publish` | Push current `main` + flip the project live in one shot. |
49
- | `fimo projects publish` | Flip the project live (no git push). |
50
- | `fimo publish --version <v>` | Tag `release/<v>` + trigger the prod swap (versioned release). |
46
+ | Command | Effect |
47
+ | ----------------------- | ----------------------------------------------------------------------- |
48
+ | `fimo deploy --publish` | Push current `main` + flip the project live in one shot. |
49
+ | `fimo projects publish` | Flip the project live (no git push). |
50
+ | `fimo publish` | Flip the already-synced `main` revision live; optional label and notes. |
51
51
 
52
52
  See `references/deploy.md` and `references/branches.md` for the full picture.
@@ -35,13 +35,13 @@ When labels are not needed at that boundary, use `<FimoProvider locale={locale}>
35
35
 
36
36
  ## New-project boundary
37
37
 
38
- Choose the primary locale from the user's request before building pages. Put the first explicitly requested locale in `.fimo/config.json#i18n.defaultLocale` and keep all requested locales in `i18n.locales`. That edit is the whole locale setup: `src/locales.ts` reads the file, so the default locale passed to `FimoProvider`, the `<html lang>` of each tree, and the set of prefixed URLs follow it. If the user gives no locale signal, keep `en` and state that choice. Never add `NEXT_PUBLIC_FIMO_DEFAULT_LOCALE` or `FIMO_DEFAULT_LOCALE`; the runtime ignores them by design.
38
+ Choose the primary locale from the user's request before building pages. Put the first explicitly requested locale in `.fimo/config.json#i18n.defaultLocale` and keep all requested locales in `i18n.locales`. That is content and provider configuration: `src/locales.ts` reads the file, so the default locale passed to `FimoProvider` and the `<html lang>` follow it. It does not create locale URLs. If the user gives no locale signal, keep `en` and state that choice. Never add `NEXT_PUBLIC_FIMO_DEFAULT_LOCALE` or `FIMO_DEFAULT_LOCALE`; the runtime ignores them by design.
39
39
 
40
- The starter keeps default routes in an unprefixed `app/(default)` route group and a native `app/[locale]` tree for the other locales. Only a root layout may render `<html>`, so each tree owns its root layout and renders the shared `src/components/Document.tsx` with its locale: the unprefixed tree with `defaultLocale`, the prefixed tree with `params.locale`. The prefixed layout 404s a locale that is not in `prefixedLocales`, which is why the default locale has exactly one URL. For `/:locale/pricing`, `params.locale.optional: true` means omit the configured default locale: with `i18n.defaultLocale: "en"`, `/pricing` is English and `/fr/pricing` is French. With `optional: false`, both `/en/pricing` and `/fr/pricing` are prefixed. The default locale value chooses the fallback locale; `optional` independently controls URL prefixes. A route without `:locale` remains application-owned.
40
+ The starter is default-only: one ordinary root layout renders `<html lang={defaultLocale}>` and `FimoProvider`, `/` is the homepage, and unknown paths get Next's native 404. Implement a locale routing strategy only when the product asks for one — prefixed `[locale]` segments, middleware, cookies, domains, or an i18n library are all Next decisions — then resolve the locale in that strategy and pass it into Fimo server reads and `FimoProvider`. Do not install a top-level `[locale]` route or an optional catch-all speculatively: it captures `/favicon.ico` and every unknown top-level path, and Fimo never requires it.
41
41
 
42
- Next.js has no optional single-segment route folder, so mirror localized routes in both existing groups as the site grows. Astro uses the same paired native filesystem-tree shape for this semantic. Do not replace the trees with middleware, rewrites, an optional catch-all that captures the application route tree, or a Fimo route helper. The config route catalog describes the URL shapes for Studio; Next's `app` directory remains authoritative.
42
+ When the app implements a localized URL shape, describe it in `.fimo/config.json#routes` for Studio. For `/:locale/pricing`, `params.locale.optional: true` means omit the configured default locale: with `i18n.defaultLocale: "en"`, `/pricing` is English and `/fr/pricing` is French. With `optional: false`, both `/en/pricing` and `/fr/pricing` are prefixed. The default locale value chooses the fallback locale; `optional` independently controls URL prefixes. A route without `:locale` remains application-owned. The config route catalog describes URL shapes for Studio; Next's `app` directory remains authoritative.
43
43
 
44
- Keep the starter's client-only `src/components/FimoPreviewBridge.tsx` inside `Document`, so both trees mount it. It reads Next's native pathname/router, reports the settled locale to Studio, and lets Studio navigate through Next; do not move Next imports into Fimo's shared runtime.
44
+ `FimoProvider` owns the optional Studio preview runtime, including Next navigation and script loading. Application code only passes its resolved locale to the provider. Do not add a preview bridge component, read Fimo preview environment variables, or inject Fimo scripts.
45
45
 
46
46
  With `next-i18next`, keep its routing and translation provider for the strings it owns. Pass the same resolved locale to Fimo; do not replace the library or duplicate its route structure.
47
47
 
@@ -133,6 +133,7 @@ For new projects, apply `references/locales.md`, keep the starter's `:locale?` r
133
133
  ## Boundaries
134
134
 
135
135
  - Route modules and `meta` exports own routing and SEO.
136
- - `FimoScripts` owns preview-script loading; do not add the overlay script manually.
136
+ - `FimoProviders` owns the optional Studio preview runtime. Do not read Fimo preview environment variables or inject its script in application code.
137
+ - `FimoScripts` owns document-only JSON-LD and the development error overlay.
137
138
  - Use `fimo deploy` only when the developer requests a hosted preview or publication.
138
139
  - Load `references/ui.md` for rendering and `references/locales.md` for locale ownership.
@@ -127,11 +127,9 @@ export const actions = {
127
127
 
128
128
  ## Live preview
129
129
 
130
- `FimoProvider` owns the Studio browser bridge. On mount it reads
131
- `PUBLIC_FIMO_PREVIEW_SCRIPT_URL` from SvelteKit's dynamic public environment,
132
- loads that script once, delegates navigation to SvelteKit's `goto`, and
133
- refreshes data with `invalidateAll()`. Without that environment value it does
134
- nothing. Do not add a second preview component.
130
+ `FimoProvider` owns the optional Studio preview runtime, including script
131
+ loading, SvelteKit navigation, and content refresh. Do not add a second preview
132
+ component, read Fimo preview environment variables, or inject Fimo scripts.
135
133
 
136
134
  ## Boundaries
137
135
 
@@ -13,7 +13,7 @@ The application owns locale resolution and routing. Fimo consumes the resolved l
13
13
  }
14
14
  ```
15
15
 
16
- For new projects, derive the primary locale from the request; when several are explicit, the first one named is the default. Update `i18n.defaultLocale`, `i18n.locales`, the framework-native route boundary and matcher, and the document language default. If the user gives no locale signal, retain the starter default and state that choice.
16
+ For new projects, derive the primary locale from the request; when several are explicit, the first one named is the default. Update `i18n.defaultLocale`, `i18n.locales`, the document language default, and any framework-native locale route boundary or matcher the application implements. If the user gives no locale signal, retain the starter default and state that choice.
17
17
 
18
18
  Keep one locale unless the product asks for multilingual output. Keep it locale-ready without forcing `/en`, a language switcher, global path-prefix routing, or localized schemas. Locale tags should be structurally valid, such as `en`, `pt-BR`, or `zh-Hans`.
19
19
 
@@ -45,4 +45,4 @@ For an already linked project, enable each locale in Fimo before writing non-def
45
45
 
46
46
  Do not replace an existing locale system merely to add Fimo. Do not duplicate localized routes in the Studio catalog. Every framework resolves its active locale and passes it to Fimo through that framework's provider or server-read seam.
47
47
 
48
- Astro and Next implement an optional locale boundary with paired native filesystem route trees: one unprefixed tree for the default locale and one prefixed tree for the other locales. Neither framework has an optional single-segment filesystem folder.
48
+ Neither Astro nor Next has an optional single-segment filesystem folder; an optional locale boundary in those frameworks is paired native filesystem route trees, one unprefixed for the default locale and one prefixed for the others. The Astro starter ships that pair; the Next starter is default-only, so a Next application adds a `[locale]` tree (or another strategy) only when the product asks for prefixed URLs.