Adds initial Serena setup and memories
Initializes project with core configuration files. Adds memories for code style conventions, codebase structure, development guidelines, project overview, suggested commands, task completion checklist, and tech stack. These memories will help guide development and ensure consistency.
This commit is contained in:
9 files changed
+396
No files matched your search
@@ -0,0 +1,35 @@
|
||||
# Code Style and Conventions
|
||||
|
||||
## TypeScript Configuration
|
||||
- **Strict Type Checking**: noImplicitAny and strictNullChecks enabled
|
||||
- **Module System**: ESNext modules with Node.js resolution
|
||||
- **Target**: ES6 with DOM, ES5-ES7 lib support
|
||||
- **Source Maps**: Inline source maps for development
|
||||
|
||||
## ESLint Rules
|
||||
- **Base**: TypeScript recommended + ESLint recommended
|
||||
- **Unused Variables**: Error level, args ignored
|
||||
- **TypeScript Comments**: @ts-comment allowed
|
||||
- **Empty Functions**: Allowed (common in plugin lifecycle)
|
||||
- **Prototype Builtins**: Disabled check
|
||||
|
||||
## Naming Conventions
|
||||
- **Classes**: PascalCase (e.g., `obsidianTypstPDFExport`)
|
||||
- **Interfaces**: PascalCase with descriptive suffixes (e.g., `obsidianTypstPDFExportSettings`)
|
||||
- **Constants**: SCREAMING_SNAKE_CASE (e.g., `DEFAULT_SETTINGS`)
|
||||
- **Methods/Properties**: camelCase
|
||||
|
||||
## Code Organization
|
||||
- **Single File Structure**: Main plugin functionality in `main.ts`
|
||||
- **Interface Definitions**: Defined alongside implementation
|
||||
- **Settings**: Object-based configuration with defaults
|
||||
- **Plugin Lifecycle**: Standard Obsidian onload/onunload pattern
|
||||
|
||||
## Type Safety
|
||||
- **Settings Interface**: Strongly typed configuration objects
|
||||
- **Plugin Class**: Proper inheritance from Obsidian Plugin base
|
||||
- **API Integration**: Type-safe Obsidian API usage
|
||||
|
||||
## Current Type Issues (To Fix)
|
||||
- Line 14: `settings: MyPluginSettings` should be `settings: obsidianTypstPDFExportSettings`
|
||||
- Template references need updating for proper typing
|
||||
@@ -0,0 +1,49 @@
|
||||
# Codebase Structure
|
||||
|
||||
## Root Directory Layout
|
||||
```
|
||||
obsidian-typst-pdf-export/
|
||||
├── main.ts # Primary plugin entry point
|
||||
├── manifest.json # Plugin metadata for Obsidian
|
||||
├── package.json # Node.js dependencies and scripts
|
||||
├── tsconfig.json # TypeScript configuration
|
||||
├── esbuild.config.mjs # Build system configuration
|
||||
├── .eslintrc # ESLint configuration
|
||||
├── styles.css # Plugin-specific CSS (currently empty)
|
||||
├── PRD.md # Product Requirements Document
|
||||
├── CLAUDE.md # Development instructions for Claude
|
||||
└── reference/ # Example plugin implementations
|
||||
├── obsidian-better-export-pdf-master/
|
||||
└── obsidian_pdf_multi_export-master/
|
||||
```
|
||||
|
||||
## Core Source Files
|
||||
- **main.ts**: Contains all plugin logic including:
|
||||
- `obsidianTypstPDFExport` class (main plugin)
|
||||
- `obsidianTypstPDFExportSettings` interface
|
||||
- `SampleModal` and `SampleSettingTab` classes (template code)
|
||||
- `DEFAULT_SETTINGS` constant
|
||||
|
||||
## Build Output
|
||||
- **main.js**: Compiled and bundled plugin code (generated by esbuild)
|
||||
- Source maps included in development builds
|
||||
|
||||
## Configuration Files
|
||||
- **tsconfig.json**: TypeScript compilation settings
|
||||
- **esbuild.config.mjs**: Build system with development/production modes
|
||||
- **.eslintrc**: Code linting rules
|
||||
- **manifest.json**: Plugin metadata (name, version, compatibility)
|
||||
|
||||
## Task Master Integration
|
||||
- **.taskmaster/**: Task management and project planning
|
||||
- **.claude/**: Claude Code configuration
|
||||
- **.serena/**: Serena analysis and memory storage
|
||||
|
||||
## Reference Materials
|
||||
- **reference/**: Two example Obsidian PDF export plugins for architecture reference
|
||||
- **PRD.md**: Comprehensive product requirements and feature specifications
|
||||
|
||||
## Development Workflow Files
|
||||
- **package-lock.json**: Locked dependency versions
|
||||
- **versions.json**: Plugin version history
|
||||
- **version-bump.mjs**: Automated version management script
|
||||
@@ -0,0 +1,68 @@
|
||||
# Development Guidelines and Design Patterns
|
||||
|
||||
## Obsidian Plugin Architecture Patterns
|
||||
|
||||
### Core Plugin Structure
|
||||
- **Main Class**: Extends `Plugin` from Obsidian API
|
||||
- **Settings Management**: Interface-based configuration with load/save methods
|
||||
- **Lifecycle Methods**: `onload()` for initialization, `onunload()` for cleanup
|
||||
- **Command Registration**: Use `addCommand()` for palette integration
|
||||
- **UI Integration**: Ribbon icons, status bar, settings tab
|
||||
|
||||
### Settings Pattern
|
||||
```typescript
|
||||
interface PluginSettings {
|
||||
// Configuration properties with types
|
||||
}
|
||||
|
||||
const DEFAULT_SETTINGS: PluginSettings = {
|
||||
// Default values
|
||||
}
|
||||
|
||||
// Load/save pattern in plugin class
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
}
|
||||
|
||||
async saveSettings() {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
```
|
||||
|
||||
### Modal and UI Patterns
|
||||
- **Modals**: Extend `Modal` class for dialog interfaces
|
||||
- **Settings Tabs**: Extend `PluginSettingTab` for configuration UI
|
||||
- **DOM Events**: Use `registerDomEvent()` for automatic cleanup
|
||||
- **Intervals**: Use `registerInterval()` for automatic cleanup
|
||||
|
||||
## Design Principles
|
||||
|
||||
### Type Safety First
|
||||
- Use strong TypeScript typing throughout
|
||||
- Define interfaces for all configuration objects
|
||||
- Avoid `any` types - use proper type definitions
|
||||
- Leverage Obsidian API types
|
||||
|
||||
### Plugin Integration Best Practices
|
||||
- Follow Obsidian's plugin lifecycle patterns
|
||||
- Use proper event registration for automatic cleanup
|
||||
- Integrate with command palette and ribbon appropriately
|
||||
- Provide clear user feedback via `Notice` class
|
||||
|
||||
### Error Handling
|
||||
- Graceful degradation when external tools unavailable
|
||||
- Clear user messaging for dependency issues
|
||||
- Proper error boundaries in async operations
|
||||
- Logging for debugging without cluttering user experience
|
||||
|
||||
### Code Organization
|
||||
- Keep main plugin class focused on orchestration
|
||||
- Separate concerns into logical modules
|
||||
- Use composition over inheritance where appropriate
|
||||
- Follow single responsibility principle
|
||||
|
||||
## External Tool Integration Patterns
|
||||
- **Dependency Checking**: Verify external tools before usage
|
||||
- **Process Management**: Spawn external processes safely
|
||||
- **Path Handling**: Cross-platform path resolution
|
||||
- **Error Recovery**: Fallback strategies for tool failures
|
||||
@@ -0,0 +1,24 @@
|
||||
# Project Overview - Obsidian Typst PDF Export Plugin
|
||||
|
||||
## Purpose
|
||||
This is an Obsidian plugin that exports notes to high-quality PDFs using Typst, featuring:
|
||||
- Superior typography through Markdown → Pandoc → Typst → PDF pipeline
|
||||
- Two export modes: Typography-pure and Style-preserving
|
||||
- Standard and single-page PDF formats
|
||||
- CSS style preservation capabilities
|
||||
- Dynamic page height adjustment for single-page exports
|
||||
|
||||
## Current Status
|
||||
The project is in early development, currently based on the Obsidian sample plugin template. The main plugin class and interfaces exist but contain mostly template code that needs to be replaced with Typst PDF export functionality.
|
||||
|
||||
## Key Components
|
||||
- **Plugin Class**: `obsidianTypstPDFExport` extends Obsidian's `Plugin` class
|
||||
- **Settings Interface**: `obsidianTypstPDFExportSettings` for configuration
|
||||
- **Template Components**: SampleModal and SampleSettingTab (need replacement)
|
||||
- **External Dependencies**: Will integrate with Pandoc and Typst tools
|
||||
|
||||
## Development Architecture
|
||||
- Built with TypeScript and esbuild
|
||||
- Follows Obsidian plugin architecture patterns
|
||||
- Uses standard Obsidian API for UI integration
|
||||
- Reference implementations available in `reference/` directory
|
||||
@@ -0,0 +1,67 @@
|
||||
# Suggested Commands for Development
|
||||
|
||||
## Core Development Workflow
|
||||
```bash
|
||||
# Install dependencies (run once after clone)
|
||||
npm install
|
||||
|
||||
# Start development with file watching and auto-compilation
|
||||
npm run dev
|
||||
|
||||
# Production build with type checking
|
||||
npm run build
|
||||
|
||||
# Version bump and manifest update
|
||||
npm run version
|
||||
```
|
||||
|
||||
## Build System Details
|
||||
- **Development**: `npm run dev` runs esbuild with watch mode and inline source maps
|
||||
- **Production**: `npm run build` includes TypeScript type checking and minification
|
||||
- **Entry Point**: `main.ts` compiles to `main.js`
|
||||
|
||||
## Code Quality Commands
|
||||
```bash
|
||||
# Type checking (part of build process)
|
||||
tsc -noEmit -skipLibCheck
|
||||
|
||||
# Linting (manual - not in package.json scripts)
|
||||
npx eslint main.ts
|
||||
|
||||
# Format code (if prettier is used)
|
||||
npx prettier --write main.ts
|
||||
```
|
||||
|
||||
## Darwin-Specific System Commands
|
||||
```bash
|
||||
# File operations
|
||||
ls -la # List files with details
|
||||
find . -name "*.ts" # Find TypeScript files
|
||||
grep -r "pattern" . # Search for patterns
|
||||
|
||||
# Git operations
|
||||
git status # Check working directory status
|
||||
git add . # Stage changes
|
||||
git commit -m "message" # Commit with message
|
||||
|
||||
# Process management
|
||||
ps aux | grep node # Find Node.js processes
|
||||
kill -9 <pid> # Force kill process
|
||||
```
|
||||
|
||||
## Plugin Development Testing
|
||||
- Install plugin in Obsidian vault at `.obsidian/plugins/obsidian-typst-pdf-export/`
|
||||
- Use `npm run dev` for live reloading during development
|
||||
- Restart Obsidian or reload plugin after changes
|
||||
|
||||
## External Tool Management (Future)
|
||||
```bash
|
||||
# Check Pandoc installation
|
||||
pandoc --version
|
||||
|
||||
# Check Typst installation
|
||||
typst --version
|
||||
|
||||
# Install via package managers
|
||||
brew install pandoc typst # macOS Homebrew
|
||||
```
|
||||
@@ -0,0 +1,52 @@
|
||||
# Task Completion Checklist
|
||||
|
||||
## Before Marking Task Complete
|
||||
|
||||
### 1. Code Quality Verification
|
||||
```bash
|
||||
# Run type checking
|
||||
npm run build # Includes tsc -noEmit -skipLibCheck
|
||||
|
||||
# Verify no compilation errors
|
||||
# Check that main.js is generated successfully
|
||||
```
|
||||
|
||||
### 2. Code Style Compliance
|
||||
- Follow existing naming conventions (PascalCase for classes, camelCase for methods)
|
||||
- Ensure proper TypeScript typing throughout
|
||||
- Fix any type inconsistencies (like MyPluginSettings → obsidianTypstPDFExportSettings)
|
||||
- Maintain consistent indentation and formatting
|
||||
|
||||
### 3. Plugin Functionality Testing
|
||||
- Test in actual Obsidian environment
|
||||
- Verify plugin loads without errors
|
||||
- Test core functionality manually
|
||||
- Check command palette integration
|
||||
- Verify settings persistence
|
||||
|
||||
### 4. Integration Verification
|
||||
- Ensure Obsidian API usage follows best practices
|
||||
- Check for proper lifecycle management (onload/onunload)
|
||||
- Verify external tool dependencies are handled gracefully
|
||||
- Test error handling and user feedback
|
||||
|
||||
### 5. Documentation Updates
|
||||
- Update relevant comments in code
|
||||
- Document any new interfaces or significant changes
|
||||
- Keep PRD alignment in mind for feature completeness
|
||||
|
||||
## Development Workflow Steps
|
||||
1. Make code changes
|
||||
2. Run `npm run dev` for live development
|
||||
3. Test in Obsidian environment
|
||||
4. Run `npm run build` to verify production build
|
||||
5. Check for TypeScript errors and resolve
|
||||
6. Verify plugin functionality works as expected
|
||||
7. Mark task complete in Task Master
|
||||
|
||||
## Quality Gates
|
||||
- ✅ No TypeScript compilation errors
|
||||
- ✅ Plugin loads in Obsidian without errors
|
||||
- ✅ Core functionality works as designed
|
||||
- ✅ Code follows established patterns and style
|
||||
- ✅ External dependencies handled appropriately
|
||||
@@ -0,0 +1,33 @@
|
||||
# Tech Stack - Obsidian Typst PDF Export Plugin
|
||||
|
||||
## Core Technologies
|
||||
- **TypeScript 4.7.4**: Primary language with strict type checking
|
||||
- **Node.js 16+**: Runtime environment requirement
|
||||
- **esbuild 0.17.3**: Fast bundler and build system
|
||||
- **Obsidian API**: Plugin framework and UI integration
|
||||
|
||||
## Build System
|
||||
- **esbuild**: Bundling, compilation, and development server
|
||||
- **TypeScript Compiler**: Type checking (tsc -noEmit)
|
||||
- **Source Maps**: Inline source maps for development
|
||||
|
||||
## Code Quality Tools
|
||||
- **ESLint**: Linting with TypeScript-specific rules
|
||||
- **@typescript-eslint**: TypeScript ESLint integration
|
||||
- **Prettier**: Code formatting (via .prettierrc in reference)
|
||||
|
||||
## External Tools (Planned)
|
||||
- **Pandoc**: Markdown to intermediate format conversion
|
||||
- **Typst**: Superior typesetting and PDF generation
|
||||
- **System Dependencies**: Will require external tool management
|
||||
|
||||
## Development Dependencies
|
||||
- obsidian: Latest Obsidian API
|
||||
- @types/node: Node.js type definitions
|
||||
- builtin-modules: Node.js built-in module handling
|
||||
- tslib: TypeScript runtime library
|
||||
|
||||
## Module System
|
||||
- **Format**: CommonJS (cjs) for Obsidian compatibility
|
||||
- **Target**: ES2018 for broad compatibility
|
||||
- **Externals**: Obsidian API and built-in modules excluded from bundle
|
||||
Reference in new issue
Block a user