Claude Wire banner
pivanov pivanov

Claude Wire

Development community

Description

TypeScript SDK for Claude Code - spawn, stream, and control the CLI programmatically

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

@pivanov/claude-wire

Run [Claude Code](https://claude.ai/download) programmatically from TypeScript.

[![npm](https://img.shields.io/npm/v/@pivanov/claude-wire)](https://www.npmjs.com/package/@pivanov/claude-wire) [![license](https://img.shields.io/npm/l/@pivanov/claude-wire)](./LICENSE)

import { claude } from "@pivanov/claude-wire";

const result = await claude.ask("Fix the bug in main.ts", {
  model: "haiku",
  maxCostUsd: 0.50,
});

console.log(result.text);     // "Fixed the undefined variable..."
console.log(result.costUsd);  // 0.0084

Features

  • Simple API - claude.ask() returns a typed result, claude.stream() yields events
  • Structured JSON - claude.askJson(prompt, schema) with Standard Schema (Zod/Valibot/ArkType) validation
  • Tool control - allow, block, or intercept any tool at runtime
  • Multi-turn sessions - persistent process across multiple prompts
  • Cost tracking - per-request budgets with auto-abort and projection primitives
  • Typed errors - rate-limit, overload, context-length, retry-exhausted as KnownError codes
  • Fully typed - discriminated union events, full IntelliSense
  • Resilient - auto-respawn with backoff, transient error detection, AbortSignal
  • Zero dependencies
  • Subpath exports - /errors, /parser, /testing for narrower imports and bundle-isolated test helpers

Install

bun add @pivanov/claude-wire
# or
npm install @pivanov/claude-wire

Requires [Claude Code CLI](https://claude.ai/download) installed and authenticated. Runs on [Bun](https://bun.sh) >= 1.0 or Node.js >= 22.

**Platform:** POSIX only (macOS, Linux, WSL). Native Windows isn't supported yet -- binary resolution relies on `which` and POSIX path conventions.

This SDK wraps Claude Code's `--output-format stream-json` protocol, which is not officially documented by Anthropic and may change between releases.

CLI

`claude-wire` ships a minimal CLI for shell-driven JSON extraction. Same e