mirror of
https://github.com/taskgenius/taskgenius-plugin.git
synced 2026-07-22 06:40:25 +00:00
refactor(repo)!: restructure directories for maintainability and update import paths
Split utils/ into managers/, services/, core/, parsers/, cache/, and utils subfolders (date/, file/, task/, ui/) Standardize file naming to kebab-case and group executors/parsers more clearly Move worker utilities to dataflow/workers to align with dataflow architecture Improves separation of concerns, naming consistency, and code discovery BREAKING CHANGE: Import paths across the project have changed; update downstream code and plugins accordingly
This commit is contained in:
parent
87bee19b8f
commit
1e49782272
189 changed files with 1251 additions and 248 deletions
351
docs/directory-structure-refactoring-plan.md
Normal file
351
docs/directory-structure-refactoring-plan.md
Normal file
|
|
@ -0,0 +1,351 @@
|
|||
# Directory Structure Refactoring Plan
|
||||
|
||||
## Overview
|
||||
This document outlines the comprehensive refactoring plan for reorganizing the `src/utils` directory and establishing a clearer, more maintainable directory structure for the Task Genius plugin.
|
||||
|
||||
## Current Issues
|
||||
|
||||
### Problem Analysis
|
||||
1. **Mixed Responsibilities**: The `src/utils/` directory contains managers, services, parsers, utilities, and executors all mixed together
|
||||
2. **Inconsistent Naming**: Files have inconsistent naming conventions (e.g., `TaskManager.ts` vs `taskUtil.ts`)
|
||||
3. **Poor Organization**: Related functionality is scattered across different locations
|
||||
4. **Overly Large Files**: `TaskManager.ts` is over 27,000 tokens and should be split
|
||||
5. **Unclear Dependencies**: Hard to understand relationships between components
|
||||
|
||||
## Existing Structures to Preserve
|
||||
|
||||
### Keep As-Is
|
||||
- **`src/dataflow/`** - Already well-organized with:
|
||||
- `api/` - QueryAPI, WriteAPI for dataflow operations
|
||||
- `parsers/` - Dataflow-specific parsers (MarkdownEntry, FileMetaEntry, CanvasEntry)
|
||||
- `workers/` - Dataflow-specific workers
|
||||
- `core/`, `events/`, `sources/`, etc.
|
||||
|
||||
- **`src/mcp/`** - MCP server implementation with:
|
||||
- `auth/` - Authentication middleware
|
||||
- `bridge/` - Bridge implementations (DataflowBridge, TaskManagerBridge)
|
||||
- `types/` - Type definitions
|
||||
|
||||
## New Directory Structure
|
||||
|
||||
```
|
||||
src/
|
||||
├── cache/ # Caching and storage utilities
|
||||
│ ├── local-storage-cache.ts (from utils/persister.ts)
|
||||
│ └── project-data-cache.ts (from utils/ProjectDataCache.ts)
|
||||
│
|
||||
├── core/ # Core business logic
|
||||
│ ├── goal/ # Goal-related functionality (moved from utils/goal/)
|
||||
│ │ ├── edit-mode.ts
|
||||
│ │ ├── read-mode.ts
|
||||
│ │ └── regex-goal.ts
|
||||
│ ├── project-filter.ts (from utils/projectFilter.ts)
|
||||
│ ├── project-tree-builder.ts (from utils/projectTreeBuilder.ts)
|
||||
│ ├── task-indexer.ts (from utils/import/TaskIndexer.ts)
|
||||
│ └── workflow-converter.ts (from utils/workflowConversion.ts)
|
||||
│
|
||||
├── dataflow/ # [EXISTING - NO CHANGES]
|
||||
│ └── workers/ # Add worker-related utilities here
|
||||
│ ├── [existing files]
|
||||
│ ├── task-index-message.ts (from utils/workers/TaskIndexWorkerMessage.ts)
|
||||
│ └── deferred-promise.ts (from utils/workers/deferred.ts)
|
||||
│
|
||||
├── executors/ # Action executors
|
||||
│ └── completion/ # Task completion actions
|
||||
│ ├── base-executor.ts (from utils/onCompletion/BaseActionExecutor.ts)
|
||||
│ ├── archive-executor.ts (from utils/onCompletion/ArchiveActionExecutor.ts)
|
||||
│ ├── complete-executor.ts (from utils/onCompletion/CompleteActionExecutor.ts)
|
||||
│ ├── delete-executor.ts (from utils/onCompletion/DeleteActionExecutor.ts)
|
||||
│ ├── duplicate-executor.ts (from utils/onCompletion/DuplicateActionExecutor.ts)
|
||||
│ ├── keep-executor.ts (from utils/onCompletion/KeepActionExecutor.ts)
|
||||
│ ├── move-executor.ts (from utils/onCompletion/MoveActionExecutor.ts)
|
||||
│ └── canvas-operation-utils.ts (from utils/onCompletion/CanvasTaskOperationUtils.ts)
|
||||
│
|
||||
├── managers/ # Feature-specific managers
|
||||
│ ├── completion-manager.ts (from utils/OnCompletionManager.ts)
|
||||
│ ├── file-filter-manager.ts (from utils/FileFilterManager.ts)
|
||||
│ ├── file-task-manager.ts (from utils/FileTaskManager.ts)
|
||||
│ ├── habit-manager.ts (from utils/HabitManager.ts)
|
||||
│ ├── icon-manager.ts (from utils/TaskGeniusIconManager.ts)
|
||||
│ ├── ics-manager.ts (from utils/ics/IcsManager.ts)
|
||||
│ ├── onboarding-manager.ts (from utils/OnboardingConfigManager.ts)
|
||||
│ ├── project-config-manager.ts (from utils/ProjectConfigManager.ts)
|
||||
│ ├── rebuild-progress-manager.ts (from utils/RebuildProgressManager.ts)
|
||||
│ ├── reward-manager.ts (from utils/RewardManager.ts)
|
||||
│ ├── task-manager.ts (from utils/TaskManager.ts)
|
||||
│ ├── timer-manager.ts (from utils/TaskTimerManager.ts)
|
||||
│ └── version-manager.ts (from utils/VersionManager.ts)
|
||||
│
|
||||
├── mcp/ # [EXISTING - NO CHANGES]
|
||||
│
|
||||
├── parsers/ # General-purpose parsers (non-dataflow)
|
||||
│ ├── canvas-parser.ts (from utils/parsing/CanvasParser.ts)
|
||||
│ ├── canvas-task-updater.ts (from utils/parsing/CanvasTaskUpdater.ts)
|
||||
│ ├── configurable-task-parser.ts (from utils/workers/ConfigurableTaskParser.ts)
|
||||
│ ├── context-detector.ts (from utils/workers/ContextDetector.ts)
|
||||
│ ├── file-metadata-parser.ts (from utils/workers/FileMetadataTaskParser.ts)
|
||||
│ ├── file-metadata-updater.ts (from utils/workers/FileMetadataTaskUpdater.ts)
|
||||
│ ├── holiday-detector.ts (from utils/ics/HolidayDetector.ts)
|
||||
│ ├── ics-parser.ts (from utils/ics/IcsParser.ts)
|
||||
│ ├── ics-status-mapper.ts (from utils/ics/StatusMapper.ts)
|
||||
│ └── webcal-converter.ts (from utils/ics/WebcalUrlConverter.ts)
|
||||
│
|
||||
├── services/ # Service classes
|
||||
│ ├── settings-change-detector.ts (from utils/SettingsChangeDetector.ts)
|
||||
│ ├── task-parsing-service.ts (from utils/TaskParsingService.ts)
|
||||
│ ├── time-parsing-service.ts (from utils/TimeParsingService.ts)
|
||||
│ ├── timer-export-service.ts (from utils/TaskTimerExporter.ts)
|
||||
│ ├── timer-format-service.ts (from utils/TaskTimerFormatter.ts)
|
||||
│ └── timer-metadata-service.ts (from utils/TaskTimerMetadataDetector.ts)
|
||||
│
|
||||
└── utils/ # Pure utility functions only
|
||||
├── date/ # Date utilities
|
||||
│ ├── date-formatter.ts (from utils/dateUtil.ts)
|
||||
│ └── date-helper.ts (from utils/DateHelper.ts)
|
||||
├── file/ # File utilities
|
||||
│ ├── file-operations.ts (from utils/fileUtils.ts)
|
||||
│ └── file-type-detector.ts (from utils/fileTypeUtils.ts)
|
||||
├── task/ # Task utilities
|
||||
│ ├── filter-compatibility.ts (from utils/filterUtils.ts)
|
||||
│ ├── priority-utils.ts (from utils/priorityUtils.ts)
|
||||
│ ├── task-filter-utils.ts (from utils/TaskFilterUtils.ts)
|
||||
│ ├── task-migration.ts (from utils/taskMigrationUtils.ts)
|
||||
│ └── task-operations.ts (from utils/taskUtil.ts - if not deprecated)
|
||||
├── ui/ # UI utilities
|
||||
│ ├── tree-view-utils.ts (from utils/treeViewUtil.ts)
|
||||
│ └── view-mode-utils.ts (from utils/viewModeUtils.ts)
|
||||
└── id-generator.ts (from utils/common.ts)
|
||||
```
|
||||
|
||||
## Implementation Phases
|
||||
|
||||
### Phase 1: Directory Creation
|
||||
Create all new directories before moving any files:
|
||||
- `src/managers/`
|
||||
- `src/services/`
|
||||
- `src/executors/completion/`
|
||||
- `src/parsers/`
|
||||
- `src/cache/`
|
||||
- `src/core/goal/`
|
||||
- `src/utils/date/`
|
||||
- `src/utils/file/`
|
||||
- `src/utils/task/`
|
||||
- `src/utils/ui/`
|
||||
|
||||
### Phase 2: Manager Migration
|
||||
Move all manager classes from `src/utils/` to `src/managers/`:
|
||||
|
||||
| Original File | New Location | Rename Reason |
|
||||
|--------------|--------------|---------------|
|
||||
| `FileTaskManager.ts` | `managers/file-task-manager.ts` | Kebab-case consistency |
|
||||
| `HabitManager.ts` | `managers/habit-manager.ts` | Kebab-case consistency |
|
||||
| `TaskManager.ts` | `managers/task-manager.ts` | Kebab-case consistency |
|
||||
| `OnCompletionManager.ts` | `managers/completion-manager.ts` | Clearer naming + kebab-case |
|
||||
| `OnboardingConfigManager.ts` | `managers/onboarding-manager.ts` | Simpler name + kebab-case |
|
||||
| `ProjectConfigManager.ts` | `managers/project-config-manager.ts` | Kebab-case consistency |
|
||||
| `RebuildProgressManager.ts` | `managers/rebuild-progress-manager.ts` | Kebab-case consistency |
|
||||
| `RewardManager.ts` | `managers/reward-manager.ts` | Kebab-case consistency |
|
||||
| `TaskGeniusIconManager.ts` | `managers/icon-manager.ts` | Simpler name + kebab-case |
|
||||
| `TaskTimerManager.ts` | `managers/timer-manager.ts` | Simpler name + kebab-case |
|
||||
| `VersionManager.ts` | `managers/version-manager.ts` | Kebab-case consistency |
|
||||
| `FileFilterManager.ts` | `managers/file-filter-manager.ts` | Kebab-case consistency |
|
||||
| `ics/IcsManager.ts` | `managers/ics-manager.ts` | Flatten structure + kebab-case |
|
||||
|
||||
### Phase 3: Service Migration
|
||||
Move service classes from `src/utils/` to `src/services/`:
|
||||
|
||||
| Original File | New Location | Rename Reason |
|
||||
|--------------|--------------|---------------|
|
||||
| `TaskParsingService.ts` | `services/task-parsing-service.ts` | Kebab-case consistency |
|
||||
| `TimeParsingService.ts` | `services/time-parsing-service.ts` | Kebab-case consistency |
|
||||
| `SettingsChangeDetector.ts` | `services/settings-change-detector.ts` | Kebab-case consistency |
|
||||
| `TaskTimerExporter.ts` | `services/timer-export-service.ts` | Clearer naming + kebab-case |
|
||||
| `TaskTimerFormatter.ts` | `services/timer-format-service.ts` | Clearer naming + kebab-case |
|
||||
| `TaskTimerMetadataDetector.ts` | `services/timer-metadata-service.ts` | Clearer naming + kebab-case |
|
||||
|
||||
### Phase 4: Executor Migration
|
||||
Move executors from `src/utils/onCompletion/` to `src/executors/completion/`:
|
||||
|
||||
| Original File | New Location | Rename Reason |
|
||||
|--------------|--------------|---------------|
|
||||
| `onCompletion/BaseActionExecutor.ts` | `executors/completion/base-executor.ts` | Simpler name + kebab-case |
|
||||
| `onCompletion/ArchiveActionExecutor.ts` | `executors/completion/archive-executor.ts` | Simpler name + kebab-case |
|
||||
| `onCompletion/CompleteActionExecutor.ts` | `executors/completion/complete-executor.ts` | Simpler name + kebab-case |
|
||||
| `onCompletion/DeleteActionExecutor.ts` | `executors/completion/delete-executor.ts` | Simpler name + kebab-case |
|
||||
| `onCompletion/DuplicateActionExecutor.ts` | `executors/completion/duplicate-executor.ts` | Simpler name + kebab-case |
|
||||
| `onCompletion/KeepActionExecutor.ts` | `executors/completion/keep-executor.ts` | Simpler name + kebab-case |
|
||||
| `onCompletion/MoveActionExecutor.ts` | `executors/completion/move-executor.ts` | Simpler name + kebab-case |
|
||||
| `onCompletion/CanvasTaskOperationUtils.ts` | `executors/completion/canvas-operation-utils.ts` | Clearer naming + kebab-case |
|
||||
|
||||
### Phase 5: Parser Migration
|
||||
Move parsers from various locations to appropriate directories:
|
||||
|
||||
| Original File | New Location | Rename Reason |
|
||||
|--------------|--------------|---------------|
|
||||
| `parsing/CanvasParser.ts` | `parsers/canvas-parser.ts` | Kebab-case consistency |
|
||||
| `parsing/CanvasTaskUpdater.ts` | `parsers/canvas-task-updater.ts` | Kebab-case consistency |
|
||||
| `ics/IcsParser.ts` | `parsers/ics-parser.ts` | Flatten structure + kebab-case |
|
||||
| `ics/HolidayDetector.ts` | `parsers/holiday-detector.ts` | Flatten structure + kebab-case |
|
||||
| `ics/StatusMapper.ts` | `parsers/ics-status-mapper.ts` | Clearer naming + kebab-case |
|
||||
| `ics/WebcalUrlConverter.ts` | `parsers/webcal-converter.ts` | Simpler name + kebab-case |
|
||||
| `workers/ConfigurableTaskParser.ts` | `parsers/configurable-task-parser.ts` | Kebab-case consistency |
|
||||
| `workers/ContextDetector.ts` | `parsers/context-detector.ts` | Kebab-case consistency |
|
||||
| `workers/FileMetadataTaskParser.ts` | `parsers/file-metadata-parser.ts` | Simpler name + kebab-case |
|
||||
| `workers/FileMetadataTaskUpdater.ts` | `parsers/file-metadata-updater.ts` | Simpler name + kebab-case |
|
||||
|
||||
### Phase 6: Cache Migration
|
||||
Move caching utilities to `src/cache/`:
|
||||
|
||||
| Original File | New Location | Rename Reason |
|
||||
|--------------|--------------|---------------|
|
||||
| `persister.ts` | `cache/local-storage-cache.ts` | Descriptive name + kebab-case |
|
||||
| `ProjectDataCache.ts` | `cache/project-data-cache.ts` | Kebab-case consistency |
|
||||
|
||||
### Phase 7: Core Business Logic Migration
|
||||
Move core business logic to `src/core/`:
|
||||
|
||||
| Original File | New Location | Rename Reason |
|
||||
|--------------|--------------|---------------|
|
||||
| `projectFilter.ts` | `core/project-filter.ts` | Kebab-case consistency |
|
||||
| `projectTreeBuilder.ts` | `core/project-tree-builder.ts` | Kebab-case consistency |
|
||||
| `workflowConversion.ts` | `core/workflow-converter.ts` | Clearer naming + kebab-case |
|
||||
| `goal/` (entire directory) | `core/goal/` | Preserve structure |
|
||||
| `import/TaskIndexer.ts` | `core/task-indexer.ts` | Flatten structure + kebab-case |
|
||||
|
||||
### Phase 8: Worker Migration to Dataflow
|
||||
Move worker utilities to existing `src/dataflow/workers/`:
|
||||
|
||||
| Original File | New Location | Rename Reason |
|
||||
|--------------|--------------|---------------|
|
||||
| `workers/TaskIndexWorkerMessage.ts` | `dataflow/workers/task-index-message.ts` | Simpler name + kebab-case |
|
||||
| `workers/deferred.ts` | `dataflow/workers/deferred-promise.ts` | Descriptive name + kebab-case |
|
||||
|
||||
### Phase 9: Utility Reorganization
|
||||
Reorganize remaining utilities into categorized subdirectories:
|
||||
|
||||
| Original File | New Location | Rename Reason |
|
||||
|--------------|--------------|---------------|
|
||||
| `DateHelper.ts` | `utils/date/date-helper.ts` | Kebab-case consistency |
|
||||
| `dateUtil.ts` | `utils/date/date-formatter.ts` | Descriptive name + kebab-case |
|
||||
| `fileTypeUtils.ts` | `utils/file/file-type-detector.ts` | Descriptive name + kebab-case |
|
||||
| `fileUtils.ts` | `utils/file/file-operations.ts` | Descriptive name + kebab-case |
|
||||
| `priorityUtils.ts` | `utils/task/priority-utils.ts` | Kebab-case consistency |
|
||||
| `taskUtil.ts` | `utils/task/task-operations.ts` | Descriptive name + kebab-case |
|
||||
| `TaskFilterUtils.ts` | `utils/task/task-filter-utils.ts` | Kebab-case consistency |
|
||||
| `filterUtils.ts` | `utils/task/filter-compatibility.ts` | Descriptive name + kebab-case |
|
||||
| `taskMigrationUtils.ts` | `utils/task/task-migration.ts` | Simpler name + kebab-case |
|
||||
| `treeViewUtil.ts` | `utils/ui/tree-view-utils.ts` | Kebab-case consistency |
|
||||
| `viewModeUtils.ts` | `utils/ui/view-mode-utils.ts` | Kebab-case consistency |
|
||||
| `common.ts` | `utils/id-generator.ts` | Descriptive name + kebab-case |
|
||||
|
||||
### Phase 10: Import Path Updates
|
||||
After all files are moved, update all import statements throughout the codebase:
|
||||
|
||||
1. Use automated refactoring tools where possible
|
||||
2. Run TypeScript compiler to identify broken imports
|
||||
3. Update test file imports
|
||||
4. Update barrel exports (index.ts files)
|
||||
5. Verify no circular dependencies were introduced
|
||||
|
||||
### Phase 11: Cleanup
|
||||
1. Remove empty directories
|
||||
2. Delete or update `src/utils/README.md`
|
||||
3. Update any documentation that references old file paths
|
||||
4. Run full test suite to ensure nothing broke
|
||||
|
||||
## Validation Checklist
|
||||
|
||||
- [ ] All directories created successfully
|
||||
- [ ] All files moved to new locations
|
||||
- [ ] All files renamed to kebab-case
|
||||
- [ ] All import paths updated
|
||||
- [ ] TypeScript compilation succeeds
|
||||
- [ ] All tests pass
|
||||
- [ ] No circular dependencies introduced
|
||||
- [ ] Documentation updated
|
||||
- [ ] Commit with detailed message explaining the refactoring
|
||||
|
||||
## Commit Message Template
|
||||
|
||||
```
|
||||
refactor: reorganize directory structure for better maintainability
|
||||
|
||||
BREAKING CHANGE: Major directory restructuring - all import paths updated
|
||||
|
||||
Motivation:
|
||||
- Mixed responsibilities in utils/ directory causing confusion
|
||||
- Inconsistent naming conventions across files
|
||||
- Poor organization making code discovery difficult
|
||||
- Need for clearer separation of concerns
|
||||
|
||||
Changes by category:
|
||||
|
||||
Managers (utils/ → managers/):
|
||||
- Renamed to kebab-case for consistency
|
||||
- FileTaskManager → file-task-manager
|
||||
- TaskGeniusIconManager → icon-manager (simplified)
|
||||
- OnCompletionManager → completion-manager (clarified)
|
||||
|
||||
Services (utils/ → services/):
|
||||
- Separated service classes from utilities
|
||||
- TaskTimerExporter → timer-export-service (clarified purpose)
|
||||
- TaskTimerFormatter → timer-format-service (clarified purpose)
|
||||
|
||||
Executors (utils/onCompletion/ → executors/completion/):
|
||||
- Grouped action executors together
|
||||
- Simplified names (e.g., BaseActionExecutor → base-executor)
|
||||
|
||||
Parsers (various → parsers/):
|
||||
- Consolidated general-purpose parsers
|
||||
- Kept dataflow-specific parsers in dataflow/parsers/
|
||||
|
||||
Core Logic (utils/ → core/):
|
||||
- Moved business logic out of utils
|
||||
- Created goal/ subdirectory for goal-related features
|
||||
|
||||
Cache (utils/ → cache/):
|
||||
- Separated caching utilities
|
||||
- persister → local-storage-cache (descriptive rename)
|
||||
|
||||
Pure Utilities (reorganized in utils/):
|
||||
- Created subdirectories: date/, file/, task/, ui/
|
||||
- Renamed for clarity and consistency
|
||||
- common.ts → id-generator.ts (specific purpose)
|
||||
|
||||
Worker Integration:
|
||||
- Moved worker utilities to dataflow/workers/
|
||||
- Maintains consistency with dataflow architecture
|
||||
|
||||
Benefits:
|
||||
- Clear separation of concerns
|
||||
- Easier code discovery
|
||||
- Consistent naming conventions
|
||||
- Better maintainability
|
||||
- Reduced cognitive load for developers
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
1. **Naming Convention**: All files use kebab-case for consistency
|
||||
2. **Dataflow Preservation**: The existing dataflow architecture is preserved
|
||||
3. **MCP Preservation**: The MCP server structure remains unchanged
|
||||
4. **Gradual Migration**: Can be implemented in phases to minimize disruption
|
||||
5. **Future Consideration**: TaskManager.ts should be split into smaller, focused modules
|
||||
|
||||
## Risk Mitigation
|
||||
|
||||
1. **Create a branch**: `refactor/directory-structure`
|
||||
2. **Implement in small commits**: One phase per commit for easy rollback
|
||||
3. **Run tests after each phase**: Ensure nothing breaks
|
||||
4. **Use automated tools**: VSCode's "Move file" and "Rename Symbol" features
|
||||
5. **Review imports carefully**: Some imports might need manual adjustment
|
||||
6. **Document changes**: Update README and other docs as needed
|
||||
|
||||
## Future Improvements
|
||||
|
||||
After this refactoring:
|
||||
1. Consider splitting `TaskManager.ts` into smaller modules
|
||||
2. Create barrel exports (index.ts) for each major directory
|
||||
3. Add JSDoc comments to clarify module purposes
|
||||
4. Consider dependency injection for better testability
|
||||
5. Evaluate if any managers should become services or vice versa
|
||||
118
final-import-fixes.py
Normal file
118
final-import-fixes.py
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
# Define all the final import fixes
|
||||
FINAL_FIXES = {
|
||||
# Test files
|
||||
'src/__tests__/TaskParsingService.integration.test.ts': [
|
||||
(r'from\s+["\']../utils/workers/ConfigurableTaskParser["\']', 'from "../parsers/configurable-task-parser"'),
|
||||
],
|
||||
|
||||
# TaskWorkerManager
|
||||
'src/dataflow/workers/TaskWorkerManager.ts': [
|
||||
(r'from\s+["\']../../utils/workers/TaskIndexWorkerMessage["\']', 'from "./task-index-message"'),
|
||||
],
|
||||
|
||||
# Task Manager fixes
|
||||
'src/managers/task-manager.ts': [
|
||||
(r'from\s+["\']./workers/TaskIndexWorkerMessage["\']', 'from "../dataflow/workers/task-index-message"'),
|
||||
],
|
||||
|
||||
# Parser files
|
||||
'src/parsers/configurable-task-parser.ts': [
|
||||
(r'from\s+["\']../../dataflow/core/ConfigurableTaskParser["\']', 'from "../dataflow/core/ConfigurableTaskParser"'),
|
||||
],
|
||||
'src/parsers/file-metadata-parser.ts': [
|
||||
(r'from\s+["\']../../types/task["\']', 'from "../types/task"'),
|
||||
(r'from\s+["\']../../common/setting-definition["\']', 'from "../common/setting-definition"'),
|
||||
],
|
||||
'src/parsers/file-metadata-updater.ts': [
|
||||
(r'from\s+["\']../../types/task["\']', 'from "../types/task"'),
|
||||
(r'from\s+["\']../../common/setting-definition["\']', 'from "../common/setting-definition"'),
|
||||
],
|
||||
'src/parsers/holiday-detector.ts': [
|
||||
(r'from\s+["\']../../types/ics["\']', 'from "../types/ics"'),
|
||||
],
|
||||
'src/parsers/ics-parser.ts': [
|
||||
(r'from\s+["\']../../types/ics["\']', 'from "../types/ics"'),
|
||||
],
|
||||
'src/parsers/ics-status-mapper.ts': [
|
||||
(r'from\s+["\']../../types/ics["\']', 'from "../types/ics"'),
|
||||
(r'from\s+["\']../../common/setting-definition["\']', 'from "../common/setting-definition"'),
|
||||
],
|
||||
|
||||
# Service files
|
||||
'src/services/task-parsing-service.ts': [
|
||||
(r'from\s+["\']./workers/TaskIndexWorkerMessage["\']', 'from "../dataflow/workers/task-index-message"'),
|
||||
],
|
||||
'src/services/timer-export-service.ts': [
|
||||
(r'from\s+["\']./TaskTimerManager["\']', 'from "../managers/timer-manager"'),
|
||||
(r'from\s+["\']./TaskTimerFormatter["\']', 'from "./timer-format-service"'),
|
||||
],
|
||||
|
||||
# Utils files
|
||||
'src/utils/file/file-operations.ts': [
|
||||
(r'from\s+["\']../editor-ext/quickCapture["\']', 'from "../../editor-ext/quickCapture"'),
|
||||
],
|
||||
'src/utils/file/file-type-detector.ts': [
|
||||
(r'from\s+["\']./FileFilterManager["\']', 'from "../../managers/file-filter-manager"'),
|
||||
],
|
||||
'src/utils/task/task-filter-utils.ts': [
|
||||
(r'from\s+["\']../types/task["\']', 'from "../../types/task"'),
|
||||
(r'from\s+["\']../common/setting-definition["\']', 'from "../../common/setting-definition"'),
|
||||
(r'from\s+["\']../index["\']', 'from "../../index"'),
|
||||
(r'from\s+["\']../commands/sortTaskCommands["\"]', 'from "../../commands/sortTaskCommands"'),
|
||||
(r'from\s+["\']../components/task-filter/ViewTaskFilter["\']', 'from "../../components/task-filter/ViewTaskFilter"'),
|
||||
(r'from\s+["\']./taskUtil["\']', 'from "./task-operations"'),
|
||||
],
|
||||
'src/utils/task/task-migration.ts': [
|
||||
(r'from\s+["\']../types/task["\']', 'from "../../types/task"'),
|
||||
],
|
||||
'src/utils/task/task-operations.ts': [
|
||||
(r'from\s+["\']../common/default-symbol["\']', 'from "../../common/default-symbol"'),
|
||||
(r'from\s+["\']./dateUtil["\']', 'from "../date/date-formatter"'),
|
||||
(r'from\s+["\']../types/task["\']', 'from "../../types/task"'),
|
||||
(r'from\s+["\']../common/regex-define["\']', 'from "../../common/regex-define"'),
|
||||
(r'from\s+["\']../dataflow/core/ConfigurableTaskParser["\']', 'from "../../dataflow/core/ConfigurableTaskParser"'),
|
||||
(r'from\s+["\']../common/task-parser-config["\']', 'from "../../common/task-parser-config"'),
|
||||
],
|
||||
'src/utils/ui/tree-view-utils.ts': [
|
||||
(r'from\s+["\']../types/task["\']', 'from "../../types/task"'),
|
||||
],
|
||||
}
|
||||
|
||||
def fix_imports_in_file(file_path, fixes):
|
||||
"""Apply specific import fixes to a file."""
|
||||
if not os.path.exists(file_path):
|
||||
print(f"Warning: File not found: {file_path}")
|
||||
return False
|
||||
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
original_content = content
|
||||
|
||||
for pattern, replacement in fixes:
|
||||
content = re.sub(pattern, replacement, content)
|
||||
|
||||
if content != original_content:
|
||||
with open(file_path, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
return True
|
||||
return False
|
||||
|
||||
def main():
|
||||
"""Main function to apply final import fixes."""
|
||||
updated_files = []
|
||||
|
||||
for file_path, fixes in FINAL_FIXES.items():
|
||||
if fix_imports_in_file(file_path, fixes):
|
||||
updated_files.append(file_path)
|
||||
print(f"Fixed imports in: {file_path}")
|
||||
|
||||
print(f"\nTotal files with imports fixed: {len(updated_files)}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
145
fix-internal-imports.py
Normal file
145
fix-internal-imports.py
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
# Define specific internal import fixes for moved files
|
||||
INTERNAL_FIXES = {
|
||||
# Fixes for managers/
|
||||
'managers/version-manager.ts': [
|
||||
(r'from\s+["\']./persister["\']', 'from "../cache/local-storage-cache"'),
|
||||
],
|
||||
'managers/task-manager.ts': [
|
||||
(r'from\s+["\']./import/TaskIndexer["\']', 'from "../core/task-indexer"'),
|
||||
(r'from\s+["\']./persister["\']', 'from "../cache/local-storage-cache"'),
|
||||
(r'from\s+["\']./ics/HolidayDetector["\']', 'from "../parsers/holiday-detector"'),
|
||||
(r'from\s+["\']./FileFilterManager["\']', 'from "./file-filter-manager"'),
|
||||
(r'from\s+["\']./parsing/CanvasTaskUpdater["\']', 'from "../parsers/canvas-task-updater"'),
|
||||
(r'from\s+["\']./workers/FileMetadataTaskUpdater["\']', 'from "../parsers/file-metadata-updater"'),
|
||||
(r'from\s+["\']./RebuildProgressManager["\']', 'from "./rebuild-progress-manager"'),
|
||||
(r'from\s+["\']./OnCompletionManager["\']', 'from "./completion-manager"'),
|
||||
],
|
||||
'managers/completion-manager.ts': [
|
||||
(r'from\s+["\']./onCompletion/(\w+)["\']', r'from "../executors/completion/\1"'),
|
||||
],
|
||||
'managers/file-filter-manager.ts': [
|
||||
(r'from\s+["\']./fileTypeUtils["\']', 'from "../utils/file/file-type-detector"'),
|
||||
],
|
||||
'managers/ics-manager.ts': [
|
||||
(r'from\s+["\']./IcsParser["\']', 'from "../parsers/ics-parser"'),
|
||||
(r'from\s+["\']./WebcalUrlConverter["\']', 'from "../parsers/webcal-converter"'),
|
||||
(r'from\s+["\']./HolidayDetector["\']', 'from "../parsers/holiday-detector"'),
|
||||
],
|
||||
# Fixes for services/
|
||||
'services/task-parsing-service.ts': [
|
||||
(r'from\s+["\']./ProjectConfigManager["\']', 'from "../managers/project-config-manager"'),
|
||||
(r'from\s+["\']./workers/ConfigurableTaskParser["\']', 'from "../parsers/configurable-task-parser"'),
|
||||
(r'from\s+["\']./workers/FileMetadataTaskParser["\']', 'from "../parsers/file-metadata-parser"'),
|
||||
],
|
||||
'services/timer-metadata-service.ts': [
|
||||
(r'from\s+["\']./TaskTimerFormatter["\']', 'from "./timer-format-service"'),
|
||||
],
|
||||
# Fixes for executors/completion/
|
||||
'executors/completion/archive-executor.ts': [
|
||||
(r'from\s+["\']./BaseActionExecutor["\']', 'from "./base-executor"'),
|
||||
(r'from\s+["\']./CanvasTaskOperationUtils["\']', 'from "./canvas-operation-utils"'),
|
||||
(r'from\s+["\']\.\./fileUtils["\']', 'from "../../utils/file/file-operations"'),
|
||||
],
|
||||
'executors/completion/complete-executor.ts': [
|
||||
(r'from\s+["\']./BaseActionExecutor["\']', 'from "./base-executor"'),
|
||||
(r'from\s+["\']./CanvasTaskOperationUtils["\']', 'from "./canvas-operation-utils"'),
|
||||
],
|
||||
'executors/completion/delete-executor.ts': [
|
||||
(r'from\s+["\']./BaseActionExecutor["\']', 'from "./base-executor"'),
|
||||
(r'from\s+["\']./CanvasTaskOperationUtils["\']', 'from "./canvas-operation-utils"'),
|
||||
],
|
||||
'executors/completion/duplicate-executor.ts': [
|
||||
(r'from\s+["\']./BaseActionExecutor["\']', 'from "./base-executor"'),
|
||||
(r'from\s+["\']./CanvasTaskOperationUtils["\']', 'from "./canvas-operation-utils"'),
|
||||
],
|
||||
'executors/completion/keep-executor.ts': [
|
||||
(r'from\s+["\']./BaseActionExecutor["\']', 'from "./base-executor"'),
|
||||
],
|
||||
'executors/completion/move-executor.ts': [
|
||||
(r'from\s+["\']./BaseActionExecutor["\']', 'from "./base-executor"'),
|
||||
(r'from\s+["\']./CanvasTaskOperationUtils["\']', 'from "./canvas-operation-utils"'),
|
||||
(r'from\s+["\']\.\./fileUtils["\']', 'from "../../utils/file/file-operations"'),
|
||||
],
|
||||
'executors/completion/canvas-operation-utils.ts': [
|
||||
(r'from\s+["\']\.\./parsing/CanvasParser["\']', 'from "../../parsers/canvas-parser"'),
|
||||
(r'from\s+["\']\.\./parsing/CanvasTaskUpdater["\']', 'from "../../parsers/canvas-task-updater"'),
|
||||
],
|
||||
# Fixes for parsers/
|
||||
'parsers/canvas-task-updater.ts': [
|
||||
(r'from\s+["\']./CanvasParser["\']', 'from "./canvas-parser"'),
|
||||
],
|
||||
'parsers/file-metadata-updater.ts': [
|
||||
(r'from\s+["\']./FileMetadataTaskParser["\']', 'from "./file-metadata-parser"'),
|
||||
(r'from\s+["\']./ConfigurableTaskParser["\']', 'from "./configurable-task-parser"'),
|
||||
],
|
||||
'parsers/file-metadata-parser.ts': [
|
||||
(r'from\s+["\']./ConfigurableTaskParser["\']', 'from "./configurable-task-parser"'),
|
||||
],
|
||||
'parsers/ics-parser.ts': [
|
||||
(r'from\s+["\']./StatusMapper["\']', 'from "./ics-status-mapper"'),
|
||||
],
|
||||
'parsers/holiday-detector.ts': [
|
||||
(r'from\s+["\']./IcsParser["\']', 'from "./ics-parser"'),
|
||||
],
|
||||
# Fixes for cache/
|
||||
'cache/project-data-cache.ts': [
|
||||
(r'from\s+["\']./persister["\']', 'from "./local-storage-cache"'),
|
||||
],
|
||||
# Fixes for core/
|
||||
'core/project-filter.ts': [
|
||||
(r'from\s+["\']\.\./utils/ProjectConfigManager["\']', 'from "../managers/project-config-manager"'),
|
||||
],
|
||||
'core/project-tree-builder.ts': [
|
||||
(r'from\s+["\']\.\./utils/treeViewUtil["\']', 'from "../utils/ui/tree-view-utils"'),
|
||||
],
|
||||
'core/task-indexer.ts': [
|
||||
(r'from\s+["\']\.\./utils/TaskManager["\']', 'from "../managers/task-manager"'),
|
||||
],
|
||||
'core/goal/edit-mode.ts': [
|
||||
(r'from\s+["\']./regexGoal["\']', 'from "./regex-goal"'),
|
||||
],
|
||||
'core/goal/read-mode.ts': [
|
||||
(r'from\s+["\']./regexGoal["\']', 'from "./regex-goal"'),
|
||||
],
|
||||
}
|
||||
|
||||
def fix_imports_in_file(file_path, fixes):
|
||||
"""Apply specific import fixes to a file."""
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
original_content = content
|
||||
|
||||
for pattern, replacement in fixes:
|
||||
content = re.sub(pattern, replacement, content)
|
||||
|
||||
if content != original_content:
|
||||
with open(file_path, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
return True
|
||||
return False
|
||||
|
||||
def main():
|
||||
"""Main function to fix internal imports in moved files."""
|
||||
src_dir = 'src'
|
||||
updated_files = []
|
||||
|
||||
for relative_path, fixes in INTERNAL_FIXES.items():
|
||||
file_path = os.path.join(src_dir, relative_path)
|
||||
if os.path.exists(file_path):
|
||||
if fix_imports_in_file(file_path, fixes):
|
||||
updated_files.append(file_path)
|
||||
print(f"Fixed internal imports in: {file_path}")
|
||||
else:
|
||||
print(f"Warning: File not found: {file_path}")
|
||||
|
||||
print(f"\nTotal files with internal imports fixed: {len(updated_files)}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
128
fix-remaining-imports.py
Normal file
128
fix-remaining-imports.py
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
# Define all the remaining import fixes
|
||||
REMAINING_FIXES = {
|
||||
# Test files
|
||||
'src/__tests__/TaskParsingService.integration.test.ts': [
|
||||
(r'from\s+["\']../utils/workers/ConfigurableTaskParser["\']', 'from "../parsers/configurable-task-parser"'),
|
||||
],
|
||||
|
||||
# Cache files
|
||||
'src/cache/project-data-cache.ts': [
|
||||
(r'from\s+["\']./ProjectConfigManager["\']', 'from "../managers/project-config-manager"'),
|
||||
],
|
||||
|
||||
# Core files
|
||||
'src/core/project-tree-builder.ts': [
|
||||
(r'from\s+["\']./taskUtil["\']', 'from "../utils/task/task-operations"'),
|
||||
],
|
||||
'src/core/task-indexer.ts': [
|
||||
(r'from\s+["\']../../types/task["\']', 'from "../types/task"'),
|
||||
(r'from\s+["\']../fileTypeUtils["\']', 'from "../utils/file/file-type-detector"'),
|
||||
(r'from\s+["\']../FileFilterManager["\']', 'from "../managers/file-filter-manager"'),
|
||||
],
|
||||
|
||||
# Dataflow workers
|
||||
'src/dataflow/workers/task-index-message.ts': [
|
||||
(r'from\s+["\']../taskUtil["\']', 'from "../../utils/task/task-operations"'),
|
||||
],
|
||||
'src/dataflow/workers/TaskWorkerManager.ts': [
|
||||
(r'from\s+["\']../../utils/workers/TaskIndexWorkerMessage["\']', 'from "./task-index-message"'),
|
||||
],
|
||||
|
||||
# Executors
|
||||
'src/executors/completion/base-executor.ts': [
|
||||
(r'from\s+["\']../parsing/CanvasTaskUpdater["\']', 'from "../../parsers/canvas-task-updater"'),
|
||||
],
|
||||
|
||||
# Managers
|
||||
'src/managers/completion-manager.ts': [
|
||||
(r'from\s+["\']../executors/completion/BaseActionExecutor["\']', 'from "../executors/completion/base-executor"'),
|
||||
(r'from\s+["\']../executors/completion/DeleteActionExecutor["\']', 'from "../executors/completion/delete-executor"'),
|
||||
(r'from\s+["\']../executors/completion/KeepActionExecutor["\']', 'from "../executors/completion/keep-executor"'),
|
||||
(r'from\s+["\']../executors/completion/CompleteActionExecutor["\']', 'from "../executors/completion/complete-executor"'),
|
||||
(r'from\s+["\']../executors/completion/MoveActionExecutor["\']', 'from "../executors/completion/move-executor"'),
|
||||
(r'from\s+["\']../executors/completion/ArchiveActionExecutor["\']', 'from "../executors/completion/archive-executor"'),
|
||||
(r'from\s+["\']../executors/completion/DuplicateActionExecutor["\']', 'from "../executors/completion/duplicate-executor"'),
|
||||
],
|
||||
'src/managers/ics-manager.ts': [
|
||||
(r'from\s+["\']../../types/ics["\']', 'from "../types/ics"'),
|
||||
(r'from\s+["\']../../types/task["\']', 'from "../types/task"'),
|
||||
(r'from\s+["\']./StatusMapper["\']', 'from "../parsers/ics-status-mapper"'),
|
||||
(r'from\s+["\']../../common/setting-definition["\']', 'from "../common/setting-definition"'),
|
||||
],
|
||||
'src/managers/reward-manager.ts': [
|
||||
(r'from\s+["\']./filterUtils["\']', 'from "../utils/task/filter-compatibility"'),
|
||||
],
|
||||
'src/managers/task-manager.ts': [
|
||||
(r'from\s+["\']./taskUtil["\']', 'from "../utils/task/task-operations"'),
|
||||
(r'from\s+["\']./TaskParsingService["\']', 'from "../services/task-parsing-service"'),
|
||||
(r'from\s+["\']./fileTypeUtils["\']', 'from "../utils/file/file-type-detector"'),
|
||||
(r'from\s+["\']./workers/TaskIndexWorkerMessage["\']', 'from "../dataflow/workers/task-index-message"'),
|
||||
],
|
||||
|
||||
# Parsers
|
||||
'src/parsers/canvas-parser.ts': [
|
||||
(r'from\s+["\']../../dataflow/core/CanvasParser["\']', 'from "../dataflow/core/CanvasParser"'),
|
||||
],
|
||||
'src/parsers/canvas-task-updater.ts': [
|
||||
(r'from\s+["\']../../types/task["\']', 'from "../types/task"'),
|
||||
(r'from\s+["\']../../types/canvas["\']', 'from "../types/canvas"'),
|
||||
(r'from\s+["\']../../index["\']', 'from "../index"'),
|
||||
(r'from\s+["\']../taskUtil["\']', 'from "../utils/task/task-operations"'),
|
||||
],
|
||||
|
||||
# Services
|
||||
'src/services/task-parsing-service.ts': [
|
||||
(r'from\s+["\']./workers/FileMetadataTaskParser["\']', 'from "../parsers/file-metadata-parser"'),
|
||||
],
|
||||
|
||||
# Parsers internal imports
|
||||
'src/parsers/file-metadata-parser.ts': [
|
||||
(r'from\s+["\']../../utils/taskUtil["\']', 'from "../utils/task/task-operations"'),
|
||||
],
|
||||
'src/parsers/configurable-task-parser.ts': [
|
||||
(r'from\s+["\']../../utils/taskUtil["\']', 'from "../utils/task/task-operations"'),
|
||||
(r'from\s+["\']../../utils/dateUtil["\']', 'from "../utils/date/date-formatter"'),
|
||||
],
|
||||
'src/parsers/context-detector.ts': [
|
||||
(r'from\s+["\']../../utils/taskUtil["\']', 'from "../utils/task/task-operations"'),
|
||||
],
|
||||
}
|
||||
|
||||
def fix_imports_in_file(file_path, fixes):
|
||||
"""Apply specific import fixes to a file."""
|
||||
if not os.path.exists(file_path):
|
||||
print(f"Warning: File not found: {file_path}")
|
||||
return False
|
||||
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
original_content = content
|
||||
|
||||
for pattern, replacement in fixes:
|
||||
content = re.sub(pattern, replacement, content)
|
||||
|
||||
if content != original_content:
|
||||
with open(file_path, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
return True
|
||||
return False
|
||||
|
||||
def main():
|
||||
"""Main function to fix remaining imports."""
|
||||
updated_files = []
|
||||
|
||||
for file_path, fixes in REMAINING_FIXES.items():
|
||||
if fix_imports_in_file(file_path, fixes):
|
||||
updated_files.append(file_path)
|
||||
print(f"Fixed imports in: {file_path}")
|
||||
|
||||
print(f"\nTotal files with imports fixed: {len(updated_files)}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
* - Error handling and validation
|
||||
*/
|
||||
|
||||
import { ArchiveActionExecutor } from "../utils/onCompletion/ArchiveActionExecutor";
|
||||
import { ArchiveActionExecutor } from "../executors/completion/archive-executor";
|
||||
import {
|
||||
OnCompletionActionType,
|
||||
OnCompletionExecutionContext,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* - Task completion status enforcement
|
||||
*/
|
||||
|
||||
import { ArchiveActionExecutor } from "../utils/onCompletion/ArchiveActionExecutor";
|
||||
import { ArchiveActionExecutor } from "../executors/completion/archive-executor";
|
||||
import {
|
||||
OnCompletionExecutionContext,
|
||||
OnCompletionArchiveConfig,
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
import { TFile } from 'obsidian';
|
||||
import { isSupportedFile, isCanvasFile } from '../utils/fileTypeUtils';
|
||||
import { isSupportedFile, isCanvasFile } from '../utils/file/file-type-detector';
|
||||
import { CanvasData } from '../types/canvas';
|
||||
|
||||
// Mock TFile for testing
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
* Integration tests for Canvas file support
|
||||
*/
|
||||
|
||||
import { isSupportedFile, getFileType, SupportedFileType } from '../utils/fileTypeUtils';
|
||||
import { CanvasParser } from '../utils/parsing/CanvasParser';
|
||||
import { isSupportedFile, getFileType, SupportedFileType } from '../utils/file/file-type-detector';
|
||||
import { CanvasParser } from '../parsers/canvas-parser';
|
||||
import { getConfig } from '../common/task-parser-config';
|
||||
|
||||
// Mock TFile for testing
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Tests for Canvas file parsing functionality
|
||||
*/
|
||||
|
||||
import { CanvasParser } from '../utils/parsing/CanvasParser';
|
||||
import { CanvasParser } from '../parsers/canvas-parser';
|
||||
import { CanvasData, CanvasTextData } from '../types/canvas';
|
||||
import { getConfig } from '../common/task-parser-config';
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* - OnCompletion metadata scenarios
|
||||
*/
|
||||
|
||||
import { CanvasTaskUpdater } from "../utils/parsing/CanvasTaskUpdater";
|
||||
import { CanvasTaskUpdater } from "../parsers/canvas-task-updater";
|
||||
import { Task, CanvasTaskMetadata } from "../types/task";
|
||||
import { Vault } from "obsidian";
|
||||
import TaskProgressBarPlugin from "../index";
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* - Canvas data saving operations
|
||||
*/
|
||||
|
||||
import { CanvasTaskOperationUtils } from "../utils/onCompletion/CanvasTaskOperationUtils";
|
||||
import { CanvasTaskOperationUtils } from "../executors/completion/canvas-operation-utils";
|
||||
import { Task } from "../types/task";
|
||||
import { CanvasData, CanvasTextData } from "../types/canvas";
|
||||
import { createMockApp } from "./mockUtils";
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Tests for Canvas task updater functionality
|
||||
*/
|
||||
|
||||
import { CanvasTaskUpdater } from '../utils/parsing/CanvasTaskUpdater';
|
||||
import { CanvasTaskUpdater } from '../parsers/canvas-task-updater';
|
||||
import { Task, CanvasTaskMetadata } from '../types/task';
|
||||
import { CanvasData } from '../types/canvas';
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* - Error handling
|
||||
*/
|
||||
|
||||
import { CompleteActionExecutor } from "../utils/onCompletion/CompleteActionExecutor";
|
||||
import { CompleteActionExecutor } from "../executors/completion/complete-executor";
|
||||
import {
|
||||
OnCompletionActionType,
|
||||
OnCompletionExecutionContext,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* - Canvas file structure integrity
|
||||
*/
|
||||
|
||||
import { DeleteActionExecutor } from "../utils/onCompletion/DeleteActionExecutor";
|
||||
import { DeleteActionExecutor } from "../executors/completion/delete-executor";
|
||||
import {
|
||||
OnCompletionActionType,
|
||||
OnCompletionExecutionContext,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
* - Error handling
|
||||
*/
|
||||
|
||||
import { DeleteActionExecutor } from "../utils/onCompletion/DeleteActionExecutor";
|
||||
import { DeleteActionExecutor } from "../executors/completion/delete-executor";
|
||||
import {
|
||||
OnCompletionActionType,
|
||||
OnCompletionExecutionContext,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* - Cross-format task duplication
|
||||
*/
|
||||
|
||||
import { DuplicateActionExecutor } from "../utils/onCompletion/DuplicateActionExecutor";
|
||||
import { DuplicateActionExecutor } from "../executors/completion/duplicate-executor";
|
||||
import {
|
||||
OnCompletionActionType,
|
||||
OnCompletionExecutionContext,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { FileFilterManager } from "../utils/FileFilterManager";
|
||||
import { FileFilterManager } from "../managers/file-filter-manager";
|
||||
import { FilterMode } from "../common/setting-definition";
|
||||
import { FileFilterSettings } from "../common/setting-definition";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
* Tests for FileMetadataTaskParser and FileMetadataTaskUpdater
|
||||
*/
|
||||
|
||||
import { FileMetadataTaskParser } from "../utils/workers/FileMetadataTaskParser";
|
||||
import { FileMetadataTaskUpdater } from "../utils/workers/FileMetadataTaskUpdater";
|
||||
import { FileMetadataTaskParser } from "../parsers/file-metadata-parser";
|
||||
import { FileMetadataTaskUpdater } from "../parsers/file-metadata-updater";
|
||||
import { FileParsingConfiguration } from "../common/setting-definition";
|
||||
import { StandardFileTaskMetadata, Task } from "../types/task";
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* - Error handling and validation
|
||||
*/
|
||||
|
||||
import { MoveActionExecutor } from "../utils/onCompletion/MoveActionExecutor";
|
||||
import { MoveActionExecutor } from "../executors/completion/move-executor";
|
||||
import {
|
||||
OnCompletionActionType,
|
||||
OnCompletionExecutionContext,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
* - Error handling
|
||||
*/
|
||||
|
||||
import { MoveActionExecutor } from "../utils/onCompletion/MoveActionExecutor";
|
||||
import { MoveActionExecutor } from "../executors/completion/move-executor";
|
||||
import {
|
||||
OnCompletionActionType,
|
||||
OnCompletionExecutionContext,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* - Error handling and validation
|
||||
*/
|
||||
|
||||
import { OnCompletionManager } from "../utils/OnCompletionManager";
|
||||
import { OnCompletionManager } from "../managers/completion-manager";
|
||||
import {
|
||||
OnCompletionActionType,
|
||||
OnCompletionConfig,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Performance tests for ProjectConfigManager cache optimizations
|
||||
*/
|
||||
|
||||
import { ProjectConfigManager, ProjectConfigManagerOptions } from "../utils/ProjectConfigManager";
|
||||
import { ProjectConfigManager, ProjectConfigManagerOptions } from "../managers/project-config-manager";
|
||||
import { TFile, Vault, MetadataCache } from "obsidian";
|
||||
|
||||
// Mock implementations
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import {
|
|||
ProjectConfigManagerOptions,
|
||||
MetadataMapping,
|
||||
ProjectNamingStrategy,
|
||||
} from "../utils/ProjectConfigManager";
|
||||
} from "../managers/project-config-manager";
|
||||
|
||||
// Mock Obsidian types
|
||||
class MockTFile {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
import { ProjectDataWorkerManager } from "../dataflow/workers/ProjectDataWorkerManager";
|
||||
import { ProjectConfigManager } from "../utils/ProjectConfigManager";
|
||||
import { ProjectConfigManager } from "../managers/project-config-manager";
|
||||
import { Vault, MetadataCache } from "obsidian";
|
||||
|
||||
// Mock the worker
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
import {
|
||||
ProjectConfigManager,
|
||||
ProjectConfigManagerOptions,
|
||||
} from "../utils/ProjectConfigManager";
|
||||
} from "../managers/project-config-manager";
|
||||
|
||||
// Mock Obsidian types
|
||||
class MockTFile {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { QuickCaptureModal } from "../components/QuickCaptureModal";
|
||||
import { DEFAULT_TIME_PARSING_CONFIG } from "../utils/TimeParsingService";
|
||||
import { DEFAULT_TIME_PARSING_CONFIG } from "../services/time-parsing-service";
|
||||
import { App } from "obsidian";
|
||||
|
||||
// Mock dependencies
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
import { MarkdownTaskParser } from "../dataflow/core/ConfigurableTaskParser";
|
||||
import { getConfig } from "../common/task-parser-config";
|
||||
import { createMockPlugin } from "./mockUtils";
|
||||
import { ContextDetector } from "../utils/workers/ContextDetector";
|
||||
import { ContextDetector } from "../parsers/context-detector";
|
||||
|
||||
describe("Tag Parsing Edge Cases", () => {
|
||||
let parser: MarkdownTaskParser;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* Tests for TaskIndexer mtime-based caching functionality
|
||||
*/
|
||||
|
||||
import { TaskIndexer } from "../utils/import/TaskIndexer";
|
||||
import { TaskIndexer } from "../core/task-indexer";
|
||||
import { Task } from "../types/task";
|
||||
|
||||
// Mock obsidian Component class
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
import {
|
||||
TaskParsingService,
|
||||
TaskParsingServiceOptions,
|
||||
} from "../utils/TaskParsingService";
|
||||
} from "../services/task-parsing-service";
|
||||
import { TaskParserConfig, MetadataParseMode } from "../types/TaskParserConfig";
|
||||
import { Task, TgProject } from "../types/task";
|
||||
|
||||
|
|
@ -1285,7 +1285,7 @@ describe("TaskParsingService Integration", () => {
|
|||
|
||||
// Clear cache before test
|
||||
const { MarkdownTaskParser } = await import(
|
||||
"../utils/workers/ConfigurableTaskParser"
|
||||
"../parsers/configurable-task-parser"
|
||||
);
|
||||
MarkdownTaskParser.clearDateCache();
|
||||
|
||||
|
|
@ -1335,7 +1335,7 @@ describe("TaskParsingService Integration", () => {
|
|||
|
||||
it("should handle date cache size limit correctly", async () => {
|
||||
const { MarkdownTaskParser } = await import(
|
||||
"../utils/workers/ConfigurableTaskParser"
|
||||
"../parsers/configurable-task-parser"
|
||||
);
|
||||
|
||||
// Clear cache before test
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { TaskTimerManager, TimerState, TimeSegment } from "../utils/TaskTimerManager";
|
||||
import { TaskTimerManager, TimerState, TimeSegment } from "../managers/timer-manager";
|
||||
import { TaskTimerSettings } from "../common/setting-definition";
|
||||
|
||||
// Mock localStorage
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
import { TaskWorkerManager } from "../dataflow/workers/TaskWorkerManager";
|
||||
import { TaskIndexer } from "../utils/import/TaskIndexer";
|
||||
import { TaskIndexer } from "../core/task-indexer";
|
||||
import { TFile } from "obsidian";
|
||||
|
||||
// Mock dependencies
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import {
|
|||
TimeParsingService,
|
||||
DEFAULT_TIME_PARSING_CONFIG,
|
||||
LineParseResult,
|
||||
} from "../utils/TimeParsingService";
|
||||
} from "../services/time-parsing-service";
|
||||
|
||||
describe("TimeParsingService", () => {
|
||||
let service: TimeParsingService;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { Task, CanvasTaskMetadata } from "../types/task";
|
||||
import { CanvasTaskUpdater } from "../utils/parsing/CanvasTaskUpdater";
|
||||
import { CanvasTaskUpdater } from "../parsers/canvas-task-updater";
|
||||
import { CanvasData } from "../types/canvas";
|
||||
|
||||
// Mock Vault and TFile (same as CanvasTaskUpdater.test.ts)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { processDateTemplates } from "../utils/fileUtils";
|
||||
import { processDateTemplates } from "../utils/file/file-operations";
|
||||
|
||||
// Mock moment function to return predictable results
|
||||
jest.mock("obsidian", () => ({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { getTodayLocalDateString, getLocalDateString } from "../utils/dateUtil";
|
||||
import { getTodayLocalDateString, getLocalDateString } from "../utils/date/date-formatter";
|
||||
|
||||
describe("dateUtil", () => {
|
||||
describe("getTodayLocalDateString", () => {
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
* This test focuses on testing the cache clearing logic without mocking the full TaskManager
|
||||
*/
|
||||
|
||||
import { TaskParsingService } from "../utils/TaskParsingService";
|
||||
import { ProjectConfigManager } from "../utils/ProjectConfigManager";
|
||||
import { TaskParsingService } from "../services/task-parsing-service";
|
||||
import { ProjectConfigManager } from "../managers/project-config-manager";
|
||||
import { getConfig } from "../common/task-parser-config";
|
||||
|
||||
// Mock Obsidian components
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
* Tests for real-world ICS parsing using Chinese Lunar Calendar data
|
||||
*/
|
||||
|
||||
import { IcsParser } from "../utils/ics/IcsParser";
|
||||
import { IcsManager } from "../utils/ics/IcsManager";
|
||||
import { IcsParser } from "../parsers/ics-parser";
|
||||
import { IcsManager } from "../managers/ics-manager";
|
||||
import { IcsSource, IcsManagerConfig } from "../types/ics";
|
||||
|
||||
// Mock Obsidian Component
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Tests for managing ICS calendar sources and fetching data
|
||||
*/
|
||||
|
||||
import { IcsManager } from "../utils/ics/IcsManager";
|
||||
import { IcsManager } from "../managers/ics-manager";
|
||||
import { IcsSource, IcsManagerConfig } from "../types/ics";
|
||||
|
||||
// Mock minimal settings for testing
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Tests for optimized parsing performance
|
||||
*/
|
||||
|
||||
import { IcsParser } from "../utils/ics/IcsParser";
|
||||
import { IcsParser } from "../parsers/ics-parser";
|
||||
import { IcsSource } from "../types/ics";
|
||||
|
||||
describe("ICS Parser Performance", () => {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Tests for parsing Chinese Lunar Calendar ICS data
|
||||
*/
|
||||
|
||||
import { IcsParser } from "../utils/ics/IcsParser";
|
||||
import { IcsParser } from "../parsers/ics-parser";
|
||||
import { IcsSource, IcsEvent } from "../types/ics";
|
||||
|
||||
describe("ICS Parser", () => {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Tests to verify that the ICS network timeout and non-blocking UI fixes work correctly
|
||||
*/
|
||||
|
||||
import { IcsManager } from "../utils/ics/IcsManager";
|
||||
import { IcsManager } from "../managers/ics-manager";
|
||||
import { IcsManagerConfig } from "../types/ics";
|
||||
|
||||
// Mock moment.js
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* from settings to actual task indexing behavior.
|
||||
*/
|
||||
|
||||
import { FileFilterManager } from '../../utils/FileFilterManager';
|
||||
import { FileFilterManager } from '../../managers/file-filter-manager';
|
||||
import { FilterMode, FileFilterSettings } from '../../common/setting-definition';
|
||||
|
||||
// Mock TFile and TFolder for testing
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* - Performance considerations
|
||||
*/
|
||||
|
||||
import { OnCompletionManager } from "../utils/OnCompletionManager";
|
||||
import { OnCompletionManager } from "../managers/completion-manager";
|
||||
import { Task } from "../types/task";
|
||||
import { createMockPlugin, createMockApp } from "./mockUtils";
|
||||
import { OnCompletionActionType } from "../types/onCompletion";
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
getAllDescendants,
|
||||
getExpandedPaths,
|
||||
restoreExpandedState
|
||||
} from '../utils/projectTreeBuilder';
|
||||
} from '../core/project-tree-builder';
|
||||
import { TreeNode, ProjectNodeData } from '../types/tree';
|
||||
import { Task } from '../types/task';
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
getEffectiveProject,
|
||||
isProjectReadonly,
|
||||
hasProject,
|
||||
} from "../utils/taskUtil";
|
||||
} from "../utils/task/task-operations";
|
||||
import { Task } from "../types/task";
|
||||
import { TgProject } from "../types/task";
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ Just regular text content`;
|
|||
});
|
||||
|
||||
// Debug: Test parseTaskLine directly
|
||||
const { parseTaskLine } = require("../utils/taskUtil");
|
||||
const { parseTaskLine } = require("../utils/task/task-operations");
|
||||
const testLine = "- [ ] Task A 📅 2025-01-01";
|
||||
const parsedTask = parseTaskLine(
|
||||
"test.md",
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* These tests verify the global view mode configuration feature
|
||||
*/
|
||||
|
||||
import { getDefaultViewMode, getSavedViewMode, saveViewMode, getInitialViewMode } from '../utils/viewModeUtils';
|
||||
import { getDefaultViewMode, getSavedViewMode, saveViewMode, getInitialViewMode } from '../utils/ui/view-mode-utils';
|
||||
|
||||
// Mock Obsidian App
|
||||
class MockApp {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* Tests for webcal URL conversion and integration functionality
|
||||
*/
|
||||
|
||||
import { WebcalUrlConverter } from "../utils/ics/WebcalUrlConverter";
|
||||
import { WebcalUrlConverter } from "../parsers/webcal-converter";
|
||||
|
||||
describe("WebcalUrlConverter", () => {
|
||||
describe("convertWebcalUrl", () => {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {
|
|||
createWorkflowStartingTask,
|
||||
convertCurrentTaskToWorkflowRoot,
|
||||
suggestWorkflowFromExisting,
|
||||
} from "../utils/workflowConversion";
|
||||
} from "../core/workflow-converter";
|
||||
import { WorkflowProgressIndicator } from "../components/WorkflowProgressIndicator";
|
||||
import { createMockPlugin, createMockApp } from "./mockUtils";
|
||||
import { WorkflowDefinition } from "../common/setting-definition";
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { TgProject } from "../types/task";
|
|||
import {
|
||||
ProjectConfigData,
|
||||
ProjectConfigManager,
|
||||
} from "./ProjectConfigManager";
|
||||
} from "../managers/project-config-manager";
|
||||
|
||||
export interface CachedProjectData {
|
||||
tgProject?: TgProject;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { EditorView } from "@codemirror/view";
|
||||
import { Notice } from "obsidian";
|
||||
import { parseTaskLine, MetadataFormat } from "../utils/taskUtil";
|
||||
import { parseTaskLine, MetadataFormat } from "../utils/task/task-operations";
|
||||
import { Task as IndexerTask } from "../types/task";
|
||||
import TaskProgressBarPlugin from "../index";
|
||||
import {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
import TaskProgressBarPlugin from "../index";
|
||||
import { buildIndentString } from "../utils";
|
||||
import { t } from "../translations/helper";
|
||||
import { isSupportedFile } from "../utils/fileTypeUtils";
|
||||
import { isSupportedFile } from "../utils/file/file-type-detector";
|
||||
|
||||
/**
|
||||
* Modal for selecting a target file to move tasks to
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
createWorkflowStartingTask,
|
||||
convertCurrentTaskToWorkflowRoot,
|
||||
suggestWorkflowFromExisting,
|
||||
} from "../utils/workflowConversion";
|
||||
} from "../core/workflow-converter";
|
||||
import { t } from "../translations/helper";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import type TaskProgressBarPlugin from "../index"; // Type-only import
|
|||
import { BaseHabitData } from "../types/habit-card";
|
||||
import type { RootFilterState } from "../components/task-filter/ViewTaskFilter";
|
||||
import { IcsManagerConfig } from "../types/ics";
|
||||
import { TimeParsingConfig } from "../utils/TimeParsingService";
|
||||
import { TimeParsingConfig } from "../services/time-parsing-service";
|
||||
|
||||
// Interface for individual project review settings (If still needed, otherwise remove)
|
||||
// Keep it for now, in case it's used elsewhere, but it's not part of TaskProgressBarSettings anymore
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { MetadataParseMode, TaskParserConfig } from "../types/TaskParserConfig";
|
||||
import { MetadataFormat } from "../utils/taskUtil";
|
||||
import { MetadataFormat } from "../utils/task/task-operations";
|
||||
import type TaskProgressBarPlugin from "../index";
|
||||
|
||||
export const getConfig = (
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
EmbeddableMarkdownEditor,
|
||||
} from "../editor-ext/markdownEditor";
|
||||
import TaskProgressBarPlugin from "../index";
|
||||
import { saveCapture } from "../utils/fileUtils";
|
||||
import { saveCapture } from "../utils/file/file-operations";
|
||||
import { t } from "../translations/helper";
|
||||
import { MinimalQuickCaptureSuggest } from "./MinimalQuickCaptureSuggest";
|
||||
import { DatePickerPopover } from "./date-picker/DatePickerPopover";
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
EmbeddableMarkdownEditor,
|
||||
} from "../editor-ext/markdownEditor";
|
||||
import TaskProgressBarPlugin from "../index";
|
||||
import { saveCapture, processDateTemplates } from "../utils/fileUtils";
|
||||
import { saveCapture, processDateTemplates } from "../utils/file/file-operations";
|
||||
import { FileSuggest } from "../components/AutoComplete";
|
||||
import { t } from "../translations/helper";
|
||||
import { MarkdownRendererComponent } from "./MarkdownRenderer";
|
||||
|
|
@ -25,7 +25,7 @@ import {
|
|||
DEFAULT_TIME_PARSING_CONFIG,
|
||||
ParsedTimeResult,
|
||||
LineParseResult,
|
||||
} from "../utils/TimeParsingService";
|
||||
} from "../services/time-parsing-service";
|
||||
import { SuggestManager, UniversalEditorSuggest } from "./suggest";
|
||||
|
||||
interface TaskMetadata {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { type Task } from "../../types/task";
|
|||
import "../../styles/gantt/gantt.css";
|
||||
|
||||
// Import new components and helpers
|
||||
import { DateHelper } from "../../utils/DateHelper";
|
||||
import { DateHelper } from "../../utils/date/date-helper";
|
||||
import { TimelineHeaderComponent } from "./timeline-header";
|
||||
import { GridBackgroundComponent } from "./grid-background";
|
||||
import { TaskRendererComponent } from "./task-renderer";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, App } from "obsidian";
|
||||
import { GanttTaskItem, Timescale, PlacedGanttTaskItem } from "./gantt"; // Correctly imports PlacedGanttTaskItem now
|
||||
import { DateHelper } from "../../utils/DateHelper"; // Corrected import path again
|
||||
import { DateHelper } from "../../utils/date/date-helper"; // Corrected import path again
|
||||
|
||||
// Interface for parameters needed by the grid component
|
||||
interface GridBackgroundParams {
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import {
|
|||
import { GanttTaskItem, PlacedGanttTaskItem, Timescale } from "./gantt"; // 添加PlacedGanttTaskItem导入
|
||||
import { Task } from "../../types/task";
|
||||
import { MarkdownRendererComponent } from "../MarkdownRenderer";
|
||||
import { sanitizePriorityForClass } from "../../utils/priorityUtils";
|
||||
import { sanitizePriorityForClass } from "../../utils/task/priority-utils";
|
||||
|
||||
// Constants from GanttComponent (consider moving to a shared config/constants file)
|
||||
const ROW_HEIGHT = 24;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, App } from "obsidian";
|
||||
import { Timescale } from "./gantt"; // Assuming types are exported or moved
|
||||
import { DateHelper } from "../../utils/DateHelper"; // Assuming DateHelper exists
|
||||
import { DateHelper } from "../../utils/date/date-helper"; // Assuming DateHelper exists
|
||||
|
||||
// Interface for parameters needed by the header component
|
||||
interface TimelineHeaderParams {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { CountHabitProps } from "../../../types/habit-card";
|
|||
import { HabitCard } from "./habitcard";
|
||||
import { t } from "../../../translations/helper";
|
||||
import TaskProgressBarPlugin from "../../../index";
|
||||
import { getTodayLocalDateString } from "../../../utils/dateUtil";
|
||||
import { getTodayLocalDateString } from "../../../utils/date/date-formatter";
|
||||
|
||||
export class CountHabitCard extends HabitCard {
|
||||
constructor(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { DailyHabitProps } from "../../../types/habit-card";
|
|||
import { HabitCard } from "./habitcard";
|
||||
import { t } from "../../../translations/helper";
|
||||
import TaskProgressBarPlugin from "../../../index";
|
||||
import { getTodayLocalDateString } from "../../../utils/dateUtil";
|
||||
import { getTodayLocalDateString } from "../../../utils/date/date-formatter";
|
||||
|
||||
export class DailyHabitCard extends HabitCard {
|
||||
constructor(
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import {
|
|||
MappingHabitProps,
|
||||
} from "../../../types/habit-card";
|
||||
import TaskProgressBarPlugin from "../../../index";
|
||||
import { getTodayLocalDateString, getLocalDateString } from "../../../utils/dateUtil";
|
||||
import { getTodayLocalDateString, getLocalDateString } from "../../../utils/date/date-formatter";
|
||||
|
||||
function getDatesInRange(startDate: string, endDate: string): string[] {
|
||||
const dates = [];
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
import { MappingHabitProps } from "../../../types/habit-card";
|
||||
import { HabitCard } from "./habitcard";
|
||||
import TaskProgressBarPlugin from "../../../index";
|
||||
import { getTodayLocalDateString } from "../../../utils/dateUtil";
|
||||
import { getTodayLocalDateString } from "../../../utils/date/date-formatter";
|
||||
|
||||
export class MappingHabitCard extends HabitCard {
|
||||
constructor(
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { HabitCard } from "./habitcard";
|
|||
import TaskProgressBarPlugin from "../../../index";
|
||||
import { t } from "../../../translations/helper";
|
||||
import { EventDetailModal } from "../habit";
|
||||
import { getTodayLocalDateString } from "../../../utils/dateUtil";
|
||||
import { getTodayLocalDateString } from "../../../utils/date/date-formatter";
|
||||
|
||||
function renderPieDotSVG(completed: number, total: number): string {
|
||||
if (total <= 0) return "";
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@ import { MarkdownRendererComponent } from "../MarkdownRenderer"; // Adjust path
|
|||
import TaskProgressBarPlugin from "../../index"; // Adjust path
|
||||
import { KanbanSpecificConfig } from "../../common/setting-definition";
|
||||
import { createTaskCheckbox } from "../task-view/details";
|
||||
import { getEffectiveProject } from "../../utils/taskUtil";
|
||||
import { sanitizePriorityForClass } from "../../utils/priorityUtils";
|
||||
import { getEffectiveProject } from "../../utils/task/task-operations";
|
||||
import { sanitizePriorityForClass } from "../../utils/task/priority-utils";
|
||||
|
||||
export class KanbanCardComponent extends Component {
|
||||
public element: HTMLElement;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import {
|
|||
KanbanSpecificConfig,
|
||||
KanbanColumnConfig,
|
||||
} from "../../common/setting-definition";
|
||||
import { getEffectiveProject, isProjectReadonly } from "../../utils/taskUtil";
|
||||
import { getEffectiveProject, isProjectReadonly } from "../../utils/task/task-operations";
|
||||
|
||||
// CSS classes for drop indicators
|
||||
const DROP_INDICATOR_BEFORE_CLASS = "tg-kanban-card--drop-indicator-before";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
OnboardingConfig,
|
||||
OnboardingConfigManager,
|
||||
} from "../../utils/OnboardingConfigManager";
|
||||
} from "../../managers/onboarding-manager";
|
||||
import { t } from "../../translations/helper";
|
||||
import { setIcon } from "obsidian";
|
||||
import type TaskProgressBarPlugin from "../../index";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { OnboardingConfig } from "../../utils/OnboardingConfigManager";
|
||||
import { OnboardingConfig } from "../../managers/onboarding-manager";
|
||||
import { t } from "../../translations/helper";
|
||||
import { setIcon } from "obsidian";
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import {
|
|||
OnboardingConfigManager,
|
||||
OnboardingConfigMode,
|
||||
OnboardingConfig,
|
||||
} from "../../utils/OnboardingConfigManager";
|
||||
} from "../../managers/onboarding-manager";
|
||||
import { UserLevelSelector } from "./UserLevelSelector";
|
||||
import { ConfigPreview } from "./ConfigPreview";
|
||||
import { TaskCreationGuide } from "./TaskCreationGuide";
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import {
|
|||
OnboardingConfigManager,
|
||||
OnboardingConfigMode,
|
||||
OnboardingConfig,
|
||||
} from "../../utils/OnboardingConfigManager";
|
||||
import { SettingsChangeDetector } from "../../utils/SettingsChangeDetector";
|
||||
} from "../../managers/onboarding-manager";
|
||||
import { SettingsChangeDetector } from "../../services/settings-change-detector";
|
||||
import { UserLevelSelector } from "./UserLevelSelector";
|
||||
import { ConfigPreview } from "./ConfigPreview";
|
||||
import { TaskCreationGuide } from "./TaskCreationGuide";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
OnboardingConfigManager,
|
||||
OnboardingConfig,
|
||||
} from "../../utils/OnboardingConfigManager";
|
||||
} from "../../managers/onboarding-manager";
|
||||
import { t } from "../../translations/helper";
|
||||
import { setIcon } from "obsidian";
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { Task } from "../../types/task";
|
|||
import { createTaskCheckbox } from "../task-view/details";
|
||||
import { MarkdownRendererComponent } from "../MarkdownRenderer";
|
||||
import { t } from "../../translations/helper";
|
||||
import { sanitizePriorityForClass } from "../../utils/priorityUtils";
|
||||
import { sanitizePriorityForClass } from "../../utils/task/priority-utils";
|
||||
|
||||
export class QuadrantCardComponent extends Component {
|
||||
plugin: TaskProgressBarPlugin;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
checkIfParentElementHasGoalFormat,
|
||||
extractTaskAndGoalInfoReadMode,
|
||||
getCustomTotalGoalReadMode,
|
||||
} from "../utils/goal/readMode";
|
||||
} from "../core/goal/read-mode";
|
||||
|
||||
interface GroupElement {
|
||||
parentElement: HTMLElement;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import {
|
|||
TFile,
|
||||
} from "obsidian";
|
||||
import { getTasksAPI } from "../utils";
|
||||
import { parseTaskLine } from "../utils/taskUtil";
|
||||
import { parseTaskLine } from "../utils/task/task-operations";
|
||||
|
||||
// This component replaces standard checkboxes with custom text marks in reading view
|
||||
export function applyTaskTextMarks({
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ import {
|
|||
import { t } from "../../translations/helper";
|
||||
import TaskProgressBarPlugin from "../../index";
|
||||
import "../../styles/ics-settings.css";
|
||||
import { HolidayDetector } from "../../utils/ics/HolidayDetector";
|
||||
import { WebcalUrlConverter } from "../../utils/ics/WebcalUrlConverter";
|
||||
import { HolidayDetector } from "../../parsers/holiday-detector";
|
||||
import { WebcalUrlConverter } from "../../parsers/webcal-converter";
|
||||
|
||||
export class IcsSettingsComponent {
|
||||
private plugin: TaskProgressBarPlugin;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { App, Modal, Setting } from "obsidian";
|
|||
import { t } from "../../translations/helper";
|
||||
import { TaskProgressBarSettingTab } from "../../setting";
|
||||
import { migrateOldFilterOptions } from "../../editor-ext/filterTasks";
|
||||
import { generateUniqueId } from "../../utils/common";
|
||||
import { generateUniqueId } from "../../utils/id-generator";
|
||||
|
||||
class PresetFilterModal extends Modal {
|
||||
constructor(app: App, private preset: any, private onSave: () => void) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { Setting, Modal } from "obsidian";
|
|||
import { t } from "../../translations/helper";
|
||||
import { TaskProgressBarSettingTab } from "../../setting";
|
||||
import { WorkflowDefinitionModal } from "../WorkflowDefinitionModal";
|
||||
import { generateUniqueId } from "src/utils/common";
|
||||
import { generateUniqueId } from "../../utils/id-generator";
|
||||
|
||||
export function renderWorkflowSettingsTab(
|
||||
settingTab: TaskProgressBarSettingTab,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { DatePickerPopover } from "../date-picker/DatePickerPopover";
|
|||
import type TaskProgressBarPlugin from "../../index";
|
||||
import { ContextSuggest, ProjectSuggest, TagSuggest } from "../AutoComplete";
|
||||
import { clearAllMarks } from "../MarkdownRenderer";
|
||||
import { getEffectiveProject, isProjectReadonly } from "../../utils/taskUtil";
|
||||
import { getEffectiveProject, isProjectReadonly } from "../../utils/task/task-operations";
|
||||
|
||||
// Cache for autocomplete data to avoid repeated expensive operations
|
||||
interface AutoCompleteCache {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { TreeManager } from "./TreeManager";
|
|||
import { VirtualScrollManager } from "./VirtualScrollManager";
|
||||
import { TableHeader, TableHeaderCallbacks } from "./TableHeader";
|
||||
import { sortTasks } from "../../commands/sortTaskCommands";
|
||||
import { isProjectReadonly } from "../../utils/taskUtil";
|
||||
import { isProjectReadonly } from "../../utils/task/task-operations";
|
||||
import "../../styles/table.css";
|
||||
|
||||
export interface TableViewCallbacks {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import { t } from "../../translations/helper";
|
|||
import { ProjectSuggest, TagSuggest, ContextSuggest } from "../AutoComplete";
|
||||
import { StatusComponent } from "../StatusComponent";
|
||||
import { format } from "date-fns";
|
||||
import { getEffectiveProject, isProjectReadonly } from "../../utils/taskUtil";
|
||||
import { getEffectiveProject, isProjectReadonly } from "../../utils/task/task-operations";
|
||||
import { OnCompletionConfigurator } from "../onCompletion/OnCompletionConfigurator";
|
||||
|
||||
export interface MetadataChangeEvent {
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import {
|
|||
EmbeddableMarkdownEditor,
|
||||
} from "../../editor-ext/markdownEditor";
|
||||
import "../../styles/inline-editor.css";
|
||||
import { getEffectiveProject, isProjectReadonly } from "../../utils/taskUtil";
|
||||
import { getEffectiveProject, isProjectReadonly } from "../../utils/task/task-operations";
|
||||
import { t } from "../../translations/helper";
|
||||
import { sanitizePriorityForClass } from "../../utils/priorityUtils";
|
||||
import { sanitizePriorityForClass } from "../../utils/task/priority-utils";
|
||||
|
||||
export interface InlineEditorOptions {
|
||||
onTaskUpdate: (task: Task, updatedTask: Task) => Promise<void>;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import {
|
|||
buildProjectTreeFromTasks,
|
||||
findNodeByPath,
|
||||
getAllDescendants
|
||||
} from "../../utils/projectTreeBuilder";
|
||||
} from "../../core/project-tree-builder";
|
||||
import { t } from "../../translations/helper";
|
||||
import TaskProgressBarPlugin from "../../index";
|
||||
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ import TaskProgressBarPlugin from "../../index";
|
|||
import { TwoColumnViewBase, TwoColumnViewConfig } from "./TwoColumnViewBase";
|
||||
import { ProjectTreeComponent } from "./ProjectTreeComponent";
|
||||
import { TreeNode, ProjectNodeData } from "../../types/tree";
|
||||
import { buildProjectTreeFromTasks, findNodeByPath } from "../../utils/projectTreeBuilder";
|
||||
import { filterTasksByProjectPaths } from "../../utils/projectFilter";
|
||||
import { getEffectiveProject } from "../../utils/taskUtil";
|
||||
import { buildProjectTreeFromTasks, findNodeByPath } from "../../core/project-tree-builder";
|
||||
import { filterTasksByProjectPaths } from "../../core/project-filter";
|
||||
import { getEffectiveProject } from "../../utils/task/task-operations";
|
||||
|
||||
export class ProjectViewComponent extends TwoColumnViewBase<string> {
|
||||
// 特定于项目视图的状态
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { App, Component } from "obsidian";
|
|||
import { Task } from "../../types/task";
|
||||
import { TaskListItemComponent } from "./listItem";
|
||||
import { TaskTreeItemComponent } from "./treeItem";
|
||||
import { tasksToTree } from "../../utils/treeViewUtil";
|
||||
import { tasksToTree } from "../../utils/ui/tree-view-utils";
|
||||
import { t } from "../../translations/helper";
|
||||
import TaskProgressBarPlugin from "../../index";
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { t } from "../../translations/helper";
|
|||
import TaskProgressBarPlugin from "../../index";
|
||||
import { TwoColumnSpecificConfig } from "../../common/setting-definition";
|
||||
import "../../styles/property-view.css";
|
||||
import { getEffectiveProject } from "../../utils/taskUtil";
|
||||
import { getEffectiveProject } from "../../utils/task/task-operations";
|
||||
|
||||
/**
|
||||
* A two-column view that displays task properties in the left column
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { Task } from "../../types/task";
|
|||
import { TaskListRendererComponent } from "./TaskList";
|
||||
import { t } from "../../translations/helper";
|
||||
import TaskProgressBarPlugin from "../../index";
|
||||
import { getInitialViewMode, saveViewMode } from "../../utils/viewModeUtils";
|
||||
import { getInitialViewMode, saveViewMode } from "../../utils/ui/view-mode-utils";
|
||||
import "../../styles/view.css";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ import {
|
|||
getViewSettingOrDefault,
|
||||
SortCriterion,
|
||||
} from "../../common/setting-definition"; // 导入 SortCriterion
|
||||
import { tasksToTree } from "../../utils/treeViewUtil"; // Re-import needed utils
|
||||
import { tasksToTree } from "../../utils/ui/tree-view-utils"; // Re-import needed utils
|
||||
import { TaskTreeItemComponent } from "./treeItem"; // Re-import needed components
|
||||
import { t } from "../../translations/helper";
|
||||
import TaskProgressBarPlugin from "../../index";
|
||||
import { getInitialViewMode, saveViewMode } from "../../utils/viewModeUtils";
|
||||
import { getInitialViewMode, saveViewMode } from "../../utils/ui/view-mode-utils";
|
||||
|
||||
// @ts-ignore
|
||||
import { filterTasks } from "../../utils/TaskFilterUtils";
|
||||
import { filterTasks } from "../../utils/task/task-filter-utils";
|
||||
import { sortTasks } from "../../commands/sortTaskCommands"; // 导入 sortTasks 函数
|
||||
|
||||
interface ContentComponentParams {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ import { clearAllMarks } from "../MarkdownRenderer";
|
|||
import { StatusComponent } from "../StatusComponent";
|
||||
import { ContextSuggest, ProjectSuggest, TagSuggest } from "../AutoComplete";
|
||||
import { FileTask } from "../../types/file-task";
|
||||
import { getEffectiveProject, isProjectReadonly } from "../../utils/taskUtil";
|
||||
import { getEffectiveProject, isProjectReadonly } from "../../utils/task/task-operations";
|
||||
import { OnCompletionConfigurator } from "../onCompletion/OnCompletionConfigurator";
|
||||
|
||||
function getStatus(task: Task, settings: TaskProgressBarSettings) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import { TaskListRendererComponent } from "./TaskList";
|
|||
import TaskProgressBarPlugin from "../../index";
|
||||
import { ForecastSpecificConfig } from "../../common/setting-definition";
|
||||
import { sortTasks } from "../../commands/sortTaskCommands"; // 导入 sortTasks 函数
|
||||
import { getInitialViewMode, saveViewMode } from "../../utils/viewModeUtils";
|
||||
import { getInitialViewMode, saveViewMode } from "../../utils/ui/view-mode-utils";
|
||||
|
||||
interface DateSection {
|
||||
title: string;
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@ import { Task } from "../../types/task";
|
|||
import { MarkdownRendererComponent } from "../MarkdownRenderer";
|
||||
import "../../styles/task-list.css";
|
||||
import { createTaskCheckbox } from "./details";
|
||||
import { getRelativeTimeString } from "../../utils/dateUtil";
|
||||
import { getRelativeTimeString } from "../../utils/date/date-formatter";
|
||||
import { t } from "../../translations/helper";
|
||||
import TaskProgressBarPlugin from "../../index";
|
||||
import { TaskProgressBarSettings } from "../../common/setting-definition";
|
||||
import { InlineEditor, InlineEditorOptions } from "./InlineEditor";
|
||||
import { InlineEditorManager } from "./InlineEditorManager";
|
||||
import { sanitizePriorityForClass } from "../../utils/priorityUtils";
|
||||
import { sanitizePriorityForClass } from "../../utils/task/priority-utils";
|
||||
|
||||
export class TaskListItemComponent extends Component {
|
||||
public element: HTMLElement;
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ import "../../styles/project-tree.css";
|
|||
import { TaskListRendererComponent } from "./TaskList";
|
||||
import TaskProgressBarPlugin from "../../index";
|
||||
import { sortTasks } from "../../commands/sortTaskCommands";
|
||||
import { getEffectiveProject } from "../../utils/taskUtil";
|
||||
import { getInitialViewMode, saveViewMode } from "../../utils/viewModeUtils";
|
||||
import { getEffectiveProject } from "../../utils/task/task-operations";
|
||||
import { getInitialViewMode, saveViewMode } from "../../utils/ui/view-mode-utils";
|
||||
import { ProjectTreeComponent } from "./ProjectTreeComponent";
|
||||
import { buildProjectTree } from "../../utils/projectTreeBuilder";
|
||||
import { buildProjectTree } from "../../core/project-tree-builder";
|
||||
import { TreeNode, ProjectNodeData } from "../../types/tree";
|
||||
import { filterTasksByProjectPaths } from "../../utils/projectFilter";
|
||||
import { filterTasksByProjectPaths } from "../../core/project-filter";
|
||||
|
||||
interface SelectedProjects {
|
||||
projects: string[];
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import { TaskTreeItemComponent } from "./treeItem";
|
|||
import { TaskListRendererComponent } from "./TaskList";
|
||||
import TaskProgressBarPlugin from "../../index";
|
||||
import { sortTasks } from "../../commands/sortTaskCommands";
|
||||
import { getInitialViewMode, saveViewMode } from "../../utils/viewModeUtils";
|
||||
import { getInitialViewMode, saveViewMode } from "../../utils/ui/view-mode-utils";
|
||||
|
||||
interface SelectedTags {
|
||||
tags: string[];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { App, Component, setIcon, Menu } from "obsidian";
|
||||
import { Task } from "../../types/task";
|
||||
import { formatDate } from "../../utils/dateUtil";
|
||||
import { formatDate } from "../../utils/date/date-formatter";
|
||||
import "../../styles/tree-view.css";
|
||||
import { MarkdownRendererComponent } from "../MarkdownRenderer";
|
||||
import { createTaskCheckbox } from "./details";
|
||||
|
|
@ -9,12 +9,12 @@ import {
|
|||
getViewSettingOrDefault,
|
||||
ViewMode,
|
||||
} from "../../common/setting-definition";
|
||||
import { getRelativeTimeString } from "../../utils/dateUtil";
|
||||
import { getRelativeTimeString } from "../../utils/date/date-formatter";
|
||||
import { t } from "../../translations/helper";
|
||||
import TaskProgressBarPlugin from "../../index";
|
||||
import { InlineEditor, InlineEditorOptions } from "./InlineEditor";
|
||||
import { InlineEditorManager } from "./InlineEditorManager";
|
||||
import { sanitizePriorityForClass } from "../../utils/priorityUtils";
|
||||
import { sanitizePriorityForClass } from "../../utils/task/priority-utils";
|
||||
|
||||
export class TaskTreeItemComponent extends Component {
|
||||
public element: HTMLElement;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import {
|
|||
createEmbeddableMarkdownEditor,
|
||||
EmbeddableMarkdownEditor,
|
||||
} from "../../editor-ext/markdownEditor";
|
||||
import { saveCapture } from "../../utils/fileUtils";
|
||||
import { saveCapture } from "../../utils/file/file-operations";
|
||||
import "../../styles/timeline-sidebar.css";
|
||||
import { createTaskCheckbox } from "../task-view/details";
|
||||
import { MarkdownRendererComponent } from "../MarkdownRenderer";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @return The extracted task text or null if no task was found
|
||||
*/
|
||||
|
||||
import { REGEX_GOAL } from "./regexGoal";
|
||||
import { REGEX_GOAL } from "./regex-goal";
|
||||
|
||||
function extractTaskText(lineText: string): string | null {
|
||||
if (!lineText) return null;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { REGEX_GOAL } from "./regexGoal";
|
||||
import { REGEX_GOAL } from "./regex-goal";
|
||||
|
||||
function getParentTaskTextReadMode(taskElement: Element): string {
|
||||
// Clone the element to avoid modifying the original
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue