diff --git a/.claude.md b/.claude.md deleted file mode 100644 index ed51276..0000000 --- a/.claude.md +++ /dev/null @@ -1,96 +0,0 @@ -# CLAUDE.md - -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. - -## Project Overview - -Atomizer is an Obsidian plugin that breaks down large notes into smaller "atomic" notes using the OpenAI API. The plugin integrates with Obsidian's UI, providing a ribbon icon and command palette entry to process notes. - -## Development Commands - -```bash -# Development mode with watch -npm run dev - -# Production build (runs TypeScript type checking first) -npm run build - -# Version bump (updates manifest.json and versions.json) -npm run version -``` - -## Architecture - -### Core Flow - -1. User triggers atomization via ribbon icon or command palette -2. `AtomizerPlugin` (main.ts:68) validates settings and note content -3. `ConfirmationModal` (modals.ts) prompts user for confirmation -4. `OpenAIService` (openai-service.ts:22) sends content to OpenAI API with system prompt -5. Response is split by `<<<>>>` delimiter into individual atomic notes -6. `NotesManager` (notes-manager.ts:26) saves each note to the configured output folder - -### Key Components - -**AtomizerPlugin (main.ts)** -- Main plugin entry point extending Obsidian's `Plugin` class -- Registers ribbon icon, command, and settings tab -- Orchestrates the atomization workflow in `atomizeNote()` method -- Handles error display and API error responses - -**OpenAIService (openai-service.ts)** -- Manages OpenAI API communication -- Constructs system prompt with YAML frontmatter template including: - - Date/time stamp - - Configurable tags (atomized tag + custom tags) - - Backlink to source note using `[[${sourceFilePath}]]` format -- Uses `<<<>>>` as note separator in prompt and response parsing - -**NotesManager (notes-manager.ts)** -- Handles file system operations for generated notes -- Extracts title from first `# Heading` in each note -- Ensures unique filenames by appending counters when needed -- Creates output folder if it doesn't exist - -**Settings (settings.ts)** -- Defines `AtomizerSettings` interface and `DEFAULT_SETTINGS` -- Provides settings UI with: - - OpenAI API key (required) - - Model selection (gpt-4o-mini or gpt-4o) - - Output folder path - - Toggle for "atomized" tag - - Custom tags (comma-separated) - -### Important Implementation Details - -**Note Delimiter**: The system uses `<<<>>>` as a separator between atomic notes. This is embedded in the OpenAI system prompt and used to split the response. - -**Frontmatter Generation**: Each atomic note includes YAML frontmatter with: -- Date: Human-readable format (ISO with space instead of T) -- Tags: Conditionally includes "atomized" tag + custom tags -- Source: Obsidian wiki-link format `[[filename]]` pointing back to original note - -**Title Extraction**: Notes must start with a level 1 heading (`# Title`) after frontmatter. The title is extracted using regex: `/^#\s+(.+)$/m` - -**Browser API Usage**: OpenAI client uses `dangerouslyAllowBrowser: true` flag since this runs in Obsidian's Electron environment. - -## Build System - -- **Bundler**: esbuild (configured in esbuild.config.mjs) -- **Entry point**: src/main.ts -- **Output**: main.js (root directory) -- **Development**: Watch mode with inline sourcemaps -- **Production**: Minified, no sourcemaps, tree-shaking enabled -- **Target**: ES2018 (CommonJS format) -- **External dependencies**: Obsidian API and all CodeMirror packages are marked external - -## TypeScript Configuration - -- Strict mode enabled with comprehensive type checking -- `noUncheckedIndexedAccess` is enabled for safer array access -- No emit (esbuild handles compilation) -- Inline source maps in development - -## Network Requests - -This plugin makes external API calls to OpenAI (api.openai.com). User content is sent to OpenAI for processing. A notice is displayed to users before making requests.