fimo 0.16.0 → 0.18.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.
- package/assets/astro/components/DateTime.astro +22 -0
- package/assets/astro/components/index.d.ts +1 -0
- package/assets/astro/components/index.js +1 -0
- package/assets/content-templates/shared/types.eta +2 -0
- package/assets/skills/fimo-cli/SKILL.md +5 -2
- package/assets/skills/fimo-cli/references/content.md +2 -2
- package/assets/skills/fimo-cli/references/deploy.md +2 -0
- package/assets/skills/fimo-cli/references/init.md +11 -4
- package/assets/skills/fimo-cli/references/locales.md +38 -14
- package/assets/skills/fimo-cli/references/pages.md +70 -0
- package/assets/skills/fimo-cli/references/webhooks.md +1 -1
- package/assets/skills/fimo-code/SKILL.md +11 -0
- package/assets/skills/fimo-code/assets/react-router-locales/LocaleLayout.tsx +12 -0
- package/assets/skills/fimo-code/assets/react-router-locales/routes.ts +7 -6
- package/assets/skills/fimo-code/references/best-practices/astro.md +47 -0
- package/assets/skills/fimo-code/references/best-practices/next.md +42 -0
- package/assets/skills/fimo-code/references/best-practices/sveltekit.md +17 -0
- package/assets/skills/fimo-code/references/content/richtext.md +5 -0
- package/assets/skills/fimo-code/references/content/schema.md +4 -1
- package/assets/skills/fimo-code/references/frameworks/astro.md +5 -3
- package/assets/skills/fimo-code/references/frameworks/hosting.md +5 -2
- package/assets/skills/fimo-code/references/frameworks/next/app-router.md +6 -0
- package/assets/skills/fimo-code/references/frameworks/next/locales.md +12 -2
- package/assets/skills/fimo-code/references/frameworks/next.md +7 -0
- package/assets/skills/fimo-code/references/frameworks/react-router.md +15 -7
- package/assets/skills/fimo-code/references/frameworks/sveltekit.md +15 -8
- package/assets/skills/fimo-code/references/labels.md +9 -1
- package/assets/skills/fimo-code/references/locales.md +8 -2
- package/assets/skills/fimo-code/references/migrations/react-router-route-ownership.md +93 -0
- package/assets/skills/fimo-code/references/ui.md +21 -2
- package/assets/skills/fimo-migration/SKILL.md +276 -51
- package/assets/skills/fimo-migration/references/content.md +119 -35
- package/assets/skills/fimo-migration/references/decision.md +72 -0
- package/assets/skills/fimo-migration/references/forms.md +38 -6
- package/assets/skills/fimo-migration/references/frameworks/nextjs.md +179 -23
- package/assets/skills/fimo-migration/references/import-contract.md +71 -19
- package/assets/skills/fimo-migration/references/manifest.md +11 -161
- package/assets/skills/fimo-migration/references/media.md +33 -1
- package/assets/skills/fimo-migration/references/platforms.md +26 -2
- package/assets/skills/fimo-migration/references/qa.md +167 -13
- package/assets/skills/fimo-migration/references/workers/content-execution.md +39 -0
- package/assets/skills/fimo-migration/references/workers/content-planner.md +64 -0
- package/assets/skills/fimo-migration/references/workers/framework.md +37 -0
- package/assets/skills/fimo-migration/references/workers/validator.md +25 -0
- package/assets/skills/fimo-migration/references/workers.md +82 -0
- package/assets/skills/fimo-migration/references/workflow.md +140 -192
- package/assets/skills/fimo-migration/scripts/apply-decision.mjs +534 -0
- package/assets/skills/fimo-migration/scripts/build-canonical-manifest.mjs +7 -4
- package/assets/skills/fimo-migration/scripts/write-migration-report.mjs +191 -4
- package/assets/skills/fimo-studio/references/cms.md +25 -7
- package/assets/skills/fimo-studio/references/webhooks.md +1 -1
- package/assets/sveltekit/components/DateTime.svelte +35 -0
- package/assets/sveltekit/components/FimoProvider.svelte +2 -2
- package/assets/sveltekit/components/index.d.ts +1 -0
- package/assets/sveltekit/components/index.js +1 -0
- package/dist/build/next/config.d.ts +4 -1
- package/dist/build/next/config.js +21 -5
- package/dist/build/sveltekit/vite.d.ts +3 -4
- package/dist/build/sveltekit/vite.js +3 -4
- package/dist/build/vite/plugins/runtime-env.d.ts +2 -1
- package/dist/build/vite/plugins/runtime-env.js +14 -10
- package/dist/cli/bundle.json +2 -2
- package/dist/cli/index.js +76 -78
- package/dist/runtime/app/FimoProviders.js +25 -14
- package/dist/runtime/app/prefetch.d.ts +3 -1
- package/dist/runtime/app/prefetch.js +11 -55
- package/dist/runtime/astro/preview.js +7 -9
- package/dist/runtime/content/client/internal.js +1 -0
- package/dist/runtime/i18n/locale.d.ts +4 -0
- package/dist/runtime/i18n/locale.js +14 -14
- package/dist/runtime/next/client-runtime.js +5 -1
- package/dist/runtime/next/client.d.ts +3 -2
- package/dist/runtime/next/client.js +2 -1
- package/dist/runtime/next/labels.d.ts +2 -2
- package/dist/runtime/next/labels.js +2 -2
- package/dist/runtime/next/preview.d.ts +13 -0
- package/dist/runtime/next/preview.js +34 -0
- package/dist/runtime/next/primitives/server.d.ts +2 -0
- package/dist/runtime/next/primitives/server.js +8 -0
- package/dist/runtime/next/provider.d.ts +5 -0
- package/dist/runtime/next/provider.js +17 -3
- package/dist/runtime/next/server-runtime.js +4 -1
- package/dist/runtime/next/server.d.ts +1 -1
- package/dist/runtime/next/server.js +1 -1
- package/dist/runtime/paths/get-fimo-paths.d.ts +6 -5
- package/dist/runtime/paths/get-fimo-paths.js +43 -42
- package/dist/runtime/preview/location.d.ts +19 -2
- package/dist/runtime/preview/location.js +16 -2
- package/dist/runtime/primitives/index.d.ts +1 -0
- package/dist/runtime/primitives/index.js +1 -0
- package/dist/runtime/react/primitives/editable/DateTime.d.ts +4 -0
- package/dist/runtime/react/primitives/editable/DateTime.js +13 -0
- package/dist/runtime/react/primitives/renderers/DateRenderer.d.ts +7 -1
- package/dist/runtime/react/primitives/renderers/DateRenderer.js +11 -8
- package/dist/runtime/react-router/{routes.d.ts → legacy/routes.d.ts} +6 -1
- package/dist/runtime/react-router/{routes.js → legacy/routes.js} +22 -7
- package/dist/runtime/routes/contract.d.ts +116 -0
- package/dist/runtime/routes/contract.js +377 -0
- package/dist/runtime/routes/index.d.ts +3 -0
- package/dist/runtime/routes/index.js +3 -0
- package/dist/runtime/routing/AppRoutesProvider.js +4 -3
- package/dist/runtime/seo/resolver.d.ts +5 -0
- package/dist/runtime/seo/resolver.js +10 -42
- package/dist/runtime/shared/fimo-config.types.d.ts +34 -8
- package/dist/runtime/shared/preview-location.d.ts +1 -22
- package/dist/runtime/shared/preview-location.js +5 -93
- package/dist/runtime/sveltekit/preview.d.ts +12 -3
- package/dist/runtime/sveltekit/preview.js +13 -8
- package/dist/scripts/sync-forms.js +1 -1
- package/dist/scripts/sync-schemas.js +1 -4
- package/dist/scripts/validate-fimo-config.js +5 -1
- package/dist/scripts/validate-page-registry.d.ts +2 -0
- package/dist/scripts/validate-page-registry.js +167 -0
- package/dist/scripts/validate-route-metadata.js +132 -41
- package/package.json +7 -3
- package/templates/astro/.fimo/config.json +13 -5
- package/templates/astro/AGENTS.md +5 -1
- package/templates/astro/astro.config.mjs +7 -0
- package/templates/astro/package.json +1 -1
- package/templates/astro/pnpm-workspace.yaml +0 -3
- package/templates/astro/src/components/ProjectOverview.astro +9 -6
- package/templates/astro/src/layouts/Base.astro +1 -1
- package/templates/astro/src/locales.ts +4 -0
- package/templates/astro/src/pages/[locale]/index.astro +19 -0
- package/templates/astro/src/pages/[locale]/projects/[slug].astro +35 -0
- package/templates/astro/src/pages/[locale]/projects/index.astro +19 -0
- package/templates/astro/src/pages/index.astro +5 -2
- package/templates/astro/src/pages/projects/[slug].astro +4 -2
- package/templates/astro/src/pages/projects/index.astro +5 -2
- package/templates/nextjs/.fimo/config.json +2 -1
- package/templates/nextjs/AGENTS.md +5 -0
- package/templates/nextjs/package.json +1 -1
- package/templates/nextjs/src/app/(default)/layout.tsx +10 -0
- package/templates/nextjs/src/app/[locale]/layout.tsx +22 -0
- package/templates/nextjs/src/app/[locale]/page.tsx +1 -0
- package/templates/nextjs/src/components/Document.tsx +26 -0
- package/templates/nextjs/src/components/FimoPreviewBridge.tsx +13 -0
- package/templates/nextjs/src/locales.ts +13 -0
- package/templates/react-router/.fimo/config.json +3 -6
- package/templates/react-router/AGENTS.md +4 -0
- package/templates/react-router/package.json +2 -2
- package/templates/react-router/pnpm-workspace.yaml +1 -3
- package/templates/react-router/react-router.config.ts +4 -10
- package/templates/react-router/src/pages/LocaleLayout.tsx +12 -0
- package/templates/react-router/src/root.tsx +2 -4
- package/templates/react-router/src/routes.ts +5 -3
- package/templates/sveltekit/.fimo/config.json +2 -1
- package/templates/sveltekit/AGENTS.md +5 -0
- package/templates/sveltekit/package.json +1 -1
- package/templates/sveltekit/src/app.html +1 -1
- package/templates/sveltekit/src/hooks.server.ts +11 -0
- package/templates/sveltekit/src/locales.ts +8 -0
- package/templates/sveltekit/src/params/locale.ts +5 -0
- package/templates/sveltekit/src/routes/+layout.server.ts +6 -1
- package/templates/sveltekit/src/routes/+layout.svelte +5 -0
- package/assets/skills/fimo-migration/references/inventory/coordinator.md +0 -40
- package/assets/skills/fimo-migration/references/inventory/locales/next-intl.md +0 -39
- package/assets/skills/fimo-migration/references/inventory/locales.md +0 -41
- package/assets/skills/fimo-migration/scripts/inventory/locales/next-intl.mjs +0 -459
- package/templates/nextjs/src/app/layout.tsx +0 -17
- /package/templates/nextjs/src/app/{page.tsx → (default)/page.tsx} +0 -0
- /package/templates/sveltekit/src/routes/{+page.svelte → [[locale=locale]]/+page.svelte} +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { notFound } from 'next/navigation';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import Document from '../../components/Document';
|
|
5
|
+
import { prefixedLocales } from '../../locales';
|
|
6
|
+
|
|
7
|
+
import '../globals.css';
|
|
8
|
+
|
|
9
|
+
export default async function LocaleLayout({
|
|
10
|
+
children,
|
|
11
|
+
params,
|
|
12
|
+
}: Readonly<{ children: ReactNode; params: Promise<{ locale: string }> }>) {
|
|
13
|
+
const { locale } = await params;
|
|
14
|
+
|
|
15
|
+
// The default locale is served unprefixed by `app/(default)`, so its prefix
|
|
16
|
+
// is not a second URL for the same page.
|
|
17
|
+
if (!prefixedLocales.has(locale)) {
|
|
18
|
+
notFound();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return <Document locale={locale}>{children}</Document>;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '../(default)/page';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FimoProvider } from 'fimo/next/client';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
import FimoPreviewBridge from './FimoPreviewBridge';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The HTML document for one locale tree. Only a root layout may render `<html>`
|
|
8
|
+
* in the App Router, so each locale tree has its own root layout and renders
|
|
9
|
+
* this with the locale that tree serves. That is what makes `<html lang>` and
|
|
10
|
+
* the Fimo locale context correct on both the unprefixed and prefixed routes.
|
|
11
|
+
*/
|
|
12
|
+
export default function Document({ children, locale }: Readonly<{ children: ReactNode; locale: string }>) {
|
|
13
|
+
const previewScriptUrl = process.env.NEXT_PUBLIC_FIMO_PREVIEW_SCRIPT_URL;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<html lang={locale}>
|
|
17
|
+
<body>
|
|
18
|
+
<FimoProvider locale={locale}>
|
|
19
|
+
<FimoPreviewBridge />
|
|
20
|
+
{children}
|
|
21
|
+
</FimoProvider>
|
|
22
|
+
{previewScriptUrl ? <script src={previewScriptUrl} defer /> : null}
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { FimoPreviewBridge as RuntimeFimoPreviewBridge } from 'fimo/next/client';
|
|
4
|
+
import { usePathname, useRouter } from 'next/navigation';
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
export default function FimoPreviewBridge() {
|
|
8
|
+
const pathname = usePathname();
|
|
9
|
+
const router = useRouter();
|
|
10
|
+
const navigate = useCallback((to: string) => router.push(to), [router]);
|
|
11
|
+
|
|
12
|
+
return <RuntimeFimoPreviewBridge pathname={pathname} navigate={navigate} />;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import fimoConfig from '../.fimo/config.json';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Locale policy read from the same file Fimo and Studio read, so the site
|
|
5
|
+
* language cannot drift from the project configuration. Change the locales in
|
|
6
|
+
* `.fimo/config.json#i18n`; nothing here needs editing.
|
|
7
|
+
*/
|
|
8
|
+
export const defaultLocale: string = fimoConfig.i18n.defaultLocale;
|
|
9
|
+
|
|
10
|
+
/** Only non-default locales carry a URL prefix; the default locale stays at the site root. */
|
|
11
|
+
export const prefixedLocales: ReadonlySet<string> = new Set(
|
|
12
|
+
fimoConfig.i18n.locales.filter((locale) => locale !== defaultLocale)
|
|
13
|
+
);
|
|
@@ -11,16 +11,13 @@
|
|
|
11
11
|
},
|
|
12
12
|
"i18n": {
|
|
13
13
|
"defaultLocale": "en",
|
|
14
|
-
"locales": ["en"]
|
|
15
|
-
"routing": {
|
|
16
|
-
"strategy": "path-prefix",
|
|
17
|
-
"prefixDefaultLocale": false
|
|
18
|
-
}
|
|
14
|
+
"locales": ["en"]
|
|
19
15
|
},
|
|
20
16
|
"routes": {
|
|
21
17
|
"home": {
|
|
22
18
|
"label": "Home",
|
|
23
|
-
"path": "
|
|
19
|
+
"path": "/:locale",
|
|
20
|
+
"params": { "locale": { "type": "locale", "optional": true } },
|
|
24
21
|
"seo": {
|
|
25
22
|
"title": "Home",
|
|
26
23
|
"description": "Welcome"
|
|
@@ -40,6 +40,10 @@ breaks that. Load `fimo-code` for the exact primitives, but the rule is:
|
|
|
40
40
|
## Project rules
|
|
41
41
|
|
|
42
42
|
- **Deploy is on-demand**, not a save step. Batch related edits into one deploy.
|
|
43
|
+
- With pnpm, run `pnpm install --config.dangerouslyAllowAllBuilds=true`; a bare install can skip the build scripts required by Fimo and the framework toolchain.
|
|
44
|
+
- Treat the user's language request as part of setup. The first explicitly requested locale is the primary locale; put it first and set it as `i18n.defaultLocale` in `.fimo/config.json`. If no language is requested, keep `en` and state that choice.
|
|
45
|
+
- Preserve the application-owned `:locale?` route boundary in `src/routes.ts` and pass its route parameter to `FimoProviders` in `LocaleLayout.tsx`. The missing parameter uses the configured default, so a one-locale site stays at `/`. Add locales in `.fimo/config.json` without rebuilding the route tree; use `:locale` without `?` only when every locale must be prefixed.
|
|
46
|
+
- Keep `.fimo/config.json#routes` aligned as Studio metadata, not as the React Router source of truth. Do not add a global locale-routing strategy, a Fimo route helper, or a Fimo-owned route tree.
|
|
43
47
|
- Do not add a second deploy tool (Vercel, Netlify, etc.).
|
|
44
48
|
- **Never edit `.fimo/project.json`** — it links this folder to the remote project.
|
|
45
49
|
- **Keep `.fimo/config.json#runtime` true to the code** — framework, `dev`/`build`/`install` commands, output directory. Update it when you rename a package script, move the build output, or change framework; the reference is `fimo skills get fimo-code --ref frameworks/hosting`.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "react-router dev --port 5173",
|
|
8
|
-
"build": "tsc --noEmit && react-router build && fimo export-static",
|
|
8
|
+
"build": "fimo validate --json && tsc --noEmit && react-router build && fimo export-static",
|
|
9
9
|
"lint": "oxlint --deny-warnings",
|
|
10
10
|
"typecheck": "tsc --noEmit",
|
|
11
11
|
"preview": "vite preview --host 0.0.0.0 --port 4173"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"cmdk": "^1.1.1",
|
|
22
22
|
"date-fns": "^4.1.0",
|
|
23
23
|
"embla-carousel-react": "^8.6.0",
|
|
24
|
-
"fimo": "0.
|
|
24
|
+
"fimo": "0.18.0",
|
|
25
25
|
"input-otp": "^1.4.2",
|
|
26
26
|
"isbot": "^5",
|
|
27
27
|
"lucide-react": "^0.577.0",
|
|
@@ -5,16 +5,10 @@ export default {
|
|
|
5
5
|
appDirectory: 'src',
|
|
6
6
|
ssr: false,
|
|
7
7
|
presets: [fimoPreset()],
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// import { getFimoPaths } from 'fimo/paths';
|
|
13
|
-
// prerender: async () => (await getFimoPaths()).map((p) => p.path),
|
|
14
|
-
//
|
|
15
|
-
// `getFimoPaths()` expands dynamic routes (e.g. `/blog/:slug`) by fetching
|
|
16
|
-
// schema entries from the content API. See `references/frameworks/react-router.md`
|
|
17
|
-
// in the fimo skill for the full setup pattern.
|
|
8
|
+
// Pages metadata is optional Studio editing context; it does not configure
|
|
9
|
+
// the app router or build-time paths. Existing projects that still need the
|
|
10
|
+
// legacy sitemap/simple-SSG helper can import `fimo/paths` in their own build
|
|
11
|
+
// configuration.
|
|
18
12
|
buildDirectory: 'dist',
|
|
19
13
|
// Feed Vite's dependency scanner the client entry + every route module.
|
|
20
14
|
// Without it React Router hands Vite an EMPTY entry list, nothing is
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FimoProviders } from 'fimo/react-router';
|
|
2
|
+
import { Outlet, useParams } from 'react-router';
|
|
3
|
+
|
|
4
|
+
export default function LocaleLayout() {
|
|
5
|
+
const { locale } = useParams();
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<FimoProviders locale={locale}>
|
|
9
|
+
<Outlet />
|
|
10
|
+
</FimoProviders>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { FimoScripts, loadFimoMetaData, buildFimoMeta, fimoHtmlProps } from 'fimo/react-router';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import type { MetaFunction } from 'react-router';
|
|
5
5
|
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from 'react-router';
|
|
@@ -45,9 +45,7 @@ export function Layout({ children }: { children: React.ReactNode }) {
|
|
|
45
45
|
export default function AppRoot() {
|
|
46
46
|
return (
|
|
47
47
|
<QueryClientProvider client={queryClient}>
|
|
48
|
-
<
|
|
49
|
-
<Outlet />
|
|
50
|
-
</FimoProviders>
|
|
48
|
+
<Outlet />
|
|
51
49
|
</QueryClientProvider>
|
|
52
50
|
);
|
|
53
51
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { RouteConfig } from '@react-router/dev/routes';
|
|
2
|
+
import { layout, route } from '@react-router/dev/routes';
|
|
3
3
|
|
|
4
4
|
// Examples of React Router route patterns:
|
|
5
5
|
// index('./pages/Index.tsx'),
|
|
@@ -12,4 +12,6 @@ import { fimoRoutes } from 'fimo/react-router/routes';
|
|
|
12
12
|
// route('settings', './pages/dashboard/Settings.tsx'),
|
|
13
13
|
// ]),
|
|
14
14
|
|
|
15
|
-
export default
|
|
15
|
+
export default [
|
|
16
|
+
layout('./pages/LocaleLayout.tsx', [route(':locale?', './pages/Index.tsx', { id: 'home' })]),
|
|
17
|
+
] satisfies RouteConfig;
|
|
@@ -27,6 +27,11 @@ a code-only task, or use `npx fimo@latest` for project-local code generation and
|
|
|
27
27
|
## Project rules
|
|
28
28
|
|
|
29
29
|
- **Deploy is on-demand**, not a save step. Batch related edits into one deploy.
|
|
30
|
+
- With pnpm, run `pnpm install --config.dangerouslyAllowAllBuilds=true`; a bare install can skip the build scripts required by Fimo and the framework toolchain.
|
|
31
|
+
- Treat the user's language request as part of setup. The first explicitly requested locale is the primary locale; put it first and set it as `i18n.defaultLocale` in `.fimo/config.json`. If no language is requested, keep `en` and state that choice. `src/locales.ts` derives the default and prefixed locale set from that config.
|
|
32
|
+
- Preserve the native `[[locale=locale]]` route boundary. The optional parameter keeps the default locale at `/`; the matcher prevents ordinary top-level routes from being mistaken for locales. The root server layout passes the tracked `event.params` through `resolveLocale`, then sends that locale to `getLabels` and `FimoProvider`. Remove the extra brackets only when every locale must be prefixed.
|
|
33
|
+
- Keep the document language request-aware: `src/hooks.server.ts` renders the initial `<html lang>`, and the root layout updates it after client navigation.
|
|
34
|
+
- Keep `.fimo/config.json#routes` as Studio metadata aligned with SvelteKit's route files. It does not configure SvelteKit routing.
|
|
30
35
|
- The application owns routes, locale resolution, links, HTML language/direction, and SEO. Fimo connects to those decisions.
|
|
31
36
|
- Do not add a second deployment platform.
|
|
32
37
|
- Never edit `.fimo/project.json`; it links this directory to the remote project.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Handle } from '@sveltejs/kit';
|
|
2
|
+
|
|
3
|
+
import { resolveLocale } from './locales';
|
|
4
|
+
|
|
5
|
+
export const handle: Handle = ({ event, resolve }) => {
|
|
6
|
+
const locale = resolveLocale(event.params);
|
|
7
|
+
|
|
8
|
+
return resolve(event, {
|
|
9
|
+
transformPageChunk: ({ html }) => html.replace('%lang%', locale),
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import fimoConfig from '../.fimo/config.json';
|
|
2
|
+
|
|
3
|
+
export const defaultLocale: string = fimoConfig.i18n.defaultLocale;
|
|
4
|
+
export const prefixedLocales = new Set(fimoConfig.i18n.locales.filter((locale) => locale !== defaultLocale));
|
|
5
|
+
|
|
6
|
+
export function resolveLocale(params: { locale?: string }): string {
|
|
7
|
+
return params.locale ?? defaultLocale;
|
|
8
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { getLabels } from 'fimo/sveltekit';
|
|
2
2
|
|
|
3
|
+
import { resolveLocale } from '../locales';
|
|
4
|
+
|
|
3
5
|
export async function load(event) {
|
|
6
|
+
const locale = resolveLocale(event.params);
|
|
7
|
+
|
|
4
8
|
return {
|
|
5
|
-
|
|
9
|
+
locale,
|
|
10
|
+
labels: await getLabels({ event, locale }),
|
|
6
11
|
};
|
|
7
12
|
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { afterNavigate } from '$app/navigation';
|
|
2
3
|
import { FimoProvider } from 'fimo/sveltekit/components';
|
|
3
4
|
import type { Snippet } from 'svelte';
|
|
4
5
|
|
|
5
6
|
import type { LayoutData } from './$types';
|
|
6
7
|
|
|
7
8
|
let { data, children }: { data: LayoutData; children: Snippet } = $props();
|
|
9
|
+
|
|
10
|
+
afterNavigate(() => {
|
|
11
|
+
document.documentElement.lang = data.locale;
|
|
12
|
+
});
|
|
8
13
|
</script>
|
|
9
14
|
|
|
10
15
|
<FimoProvider labels={data.labels}>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Deterministic inventory coordination
|
|
2
|
-
|
|
3
|
-
Prepare before running lanes:
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
fimo migrate inventory <project-root> --prepare
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
Read `inventory-plan.json`, then run each listed area in an independent worker
|
|
10
|
-
that treats application source as read-only:
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
fimo migrate inventory <project-root> --area runtime-config
|
|
14
|
-
fimo migrate inventory <project-root> --area locales
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Run only areas present in the plan. The `locales` area is currently planned
|
|
18
|
-
only when the source package manifest declares `next-intl`.
|
|
19
|
-
|
|
20
|
-
Workers must return the written deterministic fragment, not a prose summary.
|
|
21
|
-
They must read only the source root and write only their planned fragment and
|
|
22
|
-
execution receipt. A worker may report structured unresolved claims in its
|
|
23
|
-
fragment; process outcome and timing belong in the run receipt.
|
|
24
|
-
|
|
25
|
-
If independent workers are unavailable, run the same areas sequentially:
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
fimo migrate inventory <project-root> --sequential
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
After every fan-out, run deterministic fan-in:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
fimo migrate inventory <project-root> --reconcile
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Use a separate validator worker that did not produce fragments to compare the
|
|
38
|
-
plan, source evidence, fragments, and unresolved claims. If it finds a gap,
|
|
39
|
-
reopen only the affected area and reconcile again. The CLI never starts an
|
|
40
|
-
LLM or chooses a harness.
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# next-intl locale inventory
|
|
2
|
-
|
|
3
|
-
Use the shipped analyzer after `package.json` proves a next-intl dependency:
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
node <this-skill>/scripts/inventory/locales/next-intl.mjs <source-root>
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
It detects conventional JSON dictionaries, JSON imports with one dynamic locale
|
|
10
|
-
segment, and static `defineRouting` locale/default-locale values. It emits
|
|
11
|
-
deterministic facts and file/line evidence without changing the source.
|
|
12
|
-
|
|
13
|
-
If request configuration does not reveal a custom JSON dictionary layout, let
|
|
14
|
-
the agent select one relative pattern containing `{locale}` exactly once:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
node <this-skill>/scripts/inventory/locales/next-intl.mjs <source-root> \
|
|
18
|
-
--messages-pattern 'src/translations/{locale}/common.json'
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
The script rejects absolute paths, paths outside the source root, non-JSON
|
|
22
|
-
patterns, and ambiguous placeholders.
|
|
23
|
-
|
|
24
|
-
## Support boundary
|
|
25
|
-
|
|
26
|
-
The analyzer intentionally leaves a claim unresolved when its static source
|
|
27
|
-
shape is unknown. Current gaps include:
|
|
28
|
-
|
|
29
|
-
- locales/default locale declared only through legacy middleware or navigation
|
|
30
|
-
helpers;
|
|
31
|
-
- dynamic or remote locale configuration;
|
|
32
|
-
- non-JSON dictionaries such as extracted PO catalogs;
|
|
33
|
-
- public route reachability.
|
|
34
|
-
|
|
35
|
-
Treat package version as evidence that helps prioritize likely source shapes,
|
|
36
|
-
not as the primary switch. If the analyzer cannot prove a claim, follow the
|
|
37
|
-
temporary read-only strategy in `references/inventory/locales.md`. A zero exit
|
|
38
|
-
code means the analyzer ran successfully; read `unresolved[]` as the exact
|
|
39
|
-
claims still requiring evidence.
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Locale inventory
|
|
2
|
-
|
|
3
|
-
Inventory locale evidence without deciding that every dictionary is configured
|
|
4
|
-
or publicly routable.
|
|
5
|
-
|
|
6
|
-
## Evidence contract
|
|
7
|
-
|
|
8
|
-
Keep these facts distinct:
|
|
9
|
-
|
|
10
|
-
- **dictionary candidates**: locale-like values derived from message files or
|
|
11
|
-
records;
|
|
12
|
-
- **configured locales**: values proven by static application configuration;
|
|
13
|
-
- **default locale**: one statically proven fallback when present;
|
|
14
|
-
- **public locales**: values proven reachable through the application's routes;
|
|
15
|
-
- **unresolved claims**: individual facts that no strategy proved.
|
|
16
|
-
|
|
17
|
-
A successful script run means evidence collection executed correctly. It does
|
|
18
|
-
not mean every locale claim is known. Preserve proven facts when another claim
|
|
19
|
-
remains unresolved.
|
|
20
|
-
|
|
21
|
-
## Bounded fallback
|
|
22
|
-
|
|
23
|
-
1. Run the shipped strategy for the detected locale system.
|
|
24
|
-
2. If the dictionary layout is the only unknown, pass a supported bounded path
|
|
25
|
-
pattern to that strategy.
|
|
26
|
-
3. If a claim remains unresolved, inspect only the files likely to own it.
|
|
27
|
-
4. When repeated manual reads would be slower or less reliable, let the agent
|
|
28
|
-
create one disposable script in the harness or operating-system temporary
|
|
29
|
-
directory, outside the application source tree. The script must:
|
|
30
|
-
- read only the selected source root;
|
|
31
|
-
- perform no network calls or source writes;
|
|
32
|
-
- have explicit file, byte, or time bounds;
|
|
33
|
-
- print deterministic facts, evidence paths, and unresolved claims;
|
|
34
|
-
- avoid claiming route reachability from dictionary files alone.
|
|
35
|
-
5. Validate the output, copy its evidence into the canonical ledger, and remove
|
|
36
|
-
the temporary script. Do not commit it to the migrated application.
|
|
37
|
-
6. At fan-in, compare configured, default, dictionary, and public locales. Keep
|
|
38
|
-
every mismatch or unproven claim unresolved until evidence settles it.
|
|
39
|
-
|
|
40
|
-
If the same temporary strategy is needed repeatedly across migrations, turn it
|
|
41
|
-
into a tested shipped script in a separate Fimo change.
|