From ee0ef85ac691fa184870e3b9d42033d6c6610da7 Mon Sep 17 00:00:00 2001 From: Quorafind Date: Sun, 29 Nov 2026 10:58:12 +0800 Subject: [PATCH 1/3] refactor(lint): report failures with console.error/warn instead of console.log Failure paths that logged with console.log now use console.error (failed view/command registration) or console.warn (best-effort Electron window operations, missing calendar component, missing IPC bridge in the quick capture window), so removing debug logging does not silence real errors. The MCP request/response traces gated by the user's "debug" log level setting move to console.debug so that setting keeps working. --- src/bootstrap/registerViewShellModule.ts | 8 ++++---- .../features/fluent/managers/FluentComponentManager.ts | 2 +- src/index.ts | 8 ++++---- src/managers/desktop-integration-manager.ts | 4 ++-- src/managers/electron-quick-capture.ts | 6 +++--- src/mcp/McpServer.ts | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/bootstrap/registerViewShellModule.ts b/src/bootstrap/registerViewShellModule.ts index cd7cdd8a..9d82c14f 100644 --- a/src/bootstrap/registerViewShellModule.ts +++ b/src/bootstrap/registerViewShellModule.ts @@ -31,13 +31,13 @@ export function registerTaskViewShells(plugin: TaskProgressBarPlugin): void { try { registerTaskGeniusBasesViews(plugin); } catch (error) { - console.log("Failed to register Bases views:", error); + console.error("Failed to register Bases views:", error); } try { registerWidgetViews(plugin); } catch (error) { - console.log("Failed to register Widget views:", error); + console.error("Failed to register Widget views:", error); } } @@ -69,13 +69,13 @@ export function registerViewShellCommands(plugin: TaskProgressBarPlugin): void { try { registerWidgetCommands(plugin); } catch (error) { - console.log("Failed to register Widget commands:", error); + console.error("Failed to register Widget commands:", error); } try { registerWidgetCodeBlock(plugin); } catch (error) { - console.log( + console.error( "Failed to register Widget codeblock processor:", error, ); diff --git a/src/components/features/fluent/managers/FluentComponentManager.ts b/src/components/features/fluent/managers/FluentComponentManager.ts index f0670d24..2aa5b172 100644 --- a/src/components/features/fluent/managers/FluentComponentManager.ts +++ b/src/components/features/fluent/managers/FluentComponentManager.ts @@ -682,7 +682,7 @@ export class FluentComponentManager extends Component { (task) => !(task as Task & { badge?: boolean }).badge ); } - console.log( + console.warn( "[FluentComponent] Calling setTasks with filtered:", filteredTasksLocal.length, "all:", diff --git a/src/index.ts b/src/index.ts index e97be884..90091dd4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -547,13 +547,13 @@ export default class TaskProgressBarPlugin extends Plugin { try { registerTaskGeniusBasesViews(this); } catch (error) { - console.log("Failed to register Bases views:", error); + console.error("Failed to register Bases views:", error); } try { registerWidgetViews(this); } catch (error) { - console.log("Failed to register Widget views:", error); + console.error("Failed to register Widget views:", error); } } @@ -612,13 +612,13 @@ export default class TaskProgressBarPlugin extends Plugin { try { registerWidgetCommands(this); } catch (error) { - console.log("Failed to register Widget commands:", error); + console.error("Failed to register Widget commands:", error); } try { registerWidgetCodeBlock(this); } catch (error) { - console.log( + console.error( "Failed to register Widget codeblock processor:", error, ); diff --git a/src/managers/desktop-integration-manager.ts b/src/managers/desktop-integration-manager.ts index 62b29398..d6f6823e 100644 --- a/src/managers/desktop-integration-manager.ts +++ b/src/managers/desktop-integration-manager.ts @@ -306,7 +306,7 @@ export class DesktopIntegrationManager extends Component { return true; } } catch (e) { - console.log("[TrayDebug] Error checking tray validity:", e); + console.warn("[TrayDebug] Error checking tray validity:", e); delete g[globalKey]; } } @@ -1222,7 +1222,7 @@ export class DesktopIntegrationManager extends Component { } } } catch (e) { - console.log("[TrayDebug] Could not focus window:", e); + console.warn("[TrayDebug] Could not focus window:", e); } } } diff --git a/src/managers/electron-quick-capture.ts b/src/managers/electron-quick-capture.ts index e144206c..1f41013f 100644 --- a/src/managers/electron-quick-capture.ts +++ b/src/managers/electron-quick-capture.ts @@ -174,7 +174,7 @@ export class ElectronQuickCapture { ); } } catch (e) { - console.log( + console.warn( "Could not auto-adjust window size:", e, ); @@ -1025,10 +1025,10 @@ export class ElectronQuickCapture { } }; } else { - console.log('IPC not available - no ipcRenderer'); + console.warn('IPC not available - no ipcRenderer'); } } catch (e) { - console.log('IPC not available - error:', e); + console.warn('IPC not available - error:', e); } // Auto-resize textarea diff --git a/src/mcp/McpServer.ts b/src/mcp/McpServer.ts index e865c874..ff597865 100644 --- a/src/mcp/McpServer.ts +++ b/src/mcp/McpServer.ts @@ -1886,14 +1886,14 @@ export class McpServer { // Handle MCP request if (this.config.logLevel === "debug") { - console.log("[MCP] <-", request); + console.debug("[MCP] <-", request); } const response = await this.handleMcpRequest( request, sessionId, ); if (this.config.logLevel === "debug") { - console.log("[MCP] ->", response); + console.debug("[MCP] ->", response); } // Add session ID to response headers for initialize request From 0e7506849bb9db390320a67b81e9b172f0f980ac Mon Sep 17 00:00:00 2001 From: Quorafind Date: Sun, 29 Nov 2026 10:58:47 +0800 Subject: [PATCH 2/3] refactor(lint): remove debug console logging Delete the console.log/time/timeEnd calls flagged by the Obsidian community scanner ("Avoid unnecessary logging to console"), plus the ones it missed: commented-out console.log lines and the logs in the quick capture window's inline script. The removal was done with a TypeScript-AST codemod, so multi-line calls are removed whole. Statements that only existed to log are removed with them: if/else branches whose bodies only logged (conditions are side effect free), forEach loops that only logged, comments that only described a log, the no-op TaskWorkerManager.log() wrapper with its call sites and unused `debug` option, the unused SuggestManager.debugLogSuggestOrder(), the hard-coded-off DEBUG_MODE blocks in FluentTaskView, and callbacks that are now empty. The FileSource initialization tests asserted on a removed log; they now check getStats().initialized and that the initial scan runs once. --- .../file-source/FileSource.basic.test.ts | 33 +-- src/cache/local-storage-cache.ts | 3 - src/cache/project-data-cache.ts | 6 - src/components/features/calendar/algorithm.ts | 1 - .../features/changelog/ChangelogView.ts | 1 - .../fluent/components/FluentTopNavigation.ts | 8 - .../fluent/managers/FluentActionHandlers.ts | 17 -- .../fluent/managers/FluentComponentManager.ts | 89 +------- .../fluent/managers/FluentDataManager.ts | 59 ------ .../fluent/managers/FluentLayoutManager.ts | 6 - .../managers/FluentWorkspaceStateManager.ts | 27 --- .../fluent/managers/WorkspaceManager.ts | 39 ---- src/components/features/gantt/gantt.ts | 6 - .../features/gantt/grid-background.ts | 2 - .../features/gantt/task-renderer.ts | 8 - .../features/gantt/timeline-header.ts | 2 - src/components/features/habit/habit.ts | 2 - .../features/habit/habitcard/habitcard.ts | 2 - .../habit/habitcard/mappinghabitcard.ts | 2 - src/components/features/kanban/kanban.ts | 56 ----- .../on-completion/OnCompletionConfigurator.ts | 1 - .../features/onboarding/OnboardingView.ts | 6 - .../features/quadrant/quadrant-column.ts | 51 ----- src/components/features/quadrant/quadrant.ts | 45 ---- .../read-mode/ReadModeProgressBarWidget.ts | 1 - .../components/SettingsSearchComponent.ts | 17 -- .../features/settings/core/SettingsIndexer.ts | 5 - .../tabs/McpIntegrationSettingsTab.ts | 19 -- .../settings/tabs/QuickCaptureSettingsTab.ts | 2 - .../settings/tabs/WorkspaceSettingTab.ts | 9 - src/components/features/table/TableView.ts | 11 - .../features/task/filter/ViewTaskFilter.ts | 6 - .../task/filter/ViewTaskFilterPopover.ts | 5 - .../features/task/filter/in-view/filter.ts | 3 - .../features/task/view/BulkOperationsMenu.ts | 2 - .../features/task/view/InlineEditor.ts | 10 - src/components/features/task/view/TaskList.ts | 11 - .../task/view/TimerStatisticsPanel.ts | 1 - .../features/task/view/TwoColumnViewBase.ts | 1 - src/components/features/task/view/content.ts | 46 ---- src/components/features/task/view/details.ts | 3 - src/components/features/task/view/listItem.ts | 6 - .../task/view/modals/ViewConfigModal.ts | 25 --- src/components/features/task/view/review.ts | 10 - src/components/features/task/view/tags.ts | 2 - src/components/features/task/view/treeItem.ts | 3 - src/components/ui/behavior/DragManager.ts | 20 -- .../ui/behavior/ViewComponentManager.ts | 9 - .../ui/date-picker/DatePickerComponent.ts | 1 - src/components/ui/menus/IconMenu.ts | 4 - src/components/ui/modals/WorkspaceModals.ts | 11 - src/components/ui/suggest/SuggestManager.ts | 8 - src/core/task-indexer.ts | 26 --- src/dataflow/Orchestrator.ts | 197 ------------------ src/dataflow/api/QueryAPI.ts | 2 - src/dataflow/api/WriteAPI.ts | 71 ------- .../augment/DateInheritanceAugmentor.ts | 3 - src/dataflow/core/ConfigurableTaskParser.ts | 10 - src/dataflow/createDataflow.ts | 3 - src/dataflow/indexer/Repository.ts | 42 ---- src/dataflow/persistence/Storage.ts | 17 -- src/dataflow/sources/FileSource.ts | 74 ------- src/dataflow/sources/IcsSource.ts | 10 - src/dataflow/sources/ObsidianSource.ts | 38 ---- .../workers/ProjectDataWorkerManager.ts | 34 --- src/dataflow/workers/TaskWorkerManager.ts | 59 ------ src/dataflow/workers/WorkerOrchestrator.ts | 14 +- src/editor-extensions/core/extended-gutter.ts | 1 - .../date-time/date-manager.ts | 7 - src/editor-extensions/date-time/task-timer.ts | 161 -------------- .../task-operations/completion-monitor.ts | 2 - .../task-operations/status-cycler.ts | 55 ----- .../workflow/workflow-handler.ts | 7 - src/executors/completion/archive-executor.ts | 3 - src/index.ts | 39 ---- src/managers/calendar-auth-manager.ts | 30 --- src/managers/completion-manager.ts | 10 - src/managers/desktop-integration-manager.ts | 20 -- src/managers/electron-quick-capture.ts | 55 ----- src/managers/file-task-manager.ts | 31 --- src/managers/habit-manager.ts | 5 - src/managers/ics-manager.ts | 66 ------ src/managers/onboarding-manager.ts | 5 - src/managers/reward-manager.ts | 5 - src/managers/timer-manager.ts | 26 --- src/managers/version-manager.ts | 6 - src/mcp/McpServer.ts | 15 -- src/mcp/McpServerManager.ts | 4 - src/pages/FluentTaskView.ts | 81 ------- src/pages/RightDetailView.ts | 3 - src/pages/TaskSpecificView.ts | 68 ------ src/pages/TaskView.ts | 101 --------- src/pages/bases/TaskBasesView.ts | 16 -- src/pages/bases/registerBasesViews.ts | 2 - src/parsers/canvas-task-updater.ts | 1 - src/parsers/file-metadata-parser.ts | 2 - src/providers/apple-caldav-provider.ts | 9 - src/providers/google-calendar-provider.ts | 15 -- src/providers/outlook-calendar-provider.ts | 15 -- src/services/task-parsing-service.ts | 12 -- src/services/timer-export-service.ts | 6 - src/utils/SettingsMigrationManager.ts | 7 - src/utils/changelog-cache.ts | 2 - src/utils/settings-migration.ts | 2 - src/utils/task/task-filter-utils.ts | 6 - 105 files changed, 13 insertions(+), 2211 deletions(-) diff --git a/src/__tests__/file-source/FileSource.basic.test.ts b/src/__tests__/file-source/FileSource.basic.test.ts index 475624a0..a0fa6c67 100644 --- a/src/__tests__/file-source/FileSource.basic.test.ts +++ b/src/__tests__/file-source/FileSource.basic.test.ts @@ -94,41 +94,30 @@ describe('FileSource', () => { }); it('should not initialize when disabled', () => { - const consoleSpy = jest.spyOn(console, 'log').mockImplementation(); - fileSource.initialize(); - - expect(consoleSpy).not.toHaveBeenCalledWith(expect.stringContaining('[FileSource] Initializing')); - - consoleSpy.mockRestore(); + + expect(fileSource.getStats().initialized).toBe(false); }); it('should initialize when enabled', () => { - const consoleSpy = jest.spyOn(console, 'log').mockImplementation(); - // Enable FileSource fileSource.updateConfiguration({ enabled: true }); fileSource.initialize(); - - expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('[FileSource] Initializing')); - - consoleSpy.mockRestore(); + + expect(fileSource.getStats().initialized).toBe(true); }); it('should not initialize twice', () => { - const consoleSpy = jest.spyOn(console, 'log').mockImplementation(); - + const scanSpy = jest.spyOn(fileSource as any, 'performInitialScan'); + fileSource.updateConfiguration({ enabled: true }); fileSource.initialize(); fileSource.initialize(); // Second call - - // Should only log once - const initLogs = consoleSpy.mock.calls.filter((call: any[]) => - call[0]?.includes('[FileSource] Initializing') - ); - expect(initLogs).toHaveLength(1); - - consoleSpy.mockRestore(); + + // Should only run the initial scan once + expect(scanSpy).toHaveBeenCalledTimes(1); + + scanSpy.mockRestore(); }); }); diff --git a/src/cache/local-storage-cache.ts b/src/cache/local-storage-cache.ts index 071f2cbe..331bcb80 100644 --- a/src/cache/local-storage-cache.ts +++ b/src/cache/local-storage-cache.ts @@ -106,9 +106,6 @@ export class LocalStorageCache { // to keep noise down on first load after an upgrade with thousands // of cache entries. if (!LocalStorageCache._versionMismatchLogged) { - console.log( - `[LocalStorageCache] Cache version mismatch (cached=${data.version}, current=${this.currentVersion}); treating as cache miss and pruning stale entries on access.`, - ); LocalStorageCache._versionMismatchLogged = true; } // Prune the stale entry so we don't keep paying the read cost. diff --git a/src/cache/project-data-cache.ts b/src/cache/project-data-cache.ts index e06237a8..37a6d0b2 100644 --- a/src/cache/project-data-cache.ts +++ b/src/cache/project-data-cache.ts @@ -561,9 +561,6 @@ export class ProjectDataCache { } if (staleFiles.length > 0) { - console.log( - `Refreshing ${staleFiles.length} stale project data cache entries` - ); await this.getBatchProjectData(staleFiles); } } @@ -577,9 +574,6 @@ export class ProjectDataCache { ); if (uncachedFiles.length > 0) { - console.log( - `Preloading project data for ${uncachedFiles.length} recent files` - ); await this.getBatchProjectData(uncachedFiles); } } diff --git a/src/components/features/calendar/algorithm.ts b/src/components/features/calendar/algorithm.ts index 28c7c1cf..04a32901 100644 --- a/src/components/features/calendar/algorithm.ts +++ b/src/components/features/calendar/algorithm.ts @@ -28,7 +28,6 @@ export function calculateEventLayout( timeRangeStart?: Date, timeRangeEnd?: Date ): EventLayout[] { - console.log("Calculating event layout (stub)", events); // Basic Stub: Return simple layout (no overlap calculation yet) return events.map((event, index) => ({ id: event.id, diff --git a/src/components/features/changelog/ChangelogView.ts b/src/components/features/changelog/ChangelogView.ts index 42827ab5..14bfda26 100644 --- a/src/components/features/changelog/ChangelogView.ts +++ b/src/components/features/changelog/ChangelogView.ts @@ -53,7 +53,6 @@ export class ChangelogView extends ItemView { const isBeta = manifestVersion.toLowerCase().includes("beta"); const cached = getCachedChangelog(manifestVersion, isBeta, this.app); - console.log("[TG]", cached); if (!cached) { return; } diff --git a/src/components/features/fluent/components/FluentTopNavigation.ts b/src/components/features/fluent/components/FluentTopNavigation.ts index dbd52396..6de0d4c2 100644 --- a/src/components/features/fluent/components/FluentTopNavigation.ts +++ b/src/components/features/fluent/components/FluentTopNavigation.ts @@ -479,10 +479,6 @@ export class TopNavigation extends Component { buttonEl: buttonContainer, config: config, }); - - console.log( - `[FluentTopNavigation] Registered custom button: ${config.id}`, - ); } /** @@ -499,8 +495,6 @@ export class TopNavigation extends Component { // Remove from map this.customButtons.delete(id); - - console.log(`[FluentTopNavigation] Unregistered custom button: ${id}`); } /** @@ -518,8 +512,6 @@ export class TopNavigation extends Component { // Clear map this.customButtons.clear(); - - console.log("[FluentTopNavigation] Cleared all custom buttons"); } /** diff --git a/src/components/features/fluent/managers/FluentActionHandlers.ts b/src/components/features/fluent/managers/FluentActionHandlers.ts index 53832313..99f63ee2 100644 --- a/src/components/features/fluent/managers/FluentActionHandlers.ts +++ b/src/components/features/fluent/managers/FluentActionHandlers.ts @@ -223,20 +223,10 @@ export class FluentActionHandlers extends Component { task: Task, newStatusMark: string ): Promise { - console.log( - `[FluentActionHandlers] Processing kanban status update for task ${task.id}` - ); - console.log( - `[FluentActionHandlers] Status change: ${task.status} -> ${newStatusMark}` - ); - const isCompleted = this.isCompletedMark(newStatusMark); const completedDate = isCompleted ? Date.now() : undefined; if (task.status !== newStatusMark || task.completed !== isCompleted) { - console.log( - "[FluentActionHandlers] Status change detected, calling handleTaskUpdate..." - ); await this.handleTaskUpdate(task, { ...task, status: newStatusMark, @@ -246,11 +236,6 @@ export class FluentActionHandlers extends Component { completedDate: completedDate, }, }); - console.log("[FluentActionHandlers] handleTaskUpdate completed"); - } else { - console.log( - "[FluentActionHandlers] No status change needed, skipping update" - ); } } @@ -1083,7 +1068,6 @@ export class FluentActionHandlers extends Component { if (viewId === "new-task") { new QuickCaptureModal(this.app, this.plugin).open(); } else { - console.log(`[FluentAction] handleNavigate to ${viewId}`); this.onNavigateToView?.(viewId); } } @@ -1099,7 +1083,6 @@ export class FluentActionHandlers extends Component { * Handle project selection */ handleProjectSelect(projectId: string, includeSubprojects = false): void { - console.log(`[FluentAction] Project selected: ${projectId}`); this.onProjectSelected?.(projectId, includeSubprojects); } diff --git a/src/components/features/fluent/managers/FluentComponentManager.ts b/src/components/features/fluent/managers/FluentComponentManager.ts index 2aa5b172..9fdf5c4d 100644 --- a/src/components/features/fluent/managers/FluentComponentManager.ts +++ b/src/components/features/fluent/managers/FluentComponentManager.ts @@ -144,15 +144,12 @@ export class FluentComponentManager extends Component { */ public setTopNavigation(nav: TopNavigation): void { this.topNavigation = nav; - console.log("[FluentComponentManager] TopNavigation reference set"); } /** * Initialize all view components */ initializeViewComponents(): void { - console.log("[FluentComponent] initializeViewComponents started"); - // Initialize ViewComponentManager for special views const viewHandlers = { onTaskSelected: (task: Task) => @@ -183,7 +180,6 @@ export class FluentComponentManager extends Component { this.parentView.addChild(this.viewComponentManager); // Initialize ContentComponent (handles inbox, today, upcoming, flagged) - console.log("[FluentComponent] Creating ContentComponent"); this.contentComponent = new ContentComponent( this.contentArea, this.app, @@ -403,9 +399,7 @@ export class FluentComponentManager extends Component { }); // Hide all components initially - console.log("[FluentComponent] Hiding all components initially"); this.hideAllComponents(true); - console.log("[FluentComponent] initializeViewComponents completed"); } /** @@ -416,17 +410,10 @@ export class FluentComponentManager extends Component { // Smart hiding - only hide currently visible component (unless initial hide) if (!isInitialHide && this.currentVisibleComponent) { - console.log( - "[FluentComponent] Smart hide - only hiding current visible component" - ); this.currentVisibleComponent.containerEl?.hide(); this.currentVisibleComponent = null; } else { // Hide all components - console.log( - "[FluentComponent] Hiding all components", - isInitialHide ? "(initial hide)" : "" - ); this.contentComponent?.containerEl.hide(); this.forecastComponent?.containerEl.hide(); this.tagsComponent?.containerEl.hide(); @@ -465,13 +452,6 @@ export class FluentComponentManager extends Component { viewMode: ViewMode, project?: string | null ): void { - console.log( - "[FluentComponent] switchView called with:", - viewId, - "viewMode:", - viewMode - ); - // Remove transient overlays (loading/error/empty) before showing components if (this.contentArea) { this.contentArea @@ -482,7 +462,6 @@ export class FluentComponentManager extends Component { } // Hide all components first - console.log("[FluentComponent] Hiding all components"); this.hideAllComponents(); // Clear custom buttons from TopNavigation before switching views @@ -579,15 +558,9 @@ export class FluentComponentManager extends Component { // 1. With project selection (from ProjectList) → use ContentComponent for filtered tasks // 2. Without project selection (from view navigation) → use ProjectsComponent for overview if (project) { - console.log( - "[FluentComponent] Projects view with selected project - using ContentComponent" - ); targetComponent = this.contentComponent; modeForComponent = viewId; } else { - console.log( - "[FluentComponent] Projects view without selection - using ProjectsComponent" - ); targetComponent = this.projectsComponent; modeForComponent = viewId; } @@ -617,16 +590,7 @@ export class FluentComponentManager extends Component { } } - console.log( - "[FluentComponent] Target component determined:", - targetComponent?.constructor?.name - ); - if (targetComponent) { - console.log( - `[FluentComponent] Activating component for view ${viewId}:`, - targetComponent.constructor.name - ); targetComponent.containerEl.show(); this.currentVisibleComponent = targetComponent; @@ -635,17 +599,11 @@ export class FluentComponentManager extends Component { targetComponent === this.contentComponent && this.topNavigation ) { - console.log( - "[FluentComponent] Setting TopNavigation reference for ContentComponent" - ); this.contentComponent.setTopNavigation(this.topNavigation); } // Set view mode first for ContentComponent if (typeof targetComponent.setViewMode === "function") { - console.log( - `[FluentComponent] Setting view mode for ${viewId} to ${modeForComponent}` - ); targetComponent.setViewMode(modeForComponent, project); } @@ -654,24 +612,14 @@ export class FluentComponentManager extends Component { // Special handling for components that need filtered + all tasks // Tags view: uses filtered tasks for tag index (left sidebar), all tasks for tree view lookup if (viewId === "tags") { - console.log( - `[FluentComponent] Calling setTasks for ${viewId} with FILTERED tasks (${filteredTasks.length}) and ALL tasks (${tasks.length})` - ); targetComponent.setTasks(filteredTasks, tasks); } else if (viewId === "review") { // Review view still needs all tasks - console.log( - `[FluentComponent] Calling setTasks for ${viewId} with ALL tasks:`, - tasks.length - ); targetComponent.setTasks(tasks); } else if (viewId === "projects" && !project) { // Projects overview mode: standardized semantics // First param: filtered tasks (for building sidebar project index) // Second param: all tasks (for tree view parent-child lookup) - console.log( - `[FluentComponent] Calling setTasks for projects with FILTERED tasks (${filteredTasks.length}) and ALL tasks (${tasks.length})` - ); targetComponent.setTasks(filteredTasks, tasks); } else { // Use filtered tasks @@ -682,12 +630,6 @@ export class FluentComponentManager extends Component { (task) => !(task as Task & { badge?: boolean }).badge ); } - console.warn( - "[FluentComponent] Calling setTasks with filtered:", - filteredTasksLocal.length, - "all:", - tasks.length - ); targetComponent.setTasks(filteredTasksLocal, tasks); } } @@ -731,11 +673,6 @@ export class FluentComponentManager extends Component { filteredTasks: Task[], viewMode: ViewMode ): void { - console.log( - "[FluentComponent] renderContentWithViewMode called, viewMode:", - viewMode - ); - // Hide current component this.hideAllComponents(); @@ -763,10 +700,6 @@ export class FluentComponentManager extends Component { this.contentComponent.setViewMode(viewId); this.contentComponent.setIsTreeView(viewMode === "tree"); - console.log( - "[FluentComponent] Setting tasks to ContentComponent, filtered:", - filteredTasks.length - ); this.contentComponent.setTasks(filteredTasks, tasks); this.currentVisibleComponent = this.contentComponent; break; @@ -786,10 +719,6 @@ export class FluentComponentManager extends Component { // Set cycle change callback this.topNavigation.setCycleChangeCallback( (cycleId: string | null) => { - console.log( - "[FluentComponent] Cycle changed to:", - cycleId - ); // Update kanban component's selected cycle this.kanbanComponent["selectedCycleId"] = cycleId; this.kanbanComponent["saveCycleSelection"](); @@ -802,38 +731,23 @@ export class FluentComponentManager extends Component { this.topNavigation.showCycleSelector(savedCycleId); } - console.log( - "[FluentComponent] Setting", - filteredTasks.length, - "tasks to kanban" - ); this.kanbanComponent.setTasks(filteredTasks); this.currentVisibleComponent = this.kanbanComponent; break; case "calendar": // Use CalendarComponent - console.log( - "[FluentComponent] Calendar mode in renderContentWithViewMode" - ); if (!this.calendarComponent) { - console.log( + console.warn( "[FluentComponent] No calendar component available!" ); return; } - console.log("[FluentComponent] Showing calendar component"); this.calendarComponent.containerEl.show(); - console.log( - "[FluentComponent] Setting", - filteredTasks.length, - "tasks to calendar" - ); this.calendarComponent.setTasks(filteredTasks); this.currentVisibleComponent = this.calendarComponent; - console.log("[FluentComponent] Calendar mode setup complete"); break; } } @@ -914,7 +828,6 @@ export class FluentComponentManager extends Component { * Render loading state */ renderLoadingState(): void { - console.log("[FluentComponent] renderLoadingState called"); if (this.contentArea) { // Remove existing loading overlays this.contentArea diff --git a/src/components/features/fluent/managers/FluentDataManager.ts b/src/components/features/fluent/managers/FluentDataManager.ts index f65cef8e..20eccb7c 100644 --- a/src/components/features/fluent/managers/FluentDataManager.ts +++ b/src/components/features/fluent/managers/FluentDataManager.ts @@ -88,37 +88,18 @@ export class FluentDataManager extends Component { */ async loadTasks(showLoading = true): Promise { try { - console.log( - "[FluentData] loadTasks started, showLoading:", - showLoading, - ); - // Notify loading state if (showLoading && !this.isInitializing()) { - console.log("[FluentData] Notifying loading state"); this.onLoadingStateChanged?.(true); } let loadedTasks: Task[] = []; if (this.plugin.dataflowOrchestrator) { - console.log( - "[FluentData] Using dataflow orchestrator to load tasks", - ); const queryAPI = this.plugin.dataflowOrchestrator.getQueryAPI(); - console.log("[FluentData] Getting all tasks from queryAPI..."); loadedTasks = await queryAPI.getAllTasks(); - console.log( - `[FluentData] Loaded ${loadedTasks.length} tasks from dataflow`, - ); } else { - console.log( - "[FluentData] Dataflow not available, using preloaded tasks", - ); loadedTasks = this.plugin.preloadedTasks || []; - console.log( - `[FluentData] Loaded ${loadedTasks.length} preloaded tasks`, - ); } // Return loaded tasks via callback @@ -131,7 +112,6 @@ export class FluentDataManager extends Component { this.onTasksLoaded?.([], errorMessage); } finally { // Always notify loading complete - console.log("[FluentData] loadTasks complete"); this.onLoadingStateChanged?.(false); } } @@ -145,8 +125,6 @@ export class FluentDataManager extends Component { const viewId = this.getCurrentViewId(); const filterState = this.getCurrentFilterState(); - console.log(`[FluentData] applyFilters called for viewId: ${viewId}, total tasks: ${tasks.length}`); - // Build filter options const filterOptions: { textQuery: string; @@ -160,7 +138,6 @@ export class FluentDataManager extends Component { // Always enable v2Filters for Working-on so the special filter runs if (viewId === "working-on") { filterOptions.v2Filters = filterOptions.v2Filters || {}; - console.log("[FluentData] Working-on view detected, will apply special filter"); } // Apply advanced filters from the filter popover/modal @@ -169,7 +146,6 @@ export class FluentDataManager extends Component { filterState.currentFilterState.filterGroups && filterState.currentFilterState.filterGroups.length > 0 ) { - console.log("[FluentData] Applying advanced filters"); filterOptions.advancedFilter = filterState.currentFilterState; } @@ -199,9 +175,7 @@ export class FluentDataManager extends Component { // Always apply working-on filter when in that view, regardless of v2Filters if (viewId === "working-on") { - console.log(`[FluentData] Before applyWorkingOnFilter: ${filteredTasks.length} tasks`); filteredTasks = this.applyWorkingOnFilter(filteredTasks); - console.log(`[FluentData] After applyWorkingOnFilter: ${filteredTasks.length} tasks`); } // Apply additional fluent-specific filters if needed (but skip working-on duplicate filter) @@ -212,10 +186,6 @@ export class FluentDataManager extends Component { ); } - console.log( - `[FluentData] Final filtered result: ${filteredTasks.length} tasks from ${tasks.length} total for viewId: ${viewId}`, - ); - // Apply sorting (global default first, then view-specific) filteredTasks = this.applySorting(filteredTasks, viewId); @@ -335,8 +305,6 @@ export class FluentDataManager extends Component { * @returns Filtered tasks for Working-on view */ private applyWorkingOnFilter(tasks: Task[]): Task[] { - console.log(`[FluentData] applyWorkingOnFilter called with ${tasks.length} tasks`); - // Get in-progress status marks from settings const inProgressMarks = ( this.plugin.settings.taskStatuses.inProgress || ">|/" @@ -345,8 +313,6 @@ export class FluentDataManager extends Component { .map((m) => m.trim()) .filter(Boolean); - console.log(`[FluentData] In-progress marks: ${inProgressMarks.join(", ")}`); - // Get timer manager instance if timer feature is enabled let timerManager: TaskTimerManager | null = null; const activeTimerBlockIds: Set = new Set(); @@ -356,7 +322,6 @@ export class FluentDataManager extends Component { // Get all active timers and build a set of block IDs const activeTimers = timerManager.getAllActiveTimers(); - console.log(`[FluentData] Active timers count: ${activeTimers.length}`); for (const timer of activeTimers) { if (timer.status === "running" || timer.status === "paused") { activeTimerBlockIds.add(timer.blockId); @@ -373,7 +338,6 @@ export class FluentDataManager extends Component { ), ); - console.log(`[FluentData] applyWorkingOnFilter result: ${result.length} tasks after filter`); return result; } @@ -401,9 +365,6 @@ export class FluentDataManager extends Component { // Apply sorting if criteria exist if (mergedCriteria.length > 0) { - console.log( - `[FluentData] Applying ${mergedCriteria.length} sort criteria to ${result.length} tasks`, - ); result = sortTasks(result, mergedCriteria, this.plugin.settings); } @@ -417,13 +378,8 @@ export class FluentDataManager extends Component { async registerDataflowListeners(): Promise { // Add debounced view update to prevent rapid successive refreshes const debouncedViewUpdate = debounce(async () => { - console.log("[FluentData] debouncedViewUpdate triggered"); - // Skip update during batch operation to prevent list flashing if (this.isBatchOperating) { - console.log( - "[FluentData] Skipping update during batch operation", - ); return; } @@ -456,9 +412,6 @@ export class FluentDataManager extends Component { // Listen for batch operation start this.registerEvent( on(this.plugin.app, Events.BATCH_OPERATION_START, (payload: BatchOperationStartPayload) => { - console.log( - `[FluentData] Batch operation started: ${payload.count} tasks`, - ); this.isBatchOperating = true; }), ); @@ -469,9 +422,6 @@ export class FluentDataManager extends Component { this.plugin.app, Events.BATCH_OPERATION_COMPLETE, (payload: BatchOperationCompletePayload) => void (async () => { - console.log( - `[FluentData] Batch operation complete: ${payload.successCount} succeeded, ${payload.failCount} failed`, - ); this.isBatchOperating = false; // Immediately refresh view after batch operation (skip debounce) @@ -520,9 +470,6 @@ export class FluentDataManager extends Component { (!leafId.startsWith("view-config-") && leafId !== "global-filter") ) { - console.log( - "[FluentData] Filter changed, notifying update needed", - ); debouncedApplyFilter(); } }, @@ -539,9 +486,6 @@ export class FluentDataManager extends Component { return; } - console.log( - `[FluentData] View config changed (reason: ${payload?.reason ?? "unknown"})`, - ); scheduleFilterRefresh(); }, ), @@ -550,9 +494,6 @@ export class FluentDataManager extends Component { // Listen for global settings changes (e.g., default sort criteria updates) this.registerEvent( on(this.plugin.app, Events.SETTINGS_CHANGED, () => { - console.log( - "[FluentData] Settings changed event received, scheduling resort", - ); scheduleFilterRefresh(); }), ); diff --git a/src/components/features/fluent/managers/FluentLayoutManager.ts b/src/components/features/fluent/managers/FluentLayoutManager.ts index dfac66b4..a8ae9eed 100644 --- a/src/components/features/fluent/managers/FluentLayoutManager.ts +++ b/src/components/features/fluent/managers/FluentLayoutManager.ts @@ -133,9 +133,6 @@ export class FluentLayoutManager extends Component { initializeSidebar(containerEl: HTMLElement): void { if (this.useSideLeaves()) { containerEl.hide(); - console.log( - "[FluentLayout] Using workspace side leaves: skip in-view sidebar", - ); return; } @@ -173,9 +170,6 @@ export class FluentLayoutManager extends Component { */ initializeDetailsComponent(): void { if (this.useSideLeaves()) { - console.log( - "[FluentLayout] Using workspace side leaves: skip in-view details panel", - ); return; } diff --git a/src/components/features/fluent/managers/FluentWorkspaceStateManager.ts b/src/components/features/fluent/managers/FluentWorkspaceStateManager.ts index a4ac1db9..249c3e3b 100644 --- a/src/components/features/fluent/managers/FluentWorkspaceStateManager.ts +++ b/src/components/features/fluent/managers/FluentWorkspaceStateManager.ts @@ -180,7 +180,6 @@ export class FluentWorkspaceStateManager extends Component { filters, selectedProject, viewMode, - searchQuery, advancedFilter, } = payload; @@ -201,24 +200,8 @@ export class FluentWorkspaceStateManager extends Component { effectiveSettings.fluentActiveViewId = activeViewId; } - console.log("[FluentWorkspace] saveFilterStateToWorkspace", { - workspaceId, - viewId, - activeViewId, - searchQuery, - selectedProject, - hasAdvanced: !!advancedFilter, - groups: advancedFilter?.filterGroups?.length ?? 0, - }); - this.plugin.workspaceManager .saveOverridesQuietly(workspaceId, effectiveSettings) - .then(() => - console.log("[FluentWorkspace] overrides saved quietly", { - workspaceId, - viewId, - }), - ) .catch((e) => { console.error( "[FluentWorkspace] failed to save overrides", @@ -284,21 +267,11 @@ export class FluentWorkspaceStateManager extends Component { effectiveSettings.fluentActiveViewId = activeViewId; } - console.log("[FluentWorkspace] saveFilterStateImmediately", { - workspaceId, - viewId, - activeViewId, - }); - try { await this.plugin.workspaceManager.saveOverridesQuietly( workspaceId, effectiveSettings, ); - console.log("[FluentWorkspace] immediate save completed", { - workspaceId, - viewId, - }); } catch (e) { console.error("[FluentWorkspace] immediate save failed", e); new Notice( diff --git a/src/components/features/fluent/managers/WorkspaceManager.ts b/src/components/features/fluent/managers/WorkspaceManager.ts index 67af1cee..9affe3e3 100644 --- a/src/components/features/fluent/managers/WorkspaceManager.ts +++ b/src/components/features/fluent/managers/WorkspaceManager.ts @@ -164,14 +164,6 @@ export class WorkspaceManager { // Return from cache if available - console.log("[TG-WORKSPACE] getEffectiveSettings:start", { - requestId: workspaceId || null, - configActive: config.activeWorkspaceId, - defaultId: config.defaultWorkspaceId, - resolvedId: id, - cached: this.effectiveCache.has(id), - }); - if (this.effectiveCache.has(id)) { return this.effectiveCache.get(id)!; } @@ -308,11 +300,6 @@ export class WorkspaceManager { // Set active workspace public async setActiveWorkspace(workspaceId: string): Promise { - console.log("[TG-WORKSPACE] setActiveWorkspace:start", { - from: this.getActiveWorkspace()?.id, - to: workspaceId, - }); - const config = this.getWorkspacesConfig(); const previousId = config.activeWorkspaceId; @@ -322,10 +309,6 @@ export class WorkspaceManager { } if (config.activeWorkspaceId === workspaceId) { - console.log( - "[TG-WORKSPACE] setActiveWorkspace:noop (already active)", - { id: workspaceId }, - ); return; // Already active } @@ -334,10 +317,6 @@ export class WorkspaceManager { await this.plugin.saveSettings(); - console.log("[TG-WORKSPACE] setActiveWorkspace:done", { - active: config.activeWorkspaceId, - }); - emitWorkspaceSwitched(this.app, workspaceId); } @@ -514,10 +493,6 @@ export class WorkspaceManager { ws.updatedAt = Date.now(); changedKeys.push("fluentActiveViewId"); } - console.log("[TG-WORKSPACE] saveOverrides(default)", { - workspaceId, - changedKeys, - }); this.clearCache(); await this.plugin.saveSettings(); // Emit overrides saved for UI to react; also emit SETTINGS_CHANGED for global changes @@ -539,10 +514,6 @@ export class WorkspaceManager { const overrides = this.toOverrides(effective); const changedKeys = Object.keys(overrides); - console.log("[TG-WORKSPACE] saveOverrides", { - workspaceId, - changedKeys, - }); workspace.settings = overrides; workspace.updatedAt = Date.now(); @@ -593,12 +564,6 @@ export class WorkspaceManager { ); ws.updatedAt = Date.now(); } - console.log("[TG-WORKSPACE] saveOverridesQuietly(default)", { - workspaceId, - keys: WORKSPACE_SCOPED_KEYS.filter( - (k) => effective[k] !== undefined, - ), - }); this.clearCache(); await this.plugin.saveSettings(); return; @@ -611,10 +576,6 @@ export class WorkspaceManager { // Calculate overrides const overrides = this.toOverrides(effective); - console.log("[TG-WORKSPACE] saveOverridesQuietly", { - workspaceId, - keys: Object.keys(overrides), - }); workspace.settings = overrides; workspace.updatedAt = Date.now(); diff --git a/src/components/features/gantt/gantt.ts b/src/components/features/gantt/gantt.ts index cd26e20e..31924485 100644 --- a/src/components/features/gantt/gantt.ts +++ b/src/components/features/gantt/gantt.ts @@ -227,7 +227,6 @@ export class GanttComponent extends Component { } onload() { - console.log("GanttComponent loaded."); this.applyEffectiveConfig(); this.createBaseSVG(); // Creates SVG and groups @@ -287,7 +286,6 @@ export class GanttComponent extends Component { } onunload() { - console.log("GanttComponent unloaded."); this.debouncedRender.cancel(); this.debouncedHeaderUpdate.cancel(); @@ -1114,7 +1112,6 @@ export class GanttComponent extends Component { // --- Public API --- public refresh() { - console.log("GanttComponent refresh triggered."); // Force recalculation of date range and re-render this.calculateDateRange(true); this.prepareTasksForRender(); // Prepare tasks with new date range @@ -1130,7 +1127,6 @@ export class GanttComponent extends Component { // --- Filtering Logic --- private applyFiltersAndRender(activeFilters: ActiveFilter[]) { - console.log("Applying filters: ", activeFilters); if (activeFilters.length === 0) { this.tasks = [...this.allTasks]; // Show all tasks if no filters } else { @@ -1177,8 +1173,6 @@ export class GanttComponent extends Component { }); } - console.log("Filtered tasks count:", this.tasks.length); - // Recalculate date range based on filtered tasks and prepare for render this.calculateDateRange(true); // Force recalculate based on filtered tasks this.prepareTasksForRender(); // Uses the filtered this.tasks diff --git a/src/components/features/gantt/grid-background.ts b/src/components/features/gantt/grid-background.ts index c5b3cbfe..3435b1a6 100644 --- a/src/components/features/gantt/grid-background.ts +++ b/src/components/features/gantt/grid-background.ts @@ -34,12 +34,10 @@ export class GridBackgroundComponent extends Component { } onload() { - console.log("GridBackgroundComponent loaded."); // Initial render happens when updateParams is called } onunload() { - console.log("GridBackgroundComponent unloaded."); this.svgGroupEl.empty(); // Clear the grid group } diff --git a/src/components/features/gantt/task-renderer.ts b/src/components/features/gantt/task-renderer.ts index 08f2cef2..01760234 100644 --- a/src/components/features/gantt/task-renderer.ts +++ b/src/components/features/gantt/task-renderer.ts @@ -42,13 +42,7 @@ export class TaskRendererComponent extends Component { this.taskGroupEl = taskGroupEl; } - onload() { - console.log("TaskRendererComponent loaded."); - } - onunload() { - console.log("TaskRendererComponent unloaded."); - // Clean up all event listeners this.cleanupEventListeners(); @@ -278,8 +272,6 @@ export class TaskRendererComponent extends Component { const sourcePath = task.filePath || ""; labelDiv.empty(); - console.log("sourcePath", sourcePath); - const markdownRenderer = new MarkdownRendererComponent( this.app, labelDiv, diff --git a/src/components/features/gantt/timeline-header.ts b/src/components/features/gantt/timeline-header.ts index d9287fbb..e07be5a6 100644 --- a/src/components/features/gantt/timeline-header.ts +++ b/src/components/features/gantt/timeline-header.ts @@ -35,12 +35,10 @@ export class TimelineHeaderComponent extends Component { } onload() { - console.log("TimelineHeaderComponent loaded."); // Initial render happens when updateParams is called } onunload() { - console.log("TimelineHeaderComponent unloaded."); if (this.svgEl) { this.svgEl.remove(); this.svgEl = null; diff --git a/src/components/features/habit/habit.ts b/src/components/features/habit/habit.ts index 46876444..74498960 100644 --- a/src/components/features/habit/habit.ts +++ b/src/components/features/habit/habit.ts @@ -46,7 +46,6 @@ export class Habit extends Component { } onunload() { - console.log("HabitView unloaded."); this.containerEl.empty(); // Clear the container on unload } @@ -90,7 +89,6 @@ export class Habit extends Component { } renderHabitList(habits: HabitProps[]) { - console.log("renderHabitList", habits); const listContainer = this.containerEl.createDiv({ cls: "habit-list-container", }); diff --git a/src/components/features/habit/habitcard/habitcard.ts b/src/components/features/habit/habitcard/habitcard.ts index 59385db4..df747f16 100644 --- a/src/components/features/habit/habitcard/habitcard.ts +++ b/src/components/features/habit/habitcard/habitcard.ts @@ -247,8 +247,6 @@ export class HabitCard extends Component { } toggleHabitCompletion(habitId: string, data?: HabitToggleData) { - console.log(`Toggling completion for ${habitId}`, data); - // 1. Get current habit state (use a deep copy to avoid mutation issues) const currentHabits = this.getHabitData(); // In real scenario, fetch from indexer const habitIndex = currentHabits.findIndex((h) => h.id === habitId); diff --git a/src/components/features/habit/habitcard/mappinghabitcard.ts b/src/components/features/habit/habitcard/mappinghabitcard.ts index 9675ec50..741df4bb 100644 --- a/src/components/features/habit/habitcard/mappinghabitcard.ts +++ b/src/components/features/habit/habitcard/mappinghabitcard.ts @@ -118,8 +118,6 @@ export class MappingHabitCard extends HabitCard { .onChange((value) => { currentSelection = value; - console.log(this.habit.mapping?.[currentSelection]); - mappingButton.buttonEl.setText( this.habit.mapping?.[currentSelection] || "?" ); diff --git a/src/components/features/kanban/kanban.ts b/src/components/features/kanban/kanban.ts index 0ca683af..a3c39abc 100644 --- a/src/components/features/kanban/kanban.ts +++ b/src/components/features/kanban/kanban.ts @@ -111,13 +111,11 @@ export class KanbanComponent extends Component { ): void { const isChanged = this.hasConfigOverrideChanged(config); this.configOverride = config; - console.log("[Kanban] setConfigOverride received", config); if (isChanged) { // Refresh derived state from effective config (sort/hide/column order) this.loadKanbanConfig(); const eff = this.getEffectiveKanbanConfig(); - console.log("[Kanban] effective config after override", eff); if (this.columnContainerEl) { // Rebuild columns with the new configuration so changes like groupBy // take effect immediately without requiring a data refresh. @@ -166,7 +164,6 @@ export class KanbanComponent extends Component { }); this.renderColumns(); - console.log("KanbanComponent loaded."); } override onunload() { @@ -182,7 +179,6 @@ export class KanbanComponent extends Component { this.columns = []; this.containerEl.empty(); - console.log("KanbanComponent unloaded."); } private hasConfigOverrideChanged( @@ -365,10 +361,8 @@ export class KanbanComponent extends Component { } private renderFilterControls(containerEl: HTMLElement) { - console.log("Kanban rendering filter controls"); // Build initial options from the current full task list const initialFilterOptions = buildFilterOptionsFromTasks(this.allTasks); - console.log("Kanban initial filter options:", initialFilterOptions); this.filterComponent = new FilterComponent( { @@ -389,10 +383,8 @@ export class KanbanComponent extends Component { } public setTasks(newTasks: Task[]) { - console.log("Kanban setting tasks:", newTasks.length); this.allTasks = [...newTasks]; // Store the full list - console.log(this.filterComponent); // Update filter options based on the complete task list if (this.filterComponent) { this.filterComponent.updateFilterOptions(this.allTasks); @@ -409,7 +401,6 @@ export class KanbanComponent extends Component { } private applyFiltersAndRender() { - console.log("Kanban applying filters:", this.activeFilters); // Filter the full list based on active filters if (this.activeFilters.length === 0) { this.tasks = [...this.allTasks]; // No filters active, show all tasks @@ -470,8 +461,6 @@ export class KanbanComponent extends Component { }); } - console.log("Kanban filtered tasks count:", this.tasks.length); - this.renderColumns(); } @@ -557,8 +546,6 @@ export class KanbanComponent extends Component { value: stringValue, }; - console.log("Kanban handleFilterApply", filterType, stringValue); - // Check if filter already exists const existingFilterIndex = this.activeFilters.findIndex( (f) => f.category === filterType && f.value === stringValue, @@ -638,7 +625,6 @@ export class KanbanComponent extends Component { // Resolve effective config (Bases override wins over plugin settings) const kanbanConfig = this.getEffectiveKanbanConfig(); - console.log("[Kanban] renderColumns effective config", kanbanConfig); const groupBy = kanbanConfig?.groupBy || "status"; @@ -1143,7 +1129,6 @@ export class KanbanComponent extends Component { } private async handleSortEnd(event: Sortable.SortableEvent) { - console.log("Kanban sort end:", event.oldIndex, event.newIndex); const taskId = event.item.dataset.taskId; const dropTargetColumnContent = event.to; const sourceColumnContent = event.from; @@ -1186,9 +1171,6 @@ export class KanbanComponent extends Component { targetStatusMark !== undefined && targetStatusMark !== null ) { - console.log( - `Kanban requesting status update for task ${taskId} to status ${targetColumnTitle} (mark: ${targetStatusMark})`, - ); await this.handleStatusUpdate(taskId, targetStatusMark); } else { console.warn( @@ -1211,9 +1193,6 @@ export class KanbanComponent extends Component { groupBy, effectiveCustomColumns, ); - console.log( - `Kanban requesting ${groupBy} update for task ${taskId} from ${sourceValue} to value: ${targetValue}`, - ); await this.handlePropertyUpdate( taskId, groupBy, @@ -1244,11 +1223,6 @@ export class KanbanComponent extends Component { kanbanConfig.defaultSortOrder || "desc", ), }; - console.log("[Kanban] loadKanbanConfig applied", { - hideEmptyColumns: this.hideEmptyColumns, - defaultSortField: this.sortOption.field, - defaultSortOrder: this.sortOption.order, - }); } // Load saved column order @@ -1268,9 +1242,6 @@ export class KanbanComponent extends Component { const cycleExists = cycles.some((c) => c.id === saved && c.enabled); this.selectedCycleId = cycleExists ? saved : null; if (!cycleExists && saved) { - console.log( - `[Kanban] Saved cycle ${saved} no longer exists or is disabled, resetting to null`, - ); this.app.saveLocalStorage(key, null); } } @@ -1361,21 +1332,9 @@ export class KanbanComponent extends Component { taskId: string, newStatusMark: string, ): Promise { - console.log( - `[Kanban] handleStatusUpdate called: taskId=${taskId}, mark=${newStatusMark}`, - ); - console.log( - "[Kanban] onTaskStatusUpdate callback exists:", - !!this.params.onTaskStatusUpdate, - ); - if (this.params.onTaskStatusUpdate) { try { - console.log("[Kanban] Calling onTaskStatusUpdate callback..."); await this.params.onTaskStatusUpdate(taskId, newStatusMark); - console.log( - "[Kanban] onTaskStatusUpdate callback completed successfully", - ); } catch (error) { console.error("[Kanban] Failed to update task status:", error); console.error("[Kanban] Error details:", error.stack); @@ -1431,10 +1390,6 @@ export class KanbanComponent extends Component { // Use the oldValue parameter to determine which tag to remove let currentTags = updatedTask.metadata.tags || []; - console.log("Tags update - current tags:", currentTags); - console.log("Tags update - oldValue:", oldValue); - console.log("Tags update - newValue:", newValue); - // Remove the old tag if it exists and is different from the new value if (oldValue && oldValue !== "" && oldValue !== newValue) { // Try to match the oldValue with existing tags @@ -1450,7 +1405,6 @@ export class KanbanComponent extends Component { currentTags = currentTags.filter( (tag) => !oldTagVariants.includes(tag), ); - console.log("Tags after removing old:", currentTags); } // Add the new tag if it's not already present @@ -1480,7 +1434,6 @@ export class KanbanComponent extends Component { currentTags.push(tagToAdd); } - console.log("Tags after adding new:", currentTags); updatedTask.metadata.tags = currentTags; } break; @@ -1520,12 +1473,6 @@ export class KanbanComponent extends Component { // Update the task using WriteAPI try { - console.log( - `Updating task ${taskId} ${groupBy} from:`, - oldValue, - "to:", - newValue, - ); if (this.plugin.writeAPI) { const result = await this.plugin.writeAPI.updateTask({ taskId, @@ -1674,7 +1621,6 @@ export class KanbanComponent extends Component { groupBy: string, customColumns?: KanbanColumnConfig[], ): KanbanColumnValue { - console.log("customColumns", customColumns); if (customColumns && customColumns.length > 0) { const column = customColumns.find((col) => col.title === title); return column ? column.value : null; @@ -1982,8 +1928,6 @@ export class KanbanComponent extends Component { } private handleColumnSortEnd(event: Sortable.SortableEvent): void { - console.log("Column sort end:", event.oldIndex, event.newIndex); - try { if (event.oldIndex === event.newIndex) { return; // No change in position diff --git a/src/components/features/on-completion/OnCompletionConfigurator.ts b/src/components/features/on-completion/OnCompletionConfigurator.ts index 0814c917..4e9ba625 100644 --- a/src/components/features/on-completion/OnCompletionConfigurator.ts +++ b/src/components/features/on-completion/OnCompletionConfigurator.ts @@ -455,7 +455,6 @@ export class OnCompletionConfigurator extends Component { ) { this.isUserConfiguring = true; // Mark as user configuring this.currentConfig.targetFile = value || undefined; - console.log(this.currentConfig, "currentConfig", value); this.updateValue(); } }); diff --git a/src/components/features/onboarding/OnboardingView.ts b/src/components/features/onboarding/OnboardingView.ts index 0fb42299..c223a275 100644 --- a/src/components/features/onboarding/OnboardingView.ts +++ b/src/components/features/onboarding/OnboardingView.ts @@ -122,7 +122,6 @@ export class OnboardingView extends ItemView { */ private renderCurrentStep() { const step = this.controller.getCurrentStep(); - console.log("Rendering step:", OnboardingStep[step]); // Clear header and content - ensure complete clearing this.layout.clearHeader(); @@ -307,11 +306,6 @@ export class OnboardingView extends ItemView { // Navigate to next step const success = await this.controller.next(); - console.log("handleNext - Navigation result:", success); - console.log( - "handleNext - New step:", - OnboardingStep[this.controller.getCurrentStep()], - ); } /** diff --git a/src/components/features/quadrant/quadrant-column.ts b/src/components/features/quadrant/quadrant-column.ts index a6a38baf..73e59b45 100644 --- a/src/components/features/quadrant/quadrant-column.ts +++ b/src/components/features/quadrant/quadrant-column.ts @@ -83,9 +83,6 @@ export class QuadrantColumnComponent extends Component { // Additional fallback - force load after a longer delay if still not loaded window.setTimeout(() => { if (!this.isContentLoaded && this.tasks.length > 0) { - console.log( - `Fallback loading for ${this.quadrant.id} - forcing content load` - ); void this.loadContent(); } }, 500); @@ -97,9 +94,6 @@ export class QuadrantColumnComponent extends Component { this.tasks.length > 0 && this.tasks.length <= this.pageSize ) { - console.log( - `Extra aggressive fallback for small task count in ${this.quadrant.id}` - ); void this.loadContent(); } }, 1000); @@ -206,9 +200,6 @@ export class QuadrantColumnComponent extends Component { private checkInitialVisibility() { // Force load content if the column is visible in viewport if (!this.isContentLoaded && this.isElementVisible()) { - console.log( - `Force loading content for quadrant: ${this.quadrant.id}` - ); void this.loadContent(); } } @@ -241,18 +232,12 @@ export class QuadrantColumnComponent extends Component { // For small task counts, be more aggressive and load immediately if (this.tasks.length <= this.pageSize) { - console.log( - `Small task count detected (${this.tasks.length}), loading immediately for ${this.quadrant.id}` - ); void this.loadContent(); return; } // First, try immediate loading if element is visible if (this.isElementVisible()) { - console.log( - `Immediately loading content for visible quadrant: ${this.quadrant.id}` - ); void this.loadContent(); return; } @@ -262,9 +247,6 @@ export class QuadrantColumnComponent extends Component { (entries) => { entries.forEach((entry) => { if (entry.isIntersecting && !this.isContentLoaded) { - console.log( - `Intersection triggered for quadrant: ${this.quadrant.id}` - ); void this.loadContent(); } }); @@ -296,9 +278,6 @@ export class QuadrantColumnComponent extends Component { !this.isLoadingMore && this.isContentLoaded ) { - console.log( - "Triggering loadMoreTasks - intersection detected" - ); void this.loadMoreTasks(); } }); @@ -410,15 +389,8 @@ export class QuadrantColumnComponent extends Component { public setTasks(tasks: Task[]) { - console.log( - `setTasks called for ${this.quadrant.id} with ${tasks.length} tasks` - ); - // Check if tasks have actually changed to avoid unnecessary re-renders if (this.areTasksEqual(this.tasks, tasks)) { - console.log( - `Tasks unchanged for ${this.quadrant.id}, skipping setTasks` - ); return; } @@ -438,9 +410,6 @@ export class QuadrantColumnComponent extends Component { } else { // For small task counts, load immediately without lazy loading if (tasks.length <= this.pageSize) { - console.log( - `Small task count (${tasks.length}), loading immediately for ${this.quadrant.id}` - ); // Force immediate loading for small task counts window.setTimeout(() => { void this.loadContent(); @@ -450,9 +419,6 @@ export class QuadrantColumnComponent extends Component { // since the quadrant view is typically small enough to show all columns window.setTimeout(() => { if (!this.isContentLoaded) { - console.log( - `Force loading content for ${this.quadrant.id} after setTasks (aggressive)` - ); void this.loadContent(); } }, 100); @@ -541,10 +507,6 @@ export class QuadrantColumnComponent extends Component { * Force update tasks even if they appear to be the same */ public forceSetTasks(tasks: Task[]) { - console.log( - `forceSetTasks called for ${this.quadrant.id} with ${tasks.length} tasks` - ); - this.tasks = tasks; this.updateCount(); @@ -577,7 +539,6 @@ export class QuadrantColumnComponent extends Component { // Check if the task actually changed if (this.areTasksContentEqual(this.tasks[taskIndex], updatedTask)) { - console.log(`Task ${updatedTask.id} unchanged, skipping update`); return; } @@ -603,10 +564,6 @@ export class QuadrantColumnComponent extends Component { cardComponent.updateTask(updatedTask); } } - - console.log( - `Updated task ${updatedTask.id} in quadrant ${this.quadrant.id}` - ); } /** @@ -632,8 +589,6 @@ export class QuadrantColumnComponent extends Component { this.renderedTasks.push(task); void this.renderSingleTask(task); } - - console.log(`Added task ${task.id} to quadrant ${this.quadrant.id}`); } /** @@ -677,8 +632,6 @@ export class QuadrantColumnComponent extends Component { if (this.tasks.length === 0 && this.isContentLoaded) { this.showEmptyState(); } - - console.log(`Removed task ${taskId} from quadrant ${this.quadrant.id}`); } /** @@ -885,7 +838,6 @@ export class QuadrantColumnComponent extends Component { } public forceLoadContent() { - console.log(`forceLoadContent called for ${this.quadrant.id}`); if (!this.isContentLoaded) { void this.loadContent(); } @@ -895,7 +847,6 @@ export class QuadrantColumnComponent extends Component { // Force load all remaining tasks (useful for drag operations) if (!this.hasMoreTasks) return; - console.log("Loading all remaining tasks asynchronously"); this.hasMoreTasks = false; this.hideLoadMoreIndicator(); @@ -914,8 +865,6 @@ export class QuadrantColumnComponent extends Component { await new Promise((resolve) => window.setTimeout(resolve, 10)); } } - - console.log("Finished loading all tasks"); } public getQuadrantId(): string { diff --git a/src/components/features/quadrant/quadrant.ts b/src/components/features/quadrant/quadrant.ts index 18002a24..3309920b 100644 --- a/src/components/features/quadrant/quadrant.ts +++ b/src/components/features/quadrant/quadrant.ts @@ -279,9 +279,6 @@ export class QuadrantComponent extends Component { newSortOption.field !== this.sortOption.field || newSortOption.order !== this.sortOption.order ) { - console.log( - `Sort option changed from ${this.sortOption.field}-${this.sortOption.order} to ${newSortOption.field}-${newSortOption.order}` - ); this.sortOption = newSortOption; // Force refresh all columns since sorting affects all quadrants this.forceRefreshAll(); @@ -395,16 +392,12 @@ export class QuadrantComponent extends Component { // You could implement custom ordering logic here // For example, updating a custom order field in task metadata - console.log( - `Reordered task ${taskId} from position ${evt.oldIndex} to ${evt.newIndex} in quadrant ${quadrant.id}` - ); } private async handleSortEnd( event: Sortable.SortableEvent, sourceQuadrant: QuadrantDefinition ) { - console.log("Quadrant sort end:", event.oldIndex, event.newIndex); const taskId = event.item.dataset.taskId; const dropTargetColumnContent = event.to; const sourceColumnContent = event.from; @@ -427,9 +420,6 @@ export class QuadrantComponent extends Component { if (targetQuadrant && actualSourceQuadrant) { // Handle cross-quadrant moves if (targetQuadrantId !== sourceQuadrantId) { - console.log( - `Moving task ${taskId} from ${sourceQuadrantId} to ${targetQuadrantId}` - ); await this.updateTaskQuadrant( taskId, targetQuadrant, @@ -437,9 +427,6 @@ export class QuadrantComponent extends Component { ); } else if (event.oldIndex !== event.newIndex) { // Handle reordering within the same quadrant - console.log( - `Reordering task ${taskId} within ${targetQuadrantId}` - ); this.handleTaskReorder(event, targetQuadrant); } } @@ -721,10 +708,6 @@ export class QuadrantComponent extends Component { // Check if tasks have actually changed for this column if (this.hasTasksChanged(currentTasks, newTasks)) { - console.log( - `Tasks changed for quadrant ${quadrantId}, updating...` - ); - // Sort tasks within each quadrant const sortedTasks = this.sortTasks(newTasks); @@ -744,10 +727,6 @@ export class QuadrantComponent extends Component { column.forceLoadContent(); }, 50); } - } else { - console.log( - `No changes for quadrant ${quadrantId}, skipping update` - ); } }); } @@ -867,7 +846,6 @@ export class QuadrantComponent extends Component { * Force refresh all columns (fallback for when selective refresh isn't sufficient) */ public forceRefreshAll() { - console.log("Force refreshing all columns"); if (!this.columns.length) return; // Categorize tasks by quadrant @@ -899,7 +877,6 @@ export class QuadrantComponent extends Component { } private forceLoadAllColumns() { - console.log("Force loading all columns"); this.columns.forEach((column) => { if (!column.isEmpty()) { column.forceLoadContent(); @@ -941,10 +918,6 @@ export class QuadrantComponent extends Component { } else { column.setVisibility(true); } - - console.log( - `Updated quadrant ${quadrantId} with ${sortedTasks.length} tasks` - ); } /** @@ -959,10 +932,6 @@ export class QuadrantComponent extends Component { private sortTasks(tasks: Task[]): Task[] { const sortedTasks = [...tasks]; - console.log( - `Sorting ${tasks.length} tasks by ${this.sortOption.field} (${this.sortOption.order})` - ); - sortedTasks.sort((a, b) => { let aValue: number, bValue: number; @@ -998,20 +967,6 @@ export class QuadrantComponent extends Component { } }); - // Log first few tasks for debugging - if (sortedTasks.length > 0) { - console.log( - `First 3 sorted tasks:`, - sortedTasks.slice(0, 3).map((t) => ({ - id: t.id, - content: t.content.substring(0, 50), - priority: this.getTaskPriorityValue(t), - dueDate: t.metadata?.dueDate, - scheduledDate: t.metadata?.scheduledDate, - })) - ); - } - return sortedTasks; } diff --git a/src/components/features/read-mode/ReadModeProgressBarWidget.ts b/src/components/features/read-mode/ReadModeProgressBarWidget.ts index 991e6e38..6e93c019 100644 --- a/src/components/features/read-mode/ReadModeProgressBarWidget.ts +++ b/src/components/features/read-mode/ReadModeProgressBarWidget.ts @@ -159,7 +159,6 @@ export function updateProgressBarInElement({ // 检查是否需要根据heading显示progress bar if (plugin.settings.showProgressBarBasedOnHeading?.trim()) { const sectionInfo = ctx.getSectionInfo(element); - console.log(sectionInfo); if (sectionInfo) { // Read the original text to get the content of the current section const lines = sectionInfo.text.split("\n"); diff --git a/src/components/features/settings/components/SettingsSearchComponent.ts b/src/components/features/settings/components/SettingsSearchComponent.ts index cc0d6367..12e96a61 100644 --- a/src/components/features/settings/components/SettingsSearchComponent.ts +++ b/src/components/features/settings/components/SettingsSearchComponent.ts @@ -192,19 +192,13 @@ export class SettingsSearchComponent extends Component { * 执行搜索 */ public performSearch(query: string): void { - console.log(`[SettingsSearch] Performing search for: "${query}"`); - if (query.length === 0) { - console.log(`[SettingsSearch] Empty query, hiding results`); this.hideResults(); return; } // 最少输入1个字符开始搜索,提升响应性 if (query.length < 1) { - console.log( - `[SettingsSearch] Query too short (${query.length} chars), skipping search` - ); return; } @@ -212,17 +206,6 @@ export class SettingsSearchComponent extends Component { this.currentResults = this.indexer.search(query, 12); this.selectedIndex = -1; - console.log( - `[SettingsSearch] Found ${this.currentResults.length} results:` - ); - this.currentResults.forEach((result, index) => { - console.log( - ` ${index + 1}. ${result.item.name} (${ - result.matchType - }, score: ${result.score})` - ); - }); - if (this.currentResults.length > 0) { this.renderResults(); this.showResults(); diff --git a/src/components/features/settings/core/SettingsIndexer.ts b/src/components/features/settings/core/SettingsIndexer.ts index d21a8dbd..c0d00587 100644 --- a/src/components/features/settings/core/SettingsIndexer.ts +++ b/src/components/features/settings/core/SettingsIndexer.ts @@ -41,11 +41,6 @@ export class SettingsIndexer { } const endTime = performance.now(); - console.log( - `[SettingsIndexer] Index built in ${(endTime - startTime).toFixed( - 2 - )}ms with ${this.index.items.length} items` - ); this.isInitialized = true; } diff --git a/src/components/features/settings/tabs/McpIntegrationSettingsTab.ts b/src/components/features/settings/tabs/McpIntegrationSettingsTab.ts index 65f8ded7..483ae67c 100644 --- a/src/components/features/settings/tabs/McpIntegrationSettingsTab.ts +++ b/src/components/features/settings/tabs/McpIntegrationSettingsTab.ts @@ -341,13 +341,7 @@ export function renderMcpIntegrationSettingsTab( button.setButtonText(t("Testing...")); try { - console.log("[MCP Test] Starting connection test..."); - console.log("[MCP Test] Server URL:", serverUrl); - console.log("[MCP Test] Auth Token:", authToken); - console.log("[MCP Test] App ID:", appId); - // Test 1: Basic connectivity - console.log("[MCP Test] Test 1: Basic connectivity..."); const healthRes = await requestUrl({ url: `http://${ plugin.settings.mcpIntegration?.host || "127.0.0.1" @@ -363,12 +357,8 @@ export function renderMcpIntegrationSettingsTab( if (!healthRes || healthRes.status !== 200) { throw new Error(`Health check failed`); } - console.log("[MCP Test] Health check passed"); // Test 2: MCP initialize with Method B (combined bearer) - console.log( - "[MCP Test] Test 2: MCP initialize with Method B..." - ); const initRes = await requestUrl({ url: serverUrl, method: "POST", @@ -396,8 +386,6 @@ export function renderMcpIntegrationSettingsTab( // Obsidian's requestUrl returns json directly const initJson = initRes.json; - console.log("[MCP Test] Initialize response:", initJson); - console.log("[MCP Test] Headers:", initRes.headers); if (initJson.error) { throw new Error(`MCP error: ${initJson.error.message}`); @@ -415,10 +403,7 @@ export function renderMcpIntegrationSettingsTab( throw new Error("No session ID returned"); } - console.log("[MCP Test] Got session ID:", sessionId); - // Test 3: Tools list - console.log("[MCP Test] Test 3: Listing tools..."); const toolsRes = await requestUrl({ url: serverUrl, method: "POST", @@ -438,7 +423,6 @@ export function renderMcpIntegrationSettingsTab( // Obsidian's requestUrl returns json directly const toolsJson = toolsRes.json; - console.log("[MCP Test] Tools response:", toolsJson); if (toolsJson.error) { throw new Error( @@ -449,7 +433,6 @@ export function renderMcpIntegrationSettingsTab( new Notice( t("Connection test successful! MCP server is working.") ); - console.log("[MCP Test] All tests passed!"); } catch (error) { console.error("[MCP Test] Test failed:", error); new Notice( @@ -1094,8 +1077,6 @@ export function renderMcpIntegrationSettingsTab( }), }); - console.log("MCP tools", listRes); - const tools = listRes?.json.result?.tools || []; toolsInfo.setText(""); diff --git a/src/components/features/settings/tabs/QuickCaptureSettingsTab.ts b/src/components/features/settings/tabs/QuickCaptureSettingsTab.ts index b4d14475..e2e1dd39 100644 --- a/src/components/features/settings/tabs/QuickCaptureSettingsTab.ts +++ b/src/components/features/settings/tabs/QuickCaptureSettingsTab.ts @@ -112,8 +112,6 @@ export function renderQuickCaptureSettingsTab( const dailyNotesSettings = dailyNotesPlugin.instance?.options || {}; - console.log(dailyNotesSettings); - settingTab.plugin.settings.quickCapture.dailyNoteSettings = { format: diff --git a/src/components/features/settings/tabs/WorkspaceSettingTab.ts b/src/components/features/settings/tabs/WorkspaceSettingTab.ts index 1d4e2fbc..5a00a1e2 100644 --- a/src/components/features/settings/tabs/WorkspaceSettingTab.ts +++ b/src/components/features/settings/tabs/WorkspaceSettingTab.ts @@ -117,9 +117,6 @@ export function renderWorkspaceSettingsTab( button.setButtonText(t("Active")).setDisabled(true); } else { button.setButtonText(t("Switch")).onClick(async () => { - console.log("[TG-WORKSPACE] settings:switch", { - to: workspace.id, - }); await settingTab.plugin.workspaceManager!.setActiveWorkspace( workspace.id, ); @@ -197,9 +194,6 @@ function showWorkspaceSelector( await settingTab.plugin.workspaceManager?.setActiveWorkspace( workspace.id, ); - console.log("[TG-WORKSPACE] settings:menu switch", { - to: workspace.id, - }); this.display(); }); @@ -551,9 +545,6 @@ function showHiddenModulesConfig( workspace, () => { // Update callback - trigger any necessary refreshes - console.log( - `[WorkspaceSettings] Hidden modules updated for workspace ${workspace.id}`, - ); }, ); } diff --git a/src/components/features/table/TableView.ts b/src/components/features/table/TableView.ts index a1a1bef8..2f7961ca 100644 --- a/src/components/features/table/TableView.ts +++ b/src/components/features/table/TableView.ts @@ -447,10 +447,6 @@ export class TableView extends Component { sortCriteria, this.plugin.settings ); - - console.log("sort tasks", this.filteredTasks, sortCriteria); - - console.log(this.filteredTasks); } } @@ -770,13 +766,6 @@ export class TableView extends Component { this.refreshDisplay(); this.updateSortIndicators(); - // Debug logging to help identify sorting issues - console.log( - `Table sorted by ${this.currentSortField} (${this.currentSortOrder})` - ); - console.log(`Filtered tasks count: ${this.filteredTasks.length}`); - console.log(`Displayed rows count: ${this.displayedRows.length}`); - // Fallback: If the table doesn't seem to be updating properly, force a complete refresh // This is a safety net for any edge cases in the rendering logic window.setTimeout(() => { diff --git a/src/components/features/task/filter/ViewTaskFilter.ts b/src/components/features/task/filter/ViewTaskFilter.ts index ac9cf19a..7e35d91f 100644 --- a/src/components/features/task/filter/ViewTaskFilter.ts +++ b/src/components/features/task/filter/ViewTaskFilter.ts @@ -64,7 +64,6 @@ export class TaskFilterComponent extends Component { ) : this.app.loadLocalStorage("task-genius-view-filter"); - console.log("savedState", savedState, this.leafId); if ( savedState && typeof savedState.rootCondition === "string" && @@ -1141,10 +1140,6 @@ export class TaskFilterComponent extends Component { this.plugin, "save", this.getFilterState(), - (config) => { - // Optional: Handle successful save - console.log("Filter configuration saved:", config.name); - }, ); modal.open(); } @@ -1161,7 +1156,6 @@ export class TaskFilterComponent extends Component { (config) => { // Load the configuration this.loadFilterState(config.filterState); - console.log("Filter configuration loaded:", config.name); }, ); modal.open(); diff --git a/src/components/features/task/filter/ViewTaskFilterPopover.ts b/src/components/features/task/filter/ViewTaskFilterPopover.ts index 850fb6ae..e82cb96d 100644 --- a/src/components/features/task/filter/ViewTaskFilterPopover.ts +++ b/src/components/features/task/filter/ViewTaskFilterPopover.ts @@ -129,11 +129,6 @@ export class ViewTaskFilterPopover private clickOutside = (e: MouseEvent) => { if (this.popoverRef && !this.popoverRef.contains(e.target as Node)) { - console.log("clickOutside - closing popover", { - target: e.target, - popoverRef: this.popoverRef, - contains: this.popoverRef.contains(e.target as Node), - }); this.close(); } }; diff --git a/src/components/features/task/filter/in-view/filter.ts b/src/components/features/task/filter/in-view/filter.ts index 2c8617b0..9db8dad7 100644 --- a/src/components/features/task/filter/in-view/filter.ts +++ b/src/components/features/task/filter/in-view/filter.ts @@ -217,9 +217,6 @@ export class FilterComponent extends Component { ); if (availableOptions.length === 0) { - console.log( - "No more filter categories available or options populated.", - ); new Notice("No more filter categories available."); return; } diff --git a/src/components/features/task/view/BulkOperationsMenu.ts b/src/components/features/task/view/BulkOperationsMenu.ts index d61df3a7..4877a388 100644 --- a/src/components/features/task/view/BulkOperationsMenu.ts +++ b/src/components/features/task/view/BulkOperationsMenu.ts @@ -490,8 +490,6 @@ async function executeBulkStatusChange( plugin, ); - console.log(result, tasks); - showOperationResult(result, `Changed status to "${statusName}"`); selectionManager.exitSelectionMode("operation_complete"); onOperationComplete(); diff --git a/src/components/features/task/view/InlineEditor.ts b/src/components/features/task/view/InlineEditor.ts index 10e3d257..2ef3937c 100644 --- a/src/components/features/task/view/InlineEditor.ts +++ b/src/components/features/task/view/InlineEditor.ts @@ -1113,12 +1113,6 @@ export class InlineEditor extends Component { this.isSaving = true; try { - console.log( - "[InlineEditor] Calling onTaskUpdate:", - this.originalTask.content, - "->", - this.task.content - ); await this.options.onTaskUpdate(this.originalTask, this.task); this.originalTask = { ...this.task, @@ -1196,7 +1190,6 @@ export class InlineEditor extends Component { private async finishContentEdit(targetEl: HTMLElement): Promise { // Prevent multiple concurrent saves if (this.isSaving) { - console.log("Save already in progress, waiting..."); // Wait for current save to complete while (this.isSaving) { await new Promise((resolve) => window.setTimeout(resolve, 50)); @@ -1213,8 +1206,6 @@ export class InlineEditor extends Component { // Save the task and wait for completion const saveSuccess = await this.saveTask(); - console.log("save success", saveSuccess); - if (!saveSuccess) { console.error("Failed to save task, not finishing edit"); return; @@ -1267,7 +1258,6 @@ export class InlineEditor extends Component { ): Promise { // Prevent multiple concurrent saves if (this.isSaving) { - console.log("Save already in progress, waiting..."); while (this.isSaving) { await new Promise((resolve) => window.setTimeout(resolve, 50)); } diff --git a/src/components/features/task/view/TaskList.ts b/src/components/features/task/view/TaskList.ts index 3b81a263..e9f4b28b 100644 --- a/src/components/features/task/view/TaskList.ts +++ b/src/components/features/task/view/TaskList.ts @@ -107,18 +107,7 @@ export class TaskListRendererComponent extends Component { } }; taskComponent.onTaskUpdate = async (originalTask, updatedTask) => { - console.log( - "TaskListRendererComponent onTaskUpdate", - this.onTaskUpdate, - originalTask.content, - updatedTask.content, - ); if (this.onTaskUpdate) { - console.log( - "TaskListRendererComponent onTaskUpdate", - originalTask.content, - updatedTask.content, - ); await this.onTaskUpdate(originalTask, updatedTask); } }; diff --git a/src/components/features/task/view/TimerStatisticsPanel.ts b/src/components/features/task/view/TimerStatisticsPanel.ts index 399e8d27..86b1ea5d 100644 --- a/src/components/features/task/view/TimerStatisticsPanel.ts +++ b/src/components/features/task/view/TimerStatisticsPanel.ts @@ -378,7 +378,6 @@ export class TimerStatisticsPanel extends Component { } if (this.onTaskContextMenu) { this.registerDomEvent(timerEl, "contextmenu", (event) => { - console.log("contextmenu", event); event.preventDefault(); event.stopPropagation(); this.onTaskContextMenu?.(event, task ?? null); diff --git a/src/components/features/task/view/TwoColumnViewBase.ts b/src/components/features/task/view/TwoColumnViewBase.ts index 7ea90ae0..9de493eb 100644 --- a/src/components/features/task/view/TwoColumnViewBase.ts +++ b/src/components/features/task/view/TwoColumnViewBase.ts @@ -421,7 +421,6 @@ export abstract class TwoColumnViewBase extends Component { const countText = `${this.filteredTasks.length} ${t("tasks")}`; this.updateTaskListHeader(title, countText); - console.log("filteredTasks", this.filteredTasks, this.isTreeView); this.allTasksMap = new Map( this.allTasks.map((task) => [task.id, task]), ); diff --git a/src/components/features/task/view/content.ts b/src/components/features/task/view/content.ts index 09278749..5680eb00 100644 --- a/src/components/features/task/view/content.ts +++ b/src/components/features/task/view/content.ts @@ -182,9 +182,6 @@ export class ContentComponent extends Component { entry.isIntersecting && entry.target.classList.contains("task-load-marker") ) { - // console.log( - // "Load marker intersecting, calling loadMoreTasks..." - // ); // Target is the load marker, load more tasks this.loadMoreTasks(); } @@ -224,7 +221,6 @@ export class ContentComponent extends Component { setIcon(viewToggleBtn, this.isTreeView ? "git-branch" : "list"); } - console.log("toggle view mode"); // Save the new view mode state saveViewMode(this.app, this.currentViewId, this.isTreeView); this.debounceRefreshTaskList(); // Refresh list completely on view mode change @@ -566,7 +562,6 @@ export class ContentComponent extends Component { // Allow forced refresh for cases where we know the data has changed if (forceRefresh) { - console.log("ContentComponent: Forced refresh requested"); // Cancel any ongoing rendering if force refresh is requested this.isRendering = false; this.pendingForceRefresh = true; @@ -584,9 +579,6 @@ export class ContentComponent extends Component { // If a force refresh is pending, skip non-forced updates if (this.pendingForceRefresh) { - console.log( - "ContentComponent: Skipping non-forced update, force refresh is pending", - ); return; } @@ -597,9 +589,6 @@ export class ContentComponent extends Component { nextAllSignature === this.lastAllTasksSignature && nextNotFilteredSignature === this.lastNotFilteredTasksSignature ) { - console.log( - "ContentComponent: Task signatures unchanged, skipping refresh", - ); return; } @@ -682,10 +671,6 @@ export class ContentComponent extends Component { this.showGroupByMenu(); }, }); - - console.log( - "[ContentComponent] Registered Group By button in TopNavigation", - ); } /** @@ -697,9 +682,6 @@ export class ContentComponent extends Component { } this.topNavigation.unregisterCustomButton("content-group-by"); - console.log( - "[ContentComponent] Unregistered Group By button from TopNavigation", - ); } /** @@ -726,10 +708,6 @@ export class ContentComponent extends Component { this.toggleTimerStatisticsPanel(); }, }); - - console.log( - "[ContentComponent] Registered Timer Statistics button for working-on view", - ); } /** @@ -942,7 +920,6 @@ export class ContentComponent extends Component { ); private refreshTaskList() { - console.log("refreshing"); // Defer rendering if container is not visible yet (e.g., view hidden during init) if (!this.isContainerVisible()) { this.pendingForceRefresh = true; @@ -973,9 +950,6 @@ export class ContentComponent extends Component { // If a render is already in progress, queue a refresh instead of skipping if (this.isRendering) { - console.log( - "ContentComponent: Already rendering, queueing a refresh", - ); this.pendingForceRefresh = true; return; } @@ -1172,8 +1146,6 @@ export class ContentComponent extends Component { const start = this.nextTaskIndex; const end = Math.min(start + countToLoad, this.filteredTasks.length); - // console.log(`Loading list tasks from ${start} to ${end}`); - for (let i = start; i < end; i++) { const task = this.filteredTasks[i]; const taskComponent = new TaskListItemComponent( @@ -1276,10 +1248,6 @@ export class ContentComponent extends Component { ? this.nextRootTaskIndex < this.rootTasks.length : this.nextTaskIndex < this.filteredTasks.length; - // console.log( - // `Check load marker: moreTasksExist = ${moreTasksExist} (Tree: ${this.nextRootTaskIndex}/${this.rootTasks.length}, List: ${this.nextTaskIndex}/${this.filteredTasks.length})` - // ); - if (moreTasksExist) { this.addLoadMarker(); } @@ -1291,7 +1259,6 @@ export class ContentComponent extends Component { attr: { "data-task-id": "load-marker" }, // Use data attribute for identification }); loadMarker.setText(t("Loading more...")); - // console.log("Adding load marker and observing."); this.taskListObserver.observe(loadMarker); // Observe the marker } @@ -1371,30 +1338,19 @@ export class ContentComponent extends Component { } private loadMoreTasks() { - // console.log("Load more tasks triggered..."); this.removeLoadMarker(); // Remove the current marker if (this.isTreeView) { if (this.nextRootTaskIndex < this.rootTasks.length) { - // console.log( - // `Loading more TREE tasks from index ${this.nextRootTaskIndex}` - // ); const taskMap = new Map(); this.filteredTasks.forEach((task) => taskMap.set(task.id, task), ); this.loadRootTaskBatch(taskMap); - } else { - // console.log("No more TREE tasks to load."); } } else { if (this.nextTaskIndex < this.filteredTasks.length) { - // console.log( - // `Loading more LIST tasks from index ${this.nextTaskIndex}` - // ); this.loadTaskBatch(); - } else { - // console.log("No more LIST tasks to load."); } } @@ -1411,7 +1367,6 @@ export class ContentComponent extends Component { if (this.selectedTask?.id === task?.id && task !== null) { // If clicking the already selected task, deselect it (or toggle details - handled by TaskView) // this.selectedTask = null; - // console.log("Task deselected (in ContentComponent):", task?.id); // // Update visual state of the item if needed (remove highlight) // const itemEl = this.taskListEl.querySelector(`[data-task-row-id="${task.id}"]`); // itemEl?.removeClass('is-selected'); // Example class @@ -1426,7 +1381,6 @@ export class ContentComponent extends Component { } this.selectedTask = task; - // console.log("Task selected (in ContentComponent):", task?.id); // Select new task visually if needed if (task) { diff --git a/src/components/features/task/view/details.ts b/src/components/features/task/view/details.ts index b475e3f5..8547fd01 100644 --- a/src/components/features/task/view/details.ts +++ b/src/components/features/task/view/details.ts @@ -155,7 +155,6 @@ export class TaskDetailsComponent extends Component { } public showTaskDetails(task: Task) { - console.log("showTaskDetails", task); if (!task) { this.currentTask = null; this.showEmptyState(); @@ -346,7 +345,6 @@ export class TaskDetailsComponent extends Component { t("Task Title") ); const contentInput = new TextComponent(contentField); - console.log("contentInput", contentInput, task.content); contentInput.setValue(clearAllMarks(task.content)); contentInput.inputEl.addClass("details-edit-content"); @@ -822,7 +820,6 @@ export class TaskDetailsComponent extends Component { { initialValue: task.metadata.onCompletion || "", onChange: (value) => { - console.log(value, "onCompletion value changed"); // Use smarter save logic: allow basic configurations to save immediately // and allow partial configurations for complex types const config = onCompletionConfigurator.getConfig(); diff --git a/src/components/features/task/view/listItem.ts b/src/components/features/task/view/listItem.ts index 8b3d2cdc..c4ce5be3 100644 --- a/src/components/features/task/view/listItem.ts +++ b/src/components/features/task/view/listItem.ts @@ -91,12 +91,8 @@ export class TaskListItemComponent extends Component { const editorOptions: InlineEditorOptions = { onTaskUpdate: async (originalTask: Task, updatedTask: Task) => { if (this.onTaskUpdate) { - console.log(originalTask.content, updatedTask.content); try { await this.onTaskUpdate(originalTask, updatedTask); - console.log( - "listItem onTaskUpdate completed successfully" - ); // Don't update task reference here - let onContentEditFinished handle it } catch (error) { console.error("Error in listItem onTaskUpdate:", error); @@ -184,8 +180,6 @@ export class TaskListItemComponent extends Component { } this.registerDomEvent(this.element, "contextmenu", (event) => { - console.log("contextmenu", event, this.task); - // Check if we have multiple selections if ( this.selectionManager && diff --git a/src/components/features/task/view/modals/ViewConfigModal.ts b/src/components/features/task/view/modals/ViewConfigModal.ts index dc0d9326..80e7ac99 100644 --- a/src/components/features/task/view/modals/ViewConfigModal.ts +++ b/src/components/features/task/view/modals/ViewConfigModal.ts @@ -1655,14 +1655,8 @@ export class ViewConfigModal extends Modal { ) .addToggle((toggle) => { const hasAdvancedFilter = !!this.viewFilterRule.advancedFilter; - console.log( - "Initial advanced filter state:", - hasAdvancedFilter, - this.viewFilterRule.advancedFilter, - ); toggle.setValue(hasAdvancedFilter); toggle.onChange((value) => { - console.log("Advanced filter toggle changed to:", value); if (value) { // Enable advanced filtering if (!this.viewFilterRule.advancedFilter) { @@ -1670,15 +1664,10 @@ export class ViewConfigModal extends Modal { rootCondition: "any", filterGroups: [], }; - console.log( - "Created new advanced filter:", - this.viewFilterRule.advancedFilter, - ); } this.setupAdvancedFilter(); } else { // Disable advanced filtering - console.log("Disabling advanced filter"); delete this.viewFilterRule.advancedFilter; this.cleanupAdvancedFilter(); } @@ -2019,8 +2008,6 @@ export class ViewConfigModal extends Modal { private setupAdvancedFilter() { if (!this.advancedFilterContainer) return; - console.log("Setting up advanced filter..."); - // Clean up existing component if any this.cleanupAdvancedFilter(); @@ -2032,8 +2019,6 @@ export class ViewConfigModal extends Modal { this.plugin, ); - console.log("TaskFilterComponent created:", this.taskFilterComponent); - // 保存现有的过滤器状态 const existingFilterState = this.viewFilterRule.advancedFilter ? JSON.parse(JSON.stringify(this.viewFilterRule.advancedFilter)) @@ -2042,8 +2027,6 @@ export class ViewConfigModal extends Modal { filterGroups: [], }; - console.log("Filter state for view config:", existingFilterState); - // 预先保存空的筛选器状态到localStorage,防止加载意外的状态 this.app.saveLocalStorage( `task-genius-view-filter-view-config-${this.viewConfig.id}`, @@ -2053,10 +2036,7 @@ export class ViewConfigModal extends Modal { // 手动调用 onload this.taskFilterComponent.onload(); - console.log("TaskFilterComponent onload called"); - // 立即加载视图配置的过滤器状态 - console.log("Loading view config filter state:", existingFilterState); this.taskFilterComponent.loadFilterState(existingFilterState); // Set up event listener for filter changes @@ -2069,10 +2049,6 @@ export class ViewConfigModal extends Modal { this.taskFilterComponent && leafId === `view-config-${this.viewConfig.id}` ) { - console.log( - "Filter changed in view config modal:", - filterState, - ); this.viewFilterRule.advancedFilter = filterState; this.checkForChanges(); } @@ -2085,7 +2061,6 @@ export class ViewConfigModal extends Modal { // Show the container this.advancedFilterContainer.show(); - console.log("Advanced filter container should now be visible"); } private cleanupAdvancedFilter() { diff --git a/src/components/features/task/view/review.ts b/src/components/features/task/view/review.ts index 84eb730b..947f7727 100644 --- a/src/components/features/task/view/review.ts +++ b/src/components/features/task/view/review.ts @@ -434,7 +434,6 @@ export class ReviewComponent extends Component { } } - console.log("Loaded Projects:", this.reviewableProjects); this.renderProjectsList(); // If a project is currently selected but no longer available, clear the selection @@ -473,7 +472,6 @@ export class ReviewComponent extends Component { } public setTasks(tasks: Task[]) { - console.log("ReviewComponent.setTasks called with", tasks.length, "tasks"); this.allTasks = tasks; // Reload settings potentially, in case a project relevant to settings was added/removed // Or just filter existing settings based on current tasks @@ -990,7 +988,6 @@ export class ReviewComponent extends Component { * and recording the IDs of current tasks that have been reviewed */ private async markProjectAsReviewed(projectName: string) { - console.log(`Marking ${projectName} as reviewed...`); const now = Date.now(); const currentSettings = this.plugin.settings.reviewSettings; @@ -1103,11 +1100,6 @@ export class ReviewComponent extends Component { } public updateTask(updatedTask: Task) { - console.log( - "ReviewComponent received task update:", - updatedTask.id, - updatedTask.metadata.project - ); let needsListRefresh = false; // Update in allTasks list @@ -1118,7 +1110,6 @@ export class ReviewComponent extends Component { const oldTask = this.allTasks[taskIndexAll]; // If project changed, the whole view might need refresh if (oldTask.metadata.project !== updatedTask.metadata.project) { - console.log("Task project changed, reloading review settings."); this.loadReviewSettings(); // Reloads projects list and potentially task list return; // Exit, loadReviewSettings handles UI update } @@ -1202,7 +1193,6 @@ export class ReviewComponent extends Component { } public refreshReviewSettings() { - console.log("Explicitly refreshing review settings..."); this.loadReviewSettings(); } diff --git a/src/components/features/task/view/tags.ts b/src/components/features/task/view/tags.ts index 3fa0c2fa..66bc9891 100644 --- a/src/components/features/task/view/tags.ts +++ b/src/components/features/task/view/tags.ts @@ -489,7 +489,6 @@ export class TagsComponent extends Component { } // Get tasks that have ANY of the selected tags (OR logic) - console.log(this.selectedTags.tags); const taskSets: Set[] = this.selectedTags.tags.map((tag) => { // For each selected tag, include tasks from child tags const matchingTasks = new Set(); @@ -509,7 +508,6 @@ export class TagsComponent extends Component { return matchingTasks; }); - console.log(taskSets, this.allTagsMap); if (taskSets.length === 0) { this.filteredTasks = []; diff --git a/src/components/features/task/view/treeItem.ts b/src/components/features/task/view/treeItem.ts index 16683500..f9056d6e 100644 --- a/src/components/features/task/view/treeItem.ts +++ b/src/components/features/task/view/treeItem.ts @@ -99,9 +99,6 @@ export class TaskTreeItemComponent extends Component { if (this.onTaskUpdate) { try { await this.onTaskUpdate(originalTask, updatedTask); - console.log( - "treeItem onTaskUpdate completed successfully" - ); // Don't update task reference here - let onContentEditFinished handle it } catch (error) { console.error("Error in treeItem onTaskUpdate:", error); diff --git a/src/components/ui/behavior/DragManager.ts b/src/components/ui/behavior/DragManager.ts index e829ee4e..f5b8f618 100644 --- a/src/components/ui/behavior/DragManager.ts +++ b/src/components/ui/behavior/DragManager.ts @@ -90,7 +90,6 @@ export class DragManager extends Component { event.key === "Escape" && (this.isDragging || this.isPotentialDrag) ) { - console.log("DragManager: Escape key pressed, cancelling drag."); event.stopPropagation(); // Prevent event from bubbling up // Optionally trigger a specific cancel event/callback here this.resetDragState(); @@ -166,12 +165,6 @@ export class DragManager extends Component { const deltaX = Math.abs(this.currentX - this.initialPointerX); const deltaY = Math.abs(this.currentY - this.initialPointerY); - console.log( - `DragManager: Pointer move. deltaX: ${deltaX}, deltaY: ${deltaY}, distance: ${Math.sqrt( - deltaX * deltaX + deltaY * deltaY - )}` - ); - // Check if threshold is exceeded if ( Math.sqrt(deltaX * deltaX + deltaY * deltaY) > @@ -240,7 +233,6 @@ export class DragManager extends Component { // Check if drag should proceed (callback) const proceed = this.options.onDragStart?.(this.startEventData); if (proceed === false) { - console.log("Drag start cancelled by callback"); this.resetDragState(); // Reset includes hasMovedBeyondThreshold return; } @@ -294,23 +286,14 @@ export class DragManager extends Component { } private handlePointerUp(event: PointerEvent): void { - console.log( - "DragManager: Pointer up", - event, - this.hasMovedBeyondThreshold - ); // Check if the drag threshold was ever crossed during the pointermove phase if (this.hasMovedBeyondThreshold) { // If movement occurred, prevent the click event regardless of drop success etc. event.preventDefault(); - // console.log(`DragManager: Preventing click because threshold was crossed.`); - } else { - // console.log(`DragManager: Not preventing click because threshold was not crossed.`); } // Check if it was essentially a click (potential drag never became actual drag) if (this.isPotentialDrag && !this.isDragging) { - // console.log("DragManager: PotentialDrag=true, IsDragging=false. Treating as click/short drag."); this.resetDragState(); // Clean up listeners etc. // Do not return here if preventDefault was called above // If hasMovedBeyondThreshold is false (no preventDefault), this allows the click @@ -320,14 +303,12 @@ export class DragManager extends Component { // Check if drag state is inconsistent or drag didn't actually start properly if (!this.isDragging || !this.draggedElement || !this.startEventData) { - // console.log(`DragManager: Inconsistent state? isDragging=${this.isDragging}, hasMoved=${this.hasMovedBeyondThreshold}`); this.resetDragState(); return; } // --- Drag End --- (Now we are sure a drag was properly started) // preventDefault() was potentially called at the beginning of this function. - // console.log("DragManager: Drag End logic. hasMovedBeyondThreshold:", this.hasMovedBeyondThreshold); // Determine potential drop target let dropTarget: HTMLElement | null = null; @@ -423,7 +404,6 @@ export class DragManager extends Component { // Reset initial pointer positions as well this.initialPointerX = 0; this.initialPointerY = 0; - // console.log("DragManager: resetDragState finished"); } // New method to handle highlighting drop targets during move diff --git a/src/components/ui/behavior/ViewComponentManager.ts b/src/components/ui/behavior/ViewComponentManager.ts index f7c203c1..edd9a9af 100644 --- a/src/components/ui/behavior/ViewComponentManager.ts +++ b/src/components/ui/behavior/ViewComponentManager.ts @@ -300,15 +300,6 @@ export class ViewComponentManager extends Component { const viewConfig = getViewSettingOrDefault(this.plugin, viewId); const specificViewType = viewConfig.specificConfig?.viewType; - console.log( - "isSpecialView", - viewId, - specificViewType, - ["calendar", "kanban", "gantt", "forecast", "table"].includes( - viewId, - ), - ); - return !!( specificViewType || ["calendar", "kanban", "gantt", "forecast", "table"].includes( diff --git a/src/components/ui/date-picker/DatePickerComponent.ts b/src/components/ui/date-picker/DatePickerComponent.ts index e99f6886..6d5aac44 100644 --- a/src/components/ui/date-picker/DatePickerComponent.ts +++ b/src/components/ui/date-picker/DatePickerComponent.ts @@ -264,7 +264,6 @@ export class DatePickerComponent extends Component { } private navigateMonth(direction: number): void { - console.log(`Navigating month: ${direction}`); this.currentViewDate.add(direction, "month"); this.render(); } diff --git a/src/components/ui/menus/IconMenu.ts b/src/components/ui/menus/IconMenu.ts index 780920a9..28946bea 100644 --- a/src/components/ui/menus/IconMenu.ts +++ b/src/components/ui/menus/IconMenu.ts @@ -27,7 +27,6 @@ export const attachIconMenu = ( } const showMenu = () => { - console.log("showMenu", availableIcons.length); if (!availableIcons.length) { new Notice("Icon list unavailable."); return; @@ -113,11 +112,8 @@ export const attachIconMenu = ( if (isSearchActive) return; if (scrollHeight - scrollTop - clientHeight < 50) { - // console.log("Near bottom detected"); if (currentBatch * ICONS_PER_BATCH < availableIcons.length) { renderIcons(availableIcons, false); - } else { - // console.log("No more icons to lazy load."); } } }; diff --git a/src/components/ui/modals/WorkspaceModals.ts b/src/components/ui/modals/WorkspaceModals.ts index daeaa7da..5cacae00 100644 --- a/src/components/ui/modals/WorkspaceModals.ts +++ b/src/components/ui/modals/WorkspaceModals.ts @@ -265,13 +265,6 @@ export class RenameWorkspaceModal extends Modal { } if (this.plugin.workspaceManager) { - console.log("[TG-WORKSPACE] modal:rename", { - id: this.workspace.id, - name: newName, - icon: this.selectedIcon, - color: this.selectedColor, - }); - await this.plugin.workspaceManager.renameWorkspace( this.workspace.id, newName, @@ -338,10 +331,6 @@ export class DeleteWorkspaceModal extends Modal { deleteButton.addEventListener("click", () => void (async () => { if (this.plugin.workspaceManager) { - console.log("[TG-WORKSPACE] modal:delete", { - id: this.workspace.id, - }); - await this.plugin.workspaceManager.deleteWorkspace( this.workspace.id, ); diff --git a/src/components/ui/suggest/SuggestManager.ts b/src/components/ui/suggest/SuggestManager.ts index 723dd74b..fb087cf0 100644 --- a/src/components/ui/suggest/SuggestManager.ts +++ b/src/components/ui/suggest/SuggestManager.ts @@ -223,14 +223,6 @@ export class SuggestManager { this.config = { ...this.config, ...newConfig }; } - /** - * Debug: Log current suggest order - */ - debugLogSuggestOrder(): void { - console.log("Current suggest order:", (this.app.workspace as WorkspaceWithEditorSuggest).editorSuggest.suggests); - console.log("Managed suggests:", Array.from(this.activeSuggests.keys())); - } - /** * Cleanup method for proper disposal */ diff --git a/src/core/task-indexer.ts b/src/core/task-indexer.ts index e15790bb..604d8f40 100644 --- a/src/core/task-indexer.ts +++ b/src/core/task-indexer.ts @@ -115,17 +115,6 @@ export class TaskIndexer extends Component implements TaskIndexerInterface { this.fileFilterManager, "inline" ); - // Reduce log spam: only log when include=true (actual work), - // or randomly sample the false cases. - if (include || Math.random() < 0.1) { - console.log( - "[TaskIndexer] modify event inline filter", - { - path: file.path, - include, - } - ); - } if (include) this.queueFileForIndexing(file); } }) @@ -140,10 +129,6 @@ export class TaskIndexer extends Component implements TaskIndexerInterface { this.fileFilterManager, "inline" ); - console.log("[TaskIndexer] delete event inline filter", { - path: file.path, - include, - }); if (include) this.removeFileFromIndex(file); } }) @@ -159,13 +144,6 @@ export class TaskIndexer extends Component implements TaskIndexerInterface { this.fileFilterManager, "inline" ); - console.log( - "[TaskIndexer] create event inline filter", - { - path: file.path, - include, - } - ); if (include) this.queueFileForIndexing(file); } }) @@ -222,10 +200,6 @@ export class TaskIndexer extends Component implements TaskIndexerInterface { public async initialize(): Promise { // Start with an empty cache this.taskCache = this.initEmptyCache(); - - console.log( - `Task indexer initialized with empty cache. Use updateIndexWithTasks to populate.` - ); } /** diff --git a/src/dataflow/Orchestrator.ts b/src/dataflow/Orchestrator.ts index 64cc9d7a..1f16efc3 100644 --- a/src/dataflow/Orchestrator.ts +++ b/src/dataflow/Orchestrator.ts @@ -121,27 +121,12 @@ export class DataflowOrchestrator { // Initialize FileFilterManager from settings early so sources get it try { const ffSettingsEarly = this.plugin.settings?.fileFilter; - console.log( - "[DataflowOrchestrator] Early FileFilter settings:", - JSON.stringify(ffSettingsEarly, null, 2), - ); if (ffSettingsEarly) { this.fileFilterManager = new FileFilterManager(ffSettingsEarly); - console.log( - "[DataflowOrchestrator] Created FileFilterManager early with stats:", - this.fileFilterManager.getStats(), - ); // Provide to repository's indexer for inline filtering immediately this.repository.setFileFilterManager?.( this.fileFilterManager, ); - console.log( - "[DataflowOrchestrator] Provided FileFilterManager to repository indexer", - ); - } else { - console.log( - "[DataflowOrchestrator] No FileFilter settings found, FileFilterManager not created", - ); } } catch (e) { console.warn( @@ -256,18 +241,11 @@ export class DataflowOrchestrator { this.fileFilterManager, this.plugin, ); - console.log( - "[DataflowOrchestrator] FileSource constructed with filterManager=", - !!this.fileFilterManager, - ); // Keep FileSource status mapping in sync with Task Status settings try { this.fileSource.syncStatusMappingFromSettings( this.plugin.settings.taskStatuses, ); - console.log( - "[DataflowOrchestrator] Synced FileSource status mapping from settings", - ); } catch (e) { console.warn( "[DataflowOrchestrator] Failed to sync FileSource status mapping on init", @@ -282,45 +260,20 @@ export class DataflowOrchestrator { */ async initialize(): Promise { const startTime = Date.now(); - console.log("[DataflowOrchestrator] Starting initialization..."); try { - // Initialize QueryAPI and Repository - console.log( - "[DataflowOrchestrator] Initializing QueryAPI and Repository...", - ); - // Initialize or sync FileFilterManager from settings (do not recreate if already exists) const ffSettings = this.plugin.settings?.fileFilter; - console.log( - "[DataflowOrchestrator] Initialize(): FileFilter settings:", - JSON.stringify(ffSettings, null, 2), - ); if (ffSettings) { if (!this.fileFilterManager) { this.fileFilterManager = new FileFilterManager(ffSettings); - console.log( - "[DataflowOrchestrator] Initialize(): Created FileFilterManager with stats:", - this.fileFilterManager.getStats(), - ); } else { this.fileFilterManager.updateConfig(ffSettings); - console.log( - "[DataflowOrchestrator] Initialize(): Updated FileFilterManager config; stats:", - this.fileFilterManager.getStats(), - ); } // Provide to repository's indexer for inline filtering this.repository.setFileFilterManager?.( this.fileFilterManager, ); - console.log( - "[DataflowOrchestrator] Initialize(): Provided FileFilterManager to repository indexer", - ); - } else { - console.log( - "[DataflowOrchestrator] Initialize(): No FileFilter settings", - ); } await this.queryAPI.initialize(); @@ -336,10 +289,6 @@ export class DataflowOrchestrator { ); if (Array.isArray(supFiles)) this.suppressedFileTasks = new Set(supFiles); - console.log("[DataflowOrchestrator] Loaded suppressed sets", { - inline: this.suppressedInline.size, - file: this.suppressedFileTasks.size, - }); } catch (e) { console.warn( "[DataflowOrchestrator] Failed loading suppressed sets", @@ -352,15 +301,8 @@ export class DataflowOrchestrator { // Check if we have cached data const taskCount = (await this.queryAPI.getAllTasks()).length; - console.log( - `[DataflowOrchestrator] Found ${taskCount} cached tasks`, - ); if (taskCount === 0) { - console.log( - "[DataflowOrchestrator] No cached tasks found, performing initial scan...", - ); - // Get all markdown and canvas files const mdFiles = this.vault.getMarkdownFiles(); const canvasFiles = this.vault @@ -368,10 +310,6 @@ export class DataflowOrchestrator { .filter((f) => f.extension === "canvas"); const allFiles = [...mdFiles, ...canvasFiles]; - console.log( - `[DataflowOrchestrator] Found ${allFiles.length} files to process`, - ); - // Process in batches for performance const BATCH_SIZE = 50; for (let i = 0; i < allFiles.length; i += BATCH_SIZE) { @@ -380,36 +318,22 @@ export class DataflowOrchestrator { } // Persist the initial index - console.log( - "[DataflowOrchestrator] Persisting initial index...", - ); await this.repository.persist(); const finalTaskCount = (await this.queryAPI.getAllTasks()) .length; - console.log( - `[DataflowOrchestrator] Initial scan complete, indexed ${finalTaskCount} tasks`, - ); } else { - console.log( - "[DataflowOrchestrator] Using cached tasks, skipping initial scan", - ); // The cache may still hold files removed while Obsidian was closed await this.repository.removeMissingFiles(); } // Subscribe to file update events from ObsidianSource and ICS events - console.log("[DataflowOrchestrator] Subscribing to events..."); this.subscribeToEvents(); // Initialize ObsidianSource to start listening for events - console.log( - "[DataflowOrchestrator] Initializing ObsidianSource...", - ); this.obsidianSource.onload(); // Initialize IcsSource to start listening for calendar events - console.log("[DataflowOrchestrator] Initializing IcsSource..."); this.icsSource.initialize().catch((error) => { console.error( "[DataflowOrchestrator] IcsSource initialization failed:", @@ -419,9 +343,6 @@ export class DataflowOrchestrator { // Initialize FileSource to start file recognition if (this.fileSource) { - console.log( - "[DataflowOrchestrator] Initializing FileSource...", - ); this.fileSource.initialize().catch((error) => { console.error( "[DataflowOrchestrator] FileSource initialization failed:", @@ -438,9 +359,6 @@ export class DataflowOrchestrator { }); const elapsed = Date.now() - startTime; - console.log( - `[DataflowOrchestrator] Initialization complete (took ${elapsed}ms)`, - ); } catch (error) { console.error( "[DataflowOrchestrator] Initialization failed:", @@ -458,11 +376,6 @@ export class DataflowOrchestrator { this.eventRefs.push( on(this.app, Events.ICS_EVENTS_UPDATED, (payload: IcsEventsUpdatedPayload) => void (async () => { const { events, seq } = payload; - console.log( - `[DataflowOrchestrator] ICS_EVENTS_UPDATED: ${ - events?.length || 0 - } events`, - ); // Update repository with ICS events if (events) { @@ -475,9 +388,6 @@ export class DataflowOrchestrator { this.eventRefs.push( on(this.app, Events.FILE_UPDATED, (payload: FileUpdatedPayload) => void (async () => { const { path, reason } = payload; - console.log( - `[DataflowOrchestrator] FILE_UPDATED event: ${path} (${reason})`, - ); if (reason === "delete") { // Remove file from index @@ -506,17 +416,10 @@ export class DataflowOrchestrator { // Skip if no sourceSeq (likely from ObsidianSource - deprecated path) if (!sourceSeq) { - console.log( - `[DataflowOrchestrator] Ignoring TASK_CACHE_UPDATED without sourceSeq`, - ); return; } if (changedFiles && Array.isArray(changedFiles)) { - console.log( - `[DataflowOrchestrator] Batch update for ${changedFiles.length} files`, - ); - // Process each file for (const filePath of changedFiles) { const file = this.vault.getFileByPath(filePath); @@ -535,9 +438,6 @@ export class DataflowOrchestrator { Events.WRITE_OPERATION_COMPLETE, (payload: WriteOperationCompletePayload) => void (async () => { const { path, taskId } = payload; - console.log( - `[DataflowOrchestrator] WRITE_OPERATION_COMPLETE: ${path}, taskId: ${taskId}`, - ); // If we have a taskId, it means a specific task was updated // We'll handle this through TASK_UPDATED event instead @@ -559,9 +459,6 @@ export class DataflowOrchestrator { on(this.app, Events.TASK_UPDATED, (payload: TaskPayload) => void (async () => { const { task } = payload; if (task) { - console.log( - `[DataflowOrchestrator] TASK_UPDATED: ${task.id} in ${task.filePath}`, - ); // Update the single task directly in the repository await this.repository.updateSingleTask(task); } @@ -572,11 +469,6 @@ export class DataflowOrchestrator { this.eventRefs.push( on(this.app, Events.TASK_DELETED, (payload: TaskDeletedPayload) => void (async () => { const { taskId, filePath, deletedTaskIds, mode } = payload; - console.log( - `[DataflowOrchestrator] TASK_DELETED: ${taskId} in ${filePath}, mode: ${mode}, deleted: ${ - deletedTaskIds?.length || 1 - } tasks`, - ); // Remove deleted tasks from repository if (deletedTaskIds && deletedTaskIds.length > 0) { @@ -598,9 +490,6 @@ export class DataflowOrchestrator { this.eventRefs.push( on(this.app, Events.FILE_TASK_UPDATED, (payload: TaskPayload) => void (async () => { const { task } = payload; - console.log( - `[DataflowOrchestrator] FILE_TASK_UPDATED: ${task?.filePath}`, - ); if (task) { await this.applyFileTaskProject(task); @@ -612,9 +501,6 @@ export class DataflowOrchestrator { this.eventRefs.push( on(this.app, Events.FILE_TASK_REMOVED, (payload: FileTaskRemovedPayload) => void (async () => { const { filePath } = payload; - console.log( - `[DataflowOrchestrator] FILE_TASK_REMOVED: ${filePath}`, - ); if (filePath) { await this.repository.removeFileTask(filePath); @@ -686,13 +572,6 @@ export class DataflowOrchestrator { const rawCached = await this.storage.loadRaw(filePath); const augmentedCached = await this.storage.loadAugmented(filePath); const fileContent = await this.vault.cachedRead(file); - console.log("[DataflowOrchestrator] processFileImmediate start", { - filePath, - forceInvalidate, - mtime, - hasRawCached: !!rawCached, - hasAugmentedCached: !!augmentedCached, - }); let augmentedTasks: Task[]; @@ -705,9 +584,6 @@ export class DataflowOrchestrator { this.storage.isRawValid(filePath, rawCached, fileContent, mtime) ) { // Use cached augmented tasks - file hasn't changed and we have augmented data - console.log( - `[DataflowOrchestrator] Using cached augmented tasks for ${filePath} (mtime match)`, - ); augmentedTasks = augmentedCached.data; // Apply inline filter even when using cached augmented tasks const includeInlineCached = this.fileFilterManager @@ -716,10 +592,6 @@ export class DataflowOrchestrator { "inline", ) : true; - console.log( - "[DataflowOrchestrator] Inline filter decision (cached augmented)", - { filePath, includeInline: includeInlineCached }, - ); if (!includeInlineCached) { augmentedTasks = []; } @@ -739,33 +611,16 @@ export class DataflowOrchestrator { ) ) { // Use cached raw tasks but re-augment (project data might have changed) - console.log( - `[DataflowOrchestrator] Re-augmenting cached raw tasks for ${filePath}`, - ); const includeInlineReaugment = this.fileFilterManager ? this.fileFilterManager.shouldIncludePath( filePath, "inline", ) : true; - console.log( - "[DataflowOrchestrator] Inline filter decision (re-augment cached raw)", - { filePath, includeInline: includeInlineReaugment }, - ); rawTasks = includeInlineReaugment ? rawCached.data : []; projectData = await this.projectResolver.get(filePath); } else { // Parse the file from scratch - if (forceInvalidate) { - console.log( - `[DataflowOrchestrator] Parsing ${filePath} (forced invalidation from WriteAPI)`, - ); - } else { - console.log( - `[DataflowOrchestrator] Parsing ${filePath} (cache miss or mtime mismatch)`, - ); - } - // Get project data first for parsing projectData = await this.projectResolver.get(filePath); @@ -811,10 +666,6 @@ export class DataflowOrchestrator { "inline", ) : true; - console.log( - "[DataflowOrchestrator] Inline filter decision (parse path)", - { filePath, includeInline: includeInlineParse }, - ); if (includeInlineParse) { // Parse the file using workers (single-file path) rawTasks = await this.workerOrchestrator.parseFileTasks( @@ -1045,17 +896,9 @@ export class DataflowOrchestrator { ? settings.fileFilter.rules.filter((r) => r?.enabled) .length : 0; - console.log("[TG Index Filter] settingsChange", { - enabled: newEnabled, - mode: settings?.fileFilter?.mode, - rulesCount, - }); this.lastFileFilterEnabled = newEnabled; // Plan B: Always prune then restore (debounced) on any fileFilter change - console.log("[TG Index Filter] action", { - action: "PRUNE_THEN_RESTORE", - }); this.pruneByFilter().catch((error) => { console.error( "[DataflowOrchestrator] pruneByFilter failed:", @@ -1130,13 +973,6 @@ export class DataflowOrchestrator { ); } const elapsed = Date.now() - start; - console.log("[DataflowOrchestrator] pruneByFilter", { - prunedInline, - prunedFileTasks, - elapsed, - inlineSuppressedSize: this.suppressedInline.size, - fileSuppressedSize: this.suppressedFileTasks.size, - }); } catch (e) { console.warn("[DataflowOrchestrator] pruneByFilter failed", e); } @@ -1183,10 +1019,6 @@ export class DataflowOrchestrator { "inline", ), ); - console.log( - "[DataflowOrchestrator] restoreByFilter fallback candidates", - { extra: inlineCandidates.length }, - ); } catch (e) { console.warn( "[DataflowOrchestrator] fallback candidate discovery failed", @@ -1314,14 +1146,6 @@ export class DataflowOrchestrator { } const elapsed = Date.now() - start; - console.log("[DataflowOrchestrator] restoreByFilter", { - restoredFromAugmented, - restoredFromRaw, - reparsed, - totalInline: inlineCandidates.length, - totalFileTasks: fileTaskCandidates.length, - elapsed, - }); } catch (e) { console.warn("[DataflowOrchestrator] restoreByFilter failed", e); } @@ -1423,10 +1247,6 @@ export class DataflowOrchestrator { if (shouldUseWorkers) { // Use WorkerOrchestrator for parallel processing - console.log( - `[DataflowOrchestrator] Using workers to process ${files.length} files in parallel`, - ); - try { // Configure worker manager with plugin settings const taskWorkerManager = @@ -1452,9 +1272,6 @@ export class DataflowOrchestrator { } // Parse all files in parallel using workers (raw parsing only, no project data) - console.log( - `[DataflowOrchestrator] Parsing ${files.length} files with workers (raw extraction)...`, - ); const parsedResults = await this.workerOrchestrator.batchParse( files, "normal", @@ -1537,10 +1354,6 @@ export class DataflowOrchestrator { ); } } - - console.log( - `[DataflowOrchestrator] Worker processing complete, parsed ${parsedResults.size} files`, - ); } catch (error) { console.error( "[DataflowOrchestrator] Worker processing failed, falling back to sequential:", @@ -1554,12 +1367,6 @@ export class DataflowOrchestrator { await this.processBatchSequential(files, updates, skippedCount); } - if (skippedCount > 0) { - console.log( - `[DataflowOrchestrator] Skipped ${skippedCount} unchanged files`, - ); - } - // Update repository in batch if (updates.size > 0) { // Generate a unique sequence for this batch operation @@ -1671,10 +1478,6 @@ export class DataflowOrchestrator { "inline", ) : true; - console.log( - "[DataflowOrchestrator] Inline filter decision", - { filePath, includeInline }, - ); const rawTasks = includeInline ? await this.parseFile(file, projectData.tgProject) : []; diff --git a/src/dataflow/api/QueryAPI.ts b/src/dataflow/api/QueryAPI.ts index 0dc680b9..bebc2118 100644 --- a/src/dataflow/api/QueryAPI.ts +++ b/src/dataflow/api/QueryAPI.ts @@ -243,12 +243,10 @@ export class QueryAPI { */ async ensureCache(): Promise { if (!this.taskCache) { - console.log("[QueryAPI] Populating initial cache..."); try { const tasks = await this.repository.all(); this.taskCache = tasks; this.cacheTimestamp = Date.now(); - console.log(`[QueryAPI] Cache populated with ${tasks.length} tasks`); } catch (error) { console.error("[QueryAPI] Failed to populate initial cache:", error); } diff --git a/src/dataflow/api/WriteAPI.ts b/src/dataflow/api/WriteAPI.ts index deb47763..d919f26c 100644 --- a/src/dataflow/api/WriteAPI.ts +++ b/src/dataflow/api/WriteAPI.ts @@ -718,12 +718,6 @@ export class WriteAPI { // Best-effort cleanup; ignore regex issues } - console.log( - "edit content", - taskContent, - afterCheckbox, - ); - const mergedMd = { ...originalTask.metadata, ...args.updates.metadata, @@ -787,9 +781,6 @@ export class WriteAPI { // Insert the new task line after the current task lines.splice(originalTask.line + 1, 0, newTaskLine); - console.log( - `Created new recurring task after line ${originalTask.line}`, - ); } } catch (error) { console.error("Error creating recurring task:", error); @@ -957,9 +948,6 @@ export class WriteAPI { // Use custom field name if mapped const statusKey = getFrontmatterKey("status"); fm[statusKey] = statusValue; - console.log( - `[WriteAPI][FileSource] Updated ${statusKey}: ${originalTask.status} -> ${statusValue} (symbol: ${updates.status})`, - ); } // Handle metadata updates @@ -1092,10 +1080,6 @@ export class WriteAPI { } } }); - - console.log( - `[WriteAPI][FileSource] Updated frontmatter for file-source task: ${file.path}`, - ); } catch (error) { console.error( "WriteAPI: Error updating file-source task frontmatter:", @@ -1126,16 +1110,8 @@ export class WriteAPI { fm.title = updates.content; }, ); - console.log( - "[WriteAPI][FileSource] wrote fm.title (branch: title)", - { title: updates.content }, - ); const cacheAfter = this.app.metadataCache.getFileCache(file); - console.log( - "[WriteAPI][FileSource] cache fm.title after write (branch: title)", - { title: cacheAfter?.frontmatter?.title }, - ); break; } case "h1": { @@ -1150,24 +1126,8 @@ export class WriteAPI { fm[customContentField] = updates.content; }, ); - console.log( - "[WriteAPI][FileSource] wrote fm[customContentField] (branch: custom)", - { - field: customContentField, - value: updates.content, - }, - ); const cacheAfter = this.app.metadataCache.getFileCache(file); - console.log( - "[WriteAPI][FileSource] cache fm[customContentField] after write (branch: custom)", - { - field: customContentField, - value: cacheAfter?.frontmatter?.[ - customContentField - ], - }, - ); } else if (preferFrontmatterTitle) { await this.app.fileManager.processFrontMatter( file, @@ -1175,25 +1135,13 @@ export class WriteAPI { fm.title = updates.content; }, ); - console.log( - "[WriteAPI][FileSource] wrote fm.title (branch: custom fallback)", - { title: updates.content }, - ); const cacheAfter2 = this.app.metadataCache.getFileCache(file); - console.log( - "[WriteAPI][FileSource] cache fm.title after write (branch: custom fallback)", - { title: cacheAfter2?.frontmatter?.title }, - ); } else { newFilePath = await this.renameFile( file, updates.content, ); - console.log( - "[WriteAPI][FileSource] renamed file (branch: custom fallback)", - { newFilePath }, - ); } break; } @@ -1206,25 +1154,13 @@ export class WriteAPI { fm.title = updates.content; }, ); - console.log( - "[WriteAPI][FileSource] wrote fm.title (branch: filename/default)", - { title: updates.content }, - ); const cacheAfter = this.app.metadataCache.getFileCache(file); - console.log( - "[WriteAPI][FileSource] cache fm.title after write (branch: filename/default)", - { title: cacheAfter?.frontmatter?.title }, - ); } else { newFilePath = await this.renameFile( file, updates.content, ); - console.log( - "[WriteAPI][FileSource] renamed file (branch: filename/default)", - { newFilePath }, - ); } break; } @@ -2894,9 +2830,6 @@ export class WriteAPI { } } catch { // rrulestr failed, fall back to simple parsing - console.log( - `Failed to parse recurrence '${task.metadata.recurrence}' with rrule. Falling back to simple logic.`, - ); } // --- Fallback Simple Parsing Logic --- @@ -3206,10 +3139,6 @@ export class WriteAPI { (updatedTask as Partial).icsEvent = result.event; } - console.log( - `[WriteAPI] Successfully updated ICS task ${originalTask.id}`, - ); - return { success: true, task: updatedTask }; } catch (error) { console.error("[WriteAPI] Error updating ICS task:", error); diff --git a/src/dataflow/augment/DateInheritanceAugmentor.ts b/src/dataflow/augment/DateInheritanceAugmentor.ts index fe3719f9..b777b482 100644 --- a/src/dataflow/augment/DateInheritanceAugmentor.ts +++ b/src/dataflow/augment/DateInheritanceAugmentor.ts @@ -416,9 +416,6 @@ export class DateInheritanceAugmentor { updatedMetadata.enhancedDates.scheduledDateTime = combinedDateTime; break; } - - // Log successful resolution for debugging - console.log(`[DateInheritanceAugmentor] Resolved ${type} for task ${task.id}: ${date.toISOString()} (${result.source}, confidence: ${result.confidence})`); } updatedTask.metadata = updatedMetadata; diff --git a/src/dataflow/core/ConfigurableTaskParser.ts b/src/dataflow/core/ConfigurableTaskParser.ts index f94f83ce..45b28029 100644 --- a/src/dataflow/core/ConfigurableTaskParser.ts +++ b/src/dataflow/core/ConfigurableTaskParser.ts @@ -416,16 +416,6 @@ export class MarkdownTaskParser { const [key, value, newRemaining] = bracketMatch; metadata[key] = value; - // Debug: Log dataview metadata extraction, especially priority - if (key === "priority") { - // Always log for debugging - console.log("[Parser] Dataview priority found:", { - key, - value, - remaining: remaining.substring(0, 50), - }); - } - remaining = newRemaining; foundMatch = true; continue; diff --git a/src/dataflow/createDataflow.ts b/src/dataflow/createDataflow.ts index b171668e..82152eda 100644 --- a/src/dataflow/createDataflow.ts +++ b/src/dataflow/createDataflow.ts @@ -19,7 +19,6 @@ export async function createDataflow( projectOptions?: Partial ): Promise { const startTime = Date.now(); - console.log("[createDataflow] Creating dataflow orchestrator..."); const orchestrator = new DataflowOrchestrator( app, @@ -31,11 +30,9 @@ export async function createDataflow( // Expose orchestrator immediately so early consumers can subscribe to events plugin.dataflowOrchestrator = orchestrator; - console.log("[createDataflow] Initializing dataflow orchestrator..."); try { await orchestrator.initialize(); const elapsed = Date.now() - startTime; - console.log(`[createDataflow] Dataflow orchestrator ready (took ${elapsed}ms)`); } catch (error) { console.error("[createDataflow] Failed to initialize orchestrator:", error); if (plugin.dataflowOrchestrator === orchestrator) { diff --git a/src/dataflow/indexer/Repository.ts b/src/dataflow/indexer/Repository.ts index c06116b0..298569ba 100644 --- a/src/dataflow/indexer/Repository.ts +++ b/src/dataflow/indexer/Repository.ts @@ -64,13 +64,8 @@ export class Repository { * Initialize the repository (load persisted data if available) */ async initialize(): Promise { - console.log("[Repository] Initializing repository..."); - try { // Try to load consolidated index from storage - console.log( - "[Repository] Attempting to load consolidated index from storage..." - ); const consolidated = await this.storage.loadConsolidated(); if (consolidated && consolidated.data) { @@ -80,16 +75,10 @@ export class Repository { ? consolidated.data.tasks.size : Object.keys(consolidated.data.tasks).length : 0; - console.log( - `[Repository] Found persisted snapshot with ${snapshotTaskCount} tasks, restoring...` - ); await this.indexer.restoreFromSnapshot(consolidated.data); await this.normalizeRestoredProjects(); const taskCount = await this.indexer.getTotalTaskCount(); - console.log( - `[Repository] Index restored successfully with ${taskCount} tasks` - ); // Emit cache ready event emit(this.app, Events.CACHE_READY, { @@ -97,32 +86,19 @@ export class Repository { timestamp: Date.now(), seq: Seq.next(), }); - } else { - console.log( - "[Repository] No persisted data found, starting with empty index" - ); } // Load ICS events from storage - console.log("[Repository] Loading ICS events from storage..."); this.icsEvents = await this.storage.loadIcsEvents(); - console.log( - `[Repository] Loaded ${this.icsEvents.length} ICS events from storage` - ); // Load file tasks from storage - console.log("[Repository] Loading file tasks from storage..."); this.fileTasks = await this.storage.loadFileTasks(); for (const [path, task] of this.fileTasks) { this.fileTasks.set(path, normalizeTaskProject(task)); } - console.log( - `[Repository] Loaded ${this.fileTasks.size} file tasks from storage` - ); } catch (error) { console.error("[Repository] Error during initialization:", error); // Continue with empty index on error - console.log("[Repository] Continuing with empty index after error"); } } @@ -250,9 +226,6 @@ export class Repository { if (persist && hasActualChanges) { // Persist the consolidated index after batch updates await this.persist(); - console.log( - `[Repository] Persisted index after batch update of ${changedFiles.length} files with changes` - ); } // If forced emit but no changedFiles computed, include all update keys @@ -272,10 +245,6 @@ export class Repository { seq: this.lastSequence, sourceSeq: sourceSeq || 0, // Include source sequence for loop detection }); - } else { - console.log( - `[Repository] Batch update completed with no actual changes - skipping event emission` - ); } } @@ -376,8 +345,6 @@ export class Repository { * Update ICS events in the repository */ async updateIcsEvents(events: Task[], sourceSeq?: number): Promise { - console.log(`[Repository] Updating ${events.length} ICS events`); - // Store the new ICS events this.icsEvents = events; @@ -595,7 +562,6 @@ export class Repository { if (this.persistQueue.size > 0) { const queueSize = this.persistQueue.size; - console.log(`[Repository] Persisting after ${queueSize} changes`); await this.persist(); this.persistQueue.clear(); this.lastPersistTime = Date.now(); @@ -748,10 +714,6 @@ export class Repository { const filePath = updatedTask.filePath; if (!filePath) return; - console.log( - `[Repository] Updating single task: ${updatedTask.id} in ${filePath}` - ); - // Load existing augmented tasks for the file const existingAugmented = await this.storage.loadAugmented(filePath); if (!existingAugmented) { @@ -794,9 +756,5 @@ export class Repository { seq: this.lastSequence, sourceSeq: undefined, }); - - console.log( - `[Repository] Single task ${updatedTask.id} updated successfully` - ); } } diff --git a/src/dataflow/persistence/Storage.ts b/src/dataflow/persistence/Storage.ts index 7d209dd3..0b158e86 100644 --- a/src/dataflow/persistence/Storage.ts +++ b/src/dataflow/persistence/Storage.ts @@ -76,9 +76,6 @@ export class Storage { constructor(appId: string, version?: string) { this.currentVersion = version || "1.0.0"; // Use stable version instead of "unknown" this.cache = new LocalStorageCache(appId, this.currentVersion); - console.log( - `[Storage] Initialized with appId: ${appId}, version: ${this.currentVersion}` - ); } /** @@ -269,7 +266,6 @@ export class Storage { }; await this.cache.storeFile(Keys.icsEvents(), record); - console.log(`[Storage] Stored ${events.length} ICS events`); } /** @@ -309,7 +305,6 @@ export class Storage { }; await this.cache.storeFile(Keys.fileTasks(), record); - console.log(`[Storage] Stored ${tasks.size} file tasks`); } /** @@ -348,24 +343,15 @@ export class Storage { "taskIndex" ); if (!cached || !cached.data) { - console.log("[Storage] No consolidated cache found"); return null; } // Check version compatibility if (!this.isVersionValid(cached.data)) { - console.log( - "[Storage] Consolidated cache version mismatch, clearing..." - ); await this.cache.removeFile(Keys.consolidated()); return null; } - console.log( - `[Storage] Loaded consolidated cache with ${ - cached.data.data ? Object.keys(cached.data.data).length : 0 - } entries` - ); return cached.data; } catch (error) { console.error("[Storage] Error loading consolidated index:", error); @@ -384,9 +370,6 @@ export class Storage { data: taskCache, }; const count = taskCache ? Object.keys(taskCache).length : 0; - console.log( - `[Storage] Storing consolidated cache with ${count} entries` - ); await this.cache.storeConsolidatedCache("taskIndex", record); } diff --git a/src/dataflow/sources/FileSource.ts b/src/dataflow/sources/FileSource.ts index 34c5740b..16ba8ebe 100644 --- a/src/dataflow/sources/FileSource.ts +++ b/src/dataflow/sources/FileSource.ts @@ -110,8 +110,6 @@ export class FileSource { if (this.isInitialized) return; if (!this.config.isEnabled()) return; - console.log("[FileSource] Initializing FileSource..."); - // Subscribe to configuration changes this.config.onChange((newConfig) => { this.handleConfigChange(newConfig); @@ -128,12 +126,6 @@ export class FileSource { } catch (error) { console.error("[FileSource] Initial scan failed", error); } - - console.log( - `[FileSource] Initialized with strategies: ${this.config - .getEnabledStrategies() - .join(", ")}` - ); } /** @@ -473,9 +465,6 @@ export class FileSource { switch (config.matchMode) { case "prefix": if (normalizedPath.startsWith(normalizedPattern)) { - console.log( - `[FileSource] Path matches prefix pattern: ${pattern} for ${filePath}` - ); return true; } break; @@ -484,9 +473,6 @@ export class FileSource { try { const regex = new RegExp(normalizedPattern); if (regex.test(normalizedPath)) { - console.log( - `[FileSource] Path matches regex pattern: ${pattern} for ${filePath}` - ); return true; } } catch (e) { @@ -501,9 +487,6 @@ export class FileSource { if ( this.matchGlobPattern(normalizedPath, normalizedPattern) ) { - console.log( - `[FileSource] Path matches glob pattern: ${pattern} for ${filePath}` - ); return true; } break; @@ -620,8 +603,6 @@ export class FileSource { timestamp: Date.now(), seq, }); - - console.log(`[FileSource] Removed file task: ${filePath}`); } /** @@ -672,13 +653,6 @@ export class FileSource { config.fileTaskProperties.defaultStatus ); - // Log status mapping if conversion occurred - if (rawStatus && status !== rawStatus) { - console.log( - `[FileSource] Mapped status '${rawStatus}' to '${status}' for ${filePath}` - ); - } - // Create the file task const fileTask: Task = { id: `file-source:${filePath}`, @@ -1033,12 +1007,6 @@ export class FileSource { } } - if (projectValue) { - console.log( - `[FileSource] Extracted project from tag: ${projectValue}` - ); - } - return { project: projectValue, matchedTags }; } @@ -1235,8 +1203,6 @@ export class FileSource { timestamp: Date.now(), seq, }); - - console.log(`[FileSource] File task ${action}: ${task.filePath}`); } /** @@ -1270,12 +1236,7 @@ export class FileSource { * Perform initial scan of existing files */ private async performInitialScan(): Promise { - console.log("[FileSource] Performing initial scan..."); - const mdFiles = this.app.vault.getMarkdownFiles(); - console.log( - `[FileSource] Found ${mdFiles.length} markdown files to check` - ); let scannedCount = 0; let taskCount = 0; @@ -1304,36 +1265,8 @@ export class FileSource { } } - console.log( - `[FileSource] Initial scan complete: ${mdFiles.length} total files, ${relevantCount} relevant, ${scannedCount} scanned, ${taskCount} file tasks created` - ); - if (taskCount === 0 && relevantCount > 0) { - console.log( - `[FileSource] No file tasks created. Check if your files match the configured recognition strategies:` - ); const config = this.config.getConfig(); - if (config.recognitionStrategies.metadata.enabled) { - console.log( - `[FileSource] - Metadata strategy: requires frontmatter with fields: ${config.recognitionStrategies.metadata.taskFields.join( - ", " - )}` - ); - } - if (config.recognitionStrategies.tags.enabled) { - console.log( - `[FileSource] - Tag strategy: requires tags: ${config.recognitionStrategies.tags.taskTags.join( - ", " - )}` - ); - } - if (config.recognitionStrategies.paths.enabled) { - console.log( - `[FileSource] - Path strategy: requires files in paths: ${config.recognitionStrategies.paths.taskPaths.join( - ", " - )}` - ); - } } } @@ -1355,7 +1288,6 @@ export class FileSource { // Configuration changed while active - might need to rescan // This is a Phase 2 enhancement - console.log("[FileSource] Configuration updated"); } /** @@ -1428,8 +1360,6 @@ export class FileSource { destroy(): void { if (!this.isInitialized) return; - console.log("[FileSource] Destroying FileSource..."); - // Clear all debouncing timeouts for (const timeout of this.pendingUpdates.values()) { window.clearTimeout(timeout); @@ -1463,8 +1393,6 @@ export class FileSource { }); this.isInitialized = false; - - console.log("[FileSource] Cleanup complete"); } /** @@ -1492,7 +1420,5 @@ export class FileSource { // Reset state this.isInitialized = false; this.stats.initialized = false; - - console.log("[FileSource] Cleaned up and stopped"); } } diff --git a/src/dataflow/sources/IcsSource.ts b/src/dataflow/sources/IcsSource.ts index 967ee62e..a953e395 100644 --- a/src/dataflow/sources/IcsSource.ts +++ b/src/dataflow/sources/IcsSource.ts @@ -26,8 +26,6 @@ export class IcsSource { async initialize(): Promise { if (this.isInitialized) return; - console.log("[IcsSource] Initializing ICS event source..."); - // Subscribe to ICS manager updates first so we don't miss early signals this.subscribeToIcsUpdates(); @@ -60,13 +58,11 @@ export class IcsSource { private subscribeToIcsUpdates(): void { // Listen for ICS cache updates this.app.workspace.on("task-genius:ics-cache-updated", () => { - console.log("[IcsSource] ICS cache updated, reloading events..."); void this.loadAndEmitIcsEvents(); }); // Listen for ICS configuration changes // this.app.workspace.on("task-genius:ics-config-changed", () => { - // console.log("[IcsSource] ICS config changed, reloading events..."); // this.loadAndEmitIcsEvents(); // }); } @@ -77,7 +73,6 @@ export class IcsSource { private async loadAndEmitIcsEvents(): Promise { const icsManager = this.getIcsManager(); if (!icsManager) { - console.log("[IcsSource] No ICS manager available"); return; } @@ -88,8 +83,6 @@ export class IcsSource { // Convert ICS events to IcsTask format via manager to ensure proper shape const icsTasks: Task[] = icsManager.convertEventsToTasks(icsEvents); - console.log(`[IcsSource] Loaded ${icsTasks.length} ICS events`); - // Generate sequence for this update this.lastIcsUpdateSeq = Seq.next(); @@ -139,7 +132,6 @@ export class IcsSource { * Refresh ICS events manually */ async refresh(): Promise { - console.log("[IcsSource] Manual refresh triggered"); await this.loadAndEmitIcsEvents(); } @@ -164,8 +156,6 @@ export class IcsSource { * Cleanup and destroy the source */ destroy(): void { - console.log("[IcsSource] Destroying ICS source..."); - // Clear event listeners for (const ref of this.eventRefs) { this.app.vault.offref(ref); diff --git a/src/dataflow/sources/ObsidianSource.ts b/src/dataflow/sources/ObsidianSource.ts index 2ab5b844..f42b3cfa 100644 --- a/src/dataflow/sources/ObsidianSource.ts +++ b/src/dataflow/sources/ObsidianSource.ts @@ -58,8 +58,6 @@ export class ObsidianSource extends Component { * Initialize event subscriptions */ initialize(): void { - console.log("ObsidianSource: Initializing event subscriptions"); - this.registerEvent( on(this.app, Events.WRITE_OPERATION_START, ({ path }) => { this.skipNextModify.add(path); @@ -84,10 +82,6 @@ export class ObsidianSource extends Component { this.registerEvent(this.metadataCache.on("changed", this.onMetadataChange.bind(this))) this.registerEvent(this.metadataCache.on("resolve", this.onMetadataResolve.bind(this))) - - console.log( - `ObsidianSource: Subscribed to ${this.eventRefs.length} event types` - ); } /** @@ -102,8 +96,6 @@ export class ObsidianSource extends Component { return; } - console.log(`ObsidianSource: File created - ${file.path}`); - // Emit immediate event for file creation emit(this.app, Events.FILE_UPDATED, { path: file.path, @@ -124,9 +116,6 @@ export class ObsidianSource extends Component { // The WriteAPI will emit WRITE_OPERATION_COMPLETE event which is handled by Orchestrator if (this.skipNextModify.has(file.path)) { this.skipNextModify.delete(file.path); - console.log( - `ObsidianSource: Skipping modify event for ${file.path} (handled by WriteAPI)` - ); return; } @@ -153,8 +142,6 @@ export class ObsidianSource extends Component { return; } - console.log(`ObsidianSource: File deleted - ${file.path}`); - // Clear any pending debounced action for this file (drop reference) if (this.pendingFileChanges.has(file.path)) { this.pendingFileChanges.delete(file.path); @@ -176,10 +163,6 @@ export class ObsidianSource extends Component { return; } - console.log( - `ObsidianSource: File renamed - ${oldPath} -> ${file.path}` - ); - // Clear any pending debounced action for the old path (drop reference) if (this.pendingFileChanges.has(oldPath)) { this.pendingFileChanges.delete(oldPath); @@ -210,9 +193,6 @@ export class ObsidianSource extends Component { // Skip if this metadata change is from WriteAPI // WriteAPI operations can trigger metadata changes, but we handle them via TASK_UPDATED if (this.skipNextModify.has(file.path)) { - console.log( - `ObsidianSource: Skipping metadata change for ${file.path} (handled by WriteAPI)` - ); return; } @@ -271,10 +251,6 @@ export class ObsidianSource extends Component { const files = Array.from(this.pendingBatch); this.pendingBatch.clear(); - console.log( - `ObsidianSource: Processing batch of ${files.length} files` - ); - // Emit batch update event emit(this.app, Events.TASK_CACHE_UPDATED, { changedFiles: files, @@ -294,10 +270,6 @@ export class ObsidianSource extends Component { filePath: string, reason: "modify" | "frontmatter" | "create" | "delete" | "rename" ): void { - console.log( - `ObsidianSource: Emitting file update - ${filePath} (${reason})` - ); - emit(this.app, Events.FILE_UPDATED, { path: filePath, reason, @@ -356,10 +328,6 @@ export class ObsidianSource extends Component { return; } - console.log( - `ObsidianSource: Manual batch trigger for ${filePaths.length} files` - ); - emit(this.app, Events.TASK_CACHE_UPDATED, { changedFiles: filePaths, stats: { @@ -375,8 +343,6 @@ export class ObsidianSource extends Component { * Force flush all pending debounced changes */ flush(): void { - console.log("ObsidianSource: Flushing all pending changes"); - // Process all pending file changes (invoke immediately and drop references) for (const filePath of Array.from(this.pendingFileChanges.keys())) { this.pendingFileChanges.delete(filePath); @@ -409,16 +375,12 @@ export class ObsidianSource extends Component { * Cleanup resources and unsubscribe from events */ destroy(): void { - console.log("ObsidianSource: Cleaning up event subscriptions"); - // Drop references to all pending debounced actions this.pendingFileChanges.clear(); this.pendingMetadataChanges.clear(); this.debouncedBatch = null; this.pendingBatch.clear(); - console.log("ObsidianSource: Cleanup complete"); - this.unload(); } diff --git a/src/dataflow/workers/ProjectDataWorkerManager.ts b/src/dataflow/workers/ProjectDataWorkerManager.ts index 06bd9404..9a647b2c 100644 --- a/src/dataflow/workers/ProjectDataWorkerManager.ts +++ b/src/dataflow/workers/ProjectDataWorkerManager.ts @@ -80,32 +80,19 @@ export class ProjectDataWorkerManager { private initializeWorkers(): void { // Prevent multiple initialization if (this.initialized) { - console.log( - "ProjectDataWorkerManager: Workers already initialized, skipping initialization" - ); return; } if (!this.enableWorkers) { - console.log( - "ProjectDataWorkerManager: Workers disabled, using cache-only optimization" - ); return; } // Ensure any existing workers are cleaned up first if (this.workers.length > 0) { - console.log( - "ProjectDataWorkerManager: Cleaning up existing workers before re-initialization" - ); this.cleanupWorkers(); } try { - console.log( - `ProjectDataWorkerManager: Initializing ${this.maxWorkers} workers` - ); - for (let i = 0; i < this.maxWorkers; i++) { const worker = new ProjectWorker(); @@ -124,9 +111,6 @@ export class ProjectDataWorkerManager { this.updateWorkerConfig(); this.initialized = true; - console.log( - `ProjectDataWorkerManager: Successfully initialized ${this.workers.length} workers` - ); } catch (error) { console.warn( "ProjectDataWorkerManager: Failed to initialize workers, falling back to synchronous processing", @@ -161,8 +145,6 @@ export class ProjectDataWorkerManager { console.warn("Failed to update worker config:", error); } } - - console.log("ProjectDataWorkerManager: Updated worker configuration"); } /** @@ -286,10 +268,6 @@ export class ProjectDataWorkerManager { return result; } - console.log( - `ProjectDataWorkerManager: Computing project data for ${filePaths.length} files using ${this.workers.length} workers` - ); - try { // Prepare file data for workers const files = await Promise.all( @@ -360,10 +338,6 @@ export class ProjectDataWorkerManager { } } } - - console.log( - `ProjectDataWorkerManager: Successfully processed ${result.size}/${filePaths.length} files with workers` - ); } catch (error) { console.warn( "Failed to compute batch project data with workers:", @@ -463,10 +437,6 @@ export class ProjectDataWorkerManager { ): Promise> { const result = new Map(); - console.log( - `ProjectDataWorkerManager: Computing project data for ${filePaths.length} files using fallback method` - ); - // Process files in parallel using Promise.all for better performance than sequential const dataPromises = filePaths.map(async (filePath) => { try { @@ -706,8 +676,6 @@ export class ProjectDataWorkerManager { reject(new Error("Workers being reinitialized")); } this.pendingRequests.clear(); - - console.log("ProjectDataWorkerManager: Cleaned up existing workers"); } /** @@ -719,7 +687,5 @@ export class ProjectDataWorkerManager { // Reset initialization flag this.initialized = false; - - console.log("ProjectDataWorkerManager: Destroyed"); } } diff --git a/src/dataflow/workers/TaskWorkerManager.ts b/src/dataflow/workers/TaskWorkerManager.ts index 5f04a883..680bd161 100644 --- a/src/dataflow/workers/TaskWorkerManager.ts +++ b/src/dataflow/workers/TaskWorkerManager.ts @@ -42,8 +42,6 @@ export interface WorkerPoolOptions { maxWorkers: number; /** Target CPU utilization (0.1 to 1.0) */ cpuUtilization: number; - /** Whether to enable debug logging */ - debug?: boolean; /** * Per-task timeout in milliseconds. If a worker doesn't post a response * within this window the worker is terminated, the active task's promise @@ -89,7 +87,6 @@ export const DEFAULT_TASK_WORKER_TIMEOUT_MS = 8000; export const DEFAULT_WORKER_OPTIONS: WorkerPoolOptions = { maxWorkers: 1, // Reduced from 2 to 1 to minimize total worker count cpuUtilization: 0.75, - debug: false, settings: { preferMetadataFormat: "tasks", useDailyNotePathAsDate: false, @@ -296,13 +293,11 @@ export class TaskWorkerManager extends Component { private initializeWorkers(): void { // Prevent multiple initialization if (this.initialized) { - this.log("Workers already initialized, skipping initialization"); return; } // Ensure any existing workers are cleaned up first if (this.workers.size > 0) { - this.log("Cleaning up existing workers before re-initialization"); this.cleanupWorkers(); } @@ -315,16 +310,12 @@ export class TaskWorkerManager extends Component { try { const worker = this.newWorker(); this.workers.set(worker.id, worker); - this.log(`Initialized worker #${worker.id}`); } catch (error) { console.error("Failed to initialize worker:", error); } } this.initialized = true; - this.log( - `Initialized ${this.workers.size} workers (requested ${workerCount})` - ); // Check if we have any workers if (this.workers.size === 0) { @@ -366,11 +357,6 @@ export class TaskWorkerManager extends Component { if (retries < this.maxRetries) { // Retry the task - this.log( - `Retrying task for ${file.path} (attempt ${ - retries + 1 - })` - ); this.queueTaskWithPriority( file, promise, @@ -476,9 +462,6 @@ export class TaskWorkerManager extends Component { if (cachedTasks) { this.stats.filesSkipped++; this.updateCacheHitRatio(); - this.log( - `Using cached tasks for ${file.path} (${cachedTasks.length} tasks)` - ); return Promise.resolve(cachedTasks); } } @@ -539,16 +522,6 @@ export class TaskWorkerManager extends Component { filesToProcess.push(file); } - this.log( - `Batch processing: ${cachedCount} files from cache, ${ - filesToProcess.length - } files to process (cache hit ratio: ${ - cachedCount > 0 - ? ((cachedCount / files.length) * 100).toFixed(1) - : 0 - }%)` - ); - if (filesToProcess.length === 0) { return resultMap; // All files were cached } @@ -557,10 +530,6 @@ export class TaskWorkerManager extends Component { this.processedFiles = 0; this.totalFilesToProcess = filesToProcess.length; - this.log( - `Processing batch of ${filesToProcess.length} files (${cachedCount} cached)` - ); - try { // 将文件分成更小的批次,避免一次性提交太多任务 const batchSize = 10; @@ -630,9 +599,6 @@ export class TaskWorkerManager extends Component { progress % 10 === 0 || this.processedFiles === this.totalFilesToProcess ) { - this.log( - `Batch progress: ${progress}% (${this.processedFiles}/${this.totalFilesToProcess})` - ); } }); @@ -648,9 +614,6 @@ export class TaskWorkerManager extends Component { console.error("Error during batch processing:", error); } finally { this.isProcessingBatch = false; - this.log( - `Completed batch processing of ${files.length} files (${cachedCount} from cache, ${filesToProcess.length} processed)` - ); } return resultMap; @@ -841,7 +804,6 @@ export class TaskWorkerManager extends Component { } if (!worker.active) { - console.log("Received a stale worker message. Ignoring.", data); return; } @@ -853,9 +815,6 @@ export class TaskWorkerManager extends Component { const errorResult = data; if (retries < this.maxRetries) { - this.log( - `Retrying task for ${file.path} due to error: ${errorResult.error}` - ); this.queueTaskWithPriority( file, promise, @@ -983,8 +942,6 @@ export class TaskWorkerManager extends Component { worker.active[1].reject(new Error("Terminated")); worker.active = undefined; } - - this.log(`Terminated worker #${worker.id}`); } /** @@ -1034,9 +991,6 @@ export class TaskWorkerManager extends Component { try { const replacement = this.newWorker(); this.workers.set(replacement.id, replacement); - this.log( - `Spawned replacement worker #${replacement.id} after timeout`, - ); } catch (e) { console.error( "[TaskWorkerManager] Failed to spawn replacement worker after timeout:", @@ -1069,8 +1023,6 @@ export class TaskWorkerManager extends Component { } } } - - this.log("Cleaned up existing workers"); } /** @@ -1109,8 +1061,6 @@ export class TaskWorkerManager extends Component { // Reset initialization flag to allow re-initialization if needed this.initialized = false; - - this.log("Worker pool shut down"); } /** @@ -1181,13 +1131,4 @@ export class TaskWorkerManager extends Component { public isProcessingBatchTask(): boolean { return this.isProcessingBatch; } - - /** - * Log a message if debugging is enabled - */ - private log(message: string): void { - if (this.options.debug) { - console.log(`[TaskWorkerManager] ${message}`); - } - } } diff --git a/src/dataflow/workers/WorkerOrchestrator.ts b/src/dataflow/workers/WorkerOrchestrator.ts index 8de23c24..b223c274 100644 --- a/src/dataflow/workers/WorkerOrchestrator.ts +++ b/src/dataflow/workers/WorkerOrchestrator.ts @@ -252,9 +252,6 @@ export class WorkerOrchestrator { // Exponential backoff: wait 1s, 2s, 4s, etc. const delay = this.retryDelayMs * Math.pow(2, attempt - 1); await new Promise((resolve) => setTimeout(resolve, delay)); - console.log( - `WorkerOrchestrator: Retrying ${operationName}, attempt ${attempt}/${maxRetries}` - ); } return await operation(); @@ -295,9 +292,6 @@ export class WorkerOrchestrator { // Re-enable workers after 30 seconds setTimeout(() => { - console.log( - "WorkerOrchestrator: Re-enabling workers after cooldown period" - ); this.workersDisabled = false; this.workerFailureCount = 0; }, 30000); @@ -345,12 +339,7 @@ export class WorkerOrchestrator { */ setWorkerProcessingEnabled(enabled: boolean): void { this.enableWorkerProcessing = enabled; - if (!enabled) { - console.log( - "WorkerOrchestrator: Worker processing disabled, will use main thread parsing" - ); - } else { - console.log("WorkerOrchestrator: Worker processing enabled"); + if (enabled) { // Reset circuit breaker if re-enabling if ( this.workersDisabled && @@ -358,7 +347,6 @@ export class WorkerOrchestrator { ) { this.workersDisabled = false; this.workerFailureCount = 0; - console.log("WorkerOrchestrator: Circuit breaker reset"); } } } diff --git a/src/editor-extensions/core/extended-gutter.ts b/src/editor-extensions/core/extended-gutter.ts index 1fc79d6d..36001724 100644 --- a/src/editor-extensions/core/extended-gutter.ts +++ b/src/editor-extensions/core/extended-gutter.ts @@ -181,7 +181,6 @@ const gutterView = ViewPlugin.fromClass( this.dom.addClass("task-gutter-fixed"); } this.syncGutters(false); - console.log(view); view.contentDOM.parentElement?.appendChild(this.dom); } diff --git a/src/editor-extensions/date-time/date-manager.ts b/src/editor-extensions/date-time/date-manager.ts index c6ad4a84..47fc0e5b 100644 --- a/src/editor-extensions/date-time/date-manager.ts +++ b/src/editor-extensions/date-time/date-manager.ts @@ -554,13 +554,6 @@ function applyDateOperations( const safePosition = Math.min(absolutePosition, tr.newDoc.length); const clampedPosition = Math.max(0, safePosition); - // Keep minimal logging for debugging - if (clampedPosition !== absolutePosition) { - console.log( - `[AutoDateManager] Position adjusted: ${absolutePosition} -> ${clampedPosition} (doc length: ${tr.newDoc.length})`, - ); - } - changes.push({ from: clampedPosition, to: clampedPosition, diff --git a/src/editor-extensions/date-time/task-timer.ts b/src/editor-extensions/date-time/task-timer.ts index 0277b236..e11c19c5 100644 --- a/src/editor-extensions/date-time/task-timer.ts +++ b/src/editor-extensions/date-time/task-timer.ts @@ -90,20 +90,11 @@ class TaskTimerWidget extends WidgetType { this.currentTaskStatus && this.currentTaskStatus !== currentStatus ) { - console.log( - "[TaskTimer] Task status changed from", - this.currentTaskStatus, - "to", - currentStatus - ); return false; } // Force widget recreation if task becomes completed if (currentStatus === "completed") { - console.log( - "[TaskTimer] Task is completed, forcing widget removal" - ); return false; } @@ -128,16 +119,6 @@ class TaskTimerWidget extends WidgetType { const line = this.state.doc.lineAt(this.lineFrom); this.currentTaskStatus = this.getTaskStatus(line.text); - // Add debug info - console.log( - "[TaskTimer] Creating widget for line", - this.lineFrom, - "status:", - this.currentTaskStatus, - "blockId:", - this.existingBlockId - ); - // Load timer state if we have a block ID if (this.existingBlockId) { this.loadTimerState(); @@ -198,10 +179,6 @@ class TaskTimerWidget extends WidgetType { const line = this.state.doc.lineAt(this.lineFrom); const taskStatus = this.getTaskStatus(line.text); this.currentTaskStatus = taskStatus; // Update stored status - console.log( - "[TaskTimer] createContent - current task status:", - taskStatus - ); // Don't show timer for completed tasks if (taskStatus === "completed") { @@ -214,9 +191,6 @@ class TaskTimerWidget extends WidgetType { this.timerState && this.timerState.status !== "idle" ) { - console.log( - "[TaskTimer] Found active timer for task with block ID" - ); // Show timer based on existing state // Get total duration from timer manager const taskId = this.getTaskId(); @@ -292,9 +266,6 @@ class TaskTimerWidget extends WidgetType { this.addActionLink("Reset", () => this.resetTimer()); } else { // Task is in-progress with block ID but no timer state - auto-start timer - console.log( - "[TaskTimer] In-progress task with block ID but no timer state, auto-starting" - ); this.startTimer(); // Timer will be shown after state update return; @@ -306,7 +277,6 @@ class TaskTimerWidget extends WidgetType { startSpan.addEventListener("click", (e) => { e.preventDefault(); e.stopPropagation(); - console.log("[TaskTimer] Start button clicked"); this.startTimer(); }); } else { @@ -367,7 +337,6 @@ class TaskTimerWidget extends WidgetType { // Try to get from state field first const view = this.state.field(editorEditorField, false); if (view) { - console.log("[TaskTimer] Got EditorView from editorEditorField"); return view; } @@ -380,16 +349,10 @@ class TaskTimerWidget extends WidgetType { EditorWithCmView; // For CM6 editor if (editor.cm) { - console.log( - "[TaskTimer] Got EditorView from activeView.editor.cm" - ); return editor.cm; } // Some versions might have it as cm6 if (editor.cm6) { - console.log( - "[TaskTimer] Got EditorView from activeView.editor.cm6" - ); return editor.cm6; } } @@ -403,11 +366,9 @@ class TaskTimerWidget extends WidgetType { const editor = activeLeaf.view.editor; // Check for CodeMirror 6 if (editor.cm) { - console.log("[TaskTimer] Got EditorView from editor.cm"); return editor.cm; } if (editor.cm6) { - console.log("[TaskTimer] Got EditorView from editor.cm6"); return editor.cm6; } } @@ -420,7 +381,6 @@ class TaskTimerWidget extends WidgetType { Element & { cmView?: { view: EditorView } } >(".cm-editor"); if (cmEditor && cmEditor.cmView) { - console.log("[TaskTimer] Got EditorView from DOM element"); return cmEditor.cmView.view; } } @@ -451,13 +411,8 @@ class TaskTimerWidget extends WidgetType { // Replace task status marker - match any character(s) inside brackets const updatedText = lineText.replace(/\[([^\]]*)\]/, newStatus); - console.log(`[TaskTimer] updateTaskStatus - original: "${lineText}"`); - console.log(`[TaskTimer] updateTaskStatus - newStatus: "${newStatus}"`); - console.log(`[TaskTimer] updateTaskStatus - updated: "${updatedText}"`); - if (updatedText === lineText) { // No change needed - console.log("[TaskTimer] updateTaskStatus - no change needed"); return false; } @@ -510,7 +465,6 @@ class TaskTimerWidget extends WidgetType { // Get EditorView using our helper method const view = this.getEditorView(); - console.log("[TaskTimer] EditorView:", view); if (view) { const line = this.state.doc.lineAt(this.lineFrom); @@ -527,10 +481,6 @@ class TaskTimerWidget extends WidgetType { .replace(/\[([^\]]+)\]/, `[${inProgressMarker}]`) .trimEnd() + blockRef; - console.log(`[TaskTimer] Updating line ${line.number}`); - console.log("[TaskTimer] Original text:", lineText); - console.log("[TaskTimer] Updated text:", updatedText); - try { // Replace the entire line with updated status and block reference view.dispatch({ @@ -547,9 +497,6 @@ class TaskTimerWidget extends WidgetType { this.existingBlockId = blockId; // Start the timer after inserting block ID - console.log( - `[TaskTimer] Starting timer for newly created task with blockId: ${blockId}` - ); this.timerManager.startTimer(this.filePath, blockId); this.startRealtimeUpdates(); this.updateTimerState(); @@ -568,7 +515,6 @@ class TaskTimerWidget extends WidgetType { console.error("[TaskTimer] No EditorView available"); // Fallback: try to get editor from editorInfoField const editorInfo = this.state.field(editorInfoField); - console.log("[TaskTimer] Trying editorInfo:", editorInfo); if (editorInfo?.editor) { const line = this.state.doc.lineAt(this.lineFrom); @@ -598,9 +544,6 @@ class TaskTimerWidget extends WidgetType { this.existingBlockId = blockId; // Start timer for the fallback path as well - console.log( - `[TaskTimer] Starting timer for newly created task (fallback) with blockId: ${blockId}` - ); this.timerManager.startTimer( this.filePath, blockId @@ -639,16 +582,12 @@ class TaskTimerWidget extends WidgetType { } // Start or resume the timer - console.log( - `[TaskTimer] Starting/resuming timer for task: ${taskId}` - ); this.timerManager.startTimer( this.filePath, this.existingBlockId ); this.updateTimerState(); this.refreshUI(); // This will start real-time updates if needed - console.log("[TaskTimer] Timer started successfully"); } } catch (error) { console.error("[TaskTimer] Error starting timer:", error); @@ -677,21 +616,16 @@ class TaskTimerWidget extends WidgetType { return; } - console.log(`[TaskTimer] Pausing timer for task: ${taskId}`); this.timerManager.pauseTimer(taskId); // DON'T update task status - just pause the timer // The timer state is stored in localStorage and will persist // This avoids conflicts with autoDateManager and other plugins - console.log( - "[TaskTimer] Timer paused without changing task status" - ); // Stop updates immediately this.stopRealtimeUpdates(); this.updateTimerState(); this.refreshUI(); // Refresh UI to show paused state - console.log("[TaskTimer] Timer paused successfully"); } catch (error) { console.error("[TaskTimer] Error pausing timer:", error); this.updateTimerState(); @@ -719,19 +653,14 @@ class TaskTimerWidget extends WidgetType { return; } - console.log(`[TaskTimer] Resuming timer for task: ${taskId}`); this.timerManager.resumeTimer(taskId); // DON'T update task status - just resume the timer // The user can manually change status if needed - console.log( - "[TaskTimer] Timer resumed without changing task status" - ); this.startRealtimeUpdates(); this.updateTimerState(); this.refreshUI(); // Refresh UI to show running state immediately - console.log("[TaskTimer] Timer resumed successfully"); } catch (error) { console.error("[TaskTimer] Error resuming timer:", error); this.stopRealtimeUpdates(); @@ -752,17 +681,14 @@ class TaskTimerWidget extends WidgetType { return; } - console.log(`[TaskTimer] Resetting timer for task: ${taskId}`); this.timerManager.resetTimer(taskId); // DON'T update task status - just reset the timer // Let user manually manage task status - console.log("[TaskTimer] Timer reset without changing task status"); this.stopRealtimeUpdates(); this.updateTimerState(); this.refreshUI(); // Refresh UI to show reset state - console.log("[TaskTimer] Timer reset successfully"); } catch (error) { console.error("[TaskTimer] Error resetting timer:", error); this.updateTimerState(); @@ -790,8 +716,6 @@ class TaskTimerWidget extends WidgetType { return; } - console.log(`[TaskTimer] Completing timer for task: ${taskId}`); - // Get the timer state before completing const timerState = this.timerManager.getTimerState(taskId); if (!timerState) { @@ -842,15 +766,6 @@ class TaskTimerWidget extends WidgetType { ); } - console.log( - "[TaskTimer] Completing task - original:", - lineText - ); - console.log( - "[TaskTimer] Completing task - updated:", - updatedText - ); - try { // Use dispatch to replace the entire line view.dispatch({ @@ -879,9 +794,6 @@ class TaskTimerWidget extends WidgetType { this.stopRealtimeUpdates(); this.updateTimerState(); - console.log( - `[TaskTimer] Timer completed successfully: ${formattedDuration}` - ); } catch (error) { console.error("[TaskTimer] Error completing timer:", error); this.updateTimerState(); @@ -899,13 +811,6 @@ class TaskTimerWidget extends WidgetType { if (taskId) { this.timerState = this.timerManager.getTimerState(taskId); if (this.timerState) { - console.log( - "[TaskTimer] Loaded timer state for", - this.filePath, - this.existingBlockId, - ":", - this.timerState - ); // If timer is running, start real-time updates immediately if (this.timerState.status === "running") { this.startRealtimeUpdates(); @@ -1022,46 +927,35 @@ const taskTimerStateField = StateField.define({ function createTaskTimerDecorations(state: EditorState): DecorationSet { // Get configuration from facet const timerConfig = state.facet(taskTimerConfigFacet); - console.log("[TaskTimer] Creating decorations, timerConfig:", timerConfig); if (!timerConfig?.settings?.enabled) { - console.log("[TaskTimer] Timer not enabled or no config"); return Decoration.none; } // Get editor info to access app and file information const editorInfo = state.field(editorInfoField); if (!editorInfo?.app) { - console.log("[TaskTimer] No editor info or app"); return Decoration.none; } const file = editorInfo.app.workspace.getActiveFile(); if (!file) { - console.log("[TaskTimer] No active file"); return Decoration.none; } - console.log("[TaskTimer] Processing file:", file.path); - const metadataDetector = new TaskTimerMetadataDetector( timerConfig.settings, timerConfig.metadataCache ); if (!metadataDetector.isTaskTimerEnabled(file)) { - console.log("[TaskTimer] Timer not enabled for file:", file.path); return Decoration.none; } - console.log("[TaskTimer] Timer enabled for file, processing..."); - const timerManager = new TaskTimerManager(timerConfig.settings); const decorations: Range[] = []; const doc = state.doc; - console.log("[TaskTimer] Document has", doc.lines, "lines"); - // First pass: find the minimum indentation level among all tasks let minIndentLevel = Infinity; for (let i = 1; i <= doc.lines; i++) { @@ -1077,8 +971,6 @@ function createTaskTimerDecorations(state: EditorState): DecorationSet { } } - console.log("[TaskTimer] Minimum indent level found:", minIndentLevel); - // Process all lines in the document for (let i = 1; i <= doc.lines; i++) { const line = doc.line(i); @@ -1086,8 +978,6 @@ function createTaskTimerDecorations(state: EditorState): DecorationSet { // Check if this line contains a task if (isTaskLine(lineText)) { - console.log("[TaskTimer] Found task line:", lineText.trim()); - // Check if this is a first-level task const currentIndent = lineText.match(/^(\s*)/)?.[1].length || 0; const isFirstLevel = currentIndent === minIndentLevel; @@ -1109,10 +999,6 @@ function createTaskTimerDecorations(state: EditorState): DecorationSet { const completedMarkers = taskStatuses.completed.split("|"); if (completedMarkers.includes(statusChar)) { - console.log( - "[TaskTimer] Skipping completed task at line", - i - ); continue; } @@ -1121,20 +1007,12 @@ function createTaskTimerDecorations(state: EditorState): DecorationSet { if (abandonedMarkers.includes(statusChar)) { const blockId = extractBlockRef(lineText); if (!blockId) { - console.log( - "[TaskTimer] Skipping abandoned task without block ID at line", - i - ); continue; } // If abandoned task has a block ID, let it continue to show timer - console.log( - "[TaskTimer] Abandoned task with block ID found, checking for timer state" - ); } } - console.log("[TaskTimer] Found first-level task at line", i); // Extract existing block reference if present const existingBlockId = extractBlockRef(lineText); @@ -1156,15 +1034,10 @@ function createTaskTimerDecorations(state: EditorState): DecorationSet { // Add decoration at the start of the line (this will appear above the task) decorations.push(timerDeco.range(line.from)); - console.log( - "[TaskTimer] Added timer decoration for first-level task at line:", - i - ); } } } - console.log("[TaskTimer] Created", decorations.length, "timer decorations"); return Decoration.set(decorations, true); } @@ -1247,42 +1120,17 @@ function handleTaskStatusChange(transaction: Transaction): void { const taskId = `taskTimer_${file.path}#${blockId}`; const existingTimer = timerManager.getTimerState(taskId); - console.log( - `[TaskTimer] Status change detected: "${statusChar}" for task ${taskId}` - ); - console.log(`[TaskTimer] Existing timer:`, existingTimer); - if (inProgressMarkers.includes(statusChar)) { // Task is now in progress if (!existingTimer || existingTimer.status === "idle") { - console.log( - "[TaskTimer] Status -> In Progress: Starting new timer" - ); timerManager.startTimer(file.path, blockId); } else if (existingTimer.status === "paused") { - console.log( - "[TaskTimer] Status -> In Progress: Resuming paused timer" - ); timerManager.resumeTimer(taskId); - } else if (existingTimer.status === "running") { - console.log( - "[TaskTimer] Status -> In Progress: Timer already running" - ); } } else if (abandonedMarkers.includes(statusChar)) { // Task is now abandoned - pause timer if running if (existingTimer && existingTimer.status === "running") { - console.log( - "[TaskTimer] Status -> Abandoned: Pausing running timer" - ); timerManager.pauseTimer(taskId); - } else if ( - existingTimer && - existingTimer.status === "paused" - ) { - console.log( - "[TaskTimer] Status -> Abandoned: Timer already paused" - ); } } else if (completedMarkers.includes(statusChar)) { // Task is completed - finalize timer and record duration @@ -1291,21 +1139,12 @@ function handleTaskStatusChange(transaction: Transaction): void { (existingTimer.status === "running" || existingTimer.status === "paused") ) { - console.log( - "[TaskTimer] Status -> Completed: Finalizing timer and recording duration" - ); // Complete the timer - this calculates final duration and removes from active list const duration = timerManager.completeTimer(taskId); - console.log( - `[TaskTimer] Timer completed with duration: ${duration}` - ); } } else if (notStartedMarkers.includes(statusChar)) { // Task is reset to not started - reset timer if (existingTimer) { - console.log( - "[TaskTimer] Status -> Not Started: Resetting timer" - ); timerManager.resetTimer(taskId); } } diff --git a/src/editor-extensions/task-operations/completion-monitor.ts b/src/editor-extensions/task-operations/completion-monitor.ts index 8858f015..d5c0e60e 100644 --- a/src/editor-extensions/task-operations/completion-monitor.ts +++ b/src/editor-extensions/task-operations/completion-monitor.ts @@ -285,11 +285,9 @@ function handleMonitorTaskCompletionTransaction( ) ).parseLegacy(newLineText, filePath)[0]; if (task) task.line = newLine.number; // line numbers are 1-based - console.log(task); // Trigger a custom event and also ensure WriteAPI handles completion side-effects (completion date + recurrence) if (task) { - console.log("trigger task-completed event"); debounceTrigger(app, task); // Best-effort: if we can identify the taskId, call WriteAPI to append completion metadata and create next recurring instance try { diff --git a/src/editor-extensions/task-operations/status-cycler.ts b/src/editor-extensions/task-operations/status-cycler.ts index c0bda3fc..9cfbb51e 100644 --- a/src/editor-extensions/task-operations/status-cycler.ts +++ b/src/editor-extensions/task-operations/status-cycler.ts @@ -106,11 +106,6 @@ function isValidTaskMarkerReplacement( return false; } - // Log successful validation for debugging - console.log( - `Valid task marker replacement detected. No user selection or selection doesn't cover replacement range. Original: '${originalText}' -> New: '${insertedText}' at position ${fromA}-${toA}`, - ); - return true; } @@ -252,14 +247,10 @@ export function findTaskStatusChanges( // Check if this is a new task creation with a newline if (insertedText.includes("\n")) { - console.log( - "New task creation detected with newline, skipping", - ); return; } if (insertedText.includes("[[") || insertedText.includes("]]")) { - console.log("Link detected, skipping"); return; } @@ -381,20 +372,10 @@ export function findTaskStatusChanges( ); if (!isValidReplacement) { - console.log( - `Detected invalid task marker replacement (fromA=${fromA}, toA=${toA}). User manually input '${insertedText}' (original: '${originalText}'), skipping automatic cycling.`, - ); return; // Skip this change, don't add to taskChanges } - - console.log( - `Detected valid task marker replacement (fromA=${fromA}, toA=${toA}). Original: '${originalText}' -> New: '${insertedText}', proceeding with automatic cycling.`, - ); } else { // Fallback to original logic for backwards compatibility - console.log( - `Detected replacement operation (fromA=${fromA}, toA=${toA}). User manually input '${insertedText}', skipping automatic cycling.`, - ); return; // Skip this change, don't add to taskChanges } } @@ -711,7 +692,6 @@ export function handleCycleCompleteStatusTransaction( taskStatusInfo; if (tasksInfo?.isTaskChange) { - console.log(tasksInfo); continue; } @@ -760,17 +740,9 @@ export function handleCycleCompleteStatusTransaction( nextMark = marks[nextStatus] || " "; } - // Log the cycle calculation for debugging - console.log( - `[Status Cycler] Calculated cycle: '${currentMark}' → '${nextMark}' (${nextStatus})`, - ); - // Check if the current mark is the same as what would be the next mark in the cycle // If they are the same, we don't need to process this further if (currentMark === nextMark) { - console.log( - `Current mark '${currentMark}' is already the next mark in the cycle. Skipping processing.`, - ); continue; } @@ -788,9 +760,6 @@ export function handleCycleCompleteStatusTransaction( // If user's input already matches the next mark, don't cycle if (userInputMark === nextMark) { - console.log( - `User input '${userInputMark}' already matches the next mark '${nextMark}' in the cycle. Skipping processing.`, - ); continue; } @@ -838,9 +807,6 @@ export function handleCycleCompleteStatusTransaction( // Don't cycle newly created empty tasks, even if alwaysCycleNewTasks is true // This prevents unexpected data loss when creating a task if (isNewEmptyTask || isManualTaskCreation) { - console.log( - `New empty task detected with mark ' ', leaving as is regardless of alwaysCycleNewTasks setting`, - ); continue; } @@ -857,26 +823,15 @@ export function handleCycleCompleteStatusTransaction( // Check if the mark position is within the current line and valid if (markPosition < lineAtMark.from || markPosition >= lineEnd) { - console.log( - `Mark position ${markPosition} is beyond the current line range ${lineAtMark.from}-${lineEnd}, skipping processing`, - ); continue; } // Ensure the modification range doesn't exceed the current line const validTo = Math.min(markPosition + 1, lineEnd); if (validTo <= markPosition) { - console.log( - `Invalid modification range ${markPosition}-${validTo}, skipping processing`, - ); continue; } - // Log the status cycle for debugging - console.log( - `[Status Cycler] Cycling at position ${markPosition}: '${currentMark}' → '${nextMark}'`, - ); - // Always use the calculated nextMark for consistent cycling behavior newChanges.push({ from: markPosition, @@ -887,14 +842,6 @@ export function handleCycleCompleteStatusTransaction( // If we found any changes to make, create a new transaction if (newChanges.length > 0) { - console.log(` - ✅ Returning ${newChanges.length} status changes:`); - newChanges.forEach((change, i) => { - console.log( - ` [${i}] Position ${change.from}-${change.to} → "${change.insert}"`, - ); - }); - console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"); - return { changes: newChanges, selection: tr.selection, @@ -903,8 +850,6 @@ export function handleCycleCompleteStatusTransaction( } // If no changes were made, return the original transaction - console.log(" - ❌ No changes to apply"); - console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"); return tr; } diff --git a/src/editor-extensions/workflow/workflow-handler.ts b/src/editor-extensions/workflow/workflow-handler.ts index 578cd5ff..6965edd8 100644 --- a/src/editor-extensions/workflow/workflow-handler.ts +++ b/src/editor-extensions/workflow/workflow-handler.ts @@ -499,13 +499,6 @@ export function handleWorkflowTransaction( } if (newChanges.length > 0) { - // Log only if processing with existing changes - if (hasExistingChanges) { - console.log( - `[WorkflowHandler] Applied ${newChanges.length} changes (adjusted for existing changes)` - ); - } - // Rebuild a single combined change list relative to the ORIGINAL doc // 1) Take the original transaction's changes as specs (relative to startState) const baseChangeSpecs: { from: number; to: number; insert: string }[] = diff --git a/src/executors/completion/archive-executor.ts b/src/executors/completion/archive-executor.ts index 68214a42..2f0d6326 100644 --- a/src/executors/completion/archive-executor.ts +++ b/src/executors/completion/archive-executor.ts @@ -25,8 +25,6 @@ export class ArchiveActionExecutor extends BaseActionExecutor { const archiveConfig = config as OnCompletionArchiveConfig; const { task, app } = context; - console.log("executeForCanvas", context, config, task); - try { // Get task content as markdown and clean it let taskContent = @@ -215,7 +213,6 @@ export class ArchiveActionExecutor extends BaseActionExecutor { // Get or create the archive file let archiveFile = app.vault.getFileByPath(archiveFilePath); - console.log("archiveFile", archiveFile, archiveFilePath); if (!archiveFile) { // Try to create the archive file if it doesn't exist try { diff --git a/src/index.ts b/src/index.ts index 90091dd4..f97e788b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -220,7 +220,6 @@ export default class TaskProgressBarPlugin extends Plugin { private iconsDeferred = false; async onload() { - console.time("[Task Genius] onload"); await initializeTranslations(); await this.loadSettings(); @@ -333,8 +332,6 @@ export default class TaskProgressBarPlugin extends Plugin { ); this.app.workspace.onLayoutReady(async () => { - console.time("[Task Genius] onLayoutReady"); - await this.initializeDeferredStartup(); // Update workspace leaves when layout is ready @@ -450,15 +447,11 @@ export default class TaskProgressBarPlugin extends Plugin { await this.checkAndShowOnboarding(); this.maybeShowChangelog(); - - console.timeEnd("[Task Genius] onLayoutReady"); }); await this.migratePresetTaskFiltersIfNeeded(); this.registerCoreCommands(); - - console.timeEnd("[Task Genius] onload"); } private async initializeDeferredStartup(): Promise { @@ -467,8 +460,6 @@ export default class TaskProgressBarPlugin extends Plugin { return; } - console.time("[Task Genius] initializeIndexer"); - this.registerTaskViews(); this.installWorkspaceGuards(); this.registerViewCommands(); @@ -477,7 +468,6 @@ export default class TaskProgressBarPlugin extends Plugin { const dataflowInitialized = await this.initializeDataflowOrchestrator(); if (!dataflowInitialized) { this.scheduleExtendedCommands(); - console.timeEnd("[Task Genius] initializeIndexer"); return; } @@ -498,8 +488,6 @@ export default class TaskProgressBarPlugin extends Plugin { } this.scheduleExtendedCommands(); - - console.timeEnd("[Task Genius] initializeIndexer"); } private async ensureFluentIntegration(): Promise { @@ -757,7 +745,6 @@ export default class TaskProgressBarPlugin extends Plugin { } this.onCompletionManager = new OnCompletionManager(this.app, this); this.addChild(this.onCompletionManager); - console.log("[Plugin] OnCompletionManager initialized"); } private initializeRewardManager(): void { @@ -855,7 +842,6 @@ export default class TaskProgressBarPlugin extends Plugin { return; } - console.time("[Task Genius] migratePresetTaskFilters"); this.settings.taskFilter.presetTaskFilters = presets.map( (preset) => { if (preset.options) { @@ -865,7 +851,6 @@ export default class TaskProgressBarPlugin extends Plugin { }, ); await this.saveSettings(); - console.timeEnd("[Task Genius] migratePresetTaskFilters"); } registerCommands() { @@ -887,9 +872,6 @@ export default class TaskProgressBarPlugin extends Plugin { // this.dataflowOrchestrator // ) { // // Use dataflow orchestrator for refresh - // console.log( - // "[Command] Refreshing task index via dataflow", - // ); // // Re-scan all files to refresh the index // const files = this.app.vault.getMarkdownFiles(); @@ -947,9 +929,6 @@ export default class TaskProgressBarPlugin extends Plugin { this.dataflowOrchestrator ) { // Use dataflow orchestrator for force reindex - console.log( - "[Command] Force reindexing via dataflow", - ); new Notice( t( "Clearing task cache and rebuilding index...", @@ -1182,11 +1161,6 @@ export default class TaskProgressBarPlugin extends Plugin { // in a half-migrated state. Behavior is identical to before W1. migrateSettings(this.settings); this.migrateInheritanceSettings(savedData); - } else if (result.changed) { - console.log( - "[Task Genius] Migrations applied:", - Object.values(result.results).flatMap((r) => r.details), - ); } } finally { delete (this.settings as SettingsWithTransientSavedData) @@ -1455,10 +1429,6 @@ export default class TaskProgressBarPlugin extends Plugin { await this.versionManager.checkVersionChange(); if (versionResult.requiresRebuild) { - console.log( - `Task Genius (Dataflow): ${versionResult.rebuildReason}`, - ); - // Get all supported files for progress tracking const allFiles = this.app.vault .getFiles() @@ -1494,11 +1464,6 @@ export default class TaskProgressBarPlugin extends Plugin { // Mark version as processed await this.versionManager.markVersionProcessed(); - } else { - // No rebuild needed, dataflow already initialized during creation - console.log( - "Task Genius (Dataflow): No rebuild needed, using existing cache", - ); } } catch (error) { console.error( @@ -1541,10 +1506,6 @@ export default class TaskProgressBarPlugin extends Plugin { // Store current version await this.versionManager.markVersionProcessed(); - - console.log( - "Emergency dataflow rebuild completed successfully", - ); } catch (emergencyError) { console.error( "Emergency dataflow rebuild failed:", diff --git a/src/managers/calendar-auth-manager.ts b/src/managers/calendar-auth-manager.ts index e2ed9929..acb3f79b 100644 --- a/src/managers/calendar-auth-manager.ts +++ b/src/managers/calendar-auth-manager.ts @@ -228,9 +228,6 @@ export class CalendarAuthManager extends Component { plugin.registerObsidianProtocolHandler(PROTOCOL_ACTION, (params) => { void this.handleOAuthCallback(params); }); - console.log( - `[CalendarAuthManager] Registered legacy protocol handler: ${LEGACY_REDIRECT_URI}`, - ); } /** @@ -319,10 +316,6 @@ export class CalendarAuthManager extends Component { // Open browser window.open(authUrl); - - console.log( - `[CalendarAuthManager] Started OAuth flow for ${provider} with redirect: ${redirectUri}`, - ); } catch (error) { console.error( `[CalendarAuthManager] Failed to start OAuth flow:`, @@ -390,9 +383,6 @@ export class CalendarAuthManager extends Component { this.callbackServer = server; this.callbackPort = port; const redirectUri = `http://${OAUTH_CALLBACK_HOST}:${port}${OAUTH_CALLBACK_PATH}`; - console.log( - `[CalendarAuthManager] Callback server started on ${redirectUri}`, - ); resolve(redirectUri); }); }; @@ -410,9 +400,6 @@ export class CalendarAuthManager extends Component { this.callbackServer!.close(() => { this.callbackServer = null; this.callbackPort = 0; - console.log( - "[CalendarAuthManager] Callback server stopped", - ); resolve(); }); }); @@ -501,11 +488,6 @@ export class CalendarAuthManager extends Component { private async handleOAuthCallback( params: Record, ): Promise { - console.log( - `[CalendarAuthManager] Received OAuth callback:`, - Object.keys(params), - ); - // Check for error response if (params.error) { const errorDescription = params.error_description || params.error; @@ -622,13 +604,6 @@ export class CalendarAuthManager extends Component { body.set("client_secret", config.clientSecret); } - console.log("[CalendarAuthManager] Token exchange request:", { - url: tokenUrl, - clientId: clientId.substring(0, 20) + "...", - redirectUri, - codeVerifierLength: codeVerifier.length, - }); - let response; try { response = await requestUrl({ @@ -651,11 +626,6 @@ export class CalendarAuthManager extends Component { throw new Error(`Token exchange network error: ${errMsg}`); } - console.log( - "[CalendarAuthManager] Token exchange response status:", - response.status, - ); - if (response.status !== 200) { let errorData; try { diff --git a/src/managers/completion-manager.ts b/src/managers/completion-manager.ts index a3461b88..e51551ee 100644 --- a/src/managers/completion-manager.ts +++ b/src/managers/completion-manager.ts @@ -38,8 +38,6 @@ export class OnCompletionManager extends Component { this.handleTaskCompleted.bind(this), ), ); - - console.log("OnCompletionManager loaded"); } private initializeExecutors() { @@ -70,8 +68,6 @@ export class OnCompletionManager extends Component { } private async handleTaskCompleted(task: Task) { - console.log("handleTaskCompleted", task); - // Auto-stop timer when task is completed (if timer is enabled) await this.autoStopTimerForCompletedTask(task); @@ -87,8 +83,6 @@ export class OnCompletionManager extends Component { task.metadata.onCompletion || "", ); - console.log("parseResult", parseResult); - if (!parseResult.isValid || !parseResult.config) { console.warn( "Invalid onCompletion configuration:", @@ -289,9 +283,6 @@ export class OnCompletionManager extends Component { const duration = timerManager.completeTimer(timer.taskId); if (duration) { - console.log( - `[OnCompletionManager] Timer auto-stopped for completed task. Duration: ${duration}`, - ); new Notice(t("Timer stopped") + `: ${duration}`); } } @@ -305,6 +296,5 @@ export class OnCompletionManager extends Component { onunload() { this.executors.clear(); - console.log("OnCompletionManager unloaded"); } } diff --git a/src/managers/desktop-integration-manager.ts b/src/managers/desktop-integration-manager.ts index d6f6823e..456ce769 100644 --- a/src/managers/desktop-integration-manager.ts +++ b/src/managers/desktop-integration-manager.ts @@ -128,7 +128,6 @@ export class DesktopIntegrationManager extends Component { } onunload(): void { - console.log("[TrayDebug] onunload called"); if (this.dailyTimeout) window.clearTimeout(this.dailyTimeout); if (this.midnightTimeout) window.clearTimeout(this.midnightTimeout); @@ -136,7 +135,6 @@ export class DesktopIntegrationManager extends Component { this.midnightTimeout = null; this.notifiedKeys.clear(); if (this.statusBarItem) { - console.log("[TrayDebug] Detaching status bar item"); this.statusBarItem.detach(); this.statusBarItem = null; } @@ -155,19 +153,16 @@ export class DesktopIntegrationManager extends Component { const g = window as unknown as TraySingletonHost; if (this.electronTray) { - console.log("[TrayDebug] Cleaning up electron tray"); try { // Remove all listeners first this.electronTray.removeAllListeners?.(); // Only destroy if we own this tray if (g[globalKey]?.owner === this.trayOwnerToken) { - console.log("[TrayDebug] Destroying owned tray"); this.electronTray.destroy?.(); // Clear the global reference since we destroyed it delete g[globalKey]; } else { - console.log("[TrayDebug] Not destroying tray - not owner"); // If we don't own it, replace context menu with an empty one to drop closures referencing this instance try { const electron = this.getElectron(); @@ -201,12 +196,10 @@ export class DesktopIntegrationManager extends Component { // Called when settings change public async reloadSettings(): Promise { - console.log("[TrayDebug] reloadSettings called"); this.onunload(); // Add a small delay to ensure cleanup completes await new Promise((resolve) => window.setTimeout(resolve, 100)); await this.onloadAsync(); - console.log("[TrayDebug] reloadSettings completed"); } // External nudge when task cache updates @@ -248,10 +241,8 @@ export class DesktopIntegrationManager extends Component { private async createOrAdoptElectronTray(): Promise { try { - console.log("[TrayDebug] createOrAdoptElectronTray called"); const electron = this.getElectron(); if (!electron) { - console.log("[TrayDebug] No electron available"); return false; } // Prefer creating tray in main process via remote when available @@ -259,7 +250,6 @@ export class DesktopIntegrationManager extends Component { const nativeImage = electron.remote?.nativeImage || electron.nativeImage; if (!Tray || !nativeImage) { - console.log("[TrayDebug] Tray or nativeImage not available"); return false; } @@ -267,19 +257,14 @@ export class DesktopIntegrationManager extends Component { const globalKey = "__tg_tray_singleton__" + this.plugin.app.appId; const g = window as unknown as TraySingletonHost; if (g[globalKey]?.tray && g[globalKey]?.owner) { - console.log("[TrayDebug] Checking existing tray..."); // Check if the tray is still valid (not destroyed) try { // Try to access a property to check if tray is alive const isDestroyed = g[globalKey].tray.isDestroyed?.() ?? false; if (isDestroyed) { - console.log( - "[TrayDebug] Existing tray is destroyed, cleaning up" - ); delete g[globalKey]; } else { - console.log("[TrayDebug] Adopting existing valid tray"); // Adopt existing tray - don't recreate this.electronTray = g[globalKey].tray; this.trayOwnerToken = g[globalKey].owner; @@ -312,7 +297,6 @@ export class DesktopIntegrationManager extends Component { } // Create a new tray and apply theme-based icon - console.log("[TrayDebug] Creating new tray"); this.electronTray = new Tray(nativeImage.createEmpty()); try { this.electronTray.setToolTip("Task Genius"); @@ -352,7 +336,6 @@ export class DesktopIntegrationManager extends Component { clickHandler: this.trayClickHandler, }; this.trayOwnerToken = owner; - console.log("[TrayDebug] New tray created and saved globally"); // Done return true; @@ -390,7 +373,6 @@ export class DesktopIntegrationManager extends Component { private async applyThemeToTray( nativeImage: ElectronNativeImageStatic ): Promise { - console.log(this.electronTray, "tray"); if (!this.electronTray) return; // For macOS, always use black and let Template Image handle theme @@ -427,7 +409,6 @@ export class DesktopIntegrationManager extends Component { } } const handler = () => { - console.log("[TrayDebug] Theme changed, updating tray icon"); this.applyThemeToTray(nativeImage).catch(() => {}); }; this.nativeThemeHandler = handler; @@ -500,7 +481,6 @@ export class DesktopIntegrationManager extends Component { // Set as template image if requested (macOS) try { if (useTemplateImage && ni.setTemplateImage) { - console.log("[TrayDebug] Setting as template image"); ni.setTemplateImage(true); } } catch { diff --git a/src/managers/electron-quick-capture.ts b/src/managers/electron-quick-capture.ts index 1f41013f..1af3b48a 100644 --- a/src/managers/electron-quick-capture.ts +++ b/src/managers/electron-quick-capture.ts @@ -208,8 +208,6 @@ export class ElectronQuickCapture { private setupIPCHandlers(): void { if (!this.captureWindow) return; - console.log("[ElectronQuickCapture] Setting up IPC handlers"); - // Try to get ipcMain for handling messages const electron = this.getElectron(); const ipcMain = electron?.ipcMain || electron?.remote?.ipcMain; @@ -226,17 +224,12 @@ export class ElectronQuickCapture { ipcMain.handle( "quick-capture-save", async (event: ElectronIpcMainEvent, data: unknown) => { - console.log( - "[ElectronQuickCapture] IPC received save:", - data, - ); await this.handleSaveTask(data as QuickCaptureSaveData); }, ); // Handle cancel ipcMain.handle("quick-capture-cancel", async () => { - console.log("[ElectronQuickCapture] IPC received cancel"); this.closeCaptureWindow(); }); @@ -244,18 +237,11 @@ export class ElectronQuickCapture { ipcMain.handle( "quick-capture-request-data", async (event: ElectronIpcMainEvent, type: unknown) => { - console.log( - "[ElectronQuickCapture] IPC requesting data:", - type, - ); return await this.getDataForWindow(type as string); }, ); this._ipcHandlers = { ipcMain, registered: true }; - console.log( - "[ElectronQuickCapture] IPC handlers registered with ipcMain.handle", - ); } catch (e) { console.warn( "[ElectronQuickCapture] Failed to set up ipcMain handlers:", @@ -268,11 +254,6 @@ export class ElectronQuickCapture { this.captureWindow.webContents.on( "ipc-message", async (_event: unknown, channel: string, ...args: unknown[]) => { - console.log( - "[ElectronQuickCapture] Received ipc-message:", - channel, - args, - ); if (channel === "quick-capture-save") { await this.handleSaveTask(args[0] as QuickCaptureSaveData); } else if (channel === "quick-capture-cancel") { @@ -290,27 +271,16 @@ export class ElectronQuickCapture { // Also listen for direct channel messages (for newer Electron versions) if (ipcMain) { ipcMain.on("quick-capture-save", async (event: ElectronIpcMainEvent, data: unknown) => { - console.log( - "[ElectronQuickCapture] Direct IPC received save:", - data, - ); await this.handleSaveTask(data as QuickCaptureSaveData); }); ipcMain.on("quick-capture-cancel", () => { - console.log( - "[ElectronQuickCapture] Direct IPC received cancel", - ); this.closeCaptureWindow(); }); ipcMain.on( "quick-capture-request-data", async (event: ElectronIpcMainEvent, type: unknown) => { - console.log( - "[ElectronQuickCapture] Direct IPC requesting data:", - type, - ); const data = await this.getDataForWindow(type as string); event.reply("quick-capture-data-response", type, data); }, @@ -379,10 +349,6 @@ export class ElectronQuickCapture { private async handleSaveTask(data: QuickCaptureSaveData): Promise { try { - console.log( - "[ElectronQuickCapture] handleSaveTask called with data:", - data, - ); // Parse the task content and metadata const { content, project, context, dueDate, priority, tags } = data; @@ -413,10 +379,6 @@ export class ElectronQuickCapture { } // Create the task using the write API - console.log( - "[ElectronQuickCapture] Calling createTask with args:", - taskArgs, - ); const result = await this.createTask(taskArgs); if (result.success) { @@ -448,8 +410,6 @@ export class ElectronQuickCapture { return { success: false, error: "Write API not available" }; } - console.log("[ElectronQuickCapture] Creating task with args:", args); - // Determine target based on quick capture settings const qc = this.plugin.settings.quickCapture; const targetType = qc?.targetType || "daily-note"; @@ -458,26 +418,15 @@ export class ElectronQuickCapture { let result; if (targetType === "daily-note") { // Create in daily note - console.log( - "[ElectronQuickCapture] Creating task in daily note", - ); result = await this.plugin.writeAPI.createTaskInDailyNote(args); } else if (targetType === "fixed" && qc?.targetFile) { // Create in fixed file - console.log( - "[ElectronQuickCapture] Creating task in fixed file:", - qc.targetFile, - ); args.filePath = qc.targetFile; result = await this.plugin.writeAPI.createTask(args); } else { // Default to daily note - console.log( - "[ElectronQuickCapture] Creating task in daily note (default)", - ); result = await this.plugin.writeAPI.createTaskInDailyNote(args); } - console.log("[ElectronQuickCapture] Task creation result:", result); return result; } catch (error) { console.error("[ElectronQuickCapture] Error creating task:", error); @@ -996,16 +945,13 @@ export class ElectronQuickCapture { const ipcRenderer = electron?.ipcRenderer; if (ipcRenderer) { - console.log('IPC bridge established'); bridge = { save: (data) => { - console.log('Sending save via IPC:', data); // Try both old and new IPC methods ipcRenderer.send('quick-capture-save', data); return Promise.resolve(); }, cancel: () => { - console.log('Sending cancel via IPC'); ipcRenderer.send('quick-capture-cancel'); return Promise.resolve(); }, @@ -1294,7 +1240,6 @@ export class ElectronQuickCapture { window.opener.postMessage({ type: 'quick-capture-save', data }, '*'); window.close(); } else { - console.log('Would save:', data); showError('Communication bridge not available'); } } diff --git a/src/managers/file-task-manager.ts b/src/managers/file-task-manager.ts index 321f11df..778747c4 100644 --- a/src/managers/file-task-manager.ts +++ b/src/managers/file-task-manager.ts @@ -112,15 +112,6 @@ export class FileTaskManagerImpl implements FileTaskManager { // Generate unique ID based on file path const id = `file-task-${entry.file.path}`; - // Log available properties for debugging (only for first few entries) - if (Math.random() < 0.1) { - // Log 10% of entries to avoid spam - console.log( - `[FileTaskManager] Available properties for ${entry.file.name}:`, - Object.keys(properties), - ); - } - // Extract content from the specified property or use file name without extension let content = this.getPropertyValue(entry, mapping.contentProperty); if (!content) { @@ -385,11 +376,6 @@ export class FileTaskManagerImpl implements FileTaskManager { contentHandledSeparately, ); - console.log( - `[FileTaskManager] Updating file task ${task.content} with properties:`, - propertyUpdates, - ); - // Update properties through the source entry for (const [key, value] of Object.entries(propertyUpdates)) { try { @@ -499,9 +485,6 @@ export class FileTaskManagerImpl implements FileTaskManager { await Promise.resolve( task.sourceEntry.updateProperty("title", newTitle), ); - console.log( - `[FileTaskManager] Updated frontmatter title for ${task.filePath} to: ${newTitle}`, - ); } else { throw new Error( "updateProperty method not available on source entry", @@ -566,10 +549,6 @@ export class FileTaskManagerImpl implements FileTaskManager { const newContent = lines.join("\n"); await this.app.vault.modify(file, newContent); - - console.log( - `[FileTaskManager] Updated H1 heading for ${task.filePath} to: ${newHeading}`, - ); } catch (error) { console.error( `[FileTaskManager] Failed to update H1 heading:`, @@ -593,9 +572,6 @@ export class FileTaskManagerImpl implements FileTaskManager { await Promise.resolve( task.sourceEntry.updateProperty(fieldName, newContent), ); - console.log( - `[FileTaskManager] Updated custom field '${fieldName}' for ${task.filePath} to: ${newContent}`, - ); } else { throw new Error( "updateProperty method not available on source entry", @@ -647,9 +623,6 @@ export class FileTaskManagerImpl implements FileTaskManager { await this.app.fileManager.renameFile(file, newPath); // Update the task's filePath to reflect the new path task.filePath = newPath; - console.log( - `[FileTaskManager] Renamed file from ${currentPath} to ${newPath}`, - ); } } } catch (error) { @@ -692,10 +665,6 @@ export class FileTaskManagerImpl implements FileTaskManager { } }); - console.log( - `[FileTaskManager] Filtered ${entries.length} entries to ${markdownEntries.length} markdown files`, - ); - return markdownEntries.map((entry) => this.entryToFileTask(entry, mapping), ); diff --git a/src/managers/habit-manager.ts b/src/managers/habit-manager.ts index d833cf2b..f1a5095b 100644 --- a/src/managers/habit-manager.ts +++ b/src/managers/habit-manager.ts @@ -132,7 +132,6 @@ export class HabitManager extends Component { const dailyNotes = await this.getDailyNotes(); const processedHabits = await this.processHabits(dailyNotes); - console.log("processedHabits", processedHabits); this.habits = processedHabits; this.plugin.app.workspace.trigger( @@ -641,7 +640,6 @@ export class HabitManager extends Component { const app: App = this.plugin.app; const momentDate = moment(date, "YYYY-MM-DD").set("hour", 12); - console.log(momentDate); if (!momentDate.isValid()) { console.error( `Invalid date format provided: ${date}. Expected YYYY-MM-DD.` @@ -667,7 +665,6 @@ export class HabitManager extends Component { let dailyNote: TFile | null = null; try { - console.log(getAllDailyNotes()); dailyNote = getDailyNote(momentDate, getAllDailyNotes()); if (!dailyNote) { @@ -696,8 +693,6 @@ export class HabitManager extends Component { this.plugin.app.commands.executeCommandById("daily-notes"); - console.log(getAllDailyNotes()); - dailyNote = getDailyNote(momentDate, getAllDailyNotes()); } } diff --git a/src/managers/ics-manager.ts b/src/managers/ics-manager.ts index df3bc0ed..3bd1031a 100644 --- a/src/managers/ics-manager.ts +++ b/src/managers/ics-manager.ts @@ -115,8 +115,6 @@ export class IcsManager extends Component { this.startBackgroundRefresh(); } - console.log("ICS Manager initialized"); - // Notify listeners (e.g., IcsSource) that ICS is ready/config updated // try { // this.plugin.app?.workspace?.trigger?.( @@ -198,30 +196,20 @@ export class IcsManager extends Component { getAllEvents(): IcsEvent[] { const allEvents: IcsEvent[] = []; - console.log("getAllEvents: cache size", this.cache.size); - console.log("getAllEvents: config sources", this.config.sources); - for (const [sourceId, cacheEntry] of this.cache) { const source = this.config.sources.find((s) => s.id === sourceId); - console.log("source", source, "sourceId", sourceId); - console.log("cacheEntry events count", cacheEntry.events.length); // Process all enabled sources (URL-based and OAuth-based) if (source?.enabled) { - console.log("Source is enabled, applying filters"); // Apply filters if configured const filteredEvents = this.applyFilters( cacheEntry.events, source, ); - console.log("filteredEvents count", filteredEvents.length); allEvents.push(...filteredEvents); - } else { - console.log("Source not enabled or not found", source?.enabled); } } - console.log("getAllEvents: total events", allEvents.length); return allEvents; } @@ -231,26 +219,9 @@ export class IcsManager extends Component { getAllEventsWithHolidayDetection(): IcsEventWithHoliday[] { const allEvents: IcsEventWithHoliday[] = []; - console.log( - "getAllEventsWithHolidayDetection: cache size", - this.cache.size, - ); - console.log( - "getAllEventsWithHolidayDetection: config sources", - this.config.sources, - ); - for (const [sourceId, cacheEntry] of this.cache) { const source = this.config.sources.find((s) => s.id === sourceId); - console.log( - "Processing source:", - sourceId, - "enabled:", - source?.enabled, - ); - console.log("Cache entry events count:", cacheEntry.events.length); - // Process all enabled sources (URL-based and OAuth-based) if (source?.enabled) { // Apply filters first @@ -259,8 +230,6 @@ export class IcsManager extends Component { source, ); - console.log("Filtered events count:", filteredEvents.length); - // Apply holiday detection if configured (only available on URL/legacy sources) let processedEvents: IcsEventWithHoliday[]; const holidayConfig = @@ -282,15 +251,10 @@ export class IcsManager extends Component { })); } - console.log("Processed events count:", processedEvents.length); allEvents.push(...processedEvents); } } - console.log( - "getAllEventsWithHolidayDetection: total events", - allEvents.length, - ); return allEvents; } @@ -308,21 +272,17 @@ export class IcsManager extends Component { // If there's already a sync in progress, wait for it if (this.syncPromise) { - console.log("ICS: Waiting for existing sync to complete"); await this.syncPromise; return this.getAllEvents(); } // Only sync if enough time has passed since last sync if (now - this.lastSyncTime > this.SYNC_DEBOUNCE_MS) { - console.log("ICS: Starting sync (debounced)"); this.syncPromise = this.syncAllSources().finally(() => { this.syncPromise = null; }); await this.syncPromise; this.lastSyncTime = now; - } else { - console.log("ICS: Skipping sync (debounced)"); } // Return all events after sync @@ -837,8 +797,6 @@ export class IcsManager extends Component { try { const result = await this.fetchIcsData(source); - console.log("syncSource: result", result); - if (result.success && result.data) { // Update cache const cacheEntry: IcsCacheEntry = { @@ -972,18 +930,10 @@ export class IcsManager extends Component { const end = new Date(now); end.setDate(now.getDate() + 90); - console.log( - `[IcsManager] Syncing OAuth source ${source.id} (${source.type})...`, - ); - const events = await provider.getEvents({ range: { start, end }, }); - console.log( - `[IcsManager] Fetched ${events.length} events from OAuth source ${source.id}`, - ); - // Update cache const timestamp = Date.now(); const cacheEntry: IcsCacheEntry = { @@ -1249,27 +1199,15 @@ export class IcsManager extends Component { source: AnyCalendarSource, ): IcsEvent[] { let filteredEvents = [...events]; - console.log("applyFilters: initial events count", events.length); - console.log("applyFilters: source config", { - showAllDayEvents: source.showAllDayEvents, - showTimedEvents: source.showTimedEvents, - filters: "filters" in source ? source.filters : undefined, - }); // Apply event type filters if (!source.showAllDayEvents) { const beforeFilter = filteredEvents.length; filteredEvents = filteredEvents.filter((event) => !event.allDay); - console.log( - `Filtered out all-day events: ${beforeFilter} -> ${filteredEvents.length}`, - ); } if (!source.showTimedEvents) { const beforeFilter = filteredEvents.length; filteredEvents = filteredEvents.filter((event) => event.allDay); - console.log( - `Filtered out timed events: ${beforeFilter} -> ${filteredEvents.length}`, - ); } // Apply custom filters (only for URL-based sources that have filters) @@ -1371,12 +1309,8 @@ export class IcsManager extends Component { filteredEvents = filteredEvents .sort((a, b) => b.dtstart.getTime() - a.dtstart.getTime()) // 倒序:最新的事件在前 .slice(0, this.config.maxEventsPerSource); - console.log( - `Limited events: ${beforeLimit} -> ${filteredEvents.length} (max: ${this.config.maxEventsPerSource}) - keeping newest events`, - ); } - console.log("applyFilters: final events count", filteredEvents.length); return filteredEvents; } diff --git a/src/managers/onboarding-manager.ts b/src/managers/onboarding-manager.ts index 3b582c0b..a8b395cc 100644 --- a/src/managers/onboarding-manager.ts +++ b/src/managers/onboarding-manager.ts @@ -346,8 +346,6 @@ export class OnboardingConfigManager { // Apply new settings this.plugin.settings = newSettings; await this.plugin.saveSettings(); - - console.log(`Applied ${mode} configuration template with ${userCustomViews.length} user custom views preserved`); } /** @@ -364,7 +362,6 @@ export class OnboardingConfigManager { this.plugin.settings.onboarding.version = this.plugin.manifest.version; await this.plugin.saveSettings(); - console.log(`Onboarding completed with ${mode} configuration`); } /** @@ -386,7 +383,6 @@ export class OnboardingConfigManager { this.plugin.settings.onboarding.skipOnboarding = true; this.plugin.settings.onboarding.version = this.plugin.manifest.version; await this.plugin.saveSettings(); - console.log('Onboarding skipped'); } /** @@ -401,7 +397,6 @@ export class OnboardingConfigManager { this.plugin.settings.onboarding.skipOnboarding = false; this.plugin.settings.onboarding.completedAt = ""; await this.plugin.saveSettings(); - console.log('Onboarding reset'); } /** diff --git a/src/managers/reward-manager.ts b/src/managers/reward-manager.ts index af05d01e..ecd51b9c 100644 --- a/src/managers/reward-manager.ts +++ b/src/managers/reward-manager.ts @@ -43,7 +43,6 @@ export class RewardManager extends Component { } const eligibleRewards = this.getEligibleRewards(task); - console.log("eligibleRewards", eligibleRewards); if (!eligibleRewards.length) { return; // No rewards match the conditions or inventory is depleted } @@ -221,9 +220,6 @@ export class RewardManager extends Component { this.plugin.settings.rewards.rewardItems[rewardIndex] .inventory--; await this.plugin.saveSettings(); - console.log( - `Reward accepted: ${acceptedReward.name}. Inventory updated to: ${this.plugin.settings.rewards.rewardItems[rewardIndex].inventory}` - ); } else if (currentInventory !== -1) { // Log if we somehow tried to accept a reward with 0 inventory (shouldn't happen) console.warn( @@ -242,6 +238,5 @@ export class RewardManager extends Component { */ public updateSettings(): void { this.settings = this.plugin.settings.rewards; - console.log("RewardManager settings updated."); } } diff --git a/src/managers/timer-manager.ts b/src/managers/timer-manager.ts index 79d3631b..4c1b00cc 100644 --- a/src/managers/timer-manager.ts +++ b/src/managers/timer-manager.ts @@ -114,12 +114,6 @@ export class TaskTimerManager { */ startTimer(filePath: string, existingBlockId?: string): string { try { - console.log( - `[TaskTimerManager] Starting timer for file: ${filePath}, blockId: ${ - existingBlockId || "new" - }` - ); - const blockId = existingBlockId || this.generateBlockId(); const taskId = this.getStorageKey(filePath, blockId); const now = Date.now(); @@ -135,9 +129,6 @@ export class TaskTimerManager { const existingTimer = this.getTimerState(taskId); if (existingTimer) { - console.log( - `[TaskTimerManager] Found existing timer with status: ${existingTimer.status}` - ); // Resume existing timer if (existingTimer.status === "paused") { this.resumeTimer(taskId); @@ -163,9 +154,6 @@ export class TaskTimerManager { try { this.saveToStorage(taskId, JSON.stringify(timerState)); this.addToActiveList(taskId); - console.log( - `[TaskTimerManager] Successfully created new timer: ${taskId}` - ); } catch (storageError) { console.error( "[TaskTimerManager] Failed to save timer to localStorage:", @@ -263,8 +251,6 @@ export class TaskTimerManager { */ completeTimer(taskId: string): string { try { - console.log(`[TaskTimerManager] Completing timer: ${taskId}`); - const timerState = this.getTimerState(taskId); if (!timerState) { console.warn( @@ -287,9 +273,6 @@ export class TaskTimerManager { // Calculate total duration from all segments const totalDuration = this.calculateTotalDuration(timerState); - console.log( - `[TaskTimerManager] Total duration from ${timerState.segments.length} segments: ${totalDuration}ms` - ); // Validate duration if (totalDuration < 0) { @@ -313,9 +296,6 @@ export class TaskTimerManager { // Remove from storage try { this.removeTimer(taskId); - console.log( - `[TaskTimerManager] Successfully removed completed timer from storage` - ); } catch (removalError) { console.error( "[TaskTimerManager] Failed to remove timer from storage:", @@ -326,9 +306,6 @@ export class TaskTimerManager { // Format and return duration const formattedDuration = this.formatDuration(totalDuration); - console.log( - `[TaskTimerManager] Timer completed successfully, duration: ${formattedDuration}` - ); return formattedDuration; } catch (error) { console.error( @@ -356,9 +333,6 @@ export class TaskTimerManager { // Check if this is a legacy format that needs migration if (this.isLegacyFormat(parsed)) { - console.log( - `[TaskTimerManager] Migrating legacy timer state for ${taskId}` - ); const migrated = this.migrateLegacyState( parsed as LegacyTimerState ); diff --git a/src/managers/version-manager.ts b/src/managers/version-manager.ts index 2337a905..8a201550 100644 --- a/src/managers/version-manager.ts +++ b/src/managers/version-manager.ts @@ -246,17 +246,11 @@ export class VersionManager extends Component { */ public async recoverFromCorruptedVersion(): Promise { try { - console.log("Attempting to recover from corrupted version data"); - // Clear the corrupted version data await this.clearVersionInfo(); // Store the current version as if it's a fresh install await this.storeCurrentVersion(); - - console.log( - `Version recovery complete, set to ${this.currentVersion}`, - ); } catch (error) { console.error("Error during version recovery:", error); throw new Error( diff --git a/src/mcp/McpServer.ts b/src/mcp/McpServer.ts index ff597865..dc8ca6a2 100644 --- a/src/mcp/McpServer.ts +++ b/src/mcp/McpServer.ts @@ -428,7 +428,6 @@ export class McpServer { queryAPI, writeAPI, ); - console.log("MCP Server: Using DataflowBridge"); } catch (error) { console.error( "MCP Server: Failed to initialize DataflowBridge", @@ -1636,7 +1635,6 @@ export class McpServer { async start(): Promise { if (this.isRunning) { - console.log("MCP Server is already running"); return; } // Node's http and url modules exist in the desktop app only @@ -1806,14 +1804,6 @@ export class McpServer { }); req.on("end", () => void (async () => { - // Debug: log received body for UTF-8 validation - if (body.includes("content")) { - console.log( - "[MCP Debug] Received body:", - body.substring(0, 300), - ); - } - let request: JsonRpcRequest; try { request = JSON.parse(body) as JsonRpcRequest; @@ -2029,10 +2019,6 @@ export class McpServer { >; this.actualPort = address?.port || this.config.port; - console.log( - `MCP Server started on ${this.config.host}:${this.actualPort}`, - ); - // Clean up old sessions periodically window.setInterval(() => { const now = Date.now(); @@ -2074,7 +2060,6 @@ export class McpServer { return new Promise((resolve) => { this.httpServer!.close(() => { this.isRunning = false; - console.log("MCP Server stopped"); resolve(); }); }); diff --git a/src/mcp/McpServerManager.ts b/src/mcp/McpServerManager.ts index 1be2a8cf..606f9256 100644 --- a/src/mcp/McpServerManager.ts +++ b/src/mcp/McpServerManager.ts @@ -74,7 +74,6 @@ export class McpServerManager { async initialize(): Promise { // Only initialize on desktop if (!Platform.isDesktopApp) { - console.log("MCP Server is only available on desktop"); return; } @@ -122,9 +121,6 @@ export class McpServerManager { // Auto-restart logic for transient errors only if (this.autoRestartAttempts < this.maxAutoRestartAttempts) { this.autoRestartAttempts++; - console.log( - `Attempting auto-restart (${this.autoRestartAttempts}/${this.maxAutoRestartAttempts})` - ); window.setTimeout(() => void this.start(), 5000); } } diff --git a/src/pages/FluentTaskView.ts b/src/pages/FluentTaskView.ts index 039985f3..942a45c9 100644 --- a/src/pages/FluentTaskView.ts +++ b/src/pages/FluentTaskView.ts @@ -172,12 +172,10 @@ export class FluentTaskView extends ItemView { !leafId.startsWith("view-config-") && leafId !== "global-filter" ) { - console.log("[Task Genius] Filter changed from live component"); this.liveFilterState = filterState; this.currentFilterState = filterState; } else if (!leafId) { // No leafId means it's also a live filter change - console.log("[Task Genius] Filter changed (no leafId)"); this.liveFilterState = filterState; this.currentFilterState = filterState; } @@ -296,18 +294,12 @@ export class FluentTaskView extends ItemView { * Main initialization method */ async onOpen() { - console.log("[Task Genius] onOpen started"); this.isInitializing = true; try { // ==================== // PHASE 1-4: UI Setup, Managers, Structure, Events // ==================== - if (this.DEBUG_MODE) { - console.log( - "[Task Genius] Initializing UI, managers, structure, and events..." - ); - } this.contentEl.empty(); this.contentEl.toggleClass( @@ -344,29 +336,15 @@ export class FluentTaskView extends ItemView { // Subscribe to workspace and global events this.registerEvents(); - if (this.DEBUG_MODE) { - console.log( - "[Task Genius] ✅ UI, managers, structure, and events initialized" - ); - } - // ==================== // PHASE 5: Restore Workspace State // ==================== - if (this.DEBUG_MODE) { - console.log("[Task Genius] Restoring workspace state..."); - } const savedWorkspaceId = this.workspaceStateManager.getSavedWorkspaceId(); if (savedWorkspaceId && savedWorkspaceId !== this.workspaceId) { this.workspaceId = savedWorkspaceId; this.viewState.currentWorkspace = savedWorkspaceId; - if (this.DEBUG_MODE) { - console.log( - `[Task Genius] Restored workspace ID: ${savedWorkspaceId}` - ); - } } // Apply workspace settings and restore filter state @@ -430,12 +408,8 @@ export class FluentTaskView extends ItemView { // ==================== // PHASE 6: Load Data (KEY PHASE) // ==================== - console.log("[Task Genius] Loading tasks..."); await this.dataManager.loadTasks(false); // Will trigger onTasksLoaded callback await this.dataManager.registerDataflowListeners(); - console.log( - `[Task Genius] ✅ Loaded ${this.tasks.length} tasks, ${this.filteredTasks.length} after filters` - ); // ==================== // PHASE 7-8: Initial Render & Responsive Adjustments @@ -444,9 +418,6 @@ export class FluentTaskView extends ItemView { this.updateView(); // Check window size and auto-collapse sidebar if needed - if (this.DEBUG_MODE) { - console.log("[Task Genius] Checking sidebar collapse..."); - } this.layoutManager.checkAndCollapseSidebar(); } catch (error) { console.error("[Task Genius] ❌ Initialization error:", error); @@ -457,19 +428,10 @@ export class FluentTaskView extends ItemView { // ==================== // PHASE 9: Finalization (CRITICAL - Always Executes) // ==================== - if (this.DEBUG_MODE) { - console.log( - `[Task Genius] Finalizing (isInitializing was ${this.isInitializing})` - ); - } this.isInitializing = false; - if (this.DEBUG_MODE) { - console.log("[Task Genius] Calling final updateView()..."); - } this.updateView(); - console.log("[Task Genius] ✅ Initialization complete"); } } @@ -524,9 +486,6 @@ export class FluentTaskView extends ItemView { } }, onUpdateNeeded: (source) => { - console.log( - `[Task Genius] Update needed from source: ${source}` - ); // Re-apply filters and update view this.filteredTasks = this.dataManager.applyFilters(this.tasks); this.updateView(); @@ -584,20 +543,15 @@ export class FluentTaskView extends ItemView { this.updateView(); }, onNavigateToView: (viewId) => { - console.log(`[Task Genius] onNavigateToView called with viewId: ${viewId}, previous: ${this.currentViewId}`); this.recordViewModeForView( this.currentViewId, this.viewState.viewMode ); this.currentViewId = viewId; - console.log(`[Task Genius] currentViewId updated to: ${this.currentViewId}`); // When navigating to projects view directly, clear project selection // This enables the full project overview mode if (viewId === "projects") { - console.log( - "[Task Genius] Navigating to projects overview - clearing project selection" - ); this.viewState.selectedProject = undefined; // Clear project filter from filter state @@ -659,7 +613,6 @@ export class FluentTaskView extends ItemView { this.updateView(); }, onProjectSelected: (projectId, includeSubprojects) => { - console.log(`[Task Genius] Project selected: ${projectId}`); this.viewState.selectedProject = projectId; // Switch to projects view @@ -788,16 +741,12 @@ export class FluentTaskView extends ItemView { // Trigger initial workspace leaf width update this.updateWorkspaceLeafWidth(); - - console.log("[Task Genius] Managers initialized"); } /** * Build UI structure - MUST match original DOM structure for CSS */ private async buildUIStructure() { - console.log("[Task Genius] Building UI structure"); - // Create layout structure (exact same as original) const layoutContainer = this.rootContainerEl.createDiv({ cls: "tg-fluent-layout", @@ -885,9 +834,6 @@ export class FluentTaskView extends ItemView { } } else { sidebarEl.hide(); - console.log( - "[Task Genius] Using workspace side leaves: skip in-view sidebar" - ); } // Initialize with empty modes first, will be updated in updateView @@ -909,7 +855,6 @@ export class FluentTaskView extends ItemView { this.addChild(this.topNavigation); // Initialize view components - console.log("[Task Genius] Initializing view components"); this.componentManager = new FluentComponentManager( this.app, this.plugin, @@ -932,18 +877,8 @@ export class FluentTaskView extends ItemView { this.actionHandlers.handleTaskContextMenu(event, task); }, onKanbanTaskStatusUpdate: (taskId, newStatusMark) => { - console.log( - `[FluentTaskView] Kanban status update callback received: taskId=${taskId}, mark=${newStatusMark}` - ); - console.log( - `[FluentTaskView] Current task list size: ${this.tasks.length}` - ); - const task = this.tasks.find((t) => t.id === taskId); if (task) { - console.log( - "[FluentTaskView] Task found, delegating to action handler" - ); void this.actionHandlers.handleKanbanTaskStatusUpdate( task, newStatusMark @@ -969,10 +904,8 @@ export class FluentTaskView extends ItemView { // Set TopNavigation reference in ComponentManager this.componentManager.setTopNavigation(this.topNavigation); - console.log("[Task Genius] TopNavigation reference passed to ComponentManager"); // Sidebar toggle in header and responsive collapse - console.log("[Task Genius] Creating sidebar toggle"); this.layoutManager.createSidebarToggle(); // Create task count mark @@ -995,10 +928,7 @@ export class FluentTaskView extends ItemView { }); // Create action buttons in Obsidian view header - console.log("[Task Genius] Creating action buttons"); this.layoutManager.createActionButtons(); - - console.log("[Task Genius] UI structure built"); } /** @@ -1178,14 +1108,9 @@ export class FluentTaskView extends ItemView { */ private updateView() { if (this.isInitializing) { - console.log("[Task Genius] Skip update during initialization"); return; } - console.log( - `[Task Genius] Proceeding with view update for ${this.currentViewId}` - ); - // Update top navigation available modes based on current view const availableModes = this.componentManager?.getAvailableModesForView( @@ -1286,8 +1211,6 @@ export class FluentTaskView extends ItemView { * Reset all active filters */ private resetCurrentFilter(): void { - console.log("[Task Genius] Resetting filter"); - // Clear filter states this.liveFilterState = null; this.currentFilterState = null; @@ -1363,8 +1286,6 @@ export class FluentTaskView extends ItemView { * Clean up on close */ async onClose() { - console.log("[Task Genius] onClose started"); - // Save workspace layout before closing this.workspaceStateManager.saveWorkspaceLayout(); @@ -1375,7 +1296,5 @@ export class FluentTaskView extends ItemView { // Clear selection this.actionHandlers.clearSelection(); - - console.log("[Task Genius] onClose completed"); } } diff --git a/src/pages/RightDetailView.ts b/src/pages/RightDetailView.ts index db73fd90..4a9bfa36 100644 --- a/src/pages/RightDetailView.ts +++ b/src/pages/RightDetailView.ts @@ -66,11 +66,9 @@ export class RightDetailView extends ItemView { this.registerEvent( onTaskSelected(this.app, (payload: TaskSelectionPayload) => void (async () => { // Filter by active workspace correctly - console.log(this.app, payload); try { const activeId = this.plugin.workspaceManager?.getActiveWorkspace().id; - console.log(activeId, payload.workspaceId); if ( payload.workspaceId && activeId && @@ -94,7 +92,6 @@ export class RightDetailView extends ItemView { const task = repo && (await repo.getTaskById(payload.taskId)); - console.log(task); if (task) this.details.showTaskDetails(task); } catch (e) { console.warn("[TG] RightDetailView failed to load task", e); diff --git a/src/pages/TaskSpecificView.ts b/src/pages/TaskSpecificView.ts index c98f50d5..243d1003 100644 --- a/src/pages/TaskSpecificView.ts +++ b/src/pages/TaskSpecificView.ts @@ -162,7 +162,6 @@ export class TaskSpecificView extends ItemView { // 从状态恢复的过滤器应该被视为实时过滤器 this.liveFilterState = specificState?.filterState || null; this.currentFilterState = specificState?.filterState || null; - console.log("TaskSpecificView setState:", specificState); if (!this.rootContainerEl) { this.app.workspace.onLayoutReady(() => { @@ -242,19 +241,11 @@ export class TaskSpecificView extends ItemView { this.app.workspace.on( "task-genius:filter-changed", (filterState: RootFilterState, leafId?: string) => { - console.log( - "TaskSpecificView 过滤器实时变更:", - filterState, - "leafId:", - leafId, - ); - // 只处理来自当前视图的过滤器变更 if (leafId === this.leaf.id) { // 这是来自当前视图的实时过滤器组件的变更 this.liveFilterState = filterState; this.currentFilterState = filterState; - console.log("更新 TaskSpecificView 实时过滤器状态"); this.debouncedApplyFilter(); } // 忽略来自其他leafId的变更,包括基础过滤器(view-config-开头) @@ -268,7 +259,6 @@ export class TaskSpecificView extends ItemView { // 3. 获取初始视图状态 const state = this.leaf.getViewState().state; const specificState = state as unknown as TaskSpecificViewState; - console.log("TaskSpecificView initial state:", specificState); this.currentViewId = specificState?.viewId || "inbox"; // Fallback if state is missing this.currentProject = specificState?.project; this.currentFilterState = specificState?.filterState || null; @@ -708,7 +698,6 @@ export class TaskSpecificView extends ItemView { ) { this.currentViewId = viewId; this.currentProject = project; - console.log("Switching view to:", viewId, "Project:", project); // Hide all components first this.contentComponent.containerEl.hide(); @@ -806,10 +795,6 @@ export class TaskSpecificView extends ItemView { } if (targetComponent) { - console.log( - `Activating component for view ${viewId}`, - targetComponent.constructor.name, - ); targetComponent.containerEl.show(); if (typeof targetComponent.setTasks === "function") { // 使用高级过滤器状态,确保传递有效的过滤器 @@ -822,7 +807,6 @@ export class TaskSpecificView extends ItemView { this.currentFilterState.filterGroups && this.currentFilterState.filterGroups.length > 0 ) { - console.log("应用高级筛选器到视图:", viewId); filterOptions.advancedFilter = this.currentFilterState; } @@ -858,7 +842,6 @@ export class TaskSpecificView extends ItemView { this.currentFilterState.filterGroups && this.currentFilterState.filterGroups.length > 0 ) { - console.log("应用高级筛选器到表格视图:", viewId); filterOptions.advancedFilter = this.currentFilterState; } @@ -868,9 +851,6 @@ export class TaskSpecificView extends ItemView { } if (typeof targetComponent.setViewMode === "function") { - console.log( - `Setting view mode for ${viewId} to ${modeForComponent} with project ${project}`, - ); targetComponent.setViewMode(modeForComponent, project); } @@ -1186,14 +1166,8 @@ export class TaskSpecificView extends ItemView { this.tasks = []; } else { try { - console.log( - "[TaskSpecificView] Loading tasks from dataflow orchestrator...", - ); const queryAPI = this.plugin.dataflowOrchestrator.getQueryAPI(); this.tasks = await queryAPI.getAllTasks(); - console.log( - `[TaskSpecificView] Loaded ${this.tasks.length} tasks from dataflow`, - ); } catch (error) { console.error( "[TaskSpecificView] Error loading tasks from dataflow:", @@ -1226,15 +1200,9 @@ export class TaskSpecificView extends ItemView { this.tasks = []; } else { try { - console.log( - "[TaskSpecificView] Loading tasks fast from dataflow orchestrator...", - ); const queryAPI = this.plugin.dataflowOrchestrator.getQueryAPI(); // For fast loading, use regular getAllTasks (it should be cached) this.tasks = await queryAPI.getAllTasks(); - console.log( - `[TaskSpecificView] Loaded ${this.tasks.length} tasks (fast from dataflow)`, - ); } catch (error) { console.error( "[TaskSpecificView] Error loading tasks fast from dataflow:", @@ -1269,9 +1237,6 @@ export class TaskSpecificView extends ItemView { const tasks = await queryAPI.getAllTasks(); if (tasks.length !== this.tasks.length || tasks.length === 0) { this.tasks = tasks; - console.log( - `TaskSpecificView updated with ${this.tasks.length} tasks (dataflow sync)`, - ); // Don't trigger view update here as it will be handled by events } } catch (error) { @@ -1281,11 +1246,6 @@ export class TaskSpecificView extends ItemView { // 添加应用当前过滤器状态的方法 private applyCurrentFilter() { - console.log( - "应用 TaskSpecificView 当前过滤状态:", - this.liveFilterState ? "有实时筛选器" : "无实时筛选器", - this.currentFilterState ? "有过滤器" : "无过滤器", - ); // 通过 loadTasks 重新加载任务 void this.loadTasks(); } @@ -1387,16 +1347,6 @@ export class TaskSpecificView extends ItemView { return; } - console.log( - "handleTaskUpdate", - originalTask.content, - updatedTask.content, - originalTask.id, - updatedTask.id, - updatedTask, - originalTask, - ); - try { // Extract only the changed fields const updates = this.extractChangedFields( @@ -1418,10 +1368,6 @@ export class TaskSpecificView extends ItemView { updatedTask = writeResult.task; } - console.log( - `Task ${updatedTask.id} updated successfully via handleTaskUpdate.`, - ); - // Update local task list immediately const index = this.tasks.findIndex((t) => t.id === originalTask.id); if (index !== -1) { @@ -1482,7 +1428,6 @@ export class TaskSpecificView extends ItemView { if (writeResult.task) { updatedTask = writeResult.task; } - console.log(`Task ${updatedTask.id} updated successfully.`); // 立即更新本地任务列表 const index = this.tasks.findIndex((t) => t.id === originalTask.id); @@ -1561,11 +1506,9 @@ export class TaskSpecificView extends ItemView { this.rootContainerEl.empty(); this.rootContainerEl.detach(); } - console.log("TaskSpecificView closed"); } onSettingsUpdate() { - console.log("TaskSpecificView received settings update notification."); // No sidebar to update // Re-trigger view update to reflect potential setting changes (e.g., filters, status marks) void this.triggerViewUpdate(); @@ -1577,9 +1520,6 @@ export class TaskSpecificView extends ItemView { taskId: string, newStatusMark: string, ) => { - console.log( - `TaskSpecificView handling Kanban status update request for ${taskId} to mark ${newStatusMark}`, - ); const taskToUpdate = this.tasks.find((t) => t.id === taskId); if (taskToUpdate) { @@ -1605,19 +1545,12 @@ export class TaskSpecificView extends ItemView { // Use updateTask to ensure consistency and UI updates await this.updateTask(taskToUpdate, updatedTaskData); - console.log( - `Task ${taskId} status update processed by TaskSpecificView.`, - ); } catch (error) { console.error( `TaskSpecificView failed to update task status from Kanban callback for task ${taskId}:`, error, ); } - } else { - console.log( - `Task ${taskId} status (${newStatusMark}) already matches, no update needed.`, - ); } } else { console.warn( @@ -1628,7 +1561,6 @@ export class TaskSpecificView extends ItemView { // 添加重置筛选器的方法 public resetCurrentFilter() { - console.log("重置 TaskSpecificView 实时筛选器"); this.liveFilterState = null; this.currentFilterState = null; this.app.saveLocalStorage( diff --git a/src/pages/TaskView.ts b/src/pages/TaskView.ts index 0290f448..1d2ac813 100644 --- a/src/pages/TaskView.ts +++ b/src/pages/TaskView.ts @@ -222,12 +222,10 @@ export class TaskView extends ItemView { // 这是来自实时过滤器组件的变更 this.liveFilterState = filterState; this.currentFilterState = filterState; - console.log("更新实时过滤器状态"); } else if (!leafId) { // 没有leafId的情况,也视为实时过滤器变更 this.liveFilterState = filterState; this.currentFilterState = filterState; - console.log("更新实时过滤器状态(无leafId)"); } // 使用防抖函数应用过滤器,避免频繁更新 @@ -299,18 +297,15 @@ export class TaskView extends ItemView { const savedFilterState = this.app.loadLocalStorage( "task-genius-view-filter", ) as RootFilterState; - console.log("savedFilterState", savedFilterState); if ( savedFilterState && typeof savedFilterState.rootCondition === "string" && Array.isArray(savedFilterState.filterGroups) ) { - console.log("Saved filter state", savedFilterState); this.liveFilterState = savedFilterState; this.currentFilterState = savedFilterState; } else { - console.log("No saved filter state or invalid state"); this.liveFilterState = null; this.currentFilterState = null; } @@ -340,17 +335,12 @@ export class TaskView extends ItemView { this.switchView(this.currentViewId); } else { // If no tasks loaded yet, wait for background sync before rendering - console.log( - "No cached tasks found, waiting for background sync...", - ); await this.loadTasksWithSyncInBackground(); this.switchView(this.currentViewId); } - console.log("currentFilterState", this.currentFilterState); // 7. 在组件初始化完成后应用筛选器状态 if (this.currentFilterState) { - console.log("应用保存的筛选器状态"); this.applyCurrentFilter(); } @@ -469,11 +459,6 @@ export class TaskView extends ItemView { }, selectionManager: this.selectionManager, onTaskUpdate: async (originalTask: Task, updatedTask: Task) => { - console.log( - "TaskView onTaskUpdate", - originalTask.content, - updatedTask.content, - ); await this.handleTaskUpdate(originalTask, updatedTask); }, onTaskContextMenu: (event: MouseEvent, task: Task) => { @@ -496,11 +481,6 @@ export class TaskView extends ItemView { void this.toggleTaskCompletion(task); }, onTaskUpdate: async (originalTask: Task, updatedTask: Task) => { - console.log( - "TaskView onTaskUpdate", - originalTask.content, - updatedTask.content, - ); await this.handleTaskUpdate(originalTask, updatedTask); }, onTaskContextMenu: (event: MouseEvent, task: Task) => { @@ -817,11 +797,6 @@ export class TaskView extends ItemView { // 添加应用当前过滤器状态的方法 private applyCurrentFilter() { - console.log( - "应用当前过滤状态:", - this.liveFilterState ? "有实时筛选器" : "无实时筛选器", - this.currentFilterState ? "有过滤器" : "无过滤器", - ); // 通过triggerViewUpdate重新加载任务 void this.triggerViewUpdate(); } @@ -971,11 +946,6 @@ export class TaskView extends ItemView { originalTask: Task, updatedTask: Task, ) => { - console.log( - "triggered by detailsComponent", - originalTask, - updatedTask, - ); await this.updateTask(originalTask, updatedTask); }; this.detailsComponent.toggleDetailsVisibility = (visible: boolean) => { @@ -1002,14 +972,6 @@ export class TaskView extends ItemView { } this.currentViewId = viewId; - console.log( - "[TaskView] Switching view to:", - viewId, - "Project:", - project, - "ForceRefresh:", - forceRefresh, - ); // Update sidebar to reflect current view this.sidebarComponent.setViewMode(viewId); @@ -1108,10 +1070,6 @@ export class TaskView extends ItemView { } if (targetComponent) { - console.log( - `Activating component for view ${viewId}`, - targetComponent.constructor.name, - ); targetComponent.containerEl.show(); if (typeof targetComponent.setTasks === "function") { // 使用高级过滤器状态,确保传递有效的过滤器 @@ -1124,12 +1082,9 @@ export class TaskView extends ItemView { this.currentFilterState.filterGroups && this.currentFilterState.filterGroups.length > 0 ) { - console.log("应用高级筛选器到视图:", viewId); filterOptions.advancedFilter = this.currentFilterState; } - console.log("tasks", this.tasks); - let filteredTasks = filterTasks( this.tasks, viewId, @@ -1144,12 +1099,6 @@ export class TaskView extends ItemView { ); } - console.log( - "[TaskView] Calling setTasks with", - filteredTasks.length, - "filtered tasks, forceRefresh:", - forceRefresh, - ); targetComponent.setTasks( filteredTasks, this.tasks, @@ -1168,7 +1117,6 @@ export class TaskView extends ItemView { this.currentFilterState.filterGroups && this.currentFilterState.filterGroups.length > 0 ) { - console.log("应用高级筛选器到表格视图:", viewId); filterOptions.advancedFilter = this.currentFilterState; } @@ -1178,9 +1126,6 @@ export class TaskView extends ItemView { } if (typeof targetComponent.setViewMode === "function") { - console.log( - `Setting view mode for ${viewId} to ${modeForComponent} with project ${project}`, - ); targetComponent.setViewMode(modeForComponent, project); } @@ -1469,14 +1414,8 @@ export class TaskView extends ItemView { this.tasks = []; } else { try { - console.log( - "[TaskView] Loading tasks from dataflow orchestrator...", - ); const queryAPI = this.plugin.dataflowOrchestrator.getQueryAPI(); this.tasks = await queryAPI.getAllTasks(); - console.log( - `[TaskView] Loaded ${this.tasks.length} tasks from dataflow`, - ); } catch (error) { console.error( "[TaskView] Error loading tasks from dataflow:", @@ -1503,15 +1442,9 @@ export class TaskView extends ItemView { this.tasks = []; } else { try { - console.log( - "[TaskView] Loading tasks fast from dataflow orchestrator...", - ); const queryAPI = this.plugin.dataflowOrchestrator.getQueryAPI(); // For fast loading, use regular getAllTasks (it should be cached) this.tasks = await queryAPI.getAllTasks(); - console.log( - `[TaskView] Loaded ${this.tasks.length} tasks (fast from dataflow)`, - ); } catch (error) { console.error( "[TaskView] Error loading tasks fast from dataflow:", @@ -1540,9 +1473,6 @@ export class TaskView extends ItemView { const tasks = await queryAPI.getAllTasks(); if (tasks.length !== this.tasks.length || tasks.length === 0) { this.tasks = tasks; - console.log( - `TaskView updated with ${this.tasks.length} tasks (dataflow sync)`, - ); // Don't trigger view update here as it will be handled by events } } catch (error) { @@ -1649,23 +1579,12 @@ export class TaskView extends ItemView { return; } - console.log( - "handleTaskUpdate", - originalTask.content, - updatedTask.content, - originalTask.id, - updatedTask.id, - updatedTask, - originalTask, - ); - try { // Extract only the changed fields const updates = this.extractChangedFields( originalTask, updatedTask, ); - console.log("Extracted changes:", updates); // Always use WriteAPI with only the changed fields // Use originalTask.id to ensure we're updating the correct task @@ -1681,10 +1600,6 @@ export class TaskView extends ItemView { updatedTask = writeResult.task; } - console.log( - `Task ${updatedTask.id} updated successfully via handleTaskUpdate.`, - ); - // Update local task list immediately const index = this.tasks.findIndex((t) => t.id === originalTask.id); if (index !== -1) { @@ -1732,7 +1647,6 @@ export class TaskView extends ItemView { originalTask, updatedTask, ); - console.log("Extracted changes:", updates); // Always use WriteAPI with only the changed fields // Use originalTask.id to ensure we're updating the correct task @@ -1746,7 +1660,6 @@ export class TaskView extends ItemView { if (writeResult.task) { updatedTask = writeResult.task; } - console.log(`Task ${updatedTask.id} updated successfully.`); // 立即更新本地任务列表 const index = this.tasks.findIndex((t) => t.id === originalTask.id); @@ -1916,7 +1829,6 @@ export class TaskView extends ItemView { } onSettingsUpdate() { - console.log("TaskView received settings update notification."); if (typeof this.sidebarComponent.renderSidebarItems === "function") { this.sidebarComponent.renderSidebarItems(); } else { @@ -1953,9 +1865,6 @@ export class TaskView extends ItemView { taskId: string, newStatusMark: string, ) => { - console.log( - `TaskView handling Kanban status update request for ${taskId} to mark ${newStatusMark}`, - ); const taskToUpdate = this.tasks.find((t) => t.id === taskId); if (taskToUpdate) { @@ -1976,19 +1885,12 @@ export class TaskView extends ItemView { completedDate: completedDate, }, }); - console.log( - `Task ${taskId} status update processed by TaskView.`, - ); } catch (error) { console.error( `TaskView failed to update task status from Kanban callback for task ${taskId}:`, error, ); } - } else { - console.log( - `Task ${taskId} status (${newStatusMark}) already matches, no update needed.`, - ); } } else { console.warn( @@ -1999,7 +1901,6 @@ export class TaskView extends ItemView { // 添加重置筛选器的方法 public resetCurrentFilter() { - console.log("重置实时筛选器"); this.liveFilterState = null; this.currentFilterState = null; this.app.saveLocalStorage("task-genius-view-filter", null); @@ -2009,12 +1910,10 @@ export class TaskView extends ItemView { // 应用保存的筛选器配置 private applySavedFilter(config: SavedFilterConfig) { - console.log("应用保存的筛选器:", config.name); this.liveFilterState = JSON.parse(JSON.stringify(config.filterState)); this.currentFilterState = JSON.parse( JSON.stringify(config.filterState), ); - console.log("applySavedFilter", this.liveFilterState); this.app.saveLocalStorage( "task-genius-view-filter", this.liveFilterState, diff --git a/src/pages/bases/TaskBasesView.ts b/src/pages/bases/TaskBasesView.ts index 203055fd..c648d4cf 100644 --- a/src/pages/bases/TaskBasesView.ts +++ b/src/pages/bases/TaskBasesView.ts @@ -290,8 +290,6 @@ export class TaskBasesView extends BasesView { return; } - console.log(config, "based config"); - // Ensure forced view mode stays in sync with the saved config this.applyForcedViewModeConfig(config); @@ -684,20 +682,6 @@ export class TaskBasesView extends BasesView { } catch { // ignore } - - console.log("[TaskBasesView] Debug task conversion:", { - content, - rawStatusValue, - statusSymbol, - isCompleted, - taskStatusProp: this.taskStatusProp, - statusMapping: this.plugin.settings.fileSource?.statusMapping, - metadataMappings: - this.plugin.settings.fileSource?.metadataMappings, - entryFile: entry.file.path, - debugValues, - task, - }); } return task; diff --git a/src/pages/bases/registerBasesViews.ts b/src/pages/bases/registerBasesViews.ts index a411007c..fac02530 100644 --- a/src/pages/bases/registerBasesViews.ts +++ b/src/pages/bases/registerBasesViews.ts @@ -155,8 +155,6 @@ export function registerTaskGeniusBasesViews(plugin: TaskProgressBarPlugin) { }, options: createViewOptions(viewType), }); - - console.log(`Registered Bases view: ${viewType.name} (${viewType.id})`); } catch (error) { console.error(`Failed to register Bases view ${viewType.id}:`, error); } diff --git a/src/parsers/canvas-task-updater.ts b/src/parsers/canvas-task-updater.ts index 2bb7ca75..fc5bb804 100644 --- a/src/parsers/canvas-task-updater.ts +++ b/src/parsers/canvas-task-updater.ts @@ -102,7 +102,6 @@ export class CanvasTaskUpdater { // Write the updated Canvas content back to the file const updatedContent = JSON.stringify(canvasData, null, 2); - console.log("updatedContent", updatedContent); // Notify about write operation to trigger data flow update if (this.plugin.app) { diff --git a/src/parsers/file-metadata-parser.ts b/src/parsers/file-metadata-parser.ts index 3c3bb1a6..52c6e665 100644 --- a/src/parsers/file-metadata-parser.ts +++ b/src/parsers/file-metadata-parser.ts @@ -192,8 +192,6 @@ export class FileMetadataTaskParser { fileCache ); - console.log("metadata", metadata); - const task: Task = { id: taskId, content: taskContent, diff --git a/src/providers/apple-caldav-provider.ts b/src/providers/apple-caldav-provider.ts index f41aedf8..20f5d865 100644 --- a/src/providers/apple-caldav-provider.ts +++ b/src/providers/apple-caldav-provider.ts @@ -432,10 +432,6 @@ export class AppleCaldavProvider extends CalendarProviderBase 0; } diff --git a/src/utils/SettingsMigrationManager.ts b/src/utils/SettingsMigrationManager.ts index 9ea82945..040cee38 100644 --- a/src/utils/SettingsMigrationManager.ts +++ b/src/utils/SettingsMigrationManager.ts @@ -70,12 +70,6 @@ export class SettingsMigrationManager { t("FileSource is now the unified system for file-based task recognition."), 10000 ); - - // Log details for advanced users - console.log("Task Genius Settings Migration:", { - details: result.details, - warnings: result.warnings - }); } // Show warnings if any @@ -93,7 +87,6 @@ export class SettingsMigrationManager { if (result.migrated) { this.migrationCompleted = true; // Settings will be saved by the calling function - console.log("Task Genius: Silent settings migration completed", result.details); } return result; diff --git a/src/utils/changelog-cache.ts b/src/utils/changelog-cache.ts index 50bdb140..b4c9cc5a 100644 --- a/src/utils/changelog-cache.ts +++ b/src/utils/changelog-cache.ts @@ -87,8 +87,6 @@ const loadCache = (app: App): ChangelogCachePayload => { return {}; } - console.log("[ChangelogCache]", raw); - return sanitizeCachePayload(raw); } catch (error) { console.warn( diff --git a/src/utils/settings-migration.ts b/src/utils/settings-migration.ts index cca4f237..c5b25233 100644 --- a/src/utils/settings-migration.ts +++ b/src/utils/settings-migration.ts @@ -41,8 +41,6 @@ export function migrateToMultiCycle(settings: TaskProgressBarSettings): void { // Initialize statusCycles array with the migrated cycle settings.statusCycles = [legacyCycle]; - - console.log("[Task Genius] Migrated legacy status cycle configuration to multi-cycle format"); } /** diff --git a/src/utils/task/task-filter-utils.ts b/src/utils/task/task-filter-utils.ts index 9a1dd659..c83a4fbf 100644 --- a/src/utils/task/task-filter-utils.ts +++ b/src/utils/task/task-filter-utils.ts @@ -571,7 +571,6 @@ export function filterTasks( globalFilterRules.advancedFilter && globalFilterRules.advancedFilter.filterGroups?.length > 0 ) { - console.log("应用全局筛选器:", globalFilterRules.advancedFilter); filtered = filtered.filter((task) => applyAdvancedFilter(task, globalFilterRules.advancedFilter!), ); @@ -582,10 +581,6 @@ export function filterTasks( filterRules.advancedFilter && filterRules.advancedFilter.filterGroups?.length > 0 ) { - console.log( - "应用视图配置中的基础高级过滤器:", - filterRules.advancedFilter, - ); filtered = filtered.filter((task) => applyAdvancedFilter(task, filterRules.advancedFilter!), ); @@ -596,7 +591,6 @@ export function filterTasks( options.advancedFilter && options.advancedFilter.filterGroups?.length > 0 ) { - console.log("应用传入的实时高级过滤器:", options.advancedFilter); filtered = filtered.filter((task) => applyAdvancedFilter(task, options.advancedFilter!), ); From e231a9d4331958c2ef677c19ff34797acd4feba7 Mon Sep 17 00:00:00 2001 From: Quorafind Date: Sun, 29 Nov 2026 11:07:33 +0800 Subject: [PATCH 3/3] refactor(lint): drop code that only fed removed console logs Remove the timers (Date.now/performance.now), counters, destructured fields, callback parameters, constants, an import and a private field that only existed to build the now-deleted log messages. Calls with side effects are kept (completeTimer, createFileTask, controller.next); only their unused results are dropped. Also remove the progress check in TaskWorkerManager.processBatch whose body was the removed this.log() call, and type the FileSource test spy without `any`. --- .../file-source/FileSource.basic.test.ts | 5 +++- .../fluent/managers/FluentDataManager.ts | 11 ++----- src/components/features/kanban/kanban.ts | 1 - .../features/onboarding/OnboardingView.ts | 2 +- src/components/features/quadrant/quadrant.ts | 7 ++--- .../features/settings/core/SettingsIndexer.ts | 4 --- src/dataflow/Orchestrator.ts | 29 +------------------ src/dataflow/api/WriteAPI.ts | 8 ----- .../augment/DateInheritanceAugmentor.ts | 2 +- src/dataflow/createDataflow.ts | 3 -- src/dataflow/indexer/Repository.ts | 8 ----- src/dataflow/persistence/Storage.ts | 1 - src/dataflow/sources/FileSource.ts | 15 +--------- src/dataflow/sources/ObsidianSource.ts | 4 --- src/dataflow/workers/TaskWorkerManager.ts | 10 ------- src/editor-extensions/date-time/task-timer.ts | 2 +- src/managers/calendar-auth-manager.ts | 2 -- src/managers/file-task-manager.ts | 2 -- src/managers/ics-manager.ts | 3 -- src/pages/FluentTaskView.ts | 8 +---- src/services/task-parsing-service.ts | 8 ----- src/services/timer-export-service.ts | 2 -- 22 files changed, 15 insertions(+), 122 deletions(-) diff --git a/src/__tests__/file-source/FileSource.basic.test.ts b/src/__tests__/file-source/FileSource.basic.test.ts index a0fa6c67..78528c30 100644 --- a/src/__tests__/file-source/FileSource.basic.test.ts +++ b/src/__tests__/file-source/FileSource.basic.test.ts @@ -108,7 +108,10 @@ describe('FileSource', () => { }); it('should not initialize twice', () => { - const scanSpy = jest.spyOn(fileSource as any, 'performInitialScan'); + const scanSpy = jest.spyOn( + fileSource as unknown as { performInitialScan(): Promise }, + 'performInitialScan' + ); fileSource.updateConfiguration({ enabled: true }); fileSource.initialize(); diff --git a/src/components/features/fluent/managers/FluentDataManager.ts b/src/components/features/fluent/managers/FluentDataManager.ts index 20eccb7c..c6f0da83 100644 --- a/src/components/features/fluent/managers/FluentDataManager.ts +++ b/src/components/features/fluent/managers/FluentDataManager.ts @@ -4,12 +4,7 @@ import { Task } from "@/types/task"; import { filterTasks } from "@/utils/task/task-filter-utils"; import { RootFilterState } from "@/components/features/task/filter/ViewTaskFilter"; import { isDataflowEnabled } from "@/dataflow/createDataflow"; -import { - BatchOperationCompletePayload, - BatchOperationStartPayload, - Events, - on, -} from "@/dataflow/events/Events"; +import { Events, on } from "@/dataflow/events/Events"; import { sortTasks } from "@/commands/sortTaskCommands"; import { TaskTimerManager } from "@/managers/timer-manager"; import { @@ -411,7 +406,7 @@ export class FluentDataManager extends Component { if (isDataflowEnabled(this.plugin)) { // Listen for batch operation start this.registerEvent( - on(this.plugin.app, Events.BATCH_OPERATION_START, (payload: BatchOperationStartPayload) => { + on(this.plugin.app, Events.BATCH_OPERATION_START, () => { this.isBatchOperating = true; }), ); @@ -421,7 +416,7 @@ export class FluentDataManager extends Component { on( this.plugin.app, Events.BATCH_OPERATION_COMPLETE, - (payload: BatchOperationCompletePayload) => void (async () => { + () => void (async () => { this.isBatchOperating = false; // Immediately refresh view after batch operation (skip debounce) diff --git a/src/components/features/kanban/kanban.ts b/src/components/features/kanban/kanban.ts index a3c39abc..e530a9a3 100644 --- a/src/components/features/kanban/kanban.ts +++ b/src/components/features/kanban/kanban.ts @@ -115,7 +115,6 @@ export class KanbanComponent extends Component { if (isChanged) { // Refresh derived state from effective config (sort/hide/column order) this.loadKanbanConfig(); - const eff = this.getEffectiveKanbanConfig(); if (this.columnContainerEl) { // Rebuild columns with the new configuration so changes like groupBy // take effect immediately without requiring a data refresh. diff --git a/src/components/features/onboarding/OnboardingView.ts b/src/components/features/onboarding/OnboardingView.ts index c223a275..20b1b4b2 100644 --- a/src/components/features/onboarding/OnboardingView.ts +++ b/src/components/features/onboarding/OnboardingView.ts @@ -305,7 +305,7 @@ export class OnboardingView extends ItemView { } // Navigate to next step - const success = await this.controller.next(); + await this.controller.next(); } /** diff --git a/src/components/features/quadrant/quadrant.ts b/src/components/features/quadrant/quadrant.ts index 3309920b..1055c9d5 100644 --- a/src/components/features/quadrant/quadrant.ts +++ b/src/components/features/quadrant/quadrant.ts @@ -377,10 +377,7 @@ export class QuadrantComponent extends Component { this.sortableInstances.push(sortable); } - private handleTaskReorder( - evt: Sortable.SortableEvent, - quadrant: QuadrantDefinition - ) { + private handleTaskReorder(evt: Sortable.SortableEvent) { const taskEl = evt.item; const taskId = taskEl.getAttribute("data-task-id"); @@ -427,7 +424,7 @@ export class QuadrantComponent extends Component { ); } else if (event.oldIndex !== event.newIndex) { // Handle reordering within the same quadrant - this.handleTaskReorder(event, targetQuadrant); + this.handleTaskReorder(event); } } } diff --git a/src/components/features/settings/core/SettingsIndexer.ts b/src/components/features/settings/core/SettingsIndexer.ts index c0d00587..911343ab 100644 --- a/src/components/features/settings/core/SettingsIndexer.ts +++ b/src/components/features/settings/core/SettingsIndexer.ts @@ -31,8 +31,6 @@ export class SettingsIndexer { public initialize(): void { if (this.isInitialized) return; - const startTime = performance.now(); - // 优先从 DOM 构建;如果不可用,则回退到静态元数据 if (this.rootEl) { this.buildIndexFromDOM(this.rootEl); @@ -40,8 +38,6 @@ export class SettingsIndexer { this.buildIndexFromStatic(); } - const endTime = performance.now(); - this.isInitialized = true; } diff --git a/src/dataflow/Orchestrator.ts b/src/dataflow/Orchestrator.ts index 1f16efc3..5923a162 100644 --- a/src/dataflow/Orchestrator.ts +++ b/src/dataflow/Orchestrator.ts @@ -259,8 +259,6 @@ export class DataflowOrchestrator { * Initialize the orchestrator (load persisted data) */ async initialize(): Promise { - const startTime = Date.now(); - try { // Initialize or sync FileFilterManager from settings (do not recreate if already exists) const ffSettings = this.plugin.settings?.fileFilter; @@ -319,9 +317,6 @@ export class DataflowOrchestrator { // Persist the initial index await this.repository.persist(); - - const finalTaskCount = (await this.queryAPI.getAllTasks()) - .length; } else { // The cache may still hold files removed while Obsidian was closed await this.repository.removeMissingFiles(); @@ -357,8 +352,6 @@ export class DataflowOrchestrator { timestamp: Date.now(), seq: Seq.next(), }); - - const elapsed = Date.now() - startTime; } catch (error) { console.error( "[DataflowOrchestrator] Initialization failed:", @@ -468,7 +461,7 @@ export class DataflowOrchestrator { // Listen for task deletion events this.eventRefs.push( on(this.app, Events.TASK_DELETED, (payload: TaskDeletedPayload) => void (async () => { - const { taskId, filePath, deletedTaskIds, mode } = payload; + const { filePath, deletedTaskIds } = payload; // Remove deleted tasks from repository if (deletedTaskIds && deletedTaskIds.length > 0) { @@ -892,10 +885,6 @@ export class DataflowOrchestrator { if (fileFilterChanged) { const newEnabled = Boolean(settings?.fileFilter?.enabled); - const rulesCount = Array.isArray(settings?.fileFilter?.rules) - ? settings.fileFilter.rules.filter((r) => r?.enabled) - .length - : 0; this.lastFileFilterEnabled = newEnabled; // Plan B: Always prune then restore (debounced) on any fileFilter change @@ -919,10 +908,8 @@ export class DataflowOrchestrator { private async pruneByFilter(): Promise { if (!this.fileFilterManager) return; try { - const start = Date.now(); const files = await this.repository.getIndexedFilePaths(); const toClear = new Map(); - let prunedInline = 0; for (const p of files) { const includeInline = this.fileFilterManager.shouldIncludePath( p, @@ -940,11 +927,9 @@ export class DataflowOrchestrator { }); for (const p of toClear.keys()) { this.suppressedInline.add(p); - prunedInline++; } } const fileTaskPaths = this.repository.getFileTaskPaths?.() || []; - let prunedFileTasks = 0; for (const p of fileTaskPaths) { const includeFile = this.fileFilterManager.shouldIncludePath( p, @@ -953,7 +938,6 @@ export class DataflowOrchestrator { if (!includeFile) { await this.repository.removeFileTask(p); this.suppressedFileTasks.add(p); - prunedFileTasks++; } } // Persist suppressed sets for cross-restart restore capability (after updates) @@ -972,7 +956,6 @@ export class DataflowOrchestrator { e, ); } - const elapsed = Date.now() - start; } catch (e) { console.warn("[DataflowOrchestrator] pruneByFilter failed", e); } @@ -987,7 +970,6 @@ export class DataflowOrchestrator { private async restoreByFilter(): Promise { if (!this.fileFilterManager) return; try { - const start = Date.now(); let inlineCandidates: string[] = Array.from( this.suppressedInline, ).filter((p) => @@ -1027,10 +1009,6 @@ export class DataflowOrchestrator { } } - let restoredFromAugmented = 0; - let restoredFromRaw = 0; - let reparsed = 0; - const processInlineBatch = async (batch: string[]) => { for (const path of batch) { try { @@ -1049,7 +1027,6 @@ export class DataflowOrchestrator { undefined, { forceEmit: true }, ); - restoredFromAugmented++; this.suppressedInline.delete(path); continue; } @@ -1076,13 +1053,11 @@ export class DataflowOrchestrator { path, augmentedTasks, ); - restoredFromRaw++; this.suppressedInline.delete(path); continue; } // Fallback: single-file parse await this.processFileImmediate(file, false); - reparsed++; this.suppressedInline.delete(path); } catch (e) { // Persist updated suppressed sets for cross-restart recovery @@ -1144,8 +1119,6 @@ export class DataflowOrchestrator { ); } } - - const elapsed = Date.now() - start; } catch (e) { console.warn("[DataflowOrchestrator] restoreByFilter failed", e); } diff --git a/src/dataflow/api/WriteAPI.ts b/src/dataflow/api/WriteAPI.ts index d919f26c..f5f6f166 100644 --- a/src/dataflow/api/WriteAPI.ts +++ b/src/dataflow/api/WriteAPI.ts @@ -1110,8 +1110,6 @@ export class WriteAPI { fm.title = updates.content; }, ); - const cacheAfter = - this.app.metadataCache.getFileCache(file); break; } case "h1": { @@ -1126,8 +1124,6 @@ export class WriteAPI { fm[customContentField] = updates.content; }, ); - const cacheAfter = - this.app.metadataCache.getFileCache(file); } else if (preferFrontmatterTitle) { await this.app.fileManager.processFrontMatter( file, @@ -1135,8 +1131,6 @@ export class WriteAPI { fm.title = updates.content; }, ); - const cacheAfter2 = - this.app.metadataCache.getFileCache(file); } else { newFilePath = await this.renameFile( file, @@ -1154,8 +1148,6 @@ export class WriteAPI { fm.title = updates.content; }, ); - const cacheAfter = - this.app.metadataCache.getFileCache(file); } else { newFilePath = await this.renameFile( file, diff --git a/src/dataflow/augment/DateInheritanceAugmentor.ts b/src/dataflow/augment/DateInheritanceAugmentor.ts index b777b482..72e62fa8 100644 --- a/src/dataflow/augment/DateInheritanceAugmentor.ts +++ b/src/dataflow/augment/DateInheritanceAugmentor.ts @@ -364,7 +364,7 @@ export class DateInheritanceAugmentor { const updatedMetadata: EnhancedStandardTaskMetadata = { ...task.metadata }; // Update date fields with resolved dates - for (const { type, date, timeComponent, result } of resolvedDates) { + for (const { type, date, timeComponent } of resolvedDates) { const timestamp = date.getTime(); switch (type) { diff --git a/src/dataflow/createDataflow.ts b/src/dataflow/createDataflow.ts index 82152eda..b6a77441 100644 --- a/src/dataflow/createDataflow.ts +++ b/src/dataflow/createDataflow.ts @@ -18,8 +18,6 @@ export async function createDataflow( plugin: TaskProgressBarPlugin, projectOptions?: Partial ): Promise { - const startTime = Date.now(); - const orchestrator = new DataflowOrchestrator( app, vault, @@ -32,7 +30,6 @@ export async function createDataflow( try { await orchestrator.initialize(); - const elapsed = Date.now() - startTime; } catch (error) { console.error("[createDataflow] Failed to initialize orchestrator:", error); if (plugin.dataflowOrchestrator === orchestrator) { diff --git a/src/dataflow/indexer/Repository.ts b/src/dataflow/indexer/Repository.ts index 298569ba..88b8ce3e 100644 --- a/src/dataflow/indexer/Repository.ts +++ b/src/dataflow/indexer/Repository.ts @@ -70,16 +70,9 @@ export class Repository { if (consolidated && consolidated.data) { // Restore the index from persisted data - const snapshotTaskCount = consolidated.data?.tasks - ? consolidated.data.tasks instanceof Map - ? consolidated.data.tasks.size - : Object.keys(consolidated.data.tasks).length - : 0; await this.indexer.restoreFromSnapshot(consolidated.data); await this.normalizeRestoredProjects(); - const taskCount = await this.indexer.getTotalTaskCount(); - // Emit cache ready event emit(this.app, Events.CACHE_READY, { initial: true, @@ -561,7 +554,6 @@ export class Repository { } if (this.persistQueue.size > 0) { - const queueSize = this.persistQueue.size; await this.persist(); this.persistQueue.clear(); this.lastPersistTime = Date.now(); diff --git a/src/dataflow/persistence/Storage.ts b/src/dataflow/persistence/Storage.ts index 0b158e86..7215dfe0 100644 --- a/src/dataflow/persistence/Storage.ts +++ b/src/dataflow/persistence/Storage.ts @@ -369,7 +369,6 @@ export class Storage { schema: this.schemaVersion, data: taskCache, }; - const count = taskCache ? Object.keys(taskCache).length : 0; await this.cache.storeConsolidatedCache("taskIndex", record); } diff --git a/src/dataflow/sources/FileSource.ts b/src/dataflow/sources/FileSource.ts index 16ba8ebe..ef4c0757 100644 --- a/src/dataflow/sources/FileSource.ts +++ b/src/dataflow/sources/FileSource.ts @@ -1238,24 +1238,15 @@ export class FileSource { private async performInitialScan(): Promise { const mdFiles = this.app.vault.getMarkdownFiles(); - let scannedCount = 0; - let taskCount = 0; - let relevantCount = 0; - for (const file of mdFiles) { if (this.isRelevantFile(file.path)) { - relevantCount++; try { const shouldBeTask = await this.shouldCreateFileTask( file.path ); if (shouldBeTask) { - const task = await this.createFileTask(file.path); - if (task) { - taskCount++; - } + await this.createFileTask(file.path); } - scannedCount++; } catch (error) { console.error( `[FileSource] Error scanning ${file.path}:`, @@ -1264,10 +1255,6 @@ export class FileSource { } } } - - if (taskCount === 0 && relevantCount > 0) { - const config = this.config.getConfig(); - } } /** diff --git a/src/dataflow/sources/ObsidianSource.ts b/src/dataflow/sources/ObsidianSource.ts index f42b3cfa..faf75b94 100644 --- a/src/dataflow/sources/ObsidianSource.ts +++ b/src/dataflow/sources/ObsidianSource.ts @@ -4,7 +4,6 @@ import { type TFile, type Vault, type MetadataCache, - type EventRef, Component, } from "obsidian"; import { Events, emit, on } from "../events/Events"; @@ -23,9 +22,6 @@ export class ObsidianSource extends Component { private vault: Vault; private metadataCache: MetadataCache; - // Event references for cleanup - private eventRefs: EventRef[] = []; - // Debouncing configuration private readonly DEBOUNCE_DELAY = 300; // ms private readonly BATCH_DELAY = 150; // ms for batch operations diff --git a/src/dataflow/workers/TaskWorkerManager.ts b/src/dataflow/workers/TaskWorkerManager.ts index 680bd161..93adde34 100644 --- a/src/dataflow/workers/TaskWorkerManager.ts +++ b/src/dataflow/workers/TaskWorkerManager.ts @@ -508,14 +508,12 @@ export class TaskWorkerManager extends Component { // Pre-filter files: separate cached from uncached const filesToProcess: TFile[] = []; const resultMap = new Map(); - let cachedCount = 0; for (const file of files) { if (!this.shouldProcessFile(file)) { const cachedTasks = this.getCachedTasksForFile(file.path); if (cachedTasks) { resultMap.set(file.path, cachedTasks); - cachedCount++; continue; } } @@ -592,14 +590,6 @@ export class TaskWorkerManager extends Component { // 更新进度 this.processedFiles += results.length; - const progress = Math.round( - (this.processedFiles / this.totalFilesToProcess) * 100 - ); - if ( - progress % 10 === 0 || - this.processedFiles === this.totalFilesToProcess - ) { - } }); // 启动处理队列 diff --git a/src/editor-extensions/date-time/task-timer.ts b/src/editor-extensions/date-time/task-timer.ts index e11c19c5..41cbf103 100644 --- a/src/editor-extensions/date-time/task-timer.ts +++ b/src/editor-extensions/date-time/task-timer.ts @@ -1140,7 +1140,7 @@ function handleTaskStatusChange(transaction: Transaction): void { existingTimer.status === "paused") ) { // Complete the timer - this calculates final duration and removes from active list - const duration = timerManager.completeTimer(taskId); + timerManager.completeTimer(taskId); } } else if (notStartedMarkers.includes(statusChar)) { // Task is reset to not started - reset timer diff --git a/src/managers/calendar-auth-manager.ts b/src/managers/calendar-auth-manager.ts index acb3f79b..17335f1f 100644 --- a/src/managers/calendar-auth-manager.ts +++ b/src/managers/calendar-auth-manager.ts @@ -113,9 +113,7 @@ const OAUTH_CALLBACK_PATH = "/oauth/callback"; /** * Legacy Obsidian protocol URI for OAuth callback (fallback) */ -const OBSIDIAN_PROTOCOL = "obsidian"; const PROTOCOL_ACTION = "task-genius-oauth"; -const LEGACY_REDIRECT_URI = `${OBSIDIAN_PROTOCOL}://${PROTOCOL_ACTION}`; // ============================================================================ // Event Types diff --git a/src/managers/file-task-manager.ts b/src/managers/file-task-manager.ts index 778747c4..3435cab0 100644 --- a/src/managers/file-task-manager.ts +++ b/src/managers/file-task-manager.ts @@ -107,8 +107,6 @@ export class FileTaskManagerImpl implements FileTaskManager { entry: BasesEntry, mapping: FileTaskPropertyMapping = DEFAULT_FILE_TASK_MAPPING, ): FileTask { - const properties = entry.properties || {}; - // Generate unique ID based on file path const id = `file-task-${entry.file.path}`; diff --git a/src/managers/ics-manager.ts b/src/managers/ics-manager.ts index 3bd1031a..d39b0833 100644 --- a/src/managers/ics-manager.ts +++ b/src/managers/ics-manager.ts @@ -1202,11 +1202,9 @@ export class IcsManager extends Component { // Apply event type filters if (!source.showAllDayEvents) { - const beforeFilter = filteredEvents.length; filteredEvents = filteredEvents.filter((event) => !event.allDay); } if (!source.showTimedEvents) { - const beforeFilter = filteredEvents.length; filteredEvents = filteredEvents.filter((event) => event.allDay); } @@ -1305,7 +1303,6 @@ export class IcsManager extends Component { // Limit number of events if (filteredEvents.length > this.config.maxEventsPerSource) { - const beforeLimit = filteredEvents.length; filteredEvents = filteredEvents .sort((a, b) => b.dtstart.getTime() - a.dtstart.getTime()) // 倒序:最新的事件在前 .slice(0, this.config.maxEventsPerSource); diff --git a/src/pages/FluentTaskView.ts b/src/pages/FluentTaskView.ts index 942a45c9..d8819ad1 100644 --- a/src/pages/FluentTaskView.ts +++ b/src/pages/FluentTaskView.ts @@ -60,12 +60,6 @@ export const FLUENT_TASK_VIEW = "fluent-task-genius-view"; export class FluentTaskView extends ItemView { private plugin: TaskProgressBarPlugin; - // ==================== - // DEBUG CONFIGURATION - // ==================== - // Set to false in production to reduce console output - private readonly DEBUG_MODE = false; - // ==================== // MANAGERS (added via addChild for lifecycle management) // ==================== @@ -485,7 +479,7 @@ export class FluentTaskView extends ItemView { this.componentManager?.renderLoadingState(); } }, - onUpdateNeeded: (source) => { + onUpdateNeeded: () => { // Re-apply filters and update view this.filteredTasks = this.dataManager.applyFilters(this.tasks); this.updateView(); diff --git a/src/services/task-parsing-service.ts b/src/services/task-parsing-service.ts index b82562b7..0a6f6713 100644 --- a/src/services/task-parsing-service.ts +++ b/src/services/task-parsing-service.ts @@ -471,8 +471,6 @@ export class TaskParsingService { // Use optimized batch processing with worker manager if available if (this.projectDataWorkerManager) { try { - const startTime = Date.now(); - // Get batch project data using optimized cache and worker processing const projectDataMap = await this.projectDataWorkerManager.getBatchProjectData( @@ -543,8 +541,6 @@ export class TaskParsingService { } } - const processingTime = Date.now() - startTime; - return { fileProjectMap, fileMetadataMap, @@ -559,8 +555,6 @@ export class TaskParsingService { } // Fallback to original synchronous method if worker manager is not available - const startTime = Date.now(); - // Process each file to determine its project and metadata (original logic) for (const filePath of filePaths) { try { @@ -611,8 +605,6 @@ export class TaskParsingService { } } - const processingTime = Date.now() - startTime; - return { fileProjectMap, fileMetadataMap, diff --git a/src/services/timer-export-service.ts b/src/services/timer-export-service.ts index a021b646..0f4a7856 100644 --- a/src/services/timer-export-service.ts +++ b/src/services/timer-export-service.ts @@ -304,7 +304,6 @@ export class TaskTimerExporter { } let importedCount = 0; - let activeCount = 0; for (const timerData of data.timers) { try { @@ -351,7 +350,6 @@ export class TaskTimerExporter { activeList.push(timerData.taskId); } - activeCount++; importedCount++; } else if (timerData.status === "idle" || timerData.endTime) { // Store completed timers as historical data