Skip to content

Commit c4ac0e9

Browse files
wmadden-electricclaudeankur-arch
authored
docs: aggregate CLI error codes from prisma/prisma-cli (#8184)
* docs: aggregate CLI error codes from prisma/prisma-cli Extends the error-reference pipeline (generator + daily sync + completeness check) to a second source repo, following the same pattern used for prisma/prisma. The CLI gets its own page at /docs/cli/error-reference because the CLI.* namespace exists in both repos with different meanings (CLI.PROMPT_REQUIRED collides). - generate-error-reference.mjs takes --target orm|cli; orm output is unchanged - both workflows also check out prisma/prisma-cli and run its own scripts/list-error-codes.mjs to verify page completeness, exactly as they do with prisma/prisma's scanner - the generated CLI page (128 codes) is committed, with a sidebar entry under the CLI section's Introduction group - next.config.mjs redirects the path form …/error-reference/<CODE> to the #<CODE> anchor for both the ORM and CLI pages — the CLI engine composes docsUrls in path form from a family docsBaseUrl, and the ORM family's links were 404ing on this before Companion PR (must merge first): prisma/prisma-cli#234, which adds the canonical registry and scanner this consumes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> * docs: regenerate the CLI error page after the upstream cleanup prisma/prisma-cli#234 removed the code-rewriting boundary layer, so the registry no longer documents a passthrough rule and no longer carries the two entries that had no raise site. 128 codes -> 126. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> * docs: sync the ORM error reference with prisma/prisma main The completeness check caught real upstream drift: MIGRATION.PLAN_ORIGIN_UNKNOWN shipped in prisma/orm#30122 and the page had not been regenerated since. Also picks up wording changes in three existing entries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> * docs: teach the spellchecker the CLI error page's real terms Two genuine names the dictionary lacked: stricli (the argument parser the engine wraps) and UNWRITABLE (part of the INIT.CONFIG_UNWRITABLE and INIT.PACKAGE_JSON_UNWRITABLE codes), alongside the existing UNLOADABLE and UNPARSEABLE entries. The page itself is regenerated after prisma/prisma-cli fixed four British spellings and one invented word at the source, rather than adding those to the dictionary here. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> * docs: publish the CLI error page with the site's REST API name The docs site does not reintroduce "Management API" in prose (see apps/docs/CLAUDE.md); prisma-cli uses that name because the SDK it calls through is literally `@prisma/management-api-sdk`, which is right in that repo. The generator already exists to bridge that kind of mismatch for the ORM target, so the CLI target gets the same treatment: 13 prose occurrences become "REST API". The rewrite skips fenced blocks and inline code spans, so identifiers keep their real names — the exception apps/docs/CLAUDE.md calls out. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> * docs: treat every markdown code form as opaque in the generator The prose rewriter recognized only triple-backtick fences and single-backtick spans, so a tilde fence or a multi-backtick span would have had its contents rewritten — the identifiers the rewrite exists to protect. assertMdxSafe had the same blind spot from the other direction: a brace inside a tilde fence looked like unescaped MDX and would have failed the build for text that is only ever displayed. Both now read one CODE_SEGMENT covering backtick and tilde fences and spans of any delimiter length, and the rewriter walks matches instead of splitting, so it no longer depends on the pattern having exactly one capture group. Verified against both fence styles, one/two/three-backtick spans, and mixed prose; both pages regenerate byte-identically. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> --------- Signed-off-by: willbot <w.a.madden+machine@gmail.com> Signed-off-by: Will Madden <madden@prisma.io> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Ankur Datta <64993082+ankur-arch@users.noreply.github.com>
1 parent 6c8def2 commit c4ac0e9

8 files changed

Lines changed: 787 additions & 101 deletions

File tree

.github/workflows/error-reference-check.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
name: Error Reference Check
22

3-
# The published error-reference page must list every structured error code the
4-
# product (prisma/prisma main) can emit — each emitted error links to
5-
# /docs/orm/reference/error-reference#<CODE>. This check fails if any
6-
# known code is missing from the page, even if the sync workflow breaks.
3+
# The published error-reference pages must list every structured error code
4+
# the products can emit — prisma/prisma (main) errors link to
5+
# /docs/orm/reference/error-reference#<CODE>, prisma/prisma-cli (main) errors
6+
# to /docs/cli/error-reference#<CODE>. This check fails if any known code is
7+
# missing from its page, even if the sync workflow breaks.
78
#
89
# Runs on pushes to main, on PRs that touch the page or its tooling, and on a
910
# daily schedule so drift introduced upstream is flagged without blocking
@@ -15,6 +16,7 @@ on:
1516
pull_request:
1617
paths:
1718
- apps/docs/content/docs/orm/reference/error-reference.mdx
19+
- apps/docs/content/docs/cli/error-reference.mdx
1820
- apps/docs/scripts/generate-error-reference.mjs
1921
- .github/workflows/error-reference-check.yml
2022
- .github/workflows/sync-error-reference-docs.yml
@@ -43,10 +45,21 @@ jobs:
4345
path: prisma-src
4446
persist-credentials: false
4547

48+
- name: Checkout prisma/prisma-cli (main)
49+
uses: actions/checkout@v4
50+
with:
51+
repository: prisma/prisma-cli
52+
ref: main
53+
path: prisma-cli-src
54+
persist-credentials: false
55+
4656
- name: Setup Node.js
4757
uses: actions/setup-node@v4
4858
with:
4959
node-version: "20"
5060

51-
- name: Verify page lists every known error code
61+
- name: Verify ORM page lists every known error code
5262
run: node prisma-src/scripts/list-error-codes.mjs --root prisma-src --verify apps/docs/content/docs/orm/reference/error-reference.mdx
63+
64+
- name: Verify CLI page lists every known error code
65+
run: node prisma-cli-src/scripts/list-error-codes.mjs --root prisma-cli-src --verify apps/docs/content/docs/cli/error-reference.mdx

.github/workflows/sync-error-reference-docs.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,44 @@ jobs:
3232
path: prisma-src
3333
persist-credentials: false
3434

35+
- name: Checkout prisma/prisma-cli (main)
36+
uses: actions/checkout@v4
37+
with:
38+
repository: prisma/prisma-cli
39+
ref: main
40+
path: prisma-cli-src
41+
persist-credentials: false
42+
3543
- name: Setup Node.js
3644
uses: actions/setup-node@v4
3745
with:
3846
node-version: "20"
3947

40-
- name: Generate error reference page
48+
- name: Generate ORM error reference page
4149
working-directory: apps/docs
42-
run: node ./scripts/generate-error-reference.mjs --source ../../prisma-src/docs/reference/error-reference.md
50+
run: node ./scripts/generate-error-reference.mjs --target orm --source ../../prisma-src/docs/reference/error-reference.md
4351

44-
- name: Verify page lists every known error code
52+
- name: Verify ORM page lists every known error code
4553
run: node prisma-src/scripts/list-error-codes.mjs --root prisma-src --verify apps/docs/content/docs/orm/reference/error-reference.mdx
4654

55+
- name: Generate CLI error reference page
56+
working-directory: apps/docs
57+
run: node ./scripts/generate-error-reference.mjs --target cli --source ../../prisma-cli-src/docs/reference/error-reference.md
58+
59+
- name: Verify CLI page lists every known error code
60+
run: node prisma-cli-src/scripts/list-error-codes.mjs --root prisma-cli-src --verify apps/docs/content/docs/cli/error-reference.mdx
61+
4762
- name: Check for changes
4863
id: changes
4964
run: |
50-
if [[ -z "$(git status --porcelain --untracked-files=all -- apps/docs/content/docs/orm/reference/error-reference.mdx)" ]]; then
51-
echo "changed=false" >> $GITHUB_OUTPUT
65+
PAGES=(apps/docs/content/docs/orm/reference/error-reference.mdx apps/docs/content/docs/cli/error-reference.mdx)
66+
if [[ -z "$(git status --porcelain --untracked-files=all -- "${PAGES[@]}")" ]]; then
67+
echo "changed=false" >> "$GITHUB_OUTPUT"
5268
echo "No changes detected"
5369
else
54-
echo "changed=true" >> $GITHUB_OUTPUT
70+
echo "changed=true" >> "$GITHUB_OUTPUT"
5571
echo "Changes detected:"
56-
git status --short -- apps/docs/content/docs/orm/reference/error-reference.mdx
72+
git status --short -- "${PAGES[@]}"
5773
fi
5874
5975
- name: Commit and push
@@ -65,7 +81,7 @@ jobs:
6581
run: |
6682
git config user.email "prismabots@gmail.com"
6783
git config user.name "Prismo"
68-
git add apps/docs/content/docs/orm/reference/error-reference.mdx
84+
git add apps/docs/content/docs/orm/reference/error-reference.mdx apps/docs/content/docs/cli/error-reference.mdx
6985
git commit -m "chore(docs): sync Prisma 8 error reference"
7086
git push "https://x-access-token:${BOT_TOKEN}@github.com/${TARGET_REPO}.git" "HEAD:${TARGET_REF}"
7187

0 commit comments

Comments
 (0)