This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Do what has been asked; nothing more, nothing less.
- NEVER create files unless they're absolutely necessary for achieving your goal.
- ALWAYS prefer editing an existing file to creating a new one.
Pandino is an OSGi-style framework for TypeScript that provides modular architecture, service registry, and dynamic dependency injection. The project follows a monorepo structure with multiple packages managed by pnpm workspaces.
pnpm build- Build all packages recursivelypnpm build:dev- Build all packages in development modepnpm build:pandino- Build only the core pandino packagepnpm build:react-hooks- Build only the React hooks package
pnpm test- Run all tests using Vitestpnpm test:watch- Run tests in watch modepnpm test:coverage- Run tests with coverage reportvitest run --reporter=verbose- Run tests with detailed output- Individual package tests:
cd packages/<package-name> && pnpm test
pnpm dev:example- Start the example applicationpnpm lint- Run oxlint for code lintingpnpm format:write- Format code using oxfmt
- Uses pnpm workspaces with packages in
packages/directory - Node.js >=24 and pnpm >=10 required
- Workspace dependencies use
workspace:*protocol
packages/pandino/- Core framework (service registry, bundles, lifecycle management)packages/react-hooks/- React integration with hooks and componentspackages/decorators/- Decorators for Service Component Runtime (SCR)packages/rollup-bundle-plugin/- Rollup plugin for bundle automationpackages/example/- Example application demonstrating usage
Service Registry Pattern: Central registry where services are registered by interface and discovered dynamically using LDAP-style filters.
Bundle System: Self-contained modules with independent lifecycles. Each bundle has an activator that manages service registration/cleanup.
Service Component Runtime (SCR): Declarative service management using decorators (@Component, @Service, @Reference, @Activate).
Dynamic Dependencies: Services can start in any order - dependencies are resolved automatically when services become available.
framework/- Core framework implementation and bootstrapservices/- Built-in services (service registry, event admin, etc.)bundle/- Bundle management and lifecycletypes/- TypeScript interfaces and type definitionstest/- Test utilities and setup
// 1. Define interface
interface MyService {
doSomething(): void;
}
// 2. Implement with SCR decorators
@Component({ name: 'my.service', immediate: true })
@Service({ interfaces: ['MyService'] })
class MyServiceImpl implements MyService {
@Reference({ interface: 'DependencyService' })
private dependency?: DependencyService;
@Activate
activate(context: ComponentContext): void {
// Initialization logic
}
}export class BundleActivator {
async start(context: BundleContext): Promise<void> {
// Register services, event listeners
}
async stop(context: BundleContext): Promise<void> {
// Cleanup
}
}- Vitest configuration in root and individual packages
- Uses jsdom environment for DOM-related tests
- Coverage reports with @vitest/coverage-v8
- Test files follow
*.test.tspattern
- oxfmt: Code formatting with 2-space indentation, 120 character line width
- oxlint: Fast linting
- TypeScript: Strict type checking with multiple tsconfig files
- Use
reflect-metadatafor decorator support - Peer dependency on
@pandino/decorators
- Vite: Module bundling with TypeScript support
- vite-plugin-dts: Automatic TypeScript declaration generation
- Dual Format: Generates both ESM and CJS outputs
- Type Exports: Proper TypeScript module resolution support
packages/pandino/src/framework/framework.ts- Core framework implementationpackages/pandino/src/services/- Built-in service implementationspackages/pandino/src/types/- Type definitions for the entire system- Root
package.json- Workspace configuration and scripts