Skip to content

✨ feat(ask-ai-button): spin the Fumadocs Ask AI dropdown out into a package - #117

Merged
vtempest merged 1 commit into
masterfrom
claude/keen-knuth-uy99y3
Oct 6, 2026
Merged

vtempest merged 1 commit into
masterfrom
claude/keen-knuth-uy99y3

Conversation

@vtempest

@vtempest vtempest commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

What

New package packages/ask-ai-button (npm ask-ai-button, name is free on the registry), built from the AskAIDropdown and LLMCopyButton in starter-templates/template-fumadocs.

  • AskAIButton: variant="dropdown" (page header) or variant="fab" (floating, bottom-right/left)
  • AskAIPanel: the same panel, embedded inline
  • CopyPageButton: copies the page's raw Markdown (replaces LLMCopyButton)

The panel has a message box for the visitor's own question, a Link to page / Include page text toggle, and the provider list: Claude, ChatGPT, Gemini, Perplexity, Grok, Copilot, Le Chat, T3 Chat, Brave, QwkSearch, Cursor. It also has Copy prompt, Copy page and an optional GitHub link. Picking a provider opens a new tab with the prompt pre-filled.

  • Custom providers: getHref for any chat URL, or onSelect to hand the prompt to your own API without opening a tab
  • When pasted page text would make the URL longer than maxUrlLength (default 8000), the tab opens with the link prompt instead and the full prompt goes to the clipboard
  • Page text is prefetched when that mode is picked, so window.open stays synchronous and popup blockers don't stop it
  • Styles inject themselves (no Tailwind or CSS import needed) and use Fumadocs' --color-fd-* tokens when they exist; the bundle starts with "use client"

Wiring

  • template-fumadocs now uses ask-ai-button, and its two local component files are deleted
  • Agent skill skills/ask-ai-button, .claude/packages/ask-ai-button/CLAUDE.md, plus entries in SKILLS_BY_PACKAGE, test.yml, codecov.yml, the docs sync list, the root and packages READMEs, and overview.md

Validation

  • bunx turbo run typecheck test coverage build --filter=ask-ai-button: all pass, 25 tests, about 87% statement coverage
  • Checked the dropdown and FAB in headless Chromium using the demo page
  • Type-checked template-fumadocs against the local package: no errors in the changed files. The only error is an Orama typing issue in components/fumadocs/layout/search.tsx, which was already there.
  • bun run readmes:check still reports 11 stale headers in other packages. That drift was there before this PR and is left alone. The new package's header is current.

Notes

  • template-fumadocs/package-lock.json isn't regenerated because ask-ai-button isn't on npm until this merges and the publish workflow runs.
  • The git0 docs and template-nextjs-harness-cloudflare/template-fumadocs still keep their own copies of the dropdown.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01RTY3Ukit459jDu8tLsT3FJ


Generated by Claude Code

…ackage

New `packages/ask-ai-button` (npm `ask-ai-button`): an "Ask AI about this
page" component for docs sites, built from the AskAIDropdown and
LLMCopyButton in template-fumadocs.

- AskAIButton as a dropdown or a floating action button, AskAIPanel for
  inline use, CopyPageButton for copying the page Markdown
- Message box for the visitor's own question, a link/page-text toggle,
  and Claude, ChatGPT, Gemini, Perplexity, Grok, Copilot, Le Chat,
  T3 Chat, Brave, QwkSearch and Cursor as providers
- Custom providers by URL (getHref) or by handler (onSelect) for APIs
- Copy prompt / copy page actions; a prompt too long for a URL falls
  back to the link prompt and puts the full prompt on the clipboard
- Self-injected stylesheet that follows Fumadocs' theme tokens
- Vitest suite, demo page, agent skill, CI matrix and Codecov flag

template-fumadocs now uses the package in place of its local copies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RTY3Ukit459jDu8tLsT3FJ
@vercel

vercel Bot commented Oct 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cccp-deployment Building Building Preview Oct 6, 2026 1:00pm UTC
dev-tools-help-docs Building Building Preview Oct 6, 2026 1:00pm UTC
test-google-login Building Building Preview Oct 6, 2026 1:00pm UTC

@vtempest
vtempest merged commit f1cccf4 into master Oct 6, 2026
26 of 30 checks passed
@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
981 2 979 0
View the top 2 failed test(s) by shortest run time
test/cookie-consent.test.tsx > test/cookie-consent.test.tsx
Stack Traces | 0s run time
Error: Cannot find module 'react'
Require stack:
- .../dist/cjs/lucide-react.js
 ❯ Object.<anonymous> ../...../dist/cjs/lucide-react.js:10:13

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'MODULE_NOT_FOUND', requireStack: [ '.../dist/cjs/lucide-react.js' ] }
test/react.test.tsx > test/react.test.tsx
Stack Traces | 0s run time
Error: Cannot find module 'react'
Require stack:
- .../dist/cjs/lucide-react.js
 ❯ Object.<anonymous> ../...../dist/cjs/lucide-react.js:10:13

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Serialized Error: { code: 'MODULE_NOT_FOUND', requireStack: [ '.../dist/cjs/lucide-react.js' ] }

To view more test analytics, go to the Test Analytics Dashboard
πŸ“‹ Got 3 mins? Take this short survey to help us improve Test Analytics.

This branch had an error being deployed

1 failed and 2 active deployments
Preview – cccp-deployment β€” bbea3dee Deployed Oct 6, 2026 by vercel[bot]
Preview – dev-tools-help-docs β€” bbea3dee Deployed Oct 6, 2026 by vercel[bot]
Preview – test-google-login β€” bbea3dee Deployed Oct 6, 2026 by vercel[bot]
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