diff --git a/.claude/CLAUDE.md b/.claude/CLAUDE.md index 092adbbc..cc90145c 100644 --- a/.claude/CLAUDE.md +++ b/.claude/CLAUDE.md @@ -102,6 +102,7 @@ one tree rather than beside the source. | `apps/dev-tools-help-docs` | [.claude/apps/dev-tools-help-docs/CLAUDE.md](.claude/apps/dev-tools-help-docs/CLAUDE.md) | | `apps/vscode-cloud` | [.claude/apps/vscode-cloud/CLAUDE.md](.claude/apps/vscode-cloud/CLAUDE.md) | | `packages/about-system-info` | [.claude/packages/about-system-info/CLAUDE.md](.claude/packages/about-system-info/CLAUDE.md) | +| `packages/ask-ai-button` | [.claude/packages/ask-ai-button/CLAUDE.md](.claude/packages/ask-ai-button/CLAUDE.md) | | `packages/api2ai-mcp-generator` | [.claude/packages/api2ai-mcp-generator/CLAUDE.md](.claude/packages/api2ai-mcp-generator/CLAUDE.md) | | `packages/cloudflare-to-claude-fix` | [.claude/packages/cloudflare-to-claude-fix/CLAUDE.md](.claude/packages/cloudflare-to-claude-fix/CLAUDE.md) | | `packages/code-tree-graph` | [.claude/packages/code-tree-graph/CLAUDE.md](.claude/packages/code-tree-graph/CLAUDE.md) | diff --git a/.claude/architecture/overview.md b/.claude/architecture/overview.md index c2f3c940..b05a25e3 100644 --- a/.claude/architecture/overview.md +++ b/.claude/architecture/overview.md @@ -21,6 +21,7 @@ name is what turbo filters and `--skill` flags use. | Directory | npm name | What it owns | | --- | --- | --- | | `about-system-info` | `about-system` | Cross-platform CLI printing CPU/memory/disk/uptime/IP/ISP as one emoji line; also a desktop app under `native/` | +| `ask-ai-button` | `ask-ai-button` | Ask AI dropdown / floating button / inline panel for docs pages: sends the page (link or pasted Markdown) plus a question to Claude, ChatGPT, Gemini, Perplexity and more, or copies it. Spun out of `template-fumadocs` | | `api2ai-mcp-generator` | `api2ai` | Generates MCP servers from any OpenAPI spec (mcp-use); HTTP/SSE/Streamable transports, inspector UI, Zod validation | | `cloudflare-to-claude-fix` | `cloudflare-to-claude-fix` | Workers Queue consumer that fires a Claude Code routine when a Workers build fails | | `code-tree-graph` | `code-tree-graph` | Fumadocs/Next components: `DependencyGraph` (Mermaid from AST), `FileTreeView`, `TypeTable` — all from a local parser, no external service | diff --git a/.claude/packages/ask-ai-button/CLAUDE.md b/.claude/packages/ask-ai-button/CLAUDE.md new file mode 100644 index 00000000..9c815750 --- /dev/null +++ b/.claude/packages/ask-ai-button/CLAUDE.md @@ -0,0 +1,32 @@ +# CLAUDE.md — `ask-ai-button` + +**skill:** [`skills/ask-ai-button`](../../../skills/ask-ai-button/SKILL.md) +· **runner:** Vitest (jsdom) · **build:** Vite library + `vite-plugin-dts` + +"Ask AI about this page" for docs sites: `AskAIButton` (dropdown or FAB), +`AskAIPanel` (inline), `CopyPageButton`. Spun out of +`starter-templates/template-fumadocs/components/fumadocs/ai/`. + +## Rules + +- **Provider URLs are public API.** A changed query parameter silently empties + every prompt for that provider. Only change one after checking it opens with + the prompt filled in, and keep the encode-everything test passing. +- **`window.open` must stay synchronous in the click handler.** Content is + prefetched for exactly this reason; an `await` before the open gets the tab + blocked as a popup. +- **No Tailwind, no CSS import.** Styles live in `src/styles.ts` and are + injected at runtime; class names (`aai-*`) and `--aai-*` variables are public + surface. +- The bundle keeps its `"use client"` banner (`vite.config.ts`) so Next.js + server components can render it. + +## Layout + +`src/AskAIButton.tsx` (trigger, FAB, CopyPageButton) · `src/AskAIPanel.tsx` +(the panel) · `src/providers.tsx` · `src/prompt.ts` · `src/clipboard.ts` · +`src/styles.ts` · `src/icons.tsx` · `demo/` (`bun run dev`) + +```bash +cd packages/ask-ai-button && bun run typecheck && bun run test && bun run build +``` diff --git a/.github/scripts/sync-package-readmes.mjs b/.github/scripts/sync-package-readmes.mjs index c72aa024..9e196730 100644 --- a/.github/scripts/sync-package-readmes.mjs +++ b/.github/scripts/sync-package-readmes.mjs @@ -145,6 +145,7 @@ const SKILLS_SOURCE = 'https://github.com/OpenSourceAGI/dev-tools-starter-agent' const SKILLS_BY_PACKAGE = { 'about-system-info': ['about-system'], 'api2ai-mcp-generator': ['api2ai'], + 'ask-ai-button': ['ask-ai-button'], 'cloudflare-to-claude-fix': ['cloudflare-to-claude-fix'], 'code-tree-graph': ['code-tree-graph'], 'create-cloud-db': ['create-cloud-db'], diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b1364ad7..286d6294 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,7 @@ jobs: include: - package: about-system-info - package: api2ai-mcp-generator + - package: ask-ai-button - package: cloudflare-to-claude-fix - package: code-tree-graph - package: create-cloud-db diff --git a/README.md b/README.md index af1253c2..585c41be 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,9 @@ [](https://www.npmjs.com/package/code-tree-graph) **[code-tree-graph](packages/code-tree-graph/)** - Interactive code dependency graph and file tree components for Fumadocs + Next.js. `DependencyGraph` renders a pan/zoom Mermaid flowchart from full AST analysis, `FileTreeView` a searchable table with export/JSDoc metadata and GitHub deep links, and `TypeTable` collapsible property tables — all from a local TypeScript/JS parser, no external service. `npm install code-tree-graph` · `bun add code-tree-graph` +[](https://www.npmjs.com/package/ask-ai-button) **[ask-ai-button](packages/ask-ai-button/)** - "Ask AI about this page" for docs sites, as a dropdown, a floating action button or an inline panel. The visitor types a question and picks Claude, ChatGPT, Gemini, Perplexity, Grok, Copilot, Le Chat, T3 Chat, Brave, QwkSearch or Cursor; a new tab opens with the page (as a link or as pasted Markdown) and the question pre-filled. Also copies the prompt or the page Markdown, takes custom URL or API providers, and picks up Fumadocs theme colors with no CSS import. +`npm install ask-ai-button` · `bun add ask-ai-button` + [](https://www.npmjs.com/package/create-cloud-db) **[create-cloud-db](packages/create-cloud-db/)** - Interactive CLI that creates a Turso edge database and writes `TURSO_DATABASE_URL` and `TURSO_AUTH_TOKEN` directly into your `.env` file. Handles Turso login, database creation, token generation, and env-file patching in one command. `npx create-cloud-db [db-name]` · `npm install -g create-cloud-db` diff --git a/apps/dev-tools-help-docs/scripts/sync-readme-docs.ts b/apps/dev-tools-help-docs/scripts/sync-readme-docs.ts index 3de4bd51..94df785a 100644 --- a/apps/dev-tools-help-docs/scripts/sync-readme-docs.ts +++ b/apps/dev-tools-help-docs/scripts/sync-readme-docs.ts @@ -98,6 +98,11 @@ const PACKAGES: Entry[] = [ title: 'manage-storage', icon: 'HardDrive', }, + { + dir: 'packages/ask-ai-button', + title: 'ask-ai-button', + icon: 'Sparkles', + }, { dir: 'packages/react-app-store-buttons', title: 'react-app-store-buttons', diff --git a/codecov.yml b/codecov.yml index 479b6475..4c742b73 100644 --- a/codecov.yml +++ b/codecov.yml @@ -79,6 +79,9 @@ flag_management: - name: react-app-store-buttons paths: - packages/react-app-store-buttons/ + - name: ask-ai-button + paths: + - packages/ask-ai-button/ comment: layout: "header, diff, flags, files" diff --git a/packages/ask-ai-button/README.md b/packages/ask-ai-button/README.md new file mode 100644 index 00000000..27a0dfbc --- /dev/null +++ b/packages/ask-ai-button/README.md @@ -0,0 +1,176 @@ +
+
+
+💍One Code to rule them all — and in the cloud compile them.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+