open-index/open-npm huggingface dataset:
npm package: @kb-labs/cli-bin
Description: KB Labs CLI tool for project management and automation
Latest version: 2.5.0

# @kb-labs/cli-bin

Entry point for the `kb` CLI binary.

## Overview

Thin wrapper that wires the `kb` binary to the CLI execution pipeline. Contains the `run()` function used by the bin entry point and delegates to `cli-runtime` + `cli-commands` for all logic.

## Usage

### As binary

```bash
kb --help
kb --version
kb plugins ls
kb health
kb config get ai-review
```

### Programmatic

```typescript
import { run } from '@kb-labs/cli-bin';

const exitCode = await run(['plugins', 'ls', '--json']);
process.exit(exitCode ?? 0);
```

## How It Works

```
bin.ts (process.argv)
    │
    └──► run(argv)
             │
             └──► executeCli(argv)        [cli-runtime/bootstrap]
                      │
                      ├──► parseArgs()    [cli-core]
                      ├──► findCommand()  [cli-commands]
                      └──► command.run()  [plugin handler or built-in]
```

The binary itself has no logic — all command routing, middleware, and formatting happens in `cli-runtime`, `cli-core`, and `cli-commands`.

## License

KB Public License v1.1 © KB Labs
npm package: @kb-labs/cli-contracts
Description: Type definitions and contracts for KB Labs CLI framework (Commands, Context, Presenters, Profiles)
Latest version: 2.5.0

# @kb-labs/cli-contracts

Type definitions and contracts for KB Labs CLI framework.

## Overview

This package contains **pure TypeScript type definitions** with **ZERO runtime dependencies**. It defines the contracts for:

- **Commands** - `CliCommand` interface for implementing CLI commands
- **Context** - `CliContext`, `Profile` interfaces for execution context
- **Presenters** - `Presenter` interface for output handling

## Installation

```bash
pnpm add @kb-labs/cli-contracts
```

## Usage

### Implementing a CLI Command

```typescript
import type { CliCommand } from '@kb-labs/cli-contracts';

export const myCommand: CliCommand = {
  name: 'my-command',
  description: 'Does something useful',

  registerFlags(builder) {
    // Register command-specific flags
  },

  async run(ctx, argv, flags) {
    ctx.presenter.info('Running my command!');
    return 0; // Exit code
  },
};
```

### Using Context

```typescript
import type { CliContext } from '@kb-labs/cli-contracts';

function doSomething(ctx: CliContext) {
  // Access environment
  const env = ctx.env;

  // Log output
  ctx.presenter.info('Hello!');

  // Access config
  const config = ctx.config;
}
```

## Versioning

This package follows a versioned contract pattern (V1, V2, etc.) for API evolution:

```typescript
import type { CliCommandV1 } from '@kb-labs/cli-contracts';
// Future: CliCommandV2, etc.
```

Default exports always point to the latest stable version.

## Architecture

This is a **contracts package** - it contains only type definitions and has zero runtime dependencies. This pattern:

- ✅ Breaks circular dependencies between packages
- ✅ Provides stable API contracts
- ✅ Enables independent versioning
- ✅ Supports gradual migration (V1 → V2)

## License

MIT
npm package: @kb-labs/cli-runtime
Description: CLI runtime — command execution, middleware, formatters, presenters, gateway, lifecycle
Latest version: 2.5.0

# @kb-labs/cli-runtime

CLI execution pipeline — middleware chain, output formatters, and runtime context.

## Overview

Wires together the KB Labs CLI execution pipeline. Provides `createCliRuntime()` which sets up the middleware chain and formatter registry used by every command invocation.

## Quick Start

```typescript
import { createCliRuntime } from '@kb-labs/cli-runtime';

const runtime = await createCliRuntime({
  cwd: process.cwd(),
  env: process.env,
});

// Execute command through middleware chain
const result = await runtime.middleware.execute(ctx, () => handler(ctx, argv, flags));

// Format output
const output = runtime.formatters.format(result, 'json');
```

## Middleware

Commands run through a priority-ordered middleware chain. Lower priority number = runs first.

```typescript
import { createCliRuntime, type CommandMiddleware } from '@kb-labs/cli-runtime';

const authMiddleware: CommandMiddleware = {
  name: 'auth',
  priority: 10,
  async execute(ctx, next) {
    if (!ctx.isAuthenticated) throw new Error('Not authenticated');
    return next();
  },
};

const runtime = await createCliRuntime({
  cwd: process.cwd(),
  env: process.env,
  middlewares: [authMiddleware],
});
```

Built-in middleware (always active): timing, execution limits, error normalization.

## Output Formatters

```typescript
import { createCliRuntime, jsonFormatter, tableFormatter } from '@kb-labs/cli-runtime';

const runtime = await createCliRuntime({
  cwd: process.cwd(),
  env: process.env,
  formatters: [tableFormatter, jsonFormatter], // custom order
});

// Select format at runtime (e.g. from --json flag)
runtime.formatters.format(data, flags.json ? 'json' : 'table');
```

Built-in formatters: `jsonFormatter`, `yamlFormatter`, `tableFormatter`, `markdownFormatter`.

## Runtime Context

```typescript
import { createRuntimeContext } from '@kb-labs/cli-runtime';

const ctx = await createRuntimeContext({
  cwd: process.cwd(),
  env: process.env,
  logger,
  platform,
  limits: {
    middlewareTimeout: 5_000,   // ms
    discoveryTimeout: 10_000,
    lifecycleTimeout: 30_000,
  },
});
```

## License

KB Public License v1.1 © KB Labs
npm package: @kb-labs/commit-core
Description: Core business logic for KB Labs Commit plugin - git analysis, plan generation, and commit application.
Latest version: 0.6.0

# @kb-labs/commit-core

Core business logic for KB Labs Commit plugin - git analysis, plan generation, and commit application.

## Installation

```bash
pnpm add @kb-labs/commit-core
```

## Usage

```typescript
import { ... } from '@kb-labs/commit-core';
```

## API

See TypeScript types for detailed API documentation.

## License

MIT