Lula CLAUDE.md
A tool for managing compliance as code in your GitHub repositories. :unicorn:
> Sourced from [defenseunicorns/lula](https://github.com/defenseunicorns/lula) β [Apache-2.0](https://github.com/defenseunicorns/lula/blob/fc99c159365ca5d546aac88527d42614718024e2/CLAUDE.md).
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is **Lula 2** - a Git-friendly compliance control management system built with SvelteKit 5. The application manages security compliance controls (like NIST 800-53) with individual YAML files per control, enabling proper version control and collaboration on compliance documentation. It is designed to be a generic way to manage controls of any sort, split the work of defining them, mapping them and also associating to actual source code & docs for tracking changes over time. Everything is persisted by git and this is intended to be run as an `npx` command against a local git repo.
## Key Development Commands
**Note:** This project uses pnpm as the package manager. All commands below use `pnpm`, but `npm` can also be used.
### Development Server
- `pnpm run dev` - Start frontend development server on port 5173
- `pnpm run dev:api` - Start backend API server on port 3000 (serves from current directory)
- `pnpm run dev:full` - Run both frontend and backend concurrently
### Building and Testing
- `pnpm run build` - Build both SvelteKit app and CLI for production
- `pnpm run build:svelte` - Build only the SvelteKit app
- `pnpm run build:cli` - Build only the CLI tool
- `pnpm run preview` - Preview production build
- `pnpm run test` - Run unit tests (vitest)
- `pnpm run test:unit` - Run unit tests in watch mode
### Code Quality
- `pnpm run lint` - Check code formatting and linting (prettier + eslint)
- `pnpm run format` - Format code with prettier
- `pnpm run format:check` - Check code formatting without modifying files
- `pnpm run check` - Type check with svelte-check
### CLI Tool
- `npx lula2` - Run the CLI tool directly (production)
- `npx lula2 --dir <path> --port <port>` - Start server for specific control set
- `npx lula2 crawl` - Analyze pull requests for compliance impact
- `npx lula2 --version` - Show version
- `tsx index.ts` - Run CLI in development mode
## Architecture
### Frontend (SvelteKit 5 with Runes)
- **Svelte 5** with new runes-based state management (`$state`, `$effect`, `$derived`)
- **TailwindCSS 4** for styling
- **Component structure**: Organized by feature (controls/, forms/, timeline/, ui/)
- **Stores**: Uses Svelte runes instead of traditional stores
- **API layer**: Centralized in `src/lib/api.ts`
### Backend (Express + Node.js)
- **CLI-first approach**: Express server embedded in CLI tool (`index.ts`)
- **File-based storage**: Individual YAML files per control in `controls/<family>/` directories
- **Git integration**: Built-in git history tracking for all files
- **In-memory caching**: Controls and mappings cached for performance
- **WebSocket support**: Real-time updates for control changes
### Data Model
- **Controls**: Individual security controls stored as YAML files
- **Mappings**: Source code mappings to controls (stored in family-based YAML files)
- **Control Sets**: NIST 800-53 Rev 4 example included in `examples/`
### File Structure
```
examples/nist-800-53-v4-moderate/
βββ lula.yaml # Control set metadata
βββ controls/ # Individual control files
β βββ AC/ # Access Control family
β βββ AU/ # Audit family
β βββ ...
βββ mappings/ # Source code mappings
βββ AC/
βββ ...
```
## Key Libraries and Frameworks
- **SvelteKit 5**: Meta-framework with runes
- **Express**: Backend API server
- **YAML**: Control and mapping file format
- **isomorphic-git**: Git operations in Node.js
- **Commander**: CLI interface
- **TailwindCSS**: Utility-first CSS framework
- **Vitest**: Testing framework
- **TypeScript**: Type safety throughout
## Development Patterns
### State Management
- Use Svelte 5 runes (`$state`, `$effect`, `$derived`) instead of traditional stores
- Keep state local to components when possible
- Use the API client (`src/lib/api.ts`) for server communication
### File Operations
- All file operations go through `FileStore` class (`cli/server/infrastructure/fileStore.ts`)
- Git operations handled by `GitHistoryUtil` (`cli/server/infrastructure/gitHistory.ts`)
- Server state management in `cli/server/serverState.ts`
- WebSocket communication in `cli/server/websocketServer.ts`
### Component Architecture
- Prefer composition over inheritance
- Use TypeScript interfaces defined in `src/lib/types.ts`
- Components in `src/components/` organized by feature area
## Testing
- Unit tests with Vitest
- Browser testing available via `@vitest/browser`
- Test files co-located with source (`.test.ts` suffix)
## Git-Friendly Design
- Individual YAML files per control enable meaningful diffs
- Git history integration shows file-level changes over time
- Spreadsheet import with customizable field mapping
- UUID-based mapping system for tracking code-to-control relationships
## NPM Package Details
- **Package name**: `lula2`
- **Binary name**: `lula2`
- **Minimum Node version**: 22.0.0
- **Package type**: ESM module
- **Distribution**: Built CLI in `dist/` directory
Add to your project
Paste into your project's CLAUDE.md or ~/.claude/CLAUDE.md for global rules.
More for TypeScript
Node.js Express API
by @Claude Rules
Building scalable Node.js REST APIs with Express, middleware, and proper async patterns.
Vue.js Composition API
by @Claude Rules
Modern Vue 3 development with Composition API, Pinia, and TypeScript.
Angular Enterprise
by @Claude Rules
Enterprise Angular development with RxJS, NgRx, standalone components, and best practices.
SvelteKit Frontend
by @Claude Rules
Modern SvelteKit development with server-side rendering, stores, and TypeScript.
Tailwind CSS Expert
by @Claude Rules
Expert Tailwind CSS styling with component patterns, dark mode, and design systems.
Mindx CLAUDE.md
by @DotNetAge
δΈδΈͺε―θͺδΈ»θΏεηζ°εεεθΊ«
MCP servers for TypeScript
netdata/netdata#Netdata
ποΈ π βοΈ π π πͺ π§ - Discovery, exploration, reporting and root cause analysis using all observability data, including metrics, logs, systems, containers, processes, and network connections
upstash/context7
π βοΈ - Up-to-date code documentation for LLMs and AI code editors.
microsoft/playwright-mcp
Official Microsoft Playwright MCP server, enabling LLMs to interact with web pages through structured accessibility snapshots
Browse by Tag
Get the Claude Code Starter Pack
Top CLAUDE.md rules for Next.js, TypeScript, Python, Go, and React β free.
