# @principal-ai/codebase-composition

Codebase decomposition into semantic layers for the Principal AI ecosystem.

## Overview

This package decomposes and composes codebases into structured semantic layers, enabling sophisticated analysis through layer-by-layer examination of project architecture.

## Key Features

- **Package Layer** - Discover and analyze package.json, requirements.txt, Cargo.toml, etc.
- **Framework Layer** - Identify React, Vue, Angular, and other frameworks
- **Type Layer** - Extract TypeScript types and interfaces
- **Version Control Layer** - Git integration for ignore patterns and file filtering
- **File Type Layer** - Categorize and analyze different file types
- **Dependency Layer** - Track and analyze project dependencies

## Installation

```bash
bun install @principal-ai/codebase-composition
```

## Usage

```typescript
import { PackageLayerModule, FrameworkLayerModule } from '@principal-ai/codebase-composition';
import { FileTree } from '@principal-ai/repository-abstraction';

// Use layer modules to analyze your codebase
const packageLayer = new PackageLayerModule();
const frameworkLayer = new FrameworkLayerModule();

// Analyze a file tree
const analysis = await packageLayer.analyze(fileTree);
```

## Dependencies

- `@principal-ai/repository-abstraction` - For tree abstractions
- `ignore` - Gitignore pattern matching
- `js-toml` - TOML parsing
- `pip-requirements-js` - Python requirements parsing
- `typescript` - Type extraction

## Development

```bash
# Install dependencies
bun install

# Build the package
bun run build

# Run tests
bun test

# Type checking
bun run typecheck

# Watch mode for development
bun run dev
```

## License

Private package - not for public distribution.
