@maintainer-pro/ai-cli
v0.1.24
Published
Maintainer Pro server SDK: Claude/Cursor CLI, chat HTTP handlers, and optional SQL persistence
Readme
@maintainer-pro/ai-cli
Server SDK for Maintainer Pro. It talks to coding agents — Cursor (agent), Claude (claude), or Antigravity (agy) — and exposes chat HTTP handlers.
Local development: prefer @maintainer-pro/ai-server as a sidecar (a separate Node chat server beside the host app). Do not add chat routes to the host.
Production: use this SDK on a machine that can run a coding-agent CLI, or pass a custom AiProvider. HTTP model backends are out of scope for the default providers. The embed widget (ai-ui.iife.js) must be served as a static file in production — localhost sidecar URLs will not load.
Install
npm install @maintainer-pro/ai-cliRequires Node.js 22+ and one authenticated coding-agent CLI on the machine that runs chat (unless you supply providers).
Quick start
import {
createChatHandler,
createDefaultSystemPrompt,
createMaintainerProStoreFromEnv,
} from "@maintainer-pro/ai-cli";
const db = createMaintainerProStoreFromEnv();
if (!db) {
throw new Error("Set MAINTAINER_PRO_URL and MAINTAINER_PRO_API_KEY");
}
export const handlers = createChatHandler({
systemPrompt: createDefaultSystemPrompt({
productDescription: "Edit source files in the workspace when the user asks.",
}),
workspaceDir: process.env.AI_CLI_WORKSPACE ?? process.cwd(),
db,
});
export const GET = handlers.GET;
export const POST = handlers.POST;Chat history is stored in Maintainer Pro admin. Do not put API keys in the browser — serve the client key from /embed-config.js.
Environment
| Variable | Purpose |
|----------|---------|
| AI_CLI_PROVIDER | auto | claude | cursor | antigravity |
| AI_CLI_COMMAND | Optional binary name or absolute path |
| AI_CLI_WORKSPACE | Folder the agent may edit |
| MAINTAINER_PRO_URL | Admin base URL |
| MAINTAINER_PRO_API_KEY | Server API key from admin |
Related packages
| Package | Role |
|---------|------|
| @maintainer-pro/ai-server | Local Node chat server (sidecar) that uses this SDK |
| @maintainer-pro/ai-ui | Embed widget (ai-ui.iife.js) — sidecar in dev, static file in prod |
Optional SQL persistence lives on @maintainer-pro/ai-cli/db (install better-sqlite3, postgres, or mysql2).
