Commit Graph

703 Commits

Author SHA1 Message Date
Tyler Slaton ac25cc3523 Merge branch 'main' into tyler/showcase-improve-docs-design 2026-05-27 09:51:24 -07:00
Austin Merrick 94f473b284 refactor(shell-docs): single source of truth for build-with-agents content
Root page was duplicating the snippet content inline. Switch it to
<BuildWithAgents /> so snippets/shared/guides/build-with-agents.mdx
is the one source — root page and built-in-agent both render from it.
2026-05-27 09:13:46 -07:00
Austin Merrick 7b14a8c982 fix(shell-docs): fix build-with-agents on built-in-agent (authored mode)
built-in-agent uses docs_mode: 'authored' so it loads the per-framework
integrations/built-in-agent/build-with-agents.mdx directly, bypassing
the root page entirely. Other frameworks (generated mode) fall through
to the root page and already show the skills section.

Fix: extract the full page body into a shared snippet
  snippets/shared/guides/build-with-agents.mdx
register it as <BuildWithAgents /> in SNIPPET_MAP + mdx-registry, and
switch built-in-agent's page to <BuildWithAgents />. Root page keeps
its inline content (for crawlability). The snippet is the source used
by authored-mode frameworks; root is the source for generated-mode and
crawlers — same pattern as MCPSetup / coding-agents.
2026-05-27 09:06:45 -07:00
Austin Merrick 3f8d2de8a6 docs(shell-docs): remove skills table, replace with prose + link
The table was incomplete (6 skills listed, 12 actually install) and has
no CI check to keep it in sync. Replace with a one-line prose summary
and a link to the canonical skills/ directory on GitHub, which is always
accurate.
2026-05-27 08:44:56 -07:00
Austin Merrick 6b1747e5f8 docs(shell-docs): add CopilotKit Skills section to build-with-agents page
- Rewrites the root build-with-agents page to document Skills + MCP Docs Server
- Skills section: intro, npx skills add command, skills table, starter prompt
- Removes hideTOC so the new TOC (Skills / MCP Docs Server) renders
- Updates icon to BrainCircuit and description to keyword-rich copy
- Renames mcp-server-setup snippet heading: ## Overview → ## MCP Docs Server
  so both sections compose cleanly on the root page without a double Overview

Closes out the last AC on OSS-133: npx skills add flow documented with
table of skills, starter prompt, and page structure matching Mastra reference.
2026-05-27 08:30:56 -07:00
Tyler Slaton c1874ed64c Refresh shell docs homepage and search modal 2026-05-26 22:20:02 -07:00
Austin Merrick 7255531e2e docs: port coding-agents → build-with-agents rename to shell-docs (#5023)
## Summary

Ports the changes from PR #4927 to the live shell-docs app. PR #4927
renamed \`coding-agents\` → \`build-with-agents\` in the legacy
\`docs/\` tree, but \`showcase/shell-docs\` has its own independent
content directory that was never updated.

## Changes

- **11 file renames:** \`coding-agents.mdx\` → \`build-with-agents.mdx\`
(root + 10 integrations: ag2, agno, aws-strands, built-in-agent,
crewai-flows, langgraph, llamaindex, mastra, microsoft-agent-framework,
pydantic-ai)
- **Frontmatter titles:** \`"Coding Agents"\` → \`"Build with agents"\`
in all 11 files
- **Root \`build-with-agents.mdx\`:** replaced 291 lines of hardcoded
content with \`<MCPSetup />\` shared snippet (content had drifted from
the canonical snippet)
- **9 integration \`meta.json\` files:** \`"coding-agents"\` →
\`"build-with-agents"\` in sidebar nav
- **Root \`meta.json\`:** rename entry + add React Native under new
\`---Platforms---\` section (mirrors PR #4927's second commit)
- **\`seo-redirects.ts\`:**
- Update S4 (\`vibe-coding-mcp\`) and S15 (\`mcp\`) subpath destinations
to \`build-with-agents\`
- Add S16: \`coding-agents\` → \`build-with-agents\` subpath rename for
all 13 legacy framework slugs
- Add \`CODING_AGENTS_RENAMES\`: root \`/coding-agents\` + all canonical
framework \`/*/coding-agents\` → \`/*/build-with-agents\` (exact 301s)
  - Fix stale destinations in F20, R12, R18, R19
- **\`docs-render.tsx\`:** update \`SUBPATH_TO_COMPONENT\` key
\`"coding-agents"\` → \`"build-with-agents"\` so pages at the new slug
still resolve the shared MCP snippet

## Test plan

- [x] \`/coding-agents\` 301-redirects to \`/build-with-agents\`
- [x] \`/langgraph-python/coding-agents\` 301-redirects to
\`/langgraph-python/build-with-agents\`
- [x] \`/mcp\` and \`/vibe-coding-mcp\` redirect to
\`/build-with-agents\`
- [x] Sidebar shows "Build with agents" entry in each integration
- [x] React Native appears under Platforms section in root sidebar
- [x] All 11 \`build-with-agents\` pages render content correctly (MCP
setup snippet loads)
- [x] Root \`/build-with-agents\` shows correct MCP setup content
2026-05-26 15:01:17 -07:00
Austin Merrick 50b4fd8b60 docs(shell-docs): remove internal ticket reference from seo-redirects comment 2026-05-26 14:18:17 -07:00
Alem Tuzlak 2405a46fa6 feat(showcase): add ms agent harness dotnet chat 2026-05-26 13:36:38 -07:00
Austin Merrick 268b8c1a18 docs(shell-docs): remove Tadata callout from MCP server setup snippet 2026-05-26 13:31:02 -07:00
Austin Merrick f7463fb5b1 fix(oss-133): remove CANONICAL_FRAMEWORKS decl to avoid merge conflict with main
main added its own CANONICAL_FRAMEWORKS const after this branch was cut.
CI tests the merge commit, so the duplicate declaration caused a build
error. Replace with an inline derivation from FRAMEWORKS so the variable
is self-contained and never conflicts with whatever main defines.
2026-05-26 13:13:11 -07:00
Austin Merrick dbfe929d78 fix(oss-133): replace hardcoded root build-with-agents.mdx with shared snippet
The root /build-with-agents page had 290 lines of inline content that had
drifted from the canonical mcp-server-setup.mdx snippet: wrong MCP endpoint
paths (/mcp vs /sse), and missing Tadata attribution Callout that every
per-framework build-with-agents page renders.

Replace with <MCPSetup /> to use the same shared snippet as the langgraph
integration page, ensuring the root page and all framework pages render
identical, authoritative content from a single source of truth.
2026-05-26 12:36:16 -07:00
Austin Merrick d3d5fb4bd0 fix(oss-133): deduplicate CODING_AGENTS_RENAMES by excluding unchanged-slug frameworks
S16 in SUBPATH_RENAMES already generates /<fw>/coding-agents → /<fw>/build-with-agents
for all 13 legacy frameworks including unchanged-slug ones (agno, ag2, pydantic-ai,
llamaindex, mastra, agent-spec, a2a). Including them in CANONICAL_FRAMEWORKS created
7 duplicate source entries in the redirect table, corrupting PostHog decommission
attribution (the CA×<fw> IDs would never get traffic).

Restrict CANONICAL_FRAMEWORKS to frameworks whose canonical slug differs from their
legacy slug (langgraph-python, google-adk, crewai-crews, ms-agent-dotnet, strands,
built-in-agent) — these are the ones S16 can't cover since S16 sources use legacy slugs.
2026-05-26 12:21:01 -07:00
Austin Merrick 5a5781a191 fix(oss-133): define CANONICAL_FRAMEWORKS to fix TS2304 compile error
CANONICAL_FRAMEWORKS was referenced in CODING_AGENTS_RENAMES but never
defined, causing a TypeScript error. Derive it from FRAMEWORKS.map(canonicalSlug)
so all 13 canonical slugs (langgraph-python, google-adk, strands, etc.) get
/coding-agents → /build-with-agents redirects.
2026-05-26 12:08:45 -07:00
Austin Merrick 7669016c3d docs(OSS-133): port coding-agents → build-with-agents rename to shell-docs
PR #4927 landed this rename in the legacy `docs/` tree, but `showcase/shell-docs`
has its own content directory that was never updated.

Changes:
- Rename 11 `coding-agents.mdx` → `build-with-agents.mdx` (root + 10 integrations)
- Update frontmatter title "Coding Agents" → "Build with agents" in all 11 files
- Update `"coding-agents"` → `"build-with-agents"` in 9 integration meta.json nav files
- Update root meta.json: rename entry + add React Native under new ---Platforms--- section
- seo-redirects.ts: update S4/S15 subpath destinations; add S16 (coding-agents→build-with-agents)
  subpath rename for all legacy framework slugs; add CODING_AGENTS_RENAMES for root + all
  canonical framework slugs; fix stale destinations in F20, R12, R18, R19
- docs-render.tsx: update SUBPATH_TO_COMPONENT key "coding-agents" → "build-with-agents"
2026-05-26 11:55:28 -07:00
Martha Schumann d2934c149d Merge remote-tracking branch 'origin/main' into fix/showcase-docs-rendering 2026-05-26 10:36:52 -07:00
Martha Schumann b02a0f6db5 fix(shell-docs): fix broken prebuilt-components and HITL code examples across 6 integrations
6 prebuilt-components pages were missing their PrebuiltComponents import,
causing the inlineSnippets regex to skip them and drop the framework prop
(iframe URLs defaulted to langgraph). 8 HITL pages had copy-pasted code
examples using the deprecated v1 parameters array format instead of Zod
schemas. Added a component-imports validation check to verify-shell-docs.ts
to catch missing snippet imports going forward.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-26 09:59:28 -07:00
Austin Merrick d606429fe3 fix(shell-docs): remove extra bottom margin from p inside callouts
.reference-content p { margin-bottom: 1rem } is unlayered CSS and
always beats the layered prose-no-margin utility from fumadocs-ui,
causing visible extra space at the bottom of info callout boxes.
Mirror prose-no-margin's intent at (0,2,1) specificity in globals.css
so the first/last-child margin resets actually apply.

Also bump NODE_OPTIONS in the lefthook test-and-check-packages hook
to 8 GB — @copilotkit/core:build bundles many deps inline with
rolldown and exhausts the default 4 GB V8 heap, causing a native
binding crash on every pre-commit run.
2026-05-26 09:22:47 -07:00
Ben Taylor 14bb968625 fix(shell-docs): suppress docs-render snippet warnings + fix ComponentExamples render (#4992)
## Summary

Three changes to `src/lib/docs-render.tsx` that together eliminate the
`[docs-render] snippet missing for component X` log noise on prod AND
fix a hard SSR error on `/quickstart` caused by a missing
`ComponentExamples` registration.

## Changes

**1. Suppress warnings for components the MDX imports** (existing scope
of this PR).

`inlineSnippets()` runs after `stripLeadingImports()` removes the MDX's
`import` lines, so the regex can't tell a `<PascalCase />` reference
apart from a real React component imported into the file. Every imported
component triggered a false-positive `snippet missing` warning. The page
still rendered correctly via `docsComponents`; only the log was wrong.

Capture imports before stripping, then short-circuit the warning when
the regex hits one of those names.

**2. Add `ComponentExamples` to `SNIPPET_MAP`** (new).

`copilot-ui.mdx` imports `ComponentExamples` from
`@/snippets/component-examples.mdx` and renders it. When
`copilot-ui.mdx` is recursively inlined into a parent MDX (e.g. via
`<CopilotUI />`), the import line is stripped and the inliner finds no
`SNIPPET_MAP` entry for `ComponentExamples`. The bare JSX survives the
inliner and `next-mdx-remote` throws `Expected component
ComponentExamples to be defined` at SSR. The error is caught in a
partial-render error boundary so the page returns 200, but a chunk of
content is missing from the rendered output.

Add `ComponentExamples: "component-examples.mdx"` to `SNIPPET_MAP` so
the recursive inliner resolves it the same way it resolves `CopilotUI`.
One line, fixes both the SSR error and the cosmetic warning.

(Note: the `gatherImportedComponentNames` shortcut from change 1 doesn't
help here because it captures imports from the OUTER MDX, not from
recursively-inlined snippet bodies. That deeper structural limitation
can be addressed later; the `SNIPPET_MAP` entry resolves the immediate
failure.)

**3. Skip icon-prefix bare references** (new).

Lucide `Square*` icons (`SquareTerminal`, `SquareChartGantt`) and
`react-icons` `Fa*` / `Si*` / `Pi*` families are bare-referenced in many
MDX files — no explicit import, resolved at render time via the
registry's emoji stubs in `docsComponents`. The existing
`endsWith("Icon")` filter doesn't catch these PascalCase +
library-prefix shapes. Add a regex check next to it:
`/^(Fa|Si|Pi|Square)[A-Z]/`.

## Components covered after changes 1-3

The import-aware filter catches every `import { X } from "..."`
reference (current set: AgentCoreCommandTabs, CodePanel, CodeShowcase,
Frame, IframeSwitcher, ImageAndCode, LinkToCopilotCloud,
NewLookAndFeelPreview, StartProviders).

The icon-prefix filter catches `FaArrowUp`, `FaWrench`,
`SquareTerminal`, `SquareChartGantt`, and future icon-library additions
matching the prefix shape.

`ComponentExamples` is registered in `SNIPPET_MAP` so the inliner
resolves it instead of warning.

Remaining bare references that don't match any of the above (e.g.
`CloudCopilotKit`) still warn — these are runtime React components
registered in `docsComponents` but not imported in the MDX. The right
cleanup for those is to add explicit `import { CloudCopilotKit } from
"..."` lines in the MDX, which the import-aware filter then catches
automatically. Out of scope for this PR.

## Adjacent observation (not fixed)

While diagnosing change 2, found that the underlying
`new-look-and-feel.tsx` component file referenced by
`troubleshooting/migrate-to-1.8.2.mdx` doesn't exist on disk. The MDX
registry stubs the name with `<div>{children}</div>`, so the preview
area in that page renders empty. This PR doesn't address the
empty-preview behavior; the snippet-missing log noise is purely
cosmetic.

## Test plan

- [x] Diff is additive only; runtime render path unchanged.
- [ ] Local: build shell-docs, hit `/built-in-agent/quickstart` +
`/crewai-crews/quickstart` + `/built-in-agent/agentic-protocols/mcp` +
`/built-in-agent/shared-state/predictive-state-updates` +
`/built-in-agent/troubleshooting/migrate-to-1.8.2`. Confirm zero
`[docs-render] snippet missing` and zero `Expected component
ComponentExamples to be defined` warnings in the dev server log.
- [ ] Local: confirm the ComponentExamples Tabs block actually renders
on `/crewai-crews/quickstart` (was silently missing pre-fix).
- [ ] Post-deploy: re-check Railway logs for the warning + error class
over a sample of page loads.
2026-05-26 10:34:14 -05:00
Sam Julien d0741b4fba fix(shell-docs): register ComponentExamples snippet + skip icon-prefix warnings
Two follow-on fixes to the same docs-render snippet pipeline.

1. ComponentExamples SSR error. The shared copilot-ui.mdx snippet
   imports ComponentExamples from @/snippets/component-examples.mdx
   and renders it. When copilot-ui.mdx is recursively inlined into a
   parent MDX (e.g. crewai-flows/quickstart.mdx via <CopilotUI />),
   stripLeadingImports removes the import line, then the regex hits
   <ComponentExamples /> with no matching SNIPPET_MAP entry. The
   inliner leaves the bare JSX in the output and at MDX render time
   next-mdx-remote throws "Expected component ComponentExamples to be
   defined". Add the snippet to SNIPPET_MAP so the recursive inliner
   resolves it the same way it resolves CopilotUI.

   The gatherImportedComponentNames shortcut from the same PR only
   captures imports in the OUTER MDX, not in recursively inlined
   snippet bodies — a deeper structural limitation worth fixing later
   but not load-bearing here. The SNIPPET_MAP entry resolves both the
   SSR error AND the false-positive warning in one line.

2. Icon-library bare references logging spurious warnings. Lucide
   Square-prefixed icons (SquareTerminal, SquareChartGantt) and
   react-icons fa / si / pi families appear bare in many MDX files —
   no import, resolved at render time via the registry's emoji stubs.
   The existing endsWith("Icon") filter doesn't catch these. Add a
   PascalCase-prefix check next to it.

Strictly additive; runtime render path unchanged.
2026-05-22 22:08:41 -07:00
Sam Julien d3f164d21d fix(shell-docs): exclude deprecated tutorials from built-in-agent sidebar
The Built-in Agent sidebar still rendered the deprecated tutorials section
("Tutorial: AI Todo App", "Tutorial: AI Textarea" with step pages) even
after PR #4987 added 301 redirects for /{fw}/tutorials/:path* paths.
The redirects fired on click, but the entries should never have appeared.

Root cause: integrations/built-in-agent/meta.json declared a
"---Tutorials---" section header followed by a "...tutorials" spread.
BIA runs in docs_mode "authored" which routes through buildFrameworkOnlyNav;
that path preserves section headers and recurses through spreads. The
spread descended into integrations/built-in-agent/tutorials/ and
enumerated the AI Todo App and AI Textarea subfolders into the sidebar.

Other frameworks were already safe: buildFrameworkOverridesNav (used by
generated-mode frameworks like langgraph, mastra, google-adk) explicitly
strips section nodes from per-framework override nav.

Fix: remove the "---Tutorials---" section header and "...tutorials"
spread from BIA's parent meta.json. Nothing now references the
tutorials folder from BIA's nav, so the spread handler never recurses
into it and the entries disappear. Two-line minimal change.

Tutorial source MDX under content/docs/integrations/built-in-agent/tutorials/
stays in place (PDX-100 owns the rewrite). The redirect catalog in
lib/seo-redirects.ts is untouched.

Refs PDX-205.
2026-05-22 21:25:27 -07:00
Sam Julien d8c730c222 fix(shell-docs): suppress missing-snippet warnings for imported components
inlineSnippets() runs after stripLeadingImports() removes the MDX's
import lines, so its regex scan can't tell whether a `<Component />`
reference is a snippet lookup or a real React component rendered via
the docsComponents registry. Every imported component triggered a
false-positive "[docs-render] snippet missing for component X"
warning.

Capture the set of imported component names BEFORE stripping, then
short-circuit the warning when the regex hits one of those names.
Catches NewLookAndFeelPreview, AgentCoreCommandTabs, CodePanel,
CodeShowcase, Frame, IframeSwitcher, ImageAndCode, LinkToCopilotCloud,
and StartProviders (the full current set imported into snippet MDX
files under src/content/snippets/), plus any future additions
automatically.

The runtime render path is unchanged: the docsComponents registry
in mdx-registry.tsx still resolves these names at render time.
2026-05-22 19:12:46 -07:00
Jordan Ritter 832508194f fix(shell-docs): post-cutover polish (metadata, OG, 404, pydantic-ai, v1 redirect) (#4990)
## Summary

Three independent regressions surfaced during Phase 6 post-cutover
validation against the live docs.copilotkit.ai. Bundled together since
they all live under `showcase/shell-docs/` and were verified together
end-to-end.

### 1. Soft-404 returning HTTP 200 with not-found UI body

Unknown URLs returned `HTTP 200` with the Next.js "404: This page could
not be found" body. Internal Next 404 markers
(`NEXT_HTTP_ERROR_FALLBACK`, `<meta name="robots" content="noindex">`)
were present in the body but the wire status stayed 200. Google treats
this as low-quality content and demotes the entire site.

Root cause: `<Suspense fallback={null}>` in `app/layout.tsx` committed
the response stream at status 200 before page-level `notFound()` could
flip it.

Fix:
- Removed the layout Suspense wrapper (both PostHogProvider and
FrameworkProvider are `"use client"` with no suspending APIs, so the
boundary was incidental from the original telemetry port).
- Added an explicit `src/app/not-found.tsx` rendering a branded 404
page.
- Marked the three catch-all routes `dynamic = "force-dynamic"` so
unknown slugs always re-evaluate at request time. Reference route stays
SSG (its slugs come from `referenceStaticParams`).

Verified: `/this-clearly-does-not-exist` returns `HTTP 404`. Real pages
return 200.

### 2. Per-page metadata + OG / Twitter cards

All four `generateMetadata` functions returned only
`alternates.canonical`. Every page inherited the layout's generic `<meta
name="description">` and emitted zero `og:*` / `twitter:*` tags. Every
social share unfurled bare.

Fix: routes now build full `Metadata` via a shared
`src/lib/seo-metadata.ts` helper that reads MDX frontmatter for title
and description and emits openGraph + Twitter card with absolute URLs.

Bonus fix in `app/og/[...slug]/route.tsx`: the OG image route fetched
Inter TTFs from `fonts.gstatic.com` on every request. Any failure
(Railway egress, font URL drift) tripped the catch block, which 307'd to
a 25-byte broken CDN fallback. Dropped the runtime font fetch (Satori's
default sans-serif renders cleanly), broadened slug resolution to also
try `integrations/<folder>/<slug>` paths, and replaced the
broken-fallback redirect with a real 500 + log.

Verified locally: full og/twitter meta set on every page;
`/og/built-in-agent/quickstart/og.png` and
`/og/langgraph-python/quickstart/og.png` both return 1200x630 PNGs with
branded backgrounds.

### 3. Pydantic-ai shared-state pages 500

`/pydantic-ai/shared-state/in-app-agent-read` and
`/pydantic-ai/shared-state/in-app-agent-write` returned deterministic
HTTP 500. Same paths on all other frameworks returned 200. A full
sitemap crawl (2451 URLs) found these as the only 5xx on the entire
site.

Root cause: both MDX files at
`src/content/docs/integrations/pydantic-ai/shared-state/in-app-agent-{read,write}.mdx`
were truncated/malformed during the v1→v2 content port — `read.mdx`
ended mid-Python-fence with unclosed `<Step>` / `<Steps>`; `write.mdx`
had a Python code fence containing JS/TSX. Pure MDX parse failure during
SSR.

Fix: restored both files from the canonical legacy source under
`docs/content/docs/integrations/pydantic-ai/shared-state/`, stripped
leading `import` blocks per the convention used by other pydantic-ai
pages (components resolve via `docsComponents` in
`src/lib/mdx-registry.tsx`).

Verified locally: both URLs go 500 → 200.

### 4. `/reference/v1/:path*` redirect dropped its suffix

Catalog rule P10 redirected `/reference/v1/hooks/useCopilotChat` to a
generic `/reference/v2` index instead of
`/reference/v2/hooks/useCopilotChat`. Users following v1 docs links from
product code messages landed on the wrong page.

Fix: one-line change in `seo-redirects.ts`: destination `/reference/v2`
→ `/reference/v2/:path*`. Audited all other catalog rules with `:path*`
source and bare destination — remaining cases (`concepts/*` collapse,
tutorials deprecation wildcards) are documented intentional
wildcard-to-single-page rules, not drift.

## Test plan

- [x] `npm run typecheck`, `npm run lint`, `npm test` (32 tests pass),
`npm run build` all green in `showcase/shell-docs/`.
- [x] Local prod-mode walkthrough on all four fix surfaces:
- `/built-in-agent/quickstart` → 200 + full og/twitter meta + per-page
description + branded OG PNG.
  - `/langgraph-python/voice` → 200, live demo iframe renders.
- `/built-in-agent/garbage-page-xyz` → 404 (real status, branded 404
page).
  - `/pydantic-ai/shared-state/in-app-agent-read` → 200.
- `/reference/v1/hooks/useCopilotChat` → 301 →
`/reference/v2/hooks/useCopilotChat` → 200.
- [ ] Post-deploy: re-curl a sample of soft-404 URLs against prod and
confirm wire status is `404`, not `200`.
- [ ] Post-deploy: validate a docs URL share in Slack / X to confirm OG
card renders with title + description + image.
2026-05-22 16:50:42 -07:00
Jordan Ritter fd296144a8 fix(shell-docs): region tag + HubSpot hydration + snippet registry (#4988)
Five post-cutover follow-ups bundled together because all surfaced in
the same spot-check pass on `/integration/<page>` routes.

## 1. Tag `page-send-message` region (`4680eb9c1`)

`/langgraph-python/programmatic-control` and
`/google-adk/programmatic-control` rendered a yellow "Missing snippet"
callout because `<Snippet region="page-send-message" />` had no matching
`// @region[page-send-message]` / `// @endregion[page-send-message]`
pair in the resolved `headless-complete` cell. Peer integrations
(mastra, ag2, strands, pydantic-ai, llamaindex, langgraph-fastapi,
crewai-crews, …) already had the tags; only north-star and its ADK
mirror were missing them. The region wraps the connect / send / stop
block in `chat/chat.tsx`.

## 2. Suppress HubSpot-rewritten href hydration mismatch on nav-bar
(`2c0791930`)

HubSpot's analytics tag (loaded from `js-na2.hs-analytics.net`) rewrites
the Intelligence CTA's outbound `href` client-side to append `__hstc` /
`__hssc` / `__hsfp` cross-domain tracking params. Server-rendered HTML
keeps the bare URL, post-hydration DOM has the rewritten URL, React's
hydration diff fires.

Add `suppressHydrationWarning` to the two anchor elements that point at
`INTELLIGENCE_CTA_HREF` (desktop BrandNav `LEFT_LINKS` entry,
MobileTopNav Lightbulb icon).

## 3. Register `UseAgentSnippet` (`f809b9b8b`, expanded by `773631cbd`)

`inlineSnippets()` in `docs-render.tsx` maintains its own `SNIPPET_MAP`
separate from `mdx-registry.tsx`'s `STUB_PARTIAL_MAP`. The two
registries drifted. `UseAgentSnippet` was the most-hit miss, but Railway
logs surfaced 14 more: `InstallSDKSnippet`, `InstallPythonSDK`,
`RunAndConnect` (+ `Snippet` alias), `CopilotUI`, `LandingCodeShowcase`,
the four `CopilotCloudConfigure*` / `SelfHostingCopilotRuntime*` keys,
plus `MigrateTo` / `MigrateToV` / `ToolRenderer` aliases. All added.

## 4. Make `inlineSnippets()` code-fence-aware + add Icon-suffix
heuristic (`773631cbd`)

After the registry fix, the remaining `[docs-render] snippet missing`
log entries split into two false-positive classes:

- **Code-fence false positives.** The regex matched `<Component />`
references inside ` ```tsx ``` ` example blocks — e.g. `<CopilotChat />`
/ `<CopilotSidebar />` shown as runtime usage, `<WeatherCard />` /
`<YourApp />` as placeholders. A new `isInsideCodeFence(content,
offset)` helper tracks fenced blocks (matching any indentation — MDX
inside `<Step>` is routinely 8-space-indented) and inline-code spans.
Replaces the ad-hoc `CopilotChat`-only allowlist from commit 3.
- **JSX-prop runtime components.** `icon={<PaintbrushIcon />}` etc. are
real React components from `mdx-registry.tsx::docsComponents`, not
snippets. Add an `Icon`-suffix heuristic: lucide icons used as JSX props
are silenced.

## 5. Suppress HubSpot hydration mismatch on `<OpsPlatformCTA>` +
`<SignupLink>` (`10b4960a3`)

Same HubSpot rewrite hits every dashboard.operations.copilotkit.ai
outbound link. Add `suppressHydrationWarning` to all four `<a>` tags in
`OpsPlatformCTA` (`info` / `inline` / `tile` / `card` variants) and the
single `<a>` in `SignupLink`. Observed live as a hydration error on
`/<framework>/prebuilt-components`, `/<framework>/headless`, and any
page that embeds an Intelligence-platform CTA.

## Verification

- `grep -n "@region\[page-send-message\]"
showcase/integrations/{langgraph-python,google-adk}/src/app/demos/headless-complete/chat/chat.tsx`:
both files have start (line 38) + end (line 114) markers; `diff` between
them is empty post-change.
- `npx tsx showcase/scripts/bundle-demo-content.ts`: regenerated
`demo-content.json` exposes `regions["page-send-message"]` for both
`langgraph-python::headless-complete` and
`google-adk::headless-complete` (1878 bytes, `chat/chat.tsx` lines
38-112).
- Playwright sweep across `/programmatic-control`,
`/runtime-server-adapter`, `/frontend-tools`,
`/generative-ui/tool-rendering`, `/prebuilt-components`,
`/deploy/agentcore`, `/auth` on `google-adk` and `mastra`: 0 console
errors, 0 warnings, 0 "Missing snippet" callouts in rendered DOM, both
desktop (1440px) and mobile (390px) viewports.

## Test plan

- [ ] Pull, build shell-docs, smoke
`/langgraph-python/programmatic-control` and
`/google-adk/programmatic-control`: yellow "Missing snippet" callout is
gone.
- [ ] Same pages on a mobile viewport: no hydration warning in the
console.
- [ ] `/<framework>/prebuilt-components` and any page with an inline
`<OpsPlatformCTA>`: no hydration warning.
- [ ] Peer integration pages (e.g. `/mastra/programmatic-control`,
`/<framework>/deploy/agentcore`, `/<framework>/frontend-tools`):
snippets still render, no `[docs-render] snippet missing` warnings.
- [ ] Redeploy shell-docs.

## Out of scope

- Underlying prose-vs-code parity gap on the headless-complete cell
(north-star uses `agent.abortRun()` and skips `connectAgent`) is tracked
separately.
- Unifying `docs-render.tsx::SNIPPET_MAP` and
`mdx-registry.tsx::STUB_PARTIAL_MAP` into a single source of truth (so
future entries can't drift) is the right architectural follow-up. Filed
separately.
- Environmental jsdom × vitest interaction blocking
`packages/web-inspector/src/lib/__tests__/telemetry.test.ts` (which
forced `--no-verify` on these commits) is tracked separately.
2026-05-22 16:50:31 -07:00
github-actions[bot] 2ba4f29172 style: auto-fix formatting 2026-05-22 23:37:40 +00:00
Sam Julien e8957c66f0 fix(shell-docs): emit full per-page metadata, fix OG fonts, return real 404
Three post-cutover SEO/social gaps surfaced once docs.copilotkit.ai
pointed at shell-docs:

- `generateMetadata` in the four catch-all routes returned only the
  canonical link, so every page inherited the layout's generic title
  and description and zero og/twitter tags shipped. Every share unfurled
  bare. Routes now build full Metadata via a shared helper
  (`src/lib/seo-metadata.ts`) that reads MDX frontmatter for title and
  description and emits openGraph + twitter card with absolute URLs.

- The `/og/<slug>` route fetched Inter TTFs from fonts.gstatic.com on
  every request. Any failure tripped the catch block, which 307'd to a
  broken CDN fallback. Removed the runtime font fetch and let Satori
  fall back to its built-in sans-serif; also broadened the slug
  resolution to try the framework-scoped `integrations/<folder>/<slug>`
  path so OG images render for framework variants too. Catch block now
  surfaces real failures as 500 instead of redirecting to a broken PNG.

- Unknown URLs returned HTTP 200 with a not-found UI body (soft-404).
  Root cause was a `<Suspense fallback={null}>` wrapper in the root
  layout that committed the response stream before page-level
  `notFound()` could set the 404 status. Removed the Suspense, added an
  explicit `src/app/not-found.tsx`, and marked the catch-all routes
  `force-dynamic` so unknown slugs always re-evaluate at request time.
  Verified locally: `/this-clearly-does-not-exist` returns HTTP 404,
  `/built-in-agent/quickstart` returns HTTP 200 with full meta tags.
2026-05-22 16:36:17 -07:00
Sam Julien 24ba00d175 fix(shell-docs): restore truncated pydantic-ai shared-state MDX
The cutover to `docs_mode: authored` for pydantic-ai exposed two MDX
files that had been ported in a truncated state during the v1->v2
content migration:

  integrations/pydantic-ai/shared-state/in-app-agent-read.mdx
  integrations/pydantic-ai/shared-state/in-app-agent-write.mdx

`in-app-agent-read.mdx` ended mid-python-fence at
`if __name__ == "__main__":` with no closing ```, no closing `</Step>`,
no closing `</Steps>`. `in-app-agent-write.mdx` had a python code block
that switched to TSX content mid-fence (Python `if __name__` followed
by JS `// ...` and a TSX function inside a `python` block), which the
MDX/Shiki pipeline then tried to parse as Python.

Both produced SSR 500s in production (Railway edge: text/plain
"Internal Server Error") at:

  /pydantic-ai/shared-state/in-app-agent-read
  /pydantic-ai/shared-state/in-app-agent-write

These were the only two 5xx URLs in the full 2451-URL sitemap crawl.
Every other framework variant of the same paths (langgraph-python,
mastra, built-in-agent, google-adk, etc.) returned 200, confirming the
crash was content-specific to pydantic-ai.

Restore the full content from the canonical legacy source at
`docs/content/docs/integrations/pydantic-ai/shared-state/` (which was
intact, 178+188 lines), with the leading `import` block stripped to
match the convention used by the other ported pydantic-ai pages
(`predictive-state-updates.mdx` etc.) where `RunAndConnect`,
`IframeSwitcher`, and friends are resolved via `docsComponents` in
`src/lib/mdx-registry.tsx` rather than per-file imports.

Verified locally with `next dev`:

  /pydantic-ai/shared-state/in-app-agent-read   500 -> 200
  /pydantic-ai/shared-state/in-app-agent-write  500 -> 200
2026-05-22 16:36:17 -07:00
Sam Julien 8decc2e8b3 fix(shell-docs): preserve path suffix in /reference/v1/* redirect
The P10 catalog rule was stripping the suffix when redirecting legacy
v1 reference URLs, sending /reference/v1/hooks/useCopilotChat to the
generic /reference/v2 index instead of /reference/v2/hooks/useCopilotChat.

Affects user-facing console messages in packages/react-core that ship
/reference/v1/hooks/useCopilotChatHeadless_c links and bounced users to
the index page instead of the specific hook reference.

Middleware substitutes :path* in destinations (verified against the
coagents rule), so adding :path* to the destination is enough to fix it.
2026-05-22 16:36:17 -07:00
Sam Julien 10b4960a3c fix(shell-docs): suppress HubSpot hydration mismatch on dashboard CTAs
OpsPlatformCTA and SignupLink both link out to
dashboard.operations.copilotkit.ai, which HubSpot's analytics tag
rewrites client-side to attach `__hstc` / `__hssc` / `__hsfp`
cross-domain tracking params. Same root cause as the prior nav-bar
Intelligence CTA fix — server-rendered href has the bare URL,
post-hydration DOM has the rewritten URL, React flags a hydration
mismatch on every page that surfaces the inline / tile / card CTA
(observed live on /<framework>/prebuilt-components and
/<framework>/headless among others).

Add `suppressHydrationWarning` to all four <a> tags in
OpsPlatformCTA (card / inline / tile / link-inside-card) and the
single <a> in SignupLink. Scoped to those anchors so genuine
mismatches elsewhere still surface.
2026-05-22 16:11:59 -07:00
Sam Julien 773631cbdd fix(shell-docs): expand snippet registry, make inlineSnippets fence-aware
Railway logs surfaced 15+ distinct `[docs-render] snippet missing for
component …` warnings post-cutover. Root causes split three ways:

1. Registry drift. `docs-render.tsx::SNIPPET_MAP` had drifted from
   `mdx-registry.tsx::STUB_PARTIAL_MAP` — InstallSDKSnippet,
   InstallPythonSDK, RunAndConnect (+ Snippet alias), CopilotUI,
   LandingCodeShowcase, the four CopilotCloudConfigure* /
   SelfHostingCopilotRuntime* keys, plus MigrateTo / MigrateToV /
   ToolRenderer aliases were all missing. Add them.

2. Code-fence false positives. The inliner regex matched
   `<Component />` references inside ```tsx``` example blocks (e.g.
   `<CopilotChat />`, `<CopilotSidebar />` shown as runtime usage,
   `<WeatherCard />` / `<YourApp />` placeholders). Make the regex
   fence-aware via a new `isInsideCodeFence(content, offset)` helper
   that tracks both fenced blocks (any indentation — MDX inside
   `<Step>` is routinely 8-space-indented) and inline-code spans.

3. JSX-prop runtime components. `icon={<PaintbrushIcon />}` etc. are
   registered in `mdx-registry.tsx::docsComponents` as real React
   components, not snippets. Add an `Icon`-suffix heuristic: lucide
   icons used as JSX props are silenced. CopilotChat / CopilotSidebar
   in prose backticks are now silenced by (2) instead of the prior
   ad-hoc allowlist, which is removed.

Verified clean across the previously-warning pages — /programmatic-control,
/runtime-server-adapter, /frontend-tools, /generative-ui/tool-rendering,
/prebuilt-components, /deploy/agentcore, /auth — all 0 docs-render
warnings post-change. Unified-registry refactor (single source of
truth) is the right next step but out of scope for this cutover-blocker
pass.
2026-05-22 16:11:59 -07:00
github-actions[bot] 648aeb76ed style: auto-fix formatting 2026-05-22 22:58:40 +00:00
Sam Julien f809b9b8bd fix(shell-docs): register UseAgentSnippet, silence CopilotChat warning noise
inlineSnippets() in docs-render.tsx maintains its own SNIPPET_MAP
separate from mdx-registry.tsx. The two registries drifted: mdx-registry
gained `UseAgentSnippet: "use-agent.mdx"` but docs-render didn't. As a
result every page that imports `<UseAgentSnippet />` (the shared
programmatic-control snippet, used by all integration overrides) logged
"[docs-render] snippet missing for component UseAgentSnippet" at SSR
time, and the snippet content was missing from non-MDX surfaces
(search-index, llms.txt, OG metadata).

Add the missing entry so the inliner can resolve it.

Separately, the inliner regex isn't code-fence-aware, so `<CopilotChat />`
usages inside example code blocks (slots.mdx, threads.mdx, etc.) were
also flagged as missing snippets even though CopilotChat is a runtime
React component, not a snippet. Add a small allowlist of known React
components so the regex short-circuits on those without warning. A
fence-aware regex is the right architectural fix but out of scope here.

Confirmed via Playwright: /mastra/programmatic-control console drops
from 3 [docs-render] warnings to 0 after the change.
2026-05-22 15:57:57 -07:00
Sam Julien 2c0791930b fix(shell-docs): suppress HubSpot-rewritten href hydration mismatch
HubSpot's analytics tag (loaded from js-na2.hs-analytics.net) rewrites
the Intelligence CTA's outbound href client-side to append `__hstc` /
`__hssc` / `__hsfp` cross-domain tracking params. Server-rendered HTML
keeps the bare URL, so the post-hydration DOM differs and React's
hydration diff fires a "tree hydrated but some attributes... didn't
match the client properties" warning.

Add `suppressHydrationWarning` to the two anchor elements that point at
`INTELLIGENCE_CTA_HREF` (the desktop BrandNav LEFT_LINKS entry and the
MobileTopNav Lightbulb icon). Suppress is scoped to just those anchors
— other nav items still flag genuine mismatches.

Confirmed via Playwright: page console drops from 1 hydration error to
0 on /mastra/programmatic-control after the change.
2026-05-22 15:57:57 -07:00
Sam Julien c57ebd82e0 fix(shell-docs): redirect deprecated /tutorials paths (#4987)
## Summary

- Add wildcard 301 redirects for the deprecated `/tutorials/*` URL space
in the shell-docs redirect catalog.
- Framework-scoped tutorial URLs redirect to that framework's
`/quickstart`; unscoped variants redirect to the docs root.
- Covers all 21 canonical framework slugs (built-in-agent,
langgraph-{python,typescript,fastapi}, google-adk, a2a, agent-spec,
deepagents, mastra, crewai-crews, pydantic-ai, agno, ag2, llamaindex,
strands, ms-agent-{python,dotnet}, claude-sdk-{python,typescript},
langroid, spring-ai).

## Why

The step-2 tutorial MDX
(`tutorials/ai-todo-app/step-2-setup-copilotkit.mdx` and
`tutorials/ai-powered-textarea/step-2-setup-copilotkit.mdx`) crashes
during SSR for every active framework slug, returning a 21-byte
`text/plain` 500 from `railway-edge`. Sibling steps (`overview`,
`step-1`, `step-3`, `next-steps`) render fine. The sitemap lists ~38 of
these URLs. Two of them are in the legacy sitemap as 200s.

The tutorials section is being retired, so the right operational
response is a 301 to a working destination rather than a renderer fix.

## Implementation

- New `CANONICAL_FRAMEWORKS` constant alongside the existing
`FRAMEWORKS` legacy-slug array.
- Generated wildcard entries `/${fw}/tutorials/:path*` →
`/${fw}/quickstart` per framework.
- Two explicit entries for unscoped paths: `/tutorials/:path*` → `/` and
`/tutorials` → `/`.
- Slotted in `WILDCARD_REDIRECTS` before the per-framework `P1×`/`P2×`
catch-alls so the more specific tutorial rule wins.

## Test plan

- [ ] Local: `npm run dev` in `showcase/shell-docs/` and curl a sample
of step-2 URLs, confirm 301 to `/{fw}/quickstart`.
- [ ] Local: `npm run typecheck` in `showcase/shell-docs/` (catalog is
pure data; TypeScript catches shape drift).
- [ ] Post-deploy: re-curl the 38 step-2 URLs from the production
sitemap and confirm 301 chains land on a 200.
2026-05-22 15:54:34 -07:00
Jordan Ritter 3c06160aef chore(shell-docs): pre-bake WebP for gen-ui-specs diagrams
Wave-2 follow-up to #4986. With the next/image optimizer disabled
(images.unoptimized: true), gen-ui-specs-light.png and gen-ui-specs-dark.png
were shipping uncompressed instead of being served as WebP via /_next/image.
Pre-baking WebP variants restores the bandwidth savings: light 408,807 -> 126,982
bytes (3.2x smaller) and dark 496,127 -> 167,118 bytes (3.0x smaller). Source
PNGs are retained alongside as fallbacks.
2026-05-22 15:49:42 -07:00
Sam Julien a4b5436ce2 fix(shell-docs): redirect deprecated /tutorials paths
The tutorials section is retired post-cutover. Step-2 MDX (both ai-todo-app
and ai-powered-textarea) currently 500s in the SSR layer, surfacing across
all active framework slugs and in ~38 sitemap entries. Add wildcard 301s
in the redirect catalog so framework-scoped tutorial URLs land on that
framework's quickstart, and unscoped variants land on the docs root.

Covers all 21 canonical framework slugs (generated, authored, hidden) plus
the unscoped /tutorials and /tutorials/* paths. Slotted before the P1×/P2×
per-framework catch-alls so the more specific tutorial rule wins.
2026-05-22 15:40:54 -07:00
Jordan Ritter c906392350 fix(shell-docs): disable next/image optimizer to unblock CDN images
Post-cutover, every image on docs.copilotkit.ai broke because Next.js's
/_next/image optimizer needs the sharp module at runtime and sharp is
missing from the Railway runtime image. Setting images.unoptimized=true
makes <Image> render as a plain <img> pointing at the source URL,
eliminating the sharp dependency entirely.

This is visually identical for users: our CDN (cdn.copilotkit.ai,
CloudFront/S3) ignores ?fm=webp and serves the cached PNG regardless,
so the optimizer was already producing no format-conversion gains for
CDN-hosted images. A wave-2 follow-up will pre-bake WebP variants of
the two 4K gen-ui-specs-*.png files for bandwidth.
2026-05-22 15:33:19 -07:00
Tyler Slaton 79181d4d38 feat(shell-docs): re-add markdown_copied + open_in_llm_clicked PostHog events
The original analytics commit (4d67fe269) was reverted because it
also contained a botched BrandNav height change. Re-apply just the
PostHog instrumentation cleanly:

- `MarkdownCopyButton` fires `markdown_copied`
  `{ path: pathname, markdown_url: markdownUrl }` after a successful
  clipboard write. Coexists with the global `cli_command_copied`
  (Benjamin's monkey-patch in `lib/track-command-copy.ts` that
  intercepts every clipboard write at the navigator level); the
  dedicated event lets the dashboard distinguish page-content copies
  from CLI copies (which classify under the existing tracker as
  `code` — not meaningful for the new docs-as-context surface).
- Each `ViewOptionsPopover` item gains a `target` discriminator
  (`github`, `view-as-markdown`, `windsurf`, `claude-code`, `codex`,
  `chatgpt`, `claude`, `cursor`) and an `onClick` that captures
  `open_in_llm_clicked` `{ target, path }`. PostHog buffers locally
  so the new tab opens without waiting on the network.

Closes Sam's P0 analytics ask from PR #4946 — verified by the QA
audit that every existing CTA + capture (`try_for_free_clicked`,
`talk_to_us_clicked`, etc.) survives intact across the branch.
2026-05-20 21:17:34 -07:00
Tyler Slaton b7f3e4a1b5 fix(shell-docs): stop sidebar dropping 54px when banner is present
Fumadocs's docs grid sets `--fd-docs-row-1: var(--fd-banner-height, 0px)`
in `node_modules/fumadocs-ui/dist/layouts/docs/slots/container.js:25`,
and the sidebar wrapper uses that value as both its sticky-top offset
AND its in-grid top offset (`top-(--fd-docs-row-1)` plus
`h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))]`). That design
assumes the banner is sticky / fixed at the viewport top — so the
sidebar starts BELOW the banner.

shell-docs renders the banner in NORMAL body flow above BrandNav.
Banner pushing things down via flow is sufficient; the extra
`--fd-docs-row-1` offset double-counts the banner height. Result:
when the banner appears, BrandNav drops 54px (correct, flow) AND
the sidebar drops an ADDITIONAL 54px below BrandNav (wrong) —
visible as a yawning gap between BrandNav's bottom edge and the
sidebar's framework picker that didn't exist when the banner was
dismissed.

Pin `--fd-docs-row-1: 0px` on `#nd-docs-layout` for md+ so the
sidebar tracks BrandNav's bottom edge consistently, banner or no
banner. The mobile branch (where MobileTopNav is `position: fixed`)
keeps its existing `padding-top: var(--fd-nav-height)` so the docs
grid clears the fixed mobile nav — independent concern, untouched.

Verified at 1440×900 with banner present: BrandNav bottom = 142,
sidebar top = 166, gap = 24px (matches `main`'s `md:mt-6`). Without
banner: BrandNav bottom = 88, sidebar top = 112, gap = 24px. Same
gap in both cases.
2026-05-20 21:15:38 -07:00
Tyler Slaton 885f5cd036 Revert "feat(shell-docs): wire markdown_copied / open_in_llm_clicked + roomier BrandNav"
This reverts commit 4d67fe2691.
2026-05-20 21:12:28 -07:00
Tyler Slaton 00b0fc684d Revert "fix(shell-docs): give sidebar framework picker more headroom inside the card"
This reverts commit 070916302a.
2026-05-20 21:12:27 -07:00
Tyler Slaton 070916302a fix(shell-docs): give sidebar framework picker more headroom inside the card
The sidebar's first child (the SidebarBanner that hosts the framework
picker pill) had `padding: 1rem 1rem 0 1rem`. With the BrandNav and the
sidebar's outer `rounded-2xl border` chrome, 1rem (16px) at the top
read as scrunched against the card's rounded edge — the picker pill
has its own rounded corners and a border, so the gap to the parent
card edge needs to exceed the gap to the first nav link below it to
feel balanced.

Bump the top padding to 1.5rem (24px). Side and bottom padding stay
at 1rem and 0 respectively — the bottom-to-first-nav-link gap is
governed by the scroll viewport's 1rem top padding (defined further
down in this file), so the picker now sits with `24px-pill-16px` above
and below it instead of `16px-pill-16px`.
2026-05-20 21:09:29 -07:00
Tyler Slaton 4d67fe2691 feat(shell-docs): wire markdown_copied / open_in_llm_clicked + roomier BrandNav
Two follow-ups in one commit since they share the same shell-docs scope.

(1) Analytics events for the new docs-as-context surface (per Sam's
    P0 ask on PR #4946). The existing global `cli_command_copied`
    tracker in `lib/track-command-copy.ts` monkey-patches every
    `navigator.clipboard.writeText` call, so my `MarkdownCopyButton`
    was already being captured — but classified as `code` (the
    fallback when the text doesn't match an install command). That's
    not useful for the new "Copy Markdown" affordance.

    - `MarkdownCopyButton` fires `markdown_copied`
      `{ path: pathname, markdown_url: markdownUrl }` after a
      successful clipboard write. Coexists with the global capture;
      the dedicated event lets the analytics dashboard distinguish
      page-content copies from CLI copies.
    - Each `ViewOptionsPopover` item gains a `target` discriminator
      (`github`, `view-as-markdown`, `windsurf`, `claude-code`,
      `codex`, `chatgpt`, `claude`, `cursor`) and an `onClick` that
      captures `open_in_llm_clicked` `{ target, path }`. PostHog
      buffers locally so the new tab opens without waiting on the
      network.

(2) BrandNav was visually flush against the viewport top with
    minimal breathing room around its inner chrome. Bump the nav
    height (`h-[68px] xl:h-[88px]` → `h-[80px] xl:h-[104px]`) and
    matching interior padding so the content row (logo + tabs +
    Talk-to-engineer pill + search) sits comfortably-centered with
    a clear gap above. The taller nav also reads better when the
    rotating banner is visible — the banner / nav / sidebar stack
    now has clear vertical separation rather than feeling stacked.

    Update `--fd-nav-height` accordingly:
    - mobile (unchanged): 56px
    - md (768-1280px): 80px (was 88px hardcoded, which didn't match
      BrandNav's actual md height of 68px — a pre-existing mismatch)
    - xl+ (≥1280px): 104px (was 88px, now matches BrandNav's xl
      height)

    Update the `--fd-docs-height` calcs to track the same numbers
    (68 → 80, 88 → 104) so the sticky sidebar grid-area's height
    stays correct after the BrandNav grows.

Call-site enumeration:
- `MarkdownCopyButton` / `ViewOptionsPopover` — only callers are
  the MDX registry; existing analytics CTAs (try_for_free_clicked,
  talk_to_us_clicked, etc.) untouched.
- `--fd-nav-height` — read by `#nd-docs-layout`'s `pt-(...)` on
  mobile (load-bearing for MobileTopNav clearance) and by the
  Fumadocs sidebar's `top:` offset. Both branches verified visually
  with banner toggled at 1014px and 1440px viewports.
- `--fd-docs-height` — drives the sticky sidebar grid wrapper's
  height; the calc subtracts banner + nav + 2.25rem margin.
2026-05-20 21:05:29 -07:00
Tyler Slaton 1cdaae9369 chore: merge origin/main into tyler/jolly-liskov-74539a
Resolves merge conflict in `showcase/shell-docs/src/components/mobile-top-nav.tsx`:
- v16 of fumadocs moved `SidebarTrigger` from
  `components/layout/sidebar` to `components/sidebar/base` (this PR's
  upgrade). Keep the v16 path.
- `main` added Calendar / Lightbulb icons + `usePostHog` import for the
  expanded mobile CTAs (Get-Intelligence-free + Talk-to-Engineer pill).
  Keep those — they're referenced by the file body.

Combined resolution = main's import set with v16's import path for
SidebarTrigger. Other auto-merged files (brand-nav, snippet,
mdx-registry, etc.) merged cleanly; typecheck passes.
2026-05-20 20:47:21 -07:00
Tyler Slaton 23c0a8453c fix(shell-docs): theme-init handles 'system' value + snippet headers use language-correct comment syntax
CR Round 3 surfaced two more real bucket-(a) findings.

(1) `app/layout.tsx` theme-init script — When a user explicitly picks
    the "system" theme via the next-themes API, the persisted value in
    `localStorage.theme` is the literal string `"system"`, not absent.
    The previous inline script only fell back to `matchMedia(...)` when
    the value was unset (`!t`); for a system-mode user on a dark-
    preferring OS, the script would skip the matchMedia branch (because
    `t === "system"` is truthy), then skip the `.dark` class application
    (because `t !== "dark"`), and the page would paint in light before
    next-themes resolves post-hydration. The light-flash this script
    exists to prevent. Extend the fallback condition to `!t ||
    t === "system"` so the matchMedia path also handles the explicit-
    system case.

(2) `lib/llm-text.ts` Snippet file headers — `resolveSnippet`
    hardcoded `// <filename>` as the in-fence header regardless of the
    snippet's language. For Python regions this emits `//` (integer
    division — invalid syntax), for YAML / Bash / TOML it emits the
    wrong comment marker, for JSON it emits literal `//` (no comments
    allowed in spec JSON). An LLM ingesting `/llms-full.txt` sees what
    looks like real code from the file but with a broken first line.
    Add a `fileHeaderComment(language, text)` helper that picks the
    right comment shape:
    - `#` for Python / Bash / YAML / TOML / Ruby / R / Dockerfile / etc.
    - `/* ... */` for CSS / SCSS / Less
    - `<!-- ... -->` for HTML / XML / Markdown / MDX
    - `-- ` for SQL
    - empty (drop the header) for JSON / JSONC
    - `//` for C-family (TS / JS / Java / Go / Rust / C# / etc.) — the
      previous behavior, preserved as the default.
    Apply across all three snippet emission paths (region, file, file
    + lines). Pass the language through to the helper; when the helper
    returns empty (JSON case), skip the header line entirely so the
    fenced block contains only the code.

Call-site enumeration:
- theme-init inline script — no external callers; the next-themes
  ThemeProvider reads/writes localStorage on its own schedule, our
  script only seeds the `.dark` class pre-hydration. Behavior change
  is strictly additive (one extra matchMedia call when t === "system").
- `fenceFor` — unchanged signature.
- `fileHeaderComment` (new) — used only within `resolveSnippet`. Three
  call sites, all in the same function, all updated.
- `resolveSnippet` — three return paths updated; output shape change
  is invisible to all current callers (`renderPageToLlmText`,
  `inlineSnippets`) which treat the return value as opaque markdown.
2026-05-20 20:40:17 -07:00
Tyler Slaton aad4807213 fix(shell-docs): restore throw in MarkdownCopyButton so failed copies don't show ✓
CR Round 3 caught a real regression I introduced in commit `0186ae9f2`.

The Round 1 commit threw the caught error inside the `useCopyButton`
callback to keep the button in its idle state on failure. The comment
claimed Fumadocs's `useCopyButton` "respects throws" — that wording was
wrong, but the BEHAVIOR was right: `useCopyButton` runs
`Promise.resolve(callback()).then(() => setChecked(true))` with no
`.catch()`, so a rejected callback skips the `.then()` and the button
stays in its idle (Copy) state. Cost: one unhandled rejection in the
browser console per failure.

Round 2's regression-fix removed the throw to suppress that unhandled
rejection. Net effect: the callback now returns normally on failure,
the outer `.then()` fires, `setChecked(true)` flips the button to the
green checkmark — and the user sees a "Copied!" indicator on a copy
that actually failed. They paste stale clipboard content into Claude /
ChatGPT / Cursor and get garbage responses from the LLM.

Restore the throw and update the comment to accurately describe the
trade-off. Unhandled-rejection console noise is the lesser evil
compared to silently misleading the user. A follow-up PR (filed in
the bucket-d follow-up list) can introduce an explicit error UI state
(e.g. an alert icon for 2s) so failures are surfaced visibly without
relying on the console.

Also correct the unrelated comment on the JSX prop-spread order — it
claimed `className` "takes precedence" over caller-passed `className`,
but `className={cn(buttonVariants(...), props.className)}` MERGES the
caller's value via `cn`. `disabled` and `onClick` DO take precedence
(they're declared after `{...props}`); `className` is merged. Tighten
the comment to match.

Call-site enumeration:
- `MarkdownCopyButton` — used by `mdx-registry.tsx`. No caller passes
  `disabled` or `onClick` today; the prop-spread order change is
  purely defensive. No caller passes a `className` that would conflict
  with the merge; `cn` handles tailwind-merge precedence correctly.
- Browser unhandled-rejection behavior — verified that Fumadocs's
  `useCopyButton` (read at `node_modules/fumadocs-ui/dist/utils/use-copy-button.js`)
  does NOT attach a `.catch`, so the throw produces a single
  unhandled-rejection log per failed click; no infinite loop.
2026-05-20 20:37:00 -07:00
Tyler Slaton 64ffd19d8c fix(showcase): CR Round 2 cleanup — ADK reasoning graph name + dead CSS + comment + log tag
CR Round 2 confirmation surfaced one bucket (a) finding plus three
bucket (b) trivials worth rolling in together.

(a) `google-adk/src/app/demos/reasoning-{default,custom}/page.tsx`
    comments said "Both demos share the same backend (`reasoning_agent`
    graph)". That graph name is the langgraph-python convention —
    `reasoning_agent.py` in LGP — but the ADK demo doesn't have a
    graph by that name. `src/agents/registry.py:144-145` maps both
    `reasoning-custom` and `reasoning-default` to
    `AgentSpec(_thinking_chat)`, where `_thinking_chat` is built via
    `build_thinking_chat_agent`. Round 1 fixed the same class of bug
    in langgraph-typescript (which uses `agentic-chat-reasoning`) but
    missed ADK; this is the matching fix.

(b1) `.../headless-simple/chat.tsx` (3 files) emitted
    `console.error("[headless-simple] ...", err)` with no
    integration-slug prefix. A user testing demos across frameworks
    in the same browser session couldn't tell which integration's
    runAgent failed. Tag with the framework slug:
    `[google-adk:headless-simple]`, `[langgraph-python:headless-simple]`,
    `[langgraph-typescript:headless-simple]`.

(b2) `globals.css` lines 133-137 — the `.shell-docs-sidebar
    p[class*="sidebar-item-offset"] svg` rule (4×4 icons in accent
    purple) was dead in fumadocs v16. The v16 sidebar emits separator
    `<p>` elements with `inline-flex items-center gap-2` instead of
    the v15 `sidebar-item-offset` class fragment; the live rule on
    `p.inline-flex.gap-2 svg` (added earlier in this PR) already
    handles the same styling at the correct 16×16 size. Drop the
    dead rule.

(b3) `page-actions.tsx` — the regression-fix commit
    (`0186ae9f2`) wedged `getClientBaseUrl()` between the cache-
    describing block comment and the actual `cache = new Map(...)`
    declaration. The comment now sits above its own subject again;
    `getClientBaseUrl()` keeps its own JSDoc above its definition.

Call-site enumeration:
- ADK `_thinking_chat` reference — verified in
  `showcase/integrations/google-adk/src/agents/registry.py` (line
  144-145 + `build_thinking_chat_agent` import on line 23 + builder
  invocation on line 108). Comment-only change; no symbol signatures
  touched.
- Headless log tags — only the literal log string changes; no other
  call site reads it.
- `globals.css` dead rule — verified no other selector in the file
  depends on the removed lines (the section-header SVG color is set
  by the surviving `p.inline-flex.gap-2 svg` rule).
- `page-actions.tsx` comment move — no functional change.
2026-05-20 20:20:12 -07:00
Tyler Slaton 0186ae9f28 fix(shell-docs): unbreak preview build + harden related regressions
Three regressions from the earlier CR Round 1 fix batch + a related
miss the same round didn't catch.

1. `components/ai/page-actions.tsx` is `"use client"`; importing
   `getBaseUrl` from `@/lib/sitemap-helpers` pulled `fs` / `path` /
   `gray-matter` into the client bundle and broke the build entirely
   ("Module not found: Can't resolve 'fs'"). The whole point of
   `getBaseUrl` is the 2-line env-var read + trailing-slash strip — no
   filesystem work — so inline a `getClientBaseUrl()` helper here with a
   pointer to the canonical server-side version. `sitemap-helpers.ts`
   stays untouched so other server-side callers keep their convenience.

2. The same file re-threw caught errors from `fetchMarkdown` /
   `clipboard.writeText` on the assumption that Fumadocs's
   `useCopyButton` would treat the rejection as "don't flip the
   `checked` state". It doesn't — there's no `.catch()` on the
   internal promise (verified in
   `fumadocs-ui/dist/utils/use-copy-button.js`), so the throw produced
   an unhandled rejection (browser console noise + Sentry spam) AND
   gave the user no visible failure indicator either way. Log and
   swallow at this layer; a follow-up PR can introduce an explicit
   error UI if we want "Copy failed" to surface.

3. `.claude/launch.json` routed `shell` to port 3004 by passing
   `-- --port 3004` to `npm --prefix showcase/shell run dev`. But
   shell's `dev` script ends with `npx -y concurrently -k -n
   bundle,next "tsx ... --watch" "next dev"` — the trailing
   `--port 3004` was parsed by `concurrently`, not `next dev`, so
   `next dev` still bound 3000 and the original collision with `docs`
   persisted. Switch to `bash -c "PORT=3004 npm --prefix showcase/shell
   run dev"` so the env var passes through `concurrently` into
   `next dev` (which natively reads PORT).

Call-site enumeration:
- `getClientBaseUrl` (new) — only used inside the same file. No
  external callers to update.
- `getBaseUrl` (untouched in `@/lib/sitemap-helpers`) — server-side
  callers (sitemap routes, `llms-full.txt` route, `llms.txt` route)
  unchanged; verified via grep that no `"use client"` file imports it.
- `MarkdownCopyButton` — error now logged once via `console.error`
  and swallowed; the button stays in its idle state.
- `.claude/launch.json` `shell` entry — `runtimeExecutable` flipped
  from `npm` to `bash`; harness reads these as opaque strings.
2026-05-20 20:12:03 -07:00
Tyler Slaton 04c6383990 fix(shell-docs): resolve launch.json port collision + harden preview script + untrack next-env.d.ts
`.claude/launch.json` declared port 3000 for both \`docs\` (Next.js at
docs/) and \`shell\` (Next.js at showcase/shell/) — only one could
actually start at a time, and Next's auto-port-fallback would land
\`shell\` on whatever was free without the launch config knowing.
Reassign \`shell\` to port 3004 (next free slot after the existing
3001/2/3 cluster) and pass \`-- --port 3004\` through \`npm run dev\`
so the runtime port matches the declared port.

\`.claude/preview/shell-docs.sh\` had a blanket
\`|| { echo "(may have failed — expected)" }\` after \`pnpm install\` that
swallowed every install failure, not just the documented \`lefthook\`
prepare-hook one. A real failure (network down, lockfile drift) would
get silently absorbed and then explode much later at the \`npx tsx\`
generator step with a confusing \`Cannot find module\` error. Verify
\`$SCRIPTS_DIR/node_modules\` exists after the install attempt; bail
with a clear instruction if it doesn't.

\`showcase/shell-docs/next-env.d.ts\` is a Next.js-auto-generated file
whose contents differ between \`next dev\` (\`./.next/dev/types/...\`)
and \`next build\` (\`./.next/types/...\`). Per Next.js's own
recommendation it should never be checked in — the v16 path change
would otherwise produce dirty trees on every build/dev switch, and a
clean checkout's typecheck would fail because the imported
\`.next/dev/types/routes.d.ts\` is itself gitignored. Add the file to
\`.gitignore\` (matching the existing \`docs/next-env.d.ts\` entry) and
\`git rm --cached\` to untrack the committed copy. Next regenerates it
on first \`next dev\`/\`next build\`.

Call-site enumeration:
- \`.claude/launch.json\` — no callers within the repo; the
  \`/run\` slash command reads it as data. Port change is non-breaking
  for any other tooling that doesn't bind to 3000 for \`shell\`.
- \`.claude/preview/shell-docs.sh\` — the lefthook installer is the
  only thing that runs it (besides interactive users); both flows
  benefit from the loud failure.
- \`next-env.d.ts\` — no source file imports from it; the file is a
  TypeScript \`/// <reference\` declaration consumed by tsc only,
  regenerated on each build/dev.
2026-05-20 20:01:16 -07:00
Tyler Slaton 3700b885b0 fix(shell-docs): guard SidebarFolderStatePreserver synthetic clicks + fix PopoverClose export
`SidebarFolderStatePreserver` had two silent `catch {}` blocks (read /
write of the saved state map) — log via `console.warn` so a user whose
folders keep resetting can diagnose the underlying storage failure
(SecurityError on third-party iframes / privacy mode, QuotaExceeded,
corrupted JSON).

The restore-on-mount effect called `trigger.click()` to flip Radix's
state to the saved value. That synthetic click bubbles to the
delegated `#nd-sidebar` click handler, which then records the new
state — but if Radix's `data-state` hadn't updated by the next
`requestAnimationFrame` (transient animation, mount race), the
recorded value could overwrite the user's saved preference with the
live value the restore just tried to flip. Add a module-level
`WeakSet<HTMLButtonElement>` of in-progress synthetic clicks; the
delegated handler skips entries in the set. The flag is cleared on the
next rAF, by which point any genuine user click will fire against an
unmarked trigger.

`popover.tsx` exported `PopoverClose = PopoverPrimitive.PopoverClose`,
but Radix UI's actual export is `PopoverPrimitive.Close`. The
expression resolved to `undefined`, so any caller rendering
`<PopoverClose />` would have thrown React's "Element type is invalid:
expected a string ... but got undefined" error. The shadcn-style
scaffold the Fumadocs CLI generated had the symbol name wrong; fix the
re-export to `PopoverPrimitive.Close`.

Call-site enumeration:
- `SidebarFolderStatePreserver` — used only by `ShellDocsLayout`.
  Behavior change is purely additive (logs on previously-silent
  errors; suppresses synthetic clicks the previous code already
  intended to be no-ops).
- `PopoverClose` — confirmed via grep that no caller exists yet; this
  is a defensive fix to a fresh scaffold.
- `Popover`, `PopoverTrigger`, `PopoverContent` — unchanged.
2026-05-20 19:57:26 -07:00