Initializes Taskmaster AI project
Sets up the core structure and configuration files for the Taskmaster AI project, including agents, commands, configurations, and a project-specific Claude integration guide.
This commit is contained in:
58 files changed
+4979
No files matched your search
@@ -0,0 +1,417 @@
|
||||
# Task Master AI - Agent Integration Guide
|
||||
|
||||
## Essential Commands
|
||||
|
||||
### Core Workflow Commands
|
||||
|
||||
```bash
|
||||
# Project Setup
|
||||
task-master init # Initialize Task Master in current project
|
||||
task-master parse-prd .taskmaster/docs/prd.txt # Generate tasks from PRD document
|
||||
task-master models --setup # Configure AI models interactively
|
||||
|
||||
# Daily Development Workflow
|
||||
task-master list # Show all tasks with status
|
||||
task-master next # Get next available task to work on
|
||||
task-master show <id> # View detailed task information (e.g., task-master show 1.2)
|
||||
task-master set-status --id=<id> --status=done # Mark task complete
|
||||
|
||||
# Task Management
|
||||
task-master add-task --prompt="description" --research # Add new task with AI assistance
|
||||
task-master expand --id=<id> --research --force # Break task into subtasks
|
||||
task-master update-task --id=<id> --prompt="changes" # Update specific task
|
||||
task-master update --from=<id> --prompt="changes" # Update multiple tasks from ID onwards
|
||||
task-master update-subtask --id=<id> --prompt="notes" # Add implementation notes to subtask
|
||||
|
||||
# Analysis & Planning
|
||||
task-master analyze-complexity --research # Analyze task complexity
|
||||
task-master complexity-report # View complexity analysis
|
||||
task-master expand --all --research # Expand all eligible tasks
|
||||
|
||||
# Dependencies & Organization
|
||||
task-master add-dependency --id=<id> --depends-on=<id> # Add task dependency
|
||||
task-master move --from=<id> --to=<id> # Reorganize task hierarchy
|
||||
task-master validate-dependencies # Check for dependency issues
|
||||
task-master generate # Update task markdown files (usually auto-called)
|
||||
```
|
||||
|
||||
## Key Files & Project Structure
|
||||
|
||||
### Core Files
|
||||
|
||||
- `.taskmaster/tasks/tasks.json` - Main task data file (auto-managed)
|
||||
- `.taskmaster/config.json` - AI model configuration (use `task-master models` to modify)
|
||||
- `.taskmaster/docs/prd.txt` - Product Requirements Document for parsing
|
||||
- `.taskmaster/tasks/*.txt` - Individual task files (auto-generated from tasks.json)
|
||||
- `.env` - API keys for CLI usage
|
||||
|
||||
### Claude Code Integration Files
|
||||
|
||||
- `CLAUDE.md` - Auto-loaded context for Claude Code (this file)
|
||||
- `.claude/settings.json` - Claude Code tool allowlist and preferences
|
||||
- `.claude/commands/` - Custom slash commands for repeated workflows
|
||||
- `.mcp.json` - MCP server configuration (project-specific)
|
||||
|
||||
### Directory Structure
|
||||
|
||||
```
|
||||
project/
|
||||
├── .taskmaster/
|
||||
│ ├── tasks/ # Task files directory
|
||||
│ │ ├── tasks.json # Main task database
|
||||
│ │ ├── task-1.md # Individual task files
|
||||
│ │ └── task-2.md
|
||||
│ ├── docs/ # Documentation directory
|
||||
│ │ ├── prd.txt # Product requirements
|
||||
│ ├── reports/ # Analysis reports directory
|
||||
│ │ └── task-complexity-report.json
|
||||
│ ├── templates/ # Template files
|
||||
│ │ └── example_prd.txt # Example PRD template
|
||||
│ └── config.json # AI models & settings
|
||||
├── .claude/
|
||||
│ ├── settings.json # Claude Code configuration
|
||||
│ └── commands/ # Custom slash commands
|
||||
├── .env # API keys
|
||||
├── .mcp.json # MCP configuration
|
||||
└── CLAUDE.md # This file - auto-loaded by Claude Code
|
||||
```
|
||||
|
||||
## MCP Integration
|
||||
|
||||
Task Master provides an MCP server that Claude Code can connect to. Configure in `.mcp.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"mcpServers": {
|
||||
"task-master-ai": {
|
||||
"command": "npx",
|
||||
"args": ["-y", "--package=task-master-ai", "task-master-ai"],
|
||||
"env": {
|
||||
"ANTHROPIC_API_KEY": "your_key_here",
|
||||
"PERPLEXITY_API_KEY": "your_key_here",
|
||||
"OPENAI_API_KEY": "OPENAI_API_KEY_HERE",
|
||||
"GOOGLE_API_KEY": "GOOGLE_API_KEY_HERE",
|
||||
"XAI_API_KEY": "XAI_API_KEY_HERE",
|
||||
"OPENROUTER_API_KEY": "OPENROUTER_API_KEY_HERE",
|
||||
"MISTRAL_API_KEY": "MISTRAL_API_KEY_HERE",
|
||||
"AZURE_OPENAI_API_KEY": "AZURE_OPENAI_API_KEY_HERE",
|
||||
"OLLAMA_API_KEY": "OLLAMA_API_KEY_HERE"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Essential MCP Tools
|
||||
|
||||
```javascript
|
||||
help; // = shows available taskmaster commands
|
||||
// Project setup
|
||||
initialize_project; // = task-master init
|
||||
parse_prd; // = task-master parse-prd
|
||||
|
||||
// Daily workflow
|
||||
get_tasks; // = task-master list
|
||||
next_task; // = task-master next
|
||||
get_task; // = task-master show <id>
|
||||
set_task_status; // = task-master set-status
|
||||
|
||||
// Task management
|
||||
add_task; // = task-master add-task
|
||||
expand_task; // = task-master expand
|
||||
update_task; // = task-master update-task
|
||||
update_subtask; // = task-master update-subtask
|
||||
update; // = task-master update
|
||||
|
||||
// Analysis
|
||||
analyze_project_complexity; // = task-master analyze-complexity
|
||||
complexity_report; // = task-master complexity-report
|
||||
```
|
||||
|
||||
## Claude Code Workflow Integration
|
||||
|
||||
### Standard Development Workflow
|
||||
|
||||
#### 1. Project Initialization
|
||||
|
||||
```bash
|
||||
# Initialize Task Master
|
||||
task-master init
|
||||
|
||||
# Create or obtain PRD, then parse it
|
||||
task-master parse-prd .taskmaster/docs/prd.txt
|
||||
|
||||
# Analyze complexity and expand tasks
|
||||
task-master analyze-complexity --research
|
||||
task-master expand --all --research
|
||||
```
|
||||
|
||||
If tasks already exist, another PRD can be parsed (with new information only!) using parse-prd with --append flag. This will add the generated tasks to the existing list of tasks..
|
||||
|
||||
#### 2. Daily Development Loop
|
||||
|
||||
```bash
|
||||
# Start each session
|
||||
task-master next # Find next available task
|
||||
task-master show <id> # Review task details
|
||||
|
||||
# During implementation, check in code context into the tasks and subtasks
|
||||
task-master update-subtask --id=<id> --prompt="implementation notes..."
|
||||
|
||||
# Complete tasks
|
||||
task-master set-status --id=<id> --status=done
|
||||
```
|
||||
|
||||
#### 3. Multi-Claude Workflows
|
||||
|
||||
For complex projects, use multiple Claude Code sessions:
|
||||
|
||||
```bash
|
||||
# Terminal 1: Main implementation
|
||||
cd project && claude
|
||||
|
||||
# Terminal 2: Testing and validation
|
||||
cd project-test-worktree && claude
|
||||
|
||||
# Terminal 3: Documentation updates
|
||||
cd project-docs-worktree && claude
|
||||
```
|
||||
|
||||
### Custom Slash Commands
|
||||
|
||||
Create `.claude/commands/taskmaster-next.md`:
|
||||
|
||||
```markdown
|
||||
Find the next available Task Master task and show its details.
|
||||
|
||||
Steps:
|
||||
|
||||
1. Run `task-master next` to get the next task
|
||||
2. If a task is available, run `task-master show <id>` for full details
|
||||
3. Provide a summary of what needs to be implemented
|
||||
4. Suggest the first implementation step
|
||||
```
|
||||
|
||||
Create `.claude/commands/taskmaster-complete.md`:
|
||||
|
||||
```markdown
|
||||
Complete a Task Master task: $ARGUMENTS
|
||||
|
||||
Steps:
|
||||
|
||||
1. Review the current task with `task-master show $ARGUMENTS`
|
||||
2. Verify all implementation is complete
|
||||
3. Run any tests related to this task
|
||||
4. Mark as complete: `task-master set-status --id=$ARGUMENTS --status=done`
|
||||
5. Show the next available task with `task-master next`
|
||||
```
|
||||
|
||||
## Tool Allowlist Recommendations
|
||||
|
||||
Add to `.claude/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"allowedTools": [
|
||||
"Edit",
|
||||
"Bash(task-master *)",
|
||||
"Bash(git commit:*)",
|
||||
"Bash(git add:*)",
|
||||
"Bash(npm run *)",
|
||||
"mcp__task_master_ai__*"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration & Setup
|
||||
|
||||
### API Keys Required
|
||||
|
||||
At least **one** of these API keys must be configured:
|
||||
|
||||
- `ANTHROPIC_API_KEY` (Claude models) - **Recommended**
|
||||
- `PERPLEXITY_API_KEY` (Research features) - **Highly recommended**
|
||||
- `OPENAI_API_KEY` (GPT models)
|
||||
- `GOOGLE_API_KEY` (Gemini models)
|
||||
- `MISTRAL_API_KEY` (Mistral models)
|
||||
- `OPENROUTER_API_KEY` (Multiple models)
|
||||
- `XAI_API_KEY` (Grok models)
|
||||
|
||||
An API key is required for any provider used across any of the 3 roles defined in the `models` command.
|
||||
|
||||
### Model Configuration
|
||||
|
||||
```bash
|
||||
# Interactive setup (recommended)
|
||||
task-master models --setup
|
||||
|
||||
# Set specific models
|
||||
task-master models --set-main claude-3-5-sonnet-20241022
|
||||
task-master models --set-research perplexity-llama-3.1-sonar-large-128k-online
|
||||
task-master models --set-fallback gpt-4o-mini
|
||||
```
|
||||
|
||||
## Task Structure & IDs
|
||||
|
||||
### Task ID Format
|
||||
|
||||
- Main tasks: `1`, `2`, `3`, etc.
|
||||
- Subtasks: `1.1`, `1.2`, `2.1`, etc.
|
||||
- Sub-subtasks: `1.1.1`, `1.1.2`, etc.
|
||||
|
||||
### Task Status Values
|
||||
|
||||
- `pending` - Ready to work on
|
||||
- `in-progress` - Currently being worked on
|
||||
- `done` - Completed and verified
|
||||
- `deferred` - Postponed
|
||||
- `cancelled` - No longer needed
|
||||
- `blocked` - Waiting on external factors
|
||||
|
||||
### Task Fields
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "1.2",
|
||||
"title": "Implement user authentication",
|
||||
"description": "Set up JWT-based auth system",
|
||||
"status": "pending",
|
||||
"priority": "high",
|
||||
"dependencies": ["1.1"],
|
||||
"details": "Use bcrypt for hashing, JWT for tokens...",
|
||||
"testStrategy": "Unit tests for auth functions, integration tests for login flow",
|
||||
"subtasks": []
|
||||
}
|
||||
```
|
||||
|
||||
## Claude Code Best Practices with Task Master
|
||||
|
||||
### Context Management
|
||||
|
||||
- Use `/clear` between different tasks to maintain focus
|
||||
- This CLAUDE.md file is automatically loaded for context
|
||||
- Use `task-master show <id>` to pull specific task context when needed
|
||||
|
||||
### Iterative Implementation
|
||||
|
||||
1. `task-master show <subtask-id>` - Understand requirements
|
||||
2. Explore codebase and plan implementation
|
||||
3. `task-master update-subtask --id=<id> --prompt="detailed plan"` - Log plan
|
||||
4. `task-master set-status --id=<id> --status=in-progress` - Start work
|
||||
5. Implement code following logged plan
|
||||
6. `task-master update-subtask --id=<id> --prompt="what worked/didn't work"` - Log progress
|
||||
7. `task-master set-status --id=<id> --status=done` - Complete task
|
||||
|
||||
### Complex Workflows with Checklists
|
||||
|
||||
For large migrations or multi-step processes:
|
||||
|
||||
1. Create a markdown PRD file describing the new changes: `touch task-migration-checklist.md` (prds can be .txt or .md)
|
||||
2. Use Taskmaster to parse the new prd with `task-master parse-prd --append` (also available in MCP)
|
||||
3. Use Taskmaster to expand the newly generated tasks into subtasks. Consdier using `analyze-complexity` with the correct --to and --from IDs (the new ids) to identify the ideal subtask amounts for each task. Then expand them.
|
||||
4. Work through items systematically, checking them off as completed
|
||||
5. Use `task-master update-subtask` to log progress on each task/subtask and/or updating/researching them before/during implementation if getting stuck
|
||||
|
||||
### Git Integration
|
||||
|
||||
Task Master works well with `gh` CLI:
|
||||
|
||||
```bash
|
||||
# Create PR for completed task
|
||||
gh pr create --title "Complete task 1.2: User authentication" --body "Implements JWT auth system as specified in task 1.2"
|
||||
|
||||
# Reference task in commits
|
||||
git commit -m "feat: implement JWT auth (task 1.2)"
|
||||
```
|
||||
|
||||
### Parallel Development with Git Worktrees
|
||||
|
||||
```bash
|
||||
# Create worktrees for parallel task development
|
||||
git worktree add ../project-auth feature/auth-system
|
||||
git worktree add ../project-api feature/api-refactor
|
||||
|
||||
# Run Claude Code in each worktree
|
||||
cd ../project-auth && claude # Terminal 1: Auth work
|
||||
cd ../project-api && claude # Terminal 2: API work
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### AI Commands Failing
|
||||
|
||||
```bash
|
||||
# Check API keys are configured
|
||||
cat .env # For CLI usage
|
||||
|
||||
# Verify model configuration
|
||||
task-master models
|
||||
|
||||
# Test with different model
|
||||
task-master models --set-fallback gpt-4o-mini
|
||||
```
|
||||
|
||||
### MCP Connection Issues
|
||||
|
||||
- Check `.mcp.json` configuration
|
||||
- Verify Node.js installation
|
||||
- Use `--mcp-debug` flag when starting Claude Code
|
||||
- Use CLI as fallback if MCP unavailable
|
||||
|
||||
### Task File Sync Issues
|
||||
|
||||
```bash
|
||||
# Regenerate task files from tasks.json
|
||||
task-master generate
|
||||
|
||||
# Fix dependency issues
|
||||
task-master fix-dependencies
|
||||
```
|
||||
|
||||
DO NOT RE-INITIALIZE. That will not do anything beyond re-adding the same Taskmaster core files.
|
||||
|
||||
## Important Notes
|
||||
|
||||
### AI-Powered Operations
|
||||
|
||||
These commands make AI calls and may take up to a minute:
|
||||
|
||||
- `parse_prd` / `task-master parse-prd`
|
||||
- `analyze_project_complexity` / `task-master analyze-complexity`
|
||||
- `expand_task` / `task-master expand`
|
||||
- `expand_all` / `task-master expand --all`
|
||||
- `add_task` / `task-master add-task`
|
||||
- `update` / `task-master update`
|
||||
- `update_task` / `task-master update-task`
|
||||
- `update_subtask` / `task-master update-subtask`
|
||||
|
||||
### File Management
|
||||
|
||||
- Never manually edit `tasks.json` - use commands instead
|
||||
- Never manually edit `.taskmaster/config.json` - use `task-master models`
|
||||
- Task markdown files in `tasks/` are auto-generated
|
||||
- Run `task-master generate` after manual changes to tasks.json
|
||||
|
||||
### Claude Code Session Management
|
||||
|
||||
- Use `/clear` frequently to maintain focused context
|
||||
- Create custom slash commands for repeated Task Master workflows
|
||||
- Configure tool allowlist to streamline permissions
|
||||
- Use headless mode for automation: `claude -p "task-master next"`
|
||||
|
||||
### Multi-Task Updates
|
||||
|
||||
- Use `update --from=<id>` to update multiple future tasks
|
||||
- Use `update-task --id=<id>` for single task updates
|
||||
- Use `update-subtask --id=<id>` for implementation logging
|
||||
|
||||
### Research Mode
|
||||
|
||||
- Add `--research` flag for research-based AI enhancement
|
||||
- Requires a research model API key like Perplexity (`PERPLEXITY_API_KEY`) in environment
|
||||
- Provides more informed task creation and updates
|
||||
- Recommended for complex technical tasks
|
||||
|
||||
---
|
||||
|
||||
_This guide ensures Claude Code has immediate access to Task Master's essential functionality for agentic development workflows._
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"models": {
|
||||
"main": {
|
||||
"provider": "claude-code",
|
||||
"modelId": "sonnet",
|
||||
"maxTokens": 64000,
|
||||
"temperature": 0.2
|
||||
},
|
||||
"research": {
|
||||
"provider": "claude-code",
|
||||
"modelId": "opus",
|
||||
"maxTokens": 32000,
|
||||
"temperature": 0.1
|
||||
},
|
||||
"fallback": {
|
||||
"provider": "claude-code",
|
||||
"modelId": "sonnet",
|
||||
"maxTokens": 64000,
|
||||
"temperature": 0.2
|
||||
}
|
||||
},
|
||||
"global": {
|
||||
"logLevel": "info",
|
||||
"debug": false,
|
||||
"defaultNumTasks": 10,
|
||||
"defaultSubtasks": 5,
|
||||
"defaultPriority": "medium",
|
||||
"projectName": "Taskmaster",
|
||||
"ollamaBaseURL": "http://localhost:11434/api",
|
||||
"bedrockBaseURL": "https://bedrock.us-east-1.amazonaws.com",
|
||||
"responseLanguage": "English",
|
||||
"defaultTag": "master",
|
||||
"azureOpenaiBaseURL": "https://your-endpoint.openai.azure.com/",
|
||||
"userId": "1234567890"
|
||||
},
|
||||
"claudeCode": {}
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
# Product Requirements Document: Obsidian Typst PDF Export
|
||||
|
||||
## Executive Summary
|
||||
|
||||
**Product Name:** Obsidian Typst PDF Export
|
||||
**Version:** 1.0.0
|
||||
**Goal:** Create an Obsidian plugin that exports notes to aesthetically superior PDFs using Typst, with a unique single-page PDF option that dynamically adjusts page height to content.
|
||||
|
||||
## Problem Statement
|
||||
|
||||
Current PDF export solutions in Obsidian have limitations:
|
||||
- Standard PDF exports lack aesthetic appeal and typography control
|
||||
- Embedded images and PDFs format poorly
|
||||
- No option for continuous single-page PDFs that adapt to content length
|
||||
- Limited typography and layout customization
|
||||
- Plugin-specific CSS styles are often lost in exports
|
||||
|
||||
## Solution Overview
|
||||
|
||||
A plugin that leverages Typst's superior typesetting capabilities through a Markdown → Pandoc → Typst → PDF pipeline, offering both standard pagination and innovative single-page exports, with optional CSS style preservation.
|
||||
|
||||
## Core Features
|
||||
|
||||
### 1. Export Modes
|
||||
|
||||
#### 1.1 Typography-Pure Export (Default)
|
||||
- **Pipeline:** Markdown → Pandoc → Typst → PDF
|
||||
- **Benefits:** Superior typography, consistent formatting, academic quality
|
||||
- **Use Cases:** Papers, documentation, books, reports
|
||||
|
||||
#### 1.2 Style-Preserving Export
|
||||
- **Pipeline:** Markdown → HTML+CSS → Typst-enhanced → PDF
|
||||
- **Benefits:** Maintains Obsidian theme and plugin styles
|
||||
- **Use Cases:** Notes with custom styling, plugin-rendered content
|
||||
|
||||
### 2. Export Formats
|
||||
|
||||
#### 2.1 Standard PDF Export
|
||||
- Traditional paginated PDFs
|
||||
- Page sizes: A4, A5, Letter, Legal, Custom
|
||||
- Portrait/Landscape orientation
|
||||
- Configurable margins and headers/footers
|
||||
|
||||
#### 2.2 Single-Page PDF Export
|
||||
- Continuous PDF with dynamic height
|
||||
- No page breaks - content flows continuously
|
||||
- Ideal for web viewing and documentation
|
||||
- Implementation using Typst's `height: auto` feature
|
||||
|
||||
### 3. Conversion Pipeline
|
||||
|
||||
```
|
||||
Obsidian Note
|
||||
↓
|
||||
[Preprocess Obsidian Syntax]
|
||||
↓
|
||||
[Extract Frontmatter & Metadata]
|
||||
↓
|
||||
[Typography Mode] ←→ [Style Mode]
|
||||
↓ ↓
|
||||
[Pandoc → Typst] [Extract CSS]
|
||||
↓ ↓
|
||||
[Apply Template] [Map to Typst]
|
||||
↓ ↓
|
||||
└──────────┬──────────┘
|
||||
↓
|
||||
[Generate PDF]
|
||||
↓
|
||||
[Post-process]
|
||||
```
|
||||
|
||||
## Technical Architecture
|
||||
|
||||
### Directory Structure
|
||||
|
||||
```
|
||||
src/
|
||||
├── converters/
|
||||
│ ├── markdown-preprocessor.ts # Obsidian syntax handling
|
||||
│ ├── css-extractor.ts # Capture Obsidian styles
|
||||
│ ├── html-renderer.ts # HTML+CSS rendering
|
||||
│ ├── pandoc-typst.ts # Pandoc-Typst conversion
|
||||
│ └── css-to-typst-mapper.ts # Style mapping
|
||||
├── exporters/
|
||||
│ ├── standard-exporter.ts # Regular pagination
|
||||
│ ├── single-page-exporter.ts # Dynamic height
|
||||
│ └── batch-exporter.ts # Folder/vault export
|
||||
├── templates/
|
||||
│ ├── default.typ # Standard template
|
||||
│ ├── article.typ # Academic article
|
||||
│ ├── report.typ # Business report
|
||||
│ └── single-page.typ # Continuous page
|
||||
├── ui/
|
||||
│ ├── export-modal.ts # Export configuration
|
||||
│ ├── settings-tab.ts # Plugin settings
|
||||
│ └── progress-indicator.ts # Export progress
|
||||
├── utils/
|
||||
│ ├── dependency-checker.ts # Verify Pandoc/Typst
|
||||
│ ├── file-manager.ts # Output handling
|
||||
│ └── error-handler.ts # User feedback
|
||||
└── main.ts # Plugin entry point
|
||||
```
|
||||
|
||||
### Key Components
|
||||
|
||||
#### Markdown Preprocessor
|
||||
- Convert wikilinks `[[note]]` to standard markdown links
|
||||
- Handle Obsidian embeds `![[image.png]]` and `![[note.md]]`
|
||||
- Process callouts and custom code blocks
|
||||
- Preserve frontmatter for template variables
|
||||
|
||||
#### CSS Extractor
|
||||
```typescript
|
||||
function getAllStyles(): string[] {
|
||||
const cssTexts: string[] = [];
|
||||
Array.from(document.styleSheets).forEach((sheet) => {
|
||||
Array.from(sheet.cssRules).forEach((rule) => {
|
||||
cssTexts.push(rule.cssText);
|
||||
});
|
||||
});
|
||||
return cssTexts;
|
||||
}
|
||||
```
|
||||
|
||||
#### Pandoc-Typst Converter
|
||||
```typescript
|
||||
async function convertToTypst(markdown: string, config: ExportConfig) {
|
||||
const args = [
|
||||
'input.md',
|
||||
'-o', 'output.pdf',
|
||||
'--pdf-engine=typst',
|
||||
'-V', `template=${config.template}`,
|
||||
...config.variables.map(([k, v]) => ['-V', `${k}=${v}`]).flat()
|
||||
];
|
||||
return await execPandoc(args);
|
||||
}
|
||||
```
|
||||
|
||||
#### Single-Page Template
|
||||
```typst
|
||||
#set page(
|
||||
paper: "a4",
|
||||
height: auto, // Dynamic height
|
||||
margin: (x: 2cm, y: 2cm),
|
||||
)
|
||||
|
||||
#set text(
|
||||
font: $font$,
|
||||
size: $fontSize$,
|
||||
)
|
||||
|
||||
#set pagebreak(weak: true) // No page breaks
|
||||
|
||||
$body$
|
||||
```
|
||||
|
||||
## User Experience
|
||||
|
||||
### Export Workflow
|
||||
|
||||
1. **Initiate Export**
|
||||
- Right-click on note/folder → "Export to Typst PDF"
|
||||
- Command palette → "Typst PDF: Export current note"
|
||||
- Ribbon icon for quick export
|
||||
|
||||
2. **Configure Export**
|
||||
- Select export mode (Typography/Style-preserving)
|
||||
- Choose format (Standard/Single-page)
|
||||
- Pick template (Default/Article/Report/Custom)
|
||||
- Set output location
|
||||
|
||||
3. **Process**
|
||||
- Progress indicator shows conversion steps
|
||||
- Cancel option available
|
||||
- Error messages if dependencies missing
|
||||
|
||||
4. **Complete**
|
||||
- PDF opens automatically (configurable)
|
||||
- Success notification with file location
|
||||
- Recent exports in status bar
|
||||
|
||||
### Settings Interface
|
||||
|
||||
```typescript
|
||||
interface PluginSettings {
|
||||
// Paths
|
||||
pandocPath: string; // Path to Pandoc executable
|
||||
typstPath: string; // Path to Typst executable
|
||||
outputFolder: string; // Default export location
|
||||
|
||||
// Defaults
|
||||
defaultTemplate: string; // Template name
|
||||
defaultFormat: 'standard' | 'single-page';
|
||||
defaultExportMode: 'typography' | 'style-preserving';
|
||||
|
||||
// Typography
|
||||
defaultFont: string; // Main text font
|
||||
defaultFontSize: number; // In points
|
||||
mathFont: string; // Math equations font
|
||||
codeFont: string; // Code blocks font
|
||||
|
||||
// Page Setup
|
||||
defaultPageSize: string; // A4, Letter, etc.
|
||||
defaultOrientation: 'portrait' | 'landscape';
|
||||
defaultMargins: {
|
||||
top: string;
|
||||
bottom: string;
|
||||
left: string;
|
||||
right: string;
|
||||
};
|
||||
|
||||
// Behavior
|
||||
openAfterExport: boolean; // Auto-open PDF
|
||||
preserveFolderStructure: boolean; // For batch export
|
||||
includeMetadata: boolean; // Export frontmatter
|
||||
includeCssStyles: boolean; // Capture CSS
|
||||
|
||||
// Advanced
|
||||
pandocArgs: string; // Additional Pandoc arguments
|
||||
typstArgs: string; // Additional Typst arguments
|
||||
customTemplatesFolder: string; // User templates location
|
||||
concurrency: number; // Batch export parallelism
|
||||
debugMode: boolean; // Show conversion details
|
||||
}
|
||||
```
|
||||
|
||||
## Implementation Phases
|
||||
|
||||
### Phase 1: Core Foundation (Week 1)
|
||||
- [ ] Clean up template code and fix TypeScript issues
|
||||
- [ ] Set up project structure and interfaces
|
||||
- [ ] Implement basic Pandoc integration
|
||||
- [ ] Create minimal Typst template
|
||||
- [ ] Test basic markdown → PDF conversion
|
||||
|
||||
### Phase 2: Obsidian Integration (Week 2)
|
||||
- [ ] Preprocess wikilinks and embeds
|
||||
- [ ] Handle frontmatter extraction
|
||||
- [ ] Process callouts and custom blocks
|
||||
- [ ] Support tags and metadata
|
||||
- [ ] Test with various Obsidian features
|
||||
|
||||
### Phase 3: Single-Page Feature (Week 3)
|
||||
- [ ] Create single-page Typst template
|
||||
- [ ] Implement height calculation algorithm
|
||||
- [ ] Handle content overflow edge cases
|
||||
- [ ] Test with documents of various lengths
|
||||
- [ ] Optimize performance for large documents
|
||||
|
||||
### Phase 4: Style Preservation (Week 4)
|
||||
- [ ] Extract CSS from Obsidian
|
||||
- [ ] Build CSS to Typst mapping system
|
||||
- [ ] Handle plugin-specific styles
|
||||
- [ ] Create hybrid export mode
|
||||
- [ ] Test with popular themes and plugins
|
||||
|
||||
### Phase 5: UI and Polish (Week 5)
|
||||
- [ ] Build export configuration modal
|
||||
- [ ] Create settings tab
|
||||
- [ ] Add template management
|
||||
- [ ] Implement progress indicators
|
||||
- [ ] Add comprehensive error handling
|
||||
|
||||
### Phase 6: Advanced Features (Week 6)
|
||||
- [ ] Batch export for folders/vault
|
||||
- [ ] Custom template support
|
||||
- [ ] Export presets/profiles
|
||||
- [ ] Command-line interface
|
||||
- [ ] Documentation and examples
|
||||
|
||||
## Technical Considerations
|
||||
|
||||
### Dependencies
|
||||
- **Pandoc:** Required, version 3.0+
|
||||
- **Typst:** Required, version 0.11+
|
||||
- **Node.js:** Built-in with Obsidian
|
||||
- **pdf-lib:** Bundled for PDF manipulation
|
||||
|
||||
### Performance Targets
|
||||
- Single note export: < 3 seconds
|
||||
- 10-page document: < 5 seconds
|
||||
- 100-page document: < 30 seconds
|
||||
- Batch export: Parallel processing with configurable concurrency
|
||||
|
||||
### Error Handling
|
||||
- Clear messages for missing dependencies
|
||||
- Fallback options when features unavailable
|
||||
- Detailed logs in debug mode
|
||||
- Recovery from partial failures
|
||||
|
||||
### Compatibility
|
||||
- Obsidian version: 0.15.0+
|
||||
- Operating Systems: Windows, macOS, Linux
|
||||
- Themes: Test with top 10 popular themes
|
||||
- Plugins: Ensure compatibility with:
|
||||
- Dataview
|
||||
- Templater
|
||||
- Email Block Plugin
|
||||
- Excalidraw
|
||||
- Advanced Tables
|
||||
|
||||
## Success Metrics
|
||||
|
||||
### Functional Requirements
|
||||
- ✅ Export completes successfully for 95% of notes
|
||||
- ✅ Single-page PDFs render without content cutoff
|
||||
- ✅ Obsidian syntax correctly converted (90%+ accuracy)
|
||||
- ✅ CSS styles preserved when requested (best effort)
|
||||
- ✅ Templates customizable without code changes
|
||||
|
||||
### Performance Requirements
|
||||
- ✅ Export time within targets for 90% of documents
|
||||
- ✅ Memory usage < 500MB for typical exports
|
||||
- ✅ No UI freezing during export
|
||||
|
||||
### User Experience
|
||||
- ✅ Clear error messages with actionable solutions
|
||||
- ✅ Intuitive configuration interface
|
||||
- ✅ Consistent export quality
|
||||
- ✅ Reliable batch processing
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
### Version 1.1
|
||||
- Live preview in export modal
|
||||
- More built-in templates
|
||||
|
||||
### Version 1.2
|
||||
- Bibliography and citation support
|
||||
- Table of contents generation
|
||||
- Index generation
|
||||
- Cross-reference handling
|
||||
|
||||
## Risks and Mitigation
|
||||
|
||||
| Risk | Impact | Mitigation |
|
||||
|------|---------|------------|
|
||||
| Dependency installation complexity | High | none |
|
||||
| CSS mapping limitations | Medium | Set expectations, focus on common styles |
|
||||
| Performance with large documents | Medium | Implement streaming, pagination options |
|
||||
| Template compatibility issues | Low | Extensive testing, template validation |
|
||||
| Cross-platform differences | Medium | Platform-specific testing, CI/CD |
|
||||
|
||||
## Appendix
|
||||
|
||||
### A. Obsidian Syntax Support
|
||||
|
||||
- [x] Wikilinks: `[[note]]`, `[[note|alias]]`
|
||||
- [x] Embeds: `![[note]]`, `![[image.png]]`
|
||||
- [x] Tags: `#tag`, `#nested/tag`
|
||||
- [x] Callouts: `> [!note]`, `> [!warning]`
|
||||
- [x] Code blocks with syntax highlighting
|
||||
- [x] Tables (including advanced tables)
|
||||
- [x] Footnotes: `[^1]`
|
||||
- [x] Math: `$inline$`, `$$display$$`
|
||||
- [x] Mermaid diagrams
|
||||
- [ ] Excalidraw drawings (future)
|
||||
- [ ] Canvas exports (future)
|
||||
|
||||
### B. Template Variables
|
||||
|
||||
Available variables for Typst templates:
|
||||
|
||||
```typst
|
||||
$title$ // From frontmatter
|
||||
$author$ // From frontmatter
|
||||
$date$ // From frontmatter or current
|
||||
$tags$ // Array of tags
|
||||
$font$ // User-selected font
|
||||
$fontSize$ // User-selected size
|
||||
$pageSize$ // A4, Letter, etc.
|
||||
$margins$ // Margin configuration
|
||||
$headerText$ // Custom header
|
||||
$footerText$ // Custom footer
|
||||
$body$ // Document content
|
||||
```
|
||||
|
||||
### C. CSS to Typst Mapping Examples
|
||||
|
||||
| CSS Property | Typst Equivalent |
|
||||
|--------------|------------------|
|
||||
| `font-size: 14px` | `#set text(size: 14pt)` |
|
||||
| `color: #333` | `#set text(fill: rgb("#333"))` |
|
||||
| `font-weight: bold` | `#strong[text]` |
|
||||
| `font-style: italic` | `#emph[text]` |
|
||||
| `text-align: center` | `#align(center)[text]` |
|
||||
| `border: 1px solid` | `#box(stroke: 1pt)` |
|
||||
| `background: #f0f0f0` | `#box(fill: rgb("#f0f0f0"))` |
|
||||
|
||||
---
|
||||
|
||||
*This PRD is a living document and will be updated as the project evolves.*
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"currentTag": "master",
|
||||
"lastSwitched": "2025-08-29T14:11:44.406Z",
|
||||
"branchTagMapping": {},
|
||||
"migrationNoticeShown": false
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
{
|
||||
"master": {
|
||||
"tasks": [
|
||||
{
|
||||
"id": 1,
|
||||
"title": "Fix TypeScript Issues and Clean Template Code",
|
||||
"description": "Resolve TypeScript type inconsistencies and remove sample plugin template code",
|
||||
"details": "Fix type mismatches in main.ts: Line 14 should use 'obsidianTypstPDFExportSettings' instead of 'MyPluginSettings', lines 111 and 113 should use 'obsidianTypstPDFExport' instead of 'MyPlugin'. Remove sample modal and template functionality. Update plugin metadata in package.json to reflect the actual Typst PDF Export plugin. This establishes a clean foundation for implementing the core functionality.",
|
||||
"testStrategy": "Verify TypeScript compilation passes without errors using 'npm run build'. Confirm plugin loads in Obsidian without console errors.",
|
||||
"priority": "high",
|
||||
"dependencies": [],
|
||||
"status": "pending",
|
||||
"subtasks": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"title": "Define Core Interfaces and Settings Structure",
|
||||
"description": "Create comprehensive TypeScript interfaces for plugin configuration, export modes, and internal data structures",
|
||||
"details": "Replace basic settings interface with comprehensive PluginSettings including paths (pandocPath, typstPath, outputFolder), export defaults (template, format, mode), typography settings (fonts, sizes), page setup (size, orientation, margins), and behavior flags (openAfterExport, preserveFolderStructure). Create ExportConfig interface for per-export settings, ExportMode enum ('typography' | 'style-preserving'), ExportFormat enum ('standard' | 'single-page'), and Template interface for Typst template management. Follow current Obsidian plugin patterns from reference plugins.",
|
||||
"testStrategy": "Ensure all interfaces compile correctly and settings can be serialized/deserialized. Create unit tests for default settings object structure.",
|
||||
"priority": "high",
|
||||
"dependencies": [
|
||||
1
|
||||
],
|
||||
"status": "pending",
|
||||
"subtasks": []
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"title": "Implement Dependency Checker and External Tool Management",
|
||||
"description": "Create system to verify and manage Pandoc and Typst installations with clear user guidance",
|
||||
"details": "Build DependencyChecker class using Node.js child_process.spawn to verify Pandoc 3.0+ and Typst 0.11+ installations. Implement platform-specific executable detection (Windows .exe, Unix PATH lookup). Create user-friendly error messages with installation links and troubleshooting steps. Add settings UI for custom executable paths. Handle cases where tools are not in PATH but manually specified. Use current best practices: spawn with timeout, proper error handling, and cross-platform path resolution using Node.js path module.",
|
||||
"testStrategy": "Test on Windows, macOS, and Linux with both PATH-available and custom-path scenarios. Verify error messages are clear and actionable. Mock child_process for unit testing.",
|
||||
"priority": "high",
|
||||
"dependencies": [
|
||||
2
|
||||
],
|
||||
"status": "pending",
|
||||
"subtasks": []
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"title": "Build Markdown Preprocessor for Obsidian Syntax",
|
||||
"description": "Convert Obsidian-specific markdown syntax to standard markdown compatible with Pandoc",
|
||||
"details": "Create MarkdownPreprocessor class to handle: wikilinks [[note]] and [[note|alias]] conversion to [alias](note.md), embed syntax ![[image.png]] and ![[note.md]] to standard markdown image/link references, callouts > [!note] to standard blockquotes with appropriate styling markers, tags #tag extraction for metadata, frontmatter preservation and parsing using gray-matter library (latest version ~4.0.3). Handle edge cases like nested brackets, special characters in filenames, and relative path resolution within Obsidian vault structure. Use current markdown processing best practices with regex patterns and AST manipulation.",
|
||||
"testStrategy": "Create comprehensive test suite with various Obsidian syntax combinations. Test with real Obsidian notes containing complex wikilinks, embeds, and callouts. Verify output is valid standard markdown.",
|
||||
"priority": "medium",
|
||||
"dependencies": [
|
||||
2
|
||||
],
|
||||
"status": "pending",
|
||||
"subtasks": []
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"title": "Create Pandoc-Typst Conversion Pipeline",
|
||||
"description": "Implement core conversion logic from processed markdown to PDF via Pandoc and Typst",
|
||||
"details": "Build PandocTypstConverter class using child_process.spawn to execute Pandoc with --pdf-engine=typst. Implement argument building for templates, variables, and custom options. Create temporary file management for intermediate processing with proper cleanup using Node.js fs.promises and tmp library. Handle Pandoc output parsing, error message extraction, and conversion progress tracking. Support both direct PDF output and intermediate .typ file generation for debugging. Use current Pandoc 3.x API with proper argument escaping and environment variable handling. Implement timeout handling for large documents and memory management for batch processing.",
|
||||
"testStrategy": "Test conversion pipeline with various document sizes and complexity levels. Verify proper error handling for malformed markdown, missing dependencies, and file system errors. Test cleanup of temporary files.",
|
||||
"priority": "high",
|
||||
"dependencies": [
|
||||
3,
|
||||
4
|
||||
],
|
||||
"status": "pending",
|
||||
"subtasks": []
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"title": "Develop Typst Template System",
|
||||
"description": "Create flexible template management system with built-in templates and custom template support",
|
||||
"details": "Build TemplateManager class with embedded default templates (default.typ, article.typ, report.typ, single-page.typ). Implement template variable substitution system for $title$, $author$, $date$, $font$, $fontSize$, $pageSize$, $margins$, $body$ using string templating. Create single-page template using Typst's 'height: auto' feature for dynamic page sizing. Support custom user templates from configurable directory. Implement template validation and variable extraction. Use current Typst 0.11+ syntax with proper page setup, text configuration, and layout control. Include error handling for template parsing issues and missing variables.",
|
||||
"testStrategy": "Test all built-in templates with various content types. Verify single-page template correctly adjusts height for different document lengths. Test custom template loading and variable substitution accuracy.",
|
||||
"priority": "medium",
|
||||
"dependencies": [
|
||||
2
|
||||
],
|
||||
"status": "pending",
|
||||
"subtasks": []
|
||||
},
|
||||
{
|
||||
"id": 7,
|
||||
"title": "Implement Export Configuration Modal",
|
||||
"description": "Create intuitive user interface for configuring export options with real-time preview",
|
||||
"details": "Build ExportConfigModal extending Obsidian's Modal class, following patterns from reference better-export-pdf plugin. Create form sections for export mode selection (typography/style-preserving), format choice (standard/single-page), template selection with preview, output settings (location, filename pattern), page configuration (size, orientation, margins), and typography options (fonts, sizes). Implement settings persistence and restoration from previous exports. Add progress indicator during export process with cancel capability. Use current Obsidian UI components: Setting, ButtonComponent, DropdownComponent. Include real-time validation and preview updates.",
|
||||
"testStrategy": "Test modal functionality with various combinations of settings. Verify settings persistence across plugin reloads. Test export process cancellation and progress reporting accuracy.",
|
||||
"priority": "medium",
|
||||
"dependencies": [
|
||||
6
|
||||
],
|
||||
"status": "pending",
|
||||
"subtasks": []
|
||||
},
|
||||
{
|
||||
"id": 8,
|
||||
"title": "Build CSS Extraction and Style Preservation System",
|
||||
"description": "Capture Obsidian theme styles and map them to equivalent Typst styling for style-preserving export mode",
|
||||
"details": "Create CSSExtractor class to capture computed styles from Obsidian's DOM using document.styleSheets API. Build CSSToTypstMapper to convert common CSS properties to Typst equivalents: font-size to #set text(size:), color to #set text(fill: rgb()), font-weight/font-style to #strong/#emph, text-align to #align(), borders and backgrounds to #box() styling. Handle theme-specific variables and plugin-specific styles. Create hybrid export mode combining extracted styles with Typst typography. Use current CSS parsing techniques with proper specificity handling and fallback values. Include support for popular themes (default, minimal, blue topaz) and common plugins (dataview, templater).",
|
||||
"testStrategy": "Test style extraction with various Obsidian themes. Verify CSS to Typst mapping accuracy for common styling patterns. Test style preservation with plugin-generated content.",
|
||||
"priority": "medium",
|
||||
"dependencies": [
|
||||
2
|
||||
],
|
||||
"status": "pending",
|
||||
"subtasks": []
|
||||
},
|
||||
{
|
||||
"id": 9,
|
||||
"title": "Add Export Commands and Menu Integration",
|
||||
"description": "Integrate export functionality into Obsidian's command palette, ribbon, and context menus",
|
||||
"details": "Register Obsidian commands for 'Export current note to Typst PDF', 'Export with previous settings', and 'Export folder to PDF'. Add ribbon icon with Typst logo for quick access. Integrate context menu items in file explorer following patterns from reference plugins. Implement batch export functionality for folders with parallel processing using configurable concurrency. Add keyboard shortcuts and command palette integration. Support both single file and multi-file export workflows. Use current Obsidian API: addCommand(), addRibbonIcon(), workspace events. Include proper callback validation and error handling.",
|
||||
"testStrategy": "Test all command registration and menu integration. Verify keyboard shortcuts work correctly. Test batch export performance with various folder sizes and concurrency settings.",
|
||||
"priority": "medium",
|
||||
"dependencies": [
|
||||
7
|
||||
],
|
||||
"status": "pending",
|
||||
"subtasks": []
|
||||
},
|
||||
{
|
||||
"id": 10,
|
||||
"title": "Implement Settings Tab and Plugin Configuration",
|
||||
"description": "Create comprehensive settings interface for plugin configuration with validation and help text",
|
||||
"details": "Build SettingsTab extending PluginSettingTab with sections for: external tools configuration (Pandoc/Typst paths with validation), default export preferences (template, format, output location), typography settings (default fonts, sizes with preview), page layout defaults (margins, orientation, size), advanced options (concurrency, debug mode, custom arguments), template management (import/export custom templates). Include dependency checking with status indicators, path validation with file picker integration, and help text with links to installation guides. Use current Obsidian settings patterns with proper form validation and immediate feedback.",
|
||||
"testStrategy": "Test all settings persistence and validation. Verify dependency checker integration shows correct status. Test template management functionality and custom path validation across platforms.",
|
||||
"priority": "medium",
|
||||
"dependencies": [
|
||||
8,
|
||||
9
|
||||
],
|
||||
"status": "pending",
|
||||
"subtasks": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"created": "2025-08-29T14:23:07.961Z",
|
||||
"updated": "2025-08-29T14:23:07.962Z",
|
||||
"description": "Tasks for master context"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<context>
|
||||
# Overview
|
||||
[Provide a high-level overview of your product here. Explain what problem it solves, who it's for, and why it's valuable.]
|
||||
|
||||
# Core Features
|
||||
[List and describe the main features of your product. For each feature, include:
|
||||
- What it does
|
||||
- Why it's important
|
||||
- How it works at a high level]
|
||||
|
||||
# User Experience
|
||||
[Describe the user journey and experience. Include:
|
||||
- User personas
|
||||
- Key user flows
|
||||
- UI/UX considerations]
|
||||
</context>
|
||||
<PRD>
|
||||
# Technical Architecture
|
||||
[Outline the technical implementation details:
|
||||
- System components
|
||||
- Data models
|
||||
- APIs and integrations
|
||||
- Infrastructure requirements]
|
||||
|
||||
# Development Roadmap
|
||||
[Break down the development process into phases:
|
||||
- MVP requirements
|
||||
- Future enhancements
|
||||
- Do not think about timelines whatsoever -- all that matters is scope and detailing exactly what needs to be build in each phase so it can later be cut up into tasks]
|
||||
|
||||
# Logical Dependency Chain
|
||||
[Define the logical order of development:
|
||||
- Which features need to be built first (foundation)
|
||||
- Getting as quickly as possible to something usable/visible front end that works
|
||||
- Properly pacing and scoping each feature so it is atomic but can also be built upon and improved as development approaches]
|
||||
|
||||
# Risks and Mitigations
|
||||
[Identify potential risks and how they'll be addressed:
|
||||
- Technical challenges
|
||||
- Figuring out the MVP that we can build upon
|
||||
- Resource constraints]
|
||||
|
||||
# Appendix
|
||||
[Include any additional information:
|
||||
- Research findings
|
||||
- Technical specifications]
|
||||
</PRD>
|
||||
Reference in new issue
Block a user