-
Notifications
You must be signed in to change notification settings - Fork 9
Add CLAUDE.md and AGENTS.md
#154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| CLAUDE.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Overview | ||
|
|
||
| Jupyter Server Documents is a JupyterLab extension that provides real-time collaboration (RTC) capabilities by moving document state to the server. The extension consists of: | ||
|
|
||
| - **Python backend** (`jupyter_server_documents/`): Server extension handling WebSocket connections, room management, output processing, and collaboration state | ||
| - **TypeScript frontend** (`src/`): JupyterLab extension providing UI components, document providers, and awareness indicators | ||
| - **Hybrid architecture**: Frontend builds to `lib/` and gets packaged into `jupyter_server_documents/labextension/` | ||
|
|
||
| ## Development Commands | ||
|
|
||
| ### Setup | ||
|
|
||
| ```bash | ||
| # Create development environment | ||
| micromamba env create -f dev-environment.yml | ||
| micromamba activate serverdocs | ||
|
|
||
| # Development installation | ||
| jlpm dev:install | ||
| ``` | ||
|
|
||
| ### Building | ||
|
|
||
| ```bash | ||
| # Build frontend only | ||
| jlpm build | ||
|
|
||
| # Build for production | ||
| jlpm build:prod | ||
|
|
||
| # Clean build artifacts | ||
| jlpm clean:all | ||
| ``` | ||
|
|
||
| ### Development Workflow | ||
|
|
||
| ```bash | ||
| # Watch mode (auto-rebuild frontend on changes) | ||
| jlpm watch | ||
|
|
||
| # Start JupyterLab (in separate terminal) | ||
| jupyter lab | ||
| ``` | ||
|
|
||
| ### Testing | ||
|
|
||
| ```bash | ||
| # Python tests | ||
| pytest -vv -r ap --cov jupyter_server_documents | ||
|
|
||
| # Frontend tests | ||
| jlpm test | ||
|
|
||
| # Integration tests (Playwright) | ||
| cd ui-tests && yarn test | ||
| ``` | ||
|
|
||
| ### Code Quality | ||
|
|
||
| ```bash | ||
| # Lint and format | ||
| jlpm lint | ||
|
|
||
| # Check only (no fixes) | ||
| jlpm lint:check | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Backend Components | ||
|
|
||
| - **`app.py`**: Main server extension (`ServerDocsApp`) - entry point and configuration | ||
| - **`rooms/`**: Y-document room management and file-based collaboration state | ||
| - **`outputs/`**: Notebook output processing and storage optimization | ||
| - **`kernels/`**: Kernel management, execution state, and WebSocket connections | ||
| - **`websockets/`**: WebSocket handlers for real-time collaboration | ||
| - **`handlers.py`**: HTTP API endpoints | ||
|
|
||
| ### Frontend Components | ||
|
|
||
| - **`src/docprovider/`**: Document providers, awareness, and Y.js integration | ||
| - **`src/notebook-factory/`**: Custom notebook model and factory for collaboration | ||
| - **`src/codemirror-binding/`**: CodeMirror editor bindings for real-time editing | ||
| - **`src/executionindicator.tsx`**: UI component showing execution awareness | ||
|
|
||
| ### Key Patterns | ||
|
|
||
| - Uses **Y.js/Yjs** for conflict-free replicated data types (CRDTs) | ||
| - **WebSocket-based** real-time synchronization via `YRoomWebsocket` | ||
| - **Output separation**: Large outputs stored separately from notebook documents | ||
| - **Awareness protocol**: Shows user cursors and execution state across collaborators | ||
| - **Kernel state management**: Handles kernel connections and execution across multiple users | ||
|
|
||
| ## Development Notes | ||
|
|
||
| - After Python changes: restart Jupyter server | ||
| - After frontend changes: run `jlpm build` and refresh browser | ||
| - Frontend builds to `lib/` then packages to `jupyter_server_documents/labextension/` | ||
| - Uses `jlpm` (JupyterLab's yarn) instead of npm/yarn directly | ||
| - Development installation uses `uv` for faster Python package management | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be ok to work with other providers?