Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix(mcp): a CI install leaves the manifest to the task that reads it

Sidwebworksbbbf8590e5d8
diff --git a/.claude/rules/mcp-tools-reference.md b/.claude/rules/mcp-tools-reference.md
index 58bc420741..106615022a 100644
--- a/.claude/rules/mcp-tools-reference.md
+++ b/.claude/rules/mcp-tools-reference.md
@@ -28,9 +28,13 @@ catalogSearch, toolMetadata }`.
> root task `//#generate:mcp`. `postinstall` runs that task, and the `typecheck`,
> `build` and `test` of the two packages that read the manifest — `erp` and `docs`
> (`apps/erp/turbo.json`, `docs/turbo.json`) — depend on it, so a fresh clone
-> regenerates it before anything imports it. `SKIP_GENERATE_MCP=1` leaves it out of
-> the `postinstall` for installs that never read the manifest (the root `Dockerfile`
-> sets it; the erp `build` task still generates it there). The task is CACHED: its `inputs` in
+> regenerates it before anything imports it. The `postinstall` half is for
+> local development only (`react-router dev`, the editor and a bare `vitest` bypass
+> turbo). Under `CI` it is skipped, because the generator needs about 3 GB and most CI
+> installs never read the manifest: there the turbo dependency is the only producer,
+> so a CI step that reads the manifest outside turbo must run `//#generate:mcp`
+> itself, as `check:workflow-catalog` does. The root `Dockerfile` installs with
+> `CI=1`. Vercel is exempt (`VERCEL` set) and keeps generating on install. The task is CACHED: its `inputs` in
> `turbo.json` are every `.ts` file under `apps/erp/app/modules`, the app's
> `types` and `utils`, the generated DB types, the two `mcp-*` lib files,
> `scripts/lib`, and the `src` of each package a `*.models.ts` imports. With none
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index d21d507f41..96cf795fac 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -33,7 +33,7 @@ jobs:
key: node-modules-${{ hashFiles('pnpm-lock.yaml') }}
# Turborepo's local cache, carried between runs: the postinstall
- # (fonts, MCP manifest), typecheck and test restore instead of re-running
+ # (fonts), the MCP manifest, typecheck and test restore instead of re-running
# for packages whose inputs did not change. Keyed per job so each job
# saves its own tasks; it only ever grows, so bump the prefix to reset it.
- uses: actions/cache@v4
@@ -69,7 +69,7 @@ jobs:
key: node-modules-${{ hashFiles('pnpm-lock.yaml') }}
# Turborepo's local cache, carried between runs: the postinstall
- # (fonts, MCP manifest), typecheck and test restore instead of re-running
+ # (fonts), the MCP manifest, typecheck and test restore instead of re-running
# for packages whose inputs did not change. Keyed per job so each job
# saves its own tasks; it only ever grows, so bump the prefix to reset it.
- uses: actions/cache@v4
@@ -112,7 +112,7 @@ jobs:
key: node-modules-${{ hashFiles('pnpm-lock.yaml') }}
# Turborepo's local cache, carried between runs: the postinstall
- # (fonts, MCP manifest), typecheck and test restore instead of re-running
+ # (fonts), the MCP manifest, typecheck and test restore instead of re-running
# for packages whose inputs did not change. Keyed per job so each job
# saves its own tasks; it only ever grows, so bump the prefix to reset it.
- uses: actions/cache@v4
@@ -151,7 +151,7 @@ jobs:
key: node-modules-${{ hashFiles('pnpm-lock.yaml') }}
# Turborepo's local cache, carried between runs: the postinstall
- # (fonts, MCP manifest), typecheck and test restore instead of re-running
+ # (fonts), the MCP manifest, typecheck and test restore instead of re-running
# for packages whose inputs did not change. Keyed per job so each job
# saves its own tasks; it only ever grows, so bump the prefix to reset it.
- uses: actions/cache@v4
@@ -189,7 +189,7 @@ jobs:
key: node-modules-${{ hashFiles('pnpm-lock.yaml') }}
# Turborepo's local cache, carried between runs: the postinstall
- # (fonts, MCP manifest), typecheck and test restore instead of re-running
+ # (fonts), the MCP manifest, typecheck and test restore instead of re-running
# for packages whose inputs did not change. Keyed per job so each job
# saves its own tasks; it only ever grows, so bump the prefix to reset it.
- uses: actions/cache@v4
@@ -227,7 +227,7 @@ jobs:
key: node-modules-${{ hashFiles('pnpm-lock.yaml') }}
# Turborepo's local cache, carried between runs: the postinstall
- # (fonts, MCP manifest), typecheck and test restore instead of re-running
+ # (fonts), the MCP manifest, typecheck and test restore instead of re-running
# for packages whose inputs did not change. Keyed per job so each job
# saves its own tasks; it only ever grows, so bump the prefix to reset it.
- uses: actions/cache@v4
diff --git a/Dockerfile b/Dockerfile
index a70d972fb3..b923737e7e 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -25,10 +25,10 @@ COPY docs/content ./docs/content
# than node's default ~2 GB heap. Inherited by `build`.
ARG NODE_OPTIONS="--max-old-space-size=8024"
ENV NODE_OPTIONS=${NODE_OPTIONS}
-# The manifest is not generated here: `build` makes it through turbo for erp, and
-# nothing else in an image reads it.
+# CI=1 as on any CI install: the postinstall leaves the MCP manifest to the task
+# that reads it. `build` makes it through turbo for erp; nothing else here does.
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store,sharing=locked \
- SKIP_GENERATE_MCP=1 pnpm install --frozen-lockfile
+ CI=1 pnpm install --frozen-lockfile
FROM deps AS build
ARG APP
diff --git a/package.json b/package.json
index 887310d4f2..2406d5d2bb 100755
--- a/package.json
+++ b/package.json
@@ -43,7 +43,7 @@
"build:erp": "turbo run build --filter=erp",
"build:mes": "turbo run build --filter=mes",
"check:manifest": "tsx scripts/check-manifest.ts",
- "check:workflow-catalog": "tsx scripts/check-workflow-catalog.ts",
+ "check:workflow-catalog": "turbo run //#generate:mcp --output-logs=errors-only && tsx scripts/check-workflow-catalog.ts",
"ci:deploy": "pnpm --filter ci ci:deploy",
"ci:migrations": "pnpm --filter ci ci:migrations",
"clean": "turbo run clean && rimraf ./node_modules && rimraf ./pnpm-lock.yaml",
@@ -73,7 +73,7 @@
"lingui:compile": "lingui compile --namespace es",
"lingui:extract": "lingui extract --clean",
"lint": "turbo run lint",
- "postinstall": "MCP=//#generate:mcp; [ -n \"$VERCEL\" ] && [ \"${INIT_CWD##*/}\" = mes ] && MCP=; [ -n \"$SKIP_GENERATE_MCP\" ] && MCP=; turbo run @carbon/documents#build $MCP --output-logs=new-only",
+ "postinstall": "MCP=//#generate:mcp; [ -n \"$VERCEL\" ] && [ \"${INIT_CWD##*/}\" = mes ] && MCP=; [ -n \"$CI\" ] && [ -z \"$VERCEL\" ] && MCP=; turbo run @carbon/documents#build $MCP --output-logs=new-only",
"prepare": "case \"$(git config core.hooksPath)\" in *.husky) git config --unset core.hooksPath; git config --worktree --unset core.hooksPath;; esac; simple-git-hooks; if [ -f .ai/scripts/install-skills.sh ]; then bash .ai/scripts/install-skills.sh; fi",
"test": "turbo run test",
"translate": "pnpm run lingui:extract && pnpm exec linguito translate --llm && pnpm lingui:clean",