failproofai 0.0.2 → 0.0.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.
- package/.next/standalone/.claude/settings.json +316 -0
- package/.next/standalone/.failproofai/policies/workflow-policies.mjs +62 -0
- package/.next/standalone/.failproofai/policies-config.json +39 -0
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +5 -5
- package/.next/standalone/.next/prerender-manifest.json +3 -3
- package/.next/standalone/.next/required-server-files.json +3 -1
- package/.next/standalone/.next/server/app/_global-error/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_global-error/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +7 -7
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +2 -2
- package/.next/standalone/.next/server/app/_not-found.rsc +17 -17
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +17 -17
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +11 -11
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +16 -16
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +16 -16
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +11 -11
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/.next/standalone/.next/server/app/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/policies/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/policies/page/server-reference-manifest.json +8 -8
- package/.next/standalone/.next/server/app/policies/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/policies/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +2 -2
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/app/projects/page/build-manifest.json +2 -2
- package/.next/standalone/.next/server/app/projects/page/server-reference-manifest.json +1 -1
- package/.next/standalone/.next/server/app/projects/page.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/projects/page_client-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0g72weg._.js +3 -0
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__0kjo7d_._.js +1 -1
- package/.next/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_05pz9._._.js +1 -1
- package/.next/standalone/.next/server/chunks/package_json_[json]_cjs_0z7w.hh._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__12kr5~_._.js → [root-of-the-server]__03kiqd5._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__092s1ta._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09icjsf._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0qo8503._.js → [root-of-the-server]__0bo8s~-._.js} +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0g.lg8b._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0h..k-e._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0okos0k._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0w6l33k._.js +9 -9
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__11pa2ra._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__12t-wym._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/_10lm7or._.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/app_global-error_tsx_0xerkr6._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/app_policies_hooks-client_tsx_0q-m0y-._.js +1 -1
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0a_7sdg.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0ef3uwk.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0j79~gv.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0pbja1x.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_0r6o0i2.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_11y81~_.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_next_dist_esm_build_templates_app-page_12or2kf.js +2 -2
- package/.next/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_0mebn66._.js +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +5 -5
- package/.next/standalone/.next/server/pages/404.html +2 -2
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
- package/.next/standalone/.next/server/server-reference-manifest.json +9 -9
- package/.next/standalone/.next/static/chunks/{0x-625~1vx1lu.js → 02t9.s735hqyq.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0ov60i6md~37t.js → 03oepxbqx6o8~.js} +2 -2
- package/.next/standalone/.next/static/chunks/{031pa5~qfzt~_.js → 09e7drilkf1sn.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0y~0creqvl5wx.js → 0cwft44dh9bww.js} +1 -1
- package/.next/standalone/.next/static/chunks/{06og.7e9nkpjh.js → 0e2uz2g026ckb.js} +1 -1
- package/.next/standalone/.next/static/chunks/0gu_a.a80ritd.css +1 -0
- package/.next/standalone/.next/static/chunks/{15wf7x-e.8ia3.js → 0h5kbvg~.xf.v.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0_4y_t03jn2nq.js → 0od..umlku4bb.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0cvffh-pbsv5u.js → 0xbwzy4dl87-0.js} +1 -1
- package/.next/standalone/.next/static/chunks/{0c_ljlxa._4lc.js → 18cl6wups7ouq.js} +2 -2
- package/.next/standalone/.next/static/chunks/{turbopack-0uc5y~g6h.n7-.js → turbopack-0r26pc8h0y_-e.js} +1 -1
- package/.next/standalone/CHANGELOG.md +103 -0
- package/.next/standalone/CLAUDE.md +28 -0
- package/.next/standalone/Dockerfile.docs +12 -0
- package/.next/standalone/README.md +95 -49
- package/.next/standalone/app/components/session-hooks-panel.tsx +14 -1
- package/.next/standalone/app/policies/hooks-client.tsx +14 -1
- package/.next/standalone/bin/failproofai.mjs +5 -0
- package/.next/standalone/bun.lock +76 -63
- package/.next/standalone/components/navbar.tsx +5 -0
- package/.next/standalone/dist/cli.mjs +539 -90
- package/.next/standalone/dist/index.js +2 -2
- package/.next/standalone/docs/ar/architecture.mdx +333 -0
- package/.next/standalone/docs/ar/built-in-policies.mdx +566 -0
- package/.next/standalone/docs/ar/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/ar/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/ar/cli/hook.mdx +31 -0
- package/.next/standalone/docs/ar/cli/install-policies.mdx +49 -0
- package/.next/standalone/docs/ar/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/ar/cli/remove-policies.mdx +45 -0
- package/.next/standalone/docs/ar/cli/version.mdx +13 -0
- package/.next/standalone/docs/ar/configuration.mdx +223 -0
- package/.next/standalone/docs/ar/custom-policies.mdx +359 -0
- package/.next/standalone/docs/ar/dashboard.mdx +142 -0
- package/.next/standalone/docs/ar/examples.mdx +254 -0
- package/.next/standalone/docs/ar/for-agents.mdx +39 -0
- package/.next/standalone/docs/ar/getting-started.mdx +134 -0
- package/.next/standalone/docs/ar/introduction.mdx +58 -0
- package/.next/standalone/docs/ar/package-aliases.mdx +82 -0
- package/.next/standalone/docs/ar/testing.mdx +261 -0
- package/.next/standalone/docs/{architecture.md → architecture.mdx} +40 -23
- package/.next/standalone/docs/{built-in-policies.md → built-in-policies.mdx} +151 -13
- package/.next/standalone/docs/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/cli/hook.mdx +30 -0
- package/.next/standalone/docs/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/cli/version.mdx +12 -0
- package/.next/standalone/docs/{configuration.md → configuration.mdx} +62 -16
- package/.next/standalone/docs/custom-policies.mdx +357 -0
- package/.next/standalone/docs/{dashboard.md → dashboard.mdx} +26 -29
- package/.next/standalone/docs/de/architecture.mdx +332 -0
- package/.next/standalone/docs/de/built-in-policies.mdx +564 -0
- package/.next/standalone/docs/de/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/de/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/de/cli/hook.mdx +30 -0
- package/.next/standalone/docs/de/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/de/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/de/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/de/cli/version.mdx +12 -0
- package/.next/standalone/docs/de/configuration.mdx +222 -0
- package/.next/standalone/docs/de/custom-policies.mdx +357 -0
- package/.next/standalone/docs/de/dashboard.mdx +142 -0
- package/.next/standalone/docs/de/examples.mdx +253 -0
- package/.next/standalone/docs/de/for-agents.mdx +38 -0
- package/.next/standalone/docs/de/getting-started.mdx +134 -0
- package/.next/standalone/docs/de/introduction.mdx +57 -0
- package/.next/standalone/docs/de/package-aliases.mdx +82 -0
- package/.next/standalone/docs/de/testing.mdx +260 -0
- package/.next/standalone/docs/docs.json +938 -24
- package/.next/standalone/docs/es/architecture.mdx +332 -0
- package/.next/standalone/docs/es/built-in-policies.mdx +564 -0
- package/.next/standalone/docs/es/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/es/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/es/cli/hook.mdx +30 -0
- package/.next/standalone/docs/es/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/es/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/es/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/es/cli/version.mdx +12 -0
- package/.next/standalone/docs/es/configuration.mdx +222 -0
- package/.next/standalone/docs/es/custom-policies.mdx +357 -0
- package/.next/standalone/docs/es/dashboard.mdx +142 -0
- package/.next/standalone/docs/es/examples.mdx +253 -0
- package/.next/standalone/docs/es/for-agents.mdx +38 -0
- package/.next/standalone/docs/es/getting-started.mdx +134 -0
- package/.next/standalone/docs/es/introduction.mdx +57 -0
- package/.next/standalone/docs/es/package-aliases.mdx +82 -0
- package/.next/standalone/docs/es/testing.mdx +260 -0
- package/.next/standalone/docs/examples.mdx +253 -0
- package/.next/standalone/docs/for-agents.mdx +38 -0
- package/.next/standalone/docs/fr/architecture.mdx +332 -0
- package/.next/standalone/docs/fr/built-in-policies.mdx +564 -0
- package/.next/standalone/docs/fr/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/fr/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/fr/cli/hook.mdx +30 -0
- package/.next/standalone/docs/fr/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/fr/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/fr/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/fr/cli/version.mdx +12 -0
- package/.next/standalone/docs/fr/configuration.mdx +222 -0
- package/.next/standalone/docs/fr/custom-policies.mdx +357 -0
- package/.next/standalone/docs/fr/dashboard.mdx +142 -0
- package/.next/standalone/docs/fr/examples.mdx +253 -0
- package/.next/standalone/docs/fr/for-agents.mdx +38 -0
- package/.next/standalone/docs/fr/getting-started.mdx +134 -0
- package/.next/standalone/docs/fr/introduction.mdx +57 -0
- package/.next/standalone/docs/fr/package-aliases.mdx +82 -0
- package/.next/standalone/docs/fr/testing.mdx +260 -0
- package/.next/standalone/docs/getting-started.mdx +134 -0
- package/.next/standalone/docs/he/architecture.mdx +333 -0
- package/.next/standalone/docs/he/built-in-policies.mdx +564 -0
- package/.next/standalone/docs/he/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/he/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/he/cli/hook.mdx +30 -0
- package/.next/standalone/docs/he/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/he/cli/list-policies.mdx +32 -0
- package/.next/standalone/docs/he/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/he/cli/version.mdx +12 -0
- package/.next/standalone/docs/he/configuration.mdx +222 -0
- package/.next/standalone/docs/he/custom-policies.mdx +357 -0
- package/.next/standalone/docs/he/dashboard.mdx +142 -0
- package/.next/standalone/docs/he/examples.mdx +253 -0
- package/.next/standalone/docs/he/for-agents.mdx +38 -0
- package/.next/standalone/docs/he/getting-started.mdx +135 -0
- package/.next/standalone/docs/he/introduction.mdx +57 -0
- package/.next/standalone/docs/he/package-aliases.mdx +82 -0
- package/.next/standalone/docs/he/testing.mdx +260 -0
- package/.next/standalone/docs/hi/architecture.mdx +334 -0
- package/.next/standalone/docs/hi/built-in-policies.mdx +564 -0
- package/.next/standalone/docs/hi/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/hi/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/hi/cli/hook.mdx +30 -0
- package/.next/standalone/docs/hi/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/hi/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/hi/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/hi/cli/version.mdx +12 -0
- package/.next/standalone/docs/hi/configuration.mdx +222 -0
- package/.next/standalone/docs/hi/custom-policies.mdx +357 -0
- package/.next/standalone/docs/hi/dashboard.mdx +142 -0
- package/.next/standalone/docs/hi/examples.mdx +255 -0
- package/.next/standalone/docs/hi/for-agents.mdx +38 -0
- package/.next/standalone/docs/hi/getting-started.mdx +134 -0
- package/.next/standalone/docs/hi/introduction.mdx +57 -0
- package/.next/standalone/docs/hi/package-aliases.mdx +82 -0
- package/.next/standalone/docs/hi/testing.mdx +260 -0
- package/.next/standalone/docs/i18n/README.ar.md +312 -0
- package/.next/standalone/docs/i18n/README.de.md +307 -0
- package/.next/standalone/docs/i18n/README.es.md +307 -0
- package/.next/standalone/docs/i18n/README.fr.md +307 -0
- package/.next/standalone/docs/i18n/README.he.md +312 -0
- package/.next/standalone/docs/i18n/README.hi.md +307 -0
- package/.next/standalone/docs/i18n/README.it.md +307 -0
- package/.next/standalone/docs/i18n/README.ja.md +307 -0
- package/.next/standalone/docs/i18n/README.ko.md +307 -0
- package/.next/standalone/docs/i18n/README.pt-br.md +307 -0
- package/.next/standalone/docs/i18n/README.ru.md +308 -0
- package/.next/standalone/docs/i18n/README.tr.md +308 -0
- package/.next/standalone/docs/i18n/README.vi.md +308 -0
- package/.next/standalone/docs/i18n/README.zh.md +307 -0
- package/.next/standalone/docs/introduction.mdx +57 -0
- package/.next/standalone/docs/it/architecture.mdx +333 -0
- package/.next/standalone/docs/it/built-in-policies.mdx +564 -0
- package/.next/standalone/docs/it/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/it/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/it/cli/hook.mdx +30 -0
- package/.next/standalone/docs/it/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/it/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/it/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/it/cli/version.mdx +12 -0
- package/.next/standalone/docs/it/configuration.mdx +223 -0
- package/.next/standalone/docs/it/custom-policies.mdx +358 -0
- package/.next/standalone/docs/it/dashboard.mdx +142 -0
- package/.next/standalone/docs/it/examples.mdx +253 -0
- package/.next/standalone/docs/it/for-agents.mdx +38 -0
- package/.next/standalone/docs/it/getting-started.mdx +134 -0
- package/.next/standalone/docs/it/introduction.mdx +57 -0
- package/.next/standalone/docs/it/package-aliases.mdx +82 -0
- package/.next/standalone/docs/it/testing.mdx +260 -0
- package/.next/standalone/docs/ja/architecture.mdx +332 -0
- package/.next/standalone/docs/ja/built-in-policies.mdx +562 -0
- package/.next/standalone/docs/ja/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/ja/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/ja/cli/hook.mdx +30 -0
- package/.next/standalone/docs/ja/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/ja/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/ja/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/ja/cli/version.mdx +12 -0
- package/.next/standalone/docs/ja/configuration.mdx +222 -0
- package/.next/standalone/docs/ja/custom-policies.mdx +357 -0
- package/.next/standalone/docs/ja/dashboard.mdx +142 -0
- package/.next/standalone/docs/ja/examples.mdx +253 -0
- package/.next/standalone/docs/ja/for-agents.mdx +38 -0
- package/.next/standalone/docs/ja/getting-started.mdx +134 -0
- package/.next/standalone/docs/ja/introduction.mdx +57 -0
- package/.next/standalone/docs/ja/package-aliases.mdx +82 -0
- package/.next/standalone/docs/ja/testing.mdx +260 -0
- package/.next/standalone/docs/ko/architecture.mdx +332 -0
- package/.next/standalone/docs/ko/built-in-policies.mdx +562 -0
- package/.next/standalone/docs/ko/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/ko/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/ko/cli/hook.mdx +30 -0
- package/.next/standalone/docs/ko/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/ko/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/ko/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/ko/cli/version.mdx +12 -0
- package/.next/standalone/docs/ko/configuration.mdx +222 -0
- package/.next/standalone/docs/ko/custom-policies.mdx +357 -0
- package/.next/standalone/docs/ko/dashboard.mdx +142 -0
- package/.next/standalone/docs/ko/examples.mdx +253 -0
- package/.next/standalone/docs/ko/for-agents.mdx +38 -0
- package/.next/standalone/docs/ko/getting-started.mdx +134 -0
- package/.next/standalone/docs/ko/introduction.mdx +57 -0
- package/.next/standalone/docs/ko/package-aliases.mdx +82 -0
- package/.next/standalone/docs/ko/testing.mdx +260 -0
- package/.next/standalone/docs/logo/dark.svg +21 -0
- package/.next/standalone/docs/logo/light.svg +21 -0
- package/.next/standalone/docs/{package-aliases.md → package-aliases.mdx} +5 -5
- package/.next/standalone/docs/pt-br/architecture.mdx +332 -0
- package/.next/standalone/docs/pt-br/built-in-policies.mdx +564 -0
- package/.next/standalone/docs/pt-br/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/pt-br/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/pt-br/cli/hook.mdx +30 -0
- package/.next/standalone/docs/pt-br/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/pt-br/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/pt-br/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/pt-br/cli/version.mdx +12 -0
- package/.next/standalone/docs/pt-br/configuration.mdx +222 -0
- package/.next/standalone/docs/pt-br/custom-policies.mdx +357 -0
- package/.next/standalone/docs/pt-br/dashboard.mdx +142 -0
- package/.next/standalone/docs/pt-br/examples.mdx +253 -0
- package/.next/standalone/docs/pt-br/for-agents.mdx +38 -0
- package/.next/standalone/docs/pt-br/getting-started.mdx +134 -0
- package/.next/standalone/docs/pt-br/introduction.mdx +57 -0
- package/.next/standalone/docs/pt-br/package-aliases.mdx +82 -0
- package/.next/standalone/docs/pt-br/testing.mdx +260 -0
- package/.next/standalone/docs/ru/architecture.mdx +334 -0
- package/.next/standalone/docs/ru/built-in-policies.mdx +562 -0
- package/.next/standalone/docs/ru/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/ru/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/ru/cli/hook.mdx +30 -0
- package/.next/standalone/docs/ru/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/ru/cli/list-policies.mdx +32 -0
- package/.next/standalone/docs/ru/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/ru/cli/version.mdx +12 -0
- package/.next/standalone/docs/ru/configuration.mdx +223 -0
- package/.next/standalone/docs/ru/custom-policies.mdx +357 -0
- package/.next/standalone/docs/ru/dashboard.mdx +142 -0
- package/.next/standalone/docs/ru/examples.mdx +254 -0
- package/.next/standalone/docs/ru/for-agents.mdx +38 -0
- package/.next/standalone/docs/ru/getting-started.mdx +134 -0
- package/.next/standalone/docs/ru/introduction.mdx +57 -0
- package/.next/standalone/docs/ru/package-aliases.mdx +82 -0
- package/.next/standalone/docs/ru/testing.mdx +260 -0
- package/.next/standalone/docs/{testing.md → testing.mdx} +11 -11
- package/.next/standalone/docs/tr/architecture.mdx +333 -0
- package/.next/standalone/docs/tr/built-in-policies.mdx +562 -0
- package/.next/standalone/docs/tr/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/tr/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/tr/cli/hook.mdx +30 -0
- package/.next/standalone/docs/tr/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/tr/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/tr/cli/remove-policies.mdx +45 -0
- package/.next/standalone/docs/tr/cli/version.mdx +12 -0
- package/.next/standalone/docs/tr/configuration.mdx +223 -0
- package/.next/standalone/docs/tr/custom-policies.mdx +357 -0
- package/.next/standalone/docs/tr/dashboard.mdx +142 -0
- package/.next/standalone/docs/tr/examples.mdx +253 -0
- package/.next/standalone/docs/tr/for-agents.mdx +38 -0
- package/.next/standalone/docs/tr/getting-started.mdx +134 -0
- package/.next/standalone/docs/tr/introduction.mdx +57 -0
- package/.next/standalone/docs/tr/package-aliases.mdx +82 -0
- package/.next/standalone/docs/tr/testing.mdx +260 -0
- package/.next/standalone/docs/vi/architecture.mdx +333 -0
- package/.next/standalone/docs/vi/built-in-policies.mdx +564 -0
- package/.next/standalone/docs/vi/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/vi/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/vi/cli/hook.mdx +30 -0
- package/.next/standalone/docs/vi/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/vi/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/vi/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/vi/cli/version.mdx +13 -0
- package/.next/standalone/docs/vi/configuration.mdx +222 -0
- package/.next/standalone/docs/vi/custom-policies.mdx +357 -0
- package/.next/standalone/docs/vi/dashboard.mdx +142 -0
- package/.next/standalone/docs/vi/examples.mdx +253 -0
- package/.next/standalone/docs/vi/for-agents.mdx +38 -0
- package/.next/standalone/docs/vi/getting-started.mdx +134 -0
- package/.next/standalone/docs/vi/introduction.mdx +57 -0
- package/.next/standalone/docs/vi/package-aliases.mdx +82 -0
- package/.next/standalone/docs/vi/testing.mdx +260 -0
- package/.next/standalone/docs/zh/architecture.mdx +332 -0
- package/.next/standalone/docs/zh/built-in-policies.mdx +562 -0
- package/.next/standalone/docs/zh/cli/dashboard.mdx +28 -0
- package/.next/standalone/docs/zh/cli/environment-variables.mdx +34 -0
- package/.next/standalone/docs/zh/cli/hook.mdx +30 -0
- package/.next/standalone/docs/zh/cli/install-policies.mdx +48 -0
- package/.next/standalone/docs/zh/cli/list-policies.mdx +31 -0
- package/.next/standalone/docs/zh/cli/remove-policies.mdx +44 -0
- package/.next/standalone/docs/zh/cli/version.mdx +12 -0
- package/.next/standalone/docs/zh/configuration.mdx +222 -0
- package/.next/standalone/docs/zh/custom-policies.mdx +357 -0
- package/.next/standalone/docs/zh/dashboard.mdx +142 -0
- package/.next/standalone/docs/zh/examples.mdx +253 -0
- package/.next/standalone/docs/zh/for-agents.mdx +38 -0
- package/.next/standalone/docs/zh/getting-started.mdx +134 -0
- package/.next/standalone/docs/zh/introduction.mdx +57 -0
- package/.next/standalone/docs/zh/package-aliases.mdx +82 -0
- package/.next/standalone/docs/zh/testing.mdx +260 -0
- package/.next/standalone/examples/convention-policies/security-policies.mjs +40 -0
- package/.next/standalone/examples/convention-policies/workflow-policies.mjs +41 -0
- package/.next/standalone/next.config.ts +5 -3
- package/.next/standalone/node_modules/@next/env/package.json +1 -1
- package/.next/standalone/node_modules/next/dist/build/swc/index.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/jsonwebtoken/index.js +2 -2
- package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +1 -1
- package/.next/standalone/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
- package/.next/standalone/node_modules/next/dist/lib/patch-incorrect-lockfile.js +3 -3
- package/.next/standalone/node_modules/next/dist/server/config.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +7 -2
- package/.next/standalone/node_modules/next/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/app-info-log.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/lib/start-server.js +1 -1
- package/.next/standalone/node_modules/next/dist/server/render.js +20 -19
- package/.next/standalone/node_modules/next/dist/shared/lib/errors/canary-only-config-error.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
- package/.next/standalone/node_modules/next/dist/telemetry/events/version.js +2 -2
- package/.next/standalone/node_modules/next/package.json +15 -15
- package/.next/standalone/node_modules/react/cjs/react.development.js +1 -1
- package/.next/standalone/node_modules/react/cjs/react.production.js +1 -1
- package/.next/standalone/node_modules/react/package.json +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.browser.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server-legacy.node.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.browser.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.edge.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom-server.node.production.js +3 -3
- package/.next/standalone/node_modules/react-dom/cjs/react-dom.production.js +1 -1
- package/.next/standalone/node_modules/react-dom/package.json +2 -2
- package/.next/standalone/package.json +13 -10
- package/.next/standalone/scripts/translate-docs/cache.ts +62 -0
- package/.next/standalone/scripts/translate-docs/cli.ts +357 -0
- package/.next/standalone/scripts/translate-docs/config.ts +248 -0
- package/.next/standalone/scripts/translate-docs/mdx-translator.ts +153 -0
- package/.next/standalone/scripts/translate-docs/mintlify-nav.ts +107 -0
- package/.next/standalone/scripts/translate-docs/readme-translator.ts +154 -0
- package/.next/standalone/scripts/translate-docs/translator.ts +68 -0
- package/.next/standalone/scripts/translate-docs/types.ts +43 -0
- package/.next/standalone/server.js +1 -1
- package/.next/standalone/skills-lock.json +10 -0
- package/.next/standalone/src/hooks/builtin-policies.ts +405 -25
- package/.next/standalone/src/hooks/custom-hooks-loader.ts +165 -21
- package/.next/standalone/src/hooks/handler.ts +33 -6
- package/.next/standalone/src/hooks/hook-activity-store.ts +6 -1
- package/.next/standalone/src/hooks/hooks-config.ts +47 -2
- package/.next/standalone/src/hooks/llm-client.ts +2 -2
- package/.next/standalone/src/hooks/loader-utils.ts +4 -4
- package/.next/standalone/src/hooks/manager.ts +67 -16
- package/.next/standalone/src/hooks/policy-evaluator.ts +58 -19
- package/.next/standalone/src/hooks/policy-helpers.ts +2 -2
- package/.next/standalone/vitest.config.e2e.mts +3 -0
- package/.next/standalone/vitest.config.mts +3 -0
- package/README.md +95 -49
- package/bin/failproofai.mjs +5 -0
- package/dist/cli.mjs +539 -90
- package/dist/index.js +2 -2
- package/package.json +13 -10
- package/scripts/translate-docs/cache.ts +62 -0
- package/scripts/translate-docs/cli.ts +357 -0
- package/scripts/translate-docs/config.ts +248 -0
- package/scripts/translate-docs/mdx-translator.ts +153 -0
- package/scripts/translate-docs/mintlify-nav.ts +107 -0
- package/scripts/translate-docs/readme-translator.ts +154 -0
- package/scripts/translate-docs/translator.ts +68 -0
- package/scripts/translate-docs/types.ts +43 -0
- package/src/hooks/builtin-policies.ts +405 -25
- package/src/hooks/custom-hooks-loader.ts +165 -21
- package/src/hooks/handler.ts +33 -6
- package/src/hooks/hook-activity-store.ts +6 -1
- package/src/hooks/hooks-config.ts +47 -2
- package/src/hooks/llm-client.ts +2 -2
- package/src/hooks/loader-utils.ts +4 -4
- package/src/hooks/manager.ts +67 -16
- package/src/hooks/policy-evaluator.ts +58 -19
- package/src/hooks/policy-helpers.ts +2 -2
- package/.next/standalone/.next/server/chunks/[root-of-the-server]__02nt~6d._.js +0 -3
- package/.next/standalone/.next/static/chunks/15jpradyu_531.css +0 -1
- package/.next/standalone/docs/cli-reference.md +0 -175
- package/.next/standalone/docs/custom-hooks.md +0 -261
- package/.next/standalone/docs/getting-started.md +0 -128
- package/.next/standalone/docs/introduction.md +0 -47
- /package/.next/standalone/.next/static/{WS-OQSqL1Lp1w_obXfjvl → En9eEShUkUjgeYbY9v6Gy}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{WS-OQSqL1Lp1w_obXfjvl → En9eEShUkUjgeYbY9v6Gy}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{WS-OQSqL1Lp1w_obXfjvl → En9eEShUkUjgeYbY9v6Gy}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import type { LanguageConfig } from "./types";
|
|
2
|
+
|
|
3
|
+
export const LANGUAGES: LanguageConfig[] = [
|
|
4
|
+
// Tier 1 — largest developer populations
|
|
5
|
+
{ code: "zh", name: "Chinese (Simplified)", nativeName: "\u7b80\u4f53\u4e2d\u6587", tier: 1 },
|
|
6
|
+
{ code: "ja", name: "Japanese", nativeName: "\u65e5\u672c\u8a9e", tier: 1 },
|
|
7
|
+
{ code: "ko", name: "Korean", nativeName: "\ud55c\uad6d\uc5b4", tier: 1 },
|
|
8
|
+
{ code: "es", name: "Spanish", nativeName: "Espa\u00f1ol", tier: 1 },
|
|
9
|
+
{ code: "pt-br", name: "Portuguese (Brazil)", nativeName: "Portugu\u00eas", tier: 1 },
|
|
10
|
+
{ code: "de", name: "German", nativeName: "Deutsch", tier: 1 },
|
|
11
|
+
{ code: "fr", name: "French", nativeName: "Fran\u00e7ais", tier: 1 },
|
|
12
|
+
// Tier 2 — strong tech communities
|
|
13
|
+
{ code: "ru", name: "Russian", nativeName: "\u0420\u0443\u0441\u0441\u043a\u0438\u0439", tier: 2 },
|
|
14
|
+
{ code: "hi", name: "Hindi", nativeName: "\u0939\u093f\u0928\u094d\u0926\u0940", tier: 2 },
|
|
15
|
+
{ code: "tr", name: "Turkish", nativeName: "T\u00fcrk\u00e7e", tier: 2 },
|
|
16
|
+
{ code: "vi", name: "Vietnamese", nativeName: "Ti\u1ebfng Vi\u1ec7t", tier: 2 },
|
|
17
|
+
{ code: "it", name: "Italian", nativeName: "Italiano", tier: 2 },
|
|
18
|
+
// Tier 3 — RTL languages
|
|
19
|
+
{ code: "ar", name: "Arabic", nativeName: "\u0627\u0644\u0639\u0631\u0628\u064a\u0629", tier: 3, rtl: true },
|
|
20
|
+
{ code: "he", name: "Hebrew", nativeName: "\u05e2\u05d1\u05e8\u05d9\u05ea", tier: 3, rtl: true },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export function getLanguagesByTier(maxTier: number): LanguageConfig[] {
|
|
24
|
+
return LANGUAGES.filter((l) => l.tier <= maxTier);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getLanguageByCode(code: string): LanguageConfig | undefined {
|
|
28
|
+
return LANGUAGES.find((l) => l.code === code);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getLanguageCodes(maxTier?: number): string[] {
|
|
32
|
+
const langs = maxTier ? getLanguagesByTier(maxTier) : LANGUAGES;
|
|
33
|
+
return langs.map((l) => l.code);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Return the default model for a given tier. Tier 1 gets Sonnet, Tier 2/3 gets Haiku. */
|
|
37
|
+
export function getModelForTier(tier: number): string {
|
|
38
|
+
return tier <= 1 ? "claude-sonnet-4-6" : "claude-haiku-4-5-20251001";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Terms that should never be translated — kept as-is in all languages. */
|
|
42
|
+
export const DO_NOT_TRANSLATE = [
|
|
43
|
+
"failproofai",
|
|
44
|
+
"Failproof AI",
|
|
45
|
+
"FailproofAI",
|
|
46
|
+
"Claude Code",
|
|
47
|
+
"Agents SDK",
|
|
48
|
+
"Claude",
|
|
49
|
+
"Anthropic",
|
|
50
|
+
"Node.js",
|
|
51
|
+
"Bun",
|
|
52
|
+
"npm",
|
|
53
|
+
"npx",
|
|
54
|
+
"MDX",
|
|
55
|
+
"JSON",
|
|
56
|
+
"JSONL",
|
|
57
|
+
"ESM",
|
|
58
|
+
"CJS",
|
|
59
|
+
"settings.json",
|
|
60
|
+
"policies-config.json",
|
|
61
|
+
"policies-config.local.json",
|
|
62
|
+
"hook-activity.jsonl",
|
|
63
|
+
"hook.log",
|
|
64
|
+
"dist/index.js",
|
|
65
|
+
".failproofai",
|
|
66
|
+
"~/.failproofai",
|
|
67
|
+
"~/.claude",
|
|
68
|
+
// CLI commands and flags
|
|
69
|
+
"failproofai policies --install",
|
|
70
|
+
"failproofai policies --uninstall",
|
|
71
|
+
"--install",
|
|
72
|
+
"--uninstall",
|
|
73
|
+
"--scope",
|
|
74
|
+
"--port",
|
|
75
|
+
"--strict",
|
|
76
|
+
"--projects-path",
|
|
77
|
+
"--allowed-origins",
|
|
78
|
+
// Policy names
|
|
79
|
+
"block-sudo",
|
|
80
|
+
"block-rm-rf",
|
|
81
|
+
"sanitize-api-keys",
|
|
82
|
+
"prevent-secret-leakage",
|
|
83
|
+
"block-force-push",
|
|
84
|
+
"restrict-to-project",
|
|
85
|
+
"detect-loops",
|
|
86
|
+
// Technical terms
|
|
87
|
+
"PreToolUse",
|
|
88
|
+
"PostToolUse",
|
|
89
|
+
"PreNotification",
|
|
90
|
+
"PostNotification",
|
|
91
|
+
"allow",
|
|
92
|
+
"deny",
|
|
93
|
+
"instruct",
|
|
94
|
+
"customPolicies",
|
|
95
|
+
"localhost",
|
|
96
|
+
"stdin",
|
|
97
|
+
"stdout",
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
/** Navigation group translations for each language. */
|
|
101
|
+
export const NAV_TRANSLATIONS: Record<
|
|
102
|
+
string,
|
|
103
|
+
{
|
|
104
|
+
docs: string;
|
|
105
|
+
examples: string;
|
|
106
|
+
gettingStarted: string;
|
|
107
|
+
coreConcepts: string;
|
|
108
|
+
cli: string;
|
|
109
|
+
tools: string;
|
|
110
|
+
advanced: string;
|
|
111
|
+
}
|
|
112
|
+
> = {
|
|
113
|
+
en: {
|
|
114
|
+
docs: "Docs",
|
|
115
|
+
examples: "Examples",
|
|
116
|
+
gettingStarted: "Getting Started",
|
|
117
|
+
coreConcepts: "Core Concepts",
|
|
118
|
+
cli: "CLI",
|
|
119
|
+
tools: "Tools",
|
|
120
|
+
advanced: "Advanced",
|
|
121
|
+
},
|
|
122
|
+
zh: {
|
|
123
|
+
docs: "\u6587\u6863",
|
|
124
|
+
examples: "\u793a\u4f8b",
|
|
125
|
+
gettingStarted: "\u5feb\u901f\u5f00\u59cb",
|
|
126
|
+
coreConcepts: "\u6838\u5fc3\u6982\u5ff5",
|
|
127
|
+
cli: "CLI",
|
|
128
|
+
tools: "\u5de5\u5177",
|
|
129
|
+
advanced: "\u8fdb\u9636",
|
|
130
|
+
},
|
|
131
|
+
ja: {
|
|
132
|
+
docs: "\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8",
|
|
133
|
+
examples: "\u4f8b",
|
|
134
|
+
gettingStarted: "\u306f\u3058\u3081\u306b",
|
|
135
|
+
coreConcepts: "\u57fa\u672c\u6982\u5ff5",
|
|
136
|
+
cli: "CLI",
|
|
137
|
+
tools: "\u30c4\u30fc\u30eb",
|
|
138
|
+
advanced: "\u4e0a\u7d1a",
|
|
139
|
+
},
|
|
140
|
+
ko: {
|
|
141
|
+
docs: "\ubb38\uc11c",
|
|
142
|
+
examples: "\uc608\uc81c",
|
|
143
|
+
gettingStarted: "\uc2dc\uc791\ud558\uae30",
|
|
144
|
+
coreConcepts: "\ud575\uc2ec \uac1c\ub150",
|
|
145
|
+
cli: "CLI",
|
|
146
|
+
tools: "\ub3c4\uad6c",
|
|
147
|
+
advanced: "\uace0\uae09",
|
|
148
|
+
},
|
|
149
|
+
es: {
|
|
150
|
+
docs: "Documentaci\u00f3n",
|
|
151
|
+
examples: "Ejemplos",
|
|
152
|
+
gettingStarted: "Primeros pasos",
|
|
153
|
+
coreConcepts: "Conceptos principales",
|
|
154
|
+
cli: "CLI",
|
|
155
|
+
tools: "Herramientas",
|
|
156
|
+
advanced: "Avanzado",
|
|
157
|
+
},
|
|
158
|
+
"pt-br": {
|
|
159
|
+
docs: "Documenta\u00e7\u00e3o",
|
|
160
|
+
examples: "Exemplos",
|
|
161
|
+
gettingStarted: "Come\u00e7ando",
|
|
162
|
+
coreConcepts: "Conceitos principais",
|
|
163
|
+
cli: "CLI",
|
|
164
|
+
tools: "Ferramentas",
|
|
165
|
+
advanced: "Avan\u00e7ado",
|
|
166
|
+
},
|
|
167
|
+
de: {
|
|
168
|
+
docs: "Dokumentation",
|
|
169
|
+
examples: "Beispiele",
|
|
170
|
+
gettingStarted: "Erste Schritte",
|
|
171
|
+
coreConcepts: "Kernkonzepte",
|
|
172
|
+
cli: "CLI",
|
|
173
|
+
tools: "Werkzeuge",
|
|
174
|
+
advanced: "Fortgeschritten",
|
|
175
|
+
},
|
|
176
|
+
fr: {
|
|
177
|
+
docs: "Documentation",
|
|
178
|
+
examples: "Exemples",
|
|
179
|
+
gettingStarted: "D\u00e9marrage",
|
|
180
|
+
coreConcepts: "Concepts cl\u00e9s",
|
|
181
|
+
cli: "CLI",
|
|
182
|
+
tools: "Outils",
|
|
183
|
+
advanced: "Avanc\u00e9",
|
|
184
|
+
},
|
|
185
|
+
ru: {
|
|
186
|
+
docs: "\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f",
|
|
187
|
+
examples: "\u041f\u0440\u0438\u043c\u0435\u0440\u044b",
|
|
188
|
+
gettingStarted: "\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b",
|
|
189
|
+
coreConcepts: "\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438",
|
|
190
|
+
cli: "CLI",
|
|
191
|
+
tools: "\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b",
|
|
192
|
+
advanced: "\u041f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u0442\u044b\u0439",
|
|
193
|
+
},
|
|
194
|
+
hi: {
|
|
195
|
+
docs: "\u0926\u0938\u094d\u0924\u093e\u0935\u0947\u091c\u093c",
|
|
196
|
+
examples: "\u0909\u0926\u093e\u0939\u0930\u0923",
|
|
197
|
+
gettingStarted: "\u0936\u0941\u0930\u0942 \u0915\u0930\u0947\u0902",
|
|
198
|
+
coreConcepts: "\u092e\u0942\u0932 \u0905\u0935\u0927\u093e\u0930\u0923\u093e\u090f\u0901",
|
|
199
|
+
cli: "CLI",
|
|
200
|
+
tools: "\u0909\u092a\u0915\u0930\u0923",
|
|
201
|
+
advanced: "\u0909\u0928\u094d\u0928\u0924",
|
|
202
|
+
},
|
|
203
|
+
tr: {
|
|
204
|
+
docs: "Belgeler",
|
|
205
|
+
examples: "\u00d6rnekler",
|
|
206
|
+
gettingStarted: "Ba\u015flang\u0131\u00e7",
|
|
207
|
+
coreConcepts: "Temel Kavramlar",
|
|
208
|
+
cli: "CLI",
|
|
209
|
+
tools: "Ara\u00e7lar",
|
|
210
|
+
advanced: "Geli\u015fmi\u015f",
|
|
211
|
+
},
|
|
212
|
+
vi: {
|
|
213
|
+
docs: "T\u00e0i li\u1ec7u",
|
|
214
|
+
examples: "V\u00ed d\u1ee5",
|
|
215
|
+
gettingStarted: "B\u1eaft \u0111\u1ea7u",
|
|
216
|
+
coreConcepts: "Kh\u00e1i ni\u1ec7m c\u1ed1t l\u00f5i",
|
|
217
|
+
cli: "CLI",
|
|
218
|
+
tools: "C\u00f4ng c\u1ee5",
|
|
219
|
+
advanced: "N\u00e2ng cao",
|
|
220
|
+
},
|
|
221
|
+
it: {
|
|
222
|
+
docs: "Documentazione",
|
|
223
|
+
examples: "Esempi",
|
|
224
|
+
gettingStarted: "Per iniziare",
|
|
225
|
+
coreConcepts: "Concetti chiave",
|
|
226
|
+
cli: "CLI",
|
|
227
|
+
tools: "Strumenti",
|
|
228
|
+
advanced: "Avanzato",
|
|
229
|
+
},
|
|
230
|
+
ar: {
|
|
231
|
+
docs: "\u0627\u0644\u0645\u0633\u062a\u0646\u062f\u0627\u062a",
|
|
232
|
+
examples: "\u0623\u0645\u062b\u0644\u0629",
|
|
233
|
+
gettingStarted: "\u0627\u0644\u0628\u062f\u0627\u064a\u0629",
|
|
234
|
+
coreConcepts: "\u0627\u0644\u0645\u0641\u0627\u0647\u064a\u0645 \u0627\u0644\u0623\u0633\u0627\u0633\u064a\u0629",
|
|
235
|
+
cli: "CLI",
|
|
236
|
+
tools: "\u0627\u0644\u0623\u062f\u0648\u0627\u062a",
|
|
237
|
+
advanced: "\u0645\u062a\u0642\u062f\u0645",
|
|
238
|
+
},
|
|
239
|
+
he: {
|
|
240
|
+
docs: "\u05ea\u05d9\u05e2\u05d5\u05d3",
|
|
241
|
+
examples: "\u05d3\u05d5\u05d2\u05de\u05d0\u05d5\u05ea",
|
|
242
|
+
gettingStarted: "\u05ea\u05d7\u05d9\u05dc\u05ea \u05e2\u05d1\u05d5\u05d3\u05d4",
|
|
243
|
+
coreConcepts: "\u05de\u05d5\u05e9\u05d2\u05d9 \u05d9\u05e1\u05d5\u05d3",
|
|
244
|
+
cli: "CLI",
|
|
245
|
+
tools: "\u05db\u05dc\u05d9\u05dd",
|
|
246
|
+
advanced: "\u05de\u05ea\u05e7\u05d3\u05dd",
|
|
247
|
+
},
|
|
248
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { dirname, join, relative } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { getLanguageByCode } from "./config";
|
|
5
|
+
import { translateContent } from "./translator";
|
|
6
|
+
import {
|
|
7
|
+
readCache,
|
|
8
|
+
writeCache,
|
|
9
|
+
isCached,
|
|
10
|
+
setCacheEntry,
|
|
11
|
+
} from "./cache";
|
|
12
|
+
import type { TranslationResult, TranslationCache } from "./types";
|
|
13
|
+
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
const DOCS_DIR = join(__dirname, "..", "..", "docs");
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Rewrite internal doc links to include the language prefix.
|
|
19
|
+
* e.g. href="/built-in-policies" -> href="/es/built-in-policies"
|
|
20
|
+
* [Getting started](/getting-started) -> [Getting started](/es/getting-started)
|
|
21
|
+
*/
|
|
22
|
+
export function rewriteInternalLinks(
|
|
23
|
+
content: string,
|
|
24
|
+
lang: string,
|
|
25
|
+
): string {
|
|
26
|
+
// Rewrite MDX component href attributes pointing to internal paths
|
|
27
|
+
let result = content.replace(
|
|
28
|
+
/href="(\/[^"]*?)"/g,
|
|
29
|
+
(_match, path: string) => {
|
|
30
|
+
// Skip external URLs and anchors
|
|
31
|
+
if (path.startsWith("/http") || path === "/") return `href="${path}"`;
|
|
32
|
+
return `href="/${lang}${path}"`;
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
// Rewrite Markdown links with internal paths
|
|
37
|
+
result = result.replace(
|
|
38
|
+
/\]\((\/[^)]*?)\)/g,
|
|
39
|
+
(_match, path: string) => {
|
|
40
|
+
if (path.startsWith("/http") || path === "/") return `](${path})`;
|
|
41
|
+
return `](/${lang}${path})`;
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return result;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Translate a single MDX doc page for a given language.
|
|
50
|
+
*/
|
|
51
|
+
export async function translateMdxPage(
|
|
52
|
+
sourcePath: string,
|
|
53
|
+
lang: string,
|
|
54
|
+
options: { force?: boolean; dryRun?: boolean; model?: string; cache?: TranslationCache } = {},
|
|
55
|
+
): Promise<TranslationResult> {
|
|
56
|
+
const relPath = relative(DOCS_DIR, sourcePath);
|
|
57
|
+
const outputPath = join(DOCS_DIR, lang, relPath);
|
|
58
|
+
const sourceContent = readFileSync(sourcePath, "utf-8");
|
|
59
|
+
|
|
60
|
+
const langConfig = getLanguageByCode(lang);
|
|
61
|
+
if (!langConfig) throw new Error(`Unknown language: ${lang}`);
|
|
62
|
+
|
|
63
|
+
// Check cache — use provided cache object or read from disk
|
|
64
|
+
if (!options.force && !options.dryRun) {
|
|
65
|
+
const cache = options.cache ?? readCache();
|
|
66
|
+
if (isCached(cache, relPath, lang, sourceContent)) {
|
|
67
|
+
return {
|
|
68
|
+
lang,
|
|
69
|
+
sourcePath,
|
|
70
|
+
outputPath,
|
|
71
|
+
inputTokens: 0,
|
|
72
|
+
outputTokens: 0,
|
|
73
|
+
cached: true,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (options.dryRun) {
|
|
79
|
+
return {
|
|
80
|
+
lang,
|
|
81
|
+
sourcePath,
|
|
82
|
+
outputPath,
|
|
83
|
+
inputTokens: 0,
|
|
84
|
+
outputTokens: 0,
|
|
85
|
+
cached: false,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Translate
|
|
90
|
+
const { translated, inputTokens, outputTokens } = await translateContent(
|
|
91
|
+
sourceContent,
|
|
92
|
+
lang,
|
|
93
|
+
langConfig.name,
|
|
94
|
+
options.model,
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// Rewrite internal links
|
|
98
|
+
const withLinks = rewriteInternalLinks(translated, lang);
|
|
99
|
+
|
|
100
|
+
// Write output
|
|
101
|
+
mkdirSync(dirname(outputPath), { recursive: true });
|
|
102
|
+
writeFileSync(outputPath, withLinks);
|
|
103
|
+
|
|
104
|
+
// Update cache — skip if caller manages the cache (batch write)
|
|
105
|
+
if (!options.cache) {
|
|
106
|
+
const cache = readCache();
|
|
107
|
+
setCacheEntry(cache, relPath, lang, sourceContent, inputTokens, outputTokens);
|
|
108
|
+
writeCache(cache);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
lang,
|
|
113
|
+
sourcePath,
|
|
114
|
+
outputPath,
|
|
115
|
+
inputTokens,
|
|
116
|
+
outputTokens,
|
|
117
|
+
cached: false,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Get all MDX page paths from the docs directory (English only, no language subdirs).
|
|
123
|
+
*/
|
|
124
|
+
export function getEnglishMdxPages(): string[] {
|
|
125
|
+
const results: string[] = [];
|
|
126
|
+
|
|
127
|
+
function walk(dir: string, prefix: string = "") {
|
|
128
|
+
for (const entry of readdirSync(dir)) {
|
|
129
|
+
const full = join(dir, entry);
|
|
130
|
+
const rel = prefix ? `${prefix}/${entry}` : entry;
|
|
131
|
+
if (statSync(full).isDirectory()) {
|
|
132
|
+
// Skip language directories at the top level
|
|
133
|
+
if (!prefix && isLanguageDir(entry)) continue;
|
|
134
|
+
// Skip non-doc directories like logo, i18n
|
|
135
|
+
if (!prefix && (entry === "logo" || entry === "i18n")) continue;
|
|
136
|
+
walk(full, rel);
|
|
137
|
+
} else if (entry.endsWith(".mdx")) {
|
|
138
|
+
results.push(full);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
walk(DOCS_DIR);
|
|
144
|
+
return results.sort();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function isLanguageDir(name: string): boolean {
|
|
148
|
+
const langCodes = [
|
|
149
|
+
"zh", "ja", "ko", "es", "pt-br", "de", "fr",
|
|
150
|
+
"ru", "hi", "tr", "vi", "it", "ar", "he",
|
|
151
|
+
];
|
|
152
|
+
return langCodes.includes(name);
|
|
153
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { NAV_TRANSLATIONS, LANGUAGES } from "./config";
|
|
5
|
+
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const DOCS_JSON_PATH = join(__dirname, "..", "..", "docs", "docs.json");
|
|
8
|
+
|
|
9
|
+
interface NavGroup {
|
|
10
|
+
group: string;
|
|
11
|
+
pages: string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface NavTab {
|
|
15
|
+
tab: string;
|
|
16
|
+
groups: NavGroup[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface LanguageNav {
|
|
20
|
+
language: string;
|
|
21
|
+
tabs: NavTab[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Build a navigation entry for a specific language by transforming the
|
|
26
|
+
* English navigation structure.
|
|
27
|
+
*/
|
|
28
|
+
export function buildLanguageNav(
|
|
29
|
+
englishTabs: NavTab[],
|
|
30
|
+
lang: string,
|
|
31
|
+
): LanguageNav {
|
|
32
|
+
const t = NAV_TRANSLATIONS[lang];
|
|
33
|
+
if (!t) throw new Error(`No nav translations for language: ${lang}`);
|
|
34
|
+
|
|
35
|
+
const groupNameMap: Record<string, string> = {
|
|
36
|
+
"Getting Started": t.gettingStarted,
|
|
37
|
+
"Core Concepts": t.coreConcepts,
|
|
38
|
+
CLI: t.cli,
|
|
39
|
+
Tools: t.tools,
|
|
40
|
+
Advanced: t.advanced,
|
|
41
|
+
Examples: t.examples,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const tabNameMap: Record<string, string> = {
|
|
45
|
+
Docs: t.docs,
|
|
46
|
+
Examples: t.examples,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const tabs: NavTab[] = englishTabs.map((tab) => ({
|
|
50
|
+
tab: tabNameMap[tab.tab] || tab.tab,
|
|
51
|
+
groups: tab.groups.map((group) => ({
|
|
52
|
+
group: groupNameMap[group.group] || group.group,
|
|
53
|
+
pages: group.pages.map((page) => `${lang}/${page}`),
|
|
54
|
+
})),
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
return { language: lang, tabs };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Read the current docs.json config.
|
|
62
|
+
*/
|
|
63
|
+
export function readDocsConfig(): Record<string, unknown> {
|
|
64
|
+
return JSON.parse(readFileSync(DOCS_JSON_PATH, "utf-8"));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Generate the full languages array for docs.json from the English nav
|
|
69
|
+
* and a list of language codes.
|
|
70
|
+
*/
|
|
71
|
+
export function generateLanguagesArray(
|
|
72
|
+
englishTabs: NavTab[],
|
|
73
|
+
langCodes: string[],
|
|
74
|
+
): LanguageNav[] {
|
|
75
|
+
// English first (default)
|
|
76
|
+
const english: LanguageNav = { language: "en", tabs: englishTabs };
|
|
77
|
+
const others = langCodes.map((code) => buildLanguageNav(englishTabs, code));
|
|
78
|
+
return [english, ...others];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Update docs.json to use the languages array structure.
|
|
83
|
+
*/
|
|
84
|
+
export function updateDocsJson(langCodes: string[]): void {
|
|
85
|
+
const config = readDocsConfig();
|
|
86
|
+
const nav = config.navigation as Record<string, unknown>;
|
|
87
|
+
|
|
88
|
+
// Extract existing English tabs
|
|
89
|
+
const englishTabs = nav.tabs as NavTab[];
|
|
90
|
+
if (!englishTabs) {
|
|
91
|
+
throw new Error("docs.json navigation.tabs not found — is this already using the languages format?");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Build languages array
|
|
95
|
+
const languages = generateLanguagesArray(englishTabs, langCodes);
|
|
96
|
+
|
|
97
|
+
// Replace tabs with languages, preserve global
|
|
98
|
+
const newNav: Record<string, unknown> = {
|
|
99
|
+
languages,
|
|
100
|
+
};
|
|
101
|
+
if (nav.global) {
|
|
102
|
+
newNav.global = nav.global;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
config.navigation = newNav;
|
|
106
|
+
writeFileSync(DOCS_JSON_PATH, JSON.stringify(config, null, 2) + "\n");
|
|
107
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { LANGUAGES, getLanguageByCode } from "./config";
|
|
5
|
+
import { translateContent } from "./translator";
|
|
6
|
+
import { readCache, writeCache, isCached, setCacheEntry } from "./cache";
|
|
7
|
+
import type { TranslationResult, TranslationCache } from "./types";
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const ROOT_DIR = join(__dirname, "..", "..");
|
|
11
|
+
const README_PATH = join(ROOT_DIR, "README.md");
|
|
12
|
+
const I18N_DIR = join(ROOT_DIR, "docs", "i18n");
|
|
13
|
+
|
|
14
|
+
function buildLanguageSelector(currentLang: string): string {
|
|
15
|
+
const flags: Record<string, string> = {
|
|
16
|
+
en: "\ud83c\uddfa\ud83c\uddf8",
|
|
17
|
+
zh: "\ud83c\udde8\ud83c\uddf3",
|
|
18
|
+
ja: "\ud83c\uddef\ud83c\uddf5",
|
|
19
|
+
ko: "\ud83c\uddf0\ud83c\uddf7",
|
|
20
|
+
es: "\ud83c\uddea\ud83c\uddf8",
|
|
21
|
+
"pt-br": "\ud83c\udde7\ud83c\uddf7",
|
|
22
|
+
de: "\ud83c\udde9\ud83c\uddea",
|
|
23
|
+
fr: "\ud83c\uddeb\ud83c\uddf7",
|
|
24
|
+
ru: "\ud83c\uddf7\ud83c\uddfa",
|
|
25
|
+
hi: "\ud83c\uddee\ud83c\uddf3",
|
|
26
|
+
tr: "\ud83c\uddf9\ud83c\uddf7",
|
|
27
|
+
vi: "\ud83c\uddfb\ud83c\uddf3",
|
|
28
|
+
it: "\ud83c\uddee\ud83c\uddf9",
|
|
29
|
+
ar: "\ud83c\uddf8\ud83c\udde6",
|
|
30
|
+
he: "\ud83c\uddee\ud83c\uddf1",
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const links: string[] = [];
|
|
34
|
+
|
|
35
|
+
// English link (to root README)
|
|
36
|
+
if (currentLang !== "en") {
|
|
37
|
+
links.push(`[${flags.en} English](../../README.md)`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
for (const lang of LANGUAGES) {
|
|
41
|
+
const flag = flags[lang.code] || "";
|
|
42
|
+
if (lang.code === currentLang) {
|
|
43
|
+
links.push(`**${flag} ${lang.nativeName}**`);
|
|
44
|
+
} else {
|
|
45
|
+
links.push(`[${flag} ${lang.nativeName}](README.${lang.code}.md)`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return links.join(" | ");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function translateReadme(
|
|
53
|
+
lang: string,
|
|
54
|
+
options: { force?: boolean; dryRun?: boolean; model?: string; cache?: TranslationCache } = {},
|
|
55
|
+
): Promise<TranslationResult> {
|
|
56
|
+
const outputPath = join(I18N_DIR, `README.${lang}.md`);
|
|
57
|
+
const sourceContent = readFileSync(README_PATH, "utf-8");
|
|
58
|
+
|
|
59
|
+
const langConfig = getLanguageByCode(lang);
|
|
60
|
+
if (!langConfig) throw new Error(`Unknown language: ${lang}`);
|
|
61
|
+
|
|
62
|
+
// Check cache — use provided cache object or read from disk
|
|
63
|
+
if (!options.force && !options.dryRun) {
|
|
64
|
+
const cache = options.cache ?? readCache();
|
|
65
|
+
if (isCached(cache, "README.md", lang, sourceContent)) {
|
|
66
|
+
return {
|
|
67
|
+
lang,
|
|
68
|
+
sourcePath: README_PATH,
|
|
69
|
+
outputPath,
|
|
70
|
+
inputTokens: 0,
|
|
71
|
+
outputTokens: 0,
|
|
72
|
+
cached: true,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (options.dryRun) {
|
|
78
|
+
return {
|
|
79
|
+
lang,
|
|
80
|
+
sourcePath: README_PATH,
|
|
81
|
+
outputPath,
|
|
82
|
+
inputTokens: 0,
|
|
83
|
+
outputTokens: 0,
|
|
84
|
+
cached: false,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Translate
|
|
89
|
+
const { translated, inputTokens, outputTokens } = await translateContent(
|
|
90
|
+
sourceContent,
|
|
91
|
+
lang,
|
|
92
|
+
langConfig.name,
|
|
93
|
+
options.model,
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// Build the final output with header
|
|
97
|
+
const disclaimer = langConfig.rtl
|
|
98
|
+
? `> **\u26a0\ufe0f** \u0647\u0630\u0647 \u062a\u0631\u062c\u0645\u0629 \u0622\u0644\u064a\u0629. \u0644\u0644\u0627\u0637\u0644\u0627\u0639 \u0639\u0644\u0649 \u0623\u062d\u062f\u062b \u0625\u0635\u062f\u0627\u0631\u060c \u0631\u0627\u062c\u0639 [English README](../../README.md).`
|
|
99
|
+
: `> **\u26a0\ufe0f** This is an auto-generated translation. For the latest version, see the [English README](../../README.md). Community corrections welcome!`;
|
|
100
|
+
|
|
101
|
+
const langSelector = buildLanguageSelector(lang);
|
|
102
|
+
const rtlOpen = langConfig.rtl ? `<div dir="rtl">\n\n` : "";
|
|
103
|
+
const rtlClose = langConfig.rtl ? `\n\n</div>` : "";
|
|
104
|
+
|
|
105
|
+
const output = `${disclaimer}\n\n${langSelector}\n\n---\n${rtlOpen}\n${translated}\n${rtlClose}`;
|
|
106
|
+
|
|
107
|
+
// Write output
|
|
108
|
+
mkdirSync(I18N_DIR, { recursive: true });
|
|
109
|
+
writeFileSync(outputPath, output);
|
|
110
|
+
|
|
111
|
+
// Update cache — skip if caller manages the cache (batch write)
|
|
112
|
+
if (!options.cache) {
|
|
113
|
+
const cache = readCache();
|
|
114
|
+
setCacheEntry(cache, "README.md", lang, sourceContent, inputTokens, outputTokens);
|
|
115
|
+
writeCache(cache);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
lang,
|
|
120
|
+
sourcePath: README_PATH,
|
|
121
|
+
outputPath,
|
|
122
|
+
inputTokens,
|
|
123
|
+
outputTokens,
|
|
124
|
+
cached: false,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Build the language selector line to add to the main README.
|
|
130
|
+
*/
|
|
131
|
+
export function buildMainReadmeLanguageLinks(): string {
|
|
132
|
+
const flags: Record<string, string> = {
|
|
133
|
+
zh: "\ud83c\udde8\ud83c\uddf3",
|
|
134
|
+
ja: "\ud83c\uddef\ud83c\uddf5",
|
|
135
|
+
ko: "\ud83c\uddf0\ud83c\uddf7",
|
|
136
|
+
es: "\ud83c\uddea\ud83c\uddf8",
|
|
137
|
+
"pt-br": "\ud83c\udde7\ud83c\uddf7",
|
|
138
|
+
de: "\ud83c\udde9\ud83c\uddea",
|
|
139
|
+
fr: "\ud83c\uddeb\ud83c\uddf7",
|
|
140
|
+
ru: "\ud83c\uddf7\ud83c\uddfa",
|
|
141
|
+
hi: "\ud83c\uddee\ud83c\uddf3",
|
|
142
|
+
tr: "\ud83c\uddf9\ud83c\uddf7",
|
|
143
|
+
vi: "\ud83c\uddfb\ud83c\uddf3",
|
|
144
|
+
it: "\ud83c\uddee\ud83c\uddf9",
|
|
145
|
+
ar: "\ud83c\uddf8\ud83c\udde6",
|
|
146
|
+
he: "\ud83c\uddee\ud83c\uddf1",
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const links = LANGUAGES.map(
|
|
150
|
+
(l) => `[${flags[l.code] || ""} ${l.nativeName}](docs/i18n/README.${l.code}.md)`,
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
return `**Translations**: ${links.join(" | ")}`;
|
|
154
|
+
}
|