open-index/open-npm huggingface dataset:
npm package: @kb-labs/rest-api-app
Description: REST API application for KB Labs, providing HTTP endpoints for plugin functionality
Latest version: 1.6.0

# @kb-labs/rest-api-app

Deployable Fastify application for the KB Labs REST API.

## Overview

Wires together `@kb-labs/rest-api-core`, plugin manifests, and runtime middleware into a production-ready HTTP service. All business capabilities come from discovered plugin manifests — the app itself only provides shared system endpoints and middleware.

## Running Locally

```bash
# From kb-labs-rest-api root
pnpm install
pnpm --filter @kb-labs/rest-api-app dev
# Server starts on http://localhost:5050
```

Build and run compiled output:

```bash
pnpm --filter @kb-labs/rest-api-app build
pnpm --filter @kb-labs/rest-api-app start
```

## Key Components

| Path | Responsibility |
|------|----------------|
| `src/bootstrap.ts` | Fastify server setup, middleware wiring, route registration |
| `src/index.ts` | Entry point — calls `bootstrap` with repo root |
| `src/routes/` | System routes: health, readiness, metrics, registry, OpenAPI, events |
| `src/middleware/` | Security headers, CORS, rate limiting, request envelopes, timeouts |
| `src/plugins/` | Plugin discovery and dynamic route mounting |
| `src/events/` | SSE hub and registry event bridge |

## System Endpoints

- `GET /health` — versioned health snapshot (`kb.health/1`)
- `GET /ready` — readiness probe (`200` or `503`)
- `GET /openapi.json` — aggregated OpenAPI from all mounted plugins
- `GET /api/v1/plugins/registry` — mounted plugin manifest list
- `GET /api/v1/metrics` — Prometheus metrics
- `GET /api/v1/events/registry` — SSE stream for registry and health changes

## Tests

```bash
# From repo root
pnpm test
```

## License

KB Public License v1.1 © KB Labs
npm package: @kb-labs/rest-api-contracts
Description: Shared API contracts for KB Labs REST/CLI/Studio surfaces
Latest version: 1.6.0

# @kb-labs/api-contracts

Shared API contracts for KB Labs REST, CLI, and Studio surfaces.

## Overview

Provides Zod schemas and TypeScript types for consistent API shapes across all KB Labs services.

## API Reference

### Error Codes

- `ErrorCode` — standardized error code enum
- `getErrorCode(error)` — extract error code from an error value

### Response Envelopes

- `SuccessEnvelope<T>` — `{ ok: true, data: T, meta }`
- `ErrorEnvelope` — `{ ok: false, error: { code, message, details?, traceId? }, meta }`

### System Types

- `SystemInfo` — system information shape
- `SystemHealth` — health snapshot shape
- `ReadyState` — readiness probe shape
- `isReady(state)` — type guard for readiness

## Usage

```typescript
import { ErrorCode, SuccessEnvelope, ErrorEnvelope } from '@kb-labs/api-contracts';

const success: SuccessEnvelope<{ id: string }> = {
  ok: true,
  data: { id: '01K...' },
  meta: { requestId: '01K...', durationMs: 12, apiVersion: '1.0.0' },
};

const error: ErrorEnvelope = {
  ok: false,
  error: { code: ErrorCode.INTERNAL_ERROR, message: 'Something went wrong' },
  meta: { requestId: '01K...', durationMs: 5, apiVersion: '1.0.0' },
};
```

## License

KB Public License v1.1 © KB Labs
npm package: @kb-labs/rest-api-core
Description: Core REST API functionality for KB Labs, including request handling and routing
Latest version: 1.6.0

# @kb-labs/rest-api-core

Configuration loader and shared types for the KB Labs REST API runtime.

## Overview

Provides the Zod schema, loader, and environment variable mapping for `@kb-labs/rest-api-app`.
No business logic — pure configuration infrastructure.

## API Reference

- `loadRestApiConfig(options)` — load and validate REST API config from `kb-labs.config.json`
- `restApiConfigSchema` — Zod schema for REST API configuration
- `RestApiConfig` — TypeScript type for validated config

## Configuration

Loaded from `kb-labs.config.json` under the `restApi` key:

```json
{
  "restApi": {
    "port": 5050,
    "basePath": "/api/v1",
    "apiVersion": "1.0.0",
    "cors": {
      "origins": ["http://localhost:3000"],
      "profile": "dev"
    },
    "http2": {
      "enabled": false,
      "allowHTTP1": true
    }
  }
}
```

Environment variables (`KB_REST_*`) override file config — see root [README.md](../../README.md) for full list.

### HTTP/2

Enable HTTP/2 to remove the 6-connection browser limit (important for SSE):

```json
{
  "restApi": {
    "http2": { "enabled": true, "allowHTTP1": true },
    "ssl": { "keyPath": "ssl/server.key", "certPath": "ssl/server.cert" }
  }
}
```

Generate a self-signed cert for local development:

```bash
mkdir -p ssl
openssl req -x509 -newkey rsa:2048 -nodes \
  -keyout ssl/server.key -out ssl/server.cert \
  -days 365 -subj "/CN=localhost"
```

## Usage

```typescript
import { loadRestApiConfig } from '@kb-labs/rest-api-core';

const config = await loadRestApiConfig({ cwd: process.cwd() });
```

## License

KB Public License v1.1 © KB Labs
npm package: @kb-labs/review-contracts
Description: Type definitions and contracts for AI Review plugin
Latest version: 0.5.0

# @kb-labs/review-contracts

Type definitions and contracts for AI Review plugin.

## Overview

This package contains all TypeScript interfaces, types, and contracts used across the AI Review plugin packages.

## Key Types

### Core Types

- **`ReviewFinding`** - Represents a single code review finding
- **`ReviewRule`** - Rule definition (heuristic or LLM)
- **`ReviewPreset`** - Configuration preset (set of rules)
- **`ReviewResult`** - Complete review result with findings and metadata

### Engine Types

- **`EngineType`** - Engine categories (compiler, linter, sast, ast, llm)
- **`HeuristicEngine`** - Engine registry entry mapping tools to types
- **`FindingSeverity`** - Severity levels (blocker, high, medium, low, info)
- **`FindingConfidence`** - Confidence levels (certain, likely, heuristic)

### Review Flow

- **`ReviewRequest`** - Input for review operation
- **`ReviewContext`** - Context for LLM analyzers
- **`ParsedFile`** - File representation with content hash

## Usage

```typescript
import type {
  ReviewFinding,
  ReviewRule,
  ReviewPreset,
  ReviewResult,
} from '@kb-labs/review-contracts';
```

## Design Principles

1. **Unified Contract** - All engines use same interfaces
2. **Engine Type Priority** - Deduplication by engine type, not specific tool
3. **Content-Hash Based** - Deterministic caching keys
4. **Agent Gating** - Confidence + fix + scope fields for agent filtering
npm package: @kb-labs/review-llm
Description: LLM-based analysis for KB Labs AI Review
Latest version: 0.5.0

# @kb-labs/review-llm

LLM-based analysis for KB Labs AI Review

## Installation

```bash
pnpm add @kb-labs/review-llm
```

## Usage

```typescript
import { ... } from '@kb-labs/review-llm';
```

## API

See TypeScript types for detailed API documentation.

## License

MIT
npm package: @kb-labs/studio-app
Description: KB Labs Studio application
Latest version: 0.7.0

# kb-labs-studio-app

KB Labs Studio application — web UI for interacting with KB Labs plugins and products.

## Vision & Purpose

**kb-labs-studio-app** is the main Studio frontend.  
It renders dashboards, plugin widgets, workflow runs, analytics views, and release/audit results powered by the KB Labs REST API and Mind.

### Core Goals

- Provide a unified web UI for all KB Labs products (Audit, Release, Mind, DevLink, AI tools)
- Render plugin-provided Studio widgets (via `@kb-labs/plugin-adapter-studio`)
- Offer dashboards, gallery, and per-product pages on top of `@kb-labs/data-client`

## Package Status

- **Version**: 0.1.0  
- **Stage**: Stable (internal)  
- **Status**: Production Ready for internal use ✅

## Architecture

### Stack

- **Framework**: React 18 + React Router
- **UI**: `@kb-labs/ui-core`, `@kb-labs/ui-react`, Ant Design, Lucide
- **Data**: `@tanstack/react-query` with `@kb-labs/data-client`

### Structure

```
apps/studio/
├── src/
│   ├── App.tsx              # Root React tree and providers
│   ├── router.tsx           # Route definitions
│   ├── modules/             # Feature modules (analytics, dashboard, mind, workflows, settings)
│   ├── components/          # Shared layout and widget host components
│   ├── layouts/             # Layouts (TwoPane, DashboardGrid, etc.)
│   ├── providers/           # Auth, data sources, registry providers
│   ├── registry/            # Studio registry loader and types
│   ├── plugins/             # Plugin discovery and registry integration
│   ├── hooks/               # Custom hooks (polling, widget data)
│   └── styles/              # Theme and CSS variables
└── vite.config.ts           # Vite configuration
```

The app uses a plugin registry to dynamically render Studio widgets exposed by plugins.

## Scripts

From `kb-labs-studio` repo root:

```bash
pnpm install
pnpm --filter kb-labs-studio-app dev      # Start Vite dev server
pnpm --filter kb-labs-studio-app build    # Build for production
pnpm --filter kb-labs-studio-app preview  # Preview built bundle
pnpm --filter kb-labs-studio-app test     # Run Vitest tests
```

## Integration Points

- **REST API**: uses `@kb-labs/data-client` with `VITE_API_BASE_URL` (usually `/api/v1`)
- **Plugins**: consumes Studio manifests via `@kb-labs/plugin-adapter-studio` and registry loader
- **Mind**: uses `@kb-labs/mind-cli` and Mind surfaces for advanced views

## Environment

Key environment variables (via Vite):

- `VITE_API_BASE_URL` — base URL of REST API (defaults to `/api/v1`)
npm package: @kb-labs/workflow-builtins
Description: Built-in workflow handlers (shell, etc.)
Latest version: 1.6.0

# @kb-labs/workflow-builtins

Built-in workflow handlers (shell, etc.)

## Installation

```bash
pnpm add @kb-labs/workflow-builtins
```

## Usage

```typescript
import { ... } from '@kb-labs/workflow-builtins';
```

## API

See TypeScript types for detailed API documentation.

## License

MIT
npm package: @kb-labs/workflow-cli
Description: CLI commands for KB Labs Workflow Daemon - interact with workflow daemon via HTTP API.
Latest version: 1.6.0

# @kb-labs/workflow-cli

CLI commands for KB Labs Workflow Daemon - interact with workflow daemon via HTTP API.

## Installation

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

## Usage

```typescript
import { ... } from '@kb-labs/workflow-cli';
```

## API

See TypeScript types for detailed API documentation.

## License

MIT
npm package: @kb-labs/workflow-daemon
Description: Workflow daemon for KB Labs - standalone service for background job execution
Latest version: 1.6.0

# @kb-labs/workflow-daemon

Workflow daemon for KB Labs - standalone service for background job execution

## Installation

```bash
pnpm add @kb-labs/workflow-daemon
```

## Usage

```typescript
import { ... } from '@kb-labs/workflow-daemon';
```

## API

See TypeScript types for detailed API documentation.

## License

MIT
npm package: @kb-techspace-org/button
Description: > Primary button component
Latest version: 1.7.0

# `Button`

> Primary button component

## Usage

```js
import React, { Component } from 'react';
import Button from '@kb-techspace-org/button';

export default class App extends Component {
  render() {
    return <Button label="Primary Button" />;
  }
}
```