Skip to content

fix(docs/cli): unbreak cli.agentproto.sh — MDX comment markers in sandbox-rendezvous - #1256

Merged
agentiknet merged 1 commit into
mainfrom
fix/cli-docs-mdx-comment
Sep 11, 2026
Merged

agentiknet merged 1 commit into
mainfrom
fix/cli-docs-mdx-comment

Conversation

@agentiknet

@agentiknet agentiknet commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

What

The two sync-templates markers in docs/cli/guides/sandbox-rendezvous.md move from the HTML comment form to the MDX one, and scripts/sync-templates.mjs learns to read that flavor.

-<!-- sync-templates:start -->
+{/* sync-templates:start */}
 The `e2b` provider's default template is declared in
 ...
-<!-- sync-templates:end -->
+{/* sync-templates:end */}

Why

cli.agentproto.sh mirrors docs/cli/ into content/docs/ (cli-site/scripts/sync-content.mjs, renaming .md → .mdx) and compiles it with fumadocs-mdx. MDX has no HTML comments — it reads < as a JSX tag open — so those two markers are a hard parse error downstream:

29:2 Unexpected character `!` (U+0021) before name, expected a character that can
     start a name, such as a letter, `$`, or `_`
     (note: to create a comment in MDX, use {/* text */})

This has failed every production build of agentproto/cli-site since 2026-07-12 — the last green run on that repo's main. Every open PR there fails identically, including copy-only ones (agentproto/cli-site#10) and the eslint migration (agentproto/cli-site#11): it is content drift from here, not anything in those branches.

It survived two months because the content lives here and the MDX compiler runs there, and the error names content/docs/guides/sandbox-rendezvous.mdx — a build artifact, in neither repo's git tree.

sync-content.mjs already rewrites <https://…> autolinks for exactly this reason (its mdToMdx pass). HTML comments were the gap in that safety net.

The sync-templates change

sync-templates.mjs already spoke two marker flavors — <!-- … --> for markdown, /* … */ for .ts. This adds {/* … */} as a third alternative in the same regex, so it is a new spelling rather than a new mechanism, and every marked file keeps the flavor its own parser wants:

File Flavor Why
packages/sandbox-e2b/README.md <!-- … --> plain markdown, read on npm/GitHub
packages/runtime/src/**.ts /* … */ JS block comment
docs/cli/guides/sandbox-rendezvous.md {/* … */} compiled as MDX by cli.agentproto.sh

The test fixture now writes the docs file with {/* … */}, so all three flavors are exercised by the existing round-trip tests rather than by a new one.

Verified

$ node --test scripts/sync-templates.test.mjs
# pass 5   # fail 0

$ node scripts/sync-templates.mjs --check
sync-templates: generated template artifacts in sync.   exit 0

And against a sibling checkout of agentproto/cli-site at main (3fa6112), with this branch as the content source:

$ pnpm build          # cli-site
✓ Compiled successfully in 3.4s
✓ Generating static pages using 8 workers (59/59) in 549ms
exit 0

Before this change the same command failed at the error above.

I also compiled every file under docs/cli/ through @mdx-js/mdx. Two others fail on their own — README.md:12 and concepts/adapters.md:162, both <https://…> autolinks — but sync-content.mjs rewrites those to [url](url) during the sync, so they compile fine as shipped. Scanning the synced content/docs/ tree (what fumadocs actually sees) shows zero failures after this change. Left them alone rather than widening the diff; if you'd rather they not depend on the downstream rewrite, happy to fix them in a follow-up.

Not in scope

agentproto/cli-site needs no change. Its next build picks up the fixed doc through the normal sync-content clone.

…dbox-rendezvous

cli.agentproto.sh mirrors docs/cli/ into content/docs/ and compiles it
with fumadocs-mdx. MDX has no HTML comments — it reads `<` as a JSX tag
open — so the `sync-templates` markers in this guide are a hard parse
error downstream:

  29:2 Unexpected character `!` (U+0021) before name

That has failed every production build of agentproto/cli-site since
2026-07-12 — two months, including copy-only PRs, because the break
lives here and the red X lives there. (sync-content.mjs already rewrites
`<https://…>` autolinks for the same reason; HTML comments were the gap.)

Switch the two markers to the MDX comment form and teach sync-templates
that flavor. It already spoke two — `<!-- … -->` for markdown, `/* … */`
for .ts — so this is a third alternative in the same vocabulary, not a
new mechanism; every marked file keeps the flavor its own parser wants.
The fixture now uses `{/* … */}` for the docs file, so the three flavors
are covered by the existing round-trip tests.

@ponytail-coder ponytail-coder Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Adds support for the MDX comment flavor ({/* … */}) in the sync-templates marker regexes and converts the docs/cli guide to it, since MDX (fumadocs-mdx) rejects HTML comments. Script/test/docs-only change; no workspace packages touched.

Changeset

package bump reason
(none) — No workspace package changed; scripts/docs only, no changeset needed

Findings

Correctness

  • The updated MARKER_START_RE/MARKER_END_RE in scripts/sync-templates.mjs:385-390 correctly handle all three flavors (<!-- -->, /* */, {/* */}) with alternations on both open and close sides. Start requires a trailing newline, end is anchored on preceding newline — consistent with prior behavior.
  • docs/cli/guides/sandbox-rendezvous.md:25,27 marker conversion matches the new regex; round-trip is stable.

Test coverage

  • scripts/sync-templates.test.mjs:49-51 updated the fixture to the MDX flavor, but only the HTML flavor remains covered for the e2b README. There is no test covering the JS /* */ flavor used by packages/runtime/src/sandbox-providers/registry.ts in the fixture, nor an assertion that the doc file stays in MDX flavor (e.g. a check that docs/cli/** fixtures don't regress to <!-- -->). Low risk, but a cheap guard would prevent re-introducing HTML comments into the MDX-compiled tree.

Observations

  • The {/* … */} flavor means the marker is invisible when the doc is rendered as MDX, which is the point — but note plain markdown viewers show the literal braces. Since only docs/cli/ needs it, that's fine; the rationale comment in the script is clear.
  • No sensitive paths touched (no migrations/auth/security/workflows/env files).

Verdict

LGTM ✅ — small, well-reasoned script/docs fix with tests passing and no package bumps required.


🤖 @agentproto-bot — review · session sess_488e48ac (agent-step:opencode) · opencode / api-key · model openrouter/z-ai/glm-5.3-flash · $0.0035 · run 34606613162 · sha 1baf71385ff6f5bf88a84189b52899658f7c7c67

@agentiknet
agentiknet marked this pull request as ready for review September 11, 2026 22:39
@agentiknet
agentiknet merged commit 78bfd73 into main Sep 11, 2026
17 checks passed
@agentiknet
agentiknet deleted the fix/cli-docs-mdx-comment branch September 11, 2026 22:39
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.

1 participant