@frontman-ai/vite

中文文档
2.0.2发布于 2026/10/21Apache-2.0TypeScriptES Module近 30 天下载 4427

Vite integration for Frontman - AI-powered development tools

原始使用文档
文档目录15 节
  1. Installation
  2. Quick Install (Recommended)
  3. CLI Options
  4. Manual Installation
  5. Quick Start
  6. Configuration Options
  7. Understanding the host Option
  8. Supported Frameworks
  9. Architecture
  10. Key Technical Details
  11. Troubleshooting
  12. Frontman UI not loading
  13. Installer shows "manual modification required"
  14. CORS errors in browser console
  15. License

@frontman-ai/vite

Vite integration for Frontman - provides AI-powered development tools for any Vite-based application (React, Vue, Svelte, SolidJS, vanilla, etc.).

Installation

The fastest way to install Frontman is using our CLI installer:

npx @frontman-ai/vite install

# Or with a custom server host
npx @frontman-ai/vite install --server frontman.company.com

The installer will:

  • Detect your Vite project and package manager
  • Install @frontman-ai/vite as a dev dependency
  • Add frontmanPlugin({ host: '...' }) to your vite.config.ts plugins array (or create one)

CLI Options

npx @frontman-ai/vite install [options]

Options:
  --server <host>   Frontman server host (default: api.frontman.sh)
  --prefix <path>   Target directory (default: current directory)
  --dry-run         Preview changes without writing files
  --skip-deps       Skip dependency installation
  --help            Show help message

Manual Installation

If you prefer to set things up manually:

npm install -D @frontman-ai/vite

Then add the plugin to your vite.config.ts:

import { defineConfig } from 'vite';
import { frontmanPlugin } from '@frontman-ai/vite';

export default defineConfig({
  plugins: [
    frontmanPlugin({ host: 'api.frontman.sh' }),
    // ...your other plugins
  ],
});

Quick Start

After running the installer, start your Vite dev server:

npm run dev

Then open your browser to http://localhost:5173/frontman to access the Frontman UI.

With the default hosted setup, Frontman redirects you to api.frontman.sh to sign in with GitHub or Google, then returns you to the local /frontman URL. Before your first prompt, connect a supported AI provider with OAuth or add an API key. If you configured another Frontman server, sign in on that server instead.

Configuration Options

frontmanPlugin({
  host: 'api.frontman.sh',         // Frontman server host (default: env FRONTMAN_HOST or "frontman.local:4000")
  basePath: 'frontman',            // Base path for Frontman routes (default: "frontman")
  isDev: false,                    // Dev mode (default: inferred from host — true unless host is "api.frontman.sh")
  projectRoot: '.',                // Project root directory (default: env PROJECT_ROOT or cwd)
  sourceRoot: '.',                 // Source root for resolving file paths (default: projectRoot)
  clientUrl: 'https://...',        // Custom client bundle URL (default: inferred from isDev)
  clientCssUrl: 'https://...',     // Custom client CSS URL (default: inferred from isDev)
  entrypointUrl: 'http://...',     // Custom entrypoint URL for the API
});

Understanding the host Option

The host option specifies the Frontman server that the client UI will connect to for AI capabilities. When you visit /frontman in your Vite app:

  1. The plugin serves the Frontman UI HTML
  2. The UI loads the client JavaScript with ?host=<your-host>
  3. The client establishes a WebSocket connection to wss://<host>/socket
  4. AI interactions and tool calls flow through this connection

The plugin itself doesn't connect to the Frontman server - it only passes the host to the client.

Examples:

  • Production: host: 'api.frontman.sh' → client connects to wss://api.frontman.sh/socket
  • Local dev: host: 'frontman.local:4000' → client connects to wss://frontman.local:4000/socket

api.frontman.sh is the only production server. Any other host value is treated as dev mode, which changes the default clientUrl to load from a local dev server instead of the production CDN.

Supported Frameworks

This plugin works with any Vite-based project:

  • React (via @vitejs/plugin-react)
  • Vue (via @vitejs/plugin-vue)
  • Svelte (via @sveltejs/vite-plugin-svelte)
  • SolidJS (via vite-plugin-solid)
  • Vanilla JS/TS
  • Any other Vite-compatible framework
VersionStatus
Vite 5.xFully supported
Vite 6.xFully supported

Architecture

Vite Dev Server
│
├─> configureServer hook
│   └─> frontmanPlugin registers Connect middleware
│       └─> Adapts Node.js req/res ↔ Web API Request/Response
│
├─> GET /frontman
│   └─> Serves Frontman UI (HTML + client bundle + CSS)
│
├─> GET /frontman/tools
│   └─> Returns tool definitions (file read, write, search, etc.)
│
├─> POST /frontman/tools/call
│   └─> Executes tool → returns SSE stream with results
│
├─> POST /frontman/resolve-source-location
│   └─> Resolves source maps to original component locations
│
└─> OPTIONS /frontman/*
    └─> CORS preflight handling

Non-frontman routes pass through to Vite's normal dev server handling.

Key Technical Details

Node.js ↔ Web API Adapter

  • Vite's dev server uses Node.js IncomingMessage/ServerResponse
  • Frontman middleware uses Web API Request/Response
  • The plugin adapts between the two, including SSE stream piping

Troubleshooting

Frontman UI not loading

Check 1: Verify the plugin is registered Make sure frontmanPlugin() is in your vite.config.ts plugins array and your dev server is running.

Check 2: Check the URL The default path is http://localhost:5173/frontman. If you changed the basePath option, use that path instead. If Vite is running on a different port, use that port in the URL.

Installer shows "manual modification required"

This happens when the installer can't find a plugins: [ array in your Vite config to inject into. Manually add the import and plugin call as shown in Manual Installation.

CORS errors in browser console

The plugin includes CORS headers for all /frontman/* routes. If you're seeing CORS errors, verify the request is going to the correct Vite dev server URL.

License

Apache-2.0

版本与发布记录

@frontman-ai/vite 共发布 30 个版本,首次发布于 2026/02/16;过去 12 个月发布了 30 个版本。

版本发布日期距今
2.0.2latest2026/10/2125 天前
2.0.12026/09/291 个月前
2.0.02026/09/042 个月前
1.0.62026/08/282 个月前
1.0.52026/08/182 个月前
1.0.42026/08/123 个月前

关于 @frontman-ai/vite 的常见问题

@frontman-ai/vite 是什么?

Vite integration for Frontman - AI-powered development tools

如何安装 @frontman-ai/vite?

在项目目录运行 npm install @frontman-ai/vite,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vite(>=5.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 frontman-vite,可以用 npx frontman-vite 直接运行。

@frontman-ai/vite 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@frontman-ai/vite 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@frontman-ai/vite 可以商用吗?

@frontman-ai/vite 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@frontman-ai/vite 的下载量有多少?

根据 npm 官方下载统计,@frontman-ai/vite 在 2026/10/16 – 2026/11/14 这 30 天内被下载 4,427 次,日均约 148 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@frontman-ai/vite 还在维护吗?

最新版本 2.0.2 发布于 2026/10/21(25 天前);至今共发布 30 个版本,其中过去 12 个月发布了 30 个;首次发布于 2026/02/16。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。