|  | 
|  | 1 | +# CLAUDE.md | 
|  | 2 | + | 
|  | 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | 
|  | 4 | + | 
|  | 5 | +## Project Overview | 
|  | 6 | + | 
|  | 7 | +This is a JupyterLab extension package that provides default chat commands for Jupyter AI. It consists of: | 
|  | 8 | +- A Python server extension (`jupyter_ai_chat_commands`) | 
|  | 9 | +- A TypeScript frontend extension (`@jupyter-ai/chat-commands`) | 
|  | 10 | + | 
|  | 11 | +The extension currently provides two chat commands: | 
|  | 12 | +- `@file:<path>`: Add a file as an attachment to a message | 
|  | 13 | +- `/refresh-personas`: Reload local personas defined in `.jupyter/personas` | 
|  | 14 | + | 
|  | 15 | +## Development Setup | 
|  | 16 | + | 
|  | 17 | +Initial setup requires micromamba/conda and Node.js 22: | 
|  | 18 | +```bash | 
|  | 19 | +micromamba install uv jupyterlab nodejs=22 | 
|  | 20 | +jlpm | 
|  | 21 | +jlpm dev:install | 
|  | 22 | +``` | 
|  | 23 | + | 
|  | 24 | +The `dev:install` script handles the complete development setup including building the extension, installing Python dependencies, and enabling the server extension. | 
|  | 25 | + | 
|  | 26 | +## Common Commands | 
|  | 27 | + | 
|  | 28 | +### Building | 
|  | 29 | +- `jlpm build` - Build both TypeScript and labextension for development | 
|  | 30 | +- `jlpm build:prod` - Production build with optimization | 
|  | 31 | +- `jlpm build:lib` - Build TypeScript source with source maps | 
|  | 32 | +- `jlpm build:labextension` - Build the JupyterLab extension | 
|  | 33 | + | 
|  | 34 | +### Development Workflow | 
|  | 35 | +- `jlpm watch` - Watch mode for development (runs both TypeScript and labextension watch) | 
|  | 36 | +- `jupyter lab` - Start JupyterLab (run in separate terminal alongside watch) | 
|  | 37 | + | 
|  | 38 | +### Linting and Testing | 
|  | 39 | +- `jlpm lint` - Run all linters (stylelint, prettier, eslint) | 
|  | 40 | +- `jlpm lint:check` - Check without fixing | 
|  | 41 | +- `jlpm test` - Run Jest tests with coverage | 
|  | 42 | +- `pytest -vv -r ap --cov jupyter_ai_chat_commands` - Run Python server tests | 
|  | 43 | + | 
|  | 44 | +### Extension Management | 
|  | 45 | +- `jlpm dev:uninstall` - Remove development extension | 
|  | 46 | +- `jupyter server extension list` - Check server extension status | 
|  | 47 | +- `jupyter labextension list` - Check frontend extension status | 
|  | 48 | + | 
|  | 49 | +## Architecture | 
|  | 50 | + | 
|  | 51 | +### Frontend (TypeScript) | 
|  | 52 | +- Entry point: `src/index.ts` - exports main plugin and chat command plugins | 
|  | 53 | +- Chat commands: `src/chat-command-plugins/` contains individual command implementations | 
|  | 54 | +- Uses JupyterLab 4.x plugin system and `@jupyter/chat` for chat integration | 
|  | 55 | + | 
|  | 56 | +### Backend (Python) | 
|  | 57 | +- Server extension: `jupyter_ai_chat_commands/extension_app.py` | 
|  | 58 | +- Request handlers: `jupyter_ai_chat_commands/handlers.py` | 
|  | 59 | +- Depends on `jupyterlab_chat`, `jupyter_ai_router`, and `jupyter_ai_persona_manager` | 
|  | 60 | + | 
|  | 61 | +### Key Dependencies | 
|  | 62 | +- Frontend: `@jupyter/chat`, `@jupyterlab/application`, Material-UI icons | 
|  | 63 | +- Backend: `jupyter_server`, `jupyterlab_chat`, `jupyter_ai_router` | 
|  | 64 | + | 
|  | 65 | +## Code Style | 
|  | 66 | +- TypeScript: ESLint with TypeScript rules, Prettier formatting, single quotes | 
|  | 67 | +- Interface naming: Must start with 'I' and use PascalCase | 
|  | 68 | +- CSS: Stylelint with standard config | 
|  | 69 | +- Python: No specific linter configured (follows standard Python conventions) | 
|  | 70 | + | 
|  | 71 | +## Testing | 
|  | 72 | +- Frontend: Jest with coverage reporting | 
|  | 73 | +- Backend: Pytest with pytest-asyncio for server testing | 
|  | 74 | +- Integration: Playwright tests in `ui-tests/` (currently skipped) | 
|  | 75 | + | 
|  | 76 | +Note: Integration tests are currently disabled - see recent commit "skip integration tests for now". | 
0 commit comments