mirror of
https://github.com/mnaoumov/obsidian-advanced-debug-mode.git
synced 2026-07-22 05:44:00 +00:00
4.5 KiB
4.5 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
Advanced Debug Mode is an Obsidian plugin that enhances the debugging experience: it toggles Obsidian's built-in debug mode (keeping inline source maps), preserves long (and async) stack traces, manages debug-library namespaces from the UI, surfaces DevTools (via eruda) on mobile, and lets you temporarily disable Obsidian's long-running-task timeouts. It is built on obsidian-dev-utils.
Commands
| Task | Command |
|---|---|
| TypeScript check | npm run build:compile |
| Build | npm run build |
| Dev (watch) | npm run dev |
| Lint | npm run lint |
| Lint (fix) | npm run lint:fix |
| Format | npm run format |
| Format (check) | npm run format:check |
| Spellcheck | npm run spellcheck |
| Markdown lint | npm run lint:md |
| Markdown lint fix | npm run lint:md:fix |
| Unit tests | npm test |
| Coverage | npm run test:coverage |
| Integration tests | npm run test:integration |
| Commit (wizard) | npm run commit |
Architecture
- Root config files are thin re-exports — actual logic lives in
scripts/(eslint.config.mts→scripts/eslint-config.ts, etc.). src/— plugin source:main.ts— Obsidian entry point (imports the stylesheet, default-exportsPlugin)plugin.ts—Plugin extends PluginBase;onloadImplwires up all child components (settings, settings tab, DevTools, command handler, long-running tasks, error stack-trace limit, long stack traces)plugin-settings.ts—PluginSettingsdata class with the plugin's setting defaultsplugin-settings-component.ts—PluginSettingsComponentBasesubclass that loads/saves settingsplugin-settings-tab.ts— settings UI tab (displayLegacy) for debug mode, mobile emulation, debug namespaces, long/async stack traces, stack-trace limit, and task timeoutsdebug-mode.ts—DebugMode: read/toggle Obsidian's debug mode viaapp.debugModeemulate-mobile-mode.ts—EmulateMobileMode: read/toggle desktop mobile-emulation viaapp.emulateMobiledev-tools-component.ts—DevToolsComponent: initializeserudaDevTools (mobile) and toggles its entry buttonerror-stack-trace-limit-component.ts— saves and restoresError.stackTraceLimitacross load/unloadlong-running-tasks-component.ts— coordinates the twoFileSystemAdapterpatches and reloads them on settings changemulti-weak-map.ts—MultiWeakMap: multi-key map mixingMap/WeakMapstorage per key typetypes.ts— shared generic-function types (GenericFunctionWithOriginalFn, etc.)command-handlers/toggle-dev-tools-button-command.ts—GlobalCommandHandlerto toggle the DevTools buttonlong-stack-traces/long-stack-traces-component.ts— cross-platform entry; lazy-loads the desktop component and reloads on settings changelong-stack-traces/long-stack-traces-desktop-component.ts— desktop core: patchesError(and child error classes), timers, microtasks, andPromisemethods to inject long stack-trace frameslong-stack-traces/async-long-stack-traces-desktop-component.ts—async_hooks-based async stack-trace capture (desktop only)long-stack-traces/event-listener.ts—isEventListenerObjecttype guardlong-stack-traces/event-handlers-map.ts—MultiWeakMapmapping(target, type, handler)to wrapped handlerspatches/add-long-stack-traces-patch-component.ts—MonkeyAroundComponentthat wraps handler args so each invocation records a stack framepatches/event-target-remove-event-listener-patch-component.ts— patchesremoveEventListenerto remove the wrapped handlerpatches/file-system-adapter-queue-patch-component.ts— patchesFileSystemAdapter.queueto log timed-out task detailspatches/file-system-adapter-things-happening-patch-component.ts— patchesthingsHappeningto disable the long-running-task timeoutstyles/—main.scss(plugin styles) andscss.d.ts(SCSS module type declaration)test-helpers/setup.ts— unit-test setup
mainfield points tosrc/main.ts(Obsidian plugin source entry; built artifact isdist/build/main.js, not published to npm).
Known Issues
None.