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
Binary file not shown.
@@ -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
|
||||
@@ -0,0 +1,68 @@
|
||||
# language of the project (csharp, python, rust, java, typescript, go, cpp, or ruby)
|
||||
# * For C, use cpp
|
||||
# * For JavaScript, use typescript
|
||||
# Special requirements:
|
||||
# * csharp: Requires the presence of a .sln file in the project folder.
|
||||
language: typescript
|
||||
|
||||
# whether to use the project's gitignore file to ignore files
|
||||
# Added on 2025-04-07
|
||||
ignore_all_files_in_gitignore: true
|
||||
# list of additional paths to ignore
|
||||
# same syntax as gitignore, so you can use * and **
|
||||
# Was previously called `ignored_dirs`, please update your config if you are using that.
|
||||
# Added (renamed) on 2025-04-07
|
||||
ignored_paths: []
|
||||
|
||||
# whether the project is in read-only mode
|
||||
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
|
||||
# Added on 2025-04-18
|
||||
read_only: false
|
||||
|
||||
|
||||
# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
|
||||
# Below is the complete list of tools for convenience.
|
||||
# To make sure you have the latest list of tools, and to view their descriptions,
|
||||
# execute `uv run scripts/print_tool_overview.py`.
|
||||
#
|
||||
# * `activate_project`: Activates a project by name.
|
||||
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
|
||||
# * `create_text_file`: Creates/overwrites a file in the project directory.
|
||||
# * `delete_lines`: Deletes a range of lines within a file.
|
||||
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
|
||||
# * `execute_shell_command`: Executes a shell command.
|
||||
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
|
||||
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
|
||||
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
|
||||
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
|
||||
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
|
||||
# * `initial_instructions`: Gets the initial instructions for the current project.
|
||||
# Should only be used in settings where the system prompt cannot be set,
|
||||
# e.g. in clients you have no control over, like Claude Desktop.
|
||||
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
|
||||
# * `insert_at_line`: Inserts content at a given line in a file.
|
||||
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
|
||||
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
|
||||
# * `list_memories`: Lists memories in Serena's project-specific memory store.
|
||||
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
|
||||
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
|
||||
# * `read_file`: Reads a file within the project directory.
|
||||
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
|
||||
# * `remove_project`: Removes a project from the Serena configuration.
|
||||
# * `replace_lines`: Replaces a range of lines within a file with new content.
|
||||
# * `replace_symbol_body`: Replaces the full definition of a symbol.
|
||||
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
|
||||
# * `search_for_pattern`: Performs a search for a pattern in the project.
|
||||
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
|
||||
# * `switch_modes`: Activates modes by providing a list of their names
|
||||
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
|
||||
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
|
||||
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
|
||||
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
|
||||
excluded_tools: []
|
||||
|
||||
# initial prompt for the project. It will always be given to the LLM upon activating the project
|
||||
# (contrary to the memories, which are loaded on demand).
|
||||
initial_prompt: ""
|
||||
|
||||
project_name: "obsidian-typst-pdf-export"
|
||||
Reference in new issue
Block a user