Astro Integration
About 1 min
aitiAstro() — Astro Integration
Integration via Astro's official Integration mechanism (bundled with @aiti-ai/aiti-devtools-vite, no separate package): internally mounts the Vite plugin (bridge/MCP/assets under /aiti/) + injectScript('head-inline') auto-injects the launcher — SSR-rendered HTML is injected too, with no page files to change.
Installation
npm
npm install -D @aiti-ai/aiti-devtools-viteyarn
yarn add -D @aiti-ai/aiti-devtools-vitepnpm
pnpm add -D @aiti-ai/aiti-devtools-vitebun
bun add -D @aiti-ai/aiti-devtools-viteConfiguration
// astro.config.mjs — just one line on the user side
import { defineConfig } from 'astro/config';
import { aitiAstro } from '@aiti-ai/aiti-devtools-vite/astro';
export default defineConfig({
integrations: [aitiAstro({ mcp: { register: false } })],
});Behavior
- Inside the
astro:config:setuphook:updateConfigmounts the aitiDevtools() Vite plugin → bridge/MCP/console same-origin under/aiti/injectScript('head-inline')dynamically creates the launcher script tag (Astro 5 has no head-prepend stage; inline code is the fallback)
- dev-only: returns immediately when
command !== 'dev';astro buildproduction output gets zero injection - Options are identical to the Vite plugin's (prefix/bridgeUrl/aiUrl/name…)
Why Not Attach Astro with the Bare Vite Plugin?
It's possible (SvelteKit integrates exactly that way), but Astro's SSR pages don't go through the Vite transform pipeline, so the bare plugin can't inject into them; the Integration's injectScript is the official mechanism — full-page coverage and upgrade-safe.
Verification
pnpm dev --port 5499
curl -s http://localhost:5499/ | grep -o aiti-launcher # the launcher script should appear in the HTMLRunnable example: examples/aiti-astro-demo (port 5499)