Skip to content

Commit 8e624b2

Browse files
trangdoan982claude
andauthored
[ENG-1459] Obsidian plugin store prep Part 2 (#849)
* fix(obsidian): address plugin store submission requirements + UI text + commands - Update manifest.json description to start with verb and end with period (SR-4, SR-5) - Remove top-level "Discourse Graph Settings" heading (PG-UI7, PG-UI8) - Remove default hotkey Mod+\ from open-node-type-menu command (PG-C14) - Replace workspace.activeLeaf with getActiveViewOfType() (PG-W16) - Add PLUGIN_STORE_SUBMISSION.md and PR_SUMMARY.md tracking docs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Revise PLUGIN_STORE_SUBMISSION.md for clarity and updates Updated submission document to reflect changes addressing failed criteria and improved clarity on plugin guidelines. * remove PR_SUMMARY.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(obsidian): remove unnecessary console logging statements (PG-G2) Remove console.log, console.warn, and console.debug statements from production code across 8 files. Retained console.error for legitimate error handling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * remove comments * remove excessive comments * rm more logs * add remove orphan back * delete file * address PR comment * address PR comments --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c8e4be5 commit 8e624b2

8 files changed

Lines changed: 4 additions & 157 deletions

File tree

apps/obsidian/src/components/canvas/TldrawView.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export class TldrawView extends TextFileView {
8282
const store = this.createStore(fileData, assetStore);
8383

8484
if (!store) {
85-
console.warn("No tldraw data found in file");
8685
return;
8786
}
8887

@@ -100,13 +99,11 @@ export class TldrawView extends TextFileView {
10099
);
101100

102101
if (!match?.[1]) {
103-
console.warn("No tldraw data found in file");
104102
return;
105103
}
106104

107105
const data = JSON.parse(match[1]) as TLData;
108106
if (!data.raw) {
109-
console.warn("Invalid tldraw data format - missing raw field");
110107
return;
111108
}
112109
if (data.meta?.uuid) {
@@ -116,7 +113,6 @@ export class TldrawView extends TextFileView {
116113
}
117114

118115
if (!this.file) {
119-
console.warn("TldrawView not initialized: missing file");
120116
return;
121117
}
122118

@@ -152,7 +148,6 @@ export class TldrawView extends TextFileView {
152148
throw new Error("TldrawView not initialized: missing canvas UUID");
153149

154150
if (!this.assetStore) {
155-
console.warn("Asset store is not set");
156151
return;
157152
}
158153

@@ -254,4 +249,4 @@ export class TldrawView extends TextFileView {
254249
this.assetStore = null;
255250
}
256251
}
257-
}
252+
}

apps/obsidian/src/components/canvas/utils/relationJsonUtils.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ export const addRelationToRelationsJson = async ({
3030
const missing: string[] = [];
3131
if (!sourceId) missing.push(`source (${sourceFile.basename})`);
3232
if (!destId) missing.push(`target (${targetFile.basename})`);
33-
console.warn(
34-
"Could not resolve nodeInstanceIds for relation files:",
35-
missing.join(", "),
36-
);
3733
new Notice(
3834
"Could not create relation: one or both files are not discourse nodes or metadata is not ready.",
3935
3000,
@@ -74,9 +70,6 @@ export const addRelationIfRequested = async (
7470
getNodeTypeIdForFile(plugin, relationshipTargetFile),
7571
]);
7672
if (!typeA || !typeB) {
77-
console.warn(
78-
"addRelationIfRequested: could not resolve node types for one or both files",
79-
);
8073
return;
8174
}
8275

@@ -92,9 +85,6 @@ export const addRelationIfRequested = async (
9285
sourceFile = createdOrSelectedFile;
9386
targetFile = relationshipTargetFile;
9487
} else {
95-
console.warn(
96-
"addRelationIfRequested: file node types do not match relation definition",
97-
);
9888
return;
9989
}
10090

@@ -104,4 +94,4 @@ export const addRelationIfRequested = async (
10494
targetFile,
10595
relationTypeId: relation.relationshipTypeId,
10696
});
107-
};
97+
};

apps/obsidian/src/services/QueryEngine.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ export class QueryEngine {
5050
return [];
5151
}
5252
if (!this.dc) {
53-
console.warn(
54-
"Datacore API not available. Search functionality is not available.",
55-
);
5653
return [];
5754
}
5855

@@ -88,9 +85,6 @@ export class QueryEngine {
8885
*/
8986
getDiscourseNodeById = (nodeInstanceId: string): TFile | null => {
9087
if (!this.dc) {
91-
console.warn(
92-
"Datacore API not available. Search functionality is not available.",
93-
);
9488
return null;
9589
}
9690

@@ -125,9 +119,6 @@ export class QueryEngine {
125119
return [];
126120
}
127121
if (!this.dc) {
128-
console.warn(
129-
"Datacore API not available. Search functionality is not available.",
130-
);
131122
return [];
132123
}
133124

@@ -245,9 +236,6 @@ export class QueryEngine {
245236
const candidates: BulkImportCandidate[] = [];
246237

247238
if (!this.dc) {
248-
console.warn(
249-
"Datacore API not available. Falling back to vault iteration.",
250-
);
251239
return this.fallbackScanVault(patterns, validNodeTypes);
252240
}
253241

@@ -290,9 +278,6 @@ export class QueryEngine {
290278
);
291279

292280
if (!matchedNodeType) {
293-
console.warn(
294-
`No matching node type found for pattern with nodeTypeId: ${pattern.nodeTypeId}`,
295-
);
296281
continue;
297282
}
298283

@@ -348,7 +333,7 @@ export class QueryEngine {
348333
}
349334
}
350335
} catch (error) {
351-
console.warn("Error querying DataCore for imported file:", error);
336+
// DataCore query may fail; vault-iteration fallback below handles this
352337
}
353338
}
354339

@@ -403,9 +388,6 @@ export class QueryEngine {
403388
);
404389

405390
if (!matchedNodeType) {
406-
console.warn(
407-
`No matching node type found for pattern with nodeTypeId: ${pattern.nodeTypeId}`,
408-
);
409391
continue;
410392
}
411393

apps/obsidian/src/utils/fileChangeListener.ts

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ export class FileChangeListener {
7373
this.handleMetadataChange(file);
7474
};
7575
this.plugin.app.metadataCache.on("changed", this.metadataChangeCallback);
76-
77-
console.debug("FileChangeListener initialized");
7876
}
7977

8078
/**
@@ -134,7 +132,6 @@ export class FileChangeListener {
134132
return;
135133
}
136134

137-
console.log(`File modified: ${file.path}`);
138135
this.queueChange(file.path, "content");
139136
}
140137

@@ -146,7 +143,6 @@ export class FileChangeListener {
146143
return;
147144
}
148145

149-
console.log(`File deleted: ${file.path}`);
150146
this.hasPendingOrphanCleanup = true;
151147
this.resetDebounceTimer();
152148
}
@@ -159,7 +155,6 @@ export class FileChangeListener {
159155
return;
160156
}
161157

162-
console.log(`File renamed: ${oldPath} -> ${file.path}`);
163158
this.queueChange(file.path, "title", oldPath);
164159
}
165160

@@ -180,16 +175,6 @@ export class FileChangeListener {
180175

181176
// Note: pendingCreates helps track files that are created -> added nodeTypeId -> synced to Supabase.
182177
// If a file is created -> added nodeTypeId manually, it won't be detected until the next global sync (onLoad).
183-
184-
// Placeholder: Check for relation metadata changes
185-
// For now, we'll just log that metadata changed
186-
// In the future, this can detect specific relation changes
187-
const cache = this.plugin.app.metadataCache.getFileCache(file);
188-
if (cache?.frontmatter) {
189-
console.debug(
190-
`Metadata changed for ${file.path} (relation metadata placeholder)`,
191-
);
192-
}
193178
}
194179

195180
/**
@@ -235,7 +220,6 @@ export class FileChangeListener {
235220
*/
236221
private async processQueue(): Promise<void> {
237222
if (this.isProcessing) {
238-
console.debug("Sync already in progress, skipping");
239223
return;
240224
}
241225

@@ -283,31 +267,10 @@ export class FileChangeListener {
283267
}
284268
}
285269

286-
if (processedFiles.length > 0) {
287-
console.debug(
288-
`Successfully processed ${processedFiles.length} file(s):`,
289-
processedFiles,
290-
);
291-
}
292-
293-
if (failedFiles.length > 0) {
294-
console.warn(
295-
`Failed to process ${failedFiles.length} file(s), will retry on next change:`,
296-
failedFiles,
297-
);
298-
}
299-
300270
if (this.hasPendingOrphanCleanup) {
301-
const deletedCount = await cleanupOrphanedNodes(this.plugin);
302-
if (deletedCount > 0) {
303-
console.debug(`Deleted ${deletedCount} orphaned node(s)`);
304-
}
271+
await cleanupOrphanedNodes(this.plugin);
305272
this.hasPendingOrphanCleanup = false;
306273
}
307-
308-
if (processedFiles.length > 0 || failedFiles.length === 0) {
309-
console.debug("Sync queue processed");
310-
}
311274
} catch (error) {
312275
console.error("Error processing sync queue:", error);
313276
// Items that weren't processed remain in the queue for retry
@@ -341,7 +304,5 @@ export class FileChangeListener {
341304
this.changeQueue.clear();
342305
this.pendingCreates.clear();
343306
this.isProcessing = false;
344-
345-
console.debug("FileChangeListener cleaned up");
346307
}
347308
}

apps/obsidian/src/utils/importNodes.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -354,12 +354,6 @@ const fetchNodeContentForImport = async ({
354354
full.created == null ||
355355
full.last_modified == null
356356
) {
357-
if (!direct?.text) {
358-
console.warn(`No direct variant found for node ${nodeInstanceId}`);
359-
}
360-
if (!full?.text) {
361-
console.warn(`No full variant found for node ${nodeInstanceId}`);
362-
}
363357
return null;
364358
}
365359

@@ -458,12 +452,10 @@ const downloadFileFromStorage = async ({
458452
.download(filehash);
459453

460454
if (error) {
461-
console.warn(`Error downloading file ${filehash}:`, error);
462455
return null;
463456
}
464457

465458
if (!data) {
466-
console.warn(`No data returned for file ${filehash}`);
467459
return null;
468460
}
469461

@@ -858,7 +850,6 @@ const importAssetsForNode = async ({
858850

859851
if (!fileContent) {
860852
errors.push(`Failed to download file: ${filepath}`);
861-
console.warn(`Failed to download file ${filepath} (hash: ${filehash})`);
862853
continue;
863854
}
864855

@@ -898,7 +889,6 @@ const importAssetsForNode = async ({
898889

899890
// Track path mapping (raw + normalized key so updateMarkdownAssetLinks can lookup by link text)
900891
setPathMapping(filepath, targetPath);
901-
console.log(`Imported asset: ${filepath} -> ${targetPath}`);
902892
} catch (error) {
903893
const errorMsg = `Error importing asset ${fileRef.filepath}: ${error}`;
904894
errors.push(errorMsg);
@@ -1173,7 +1163,6 @@ export const importSelectedNodes = async ({
11731163
const importFolderPath = `import/${sanitizeFileName(spaceName)}`;
11741164
const spaceUri = spaceUris.get(spaceId);
11751165
if (!spaceUri) {
1176-
console.warn(`Missing URI for space ${spaceId}`);
11771166
for (const _node of nodes) {
11781167
failedCount++;
11791168
processedCount++;
@@ -1302,14 +1291,6 @@ export const importSelectedNodes = async ({
13021291
}
13031292
}
13041293

1305-
// Log asset import errors if any
1306-
if (assetImportResult.errors.length > 0) {
1307-
console.warn(
1308-
`Some assets failed to import for node ${node.nodeInstanceId}:`,
1309-
assetImportResult.errors,
1310-
);
1311-
}
1312-
13131294
// If title changed and file exists, rename it to match the new title
13141295
if (existingFile && processedFile.basename !== sanitizedFileName) {
13151296
const newPath = `${importFolderPath}/${sanitizedFileName}.md`;

apps/obsidian/src/utils/publishNode.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ const publishSchema = async ({
4242
}
4343

4444
if (!schemaResponse.data) {
45-
console.warn(
46-
`Schema with nodeTypeId ${nodeTypeId} not found in space ${spaceId}`,
47-
);
4845
return; // Schema doesn't exist, skip publishing
4946
}
5047

@@ -299,9 +296,6 @@ export const publishNodeToGroup = async ({
299296
link,
300297
file.path,
301298
);
302-
if (attachment === null) {
303-
console.warn("Could not find file for " + link);
304-
}
305299
return attachment;
306300
})
307301
.filter((a) => !!a);

0 commit comments

Comments
 (0)