Skip to content

Stop the MCP doc sync reintroducing /en/-prefixed links - #189

Merged
matenadasdi merged 2 commits into
mainfrom
mcp-sync-strip-en-prefix
Aug 18, 2026
Merged

Stop the MCP doc sync reintroducing /en/-prefixed links#189
matenadasdi merged 2 commits into
mainfrom
mcp-sync-strip-en-prefix

Conversation

@matenadasdi

Copy link
Copy Markdown
Collaborator

rewrite_internal_links() in scripts/sync_mcp_docs.py mapped the source repo's /docs/<file>.md targets to /en/bitrise-platform/.... 51f565b stripped that prefix repo-wide and CLAUDE.md now documents the convention, but the sync script was missed by the sweep — so every run silently undid it for these eight pages.

Internal links must be bare absolute paths: each locale has its own baseUrl (i18n.localeConfigs in docusaurus.config.ts), which Docusaurus prepends at render time. A hardcoded /en/ resolves to /ja/en/... under any other locale, which doesn't exist.

Only this one function was affected — SLUG_BASE and build_frontmatter() already emit bare paths, so page slugs were never wrong.

Stacked on #188

Based on ja-infra-prep, not main — merge #188 first. These eight pages are .mdx only on that branch, and #188 also carries the .mdx destination fix without which a sync run produces stray .md duplicates.

Verified

  • The sync now produces no diff against the checked-in pages. The content was already correct (51f565b fixed it); the script was the thing out of sync. A run over a clean tree reports all seven install pages unchanged, and a second run writes nothing.
  • The one content change is unrelated upstream drift, committed separately: upstream documented a new stack parameter on trigger_bitrise_build.
  • node scripts/check-links-source.js — clean, 631 files.
  • npm run build — green for both locales, zero broken-link warnings.
  • Built output, both locales. The Tools link from install-claude now renders as /en/bitrise-platform/ai/bitrise-mcp/tools in the en build and /ja/bitrise-platform/ai/bitrise-mcp/tools in the ja build. No /ja/en/ anywhere in the ja output — which is the bug this fixes.
  • Unit-checked the rewriter against anchors (#section), external .md URLs (untouched), and already-bare paths (untouched).

Found while checking, not fixed here

  • Seven of the eight synced pages have no description frontmatterbuild_frontmatter() never emits the field, so they fall back to the generic site tagline in social preview cards. A hand edit wouldn't survive a sync; it needs a stem → description map in the script. Left for its own PR since it's content copy, not a script bugfix.
  • src/html/portal.html still contains /en/…​.html links. It isn't referenced anywhere and isn't in the build output — a leftover from the pre-Docusaurus portal — so those are dead weight rather than a live bug.

🤖 Generated with Claude Code

matenadasdi and others added 2 commits August 18, 2026 16:18
rewrite_internal_links() mapped the source repo's /docs/<file>.md targets to
/en/bitrise-platform/... . 51f565b stripped that prefix repo-wide and
CLAUDE.md now documents the convention, but the sync script was missed by
that sweep — so every run silently undid it for these eight pages.

Internal links must be bare absolute paths: each locale has its own baseUrl
(i18n.localeConfigs in docusaurus.config.ts), which Docusaurus prepends at
render time. A hardcoded /en/ resolves to /ja/en/... under any other locale,
which doesn't exist.

Only this one function was affected — SLUG_BASE and build_frontmatter()
already emit bare paths, so page slugs were never wrong.

The checked-in pages are already correct (51f565b fixed the content), so the
sync now produces no diff against them. Verified: a run over a clean tree
reports all seven install pages unchanged, and a second run writes nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Picked up by the sync run in the previous commit, and unrelated to it:
upstream documented a new `stack` parameter on trigger_bitrise_build, which
overrides the workflow's meta.bitrise.io.stack for a single build.

Generated by scripts/sync_mcp_docs.py — not hand-edited.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Base automatically changed from ja-infra-prep to main August 18, 2026 14:45
@matenadasdi
matenadasdi merged commit 7f28e91 into main Aug 18, 2026
2 checks passed
matenadasdi added a commit that referenced this pull request Aug 18, 2026
Brings in the infrastructure that was split out of this PR and has since
merged — #188 (the <NT> component, the 83 .md -> .mdx renames, the
check-links-source.js anchor fix, the patch-api-info.js duplicate-label fix)
and #189 (the MCP sync /en/ fix) — plus #187's docusaurus-plugin-llms bump.

The overlapping work is identical on both sides, so it resolves without
conflict. What remains unique to this branch is the translation pipeline,
the localization glossary and guides, the i18n/ja content, and the locale
switcher.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ilanazholobovsky added a commit that referenced this pull request Aug 19, 2026
The previous commit set `info_path` to `en/...`. That fixes the en build but
breaks the ja one, and it contradicts the convention #189 established.

The theme renders the value through Docusaurus's <Link>:

    const infoAuthPath = `/${props.infoPath}#authentication`;
    <Link to={infoAuthPath}>...</Link>

<Link> prepends the active locale's baseUrl unless the path already starts
with it. So `en/...` renders as /en/... on the en build (correct, since it
already carries the prefix) but as /ja/en/... on the ja build, which doesn't
exist. Verified on the deploy preview:

    /ja/bitrise-api/api-reference/activity-list
      -> Authentication href /ja/en/bitrise-api/api-reference/bitrise-api  -> 404

That is the exact failure mode sync_mcp_docs.py's rewrite_internal_links
warns about, and the reason #189 stripped hardcoded /en/ from synced links.

A bare route path is correct for every locale, because <Link> supplies the
prefix. Both info pages exist under both locales today (the ja build falls
back to the untranslated source), verified on the same preview:

    /en/bitrise-api/api-reference/bitrise-api                          -> 200
    /ja/bitrise-api/api-reference/bitrise-api                          -> 200
    /en/bitrise-rde-api/.../bitrise-remote-dev-environments-api        -> 200
    /ja/bitrise-rde-api/.../bitrise-remote-dev-environments-api        -> 200

Also corrects the root-cause note in the script's header. The plugin does
have logic to turn outputDir into a route, but it is guarded (plugin
src/index.ts, v5.0.2):

    let infoBasePath = `${outputDir}/${item.infoId}`;
    if (docRouteBasePath) { ...rebuild from docRouteBasePath... }

`docs.routeBasePath` is '' here, which is falsy, so the guard never fires and
the raw filesystem path is written. This was latent until routeBasePath
changed from 'en' to '' — which is why the value was correct before the
change and wrong after the next regeneration.

- EN_ROUTE_PREFIX -> ROUTE_BASE_PATH, mirroring docs.routeBasePath
- Regenerate the 164 *.api.mdx via the script (one line each)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants