This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Libro is a JavaScript + Python hybrid monorepo providing a Notebook product solution with AI capabilities. It supports kernel-level extensibility and defines workflows for large models.
# Initial setup (installs dependencies and builds packages)
pnpm bootstrap
# Start development server (docs/demo site)
pnpm run docs
# Build all packages
pnpm run build
# Lint code
pnpm run lint
# Run all tests
pnpm run test
# Run tests for a specific package
pnpm run test:jest --filter=@difizen/libro-core
# Type check
pnpm run tsc
# Create changeset for version management
pnpm run changeset
# Run CI checks (lint, typecheck, coverage)
pnpm run ci:checkLibro uses @difizen/mana-app for dependency injection. Core patterns:
- ManaModule: Modules are created using
ManaModule.create().register(...).dependOn(...) - @singleton / @transient: Class decorators for DI scope
- @inject: Property/constructor injection
- @prop(): Reactive properties with MobX-like behavior
- Contributions: Use
.contribution(Token)to register providers, then inject@inject(Token)to get all contributions
- LibroModule: Main module that registers core services and depends on sub-modules
- LibroService: Manages notebook views/models, tracks active/focus state, emits events
- LibroModel: Notebook model containing cells and metadata
- LibroView: Notebook view component
- LibroCellModule: Cell system with
CellViewContributionandCellModelContributionfor registering cell types
Cells follow a contribution pattern. To add a new cell type:
- Create
CellViewContribution- provides the view component - Create
CellModelContribution- provides factory for the model - Register both in your module
Existing cell types: code-cell, markdown-cell, prompt-cell, sql-cell, raw-cell
- IKernelConnection: Interface for kernel communication
- ExecutableNotebookModel: Extends NotebookModel with kernel connection support
- Kernel connection is managed per notebook instance
| Package | Purpose |
|---|---|
libro-core |
Core notebook functionality, model/view, cell system |
libro-kernel |
Kernel connection management |
libro-jupyter |
Jupyter protocol implementation, integrates cell types |
libro-lab |
Full lab application combining all features |
libro-ai-native |
AI capabilities (completion, chat, error fixing) |
libro-codemirror |
CodeMirror editor integration |
libro-cofine-editor-* |
Advanced editor features (LSP, textmate) |
libro-rendermime |
MIME type rendering for outputs |
libro-output |
Output display components |
- pnpm with workspaces for monorepo management
- nx for task orchestration with caching
- father for building individual packages (ESM output to
es/)
- Uses changesets for version management
- All
@difizen/*packages are linked together (same version) - Run
pnpm run changesetto create version changes
- Create changeset:
pnpm run changeset(or auto-generate for snapshots) - Build:
pnpm run build - For snapshot release:
sh ./scripts/release-snapshot.sh
Follow Angular commit guidelines:
feat(scope): description- new featurefix(scope): description- bug fixchore(scope): description- maintenance
- Node.js 20.x
- pnpm 8.15.6