fimo 0.17.0 → 0.19.0

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 (164) hide show
  1. package/assets/astro/components/DateTime.astro +22 -0
  2. package/assets/astro/components/index.d.ts +1 -0
  3. package/assets/astro/components/index.js +1 -0
  4. package/assets/content-templates/shared/types.eta +2 -0
  5. package/assets/skills/fimo-cli/SKILL.md +8 -6
  6. package/assets/skills/fimo-cli/references/branches.md +2 -2
  7. package/assets/skills/fimo-cli/references/content.md +2 -2
  8. package/assets/skills/fimo-cli/references/deploy.md +17 -9
  9. package/assets/skills/fimo-cli/references/hosting.md +114 -0
  10. package/assets/skills/fimo-cli/references/init.md +13 -6
  11. package/assets/skills/fimo-cli/references/integrations/firecrawl.md +2 -0
  12. package/assets/skills/fimo-cli/references/locales.md +38 -14
  13. package/assets/skills/fimo-cli/references/pages.md +70 -0
  14. package/assets/skills/fimo-cli/references/preview.md +26 -20
  15. package/assets/skills/fimo-cli/references/webhooks.md +1 -1
  16. package/assets/skills/fimo-code/SKILL.md +11 -0
  17. package/assets/skills/fimo-code/assets/react-router-locales/LocaleLayout.tsx +12 -0
  18. package/assets/skills/fimo-code/assets/react-router-locales/routes.ts +7 -6
  19. package/assets/skills/fimo-code/references/best-practices/astro.md +47 -0
  20. package/assets/skills/fimo-code/references/best-practices/next.md +42 -0
  21. package/assets/skills/fimo-code/references/best-practices/sveltekit.md +17 -0
  22. package/assets/skills/fimo-code/references/content/richtext.md +5 -0
  23. package/assets/skills/fimo-code/references/content/schema.md +4 -1
  24. package/assets/skills/fimo-code/references/frameworks/astro.md +5 -3
  25. package/assets/skills/fimo-code/references/frameworks/hosting.md +5 -2
  26. package/assets/skills/fimo-code/references/frameworks/next/app-router.md +6 -0
  27. package/assets/skills/fimo-code/references/frameworks/next/locales.md +12 -2
  28. package/assets/skills/fimo-code/references/frameworks/next.md +7 -0
  29. package/assets/skills/fimo-code/references/frameworks/react-router.md +15 -7
  30. package/assets/skills/fimo-code/references/frameworks/sveltekit.md +15 -8
  31. package/assets/skills/fimo-code/references/labels.md +9 -1
  32. package/assets/skills/fimo-code/references/locales.md +8 -2
  33. package/assets/skills/fimo-code/references/migrations/react-router-route-ownership.md +93 -0
  34. package/assets/skills/fimo-code/references/ui.md +21 -2
  35. package/assets/skills/fimo-migration/SKILL.md +276 -51
  36. package/assets/skills/fimo-migration/references/content.md +119 -35
  37. package/assets/skills/fimo-migration/references/decision.md +72 -0
  38. package/assets/skills/fimo-migration/references/forms.md +38 -6
  39. package/assets/skills/fimo-migration/references/frameworks/nextjs.md +179 -23
  40. package/assets/skills/fimo-migration/references/import-contract.md +71 -19
  41. package/assets/skills/fimo-migration/references/manifest.md +11 -161
  42. package/assets/skills/fimo-migration/references/media.md +33 -1
  43. package/assets/skills/fimo-migration/references/platforms.md +26 -2
  44. package/assets/skills/fimo-migration/references/qa.md +167 -13
  45. package/assets/skills/fimo-migration/references/workers/content-execution.md +39 -0
  46. package/assets/skills/fimo-migration/references/workers/content-planner.md +64 -0
  47. package/assets/skills/fimo-migration/references/workers/framework.md +37 -0
  48. package/assets/skills/fimo-migration/references/workers/validator.md +25 -0
  49. package/assets/skills/fimo-migration/references/workers.md +82 -0
  50. package/assets/skills/fimo-migration/references/workflow.md +140 -192
  51. package/assets/skills/fimo-migration/scripts/apply-decision.mjs +534 -0
  52. package/assets/skills/fimo-migration/scripts/build-canonical-manifest.mjs +7 -4
  53. package/assets/skills/fimo-migration/scripts/write-migration-report.mjs +191 -4
  54. package/assets/skills/fimo-studio/references/ai-chat.md +1 -1
  55. package/assets/skills/fimo-studio/references/cms.md +25 -7
  56. package/assets/skills/fimo-studio/references/webhooks.md +1 -1
  57. package/assets/sveltekit/components/DateTime.svelte +35 -0
  58. package/assets/sveltekit/components/FimoProvider.svelte +2 -2
  59. package/assets/sveltekit/components/index.d.ts +1 -0
  60. package/assets/sveltekit/components/index.js +1 -0
  61. package/dist/build/next/config.d.ts +4 -1
  62. package/dist/build/next/config.js +21 -5
  63. package/dist/build/sveltekit/vite.d.ts +3 -4
  64. package/dist/build/sveltekit/vite.js +3 -4
  65. package/dist/build/vite/plugins/runtime-env.d.ts +2 -1
  66. package/dist/build/vite/plugins/runtime-env.js +14 -10
  67. package/dist/cli/bundle.json +2 -2
  68. package/dist/cli/index.js +113 -108
  69. package/dist/runtime/app/FimoProviders.js +25 -14
  70. package/dist/runtime/app/prefetch.d.ts +3 -1
  71. package/dist/runtime/app/prefetch.js +11 -55
  72. package/dist/runtime/astro/preview.js +7 -9
  73. package/dist/runtime/content/client/internal.js +1 -0
  74. package/dist/runtime/i18n/locale.d.ts +6 -3
  75. package/dist/runtime/i18n/locale.js +16 -41
  76. package/dist/runtime/next/client-runtime.js +5 -1
  77. package/dist/runtime/next/client.d.ts +3 -2
  78. package/dist/runtime/next/client.js +2 -1
  79. package/dist/runtime/next/labels.d.ts +2 -2
  80. package/dist/runtime/next/labels.js +2 -2
  81. package/dist/runtime/next/preview.d.ts +13 -0
  82. package/dist/runtime/next/preview.js +34 -0
  83. package/dist/runtime/next/primitives/server.d.ts +2 -0
  84. package/dist/runtime/next/primitives/server.js +8 -0
  85. package/dist/runtime/next/provider.d.ts +5 -0
  86. package/dist/runtime/next/provider.js +17 -3
  87. package/dist/runtime/next/server-runtime.js +4 -1
  88. package/dist/runtime/next/server.d.ts +1 -1
  89. package/dist/runtime/next/server.js +1 -1
  90. package/dist/runtime/paths/get-fimo-paths.d.ts +6 -5
  91. package/dist/runtime/paths/get-fimo-paths.js +43 -42
  92. package/dist/runtime/preview/location.d.ts +19 -2
  93. package/dist/runtime/preview/location.js +16 -2
  94. package/dist/runtime/primitives/index.d.ts +1 -0
  95. package/dist/runtime/primitives/index.js +1 -0
  96. package/dist/runtime/react/primitives/editable/DateTime.d.ts +4 -0
  97. package/dist/runtime/react/primitives/editable/DateTime.js +13 -0
  98. package/dist/runtime/react/primitives/renderers/DateRenderer.d.ts +7 -1
  99. package/dist/runtime/react/primitives/renderers/DateRenderer.js +11 -8
  100. package/dist/runtime/react-router/{routes.d.ts → legacy/routes.d.ts} +6 -1
  101. package/dist/runtime/react-router/{routes.js → legacy/routes.js} +22 -7
  102. package/dist/runtime/routes/index.d.ts +162 -0
  103. package/dist/runtime/routes/index.js +335 -0
  104. package/dist/runtime/routing/AppRoutesProvider.js +4 -3
  105. package/dist/runtime/seo/resolver.d.ts +5 -0
  106. package/dist/runtime/seo/resolver.js +10 -42
  107. package/dist/runtime/shared/fimo-config.types.d.ts +14 -13
  108. package/dist/runtime/shared/preview-location.d.ts +1 -22
  109. package/dist/runtime/shared/preview-location.js +5 -93
  110. package/dist/runtime/sveltekit/preview.d.ts +12 -3
  111. package/dist/runtime/sveltekit/preview.js +13 -8
  112. package/dist/runtime/templates.d.ts +19 -0
  113. package/dist/runtime/templates.js +33 -0
  114. package/dist/scripts/sync-forms.js +1 -1
  115. package/dist/scripts/sync-schemas.js +1 -4
  116. package/dist/scripts/validate-fimo-config.js +5 -1
  117. package/dist/scripts/validate-page-registry.d.ts +2 -0
  118. package/dist/scripts/validate-page-registry.js +167 -0
  119. package/dist/scripts/validate-route-metadata.js +132 -41
  120. package/package.json +10 -5
  121. package/templates/astro/.fimo/config.json +13 -5
  122. package/templates/astro/AGENTS.md +5 -1
  123. package/templates/astro/astro.config.mjs +7 -0
  124. package/templates/astro/pnpm-workspace.yaml +0 -3
  125. package/templates/astro/src/components/ProjectOverview.astro +9 -6
  126. package/templates/astro/src/layouts/Base.astro +1 -1
  127. package/templates/astro/src/locales.ts +4 -0
  128. package/templates/astro/src/pages/[locale]/index.astro +19 -0
  129. package/templates/astro/src/pages/[locale]/projects/[slug].astro +35 -0
  130. package/templates/astro/src/pages/[locale]/projects/index.astro +19 -0
  131. package/templates/astro/src/pages/index.astro +5 -2
  132. package/templates/astro/src/pages/projects/[slug].astro +4 -2
  133. package/templates/astro/src/pages/projects/index.astro +5 -2
  134. package/templates/nextjs/.fimo/config.json +2 -1
  135. package/templates/nextjs/AGENTS.md +5 -0
  136. package/templates/nextjs/src/app/(default)/layout.tsx +10 -0
  137. package/templates/nextjs/src/app/[locale]/layout.tsx +22 -0
  138. package/templates/nextjs/src/app/[locale]/page.tsx +1 -0
  139. package/templates/nextjs/src/components/Document.tsx +26 -0
  140. package/templates/nextjs/src/components/FimoPreviewBridge.tsx +13 -0
  141. package/templates/nextjs/src/locales.ts +13 -0
  142. package/templates/react-router/.fimo/config.json +3 -6
  143. package/templates/react-router/AGENTS.md +4 -0
  144. package/templates/react-router/package.json +1 -1
  145. package/templates/react-router/pnpm-workspace.yaml +1 -3
  146. package/templates/react-router/react-router.config.ts +4 -10
  147. package/templates/react-router/src/pages/LocaleLayout.tsx +12 -0
  148. package/templates/react-router/src/root.tsx +2 -4
  149. package/templates/react-router/src/routes.ts +5 -3
  150. package/templates/sveltekit/.fimo/config.json +2 -1
  151. package/templates/sveltekit/AGENTS.md +5 -0
  152. package/templates/sveltekit/src/app.html +1 -1
  153. package/templates/sveltekit/src/hooks.server.ts +11 -0
  154. package/templates/sveltekit/src/locales.ts +8 -0
  155. package/templates/sveltekit/src/params/locale.ts +5 -0
  156. package/templates/sveltekit/src/routes/+layout.server.ts +6 -1
  157. package/templates/sveltekit/src/routes/+layout.svelte +5 -0
  158. package/assets/skills/fimo-migration/references/inventory/coordinator.md +0 -40
  159. package/assets/skills/fimo-migration/references/inventory/locales/next-intl.md +0 -39
  160. package/assets/skills/fimo-migration/references/inventory/locales.md +0 -41
  161. package/assets/skills/fimo-migration/scripts/inventory/locales/next-intl.mjs +0 -459
  162. package/templates/nextjs/src/app/layout.tsx +0 -17
  163. /package/templates/nextjs/src/app/{page.tsx → (default)/page.tsx} +0 -0
  164. /package/templates/sveltekit/src/routes/{+page.svelte → [[locale=locale]]/+page.svelte} +0 -0
@@ -0,0 +1,93 @@
1
+ # React Router locale route ownership upgrade
2
+
3
+ Use this guide to move an existing project from the deprecated
4
+ `fimo/react-router/routes` compatibility adapter to application-owned React
5
+ Router routes. Existing projects can upgrade before completing this migration,
6
+ but new projects should not use the adapter and a future breaking release may
7
+ remove it.
8
+
9
+ ## Identify the installed contract
10
+
11
+ Run the project-local CLI with the package manager selected by the lockfile:
12
+
13
+ ```bash
14
+ pnpm exec fimo --version
15
+ ```
16
+
17
+ Then inspect `package.json`, the lockfile, `src/routes.ts`, the locale layout or
18
+ provider, `.fimo/config.json` (or legacy `fimo-config.json`), the language
19
+ selector, redirects, and SEO/static-generation setup. The installed package is
20
+ authoritative. Do not use a newer globally installed CLI to rewrite the app.
21
+
22
+ Choose the path by the installed and target contracts, not by a guessed
23
+ version number:
24
+
25
+ | Installed project | Target project | Action |
26
+ | ------------------------------------- | --------------- | ------------------------------------------------------------------------- |
27
+ | Uses `fimo/react-router/routes` | Current release | Upgrade safely, then follow this guide to leave the deprecated adapter. |
28
+ | Already uses application-owned routes | Later release | Keep the app-owned routes; no routing migration is needed. |
29
+ | Uses another router or framework | Any release | Keep that framework's locale system and pass its resolved locale to Fimo. |
30
+
31
+ The package export and `pnpm exec fimo --version` are the reliable boundary
32
+ until release notes assign concrete version numbers.
33
+
34
+ ## Replace the deprecated route wrapper
35
+
36
+ Remove the `fimo/react-router/routes` import and declare each localized path
37
+ directly. React Router uses `:locale?`; route metadata uses `/:locale` with an
38
+ optional locale descriptor:
39
+
40
+ ```ts
41
+ import type { RouteConfig } from '@react-router/dev/routes';
42
+ import { layout, route } from '@react-router/dev/routes';
43
+
44
+ export default [
45
+ layout('./pages/LocaleLayout.tsx', [
46
+ route(':locale?/pricing', './pages/Pricing.tsx'),
47
+ route(':locale?/blog/:slug', './pages/BlogPost.tsx'),
48
+ ]),
49
+ ] satisfies RouteConfig;
50
+ ```
51
+
52
+ Keep the public URL matrix unchanged:
53
+
54
+ | URL | route | active locale |
55
+ | --------------- | --------- | ------------------ |
56
+ | `/pricing` | pricing | configured default |
57
+ | `/es/pricing` | pricing | `es` |
58
+ | `/blog/hello` | blog post | configured default |
59
+ | `/es/blog/hola` | blog post | `es` |
60
+
61
+ Do not add a default-locale prefix. Read the optional route locale in an
62
+ application-owned layout and pass it to `<FimoProviders locale={locale}>`.
63
+ When it is omitted, FimoProviders resolves the configured default locale.
64
+ Preserve existing redirects, link behavior, document language/direction, and
65
+ locale validation.
66
+
67
+ The copyable boundary is:
68
+
69
+ ```tsx
70
+ import { FimoProviders } from 'fimo/react-router';
71
+ import { Outlet, useParams } from 'react-router';
72
+
73
+ export default function LocaleLayout() {
74
+ const { locale } = useParams();
75
+ return (
76
+ <FimoProviders locale={locale}>
77
+ <Outlet />
78
+ </FimoProviders>
79
+ );
80
+ }
81
+ ```
82
+
83
+ ## Verify before finishing
84
+
85
+ Run the project-local `fimo validate`, then verify all four URL shapes in the
86
+ preview. Switch languages in the application selector and in Studio, and check
87
+ that both report the same locale. Confirm canonical URLs, `hreflang`, sitemap or
88
+ prerender output, and locale-specific metadata/content remain correct.
89
+
90
+ If the installed version has no exact matching reference, preserve every
91
+ existing public URL and routing behavior. Report the installed version, the
92
+ pattern found, the checks completed, and any uncertainty instead of guessing a
93
+ new route shape.
@@ -9,7 +9,8 @@ Use Fimo components for source-tracked schema and label values so Studio can ide
9
9
  | media as `FimoMedia` | `Image` | schema media images |
10
10
  | non-schema URL | `StaticImage` | decorative/static image URLs |
11
11
  | media as `FimoMedia` | `Video` | schema media videos |
12
- | date as `FimoString` | `Date` | schema dates |
12
+ | date as `FimoString` | `Date` | schema dates; `<time datetime>` is the calendar day |
13
+ | datetime as `FimoString` | `DateTime` | schema instants; `<time datetime>` keeps the time |
13
14
  | boolean as `FimoBoolean` | `Boolean` | schema booleans |
14
15
  | source-tagged plain JSON | `Json` | schema JSON |
15
16
  | number | normal JSX; SvelteKit `Number` | numbers stay plain; SvelteKit `Number` formats display-only values |
@@ -21,6 +22,7 @@ Use Fimo components for source-tracked schema and label values so Studio can ide
21
22
  <RichText value={article.body} />
22
23
  <Image value={article.cover} width={1200} height={630} />
23
24
  <Date value={article.publishedAt} />
25
+ <DateTime value={article.lastReviewedAt} />
24
26
  ```
25
27
 
26
28
  Pass the tracked value directly. Do not replace `<Text>` with `<h1>{article.title}</h1>`, unwrap media into raw `<img>`, or hand-roll richtext rendering.
@@ -44,7 +46,24 @@ Blocks do not change this rule. Every visible nested scalar is source-tracked to
44
46
 
45
47
  Do not render those values as `{program.title}` or `{highlight.label}`. That displays text but bypasses the primitive that Studio uses to resolve the exact nested edit target.
46
48
 
47
- Use `<StaticImage>` only when the image is deliberately not editor-managed. Use `String(value)` for attributes/third-party APIs that cannot accept a `FimoString`; keep editable visible text in `<Text>`.
49
+ Use `<StaticImage>` only when the image is deliberately not editor-managed.
50
+
51
+ ## Wrapper values in JavaScript logic
52
+
53
+ `FimoString`, `FimoBoolean`, and the other tracked values are objects, not primitives: a plain string or boolean cannot carry the source field, locale, and edit-target metadata Fimo editing needs. That gives one two-sided rule:
54
+
55
+ - **MUST** pass the wrapper directly to Fimo rendering primitives (`Text`, `Boolean`, …). Unwrapping first removes the edit target.
56
+ - **MUST** normalize the wrapper before any JavaScript comparison, condition, attribute, or third-party API: `String(value)` for strings, `value.value` (or `value.valueOf()`) for booleans.
57
+
58
+ ```ts
59
+ fimoValue === 'build'; // false — an object never strict-equals a primitive
60
+ String(fimoValue) === 'build'; // true
61
+
62
+ if (fimoFlag) { … } // always runs — an object is truthy even when the value is false
63
+ if (fimoFlag.value) { … } // correct
64
+ ```
65
+
66
+ Keep editable visible text in `<Text>`; normalized primitives are for logic and APIs only, never a substitute for rendering through the primitive.
48
67
 
49
68
  Numeric fields stay plain JavaScript numbers, so they do not carry Studio source metadata. SvelteKit's `Number` component is an optional display/formatting helper; it is not source-editable. Other framework surfaces should render numeric fields normally until a shared tracked-number contract exists.
50
69
 
@@ -14,24 +14,156 @@ description: >-
14
14
  Move published URLs, exports, source repositories, CMS data, media, and forms
15
15
  into a real Fimo project without silently dropping source material.
16
16
 
17
- > **Experimental:** migration support is limited. Assess what can be preserved, explain unsupported parts, and never promise source-framework preservation.
17
+ > **Experimental:** migration support is limited. Assess what can be preserved,
18
+ > explain unsupported parts, record every gap as an owner-visible unresolved
19
+ > item, and do not promise behavior that the target cannot prove. When the CLI
20
+ > supports the source framework, preserve it explicitly and verify the runtime
21
+ > before importing data.
18
22
  >
19
23
  > Use the CLI invocation selected for this flow for every `fimo` command in the migration. Otherwise use `npx fimo@latest`; do not install it globally.
20
24
 
25
+ The first pass is a faithful migration, not a framework conversion. Detect the
26
+ source framework before creating the target and pass it explicitly to
27
+ `fimo migrate init`. For a Next.js source, use `--framework nextjs`; never rely
28
+ on the React Router default. The setup receipt must report the target runtime
29
+ framework, and a mismatch is a setup failure before any schemas, entries,
30
+ assets, labels, or forms are imported.
31
+
32
+ Keep third-party integrations when Fimo does not reproduce their behavior
33
+ end-to-end. Preserve the original code path and record required environment
34
+ variable names only; never read or copy secret values. A missing secret is a
35
+ follow-up for the owner, not permission to silently remove the integration.
36
+
37
+ ## Execution environment
38
+
39
+ Run this skill from a coding-agent process that has direct access to the
40
+ migration checkout. The process must be able to read and write source files,
41
+ run bounded shell scripts, spawn its own subagents, and invoke the selected
42
+ standalone Fimo CLI. The root agent owns the complete loop: fan out workers,
43
+ fan in their reports, repair what they missed, and validate the real target.
44
+
45
+ A plan, an evidence pack, or a generated report without source changes and
46
+ verified Fimo state is only a draft. Do not finish with an explanation when the
47
+ migration request requires an implementation.
48
+
49
+ ## CLI provenance
50
+
51
+ Run every `fimo` command in the migration through one released, pinned CLI
52
+ artifact, and record which one.
53
+
54
+ - Use the exact CLI invocation selected for this flow. If none was provided,
55
+ stop and request an exact released version or immutable package URL. Never
56
+ default to `latest` or another moving dist-tag, never install it globally,
57
+ and never switch artifacts mid-run.
58
+ - Never run the migration through a `file:`-linked workspace CLI from a Fimo
59
+ source checkout: the workspace binary skips the publish-time bundle and can
60
+ miss bundled workspace packages such as `@fimo/cli-kit`. When the migration
61
+ must exercise unreleased CLI changes, publish a pinned dev artifact from that
62
+ checkout first (`pnpm -F fimo publish-cli -- --id <task-name>`, or
63
+ `node scripts/remote-dev-publish-cli.mjs --id <task-name>` when the checkout
64
+ runs on a Dev Remote box) and use the exact package the publish recorded in
65
+ that checkout's `.fimo/dev.json`.
66
+ - Record the provenance in the migration report - the `fimo --version` output
67
+ plus the artifact source (an npm version, or the pinned artifact URL from
68
+ `.fimo/dev.json`).
69
+
70
+ ## Initialized target precondition
71
+
72
+ Before workers start, the root process must establish a real Fimo project and
73
+ environment, link the migration checkout to it, and prove the data plane is
74
+ reachable with a read such as `fimo schemas list -C <target> --env <env>` using
75
+ the selected pinned CLI. Give workers the project id, environment, exact CLI
76
+ invocation, and verification command. Generated `.fimo` JSON without a
77
+ successful platform read is not initialization.
78
+
79
+ For an existing non-empty application, reuse the CLI's real flow: create or
80
+ select the Fimo project with `fimo init`, then run
81
+ `fimo link <project-id> -C <target> --env <env>` and verify the data plane.
82
+ `fimo migrate init <url> <dir>` is only usable when the target directory is
83
+ empty or already linked.
84
+ If authentication, organization selection, project creation, environment
85
+ resolution, linking, or the verification read fails, stop before workers and
86
+ report the exact failed command and setup requirement.
87
+
21
88
  ## Core contract
22
89
 
90
+ - Migrate 1:1, not a compact approximation. Keep the source's route surface
91
+ and user-visible behavior: do not refactor routes merely to make the
92
+ migration easier, and do not replace many source pages with one generic
93
+ static shell. Every source page, content construct, array item, Markdown or
94
+ MDX block, imported component, and meaningful UI behavior ends with a
95
+ consuming target route or component, or with an explicit
96
+ unresolved/incompatible item in the text plan/report.
97
+ - The first migration produces a working Fimo app with minimal refactoring.
98
+ Source-backed migrations preserve the detected source framework, router,
99
+ runtime, provider structure, and configuration by default: React Router/Vite
100
+ stays React Router/Vite, and Next.js stays Next.js. Framework conversion is
101
+ always an explicit user choice. URL-only and rebuild migrations have no
102
+ source framework to preserve, so the user must choose the target framework
103
+ explicitly; do not silently inherit a scaffold default. An explicit
104
+ conversion is still a faithful first pass: the framework conversion worker
105
+ ports the source's APIs, loaders, hardcoded content, integrations, and
106
+ visible behavior into the new framework unchanged, and Fimo schemas,
107
+ payloads, imports, and code wiring happen later through the content workers
108
+ (`references/workers/content-execution.md`). If the framework or hosting
109
+ setup is unclear or unsupported, stop and ask instead of guessing,
110
+ converting it, or deleting provider-specific files.
111
+ - Inventory provider-specific files and rules before editing them. Classify each
112
+ as `preserved`, `replaced`, `safely-unnecessary-implementation-detail`, or
113
+ `unresolved`, with source evidence and affected behavior. Delete only after
114
+ proving redundancy or recording the user's acceptance of the loss.
115
+ - Preserve an existing third-party integration (email, marketing, payments,
116
+ analytics) unless Fimo reproduces its exact user-visible behavior end to
117
+ end. When behavior is not 1:1 - a Brevo newsletter flow, for example - keep
118
+ the original integration wired and record the credential environment keys it
119
+ needs by name, without reading secret values. A missing secret is a user
120
+ follow-up in the report, never a reason to delete behavior or to block
121
+ local build, evaluation, or QA checks.
23
122
  - Record every route, CMS record, media asset, form, locale, redirect, SEO
24
123
  field, and unsupported behavior as imported, deliberately ignored with a
25
124
  reason, or unresolved.
125
+ - When Fimo cannot support a source feature, do not silently drop or simplify
126
+ it. Preserve the original behavior when possible; otherwise leave the
127
+ existing source behavior or its documented fallback in place and record an
128
+ unresolved item with the source evidence, the owner action, and the
129
+ user-visible impact. Never claim completion while source content is
130
+ unwired.
26
131
  - Prefer source code and exports over inferred crawl data. Use a public URL as
27
132
  visual, SEO, route, and behavior evidence when better source material exists.
133
+ - Read local files and exports directly and public APIs without credentials.
134
+ Private APIs and CMSs require a user-provided export or a narrowly scoped
135
+ server-side credential. Never read credentials from browser code or copy
136
+ them into browser code, migration artifacts, or reports. Target-project
137
+ authentication does not grant source access. Missing access stops only that
138
+ data lane and becomes unresolved; never invent replacement content.
28
139
  - Model content before page code. Generated JSON is not imported content.
29
- - Keep migration evidence in the canonical ledger from
30
- `references/manifest.md`.
140
+ - Model editorial content Fimo-natively: blocks for structured or repeatable
141
+ sections, richtext for rich bodies, references for categories, authors,
142
+ related items, and repeated taxonomies, and singleton content types for
143
+ editable header, footer, navigation, and site settings. A `json` field is the
144
+ last resort for opaque or application-owned data and carries a recorded
145
+ reason. Better modeling never redesigns the site: preserve the source's
146
+ content shape and behavior, and record the source-to-Fimo mapping
147
+ (`references/content.md`).
148
+ - Media owns its alt text. Preserve the source alt on the media value and pass
149
+ it to asset metadata when the upload command supports it; never add a
150
+ standalone alt field to a content schema. Record the limitation when the
151
+ command cannot carry it (`references/media.md`).
152
+ - Every write is create-or-update, so any step can be rerun without duplicating
153
+ a schema, entry, asset, single, or label.
154
+ - Every decision cites the source file (and line when it matters) that proves
155
+ it. What no worker could prove stays unresolved with an owner action.
156
+ - Keep coordination evidence in the plain-text files
157
+ `.fimo/migration/migration-plan.md` and
158
+ `.fimo/migration/migration-report.md`. Use JSON only for actual Fimo
159
+ schema/content payloads that a data-plane command needs to import. Do not
160
+ create a target description, worker plan, decision registry, or JSON receipt
161
+ just to describe the filesystem or agent work.
31
162
  - Do not report completion until the QA gate passes or every failed check is
32
163
  present in the migration report.
33
- - Do not deploy while migrating. Import through the data-plane commands,
34
- verify locally, and propose one final owner-approved deployment.
164
+ - Import through the data-plane commands and verify locally before deployment.
165
+ Propose one preview deployment after a successful run, but deploy or publish
166
+ only after an explicit user request.
35
167
 
36
168
  ## Orient and route
37
169
 
@@ -41,70 +173,160 @@ into a real Fimo project without silently dropping source material.
41
173
  framework APIs.
42
174
  3. Classify the available evidence:
43
175
  - **source-backed**: source repository, export, downloaded HTML, CMS data,
44
- or media folder. Treat the source files as truth and run the relevant
45
- bounded inventory helpers when available. After the canonical manifest
46
- records `source.rootPath` and `source.inventoryPath`, run
47
- `fimo migrate inventory [project-root]` for deterministic framework,
48
- runtime, package, locale, and message-file evidence.
176
+ or media folder. The source files are truth; the workers read them
177
+ directly.
49
178
  - **url-only**: only a published URL. Run `fimo migrate <url> [dir]` to
50
179
  create the draft evidence pack.
51
180
  - **hybrid**: source material plus a public URL. Treat source material as
52
181
  truth and the URL as comparison evidence.
53
182
  4. Read `references/workflow.md` before implementation and create or update the
54
- canonical ledger.
55
- 5. Load only the framework and inventory references that apply:
183
+ plain-text migration plan.
184
+ 5. Load the references that apply:
185
+ - Coordinator ownership and dependency gates -> `references/workers.md`.
186
+ - Framework conversion worker -> `references/workers/framework.md`.
187
+ - Content planner -> `references/workers/content-planner.md`.
188
+ - Content data/code workers -> `references/workers/content-execution.md`.
189
+ - Independent validator -> `references/workers/validator.md`.
56
190
  - Next.js source -> `references/frameworks/nextjs.md`.
57
- - Locale or dictionary evidence -> `references/inventory/locales.md`.
58
- - Declared next-intl dependency ->
59
- `references/inventory/locales/next-intl.md`.
60
- - Deterministic inventory coordination ->
61
- `references/inventory/coordinator.md`.
191
+ - React Router/Vite source -> load the target project's `fimo-code`
192
+ `frameworks/react-router`, `frameworks/vite-react`, and
193
+ `frameworks/hosting` references as applicable.
194
+ - Next.js implementation -> load the target project's `fimo-code`
195
+ `frameworks/next` and `frameworks/hosting` references. Those references
196
+ describe available equivalents; verify hosting support instead of assuming
197
+ every Next.js rule or runtime behavior is automatic.
198
+ Framework, provider, and rendering-primitive rules live in the `fimo-code`
199
+ skill; this skill routes to them and does not restate them.
200
+
201
+ ## Target setup
202
+
203
+ The target is its own Fimo project directory. The client source checkout is
204
+ read-only evidence: never run setup inside it, never modify it, and never
205
+ hand-write a `.fimo/project.json` marker to fake a link.
206
+
207
+ `fimo migrate init` is the migration setup gate. For a source-backed migration
208
+ it validates the target and CLI auth, then delegates project selection and
209
+ creation to the standard `fimo init` flow (same options, no separate creation
210
+ path), and returns a setup receipt covering auth, the target link, the
211
+ migration directory, and readiness. It fails with a structured error when auth
212
+ is missing, the target is missing or invalid, or the project or organization
213
+ is inaccessible. Both forms need a real ID supplied by the owner — without
214
+ one, stop with an unresolved owner action instead of inventing an ID:
215
+
216
+ - Link an owner-supplied (empty) project:
217
+ `fimo migrate init <target-dir> --project-id <projectId> --framework <framework>`
218
+ - Create a new project in an owner-supplied organization:
219
+ `fimo migrate init <target-dir> --org <organizationId> --framework <framework>`
220
+
221
+ After setup, check `.fimo/config.json#runtime.framework` and the scaffold's
222
+ framework files before starting workers. A Next.js target must still have its
223
+ Next runtime/configuration (`next.config.*` and the source router shape), not a
224
+ React Router scaffold.
225
+
226
+ Setup scaffolds the target and pushes its initial commit; that is the only
227
+ remote write it performs — it never pushes schemas, uploads assets, or imports
228
+ entries. `fimo deploy` and `fimo publish` stay separate and are never run
229
+ automatically (see Completion and deployment).
230
+
231
+ ## Command surface
232
+
233
+ Plan-only commands operate on local artifacts and work before the target is
234
+ linked:
235
+
236
+ - `fimo migrate init <url> [dir]` — URL migrations only: crawl the live site
237
+ into the draft evidence pack.
238
+ - `fimo migrate inspect` — summarize the URL draft or an existing legacy ledger.
239
+ - `fimo migrate import` — print the import plan; it writes no data.
240
+ - `fimo migrate apply` / `fimo migrate refine` — URL-draft-only scaffold and
241
+ refinement handoff; they play no role in a source-backed migration. `apply`
242
+ must never run against an initialized non-React-Router target: it is the
243
+ legacy React Router scaffold path and must fail instead of downgrading a
244
+ Next.js (or another framework) project.
245
+ - `fimo migrate manifest` / `fimo migrate report` — legacy URL-draft helpers.
246
+ New source-backed migrations use the plain-text migration plan, worker
247
+ reports, and final migration report; they do not bootstrap another JSON
248
+ registry.
249
+
250
+ Commands that perform actual data writes, all requiring the linked target:
251
+
252
+ - `fimo schemas push`, `fimo assets upload`, `fimo entries create|update`,
253
+ `fimo singles update`, `fimo labels set|set-many`, `fimo forms push`.
254
+ - `fimo migrate init` (source-backed form): the project link/creation and
255
+ initial commit push described above.
256
+ - `fimo deploy` / `fimo publish` — owner-approved only.
62
257
 
63
258
  ## Migration loop
64
259
 
65
- 1. Prepare the deterministic inventory plan first. When independent workers
66
- are available, create one read-only subagent per planned lane; otherwise run
67
- the same lanes sequentially. Every worker returns its fragment, never a
68
- prose claim. Run reconcile after every fan-out, then use targeted file reads
69
- for evidence the inventory leaves unresolved. Use a validator worker that
70
- produced no fragments to compare the plan, source evidence, fragments, and
71
- unresolved claims. Reopen only affected lanes when validation finds a gap.
72
- 2. Normalize CMS, media, forms, routes, redirects, locales, and unsupported
73
- behavior into the canonical ledger.
74
- 3. Model content and references before writing pages.
75
- 4. Generate or update schemas, entries, media mappings, forms, routes, and
76
- application code with native Fimo contracts.
77
- 5. Import reviewed media, schemas, entries, and forms in the order required by
78
- `references/import-contract.md`.
79
- 6. Run the local QA gate in `references/qa.md`.
80
- 7. Write `.fimo/migration/migration-report.md` with coverage, counts,
81
- mappings, unresolved items, and next actions.
82
-
83
- Use the bundled deterministic helpers whenever their contract fits. If a
84
- helper cannot prove a source fact, follow the bounded fallback in the relevant
85
- inventory reference instead of treating the whole inventory as failed.
260
+ 1. Run `fimo migrate init` and inspect the initialized target before any worker
261
+ edits it. Choose the target framework through the same canonical option as
262
+ `fimo init`: pass the detected source framework for a source-backed
263
+ migration, the framework the user explicitly chose for a conversion, and —
264
+ for a URL-only or rebuild migration — the framework the user selected (ask
265
+ when they have not). `--template-root` is a development/test
266
+ override only; normal migration prompts must not select a framework by
267
+ copying an arbitrary template path. The target's real files and directories
268
+ are the authority for framework paths; do not invent a second `app/` or
269
+ `src/app/` tree from an example.
270
+ 2. Write a short `.fimo/migration/migration-plan.md` containing the chosen
271
+ framework, source/target paths, worker owners, important dependencies, and
272
+ known questions. Start the independent workers in `references/workers.md`:
273
+ runtime/config, routes/SEO, content planning, and locales when those surfaces
274
+ exist. When the user explicitly chose a framework conversion,
275
+ one framework conversion worker replaces the runtime and routes lanes, owns
276
+ all structural target code, and must pass the framework gate in
277
+ `references/workers/framework.md` before content data and code workers
278
+ start. Worker prompts and worker reports are plain text.
279
+ 3. The content planner reads every content-bearing source and consumer, writes
280
+ and pushes complete schemas, and writes the content import payloads required
281
+ by the Fimo CLI. It records source items, consumers, batches, and unresolved
282
+ behavior in the text plan; it does not create a second orchestration format.
283
+ 4. Once the content plan is ready, upload every planned asset and patch its
284
+ target payload references. After the asset gate passes (and, in conversion
285
+ mode, the framework gate), run data workers per schema/locale. Start content
286
+ code workers only after their imported records read back successfully, so
287
+ they can prove real values render through the native Fimo APIs.
288
+ 5. Fan in the workers' plain-text reports. Compare their claimed files with
289
+ `git diff`, their Fimo writes with read-back CLI queries, and their source
290
+ coverage with the content plan. Every source item must be migrated,
291
+ deliberately preserved, or listed as unresolved with an owner action. A
292
+ report that merely says “done” is not evidence.
293
+ 6. Validate against the real target with a validator that did not author the
294
+ changes and starts only after every other worker report is terminal: read
295
+ back schemas, entries, singles, labels, and assets through the CLI, build
296
+ the project, render the migrated routes, and verify hosting compatibility
297
+ (local startup, Fimo Preview embeddability, build). Record `browserProof`
298
+ when a browser is available; otherwise use deterministic
299
+ HTTP/header/process/log checks and mark visual proof unavailable. Then run
300
+ the QA gate in `references/qa.md`.
301
+ 7. Write `.fimo/migration/migration-report.md` with coverage, counts, mappings,
302
+ unresolved items, timings from worker reports, and next actions.
86
303
 
87
304
  ## References
88
305
 
89
306
  - `references/workflow.md` - phase order, source intake, URL artifacts, and
90
307
  implementation loop.
91
- - `references/manifest.md` - canonical migration ledger schema.
308
+ - `references/decision.md` - plain-text decision and schema guidance; no
309
+ decision JSON is required.
92
310
  - `references/content.md` - CMS, entries, references, and source value rules.
93
- - `references/media.md` - media inventory, upload, dedupe, and replacement.
311
+ - `references/media.md` - media obligations, upload, dedupe, and replacement.
94
312
  - `references/forms.md` - form classification and Fimo replacement.
95
313
  - `references/import-contract.md` - import obligations for media, entries, and
96
314
  forms.
97
315
  - `references/platforms.md` - platform-specific source-of-truth and rebuild
98
316
  notes.
99
317
  - `references/qa.md` - acceptance gate and report format.
100
- - `references/frameworks/nextjs.md` - Next.js source inventory routing.
101
- - `references/inventory/locales.md` - locale evidence and agent fallback.
102
- - `references/inventory/locales/next-intl.md` - next-intl strategy and support
103
- boundary.
104
- - `references/inventory/coordinator.md` - deterministic inventory fan-out,
105
- worker, and fan-in commands.
106
- - `scripts/build-canonical-manifest.mjs` - bootstrap the canonical ledger.
107
- - `scripts/write-migration-report.mjs` - update QA state and write the report.
318
+ - `references/frameworks/nextjs.md` - Next.js routes, config, locales, and
319
+ Markdown or MDX content.
320
+ - `references/workers.md` - coordinator schedule, ownership, and gates.
321
+ - `references/workers/framework.md` - explicit framework-conversion contract.
322
+ - `references/workers/content-planner.md` - discovery, schemas, payloads, and
323
+ handoff contract.
324
+ - `references/workers/content-execution.md` - data import and code-wiring
325
+ contracts.
326
+ - `references/workers/validator.md` - independent fan-in validation.
327
+ - Existing manifest/decision helper scripts are legacy compatibility tools for
328
+ older migration artifacts. Do not invoke them in a new migration unless the
329
+ user explicitly asks to replay an older artifact.
108
330
 
109
331
  ## Completion and deployment
110
332
 
@@ -117,6 +339,9 @@ Use one final status:
117
339
  a draft.
118
340
 
119
341
  Never call a migration complete when CMS entries, media mappings, forms, or
120
- route coverage are unknown. Never run `fimo deploy` or `fimo publish` as a
121
- preview or QA step. After local QA passes, propose one final deployment and run
122
- it only when the owner explicitly approves it in the current turn.
342
+ route coverage are unknown. Local QA remains the acceptance gate. If
343
+ `fimo migrate init` created a new Fimo project, run one `fimo deploy` after QA
344
+ and return its preview and dashboard links; skip it when the user said not to
345
+ deploy or `FIMO_MIGRATION_NO_DEPLOY=1` is set. For an existing linked project,
346
+ offer the deployment and wait for approval. Never run `fimo publish` without an
347
+ explicit request.