diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f629591..79daa04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,6 +90,9 @@ jobs: - run: pnpm install --frozen-lockfile + - name: Node engine contract + run: pnpm check:node-engine + # `postinstall` builds all five @openmaic packages, and some of them # generate tracked, publishable files (renderer's fonts.css and its KaTeX # font snapshot). The publish workflow refuses to release when the build diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 00dfce6..d6c4581 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,7 +24,7 @@ To avoid duplicate effort, please **comment on an issue** to claim it before you ## Prerequisites -- [Node.js](https://nodejs.org/) >= 20.9.0 +- [Node.js](https://nodejs.org/) >= 22.19.0 - [pnpm](https://pnpm.io/) (latest) - A copy of `.env.local` — see [`.env.example`](.env.example) for reference diff --git a/README-zh.md b/README-zh.md index 39d2cbc..7fa80f3 100644 --- a/README-zh.md +++ b/README-zh.md @@ -92,7 +92,7 @@ https://github.com/user-attachments/assets/dbd013f6-9fab-43c5-a788-b47126cff7a8 ### 环境要求 -- **Node.js** >= 20 +- **Node.js** >= 22.19 - **pnpm** >= 10 ### 1. 克隆 & 安装 diff --git a/README.md b/README.md index 99e1021..eea60c0 100644 --- a/README.md +++ b/README.md @@ -105,7 +105,7 @@ https://github.com/user-attachments/assets/b4ab35ac-f994-46b1-8957-e82fe87ff0e9 ### Prerequisites -- **Node.js** >= 20 +- **Node.js** >= 22.19 - **pnpm** >= 10 ### 1. Clone & Install diff --git a/package.json b/package.json index 45448c1..8189965 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "license": "MIT", "engines": { - "node": ">=20.9.0" + "node": ">=22.19.0" }, "scripts": { "postinstall": "cd packages/mathml2omml && npm run build && cd ../pptxgenjs && npm run build && cd ../@openmaic/dsl && pnpm run build && cd ../generation && pnpm run build && cd ../storage && pnpm run build && cd ../importer && pnpm run build && cd ../renderer && pnpm run build && cd ../editor && pnpm run build && cd ../../.. && node scripts/sync-maic-importer.mjs", @@ -17,6 +17,7 @@ "start": "next start", "lint": "eslint", "check:i18n-keys": "node scripts/check-i18n-keys.mjs", + "check:node-engine": "node scripts/check-node-engine-contract.mjs", "check:package-versions": "node scripts/check-package-version-bumps.mjs", "check": "prettier . --check", "format": "prettier . --write", diff --git a/packages/docs/content/docs/deployment.ar.mdx b/packages/docs/content/docs/deployment.ar.mdx index 75d265c..5966504 100644 --- a/packages/docs/content/docs/deployment.ar.mdx +++ b/packages/docs/content/docs/deployment.ar.mdx @@ -56,7 +56,7 @@ services: ## الاستضافة الذاتية على جهاز افتراضي -يحتاج المضيف إلى Node.js `20.9.0` أو أحدث، وpnpm `10.28.0`. قم بالبناء والتشغيل باستخدام `pnpm`: +يحتاج المضيف إلى Node.js `22.19.0` أو أحدث، وpnpm `10.28.0`. قم بالبناء والتشغيل باستخدام `pnpm`: ```bash pnpm install diff --git a/packages/docs/content/docs/deployment.ja.mdx b/packages/docs/content/docs/deployment.ja.mdx index ca50cae..d585c29 100644 --- a/packages/docs/content/docs/deployment.ja.mdx +++ b/packages/docs/content/docs/deployment.ja.mdx @@ -56,7 +56,7 @@ Docker コンテナ内の `localhost` はコンテナ自身を指します。ホ ## 自前の仮想マシンでのセルフホスト -ホストには Node.js `20.9.0` 以上と pnpm `10.28.0` が必要です。`pnpm` でビルドして起動します: +ホストには Node.js `22.19.0` 以上と pnpm `10.28.0` が必要です。`pnpm` でビルドして起動します: ```bash pnpm install diff --git a/packages/docs/content/docs/deployment.mdx b/packages/docs/content/docs/deployment.mdx index 5ef237f..af0f90c 100644 --- a/packages/docs/content/docs/deployment.mdx +++ b/packages/docs/content/docs/deployment.mdx @@ -56,7 +56,7 @@ Inside a Docker container, `localhost` refers to the container itself. If Ollama ## Self-host on a VM -The host needs Node.js `20.9.0` or later and pnpm `10.28.0`. Build and start with `pnpm`: +The host needs Node.js `22.19.0` or later and pnpm `10.28.0`. Build and start with `pnpm`: ```bash pnpm install diff --git a/packages/docs/content/docs/deployment.ru.mdx b/packages/docs/content/docs/deployment.ru.mdx index 9137237..082a51e 100644 --- a/packages/docs/content/docs/deployment.ru.mdx +++ b/packages/docs/content/docs/deployment.ru.mdx @@ -56,7 +56,7 @@ services: ## Самостоятельный хостинг на виртуальной машине -Требуется Node.js версии не ниже `20.9.0` и pnpm `10.28.0`. Соберите и запустите через `pnpm`: +Требуется Node.js версии не ниже `22.19.0` и pnpm `10.28.0`. Соберите и запустите через `pnpm`: ```bash pnpm install diff --git a/packages/docs/content/docs/deployment.zh-cn.mdx b/packages/docs/content/docs/deployment.zh-cn.mdx index 5af6492..f4b7acd 100644 --- a/packages/docs/content/docs/deployment.zh-cn.mdx +++ b/packages/docs/content/docs/deployment.zh-cn.mdx @@ -56,7 +56,7 @@ Docker 容器中的 `localhost` 指向容器自身。若 Ollama、Lemonade、Vox ## 自建虚拟机 -主机需要 Node.js `20.9.0` 或更高版本,以及 pnpm `10.28.0`。用 `pnpm` 构建并启动: +主机需要 Node.js `22.19.0` 或更高版本,以及 pnpm `10.28.0`。用 `pnpm` 构建并启动: ```bash pnpm install diff --git a/packages/docs/content/docs/deployment.zh-tw.mdx b/packages/docs/content/docs/deployment.zh-tw.mdx index 342dc36..2b171df 100644 --- a/packages/docs/content/docs/deployment.zh-tw.mdx +++ b/packages/docs/content/docs/deployment.zh-tw.mdx @@ -56,7 +56,7 @@ Docker 容器中的 `localhost` 指向容器本身。若 Ollama、Lemonade、Vox ## 自建 VM -主機需要 Node.js `20.9.0` 或更新版本,以及 pnpm `10.28.0`。使用 `pnpm` 建置並啟動: +主機需要 Node.js `22.19.0` 或更新版本,以及 pnpm `10.28.0`。使用 `pnpm` 建置並啟動: ```bash pnpm install diff --git a/packages/docs/content/docs/getting-started.ar.mdx b/packages/docs/content/docs/getting-started.ar.mdx index ef08431..f3a321c 100644 --- a/packages/docs/content/docs/getting-started.ar.mdx +++ b/packages/docs/content/docs/getting-started.ar.mdx @@ -7,7 +7,7 @@ OpenMAIC هو تطبيق Next.js يمكن تشغيله على جهازك الخ ## المتطلبات المسبقة -- **Node.js** 20.9.0 أو أحدث +- **Node.js** 22.19.0 أو أحدث - **pnpm** 10.28.0 (إذا لم يكن مثبتًا، نفذ `npm install -g pnpm@10.28.0`) - إعداد مزود LLM واحد على الأقل؛ عادةً ما تتطلب المزودات السحابية مفتاح API، أما Ollama أو Lemonade المحليان فلا يحتاجان إلى مفتاح API diff --git a/packages/docs/content/docs/getting-started.ja.mdx b/packages/docs/content/docs/getting-started.ja.mdx index f71a56e..26f9253 100644 --- a/packages/docs/content/docs/getting-started.ja.mdx +++ b/packages/docs/content/docs/getting-started.ja.mdx @@ -7,7 +7,7 @@ OpenMAIC は自分のマシンで動かせる Next.js アプリケーション ## 前提条件 -- **Node.js** 20.9.0 以上 +- **Node.js** 22.19.0 以上 - **pnpm** 10.28.0(未インストールの場合は `npm install -g pnpm@10.28.0`) - 少なくとも 1 つの LLM プロバイダーを設定。クラウドのプロバイダーは通常 API key が必要、ローカルの Ollama や Lemonade は API key 不要 diff --git a/packages/docs/content/docs/getting-started.mdx b/packages/docs/content/docs/getting-started.mdx index 3e78ab4..451b070 100644 --- a/packages/docs/content/docs/getting-started.mdx +++ b/packages/docs/content/docs/getting-started.mdx @@ -7,7 +7,7 @@ OpenMAIC is a Next.js application that runs on your own machine. You need to con ## Prerequisites -- **Node.js** 20.9.0 or later +- **Node.js** 22.19.0 or later - **pnpm** 10.28.0 (if needed, run `npm install -g pnpm@10.28.0`) - At least one LLM provider; cloud providers usually require an API key, while local Ollama or Lemonade does not diff --git a/packages/docs/content/docs/getting-started.ru.mdx b/packages/docs/content/docs/getting-started.ru.mdx index 20c6186..8172e68 100644 --- a/packages/docs/content/docs/getting-started.ru.mdx +++ b/packages/docs/content/docs/getting-started.ru.mdx @@ -7,7 +7,7 @@ OpenMAIC — это приложение на Next.js, которое можно ## Предварительные требования -- **Node.js** версии 20.9.0 или выше +- **Node.js** версии 22.19.0 или выше - **pnpm** версии 10.28.0 (если не установлен, выполните `npm install -g pnpm@10.28.0`) - Настроить как минимум одного LLM-провайдера; облачные провайдеры обычно требуют API key, локальные Ollama или Lemonade — нет diff --git a/packages/docs/content/docs/getting-started.zh-cn.mdx b/packages/docs/content/docs/getting-started.zh-cn.mdx index 600c973..ba247a5 100644 --- a/packages/docs/content/docs/getting-started.zh-cn.mdx +++ b/packages/docs/content/docs/getting-started.zh-cn.mdx @@ -7,7 +7,7 @@ OpenMAIC 是一个 Next.js 应用,可以在自己的机器上运行。你需 ## 前置条件 -- **Node.js** 20.9.0 或更高 +- **Node.js** 22.19.0 或更高 - **pnpm** 10.28.0(如果没装,先 `npm install -g pnpm@10.28.0`) - 至少配置一个 LLM provider;云端 provider 通常需要 API key,本地 Ollama 或 Lemonade 不需要 API key diff --git a/packages/docs/content/docs/getting-started.zh-tw.mdx b/packages/docs/content/docs/getting-started.zh-tw.mdx index eed14c7..94987d4 100644 --- a/packages/docs/content/docs/getting-started.zh-tw.mdx +++ b/packages/docs/content/docs/getting-started.zh-tw.mdx @@ -7,7 +7,7 @@ OpenMAIC 是一個 Next.js 應用程式,可以在自己的機器上執行。 ## 前置條件 -- **Node.js** 20.9.0 或更新版本 +- **Node.js** 22.19.0 或更新版本 - **pnpm** 10.28.0(如果尚未安裝,請先執行 `npm install -g pnpm@10.28.0`) - 至少設定一個 LLM provider;雲端 provider 通常需要 API key,本機 Ollama 或 Lemonade 不需要 API key diff --git a/scripts/check-node-engine-contract.mjs b/scripts/check-node-engine-contract.mjs new file mode 100644 index 0000000..78bc399 --- /dev/null +++ b/scripts/check-node-engine-contract.mjs @@ -0,0 +1,73 @@ +import { readFileSync } from 'node:fs'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import semver from 'semver'; + +const repositoryRoot = dirname(fileURLToPath(new URL('../package.json', import.meta.url))); + +function readManifest(path) { + return JSON.parse(readFileSync(path, 'utf8')); +} + +function fail(headline, problems) { + console.error([headline, ...problems.map((problem) => `- ${problem}`)].join('\n')); + process.exit(1); +} + +const rootManifest = readManifest(join(repositoryRoot, 'package.json')); +const rootRange = rootManifest.engines?.node; +const rootMinimum = rootRange ? semver.minVersion(rootRange) : null; +if (!rootRange || rootMinimum === null) { + fail('The root Node engine contract is invalid:', [ + `package.json engines.node must be a valid semver range, got ${JSON.stringify(rootRange)}.`, + ]); +} + +const failures = []; +let constrainedDependencies = 0; + +for (const dependency of Object.keys(rootManifest.dependencies ?? {}).sort()) { + const manifestPath = join( + repositoryRoot, + 'node_modules', + ...dependency.split('/'), + 'package.json', + ); + let manifest; + try { + manifest = readManifest(manifestPath); + } catch (error) { + failures.push( + `cannot read installed manifest for ${dependency} at ${manifestPath}: ${String(error)}. ` + + 'Run pnpm install before this check.', + ); + continue; + } + + const dependencyRange = manifest.engines?.node; + if (!dependencyRange) continue; + constrainedDependencies += 1; + const dependencyMinimum = semver.minVersion(dependencyRange); + if (dependencyMinimum === null) { + failures.push( + `${dependency} declares an invalid engines.node range: ${JSON.stringify(dependencyRange)}.`, + ); + continue; + } + if (semver.lt(rootMinimum, dependencyMinimum)) { + failures.push( + `root engines.node ${JSON.stringify(rootRange)} starts at ${rootMinimum.version}, below ` + + `${dependency}@${manifest.version} engines.node ${JSON.stringify(dependencyRange)} ` + + `(minimum ${dependencyMinimum.version}).`, + ); + } +} + +if (failures.length > 0) { + fail('The root Node engine minimum is below its direct production dependencies:', failures); +} + +console.log( + `Node engine contract passed: root minimum ${rootMinimum.version} satisfies ` + + `${constrainedDependencies} engine-constrained direct production dependencies.`, +); diff --git a/skills/openmaic/references/extend.md b/skills/openmaic/references/extend.md index bfc0d65..d0f23ea 100644 --- a/skills/openmaic/references/extend.md +++ b/skills/openmaic/references/extend.md @@ -9,7 +9,7 @@ This reference takes priority over the `accessCode` auto-shortcut in Phase 0: if ## Secondary-Development Rules 1. **Read before edit.** Before changing any file, read it (and the symbols it imports) so the edit matches surrounding conventions. Do not paste large code blocks into chat — point the user at `file:line` entry points and let them read. -2. **Toolchain is hard-required.** `pnpm@10.28.0` (root `packageManager`), Node `>=20.9` (`.nvmrc` pins `22`). Mismatched pnpm will fail install. +2. **Toolchain is hard-required.** `pnpm@10.28.0` (root `packageManager`), Node `>=22.19.0` (`.nvmrc` pins `22`). Mismatched pnpm will fail install. 3. **Forking and disabling CI are conditional, not defaults.** Decide per the user's intent — see Development Environment below — instead of reflexively forking every user. ## Development Environment (Same As Local Deployment)