This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
JSON-DOC is a standardized format for storing structured content in JSON files, inspired by Notion's data model. It supports a wide variety of content types including paragraphs, headings, lists, tables, images, code blocks, and more.
The project consists of:
- A JSON schema specification for the format
- A Python implementation
- A TypeScript implementation (in progress)
- Converters for various formats (HTML, Markdown, etc.)
/schema/: JSON schemas defining the structure of JSON-DOC files/python/: Python implementation/typescript/: TypeScript implementation/docs/: Documentation/examples/: Example files showing the format/tests/: Tests for both implementations
# Set up development environment
cd /Users/onur/tc/JSON-DOC/python
python -m pip install -e .
python -m pip install -e ".[dev]"
# Run tests
cd /Users/onur/tc/JSON-DOC/python
pytest
# Run a specific test
cd /Users/onur/tc/JSON-DOC/python
pytest tests/test_serialization.py -v
# Run validation tests
cd /Users/onur/tc/JSON-DOC/python
python tests/test_validation.py schema
# Run linting
cd /Users/onur/tc/JSON-DOC/python
ruff check .
ruff format .# Set up development environment
cd /Users/onur/tc/JSON-DOC/typescript
npm install
# Build TypeScript
cd /Users/onur/tc/JSON-DOC/typescript
npm run build
# Run tests
cd /Users/onur/tc/JSON-DOC/typescript
npm testThe JSON-DOC schema is defined in JSONSchema format, with the following primary components:
- Page: The top-level container for all content
- Block: Content blocks of various types (paragraph, heading, list item, etc.)
- Rich Text: Text content with formatting (bold, italic, etc.)
- File: External file references (images, etc.)
Each block type has specific schemas and validation rules.
The Python implementation uses Pydantic models for validation and serialization, with:
- Block types implemented as classes inheriting from a base Block class
- Rich text types implemented as classes inheriting from a base RichText class
- Serialization/deserialization functions for loading and saving JSON-DOC files
- Converters for HTML, Markdown, and other formats
Key modules:
jsondoc.models: Pydantic models for JSON-DOCjsondoc.serialize: Functions for loading/saving JSON-DOCjsondoc.validate: Schema validationjsondoc.convert: Conversion between formats
The TypeScript implementation is in progress, following similar architecture to the Python version:
- Type definitions for all JSON-DOC structures
- Functions for loading/saving JSON-DOC files
- Schema validation
- Converters for other formats
- Schema validation tests ensure examples conform to schemas
- Serialization tests ensure round-trip conversion preserves data
- Conversion tests verify correct transformation between formats
- Integration tests for end-to-end workflows
-
The project follows a modular architecture with clear separation between:
- Schema definition
- Model implementation
- Validation
- Serialization
- Conversion
-
The TypeScript implementation should follow the same patterns as the Python implementation, with appropriate adaptations for the TypeScript ecosystem.
-
The core functionality is focused on:
- Loading JSON-DOC files into typed objects
- Validating JSON-DOC files against schemas
- Converting between JSON-DOC and other formats
- don's assume things, if some things are clear, ask for clarification