···6[](go.mod)
78Noteleaf is a unified personal productivity CLI that combines task management, note-taking, and media tracking in one place.
9-It provides TaskWarrior-inspired task management with additional support for notes, articles, books, movies, and TV shows - all built with Golang & Charm.sh libs. Inspired by TaskWarrior & todo.txt CLI applications.
01011## Why?
1213-- **Fragmented productivity tools**: Instead of juggling multiple apps for tasks, notes, reading lists, and media queues, Noteleaf provides a single CLI interface
14-- **Terminal-native workflow**: For developers and power users who prefer staying in the terminal, Noteleaf offers rich TUIs without leaving your command line
15- - **Lightweight and fast**: No desktop apps or web interfaces - just a fast, focused CLI tool
16- **Unified data model**: Tasks, notes, and media items can reference each other, creating a connected knowledge and productivity system
1718-## Getting started
19-20-### Prerequisites
21-22-Go v1.24+
2324-### Installation
2526```sh
27git clone https://github.com/stormlightlabs/noteleaf
···30go install
31```
3233-### Basic usage
34-35-```sh
36-# Initialize the application
37-noteleaf setup
38-39-# Add sample data for exploration
40-noteleaf setup seed
41-42-# Create your first task
43-noteleaf task add "Learn Noteleaf CLI"
44-45-# View tasks
46-noteleaf task list
47-48-# Create a note
49-noteleaf note add "My first note"
50-51-# Add a book to your reading list
52-noteleaf media book add "The Name of the Wind"
53-54-# Generate docs
55-noteleaf docgen --format docusaurus --out ./website/docs/manual
56-```
57-58-## Status
59-60-**Status**: Work in Progress (MVP completed)
61-62-### Completed
6364-- Task management with projects and tags
65-- Note-taking system
66-- Article parsing from URLs
67-- Media tracking (books, movies, TV shows)
68-69-### Planned
70-71-- Time tracking integration
72-- Advanced search and filtering
73-- Export/import functionality
74-- Plugin system
···6[](go.mod)
78Noteleaf is a unified personal productivity CLI that combines task management, note-taking, and media tracking in one place.
9+It provides TaskWarrior-inspired task management with additional support for notes, articles, books, movies, and TV shows, all built with Golang & Charm.sh libs.
10+Inspired by TaskWarrior & todo.txt CLI applications.
1112## Why?
1314+- **Fragmented Ecosystem**: Instead of juggling multiple apps for tasks, notes, reading lists, and media queues, Noteleaf provides a single CLI interface
15+- **Terminal-native**: For developers and power users who prefer staying in the terminal, Noteleaf offers rich TUIs without leaving your command line
16+ - **Lightweight**: No desktop apps or web interfaces, just a fast, focused CLI tool
17- **Unified data model**: Tasks, notes, and media items can reference each other, creating a connected knowledge and productivity system
1819+## Getting Started
00002021+### Quick Install
2223```sh
24git clone https://github.com/stormlightlabs/noteleaf
···27go install
28```
2930+### First Steps
000000000000000000000000000003132+For a comprehensive walkthrough including task management, time tracking, notes, and media tracking, see the [Quickstart Guide](website/docs/Quickstart.md).
0000000000
···2425### Business Logic
2627-**Handlers** - Business logic resides in `internal/handlers/` with one handler per domain (TaskHandler, NoteHandler, ArticleHandler, etc.). Handlers receive repository dependencies through constructor injection.
02829**Services** - Domain-specific operations in `internal/services/` handle complex business workflows and external integrations.
30···3435### Content Management
3637-**Articles** - Web scraping using `gocolly/colly` with domain-specific extraction rules stored in `internal/articles/rules/`. Articles are parsed to markdown and stored with dual file references (markdown + HTML).
03839**Tasks** - Todo/task management inspired by TaskWarrior with filtering, status tracking, and interactive TUI views.
40···6465### Technology Choices
6667-**Go over Rust** - Go was selected for its simplicity, excellent CLI ecosystem (Cobra, Charm libraries), and faster development velocity. While Rust + Ratatui would provide better memory safety and potentially superior performance, Go's straightforward concurrency model and mature tooling ecosystem made it the pragmatic choice for rapid prototyping and iteration.
06869-**SQLite over PostgreSQL** - SQLite provides zero-configuration deployment and sufficient performance for single-user CLI applications. The embedded database eliminates setup complexity while supporting full SQL features needed for filtering and querying. PostgreSQL would add deployment overhead without meaningful benefits for this use case.
007071-**Repository Pattern over Active Record** - Repository interfaces enable clean separation between business logic and data access, facilitating testing through dependency injection. This pattern scales better than Active Record for complex domain logic while maintaining clear boundaries between layers.
07273### Architectural Tradeoffs
7475-**CommandGroup Interface** - Centralizes command registration while enabling modular command organization. The pattern requires additional abstraction but provides consistent dependency injection and testing capabilities across all command groups.
07677-**Handler-based Business Logic** - Business logic in handlers rather than rich domain models keeps the codebase simple and avoids over-engineering. While this approach may not scale to complex business rules, it provides clear separation of concerns for the current feature set.
07879-**Dual Storage for Articles** - Articles store both markdown and HTML versions to balance processing speed with format flexibility. This doubles storage requirements but eliminates runtime conversion overhead and preserves original formatting.
08081### Component Interactions
8283-**Handler โ Repository โ Database** - Request flow follows a linear path from CLI commands through business logic to data persistence. This pattern ensures consistent validation and error handling while maintaining clear separation of concerns.
08485-**TUI State Management** - Bubbletea's unidirectional data flow provides predictable state updates for interactive components. The model-view-update pattern ensures consistent UI behavior across different terminal environments.
08687-**Configuration and Migration** - Application startup validates configuration and runs database migrations before initializing handlers. This fail-fast approach prevents runtime errors and ensures consistent database schema across deployments.
0
···2425### Business Logic
2627+**Handlers** - Business logic resides in `internal/handlers/` with one handler per domain (TaskHandler, NoteHandler, ArticleHandler, etc.).
28+Handlers receive repository dependencies through constructor injection.
2930**Services** - Domain-specific operations in `internal/services/` handle complex business workflows and external integrations.
31···3536### Content Management
3738+**Articles** - Web scraping using `gocolly/colly` with domain-specific extraction rules stored in `internal/articles/rules/`.
39+Articles are parsed to markdown and stored with dual file references (markdown + HTML).
4041**Tasks** - Todo/task management inspired by TaskWarrior with filtering, status tracking, and interactive TUI views.
42···6667### Technology Choices
6869+**Go over Rust** - Go was selected for its simplicity, excellent CLI ecosystem (Cobra, Charm libraries), and faster development velocity.
70+While Rust + Ratatui would provide better memory safety and potentially superior performance, Go's straightforward concurrency model and mature tooling ecosystem made it the pragmatic choice for rapid prototyping and iteration.
7172+**SQLite over PostgreSQL** - SQLite provides zero-configuration deployment and sufficient performance for single-user CLI applications.
73+The embedded database eliminates setup complexity while supporting full SQL features needed for filtering and querying.
74+PostgreSQL would add deployment overhead without meaningful benefits for this use case.
7576+**Repository Pattern over Active Record** - Repository interfaces enable clean separation between business logic and data access, facilitating testing through dependency injection.
77+This pattern scales better than Active Record for complex domain logic while maintaining clear boundaries between layers.
7879### Architectural Tradeoffs
8081+**CommandGroup Interface** - Centralizes command registration while enabling modular command organization.
82+The pattern requires additional abstraction but provides consistent dependency injection and testing capabilities across all command groups.
8384+**Handler-based Business Logic** - Business logic in handlers rather than rich domain models keeps the codebase simple and avoids over-engineering.
85+While this approach may not scale to complex business rules, it provides clear separation of concerns for the current feature set.
8687+**Dual Storage for Articles** - Articles store both markdown and HTML versions to balance processing speed with format flexibility.
88+This doubles storage requirements but eliminates runtime conversion overhead and preserves original formatting.
8990### Component Interactions
9192+**Handler โ Repository โ Database** - Request flow follows a linear path from CLI commands through business logic to data persistence.
93+This pattern ensures consistent validation and error handling while maintaining clear separation of concerns.
9495+**TUI State Management** - Bubbletea's unidirectional data flow provides predictable state updates for interactive components.
96+The model-view-update pattern ensures consistent UI behavior across different terminal environments.
9798+**Configuration and Migration** - Application startup validates configuration and runs database migrations before initializing handlers.
99+This fail-fast approach prevents runtime errors and ensures consistent database schema across deployments.
···45## Overview
67-The codebase follows Go's standard testing practices with specialized testing utilities for complex scenarios. Tests use the standard library along with carefully selected dependencies like faker for data generation and BubbleTea for TUI testing. This approach keeps dependencies minimal while providing robust testing infrastructure for interactive components and complex integrations.
0089### Organization
1011-Each package contains its own test files alongside the source code. Test files are organized by functionality and mirror the structure of the source code they test. The codebase includes four main test utility files that provide specialized testing infrastructure:
01213- `internal/services/test_utilities.go` - HTTP mocking and media service testing
14- `internal/repo/test_utilities.go` - Database testing and data generation
···1920### Handler Creation
2122-Tests create real handler instances using temporary databases to ensure test isolation. Factory functions handle both database setup and handler initialization, returning both the handler and a cleanup function.
02324### Database Isolation
2526-Tests use temporary directories and environment variable manipulation to create isolated database instances. Each test gets its own temporary SQLite database that is automatically cleaned up after the test completes.
02728-The `setupCommandTest` function creates a temporary directory, sets `XDG_CONFIG_HOME` to point to it, and initializes the database schema. This ensures tests don't interfere with each other or with development data.
02930### Resource Management
3132-Tests properly manage resources using cleanup functions returned by factory methods. The cleanup function handles both handler closure and temporary directory removal. This pattern ensures complete resource cleanup even if tests fail.
003334### Error Handling
3536-Tests use `t.Fatal` for setup errors that prevent test execution and `t.Error` for test assertion failures. Fatal errors stop test execution while errors allow tests to continue checking other conditions.
03738### Context Cancellation
3940-Error case testing frequently uses context cancellation to simulate database and network failures. The pattern creates a context, immediately cancels it, then calls the function under test to verify error handling. This provides a reliable way to test error paths without requiring complex mock setups or external failure injection.
004142### Command Structure
4344-Command group tests verify cobra command structure including use strings, aliases, short descriptions, and subcommand presence. Tests check that commands are properly configured without executing their logic.
04546### Interface Compliance
4748-Tests verify interface compliance using compile-time checks with blank identifier assignments. This ensures structs implement expected interfaces without runtime overhead.
04950## Test Infrastructure
5152### Test Utility Frameworks
5354-The codebase provides comprehensive testing utilities organized by layer and functionality. Each test utility file contains specialized helpers, mocks, and test infrastructure for its respective domain.
05556#### Database Testing Utilities
57···105106#### TUI Testing with BubbleTea Framework
107108-The TUI testing framework addresses the fundamental challenge of testing interactive terminal applications in a deterministic, concurrent environment. BubbleTea's message-passing architecture creates unique testing requirements that standard Go testing patterns cannot adequately address.
0109110-The framework implements a controlled execution environment that replaces BubbleTea's typical program loop with a deterministic testing harness. Rather than running an actual terminal program, the "testing suite" directly manages model state transitions by simulating the Update/View cycle. This approach eliminates the non-deterministic behavior inherent in real terminal interactions while preserving the exact message flow patterns that production code experiences.
00111112-State verification relies on function composition patterns where test conditions are expressed as closures that capture specific model states. The `WaitFor` mechanism uses polling with configurable timeouts, addressing the async nature of BubbleTea model updates without creating race conditions. This pattern bridges imperative test assertions with BubbleTea's declarative update model.
00113This is inspired by front-end/TS/JS testing patterns.
114115The framework's I/O abstraction layer replaces terminal input/output with controlled buffers that implement standard Go interfaces.
116-This design maintains interface compatibility while providing complete control over timing and content. The controlled I/O system captures all output for later verification and injects precise input sequences, enabling complex interaction testing without external dependencies.
0117118Concurrency management uses channels and context propagation to coordinate between the testing framework and the model under test.
119-The suite manages goroutine lifecycle and ensures proper cleanup, preventing test interference and resource leaks. This architecture supports testing of models that perform background operations or handle async events.
0120121#### HTTP Service Mocking
122···134135### Single Root Test
136137-The preferred test organization pattern uses a single root test function with nested subtests using `t.Run`. This provides clear hierarchical organization and allows running specific test sections while maintaining shared setup and context. This pattern offers several advantages: clear test hierarchy with logical grouping, ability to run specific test sections, consistent test structure across the codebase, and shared setup that can be inherited by subtests.
00138139### Integration vs Unit Testing
140141-The codebase emphasizes integration testing over heavy mocking by using real handlers and services to verify actual behavior rather than mocked interactions. The goal is to catch integration issues while maintaining test reliability.
0142143### Static Output
144···146147### Standard Output Redirection
148149-For testing functions that write to stdout, tests use a pipe redirection pattern with goroutines to capture output. The pattern saves the original stdout, redirects to a pipe, captures output in a separate goroutine, and restores stdout after the test. This ensures clean output capture without interfering with the testing framework.
00150151## Utilities
152···189190## Testing CLI Commands
191192-Command group tests focus on structure verification rather than execution testing. Tests check command configuration, subcommand presence, and interface compliance. This approach ensures command trees are properly constructed without requiring complex execution mocking.
0193194### CommandGroup Interface Testing
195196-The CommandGroup interface enables testable CLI architecture. Tests verify that command groups implement the interface correctly and return properly configured cobra commands. This pattern separates command structure from command execution.
0197198Interface compliance is tested using compile-time checks within the "Interface Implementations" subtest, ensuring all command structs properly implement the CommandGroup interface without runtime overhead.
199200## Performance Considerations
201202-Tests avoid expensive operations in setup functions. Handler creation uses real instances but tests focus on structure verification rather than full execution paths. This keeps test suites fast while maintaining coverage of critical functionality.
0203204The single root test pattern allows for efficient resource management where setup costs can be amortized across multiple related test cases.
205
···45## Overview
67+The codebase follows Go's standard testing practices with specialized testing utilities for complex scenarios.
8+Tests use the standard library along with carefully selected dependencies like faker for data generation and BubbleTea for TUI testing.
9+This approach keeps dependencies minimal while providing robust testing infrastructure for interactive components and complex integrations.
1011### Organization
1213+Each package contains its own test files alongside the source code. Test files are organized by functionality and mirror the structure of the source code they test.
14+The codebase includes four main test utility files that provide specialized testing infrastructure:
1516- `internal/services/test_utilities.go` - HTTP mocking and media service testing
17- `internal/repo/test_utilities.go` - Database testing and data generation
···2223### Handler Creation
2425+Tests create real handler instances using temporary databases to ensure test isolation.
26+Factory functions handle both database setup and handler initialization, returning both the handler and a cleanup function.
2728### Database Isolation
2930+Tests use temporary directories and environment variable manipulation to create isolated database instances.
31+Each test gets its own temporary SQLite database that is automatically cleaned up after the test completes.
3233+The `setupCommandTest` function creates a temporary directory, sets `XDG_CONFIG_HOME` to point to it, and initializes the database schema.
34+This ensures tests don't interfere with each other or with development data.
3536### Resource Management
3738+Tests properly manage resources using cleanup functions returned by factory methods.
39+The cleanup function handles both handler closure and temporary directory removal.
40+This pattern ensures complete resource cleanup even if tests fail.
4142### Error Handling
4344+Tests use `t.Fatal` for setup errors that prevent test execution and `t.Error` for test assertion failures.
45+Fatal errors stop test execution while errors allow tests to continue checking other conditions.
4647### Context Cancellation
4849+Error case testing frequently uses context cancellation to simulate database and network failures.
50+The pattern creates a context, immediately cancels it, then calls the function under test to verify error handling.
51+This provides a reliable way to test error paths without requiring complex mock setups or external failure injection.
5253### Command Structure
5455+Command group tests verify cobra command structure including use strings, aliases, short descriptions, and subcommand presence.
56+Tests check that commands are properly configured without executing their logic.
5758### Interface Compliance
5960+Tests verify interface compliance using compile-time checks with blank identifier assignments.
61+This ensures structs implement expected interfaces without runtime overhead.
6263## Test Infrastructure
6465### Test Utility Frameworks
6667+The codebase provides comprehensive testing utilities organized by layer and functionality.
68+Each test utility file contains specialized helpers, mocks, and test infrastructure for its respective domain.
6970#### Database Testing Utilities
71···119120#### TUI Testing with BubbleTea Framework
121122+The TUI testing framework addresses the fundamental challenge of testing interactive terminal applications in a deterministic, concurrent environment.
123+BubbleTea's message-passing architecture creates unique testing requirements that standard Go testing patterns cannot adequately address.
124125+The framework implements a controlled execution environment that replaces BubbleTea's typical program loop with a deterministic testing harness.
126+Rather than running an actual terminal program, the "testing suite" directly manages model state transitions by simulating the Update/View cycle.
127+This approach eliminates the non-deterministic behavior inherent in real terminal interactions while preserving the exact message flow patterns that production code experiences.
128129+State verification relies on function composition patterns where test conditions are expressed as closures that capture specific model states.
130+The `WaitFor` mechanism uses polling with configurable timeouts, addressing the async nature of BubbleTea model updates without creating race conditions.
131+This pattern bridges imperative test assertions with BubbleTea's declarative update model.
132This is inspired by front-end/TS/JS testing patterns.
133134The framework's I/O abstraction layer replaces terminal input/output with controlled buffers that implement standard Go interfaces.
135+This design maintains interface compatibility while providing complete control over timing and content.
136+The controlled I/O system captures all output for later verification and injects precise input sequences, enabling complex interaction testing without external dependencies.
137138Concurrency management uses channels and context propagation to coordinate between the testing framework and the model under test.
139+The suite manages goroutine lifecycle and ensures proper cleanup, preventing test interference and resource leaks.
140+This architecture supports testing of models that perform background operations or handle async events.
141142#### HTTP Service Mocking
143···155156### Single Root Test
157158+The preferred test organization pattern uses a single root test function with nested subtests using `t.Run`.
159+This provides clear hierarchical organization and allows running specific test sections while maintaining shared setup and context.
160+This pattern offers several advantages: clear test hierarchy with logical grouping, ability to run specific test sections, consistent test structure across the codebase, and shared setup that can be inherited by subtests.
161162### Integration vs Unit Testing
163164+The codebase emphasizes integration testing over heavy mocking by using real handlers and services to verify actual behavior rather than mocked interactions.
165+The goal is to catch integration issues while maintaining test reliability.
166167### Static Output
168···170171### Standard Output Redirection
172173+For testing functions that write to stdout, tests use a pipe redirection pattern with goroutines to capture output.
174+The pattern saves the original stdout, redirects to a pipe, captures output in a separate goroutine, and restores stdout after the test.
175+This ensures clean output capture without interfering with the testing framework.
176177## Utilities
178···215216## Testing CLI Commands
217218+Command group tests focus on structure verification rather than execution testing.
219+Tests check command configuration, subcommand presence, and interface compliance. This approach ensures command trees are properly constructed without requiring complex execution mocking.
220221### CommandGroup Interface Testing
222223+The CommandGroup interface enables testable CLI architecture. Tests verify that command groups implement the interface correctly and return properly configured cobra commands.
224+This pattern separates command structure from command execution.
225226Interface compliance is tested using compile-time checks within the "Interface Implementations" subtest, ensuring all command structs properly implement the CommandGroup interface without runtime overhead.
227228## Performance Considerations
229230+Tests avoid expensive operations in setup functions. Handler creation uses real instances but tests focus on structure verification rather than full execution paths.
231+This keeps test suites fast while maintaining coverage of critical functionality.
232233The single root test pattern allows for efficient resource management where setup costs can be amortized across multiple related test cases.
234
···1011### CORE
1213-- [ ] Ensure **all documented subcommands** exist and work:
14 - Tasks: add, list, view, update, edit, delete, projects, tags, contexts, done, start, stop, timesheet
15 - Notes: create, list, read, edit, remove
16 - Books: add, list, reading, finished, remove, progress, update
17 - Movies: add, list, watched, remove
18 - TV: add, list, watching, watched, remove
19 - Articles: add, list, view, read, remove
20-- [ ] Confirm all **aliases** work (`todo`, `ls`, `rm`, etc.).
21-- [ ] Verify **flags** and argument parsing match man page (priority, project, context, due, tags, etc.).
22-- [ ] Implement or finish stubs (e.g. `config management` noted in code).
2324### Task Management Domain
2526-- [ ] Verify tasks can be created with all attributes (priority, project, context, due date, tags).
27-- [ ] Confirm task listing supports interactive and static modes.
28-- [ ] Implement status filtering (`pending`, `completed`, etc.).
29-- [ ] Validate time tracking (start/stop) writes entries and timesheet summarizes correctly.
30-- [ ] Ensure update supports add/remove tags and all fields.
31-- [ ] Test interactive editor (`task edit`).
3233### Notes Domain
3435-- [ ] Implement note creation from:
36 - Inline text
37 - File (`--file`)
38 - Interactive input (`--interactive`)
39-- [ ] Verify note list interactive TUI works, static list fallback works.
40-- [ ] Confirm filtering by tags and `--archived`.
41-- [ ] Ensure notes can be opened, edited in `$EDITOR`, and deleted.
4243### Media Domains
4445#### Books
4647-- [ ] Implement search + add (possibly external API).
48-- [ ] Verify list supports statuses (`queued`, `reading`, `finished`).
49-- [ ] Progress updates (`book progress`) work with percentages.
50-- [ ] Status update (`book update`) accepts valid values.
5152#### Movies
5354-- [ ] Implement search + add.
55-- [ ] Verify `list` with status filtering (`all`, `queued`, `watched`).
56-- [ ] Confirm `watched`/`remove` commands update correctly.
5758#### TV
5960-- [ ] Implement search + add.
61-- [ ] Verify `list` with multiple statuses (`queued`, `watching`, `watched`).
62-- [ ] Ensure `watching`, `watched`, `remove` commands behave correctly.
6364#### Articles
6566-- [ ] Implement article parser (XPath/domain-specific rules).
67-- [ ] Save articles in Markdown + HTML.
68-- [ ] Verify metadata is stored in DB.
69-- [ ] Confirm list supports query, author filter, limit.
70-- [ ] Test article view/read/remove.
7172### Configuration & Data
7374-- [ ] Implement **config management**
75-- [ ] Define config file format (TOML, YAML, JSON).
76-- [ ] Set default config/data paths:
77 - Linux: `~/.config/noteleaf`, `~/.local/share/noteleaf`
78 - macOS: `~/Library/Application Support/noteleaf`
79 - Windows: `%APPDATA%\noteleaf`
80-- [ ] Implement overrides with environment variables (`NOTELEAF_CONFIG`, `NOTELEAF_DATA_DIR`).
81-- [ ] Ensure consistent DB schema migrations and versioning.
8283### Documentation
8485-- [ ] Finalize **man page** (plaintext + roff).
86-- [ ] Write quickstart guide in `README.md`.
87-- [ ] Add examples for each command.
88-- [ ] Document config file with defaults and examples.
89-- [ ] Provide developer docs for contributing.
009091### QA
92
···1011### CORE
1213+- [x] Ensure **all documented subcommands** exist and work:
14 - Tasks: add, list, view, update, edit, delete, projects, tags, contexts, done, start, stop, timesheet
15 - Notes: create, list, read, edit, remove
16 - Books: add, list, reading, finished, remove, progress, update
17 - Movies: add, list, watched, remove
18 - TV: add, list, watching, watched, remove
19 - Articles: add, list, view, read, remove
20+- [x] Confirm all **aliases** work (`todo`, `ls`, `rm`, etc.).
21+- [x] Verify **flags** and argument parsing match man page (priority, project, context, due, tags, etc.).
22+- [x] Implement or finish stubs (e.g. `config management` noted in code).
2324### Task Management Domain
2526+- [x] Verify tasks can be created with all attributes (priority, project, context, due date, tags).
27+- [x] Confirm task listing supports interactive and static modes.
28+- [x] Implement status filtering (`pending`, `completed`, etc.).
29+- [x] Validate time tracking (start/stop) writes entries and timesheet summarizes correctly.
30+- [x] Ensure update supports add/remove tags and all fields.
31+- [x] Test interactive editor (`task edit`).
3233### Notes Domain
3435+- [x] Implement note creation from:
36 - Inline text
37 - File (`--file`)
38 - Interactive input (`--interactive`)
39+- [x] Verify note list interactive TUI works, static list fallback works.
40+- [x] Confirm filtering by tags and `--archived`.
41+- [x] Ensure notes can be opened, edited in `$EDITOR`, and deleted.
4243### Media Domains
4445#### Books
4647+- [x] Implement search + add (possibly external API).
48+- [x] Verify list supports statuses (`queued`, `reading`, `finished`).
49+- [x] Progress updates (`book progress`) work with percentages.
50+- [x] Status update (`book update`) accepts valid values.
5152#### Movies
5354+- [x] Implement search + add.
55+- [x] Verify `list` with status filtering (`all`, `queued`, `watched`).
56+- [x] Confirm `watched`/`remove` commands update correctly.
5758#### TV
5960+- [x] Implement search + add.
61+- [x] Verify `list` with multiple statuses (`queued`, `watching`, `watched`).
62+- [x] Ensure `watching`, `watched`, `remove` commands behave correctly.
6364#### Articles
6566+- [x] Implement article parser (XPath/domain-specific rules).
67+- [x] Save articles in Markdown + HTML.
68+- [x] Verify metadata is stored in DB.
69+- [x] Confirm list supports query, author filter, limit.
70+- [x] Test article view/read/remove.
7172### Configuration & Data
7374+- [x] Implement **config management**
75+- [x] Define config file format (TOML, YAML, JSON).
76+- [x] Set default config/data paths:
77 - Linux: `~/.config/noteleaf`, `~/.local/share/noteleaf`
78 - macOS: `~/Library/Application Support/noteleaf`
79 - Windows: `%APPDATA%\noteleaf`
80+- [x] Implement overrides with environment variables (`NOTELEAF_CONFIG`, `NOTELEAF_DATA_DIR`).
81+- [x] Ensure consistent DB schema migrations and versioning.
8283### Documentation
8485+- [x] Finalize **man page** - use `tools/docgen.go` as a dev only command for `website/docs/manual`
86+- [x] Strictly follow <https://diataxis.fr/>
87+ - [x] Write quickstart guide in `README.md` & add `website/docs/Quickstart.md`
88+ - [x] Add examples for each command (`website/docs/examples`)
89+ - [x] Document config file with defaults and examples in `website/docs/Configuration.md`
90+ - [x] Provide developer docs for contributing in `docs/dev`
91+ - [x] Move to `website/docs/development`
9293### QA
94
+5-3
internal/services/services.go
···16 "time"
1718 "github.com/stormlightlabs/noteleaf/internal/models"
019 "golang.org/x/time/rate"
20)
21···27 // Rate limiting: 180 requests per minute = 3 requests per second
28 requestsPerSecond int = 3
29 burstLimit int = 5
03031- // User agent
32- // TODO: See https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications
33- userAgent string = "Noteleaf/1.0.0 (info@stormlightlabs.org)"
34)
3536// APIService defines the contract for API interactions
···16 "time"
1718 "github.com/stormlightlabs/noteleaf/internal/models"
19+ "github.com/stormlightlabs/noteleaf/internal/version"
20 "golang.org/x/time/rate"
21)
22···28 // Rate limiting: 180 requests per minute = 3 requests per second
29 requestsPerSecond int = 3
30 burstLimit int = 5
31+)
3233+var (
34+ // User agent for HTTP requests - uses version information set at build time
35+ userAgent = version.UserAgent("Noteleaf", "info@stormlightlabs.org")
36)
3738// APIService defines the contract for API interactions
···1+# Quickstart Guide
2+3+This guide will walk you through installing Noteleaf and getting productive with tasks, notes, and media tracking in under 15 minutes.
4+5+## Installation
6+7+### Requirements
8+9+- Go 1.24 or higher
10+- Git (for cloning the repository)
11+12+### Build and Install
13+14+Clone the repository and build the binary:
15+16+```sh
17+git clone https://github.com/stormlightlabs/noteleaf
18+cd noteleaf
19+go build -o ./tmp/noteleaf ./cmd
20+```
21+22+Optionally, install to your GOPATH:
23+24+```sh
25+go install
26+```
27+28+## Initialize Noteleaf
29+30+Set up the database and configuration:
31+32+```sh
33+noteleaf setup
34+```
35+36+This creates:
37+38+- Database at `~/.local/share/noteleaf/noteleaf.db` (Linux) or `~/Library/Application Support/noteleaf/noteleaf.db` (macOS)
39+- Configuration file at `~/.config/noteleaf/config.toml` (Linux) or `~/Library/Application Support/noteleaf/config.toml` (macOS)
40+41+### Optional: Add Sample Data
42+43+Explore with pre-populated examples:
44+45+```sh
46+noteleaf setup seed
47+```
48+49+## Task Management
50+51+### Create Your First Task
52+53+```sh
54+noteleaf task add "Write project proposal"
55+```
56+57+### Add a Task with Priority and Project
58+59+```sh
60+noteleaf task add "Review pull requests" --priority high --project work
61+```
62+63+### List Tasks
64+65+Interactive mode with arrow key navigation:
66+67+```sh
68+noteleaf task list
69+```
70+71+Static output for scripting:
72+73+```sh
74+noteleaf task list --static
75+```
76+77+### Mark a Task as Done
78+79+```sh
80+noteleaf task done 1
81+```
82+83+### Track Time
84+85+Start tracking:
86+87+```sh
88+noteleaf task start 1
89+```
90+91+Stop tracking:
92+93+```sh
94+noteleaf task stop 1
95+```
96+97+View timesheet:
98+99+```sh
100+noteleaf task timesheet
101+```
102+103+## Note Taking
104+105+### Create a Note
106+107+Quick note from command line:
108+109+```sh
110+noteleaf note create "Meeting Notes" "Discussed Q4 roadmap and priorities"
111+```
112+113+Create with your editor:
114+115+```sh
116+noteleaf note create --interactive
117+```
118+119+Create from a file:
120+121+```sh
122+noteleaf note create --file notes.md
123+```
124+125+### List and Read Notes
126+127+List all notes (interactive):
128+129+```sh
130+noteleaf note list
131+```
132+133+Read a specific note:
134+135+```sh
136+noteleaf note read 1
137+```
138+139+### Edit a Note
140+141+Opens in your `$EDITOR`:
142+143+```sh
144+noteleaf note edit 1
145+```
146+147+## Media Tracking
148+149+### Books
150+151+Search and add from Open Library:
152+153+```sh
154+noteleaf media book add "Project Hail Mary"
155+```
156+157+List your reading queue:
158+159+```sh
160+noteleaf media book list
161+```
162+163+Update reading progress:
164+165+```sh
166+noteleaf media book progress 1 45
167+```
168+169+Mark as finished:
170+171+```sh
172+noteleaf media book finished 1
173+```
174+175+### Movies
176+177+Add a movie:
178+179+```sh
180+noteleaf media movie add "The Matrix"
181+```
182+183+Mark as watched:
184+185+```sh
186+noteleaf media movie watched 1
187+```
188+189+### TV Shows
190+191+Add a show:
192+193+```sh
194+noteleaf media tv add "Breaking Bad"
195+```
196+197+Update status:
198+199+```sh
200+noteleaf media tv watching 1
201+```
202+203+## Articles
204+205+### Save an Article
206+207+Parse and save from URL:
208+209+```sh
210+noteleaf article add https://example.com/interesting-post
211+```
212+213+### List Articles
214+215+```sh
216+noteleaf article list
217+```
218+219+Filter by author:
220+221+```sh
222+noteleaf article list --author "Jane Smith"
223+```
224+225+### Read an Article
226+227+View in terminal:
228+229+```sh
230+noteleaf article view 1
231+```
232+233+## Configuration
234+235+### View Current Configuration
236+237+```sh
238+noteleaf config show
239+```
240+241+### Set Configuration Values
242+243+```sh
244+noteleaf config set editor vim
245+noteleaf config set default_priority medium
246+```
247+248+### Check Status
249+250+View application status and paths:
251+252+```sh
253+noteleaf status
254+```
255+256+## Getting Help
257+258+View help for any command:
259+260+```sh
261+noteleaf --help
262+noteleaf task --help
263+noteleaf task add --help
264+```
265+266+## Next Steps
267+268+Now that you have the basics down:
269+270+- Explore advanced task filtering and queries
271+- Create custom projects and contexts for organizing tasks
272+- Link notes to tasks and media items
273+- Set up recurring tasks and dependencies
274+- Configure the application to match your workflow
275+276+For detailed documentation on each command, see the CLI reference in the manual section.
···1+# Media Examples
2+3+Examples of managing your reading lists and watch queues using Noteleaf.
4+5+## Books
6+7+### Adding Books
8+9+Search and add from Open Library:
10+11+```sh
12+noteleaf media book add "The Name of the Wind"
13+noteleaf media book add "Project Hail Mary"
14+noteleaf media book add "Dune"
15+```
16+17+Add by author:
18+19+```sh
20+noteleaf media book add "Foundation by Isaac Asimov"
21+```
22+23+Add with specific year:
24+25+```sh
26+noteleaf media book add "1984 by George Orwell 1949"
27+```
28+29+### Viewing Books
30+31+List all books:
32+33+```sh
34+noteleaf media book list
35+```
36+37+Filter by status:
38+39+```sh
40+noteleaf media book list --status queued
41+noteleaf media book list --status reading
42+noteleaf media book list --status finished
43+```
44+45+### Managing Reading Status
46+47+Start reading:
48+49+```sh
50+noteleaf media book reading 1
51+```
52+53+Mark as finished:
54+55+```sh
56+noteleaf media book finished 1
57+```
58+59+### Tracking Progress
60+61+Update reading progress (percentage):
62+63+```sh
64+noteleaf media book progress 1 25
65+noteleaf media book progress 1 50
66+noteleaf media book progress 1 75
67+```
68+69+Update with page numbers:
70+71+```sh
72+noteleaf media book progress 1 150 --total 400
73+```
74+75+### Book Details
76+77+View book details:
78+79+```sh
80+noteleaf media book view 1
81+```
82+83+### Updating Book Information
84+85+Update book notes:
86+87+```sh
88+noteleaf media book update 1 --notes "Excellent worldbuilding and magic system"
89+```
90+91+Add rating:
92+93+```sh
94+noteleaf media book update 1 --rating 5
95+```
96+97+### Removing Books
98+99+Remove from list:
100+101+```sh
102+noteleaf media book remove 1
103+```
104+105+## Movies
106+107+### Adding Movies
108+109+Add movie:
110+111+```sh
112+noteleaf media movie add "The Matrix"
113+noteleaf media movie add "Inception"
114+noteleaf media movie add "Interstellar"
115+```
116+117+Add with year:
118+119+```sh
120+noteleaf media movie add "Blade Runner 1982"
121+```
122+123+### Viewing Movies
124+125+List all movies:
126+127+```sh
128+noteleaf media movie list
129+```
130+131+Filter by status:
132+133+```sh
134+noteleaf media movie list --status queued
135+noteleaf media movie list --status watched
136+```
137+138+### Managing Watch Status
139+140+Mark as watched:
141+142+```sh
143+noteleaf media movie watched 1
144+```
145+146+### Movie Details
147+148+View movie details:
149+150+```sh
151+noteleaf media movie view 1
152+```
153+154+### Updating Movie Information
155+156+Add notes and rating:
157+158+```sh
159+noteleaf media movie update 1 --notes "Mind-bending sci-fi" --rating 5
160+```
161+162+### Removing Movies
163+164+Remove from list:
165+166+```sh
167+noteleaf media movie remove 1
168+```
169+170+## TV Shows
171+172+### Adding TV Shows
173+174+Add TV show:
175+176+```sh
177+noteleaf media tv add "Breaking Bad"
178+noteleaf media tv add "The Wire"
179+noteleaf media tv add "Better Call Saul"
180+```
181+182+### Viewing TV Shows
183+184+List all shows:
185+186+```sh
187+noteleaf media tv list
188+```
189+190+Filter by status:
191+192+```sh
193+noteleaf media tv list --status queued
194+noteleaf media tv list --status watching
195+noteleaf media tv list --status watched
196+```
197+198+### Managing Watch Status
199+200+Start watching:
201+202+```sh
203+noteleaf media tv watching 1
204+```
205+206+Mark as finished:
207+208+```sh
209+noteleaf media tv watched 1
210+```
211+212+Put on hold:
213+214+```sh
215+noteleaf media tv update 1 --status on-hold
216+```
217+218+### TV Show Details
219+220+View show details:
221+222+```sh
223+noteleaf media tv view 1
224+```
225+226+### Updating TV Show Information
227+228+Update current episode:
229+230+```sh
231+noteleaf media tv update 1 --season 2 --episode 5
232+```
233+234+Add notes and rating:
235+236+```sh
237+noteleaf media tv update 1 --notes "Intense character development" --rating 5
238+```
239+240+### Removing TV Shows
241+242+Remove from list:
243+244+```sh
245+noteleaf media tv remove 1
246+```
247+248+## Common Workflows
249+250+### Weekend Watch List
251+252+Plan your weekend viewing:
253+254+```sh
255+# Add movies
256+noteleaf media movie add "The Shawshank Redemption"
257+noteleaf media movie add "Pulp Fiction"
258+noteleaf media movie add "Forrest Gump"
259+260+# View queue
261+noteleaf media movie list --status queued
262+```
263+264+### Reading Challenge
265+266+Track annual reading goal:
267+268+```sh
269+# Add books to queue
270+noteleaf media book add "The Lord of the Rings"
271+noteleaf media book add "The Hobbit"
272+noteleaf media book add "Mistborn"
273+274+# Check progress
275+noteleaf media book list --status finished
276+noteleaf media book list --status reading
277+```
278+279+### Binge Watching Tracker
280+281+Track TV series progress:
282+283+```sh
284+# Start series
285+noteleaf media tv add "Game of Thrones"
286+noteleaf media tv watching 1
287+288+# Update progress
289+noteleaf media tv update 1 --season 1 --episode 1
290+noteleaf media tv update 1 --season 1 --episode 2
291+292+# View current shows
293+noteleaf media tv list --status watching
294+```
295+296+### Media Recommendations
297+298+Keep track of recommendations:
299+300+```sh
301+# Add recommended items
302+noteleaf media book add "Sapiens" --notes "Recommended by John"
303+noteleaf media movie add "Parasite" --notes "Won Best Picture 2020"
304+noteleaf media tv add "Succession" --notes "From Reddit recommendations"
305+306+# View recommendations
307+noteleaf media book list --static | grep "Recommended"
308+```
309+310+### Review and Rating
311+312+After finishing, add review:
313+314+```sh
315+# Book review
316+noteleaf media book finished 1
317+noteleaf media book update 1 \
318+ --rating 5 \
319+ --notes "Masterful storytelling. The magic system is one of the best in fantasy."
320+321+# Movie review
322+noteleaf media movie watched 2
323+noteleaf media movie update 2 \
324+ --rating 4 \
325+ --notes "Great cinematography but slow pacing in second act."
326+327+# TV show review
328+noteleaf media tv watched 3
329+noteleaf media tv update 3 \
330+ --rating 5 \
331+ --notes "Best character development I've seen. Final season was perfect."
332+```
333+334+### Genre Organization
335+336+Organize by genre using notes:
337+338+```sh
339+noteleaf media book add "Snow Crash" --notes "Genre: Cyberpunk"
340+noteleaf media book add "Neuromancer" --notes "Genre: Cyberpunk"
341+noteleaf media book add "The Expanse" --notes "Genre: Space Opera"
342+343+# Find by genre
344+noteleaf media book list --static | grep "Cyberpunk"
345+```
346+347+### Currently Consuming
348+349+See what you're currently reading/watching:
350+351+```sh
352+noteleaf media book list --status reading
353+noteleaf media tv list --status watching
354+```
355+356+### Completed This Month
357+358+View completed items:
359+360+```sh
361+noteleaf media book list --status finished
362+noteleaf media movie list --status watched
363+noteleaf media tv list --status watched
364+```
365+366+### Clear Finished Items
367+368+Archive or remove completed media:
369+370+```sh
371+# Remove watched movies
372+noteleaf media movie remove 1 2 3
373+374+# Remove finished books
375+noteleaf media book remove 4 5 6
376+```
377+378+## Statistics and Reports
379+380+### Reading Statistics
381+382+Count books by status:
383+384+```sh
385+echo "Queued: $(noteleaf media book list --status queued --static | wc -l)"
386+echo "Reading: $(noteleaf media book list --status reading --static | wc -l)"
387+echo "Finished: $(noteleaf media book list --status finished --static | wc -l)"
388+```
389+390+### Viewing Habits
391+392+Track watch queue size:
393+394+```sh
395+echo "Movies to watch: $(noteleaf media movie list --status queued --static | wc -l)"
396+echo "Shows in progress: $(noteleaf media tv list --status watching --static | wc -l)"
397+```
···1+# Publication Examples
2+3+Examples of publishing notes to leaflet.pub using the AT Protocol integration.
4+5+## Overview
6+7+The publication system allows you to sync your local notes with leaflet.pub, an AT Protocol-based publishing platform. You can pull drafts from leaflet, publish local notes, and maintain a synchronized writing workflow across platforms.
8+9+## Authentication
10+11+### Initial Authentication
12+13+Authenticate with your BlueSky account:
14+15+```sh
16+noteleaf pub auth username.bsky.social
17+```
18+19+This will prompt for your app password interactively.
20+21+### Authenticate with Password Flag
22+23+Provide credentials directly:
24+25+```sh
26+noteleaf pub auth username.bsky.social --password "your-app-password"
27+```
28+29+### Creating an App Password
30+31+1. Visit [bsky.app/settings/app-passwords](https://bsky.app/settings/app-passwords)
32+2. Create a new app password named "noteleaf"
33+3. Use that password (not your main password) for authentication
34+35+### Check Authentication Status
36+37+```sh
38+noteleaf pub status
39+```
40+41+## Pulling Documents from Leaflet
42+43+### Pull All Documents
44+45+Fetch all drafts and published documents:
46+47+```sh
48+noteleaf pub pull
49+```
50+51+This will:
52+- Connect to your leaflet account
53+- Fetch all documents in your repository
54+- Create new notes for documents not yet synced
55+- Update existing notes that have changed
56+57+### After Pulling
58+59+List the synced notes:
60+61+```sh
62+noteleaf pub list
63+```
64+65+View synced notes interactively:
66+67+```sh
68+noteleaf pub list --interactive
69+```
70+71+## Publishing Local Notes
72+73+### Publish a Note
74+75+Create a new document on leaflet from a local note:
76+77+```sh
78+noteleaf pub post 123
79+```
80+81+### Publish as Draft
82+83+Create as draft instead of publishing immediately:
84+85+```sh
86+noteleaf pub post 123 --draft
87+```
88+89+### Preview Before Publishing
90+91+See what would be posted without actually posting:
92+93+```sh
94+noteleaf pub post 123 --preview
95+```
96+97+### Validate Conversion
98+99+Check if markdown conversion will work:
100+101+```sh
102+noteleaf pub post 123 --validate
103+```
104+105+## Updating Published Documents
106+107+### Update an Existing Document
108+109+Update a previously published note:
110+111+```sh
112+noteleaf pub patch 123
113+```
114+115+### Preview Update
116+117+See what would be updated:
118+119+```sh
120+noteleaf pub patch 123 --preview
121+```
122+123+### Validate Update
124+125+Check conversion before updating:
126+127+```sh
128+noteleaf pub patch 123 --validate
129+```
130+131+## Batch Operations
132+133+### Publish Multiple Notes
134+135+Create or update multiple documents at once:
136+137+```sh
138+noteleaf pub push 1 2 3 4 5
139+```
140+141+This will:
142+- Create new documents for notes never published
143+- Update existing documents for notes already on leaflet
144+145+### Batch Publish as Drafts
146+147+```sh
148+noteleaf pub push 10 11 12 --draft
149+```
150+151+## Viewing Publications
152+153+### List All Synced Notes
154+155+```sh
156+noteleaf pub list
157+```
158+159+Aliases:
160+```sh
161+noteleaf pub ls
162+```
163+164+### Filter by Status
165+166+Published documents only:
167+```sh
168+noteleaf pub list --published
169+```
170+171+Drafts only:
172+```sh
173+noteleaf pub list --draft
174+```
175+176+All documents:
177+```sh
178+noteleaf pub list --all
179+```
180+181+### Interactive Browser
182+183+Browse with TUI interface:
184+185+```sh
186+noteleaf pub list --interactive
187+noteleaf pub list -i
188+```
189+190+With filters:
191+```sh
192+noteleaf pub list --published --interactive
193+noteleaf pub list --draft -i
194+```
195+196+## Common Workflows
197+198+### Initial Setup and Pull
199+200+Set up leaflet integration and pull existing documents:
201+202+```sh
203+# Authenticate
204+noteleaf pub auth username.bsky.social
205+206+# Check status
207+noteleaf pub status
208+209+# Pull all documents
210+noteleaf pub pull
211+212+# View synced notes
213+noteleaf pub list --interactive
214+```
215+216+### Publishing Workflow
217+218+Write locally, then publish to leaflet:
219+220+```sh
221+# Create a note
222+noteleaf note create "My Blog Post" --interactive
223+224+# List notes to get ID
225+noteleaf note list
226+227+# Publish as draft first
228+noteleaf pub post 42 --draft
229+230+# Review draft on leaflet.pub
231+# Make edits locally
232+noteleaf note edit 42
233+234+# Update the draft
235+noteleaf pub patch 42
236+237+# When ready, republish without --draft flag
238+noteleaf pub post 42
239+```
240+241+### Sync Workflow
242+243+Keep local notes in sync with leaflet:
244+245+```sh
246+# Pull latest changes from leaflet
247+noteleaf pub pull
248+249+# Make local edits
250+noteleaf note edit 123
251+252+# Push changes back
253+noteleaf pub patch 123
254+255+# Check sync status
256+noteleaf pub list --published
257+```
258+259+### Draft Management
260+261+Work with drafts before publishing:
262+263+```sh
264+# Create drafts
265+noteleaf pub post 10 --draft
266+noteleaf pub post 11 --draft
267+noteleaf pub post 12 --draft
268+269+# View all drafts
270+noteleaf pub list --draft
271+272+# Edit a draft locally
273+noteleaf note edit 10
274+275+# Update on leaflet
276+noteleaf pub patch 10
277+278+# Promote draft to published (re-post without --draft)
279+noteleaf pub post 10
280+```
281+282+### Batch Publishing
283+284+Publish multiple notes at once:
285+286+```sh
287+# Create several notes
288+noteleaf note create "Post 1" "Content 1"
289+noteleaf note create "Post 2" "Content 2"
290+noteleaf note create "Post 3" "Content 3"
291+292+# Get note IDs
293+noteleaf note list --static
294+295+# Publish all at once
296+noteleaf pub push 50 51 52
297+298+# Or as drafts
299+noteleaf pub push 50 51 52 --draft
300+```
301+302+### Review Before Publishing
303+304+Always preview and validate before publishing:
305+306+```sh
307+# Validate markdown conversion
308+noteleaf pub post 99 --validate
309+310+# Preview the output
311+noteleaf pub post 99 --preview
312+313+# If everything looks good, publish
314+noteleaf pub post 99
315+```
316+317+### Cross-Platform Editing
318+319+Edit on leaflet.pub, sync to local:
320+321+```sh
322+# Pull changes from leaflet
323+noteleaf pub pull
324+325+# View what changed
326+noteleaf pub list --interactive
327+328+# Make additional edits locally
329+noteleaf note edit 123
330+331+# Push updates back
332+noteleaf pub patch 123
333+```
334+335+### Status Monitoring
336+337+Check authentication and publication status:
338+339+```sh
340+# Check auth status
341+noteleaf pub status
342+343+# List published documents
344+noteleaf pub list --published
345+346+# Count publications
347+noteleaf pub list --published --static | wc -l
348+```
349+350+## Troubleshooting
351+352+### Re-authenticate
353+354+If authentication expires:
355+356+```sh
357+noteleaf pub auth username.bsky.social
358+```
359+360+### Check Status
361+362+Verify connection:
363+364+```sh
365+noteleaf pub status
366+```
367+368+### Force Pull
369+370+Re-sync all documents:
371+372+```sh
373+noteleaf pub pull
374+```
375+376+### Validate Before Publishing
377+378+If publishing fails, validate first:
379+380+```sh
381+noteleaf pub post 123 --validate
382+```
383+384+Check for markdown formatting issues that might not convert properly.
385+386+## Integration with Notes
387+388+### Publishing Flow
389+390+```sh
391+# Create note locally
392+noteleaf note create "Article Title" --interactive
393+394+# Add tags for organization
395+noteleaf note tag 1 --add published,blog
396+397+# Publish to leaflet
398+noteleaf pub post 1
399+400+# Continue editing locally
401+noteleaf note edit 1
402+403+# Sync updates
404+noteleaf pub patch 1
405+```
406+407+### Import from Leaflet
408+409+```sh
410+# Pull from leaflet
411+noteleaf pub pull
412+413+# View imported notes
414+noteleaf pub list
415+416+# Edit locally
417+noteleaf note edit 123
418+419+# Continue working with standard note commands
420+noteleaf note read 123
421+noteleaf note tag 123 --add imported
422+```
423+424+## Advanced Usage
425+426+### Selective Publishing
427+428+Publish only specific notes with a tag:
429+430+```sh
431+# Tag notes for publication
432+noteleaf note tag 10 --add ready-to-publish
433+noteleaf note tag 11 --add ready-to-publish
434+435+# List tagged notes
436+noteleaf note list --tags ready-to-publish
437+438+# Publish those notes
439+noteleaf pub push 10 11
440+```
441+442+### Draft Review Cycle
443+444+```sh
445+# Publish drafts
446+noteleaf pub push 1 2 3 --draft
447+448+# Review on leaflet.pub in browser
449+# Make edits locally based on feedback
450+451+# Update drafts
452+noteleaf pub push 1 2 3
453+454+# When ready, publish (create as non-drafts)
455+noteleaf pub post 1
456+noteleaf pub post 2
457+noteleaf pub post 3
458+```
459+460+### Publication Archive
461+462+Keep track of published work:
463+464+```sh
465+# Tag published notes
466+noteleaf note tag 123 --add published,2024,blog
467+468+# List all published notes
469+noteleaf note list --tags published
470+471+# Archive old publications
472+noteleaf note archive 123
473+```
474+475+## Notes
476+477+- Authentication tokens are stored in the configuration file
478+- Notes are matched by their leaflet record key (rkey)
479+- The `push` command intelligently chooses between `post` and `patch`
480+- Draft status is preserved when patching existing documents
481+- Use `--preview` and `--validate` flags to test before publishing
482+- Pull regularly to stay synced with changes made on leaflet.pub