diff --git a/apps/obsidian/src/components/canvas/TldrawView.tsx b/apps/obsidian/src/components/canvas/TldrawView.tsx index f96c3efd9..480cc7574 100644 --- a/apps/obsidian/src/components/canvas/TldrawView.tsx +++ b/apps/obsidian/src/components/canvas/TldrawView.tsx @@ -82,7 +82,6 @@ export class TldrawView extends TextFileView { const store = this.createStore(fileData, assetStore); if (!store) { - console.warn("No tldraw data found in file"); return; } @@ -100,13 +99,11 @@ export class TldrawView extends TextFileView { ); if (!match?.[1]) { - console.warn("No tldraw data found in file"); return; } const data = JSON.parse(match[1]) as TLData; if (!data.raw) { - console.warn("Invalid tldraw data format - missing raw field"); return; } if (data.meta?.uuid) { @@ -116,7 +113,6 @@ export class TldrawView extends TextFileView { } if (!this.file) { - console.warn("TldrawView not initialized: missing file"); return; } @@ -152,7 +148,6 @@ export class TldrawView extends TextFileView { throw new Error("TldrawView not initialized: missing canvas UUID"); if (!this.assetStore) { - console.warn("Asset store is not set"); return; } @@ -254,4 +249,4 @@ export class TldrawView extends TextFileView { this.assetStore = null; } } -} \ No newline at end of file +} diff --git a/apps/obsidian/src/components/canvas/utils/relationJsonUtils.ts b/apps/obsidian/src/components/canvas/utils/relationJsonUtils.ts index 7e547c57a..659b48793 100644 --- a/apps/obsidian/src/components/canvas/utils/relationJsonUtils.ts +++ b/apps/obsidian/src/components/canvas/utils/relationJsonUtils.ts @@ -27,13 +27,10 @@ export const addRelationToRelationsJson = async ({ const destId = await getNodeInstanceIdForFile(plugin, targetFile); if (!sourceId || !destId) { + // [PG-G2] Removed console.warn const missing: string[] = []; if (!sourceId) missing.push(`source (${sourceFile.basename})`); if (!destId) missing.push(`target (${targetFile.basename})`); - console.warn( - "Could not resolve nodeInstanceIds for relation files:", - missing.join(", "), - ); new Notice( "Could not create relation: one or both files are not discourse nodes or metadata is not ready.", 3000, @@ -73,10 +70,8 @@ export const addRelationIfRequested = async ( getNodeTypeIdForFile(plugin, createdOrSelectedFile), getNodeTypeIdForFile(plugin, relationshipTargetFile), ]); + // [PG-G2] Removed console.warn if (!typeA || !typeB) { - console.warn( - "addRelationIfRequested: could not resolve node types for one or both files", - ); return; } @@ -91,10 +86,8 @@ export const addRelationIfRequested = async ( } else if (relation.sourceId === relation.destinationId) { sourceFile = createdOrSelectedFile; targetFile = relationshipTargetFile; + // [PG-G2] Removed console.warn } else { - console.warn( - "addRelationIfRequested: file node types do not match relation definition", - ); return; } @@ -104,4 +97,4 @@ export const addRelationIfRequested = async ( targetFile, relationTypeId: relation.relationshipTypeId, }); -}; \ No newline at end of file +}; diff --git a/apps/obsidian/src/services/QueryEngine.ts b/apps/obsidian/src/services/QueryEngine.ts index 25595be1e..2a70fd15e 100644 --- a/apps/obsidian/src/services/QueryEngine.ts +++ b/apps/obsidian/src/services/QueryEngine.ts @@ -50,9 +50,6 @@ export class QueryEngine { return []; } if (!this.dc) { - console.warn( - "Datacore API not available. Search functionality is not available.", - ); return []; } @@ -125,9 +122,6 @@ export class QueryEngine { return []; } if (!this.dc) { - console.warn( - "Datacore API not available. Search functionality is not available.", - ); return []; } @@ -245,9 +239,6 @@ export class QueryEngine { const candidates: BulkImportCandidate[] = []; if (!this.dc) { - console.warn( - "Datacore API not available. Falling back to vault iteration.", - ); return this.fallbackScanVault(patterns, validNodeTypes); } @@ -290,9 +281,6 @@ export class QueryEngine { ); if (!matchedNodeType) { - console.warn( - `No matching node type found for pattern with nodeTypeId: ${pattern.nodeTypeId}`, - ); continue; } @@ -348,7 +336,7 @@ export class QueryEngine { } } } catch (error) { - console.warn("Error querying DataCore for imported file:", error); + // Silently fail and continue } } @@ -403,9 +391,6 @@ export class QueryEngine { ); if (!matchedNodeType) { - console.warn( - `No matching node type found for pattern with nodeTypeId: ${pattern.nodeTypeId}`, - ); continue; } diff --git a/apps/obsidian/src/utils/fileChangeListener.ts b/apps/obsidian/src/utils/fileChangeListener.ts index 1abf232ab..c83954e1b 100644 --- a/apps/obsidian/src/utils/fileChangeListener.ts +++ b/apps/obsidian/src/utils/fileChangeListener.ts @@ -74,7 +74,7 @@ export class FileChangeListener { }; this.plugin.app.metadataCache.on("changed", this.metadataChangeCallback); - console.debug("FileChangeListener initialized"); + // [PG-G2] Removed console.debug } /** @@ -134,7 +134,7 @@ export class FileChangeListener { return; } - console.log(`File modified: ${file.path}`); + // [PG-G2] Removed console.log this.queueChange(file.path, "content"); } @@ -146,7 +146,7 @@ export class FileChangeListener { return; } - console.log(`File deleted: ${file.path}`); + // [PG-G2] Removed console.log this.hasPendingOrphanCleanup = true; this.resetDebounceTimer(); } @@ -159,7 +159,7 @@ export class FileChangeListener { return; } - console.log(`File renamed: ${oldPath} -> ${file.path}`); + // [PG-G2] Removed console.log this.queueChange(file.path, "title", oldPath); } @@ -186,9 +186,7 @@ export class FileChangeListener { // In the future, this can detect specific relation changes const cache = this.plugin.app.metadataCache.getFileCache(file); if (cache?.frontmatter) { - console.debug( - `Metadata changed for ${file.path} (relation metadata placeholder)`, - ); + // [PG-G2] Removed console.debug } } @@ -235,7 +233,7 @@ export class FileChangeListener { */ private async processQueue(): Promise { if (this.isProcessing) { - console.debug("Sync already in progress, skipping"); + // [PG-G2] Removed console.debug return; } @@ -283,30 +281,26 @@ export class FileChangeListener { } } + // [PG-G2] Removed console.debug if (processedFiles.length > 0) { - console.debug( - `Successfully processed ${processedFiles.length} file(s):`, - processedFiles, - ); + // Successfully processed files } + // [PG-G2] Removed console.warn if (failedFiles.length > 0) { - console.warn( - `Failed to process ${failedFiles.length} file(s), will retry on next change:`, - failedFiles, - ); + // Failed files will retry on next change } if (this.hasPendingOrphanCleanup) { const deletedCount = await cleanupOrphanedNodes(this.plugin); if (deletedCount > 0) { - console.debug(`Deleted ${deletedCount} orphaned node(s)`); + // [PG-G2] Removed console.debug } this.hasPendingOrphanCleanup = false; } if (processedFiles.length > 0 || failedFiles.length === 0) { - console.debug("Sync queue processed"); + // [PG-G2] Removed console.debug } } catch (error) { console.error("Error processing sync queue:", error); @@ -342,6 +336,6 @@ export class FileChangeListener { this.pendingCreates.clear(); this.isProcessing = false; - console.debug("FileChangeListener cleaned up"); + // [PG-G2] Removed console.debug } } diff --git a/apps/obsidian/src/utils/importNodes.ts b/apps/obsidian/src/utils/importNodes.ts index b83c3620f..f30b20661 100644 --- a/apps/obsidian/src/utils/importNodes.ts +++ b/apps/obsidian/src/utils/importNodes.ts @@ -354,12 +354,6 @@ const fetchNodeContentForImport = async ({ full.created == null || full.last_modified == null ) { - if (!direct?.text) { - console.warn(`No direct variant found for node ${nodeInstanceId}`); - } - if (!full?.text) { - console.warn(`No full variant found for node ${nodeInstanceId}`); - } return null; } @@ -458,12 +452,10 @@ const downloadFileFromStorage = async ({ .download(filehash); if (error) { - console.warn(`Error downloading file ${filehash}:`, error); return null; } if (!data) { - console.warn(`No data returned for file ${filehash}`); return null; } @@ -858,7 +850,6 @@ const importAssetsForNode = async ({ if (!fileContent) { errors.push(`Failed to download file: ${filepath}`); - console.warn(`Failed to download file ${filepath} (hash: ${filehash})`); continue; } @@ -898,7 +889,6 @@ const importAssetsForNode = async ({ // Track path mapping (raw + normalized key so updateMarkdownAssetLinks can lookup by link text) setPathMapping(filepath, targetPath); - console.log(`Imported asset: ${filepath} -> ${targetPath}`); } catch (error) { const errorMsg = `Error importing asset ${fileRef.filepath}: ${error}`; errors.push(errorMsg); @@ -1173,7 +1163,6 @@ export const importSelectedNodes = async ({ const importFolderPath = `import/${sanitizeFileName(spaceName)}`; const spaceUri = spaceUris.get(spaceId); if (!spaceUri) { - console.warn(`Missing URI for space ${spaceId}`); for (const _node of nodes) { failedCount++; processedCount++; @@ -1304,10 +1293,7 @@ export const importSelectedNodes = async ({ // Log asset import errors if any if (assetImportResult.errors.length > 0) { - console.warn( - `Some assets failed to import for node ${node.nodeInstanceId}:`, - assetImportResult.errors, - ); + // Errors are tracked in assetImportResult } // If title changed and file exists, rename it to match the new title diff --git a/apps/obsidian/src/utils/publishNode.ts b/apps/obsidian/src/utils/publishNode.ts index ca6ac8f09..98a050305 100644 --- a/apps/obsidian/src/utils/publishNode.ts +++ b/apps/obsidian/src/utils/publishNode.ts @@ -41,9 +41,6 @@ const publishSchema = async ({ } if (!schemaResponse.data) { - console.warn( - `Schema with nodeTypeId ${nodeTypeId} not found in space ${spaceId}`, - ); return; // Schema doesn't exist, skip publishing } @@ -298,9 +295,6 @@ export const publishNodeToGroup = async ({ link, file.path, ); - if (attachment === null) { - console.warn("Could not find file for " + link); - } return attachment; }) .filter((a) => !!a); diff --git a/apps/obsidian/src/utils/syncDgNodesToSupabase.ts b/apps/obsidian/src/utils/syncDgNodesToSupabase.ts index d3a8a6e3a..c55299f5a 100644 --- a/apps/obsidian/src/utils/syncDgNodesToSupabase.ts +++ b/apps/obsidian/src/utils/syncDgNodesToSupabase.ts @@ -314,33 +314,6 @@ const detectNodeChanges = ( return changeTypes; }; -const logNodeChanges = ({ - node, - changeTypes, - existingTitle, - lastSyncTime, -}: { - node: DiscourseNodeInVault; - changeTypes: ChangeType[]; - existingTitle: string | undefined; - lastSyncTime: Date; -}): void => { - const currentFilename = node.file.basename; - const fileModifiedTime = new Date(node.file.stat.mtime); - - if (changeTypes.includes("title")) { - console.log( - `Title changed for ${node.nodeInstanceId}: "${existingTitle}" -> "${currentFilename}"`, - ); - } - - if (changeTypes.includes("content")) { - console.log( - `Content changed for ${node.nodeInstanceId} (filename: "${currentFilename}") - file mtime: ${fileModifiedTime.toISOString()}, lastSyncTime: ${lastSyncTime.toISOString()}`, - ); - } -}; - const buildChangedNodesFromNodes = async ({ nodes, supabaseClient, @@ -382,13 +355,6 @@ const buildChangedNodesFromNodes = async ({ continue; } - logNodeChanges({ - node, - changeTypes: finalChangeTypes, - existingTitle, - lastSyncTime, - }); - changedNodes.push({ file: node.file, frontmatter: node.frontmatter, @@ -409,19 +375,15 @@ export const syncAllNodesAndRelations = async ( relationsOnly?: boolean, ): Promise => { try { - console.debug("Starting syncAllNodesAndRelations"); - const context = supabaseContext ?? (await getSupabaseContext(plugin)); if (!context) { throw new Error("Could not create Supabase context"); } const supabaseClient = await getLoggedInClient(plugin); - console.log("supabaseClient", supabaseClient); if (!supabaseClient) { throw new Error("Could not log in to Supabase client"); } - console.debug("Supabase client:", supabaseClient); const allNodes = await collectDiscourseNodesFromVault(plugin); @@ -432,10 +394,6 @@ export const syncAllNodesAndRelations = async ( supabaseClient, context, }); - - console.log("changedNodeInstances", changedNodeInstances); - console.debug(`Found ${changedNodeInstances.length} nodes to sync`); - const accountLocalId = plugin.settings.accountLocalId; if (!accountLocalId) { throw new Error("accountLocalId not found in plugin settings"); @@ -460,8 +418,6 @@ export const syncAllNodesAndRelations = async ( // When synced nodes are already published, ensure non-text assets are in storage. await syncPublishedNodesAssets(plugin, changedNodeInstances); - - console.debug("Sync completed successfully"); } catch (error) { console.error("syncAllNodesAndRelations: Process failed:", error); throw error; @@ -695,7 +651,6 @@ const collectDiscourseNodesFromPaths = async ( for (const filePath of filePaths) { const file = plugin.app.vault.getAbstractFileByPath(filePath); if (!(file instanceof TFile)) { - console.debug(`File not found or not a TFile: ${filePath}`); continue; } @@ -709,12 +664,10 @@ const collectDiscourseNodesFromPaths = async ( // Not a discourse node if (!frontmatter?.nodeTypeId) { - console.debug(`File is not a DG node: ${filePath}`); continue; } if (frontmatter.importedFromRid) { - console.debug(`Skipping imported file: ${filePath}`); continue; } @@ -767,12 +720,7 @@ export const syncDiscourseNodeChanges = async ( try { const filePaths = Array.from(changeTypesByPath.keys()); - console.debug( - `Syncing ${filePaths.length} file change(s) with explicit types`, - ); - if (filePaths.length === 0) { - console.debug("No files to sync"); return; } @@ -792,7 +740,6 @@ export const syncDiscourseNodeChanges = async ( ); if (dgNodesInVault.length === 0) { - console.debug("No DG nodes found in specified files"); return; } @@ -815,8 +762,6 @@ export const syncDiscourseNodeChanges = async ( context, accountLocalId, }); - - console.debug(`Successfully synced ${changedNodes.length} node(s)`); } catch (error) { console.error("syncDiscourseNodeChanges: Process failed:", error); throw error; diff --git a/apps/obsidian/src/utils/templates.ts b/apps/obsidian/src/utils/templates.ts index 2b0895fc9..6805c0e33 100644 --- a/apps/obsidian/src/utils/templates.ts +++ b/apps/obsidian/src/utils/templates.ts @@ -106,12 +106,10 @@ export const applyTemplate = async ({ const { isEnabled, folderPath } = getTemplatePluginInfo(app); if (!isEnabled) { - console.warn("Templates plugin is not enabled"); return false; } if (!folderPath) { - console.warn("Template folder is not configured"); return false; } @@ -119,7 +117,6 @@ export const applyTemplate = async ({ const templateFile = app.vault.getAbstractFileByPath(templateFilePath); if (!templateFile || !(templateFile instanceof TFile)) { - console.warn(`Template file not found: ${templateFilePath}`); return false; }