@iprep/adapter-utils
v1.1.4
Published
Claude process adapter and utilities for spawning Claude CLI. Runs on your locally installed Claude Code CLI
Downloads
386
Readme
@iprep/adapter-utils
Utilities for spawning Claude Code CLI as a child process and building prompts for iPrep tutors.
Exports
| Export | Description |
| ----------------------- | ----------------------------------------------------------------- |
| ClaudeProcessSpawner | Spawns claude -p one-shot calls; no API key needed |
| buildSystemPrompt | Builds the system prompt for a given tutor from its config files |
| buildChatPrompt | Combines system prompt + conversation history into a full prompt |
| sessionManager | Tracks active Claude sessions (session ID ↔ tutor mapping) |
How It Works
iPrep uses one-shot mode (claude -p "<prompt>"). Each message spawns a fresh claude process — no long-lived process to manage. Authentication is handled by the Claude CLI itself (your subscription login).
import { ClaudeProcessSpawner, buildChatPrompt } from '@iprep/adapter-utils';
const spawner = new ClaudeProcessSpawner();
// Optional: associate with a DB session
await spawner.spawn({ sessionId: 'abc123' });
// Send a prompt and get a response
const prompt = buildChatPrompt(systemPrompt, conversationHistory, userMessage);
const response = await spawner.sendPrompt(prompt);
console.log(response); // Claude's replyPrerequisites
Claude Code CLI must be installed and authenticated:
npm install -g @anthropic-ai/claude-code
claude # opens browser login — authenticate once
claude --versionWhy No API Key?
Claude Code CLI handles authentication using your Claude subscription. iPrep calls claude -p via child_process.spawn — no Anthropic API key, no extra cost beyond your existing subscription.
