fimo 2.6.0 → 2.7.0-staging.2

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 (36) hide show
  1. package/assets/skills/fimo-cli/SKILL.md +1 -1
  2. package/assets/skills/fimo-cli/references/agents.md +1 -1
  3. package/assets/skills/fimo-cli/references/analytics.md +14 -0
  4. package/assets/skills/fimo-cli/references/content.md +2 -2
  5. package/assets/skills/fimo-cli/references/hosting.md +11 -0
  6. package/assets/skills/fimo-cli/references/locales.md +2 -2
  7. package/assets/skills/fimo-cli/references/pages.md +14 -2
  8. package/assets/skills/fimo-code/references/frameworks/astro.md +2 -0
  9. package/assets/skills/fimo-code/references/frameworks/next.md +12 -9
  10. package/assets/skills/fimo-code/references/ui.md +6 -1
  11. package/assets/skills/fimo-migration/SKILL.md +9 -6
  12. package/assets/skills/fimo-migration/references/frameworks/nextjs.md +24 -27
  13. package/assets/skills/fimo-migration/references/media.md +98 -62
  14. package/assets/skills/fimo-migration/references/qa.md +111 -11
  15. package/assets/skills/fimo-migration/references/workers/content-execution.md +2 -1
  16. package/assets/skills/fimo-migration/references/workers/validator.md +22 -6
  17. package/assets/skills/fimo-migration/references/workers.md +5 -3
  18. package/assets/skills/fimo-migration/scripts/check-rendered-guardrails.mjs +500 -0
  19. package/assets/skills/fimo-studio/references/agents.md +2 -0
  20. package/assets/skills/fimo-studio/references/publish-and-deploy.md +1 -0
  21. package/dist/cli/bundle.json +1 -1
  22. package/dist/cli/index.js +26 -26
  23. package/dist/runtime/paths/get-fimo-paths.d.ts +3 -1
  24. package/dist/runtime/paths/get-fimo-paths.js +59 -5
  25. package/dist/runtime/primitives/lib/primitives.d.ts +20 -1
  26. package/dist/runtime/primitives/lib/primitives.js +24 -1
  27. package/dist/runtime/routes/index.d.ts +19 -3
  28. package/dist/runtime/routes/index.js +27 -2
  29. package/dist/scripts/validate-page-registry.js +14 -3
  30. package/package.json +10 -9
  31. package/release.json +2 -2
  32. package/templates/astro/package.json +2 -2
  33. package/templates/nextjs/package.json +3 -3
  34. package/templates/react-router/package.json +4 -4
  35. package/templates/sveltekit/package.json +2 -2
  36. package/templates/vite/package.json +4 -4
@@ -104,8 +104,7 @@ items.
104
104
 
105
105
  For linked Next.js targets, the root `FimoProvider` resolves an explicit host
106
106
  connection first, otherwise `.fimo/project.json` plus the active git branch,
107
- and passes only the public connection to the browser. `withFimo` handles
108
- hosted preview origins, not this connection. Run the normal `next dev`,
107
+ and passes only the public connection to the browser. Run the normal `next dev`,
109
108
  `next build`, and `next start` commands without creating a Fimo env file.
110
109
 
111
110
  ## Hosting
@@ -113,18 +112,23 @@ hosted preview origins, not this connection. Run the normal `next dev`,
113
112
  Owned by the runtime lane; verified here read-only.
114
113
 
115
114
  - The target starts locally: the dev server responds without startup errors.
116
- - The target is embeddable in Fimo Preview, which frames the app in an iframe
117
- and drives it over the postMessage preview bridge. Development/preview
118
- responses carry no unconditional `X-Frame-Options` or CSP `frame-ancestors`
119
- block; protective headers (nosniff, HSTS, referrer policy) stay. The
120
- translation goes through `FIMO_PREVIEW_ALLOWED_ORIGINS`; `withFimo` alone
121
- does not solve headers — it only extends `allowedDevOrigins` during
122
- `next dev`.
115
+ - Fimo Preview renders the target in Fimo Studio and Edit Mode works. If either
116
+ is blocked, verify the actual framing behavior and response headers. The
117
+ application owns its security policy; any Preview exception must preserve
118
+ production protections and unrelated security headers.
119
+ - Check CSP sources by purpose: `frame-ancestors` permits the Studio parent;
120
+ the app's preview origin is the framed site. `script-src`, `connect-src`,
121
+ `frame-src`, and `form-action` use resolved/observed Fimo resources and
122
+ endpoints actually used by the iframe. Do not copy ancestor sources into
123
+ resource directives or derive them from a preview-origin variable.
124
+ - `withFimo` does not rewrite response headers. Verify any required manual
125
+ Preview adaptation of an application-owned restrictive policy.
123
126
  - The runtime report covers local startup, preview embedding, build, the
124
127
  resolved Fimo connection, header translations, and integration env-key
125
128
  names, with every claim backed by evidence.
126
129
  - With a browser available, record `browserProof` (rendered route plus console
127
- state) for startup and embedding. Without one, use deterministic HTTP
130
+ state) for startup, Studio embedding, and Edit Mode. Build or HTTP checks alone
131
+ do not prove these work. Without a browser, use deterministic HTTP
128
132
  status/header/process/log checks and mark visual proof explicitly
129
133
  unavailable in the report.
130
134
  - Deployment smoke is explicit owner opt-in; never run deploy or publish as a
@@ -157,12 +161,102 @@ Owned by the runtime lane; verified here read-only.
157
161
  fetched again after hydration. A new client waterfall, repeated full-list
158
162
  read, avoidable sequential request chain, or stale edit fails the responsible
159
163
  migration lane.
160
- - Navigation and footer links point to migrated routes or documented external URLs.
164
+ - Navigation and footer links point to migrated routes or documented external
165
+ URLs. The `links-resolve` rule below checks internal routes; the validator
166
+ reviews external destinations separately.
161
167
  - Missing integration secrets do not block these checks: build, dev, and route
162
168
  render run with the integration inert, and the missing key is a recorded
163
169
  follow-up.
164
170
  - Unsupported app behavior is not hidden behind broken UI.
165
171
 
172
+ ## Rendered guardrails (required)
173
+
174
+ Brand, legal, compliance, and navigation rules are proven on the final rendered
175
+ application, never by grepping the target source. Once copy moves into Fimo the
176
+ strings leave the repository: a source grep for a forbidden phrase passes
177
+ because nothing is there, and a grep for the brand name fails for the same
178
+ reason. Worker reports, manifests, and coverage tables are diagnostics; this
179
+ check is the acceptance evidence.
180
+
181
+ 1. Before the validation wave, the coordinator writes the guardrail inventory to
182
+ `.fimo/migration/guardrails.json` for the deterministic checker. List every
183
+ route the migration must prove and every rule the source, owner, or accepted
184
+ scope imposes. Every rule includes `source`: the source page, file, or owner
185
+ decision that requires it. A rule without a citation is an invention, not a
186
+ recovered project guardrail.
187
+ - `required-text`: copy that must render, such as the brand name or a
188
+ legally required notice.
189
+ - `forbidden-text`: copy that must never render, such as an old brand name,
190
+ placeholder text, or a claim the owner withdrew.
191
+ - `required-link`: a link every page must carry, such as the privacy policy
192
+ or imprint.
193
+ - `links-resolve`: every internal link rendered on the inventoried routes
194
+ points at an inventoried route or an explicitly allowed path prefix.
195
+
196
+ Internal links are resolved against the final document URL and any
197
+ `<base href>`; query and fragment do not change route identity. An `allow`
198
+ prefix exempts a destination family deliberately outside the accepted scope.
199
+
200
+ Scope a rule with `routes` only when it is not global. When the source has
201
+ no rule of a kind (for example no legal page), say so in the migration
202
+ report rather than leaving the inventory thin without explanation.
203
+
204
+ ```json
205
+ {
206
+ "routes": ["/", "/about", "/legal/privacy"],
207
+ "rules": [
208
+ { "id": "brand-name", "kind": "required-text", "text": "<target brand>", "source": "<source page or file>" },
209
+ {
210
+ "id": "no-old-brand",
211
+ "kind": "forbidden-text",
212
+ "text": ["<previous brand>", "Lorem ipsum"],
213
+ "source": "<owner decision>"
214
+ },
215
+ { "id": "footer-privacy", "kind": "required-link", "href": "/legal/privacy", "source": "<source navigation>" },
216
+ { "id": "nav-resolves", "kind": "links-resolve", "allow": ["/blog"], "source": "<source navigation>" }
217
+ ]
218
+ }
219
+ ```
220
+
221
+ 2. The validator observes the rendered application, not files in the
222
+ repository. For a server-rendered target, run the check with `--base-url`
223
+ while the built app serves locally. For a client-rendered target, save each
224
+ hydrated document from the browser pass as `<captures>/index.html` and
225
+ `<captures>/<route>.html` and pass `--captures`. Save a JSON sidecar next to
226
+ each HTML file, such as `index.html.json` or `legal/privacy.html.json`:
227
+
228
+ ```json
229
+ { "status": 200, "url": "http://localhost:3000/legal/privacy", "error": null }
230
+ ```
231
+
232
+ Record the actual final navigation response status and document URL,
233
+ including its trailing slash. Record navigation or capture failures in
234
+ `error`; never infer a successful status from HTML or fill in missing
235
+ evidence. Missing, malformed, non-200, or error metadata fails the route.
236
+ Captures are supplied evidence: the checker cannot authenticate them or
237
+ recognize every error page served with status 200. The browser smoke below
238
+ must still prove representative content and working controls.
239
+
240
+ Count visitor-visible body text and readable attributes (`alt`, `title`,
241
+ `aria-label`, `placeholder`, and `meta` content); script, style, and comment
242
+ strings do not count.
243
+
244
+ ```bash
245
+ node node_modules/fimo/assets/skills/fimo-migration/scripts/check-rendered-guardrails.mjs <target> \
246
+ --base-url http://localhost:3000 --output .fimo/migration/guardrails-report.md
247
+ ```
248
+
249
+ 3. The check fails closed and caps the gate at `draft-only` when the inventory
250
+ or rendered evidence is empty, a route is missing or non-200, a final URL
251
+ does not match the inventoried route, or a rule observes nothing. Nothing
252
+ observed is failed, never passed.
253
+
254
+ 4. Copy the emitted `## Guardrails` block unchanged into the validator's
255
+ worker report and the migration report. Acceptance is `Result: passed` with
256
+ every inventoried route rendered and every rule observed on at least one
257
+ route. Each failure names the route and the phrase or link involved, so the
258
+ repair owner needs no rerun to locate it.
259
+
166
260
  ## Browser smoke (required)
167
261
 
168
262
  Build success and HTTP 200 responses are not sufficient evidence: a page can
@@ -262,6 +356,8 @@ complete | complete-with-unresolved | draft-only
262
356
 
263
357
  ## Content Delivery
264
358
 
359
+ ## Guardrails
360
+
265
361
  ## Timing
266
362
 
267
363
  ## Checks
@@ -279,6 +375,10 @@ locales) with `gate`,
279
375
  coverage must not average away a missing entry or an unuploaded asset. Timing is
280
376
  a separate section copied from the worker reports, so it never dilutes coverage.
281
377
 
378
+ `Guardrails` is the unmodified block emitted by
379
+ `scripts/check-rendered-guardrails.mjs`. A report without it, or with
380
+ `Result: failed`, cannot be `complete` or `complete-with-unresolved`.
381
+
282
382
  Cache freshness is a report check whenever migration changes the content
283
383
  transport or rendering mode. Do not fail a migration for omitted provider cache
284
384
  mechanics alone, but do fail stale Fimo edits caused by the target's migrated
@@ -22,7 +22,8 @@ do not poll indefinitely.
22
22
  Start only after this batch's real records read back as non-empty. Own exactly
23
23
  the consumer files assigned by the planner.
24
24
 
25
- 1. Load the active framework's `fimo-code` reference.
25
+ 1. Load the active framework's `fimo-code` reference. Before changing a media
26
+ read or image component, load `fimo skills get fimo-migration --ref media`.
26
27
  2. Establish the generated Fimo client/adapter needed by the batch.
27
28
  3. Replace every planned `sourceFile`/`sourceKey` at its existing consumer in
28
29
  place. Appending a disconnected duplicate section is not wiring.
@@ -1,11 +1,13 @@
1
1
  # Migration validator
2
2
 
3
3
  Validation is one independent read-only wave after all writers return. The
4
- coordinator gives every validator the accepted migration scope and deliberate
5
- user-approved differences, but no producer findings, repair reasoning,
6
- transcript, or expected verdict. A validator checks the finished target against
7
- the source within that contract. It does not report an explicitly excluded
8
- route, integration, or control as migration drift.
4
+ coordinator gives every validator the accepted migration scope, deliberate
5
+ user-approved differences, and the guardrail inventory path
6
+ (`references/qa.md`, Rendered guardrails), but no producer findings, repair
7
+ reasoning, transcript, or expected verdict. A validator may add a rule the
8
+ source proves; it never removes or narrows one. A validator checks the
9
+ finished target against the source within that contract. It does not report an
10
+ explicitly excluded route, integration, or control as migration drift.
9
11
 
10
12
  When subagents are available, launch separate workers for build and runtime,
11
13
  Fimo data and content, and rendered browser behavior. Run them concurrently
@@ -13,11 +15,18 @@ after their prerequisites pass. They may inspect overlapping files because none
13
15
  of them writes.
14
16
 
15
17
  Compare the source, content plan, actual `git diff`, real Fimo state, and local
16
- application behavior. A worker report is a claim, not evidence.
18
+ application behavior. A worker report, manifest, or coverage table is a
19
+ diagnostic, not acceptance evidence. A check that observed nothing - zero
20
+ rendered routes, zero collected links, zero matched rules - is failed, not
21
+ passed.
17
22
 
18
23
  Verify:
19
24
 
20
25
  - every source route renders with expected status and representative content;
26
+ - the rendered guardrail inventory passes: brand, legal, compliance, and
27
+ navigation rules are proven on rendered HTML or a running local server with
28
+ `scripts/check-rendered-guardrails.mjs`, never by grepping target source.
29
+ Browser captures include the response metadata required by `references/qa.md`;
21
30
  - schemas, entries, singles, labels, media, forms, and locales exist through
22
31
  CLI read-back;
23
32
  - every planned source item is consumed at its original behavior path, not in
@@ -43,6 +52,13 @@ duration, checks run, counts, failing source items, blocked descendants, and
43
52
  suggested repair ownership. Stop only when a failed prerequisite makes a check
44
53
  meaningless.
45
54
 
55
+ End every validator report with an `Acceptance` section: the exact commands
56
+ another party can rerun (build, local start, the guardrail check with its
57
+ inventory and observation source, CLI read-back) and the expected evidence for
58
+ each - exit status, the unmodified `## Guardrails` block ending in
59
+ `Result: passed`, and the counts observed. A pass reported without its command
60
+ and output is a claim.
61
+
46
62
  The coordinator fans every lane into one finding set before editing. It assigns
47
63
  disjoint repair owners, waits for the whole repair wave, then reruns one central
48
64
  validation wave. It does not restart every worker, repair findings one at a
@@ -76,9 +76,11 @@ other after it. Do not add a metadata format for a small overlap.
76
76
  framework gate.
77
77
  6. Start each code worker only after its own imported records read back as
78
78
  non-empty. A build over empty data proves nothing.
79
- 7. After every writer returns, start one read-only validation wave. When
80
- subagents are available, run build and runtime, Fimo data and content, and
81
- rendered browser checks concurrently after their prerequisites pass.
79
+ 7. Before the validation wave, write the cited rendered-guardrail inventory
80
+ required by `references/qa.md`. After every writer returns, start one
81
+ read-only validation wave. When subagents are available, run build and
82
+ runtime, Fimo data and content, and rendered browser checks concurrently
83
+ after their prerequisites pass.
82
84
 
83
85
  Each prompt names the worker's source paths, exact target ownership, applicable
84
86
  reference above, and dependencies. Each report states status, duration, source