@@ -11,22 +11,26 @@ This is the main plugin source code for an unofficial Obsidian plugin that enabl
1111All commands should be run from this ` plugin/ ` directory:
1212
1313### Development
14+
1415- ` npm run dev ` - Build plugin in development mode with type checking
1516- ` npm run build ` - Build plugin for production
1617- ` npm run check ` - Run TypeScript type checking only
1718
1819### Testing and Quality
20+
1921- ` npm run test ` - Run all tests with Vitest
2022- ` npm run test ./src/utils ` - Run tests for specific directory/file
2123- ` npm run lint:check ` - Check code formatting and linting with BiomeJS
2224- ` npm run lint:fix ` - Auto-fix formatting and linting issues
2325
2426### Other
27+
2528- ` npm run gen ` - Generate language status file
2629
2730## Architecture Overview
2831
2932### Plugin Structure
33+
3034- ** Main Plugin** (` src/index.ts ` ): Core plugin class that initializes services, registers commands, and handles Obsidian lifecycle
3135- ** API Layer** (` src/api/ ` ): Todoist REST API client with domain models for tasks, projects, sections, and labels
3236- ** Query System** (` src/query/ ` ): Markdown code block processor that renders Todoist queries in notes
@@ -35,19 +39,23 @@ All commands should be run from this `plugin/` directory:
3539- ** Data Layer** (` src/data/ ` ): Repository pattern for caching and managing Todoist data with transformations
3640
3741### Key Components
42+
3843- ** Query Injector** (` src/query/injector.tsx ` ): Processes ` todoist ` code blocks and renders interactive task lists
3944- ** Repository Pattern** (` src/data/repository.ts ` ): Generic caching layer for API data with sync capabilities
4045- ** Settings Store** (` src/settings.ts ` ): Zustand-based state management for plugin configuration
4146- ** Token Accessor** (` src/services/tokenAccessor.ts ` ): Secure storage and retrieval of Todoist API tokens
4247
4348### UI Architecture
49+
4450- Built with React 19 and React Aria Components
4551- Uses Framer Motion for animations
4652- SCSS with component-scoped styles
4753- Supports both light and dark themes matching Obsidian
4854
4955### Query Language
56+
5057The plugin supports a custom query language in ` todoist ` code blocks with options for:
58+
5159- Filtering tasks by project, labels, due dates
5260- Sorting by priority, date, order
5361- Grouping by project, section, priority, date, labels
@@ -56,18 +64,42 @@ The plugin supports a custom query language in `todoist` code blocks with option
5664## Development Environment
5765
5866### Local Development
67+
5968Set ` VITE_OBSIDIAN_VAULT ` in ` .env.local ` to automatically copy build output to your Obsidian vault for testing:
69+
6070```
6171export VITE_OBSIDIAN_VAULT=/path/to/your/obsidian/vault
6272```
6373
6474### Code Style
75+
6576- Uses BiomeJS for formatting and linting
6677- 2-space indentation, 100 character line width
6778- Automatic import organization with package/alias/path grouping
6879- React functional components with hooks
6980
81+ ### Internationalization
82+
83+ - ** Always use translations for user-facing text** - never hardcode strings in UI components
84+ - Import translations with ` import { t } from "@/i18n" ` and use ` const i18n = t().section `
85+ - For simple text: define as ` string ` in translation interface and return string value
86+ - For text with interpolation: define as ` (param: Type) => string ` function in translation interface
87+ - Example with interpolation:
88+
89+ ``` typescript
90+ // translation.ts
91+ deleteNotice : (itemName : string ) => string ;
92+
93+ // en.ts
94+ deleteNotice : (itemName : string ) => ` Item "${itemName }" was deleted ` ,
95+ // component.tsx
96+ new Notice (i18n .deleteNotice (item .name ));
97+ ```
98+
99+ - Translation files are in ` src/i18n/ ` with interface in ` translation.ts ` and implementations in ` langs/ `
100+
70101### Testing
102+
71103- Vitest with jsdom environment for React component testing
72104- Mocked Obsidian API (` src/mocks/obsidian.ts ` )
73105- Tests focus on data transformations and utility functions
@@ -86,9 +118,10 @@ export VITE_OBSIDIAN_VAULT=/path/to/your/obsidian/vault
86118## Build Process
87119
88120Uses Vite with:
121+
89122- TypeScript compilation with path aliases
90123- React JSX transformation
91124- SCSS processing
92125- Library mode targeting CommonJS for Obsidian compatibility
93126- Manifest copying and build stamping
94- - Development mode auto-copying to vault
127+ - Development mode auto-copying to vault
0 commit comments