open-index/open-npm huggingface dataset:
npm package: @justn-hyeok/beautiful-ccg-adapter-base
Description: Shared types, interfaces, error classes, and constants for bccg adapters. Zero runtime dependencies.
Latest version: 0.1.0

# @justn-hyeok/beautiful-ccg-adapter-base

Shared types, interfaces, error classes, and constants for bccg adapters. Zero runtime dependencies.

## Install

```bash
pnpm add @justn-hyeok/beautiful-ccg-adapter-base
```

## Interfaces

### `ModelAdapter`

The core contract every adapter must implement.

```typescript
interface ModelAdapter {
  readonly name: string;
  readonly costTier: CostTier;        // "free" | "low" | "medium" | "high"
  readonly multiModel: boolean;

  run(prompt: string, options?: RunOptions): Promise<AdapterResult>;
  checkAvailability(): Promise<AvailabilityStatus>;
  getSupportedModels?(): Promise<string[]>;
}
```

### `RunOptions`

```typescript
interface RunOptions {
  timeout?: number;
  model?: string;
  cwd?: string;
  signal?: AbortSignal;
  env?: Record<string, string>;
}
```

### `AdapterResult`

```typescript
interface AdapterResult {
  output: string;
  model: string;
  adapter: string;
  latency: number;
  exitCode: number;
  raw?: string;
}
```

## Error Classes

- **`AdapterError`** — single adapter failure (includes `adapter`, `exitCode?`, `stderr?`)
- **`PipelineError`** — pipeline step failure (includes `step` index, `partialResults`)

## Constants

| Constant | Value |
|---|---|
| `BCCG_DEPTH_ENV` | `"BCCG_DEPTH"` |
| `BCCG_HOST_CLI_ENV` | `"BCCG_HOST_CLI"` |
| `MAX_PIPELINE_STEPS` | `10` |
| `MAX_OUTPUT_SIZE` | `102400` (100KB) |

### Default Timeouts

| Adapter | Timeout |
|---|---|
| `claude` | 180s |
| `codex` | 120s |
| `copilot` | 60s |
| `gemini` | 30s |
| `cursor` | 120s |

## CLI Output Schemas

Type definitions for parsing each CLI's JSON output:

- **Copilot** — `CopilotMessageEvent`, `CopilotToolsUpdatedEvent`, `CopilotResultEvent` (JSONL)
- **Codex** — `CodexItemCompletedEvent`, `CodexTurnCompletedEvent` (NDJSON)
- **Gemini** — `GeminiOutput` (single JSON object)
npm package: @justn-hyeok/beautiful-ccg-adapter-claude
Description: bccg adapter for [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code).
Latest version: 0.1.0

# @justn-hyeok/beautiful-ccg-adapter-claude

bccg adapter for [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code).

## Usage

```typescript
import { ClaudeAdapter } from "@justn-hyeok/beautiful-ccg-adapter-claude";

const adapter = new ClaudeAdapter();

// Check availability
const status = await adapter.checkAvailability();

// Run a prompt
const result = await adapter.run("explain this error", {
  timeout: 60_000,
  cwd: "/path/to/project",
});
console.log(result.output);
```

## Properties

| Property | Value |
|---|---|
| `name` | `"claude"` |
| `costTier` | `"high"` |
| `multiModel` | `false` |

## CLI Command

```bash
claude -p <prompt> --output-format json
```

Output is JSONL. The parser extracts content from `assistant.message` events, model from `system` events, and exit code from `result` events.

## Exports

- `ClaudeAdapter` — `ModelAdapter` implementation
- `parseClaudeOutput(stdout: string): ClaudeParsed` — standalone parser
- `ClaudeParsed` — `{ content: string; model: string; exitCode: number }`

## Recursion Safety

When running inside a Claude Code session (detected via `CLAUDECODE` env var), the adapter reports `authenticated: false` to prevent the host from invoking itself through bccg.
npm package: @justn-hyeok/beautiful-ccg-adapter-codex
Description: bccg adapter for [OpenAI Codex CLI](https://github.com/openai/codex).
Latest version: 0.1.0

# @justn-hyeok/beautiful-ccg-adapter-codex

bccg adapter for [OpenAI Codex CLI](https://github.com/openai/codex).

## Usage

```typescript
import { CodexAdapter } from "@justn-hyeok/beautiful-ccg-adapter-codex";

const adapter = new CodexAdapter();
const result = await adapter.run("implement a retry function");
console.log(result.output);
```

## Properties

| Property | Value |
|---|---|
| `name` | `"codex"` |
| `costTier` | `"medium"` |
| `multiModel` | `false` |

## CLI Command

```bash
codex exec <prompt> --json --full-auto
```

Output is NDJSON. The parser collects text from `item.completed` events where `item.type === "agent_message"`, and extracts token counts from `turn.completed` events.

## Exports

- `CodexAdapter` — `ModelAdapter` implementation
- `parseCodexOutput(stdout: string): CodexParsed` — standalone parser
- `CodexParsed` — `{ content, model, exitCode, inputTokens?, outputTokens? }`
npm package: @justn-hyeok/beautiful-ccg-adapter-gemini
Description: bccg adapter for [Google Gemini CLI](https://github.com/google-gemini/gemini-cli).
Latest version: 0.1.0

# @justn-hyeok/beautiful-ccg-adapter-gemini

bccg adapter for [Google Gemini CLI](https://github.com/google-gemini/gemini-cli).

## Usage

```typescript
import { GeminiAdapter } from "@justn-hyeok/beautiful-ccg-adapter-gemini";

const adapter = new GeminiAdapter();
const result = await adapter.run("summarize this document");
console.log(result.output);
```

## Properties

| Property | Value |
|---|---|
| `name` | `"gemini"` |
| `costTier` | `"free"` |
| `multiModel` | `false` |

## CLI Command

```bash
gemini -p <prompt> --output-format json
```

Unlike other adapters, Gemini outputs a **single JSON object** (not JSONL/NDJSON). The parser extracts:
- `response` — the generated text
- `session_id` — session identifier
- Model name from `stats.models` (entry with `roles.main`, or first available)

## Exports

- `GeminiAdapter` — `ModelAdapter` implementation
- `parseGeminiOutput(stdout: string): GeminiParsed` — standalone parser
- `GeminiParsed` — `{ content: string; model: string; sessionId: string }`
npm package: @justn-hyeok/beautiful-ccg-mcp-server
Description: MCP server that exposes bccg capabilities as tools via the [Model Context Protocol](https://modelcontextprotocol.io).
Latest version: 0.1.0

# @justn-hyeok/beautiful-ccg-mcp-server

MCP server that exposes bccg capabilities as tools via the [Model Context Protocol](https://modelcontextprotocol.io).

## Usage

```typescript
import { createServer, startServer } from "@justn-hyeok/beautiful-ccg-mcp-server";
import { Orchestrator, Registry } from "@justn-hyeok/beautiful-ccg-core";

const orchestrator = new Orchestrator(registry);

// Option 1: Start stdio server (blocks)
await startServer(orchestrator);

// Option 2: Create server for custom transport
const server = createServer(orchestrator);
await server.connect(myTransport);
```

## MCP Tools

### `bccg_run`

Run a prompt through multiple AI CLIs with auto-routing.

| Parameter | Type | Required | Description |
|---|---|---|---|
| `prompt` | string | yes | The prompt to run |
| `strategy` | enum | no | `cheap-first`, `quality-first`, `balanced`, `parallel` |
| `adapter` | string | no | Specific adapter name |
| `model` | string | no | Model for intra-CLI routing |

### `bccg_pipeline`

Execute a multi-step CCG pipeline.

| Parameter | Type | Required | Description |
|---|---|---|---|
| `steps` | string | yes | Pipeline DSL (e.g. `gemini:summarize -> claude:review`) |
| `prompt` | string | no | Base prompt for the pipeline |

### `bccg_status`

Check available CLI adapters and their status. No parameters. Returns JSON.

## Recursion Guard

Both `bccg_run` and `bccg_pipeline` are blocked when `BCCG_DEPTH >= 1`, returning an error. This prevents infinite loops when a host CLI invokes bccg which would spawn the same CLI.

## Transport

Uses `StdioServerTransport` from `@modelcontextprotocol/sdk`. Handles `SIGINT` and `SIGTERM` for clean shutdown.

## Exports

- `createServer(orchestrator): McpServer` — create an MCP server instance
- `startServer(orchestrator): Promise<void>` — start stdio server (blocks until signal)