From e3ba3fd23148da42b78372c2169ace08f8230179 Mon Sep 17 00:00:00 2001 From: macros0 Date: Fri, 30 Oct 2026 20:30:30 +0300 Subject: [PATCH 1/7] Integrate community features, remote MCP and editor recovery Combine community navigation, vault and media features with refreshed dependencies, formatting controls and Markdown rendering corrections. Add authenticated remote MCP, resilient cached indexing, module-based plugin loading, local draft recovery, conflict resolution and adaptive toolbar layouts. Retain data-safety fixes and browser, integration and dependency regression coverage. Wait for asynchronous viewport layout before asserting browser zoom geometry. Source contributions: phamtruonghung/webobsidian, lakylekidd/webobsidian and macros0/webobsidian. MIT license and contributor attribution retained. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: anthropic-code-agent[bot] <242468646+Claude@users.noreply.github.com> Co-authored-by: openai-code-agent[bot] <242516109+Codex@users.noreply.github.com> Co-authored-by: lakylekidd <9472854+lakylekidd@users.noreply.github.com> Co-authored-by: Cosmo Co-authored-by: Billy Vlachos Co-authored-by: Charles Bine Co-authored-by: Jeff Stephens Co-authored-by: JulienJBO Co-authored-by: Maximo Diaz Co-authored-by: ziuus Co-authored-by: Claude Opus 5 Co-authored-by: Phil Palmieri Co-authored-by: Robert Jones Co-authored-by: phamtruonghung Co-authored-by: Billy Vlachos --- .env.example | 20 + .gitattributes | 5 + .github/workflows/ci.yml | 86 +- .github/workflows/deploy.yml | 85 + .github/workflows/release.yml | 2 +- .github/workflows/upstream-sync.yml | 73 + .gitignore | 6 +- CHANGELOG.md | 534 ++ CLAUDE.md | 40 +- CONTRIBUTING.md | 27 +- Dockerfile | 23 +- IMPLEMENTATION_PLAN.md | 950 ++- PRD.md | 774 +- README.md | 323 +- SECURITY.md | 12 + deploy/deploy.sh | 272 + deploy/smoke.sh | 268 + desktop/README.md | 31 +- desktop/package.json | 10 +- docker-compose.yml | 18 +- docs/AGENT_API.md | 150 +- docs/DEPLOYMENT.md | 252 + docs/FORK_INTEGRATION.md | 58 + docs/INDEXING.md | 103 + docs/LOCKS.md | 84 + docs/MCP_REMOTE.md | 100 + docs/PLUGIN_COMPATIBILITY.md | 57 + docs/UPSTREAM_PR_MERGES.md | 147 + docs/agent-skill/webobsidian/SKILL.md | 52 +- docs/agents/domain.md | 56 + docs/agents/issue-tracker.md | 75 + docs/agents/triage-labels.md | 25 + docs/rendering-compatibility.md | 87 + .../plans/2026-10-29-color-toolbar.md | 41 + .../plans/2026-10-29-community-forks.md | 58 + ...026-10-29-full-editing-toolbar-progress.md | 19 + .../plans/2026-10-29-full-editing-toolbar.md | 218 + .../2026-10-29-rendering-parity-progress.md | 94 + .../plans/2026-10-29-rendering-parity.md | 191 + ...fts-conflicts-adaptive-toolbar-progress.md | 55 + ...rafts-conflicts-adaptive-toolbar-review.md | 67 + ...10-30-drafts-conflicts-adaptive-toolbar.md | 202 + .../plans/2026-10-30-indexing-watch.md | 133 + .../plans/2026-10-30-plugin-runtime-fixes.md | 105 + .../2026-10-30-plugin-runtime-validation.md | 96 + .../plans/2026-10-30-remote-mcp.md | 151 + .../plans/2026-10-30-review-fixes.md | 172 + .../2026-10-29-full-editing-toolbar-design.md | 198 + .../specs/2026-10-30-indexing-watch-design.md | 86 + .../specs/2026-10-30-plugin-runtime-review.md | 64 + .../specs/2026-10-30-remote-mcp-design.md | 74 + docs/supervisor-daily-management-brief.md | 107 + mcp-server/README.md | 92 + mcp-server/package.json | 48 + mcp-server/src/client.ts | 137 + mcp-server/src/errors.ts | 10 + mcp-server/src/index.ts | 11 + mcp-server/src/server.ts | 220 + mcp-server/src/types.ts | 23 + mcp-server/test/handshake.mjs | 168 + mcp-server/test/http.mjs | 100 + mcp-server/test/library.mjs | 33 + mcp-server/tsconfig.json | 26 + package-lock.json | 7059 +++++++++-------- package.json | 26 +- packages/webo/package.json | 18 + packages/webo/src/bin.ts | 467 ++ packages/webo/src/default-env.ts | 14 + packages/webo/tsconfig.json | 19 + scripts/capture-obsidian-reference.mjs | 64 + scripts/check-critical-dependencies.mjs | 50 + scripts/docker-mcp-smoke.sh | 45 + scripts/indexing-benchmark.mjs | 82 + scripts/integration-smoke.mjs | 172 + scripts/merge-upstream-pr.sh | 55 + scripts/smoke-test.sh | 256 + scripts/upstream-pr-status.sh | 124 + server/package.json | 15 +- server/src/bootstrap.ts | 11 +- server/src/config.ts | 8 + server/src/index.ts | 226 +- server/src/lib/redact.test.ts | 39 + server/src/middleware/ratelimit.test.ts | 36 + server/src/middleware/ratelimit.ts | 47 +- server/src/routes/agent.ts | 179 +- server/src/routes/auth.test.ts | 80 + server/src/routes/auth.ts | 16 +- server/src/routes/files.concurrency.test.ts | 86 + server/src/routes/files.ts | 279 +- server/src/routes/indexing.test.ts | 112 + server/src/routes/indexing.ts | 16 + server/src/routes/linkpreview.ts | 20 + server/src/routes/mcp.test.ts | 117 + server/src/routes/mcp.ts | 55 + server/src/routes/plugins.test.ts | 38 + server/src/routes/plugins.ts | 70 +- server/src/routes/search.ts | 29 +- server/src/routes/settings.test.ts | 38 + server/src/routes/settings.ts | 119 +- server/src/routes/sharepage.ts | 6 +- server/src/routes/shares.ts | 23 +- server/src/routes/tasks.test.ts | 382 + server/src/routes/tasks.ts | 40 + server/src/services/agentOperations.test.ts | 61 + server/src/services/agentOperations.ts | 127 + server/src/services/auth.test.ts | 96 + server/src/services/auth.ts | 54 +- server/src/services/autosync.test.ts | 80 + server/src/services/autosync.ts | 9 + server/src/services/cli-defaults.test.ts | 14 + .../services/dependencies.security.test.ts | 99 + server/src/services/draftScopes.test.ts | 18 + server/src/services/draftScopes.ts | 33 + server/src/services/embeds.ts | 180 + server/src/services/fileindex.ts | 34 +- server/src/services/frontmatterPolicy.ts | 30 + server/src/services/git.integration.test.ts | 247 + server/src/services/git.test.ts | 105 + server/src/services/git.ts | 17 +- server/src/services/htmlPolicy.ts | 2 + server/src/services/indexing/config.test.ts | 7 + server/src/services/indexing/config.ts | 10 + .../src/services/indexing/coordinator.test.ts | 115 + server/src/services/indexing/coordinator.ts | 199 + .../src/services/indexing/inventory.test.ts | 51 + server/src/services/indexing/inventory.ts | 88 + .../src/services/indexing/maintenance.test.ts | 10 + server/src/services/indexing/maintenance.ts | 4 + .../src/services/indexing/projection.test.ts | 37 + server/src/services/indexing/projection.ts | 33 + server/src/services/indexing/snapshot.test.ts | 41 + server/src/services/indexing/snapshot.ts | 55 + server/src/services/indexing/types.ts | 18 + server/src/services/indexing/watcher.test.ts | 15 + server/src/services/indexing/watcher.ts | 28 + server/src/services/linkpreview.ts | 232 + server/src/services/links.ts | Bin 5781 -> 8619 bytes server/src/services/locks.test.ts | 156 + server/src/services/locks.ts | 150 + server/src/services/markdown.test.ts | 14 + server/src/services/markdown.ts | 5 +- server/src/services/markdownCallouts.ts | 61 + server/src/services/markdownContext.ts | 163 + server/src/services/markdownDialect.ts | 156 + server/src/services/markdownRendering.ts | 290 + server/src/services/mcpAgentApi.ts | 30 + server/src/services/mcpConfig.test.ts | 23 + server/src/services/mcpConfig.ts | 30 + server/src/services/mime.test.ts | 45 + server/src/services/mime.ts | 19 + server/src/services/noteedit.test.ts | 51 + server/src/services/noteedit.ts | 53 + server/src/services/notegrep.test.ts | 80 + server/src/services/notegrep.ts | 91 + server/src/services/noteversion.test.ts | 31 + server/src/services/noteversion.ts | 38 + server/src/services/password-policy.ts | 35 + server/src/services/pluginData.ts | 24 + server/src/services/pluginModule.test.ts | 3 + server/src/services/pluginModule.ts | 15 + server/src/services/pluginStorage.ts | 107 + server/src/services/plugins.test.ts | 70 + server/src/services/plugins.ts | 368 +- server/src/services/publicMarkdown.ts | 15 + server/src/services/rendercanvas.ts | 8 +- server/src/services/renderhtml.ts | Bin 6909 -> 3161 bytes server/src/services/search.test.ts | 110 + server/src/services/search.ts | 116 +- .../src/services/settings.integration.test.ts | 113 + server/src/services/settings.ts | 86 +- server/src/services/tasks.test.ts | 243 + server/src/services/tasks.ts | 149 + server/src/services/trashindex.ts | 153 + server/src/services/trashretention.ts | 49 + server/src/services/vault.test.ts | 514 ++ server/src/services/vault.ts | 472 +- server/src/services/vaultmutations.test.ts | 59 + server/src/services/vaultmutations.ts | 47 + server/tsconfig.json | 3 +- server/vitest.config.ts | 8 + tests/fixtures/rendering/Contract.md | 11 + tests/fixtures/rendering/Cycle.md | 3 + tests/fixtures/rendering/Reference.md | 45 + tests/fixtures/rendering/Structures.md | 13 + tests/fixtures/rendering/Target.md | 20 + tests/fixtures/rendering/cases.json | 14 + .../obsidian-contract-live-styles.json | 15 + .../rendering/obsidian-contract-styles.json | 13 + .../fixtures/rendering/obsidian-contract.json | 8 + .../fixtures/rendering/obsidian-contract.png | Bin 0 -> 41494 bytes .../obsidian-reference-live-styles.json | 17 + .../rendering/obsidian-reference-styles.json | 57 + .../rendering/obsidian-reference-text.json | 8 + .../rendering/obsidian-reference.json | 11 + .../fixtures/rendering/obsidian-reference.png | Bin 0 -> 42638 bytes .../obsidian-structures-live-styles.json | 17 + .../rendering/obsidian-structures-styles.json | 68 + .../rendering/obsidian-structures.json | 11 + .../rendering/obsidian-structures.png | Bin 0 -> 40152 bytes web/index.html | 2 +- web/package.json | 11 +- web/src/App.tsx | 80 +- web/src/components/BookmarksPanel.tsx | 12 +- web/src/components/CanvasView.tsx | 2 +- web/src/components/ColorControls.tsx | 163 + web/src/components/CommandPalette.tsx | 24 +- web/src/components/ConfirmDialog.tsx | 65 + web/src/components/ConflictResolver.tsx | 86 + web/src/components/ContextMenu.tsx | 4 +- web/src/components/DocOutline.tsx | 182 + web/src/components/DraftRecovery.tsx | 40 + web/src/components/DueDateEditor.tsx | 82 + web/src/components/Editor.tsx | 277 +- web/src/components/FileTree.tsx | 260 +- web/src/components/FolderPicker.tsx | 22 +- web/src/components/FolderView.tsx | 4 +- web/src/components/FormatToolbar.tsx | 87 +- web/src/components/GanttChart.tsx | 349 + web/src/components/GraphView.tsx | 290 +- web/src/components/Icon.tsx | 26 +- web/src/components/Preview.tsx | 40 +- web/src/components/Ribbon.tsx | 8 + web/src/components/SearchPanel.tsx | 55 +- web/src/components/Settings.tsx | 174 +- web/src/components/Sidebar.tsx | 4 +- web/src/components/StatusBar.tsx | 1 - web/src/components/TasksView.tsx | 473 ++ web/src/components/TemplatePicker.tsx | 189 + web/src/components/Workspace.tsx | 136 +- .../components/toolbar/ToolbarSettings.tsx | 102 + web/src/components/toolbar/ToolbarSurface.tsx | 106 + .../components/toolbar/useToolbarOverflow.ts | 40 + web/src/lib/activeEditor.ts | 40 +- web/src/lib/api.ts | 192 +- web/src/lib/attachments.ts | 49 + web/src/lib/callouts.ts | 62 +- web/src/lib/colorFormatting.ts | 18 + web/src/lib/confirm.ts | 39 + web/src/lib/conflicts.ts | 51 + web/src/lib/cssColor.ts | 80 + web/src/lib/drafts/session.ts | 102 + web/src/lib/drafts/storage.ts | 54 + web/src/lib/drafts/types.ts | 15 + web/src/lib/embeds.ts | 196 + web/src/lib/gantt.ts | 359 + web/src/lib/highlight.ts | 36 +- web/src/lib/imageDelete.ts | 61 + web/src/lib/indexStatus.ts | 43 + web/src/lib/linkPreview.ts | 65 + web/src/lib/livePreview.ts | 1026 ++- web/src/lib/markdown.ts | Bin 13588 -> 3978 bytes web/src/lib/media.ts | 55 + web/src/lib/plugins.ts | 275 +- web/src/lib/plugins/diagnostics.ts | 26 + web/src/lib/plugins/manager.ts | 119 + web/src/lib/plugins/obsidianApi.ts | 220 + web/src/lib/plugins/registry.ts | 39 + web/src/lib/propOptions.ts | 75 + web/src/lib/selectionToolbar.tsx | 53 + web/src/lib/snippet.ts | 59 + web/src/lib/store.ts | 640 +- web/src/lib/suggest.ts | 7 +- web/src/lib/tasks.ts | 330 + web/src/lib/templates.ts | 151 + web/src/lib/theme.ts | 43 + web/src/lib/title.ts | 40 + web/src/lib/toolbar/commands/textTools.ts | 303 + web/src/lib/toolbar/config.ts | 114 + web/src/lib/toolbar/formatBrush.ts | 34 + web/src/lib/toolbar/formatCleanup.ts | 282 + web/src/lib/toolbar/importConfig.ts | 61 + web/src/lib/toolbar/overflow.ts | 16 + web/src/lib/toolbar/registry.ts | 101 + web/src/lib/toolbar/textTools.worker.ts | 2 + web/src/lib/urlsync.ts | 32 +- web/src/lib/useVisualViewport.ts | 8 + web/src/styles/obsidian.css | 829 +- web/tests/colorFormatting.test.ts | 147 + web/tests/conflicts.test.ts | 11 + web/tests/cssColor.test.ts | 71 + web/tests/draftRecoveryBrowser.test.ts | 68 + web/tests/draftSession.test.ts | 60 + web/tests/draftStorageBrowser.test.ts | 36 + web/tests/editorSelectionBrowser.test.ts | 107 + web/tests/editorSpacing.test.ts | 133 + web/tests/editorTheme.test.ts | 50 + .../fixtures/editingToolbarCommands.json | 386 + web/tests/gantt.test.ts | 360 + web/tests/imageDelete.test.ts | 73 + web/tests/indexStatus.test.ts | 27 + web/tests/livePreviewHtml.test.ts | 450 ++ web/tests/markdown.test.ts | 48 + web/tests/media.test.ts | 41 + web/tests/pluginApiBrowser.test.ts | 29 + web/tests/pluginLifecycle.test.ts | 45 + web/tests/pluginRuntimeBrowser.test.ts | 40 + web/tests/propOptions.test.ts | 104 + web/tests/rendering-security.test.ts | 44 + web/tests/renderingParity.test.ts | 269 + web/tests/searchRefreshBrowser.test.ts | 52 + web/tests/selectionToolbar.test.ts | 22 + web/tests/snippet.test.ts | 40 + web/tests/store.test.ts | 462 ++ web/tests/tabLifecycle.test.ts | 305 + web/tests/tasks.test.ts | 453 ++ web/tests/templates.test.ts | 180 + web/tests/themeHost.test.ts | 69 + web/tests/toolbarBrowser.test.ts | 158 + web/tests/toolbarBrush.test.ts | 122 + web/tests/toolbarConfig.test.ts | 150 + web/tests/toolbarInventory.test.ts | 9 + web/tests/toolbarOverflow.test.ts | 19 + web/tests/toolbarOverflowBrowser.test.ts | 46 + web/tests/toolbarRegistry.test.ts | 24 + web/tests/toolbarRendering.test.ts | 8 + web/tests/toolbarTextTools.test.ts | 123 + web/tests/toolbarViewportBrowser.test.ts | 88 + web/tests/urlsync.test.ts | 84 + 318 files changed, 34732 insertions(+), 5154 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/upstream-sync.yml create mode 100755 deploy/deploy.sh create mode 100755 deploy/smoke.sh create mode 100644 docs/DEPLOYMENT.md create mode 100644 docs/FORK_INTEGRATION.md create mode 100644 docs/INDEXING.md create mode 100644 docs/LOCKS.md create mode 100644 docs/MCP_REMOTE.md create mode 100644 docs/PLUGIN_COMPATIBILITY.md create mode 100644 docs/UPSTREAM_PR_MERGES.md create mode 100644 docs/agents/domain.md create mode 100644 docs/agents/issue-tracker.md create mode 100644 docs/agents/triage-labels.md create mode 100644 docs/rendering-compatibility.md create mode 100644 docs/superpowers/plans/2026-10-29-color-toolbar.md create mode 100644 docs/superpowers/plans/2026-10-29-community-forks.md create mode 100644 docs/superpowers/plans/2026-10-29-full-editing-toolbar-progress.md create mode 100644 docs/superpowers/plans/2026-10-29-full-editing-toolbar.md create mode 100644 docs/superpowers/plans/2026-10-29-rendering-parity-progress.md create mode 100644 docs/superpowers/plans/2026-10-29-rendering-parity.md create mode 100644 docs/superpowers/plans/2026-10-30-drafts-conflicts-adaptive-toolbar-progress.md create mode 100644 docs/superpowers/plans/2026-10-30-drafts-conflicts-adaptive-toolbar-review.md create mode 100644 docs/superpowers/plans/2026-10-30-drafts-conflicts-adaptive-toolbar.md create mode 100644 docs/superpowers/plans/2026-10-30-indexing-watch.md create mode 100644 docs/superpowers/plans/2026-10-30-plugin-runtime-fixes.md create mode 100644 docs/superpowers/plans/2026-10-30-plugin-runtime-validation.md create mode 100644 docs/superpowers/plans/2026-10-30-remote-mcp.md create mode 100644 docs/superpowers/plans/2026-10-30-review-fixes.md create mode 100644 docs/superpowers/specs/2026-10-29-full-editing-toolbar-design.md create mode 100644 docs/superpowers/specs/2026-10-30-indexing-watch-design.md create mode 100644 docs/superpowers/specs/2026-10-30-plugin-runtime-review.md create mode 100644 docs/superpowers/specs/2026-10-30-remote-mcp-design.md create mode 100644 docs/supervisor-daily-management-brief.md create mode 100644 mcp-server/README.md create mode 100644 mcp-server/package.json create mode 100644 mcp-server/src/client.ts create mode 100644 mcp-server/src/errors.ts create mode 100644 mcp-server/src/index.ts create mode 100644 mcp-server/src/server.ts create mode 100644 mcp-server/src/types.ts create mode 100644 mcp-server/test/handshake.mjs create mode 100644 mcp-server/test/http.mjs create mode 100644 mcp-server/test/library.mjs create mode 100644 mcp-server/tsconfig.json create mode 100644 packages/webo/package.json create mode 100644 packages/webo/src/bin.ts create mode 100644 packages/webo/src/default-env.ts create mode 100644 packages/webo/tsconfig.json create mode 100644 scripts/capture-obsidian-reference.mjs create mode 100644 scripts/check-critical-dependencies.mjs create mode 100644 scripts/docker-mcp-smoke.sh create mode 100644 scripts/indexing-benchmark.mjs create mode 100644 scripts/integration-smoke.mjs create mode 100755 scripts/merge-upstream-pr.sh create mode 100755 scripts/smoke-test.sh create mode 100755 scripts/upstream-pr-status.sh create mode 100644 server/src/lib/redact.test.ts create mode 100644 server/src/middleware/ratelimit.test.ts create mode 100644 server/src/routes/auth.test.ts create mode 100644 server/src/routes/files.concurrency.test.ts create mode 100644 server/src/routes/indexing.test.ts create mode 100644 server/src/routes/indexing.ts create mode 100644 server/src/routes/linkpreview.ts create mode 100644 server/src/routes/mcp.test.ts create mode 100644 server/src/routes/mcp.ts create mode 100644 server/src/routes/plugins.test.ts create mode 100644 server/src/routes/settings.test.ts create mode 100644 server/src/routes/tasks.test.ts create mode 100644 server/src/routes/tasks.ts create mode 100644 server/src/services/agentOperations.test.ts create mode 100644 server/src/services/agentOperations.ts create mode 100644 server/src/services/auth.test.ts create mode 100644 server/src/services/autosync.test.ts create mode 100644 server/src/services/cli-defaults.test.ts create mode 100644 server/src/services/dependencies.security.test.ts create mode 100644 server/src/services/draftScopes.test.ts create mode 100644 server/src/services/draftScopes.ts create mode 100644 server/src/services/embeds.ts create mode 100644 server/src/services/frontmatterPolicy.ts create mode 100644 server/src/services/git.integration.test.ts create mode 100644 server/src/services/git.test.ts create mode 100644 server/src/services/htmlPolicy.ts create mode 100644 server/src/services/indexing/config.test.ts create mode 100644 server/src/services/indexing/config.ts create mode 100644 server/src/services/indexing/coordinator.test.ts create mode 100644 server/src/services/indexing/coordinator.ts create mode 100644 server/src/services/indexing/inventory.test.ts create mode 100644 server/src/services/indexing/inventory.ts create mode 100644 server/src/services/indexing/maintenance.test.ts create mode 100644 server/src/services/indexing/maintenance.ts create mode 100644 server/src/services/indexing/projection.test.ts create mode 100644 server/src/services/indexing/projection.ts create mode 100644 server/src/services/indexing/snapshot.test.ts create mode 100644 server/src/services/indexing/snapshot.ts create mode 100644 server/src/services/indexing/types.ts create mode 100644 server/src/services/indexing/watcher.test.ts create mode 100644 server/src/services/indexing/watcher.ts create mode 100644 server/src/services/linkpreview.ts create mode 100644 server/src/services/locks.test.ts create mode 100644 server/src/services/locks.ts create mode 100644 server/src/services/markdown.test.ts create mode 100644 server/src/services/markdownCallouts.ts create mode 100644 server/src/services/markdownContext.ts create mode 100644 server/src/services/markdownDialect.ts create mode 100644 server/src/services/markdownRendering.ts create mode 100644 server/src/services/mcpAgentApi.ts create mode 100644 server/src/services/mcpConfig.test.ts create mode 100644 server/src/services/mcpConfig.ts create mode 100644 server/src/services/mime.test.ts create mode 100644 server/src/services/noteedit.test.ts create mode 100644 server/src/services/noteedit.ts create mode 100644 server/src/services/notegrep.test.ts create mode 100644 server/src/services/notegrep.ts create mode 100644 server/src/services/noteversion.test.ts create mode 100644 server/src/services/noteversion.ts create mode 100644 server/src/services/password-policy.ts create mode 100644 server/src/services/pluginData.ts create mode 100644 server/src/services/pluginModule.test.ts create mode 100644 server/src/services/pluginModule.ts create mode 100644 server/src/services/pluginStorage.ts create mode 100644 server/src/services/plugins.test.ts create mode 100644 server/src/services/publicMarkdown.ts create mode 100644 server/src/services/search.test.ts create mode 100644 server/src/services/settings.integration.test.ts create mode 100644 server/src/services/tasks.test.ts create mode 100644 server/src/services/tasks.ts create mode 100644 server/src/services/trashindex.ts create mode 100644 server/src/services/trashretention.ts create mode 100644 server/src/services/vault.test.ts create mode 100644 server/src/services/vaultmutations.test.ts create mode 100644 server/src/services/vaultmutations.ts create mode 100644 server/vitest.config.ts create mode 100644 tests/fixtures/rendering/Contract.md create mode 100644 tests/fixtures/rendering/Cycle.md create mode 100644 tests/fixtures/rendering/Reference.md create mode 100644 tests/fixtures/rendering/Structures.md create mode 100644 tests/fixtures/rendering/Target.md create mode 100644 tests/fixtures/rendering/cases.json create mode 100644 tests/fixtures/rendering/obsidian-contract-live-styles.json create mode 100644 tests/fixtures/rendering/obsidian-contract-styles.json create mode 100644 tests/fixtures/rendering/obsidian-contract.json create mode 100644 tests/fixtures/rendering/obsidian-contract.png create mode 100644 tests/fixtures/rendering/obsidian-reference-live-styles.json create mode 100644 tests/fixtures/rendering/obsidian-reference-styles.json create mode 100644 tests/fixtures/rendering/obsidian-reference-text.json create mode 100644 tests/fixtures/rendering/obsidian-reference.json create mode 100644 tests/fixtures/rendering/obsidian-reference.png create mode 100644 tests/fixtures/rendering/obsidian-structures-live-styles.json create mode 100644 tests/fixtures/rendering/obsidian-structures-styles.json create mode 100644 tests/fixtures/rendering/obsidian-structures.json create mode 100644 tests/fixtures/rendering/obsidian-structures.png create mode 100644 web/src/components/ColorControls.tsx create mode 100644 web/src/components/ConfirmDialog.tsx create mode 100644 web/src/components/ConflictResolver.tsx create mode 100644 web/src/components/DocOutline.tsx create mode 100644 web/src/components/DraftRecovery.tsx create mode 100644 web/src/components/DueDateEditor.tsx create mode 100644 web/src/components/GanttChart.tsx create mode 100644 web/src/components/TasksView.tsx create mode 100644 web/src/components/TemplatePicker.tsx create mode 100644 web/src/components/toolbar/ToolbarSettings.tsx create mode 100644 web/src/components/toolbar/ToolbarSurface.tsx create mode 100644 web/src/components/toolbar/useToolbarOverflow.ts create mode 100644 web/src/lib/attachments.ts create mode 100644 web/src/lib/colorFormatting.ts create mode 100644 web/src/lib/confirm.ts create mode 100644 web/src/lib/conflicts.ts create mode 100644 web/src/lib/cssColor.ts create mode 100644 web/src/lib/drafts/session.ts create mode 100644 web/src/lib/drafts/storage.ts create mode 100644 web/src/lib/drafts/types.ts create mode 100644 web/src/lib/embeds.ts create mode 100644 web/src/lib/gantt.ts create mode 100644 web/src/lib/imageDelete.ts create mode 100644 web/src/lib/indexStatus.ts create mode 100644 web/src/lib/linkPreview.ts create mode 100644 web/src/lib/plugins/diagnostics.ts create mode 100644 web/src/lib/plugins/manager.ts create mode 100644 web/src/lib/plugins/obsidianApi.ts create mode 100644 web/src/lib/plugins/registry.ts create mode 100644 web/src/lib/propOptions.ts create mode 100644 web/src/lib/selectionToolbar.tsx create mode 100644 web/src/lib/snippet.ts create mode 100644 web/src/lib/tasks.ts create mode 100644 web/src/lib/templates.ts create mode 100644 web/src/lib/theme.ts create mode 100644 web/src/lib/title.ts create mode 100644 web/src/lib/toolbar/commands/textTools.ts create mode 100644 web/src/lib/toolbar/config.ts create mode 100644 web/src/lib/toolbar/formatBrush.ts create mode 100644 web/src/lib/toolbar/formatCleanup.ts create mode 100644 web/src/lib/toolbar/importConfig.ts create mode 100644 web/src/lib/toolbar/overflow.ts create mode 100644 web/src/lib/toolbar/registry.ts create mode 100644 web/src/lib/toolbar/textTools.worker.ts create mode 100644 web/src/lib/useVisualViewport.ts create mode 100644 web/tests/colorFormatting.test.ts create mode 100644 web/tests/conflicts.test.ts create mode 100644 web/tests/cssColor.test.ts create mode 100644 web/tests/draftRecoveryBrowser.test.ts create mode 100644 web/tests/draftSession.test.ts create mode 100644 web/tests/draftStorageBrowser.test.ts create mode 100644 web/tests/editorSelectionBrowser.test.ts create mode 100644 web/tests/editorSpacing.test.ts create mode 100644 web/tests/editorTheme.test.ts create mode 100644 web/tests/fixtures/editingToolbarCommands.json create mode 100644 web/tests/gantt.test.ts create mode 100644 web/tests/imageDelete.test.ts create mode 100644 web/tests/indexStatus.test.ts create mode 100644 web/tests/livePreviewHtml.test.ts create mode 100644 web/tests/markdown.test.ts create mode 100644 web/tests/media.test.ts create mode 100644 web/tests/pluginApiBrowser.test.ts create mode 100644 web/tests/pluginLifecycle.test.ts create mode 100644 web/tests/pluginRuntimeBrowser.test.ts create mode 100644 web/tests/propOptions.test.ts create mode 100644 web/tests/rendering-security.test.ts create mode 100644 web/tests/renderingParity.test.ts create mode 100644 web/tests/searchRefreshBrowser.test.ts create mode 100644 web/tests/selectionToolbar.test.ts create mode 100644 web/tests/snippet.test.ts create mode 100644 web/tests/store.test.ts create mode 100644 web/tests/tabLifecycle.test.ts create mode 100644 web/tests/tasks.test.ts create mode 100644 web/tests/templates.test.ts create mode 100644 web/tests/themeHost.test.ts create mode 100644 web/tests/toolbarBrowser.test.ts create mode 100644 web/tests/toolbarBrush.test.ts create mode 100644 web/tests/toolbarConfig.test.ts create mode 100644 web/tests/toolbarInventory.test.ts create mode 100644 web/tests/toolbarOverflow.test.ts create mode 100644 web/tests/toolbarOverflowBrowser.test.ts create mode 100644 web/tests/toolbarRegistry.test.ts create mode 100644 web/tests/toolbarRendering.test.ts create mode 100644 web/tests/toolbarTextTools.test.ts create mode 100644 web/tests/toolbarViewportBrowser.test.ts create mode 100644 web/tests/urlsync.test.ts diff --git a/.env.example b/.env.example index dc8a500c..48269975 100644 --- a/.env.example +++ b/.env.example @@ -23,6 +23,14 @@ HTTP_PORT=8787 # only for an instance exposed directly to clients with no reverse proxy. TRUST_PROXY=true +# Real-client-IP header set by the proxy in front of WebObsidian, used only to key +# the login rate limit. Without it, everyone arriving through a tunnel shares the +# proxy's address, so one stranger's wrong guesses lock the owner out as well. +# Cloudflare tunnel: CF-Connecting-IP. Only honoured when the connecting peer is +# trusted per TRUST_PROXY — if the port is also reachable on your LAN, narrow +# TRUST_PROXY to the proxy's address so LAN clients can't pick their own bucket. +CLIENT_IP_HEADER= + # Initial master password. Leave empty to set it on first-run via the UI. WEBOBSIDIAN_PASSWORD= @@ -32,7 +40,14 @@ WEBOBSIDIAN_PASSWORD= # polling force polling (no inotify; works anywhere, higher CPU). # For large vaults, prefer raising the host limit over polling: # sudo sysctl -w fs.inotify.max_user_watches=524288 +# For NFS/SMB vaults, use polling: writes from another client may not emit native events. +# Polling checks every second; NAS metadata caching can add several seconds of delay. WEBOBSIDIAN_WATCH=auto +# Recover missed events by checking the file inventory in the background. +# Positive integer milliseconds; intervals are not maximum NAS visibility delays. +WEBOBSIDIAN_RECONCILE_INTERVAL_MS=60000 +# Check full Markdown bytes, including changes with unchanged file metadata. +WEBOBSIDIAN_HASH_AUDIT_INTERVAL_MS=1800000 # --- Bare-metal only (npm run start, without docker) -------- # The container sets these itself; uncomment only when running outside docker. @@ -42,3 +57,8 @@ WEBOBSIDIAN_WATCH=auto # DATA_DIR=./data # ALLOWED_ROOTS= # NODE_ENV=production + +# Optional remote MCP (stdio remains available independently). TLS terminates at your proxy. +WEBOBSIDIAN_MCP_ENABLED=false +WEBOBSIDIAN_MCP_PUBLIC_URL= +WEBOBSIDIAN_MCP_ALLOWED_ORIGINS= diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..53f22d71 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# markdown.ts, services/renderhtml.ts and services/links.ts embed raw NUL bytes +# as parser sentinels, so git detects them as binary and prints +# "Bin 1234 -> 5678 bytes" instead of a patch. (grep also skips them without -a.) +*.ts diff +*.tsx diff diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ee370d0..5047678d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,22 +5,67 @@ on: branches: [main] pull_request: branches: [main] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: + security: + name: Dependency vulnerability audit + runs-on: ubuntu-24.04 + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install dependencies without lifecycle scripts + run: npm ci --ignore-scripts --no-audit --include=dev + + - name: Reject remediated vulnerable dependency versions + run: npm run check:secure-deps + + - name: Audit all dependency advisory severities + id: audit + run: npm audit --include=dev --audit-level=low --json --fetch-timeout=30000 --fetch-retries=1 > npm-audit.json + + - name: Upload dependency audit report + if: ${{ !cancelled() && (steps.audit.outcome == 'success' || steps.audit.outcome == 'failure') }} + uses: actions/upload-artifact@v4 + with: + name: npm-audit + path: npm-audit.json + if-no-files-found: error + retention-days: 14 + build: name: Typecheck & build - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 + timeout-minutes: 30 steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Set up Node uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm - name: Install dependencies - run: npm ci || npm install + run: npm ci --no-audit - name: Typecheck run: npm run typecheck @@ -31,14 +76,47 @@ jobs: - name: Build run: npm run build + - name: Prepare Electron browser tests + run: | + # Electron 43 downloads its runtime lazily, rather than during npm ci. + node node_modules/electron/install.js + sudo apt-get update + sudo apt-get install --yes --no-install-recommends xvfb xauth libgtk-3-0 libnss3 libasound2t64 + # Chromium needs its setuid helper when user namespaces are restricted. + sudo chown root:root node_modules/electron/dist/chrome-sandbox + sudo chmod 4755 node_modules/electron/dist/chrome-sandbox + + - name: Test (server, web and Electron browser fixtures) + run: xvfb-run --auto-servernum npm test + + - name: HTTP and stdio MCP integration (disposable vault) + run: npm run test:mcp + + - name: Merged fork integration smoke test + run: node scripts/integration-smoke.mjs + + - name: Smoke test (auth hardening, symlinked vault, graceful shutdown) + run: scripts/smoke-test.sh + - name: Build desktop bundle run: npm --workspace desktop run build + - name: Package desktop directory without publishing + run: npm exec --workspace desktop -- electron-builder --dir --linux --x64 --publish never + env: + CSC_IDENTITY_AUTO_DISCOVERY: false + docker: name: Docker image builds - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 + timeout-minutes: 20 steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - name: Build image run: docker build -t webobsidian:ci . + + - name: Docker MCP runtime smoke + run: bash scripts/docker-mcp-smoke.sh webobsidian:ci diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..cee67ac8 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,85 @@ +name: Deploy (LXC 107) + +# Deploys to the homelab LXC 107, which is behind NAT: no inbound access exists, so the job runs on a +# self-hosted runner *inside that LXC* (labels: self-hosted, webobsidian-107). The runner is +# registered to this repository only, and this workflow is the only one that targets it. +# +# Trigger: after the CI workflow succeeds for a push to `main` (i.e. a merged PR), plus manual +# dispatch. `workflow_run.event == 'push'` is checked explicitly: workflow_run also fires for +# `pull_request` runs, and a fork PR must never reach this runner. +on: + workflow_run: + workflows: ["CI"] + types: [completed] + branches: [main] + workflow_dispatch: + inputs: + sync: + description: "Sync the deploy checkout to origin/main before building" + type: boolean + default: true + +concurrency: + group: deploy-lxc107 + cancel-in-progress: false + +permissions: + contents: read + +jobs: + deploy: + name: Deploy to LXC 107 + if: >- + github.repository == 'phamtruonghung/webobsidian' && + (github.event_name == 'workflow_dispatch' || + (github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success')) + runs-on: [self-hosted, webobsidian-107] + timeout-minutes: 45 + env: + DEPLOY_DIR: /root/webobsidian + ENV_FILE: /root/webobsidian/.env + BACKUP_DIR: /root/backups + PROJECT: webobsidian + SYNC: "0" + steps: + - name: Show what is being deployed + run: | + set -euo pipefail + echo "event: ${{ github.event_name }}" + echo "sha: ${{ github.event.workflow_run.head_sha || github.sha }}" + echo "run: ${{ github.event.workflow_run.run_number || github.run_number }}" + docker compose version + docker system df + + - name: Sync deploy checkout to the merged commit + if: github.event_name == 'workflow_run' + run: | + set -euo pipefail + SHA='${{ github.event.workflow_run.head_sha }}' + git -C "$DEPLOY_DIR" fetch --prune origin + git -C "$DEPLOY_DIR" checkout --force "$SHA" + test "$(git -C "$DEPLOY_DIR" rev-parse HEAD)" = "$SHA" + echo "deploy checkout is at $(git -C "$DEPLOY_DIR" rev-parse --short HEAD)" + + - name: Deploy (backup → build → up → smoke, rollback on failure) + run: | + set -euo pipefail + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + SYNC="${{ inputs.sync && '1' || '0' }}" "$DEPLOY_DIR/deploy/deploy.sh" + else + SYNC=0 "$DEPLOY_DIR/deploy/deploy.sh" + fi + + - name: Report deployed state + if: always() + run: | + set +e + echo "--- container ---" + docker compose -f "$DEPLOY_DIR/docker-compose.yml" --env-file "$ENV_FILE" -p "$PROJECT" ps + echo "--- git ---" + git -C "$DEPLOY_DIR" log -1 --pretty='%h %s (%ci)' + echo "--- images ---" + docker images --format '{{.Repository}}:{{.Tag}} {{.CreatedSince}} {{.Size}}' | head -10 + echo "--- last log lines ---" + docker compose -f "$DEPLOY_DIR/docker-compose.yml" --env-file "$ENV_FILE" -p "$PROJECT" logs --tail 20 webobsidian + exit 0 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f934f7e..4336a020 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: - name: Set up Node uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm - name: Install dependencies diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml new file mode 100644 index 00000000..92591dbc --- /dev/null +++ b/.github/workflows/upstream-sync.yml @@ -0,0 +1,73 @@ +name: Upstream PR sync check + +# Keeps the "sync later upstream PRs" follow-up from issue #2 turning into a manual chore: +# once a week (and on demand) this checks every open PR on xnohat/webobsidian against this +# fork's main and, only when something is genuinely new, opens or updates a single issue +# labelled `upstream-sync`. No new PRs → no noise. +on: + schedule: + - cron: '0 6 * * 1' # Mondays 06:00 UTC + workflow_dispatch: + +permissions: + contents: read + issues: write + +jobs: + check: + name: Any new upstream PRs? + # Preserve the source automation without scheduling issue creation in this fork. + if: github.repository == 'phamtruonghung/webobsidian' + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + UPSTREAM_REPO: xnohat/webobsidian + # Pin gh to THIS repo. The status script adds a git remote named `upstream` + # (xnohat/webobsidian), and gh's repo inference prefers the parent-looking remote — + # without this, `gh issue create` tries to file the report on the upstream repo and + # fails with "could not add label" (it did, before this pin). + GH_REPO: ${{ github.repository }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # the script compares upstream PR head commits against main + + - name: Scan upstream PRs against main + id: scan + run: | + set +e + out="$(scripts/upstream-pr-status.sh --new-only 2>/dev/null)" + code=$? + set -e + printf '%s\n' "$out" > /tmp/new-prs.txt + echo "exit_code=$code" >> "$GITHUB_OUTPUT" + echo "new PRs: $(grep -c . /tmp/new-prs.txt || true)" + cat /tmp/new-prs.txt + + - name: Report new PRs as an issue (only when there are any) + if: steps.scan.outputs.exit_code == '1' + run: | + set -euo pipefail + { + echo "Open pull requests on \`xnohat/webobsidian\` that are **not** in this fork's \`main\` yet." + echo + echo '| PR | Author | Title |' + echo '|----|--------|-------|' + while IFS=$'\t' read -r n author title url; do + [ -n "${n:-}" ] || continue + printf '| [#%s](%s) | %s | %s |\n' "$n" "$url" "$author" "$title" + done < /tmp/new-prs.txt + echo + echo 'Sync one with `scripts/merge-upstream-pr.sh `, then verify with `npm ci && npm test && npm run build` (see [docs/UPSTREAM_PR_MERGES.md](../blob/main/docs/UPSTREAM_PR_MERGES.md)).' + } > /tmp/body.md + + existing="$(gh issue list --repo "$GITHUB_REPOSITORY" --label upstream-sync --state open \ + --json number --jq '.[0].number // empty')" + if [[ -n "$existing" ]]; then + gh issue comment "$existing" --repo "$GITHUB_REPOSITORY" --body-file /tmp/body.md + echo "commented on #$existing" + else + gh issue create --repo "$GITHUB_REPOSITORY" \ + --title "Upstream PR sync available" --label upstream-sync --body-file /tmp/body.md + fi diff --git a/.gitignore b/.gitignore index deacacc5..ab8cf0d8 100644 --- a/.gitignore +++ b/.gitignore @@ -11,9 +11,13 @@ server/dist/ server/public/ coverage/ *.tsbuildinfo +# Local execution ledgers and review scratch files +.superpowers/ # Desktop (Electron) build artifacts desktop/.gen/ desktop/release/ +# CLI package build output (built via `npm run build`) +packages/*/dist/ # Local agent runbooks/skills — may contain server creds; never commit. .claude/skills/ -report.md \ No newline at end of file +report.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 106c0985..f7602adc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,546 @@ # Changelog +## Plugin runtime and diagnostics — 2026-10-30 + +- Load authenticated same-origin CommonJS factories as ESM under the existing CSP, + replacing browser string evaluation. Validate syntax without server execution. +- Show per-plugin lifecycle/failure state and one summary instead of overlapping + generic incompatibility notices; dispose resources on disable and vault/logout. +- Protect plugin note writes with content versions and store web plugin data/code + separately from desktop `.obsidian` files. +- Document the verified API subset and exact real-plugin limitations in + [PLUGIN_COMPATIBILITY](docs/PLUGIN_COMPATIBILITY.md). + +## Cached startup and resilient indexing — 2026-10-30 + +- Restore a versioned server cache, then verify file metadata in the background; + SHA-256 hashes avoid reparsing unchanged notes. Markdown remains the source of truth. +- Queue watcher and application changes, periodically reconcile metadata and audit + content hashes, and preserve the last successful records on filesystem errors. +- Add index status and maintenance endpoints, readiness errors for index consumers, + settings controls and automatic refresh of active search results/snippets. +- Keep local stdio and remote MCP on the same search index. Document NAS delays, + cache migration, recovery and a synthetic benchmark in [INDEXING](docs/INDEXING.md). + +## Fresh search index on startup — 2026-10-30 + +- Rebuild search from current vault files before accepting requests, instead of + trusting an old non-empty snapshot. Notes added or edited while the server was + stopped now appear in web and MCP search; deleted notes no longer remain in results. +- Added regression coverage for additions, edits, deletions and the refreshed snapshot. + +## Remote MCP — 2026-10-30 + +- Added opt-in stateless Streamable HTTP at `/mcp`, using existing scoped API keys, + per-request authentication, shared REST rate limits and explicit Host/Origin checks. +- Preserved local stdio commands and all ten tools; REST and MCP share note operations. +- Fixed double decoding of Agent API paths containing literal percent signs. +- Added HTTP/stdio integration checks, Docker runtime CI smoke and a + [Perplexity Pro setup guide](docs/MCP_REMOTE.md). Live Perplexity/HTTPS acceptance + remains to be performed on the deployed instance. + +## Literal identifiers use body text color — 2026-10-29 + +- Display `` and other underscore identifiers in the normal text color in + Source/Live/Reading, including their brackets. Preserve note source and actual + HTML/code syntax colors. This supersedes the earlier decision to retain red. +- Verify mode switching with the actual React Editor: Source exposes Markdown, + Live renders it, Reading renders it read-only, and document text stays unchanged. +- Match Obsidian Live for paired multiline backticks, including blank paragraphs: + conceal delimiters and display the body as ordinary literal lines, preserving + identifiers and line breaks. Reading keeps its separate Markdown semantics. + +## 2026-10-29 — Native Editing Toolbar + +- Full standard toolbar inventory with popup groups, text tools, insert dialogs, brush/cleanup, alpha colors and alignment; shared editor command registry. +- Selection, fixed and mobile layouts, safe settings/import/export, custom literal templates and clipboard fallbacks. +- Retain finished parallel rendering parity work (tables, embeds, fragments, typography and literal angle-bracket text). + + +## Rendering parity: background reference checks — 2026-10-29 + +- Capture Obsidian 1.14.5 reference PNG/DOM/styles in an isolated hidden process, + preserving OS focus and note hashes. No app installation or production access. +- Render tables inside lists/quotes, preserve their prefixes on edit/Undo and retain + empty column positions and correctly escaped pipes. +- Resolve compound heading paths within their parent sections and match the observed + six-level transclusion limit. Align measured text, paragraph, quote and table metrics. + +## Rendering parity: original Obsidian comparison — 2026-10-29 + +- Compare synthetic fixtures with Obsidian 1.14.5 in an isolated vault; record + accessibility evidence and unchanged source hash (window capture was unavailable). +- Share Markdown preprocessing, callouts, tasks and HTML sanitization between web/public. + Render formatted table cells, nested/folded callouts and Reading footnotes with working + links and unique IDs. Keep compiled embeds out of a second Markdown pass. +- Support paragraph/list block embeds and source-relative resolution of same-named notes; + omit filename titles for fragment embeds and preserve angle-wrapped image destinations. +- Fall back to visible source for YAML the simple property editor cannot preserve. +- Verify 24 mode/theme/width/line-ending combinations without document edit transactions. + Remaining visual and syntax coverage is documented in `docs/rendering-compatibility.md`. + +## Rendering parity: critical parsing fixes — 2026-10-29 + +- Preserve literal identifiers such as `` alongside inline HTML in Live/Reading. +- Protect parser-defined code, escapes and HTML attributes before Markdown extensions; + restrict Live tables to actual parser boundaries and prevent embed expansion inside code. +- Hide Obsidian comments in Reading/preview/public output, including public metadata, + while keeping them editable in Live and preserving literal examples inside code. +- Share heading-embed selection between Live and preview, preserve attachment paths and + carry the embedded note's path when resolving its images. Missing headings keep a fallback. +- Add shared fixtures and browser regressions for source preservation. Full visual parity, + block embeds, complex table formatting and remaining dialect differences are still pending. + +## Editor color and selection toolbar — 2026-10-29 + +- Add text/background color palettes, custom colors and reset to the desktop/mobile formatting toolbar. +- Show a compact floating toolbar for selected text; preserve selection, support Escape and Undo/Redo, + inherit the current theme, and disable formatting on locked/read-only notes. +- Store Obsidian-compatible color spans, preserve Markdown block structure and render colors with + emphasis/inline code in Live/Reading and the Markdown preview. No new dependencies. + +## Rendering dependency maintenance — 2026-10-29 + +- Upgrade KaTeX to patched 0.18.10 and Mermaid to 12.2.0, sharing the patched math renderer. + Pin KaTeX because 0.18.11 was deprecated by its publisher for accidental breaking changes. +- Reject inherited trust in math options; add security regressions and ordinary rendering controls. +- Gate all npm advisory severities in CI. Mermaid diagrams now need an ES2024-capable browser + (Safari 17.4+); diagram layout may differ from Mermaid 11. + +## Moderate dependency maintenance — 2026-10-29 + +- Refresh compatible Hono/node-server, fast-uri, ip-address and qs versions; update desktop + esbuild without forcing Vite's separate compiler version outside its supported range. +- Cover encoded URI schemes, comma-array coercion, IPv6 link-local ranges and compiler CORS. +- Extend dependency and CI audit guards to moderate severity; KaTeX and Mermaid are deferred. + +## High dependency maintenance — 2026-10-29 + +- Update Electron to maintained 43.8.4 in install and packaging pins, retaining Windows ia32; + remove the vulnerable legacy extract-zip dependency through its supported replacement. +- Upgrade Vite to maintained 6.4.5, MCP SDK to 1.32.2, Multer to 2.5.0 and Zod to 4.6.7; + refresh both body-parser lines and Browserslist within compatible parent ranges. +- Preserve nested settings defaults with Zod prefaults; cover fresh/legacy values and secrets, + early collection-size rejection, compressed JSON, malformed/normal uploads and MCP constraints. +- Extend CI dependency guards and audit threshold to reject both high and critical advisories. + +## Security dependency maintenance — 2026-10-29 + +- Upgrade simple-git/argv-parser, Vitest, concurrently/shell-quote and electron-builder/tar; + refresh compatible DOMPurify and proxy-addr patches. Remove the vulnerable tinypool path. +- Require Node ≥22.12 for supported desktop build tooling; align CI/release runners and use + reproducible Docker installs from the checked lockfile. +- Cover mapped-proxy trust, VISUAL editor guards, Git clone/sync and isolated Git configuration; + reject the remediated critical lockfile versions in CI and exercise desktop directory packaging. +- Keep automatic Git merge noninteractive without weakening simple-git's environment guards. + +## Community integration — 2026-10-29 + +- Combine Pham and Lakyle improvements with source histories and attribution preserved. +- Retain locks/PDF/tasks/templates/MCP/CLI alongside sorting/outline/attachments/media features. +- Default trash retention to zero; automatic permanent deletion requires explicit configuration. +- Add cross-feature state regressions and an isolated HTTP integration smoke test. + All notable changes to WebObsidian are documented here. This project tracks its product design and version history in [PRD.md](PRD.md); the entries below summarize user-facing changes. The format is loosely based on [Keep a Changelog](https://keepachangelog.com). ## [Unreleased] +## [0.3.0] - 2026-10-16 + +### Added +- **File explorer quick actions** — hover a folder row for *New note* / *New canvas*, and hover + any row for *Delete*. Deleting asks for confirmation in an in-app dialog (native browser + prompts are blocked in embedded browsers) and warns how many items a folder contains. On touch + devices the buttons appear on the selected row; the delete button is also reachable by keyboard. +- **Double-click to rename** files, folders and canvases in the file explorer. +- **Manual sorting** — a new *Manual* sort mode. Drag to reorder: the top/bottom edge of a row + inserts before/after it (with an insertion line) and the middle of a folder row moves the item + into it. The order is saved with your workspace and kept when items are renamed or moved. +- **Trash retention** — items in `.trash` are permanently deleted after a configurable number of + days (default 30, `0` keeps them forever), counted from when they were moved to the trash. + *Settings → Vault & Files → Trash retention*. +- **Local attachment folders** — pasted and dropped images are saved in an `attachments/` folder + next to the note and linked with relative paths. A trash icon on a rendered image removes it + from the note and permanently deletes the file when nothing else uses it. These folders are + hidden in the file explorer by default (*Show attachment folders* setting); a folder named + `attachments` that contains notes is never hidden. +- **Floating document outline** — a margin outline for the current note with the active section + highlighted as you scroll; hover for the heading list, click a heading to scroll to it with a + smooth ease-in-out animation. +- **Human-readable note titles** — notes named like `my-first-note` show as "My First Note" in + the file explorer and the note's title (display only — filenames are unchanged). A front + matter `title` overrides it in the note view. +- **Reveal active file in explorer** — a setting (*Settings → Vault & Files*) that expands + parent folders, scrolls to the active file and highlights it when you switch documents. + +### Fixed +- Wrapped lines in bullet, task and ordered lists now line up under the text. +- Pasting several images that share a filename (such as `image.png`) no longer overwrites earlier + ones, and every pasted image gets its link. +- Public share pages show the right image for notes with local attachments, including file names + with spaces. + +## [0.2.0] - 2026-10-15 + +### Added +- **Inline media embeds** — a YouTube, Instagram or Facebook link alone on a line renders as + a player in Live and Reading modes and on public share pages. Only whitelisted providers + embed; the iframe URL is rebuilt from validated IDs and sandboxed. +- **Link preview cards** — a pasted URL alone on a line becomes a rich card (title, + description, thumbnail, domain). Metadata is fetched server-side with SSRF protection + (private/loopback addresses blocked, redirects re-validated, size and time capped); links + that cannot be previewed stay plain. `GET /api/linkpreview`. +- **Multi-cursor editing** — Option/Alt+Click adds a cursor, Shift+Alt+Drag selects a + column, Esc returns to a single cursor. +- **Hanging indent for lists** — wrapped lines in bullets, tasks and ordered lists align + under the text instead of the marker (nested lists and multi-digit numbers included). +- **YAML front matter highlighting** in Source mode (new dependency `@codemirror/lang-yaml`). + +### Fixed +- Alt+Click no longer collapses multi-cursor selections in Live Preview. + +## [0.1.3] and earlier + +### Added +- **A status you pick, not a status you type.** On a task page the `status` was free text, so changing + it meant spelling the id exactly — and a typo is not cosmetic: the board maps only + `open / in-progress / blocked / done` plus a few aliases, so anything else becomes a column of its + own and is never rewritten on read. Keys whose values are a closed list — `status`, `priority`, + `origin`, `confidence`, `severity` — now show a `▾` beside the value that opens the vocabulary the + vault's `SCHEMA.md` defines (`status` per page kind: a task's statuses are not an abnormality's, and + a page kind with none — an ADR, an entity — offers no list at all), marks the note's current value, + and writes the pick back through the + same frontmatter path as typing (one `status:` line changes; the rest of the note is untouched). The + field stays editable text, and a value the table does not know (`accepted`, `dropped`) is kept, + listed first with a label and never rewritten — the vocabulary lives in the vault, the app only + saves the typing. *(issue #61)* +- **The vault can hand you a file it cannot show.** A Word, Excel or PowerPoint document, an archive + or an RTF used to fall through to the markdown editor — which rendered its bytes as noise — and the + only URL that served it (`/api/files/content?path=…`) saved it as `content`, with no extension, so + nothing on the desktop could open the result. Those types now open a pane with the file name and a + **Download** button, and the server sends them as an attachment under their real name (including + non-ASCII names, via RFC 5987 `filename*`). Both halves come from the same seam as the PDF viewer: + `fileViewKind()` picks the pane, `?download=1` picks the header. *(issue #59)* +- **PDF files open in a viewer — and `![[doc.pdf]]` embeds one inline.** A PDF in the vault used to be + unviewable: `/note/.pdf`, a click in the file tree and a wikilink all opened an *empty* editor + tab, because the pane only knew markdown, canvases, images, audio and video. A PDF now opens as a + full-pane frame served by the browser's own viewer (pages, zoom, search, print), and `![[doc.pdf]]` + renders that same viewer inline in Live Preview and in the Reading/split preview, with the file name + as a link that opens it as a tab. Rendering the frame required the app's CSP to allow framing its own + content (`frame-ancestors 'none'` → `'self'`; third parties stay blocked), and the sanitize schema was + *not* widened — raw note HTML still cannot inject an iframe. A link to an attachment the vault does + not hold (`[[report.pdf]]` with a typo) now says "File not found" instead of quietly creating a note + named `report.pdf`. Other binaries (`.xlsx`, `.docx`, `.zip`) now open a **download** pane instead of the editor — see the + entry above. *(issue #57)* +- **Vault locks — notes the browser cannot write.** Mark paths in `_system/locks.json` (raw evidence, + generated boards and indexes, `_system/` itself) and a *session* write is refused with `423 locked` + while an **API key keeps writing** — the app's two writers were already separate, so a lock is a guard + on one router rather than a second permission system. Locked notes show a 🔒 in the file tree and open + read-only with a banner that states the reason; unlocking is deliberate (`confirm` dialog, the operator + password, or `off` for none). See [docs/LOCKS.md](docs/LOCKS.md). +- **Settings → Appearance → Show inline title.** Turn off the file-name title above each note when your + notes already open with their own heading (on by default, like Obsidian). +- **`CLIENT_IP_HEADER`** (e.g. `CF-Connecting-IP`): behind a tunnel every visitor shares the proxy's + address, so ten wrong guesses from anyone locked the owner out of login for 15 minutes. With this set, + the login limit is per visitor. The header is only trusted from a peer that `TRUST_PROXY` trusts. +- **New note from template — the copy, rename and re-date steps are gone.** A `New note from template` + command (command palette + a ribbon button) lists the templates in your vault's `templates` folder, + takes a title, and creates `/-.md` with the template's placeholders filled + in and the note opened for editing. The target folder is derived from the template's name + (`meeting` → `meetings`, `query` → `queries`, `weekly-review` → `reviews`), is shown before anything + is written, and stays editable. Placeholders: `{{title}}`, `{{date}}`, `{{time}}`, `{{slug}}` — plus + the literal `YYYY-MM-DD` / `YYYY-MM-DD-slug` shapes existing templates already use, so no template + has to be migrated. It never overwrites (a taken name moves to `-2`, `-3`, and the write is + create-only server-side) and it does not create a missing folder — it names it instead. *(issue #42)* + +### Fixed +- **Reading a note that does not exist is a `404`, not a `500`.** `GET /api/files/content` resolved a + missing path by basename (the `![[image.png]]` embed case) and then read it anyway, so ENOENT surfaced + as a 500. Found by the new live lock assertion in `deploy/smoke.sh`. +- **"Open today's daily note" writes to the vault's own daily folder** (issue #52). It hard-coded + `Daily/.md` at the vault root, so a vault that keeps daily notes deeper — `relats/daily/` here — + grew a stray file at the root on every press. It now picks the **shallowest** `daily/` folder in the + tree, falling back to a root `Daily/` only for vaults that have no daily folder at all. +- **The `[[` link suggester no longer renders black-on-dark.** The popup was mounted outside the + themed wrapper whenever the active theme is one of the four **Catppuccin** themes (the lookup only + matched `.theme-light, .theme-dark`), where the palette variables don't resolve: titles came out + black and the popup background transparent. It now mounts through `themedPopupHost()`, so every + theme gets its own colours. Same fix for the Properties **value dropdown** and plugin **notices**. + *(issue #49)* +- **Tables no longer break words in half** ("Own|er", "hun|g"). Wide tables scroll sideways in their + own box instead of being squeezed to the line width, on desktop and phone. +- **Live updates survive disconnects.** The browser reconnects the WebSocket with backoff (and reloads + the file tree once), the server pings every 30s so proxies like Cloudflare don't drop idle sockets, + and a plain `GET /ws` answers `426` instead of the app's HTML so a proxy stripping upgrades is obvious. +- **Graph view** fits the whole graph once the layout settles (only zooming out, and not if you already + moved the camera), hides labels that would overlap (busiest nodes keep theirs), and the footer reads + "N nodes · M notes". +- **Tasks board** columns flex (240–340px) so four fit a laptop screen; per-column label reads "N hidden". +- **Recent / Bookmarks** show the parent folder when two entries share a file name. +- **Search snippets** drop Markdown syntax (`[[…]]`, `**`, `#`, table pipes) and no longer show a sliver + of a third line. +- **Login screen** uses the theme this browser last used instead of flashing light. +- **Mobile**: pinch-zoom is no longer blocked; form fields are 16px so iOS doesn't zoom on focus. +- **Faster repeat loads**: hashed `/assets/*` files are cached for a year (`immutable`). +- **The timeline now actually lands on today.** `scrollToToday()` ran on mount while the task list + was still empty: the placeholder range fit the pane, so `scrollLeft` clamped to 0, and the stale + offset meant the today line sat off-screen — invisible in both themes. The landing now re-runs when + the range or zoom changes, observes both the scroll container and the chart content, and yields the + moment you scroll, drag, tap or zoom yourself. Caught by asserting *visibility* in the headless DOM + check, not just the line's offset (which was always "correct"). *(issue #35)* + +### Fixed +- **The template picker picked on hover, so a click looked dead** — moving the mouse over a template + selected it (hover set the same state the click set) and the first template was pre-selected for you. + Choosing is now explicit: rows are buttons (click, or Tab + Enter/Space), hover is cosmetic only, + nothing is pre-chosen, and the form names the current choice. *(FR-17, issue #46)* +- **A template with no folder could be created at the vault root.** `document`, `procedure`, `query` + and `shift-handover` resolve to no folder, and Create did not check the folder at all, so the note + landed in the vault root — exactly what the feature promised to refuse. Create is now blocked until + the template, the title *and* the folder are present (the reason is shown in place of the path), and + the store action refuses an empty folder outright. *(FR-17, issue #46)* + +### Changed +- **Week zoom now shows at least the next eight weeks, whatever the screen.** Pixels per day is derived + from the chart's real width (`weekZoomPxPerDay`, clamped 4-20px/day) with 12% of the width left as + past context, and the timeline always draws 56 days of runway past today even when every task is due + sooner. Measured: 1440px → 8.0 weeks ahead, 1000px with both sidebars open → 8.0, 390px phone → 8.0 + (it was 10.6 / 4.4 / 2.3 at a fixed 16px/day). Week ticks label as `Sep 14` when there is room and as + `14` when dense, `Month` zoom moved to 3px/day so the zoom order still holds, the title column goes + compact from the *pane* width rather than the viewport, and the toolbar reports "8.0 weeks ahead". + *(issue #37)* + +- **Tasks timeline restyled.** Two-tier axis (month band above week ticks) with labels like `Sep 28` + instead of `09-28`; weekend shading; a layered grid (day hairlines, week lines, 2px month lines) + replacing the per-day gradient haze; a today band, line and `Today` pill; rounded bars with priority + chips and their title inside when there is room; open-ended bars fading out instead of a dashed + edge; overdue marked by a red ring *and* stripes rather than colour alone; status named in words in + the title column. The title column drops from 200px to 132px below 640px and hides the owner and + priority from its metadata. Every bar-text pair measures ≥4.5:1 in both themes (worst 4.70:1) and + the `open` bar is lifted on dark themes. *(issue #35)* + +### Added +- **Set a due date from the board or the timeline.** The due badge on a card is a control now: click it + and it turns into a date field (Enter saves, Escape cancels, the `Clear` button writes `due: none`), + and the `⋯` menu gains "Set due date…" / "Clear due date" for keyboard use. The timeline's row chip + does the same; clicking a *bar* still opens the note. Writes go through a pure `setTaskDue` that + changes only the `due:` and `updated:` lines, compare-and-set guarded, with optimistic rollback and + a notice on failure — the same discipline as the status drag. A **"Needs a due date"** chip filters + to undated tasks so a batch can be scheduled in one pass. *(PRD 1.14 - FR-15, issue #41)* +- **The task template now carries a due date.** `Wiki/templates/task.md` ships `due: YYYY-MM-DD` + instead of `due: none`, with the rule stated in the body; `Wiki/SCHEMA.md` makes `due` required on + task pages and `none` a deliberate exception, so a missing date is a visible decision rather than a + silently empty field. The action-item extraction skills keep "never invent a date" and now require + `due: none` to be recorded so those tasks surface under *Needs a due date*. *(issue #41)* + +- **Tasks view: filter by status, with Done hidden by default.** A "Status" row of chips (canonical + four in column order, then any unmapped statuses present), each with its card count; `done` starts + hidden, everything else — including unmapped values — stays visible. The row reports what it is + hiding (`1 hidden — show all`, one click to clear) and the task count reflects what is shown. + **Every column still renders**, including a filtered-out Done: it stays a drop target so a card can + still be dragged to completion, with `+N hidden` in its header and the reason in its body. The + timeline shares the same filter. *(PRD 1.13 - FR-15, issue #39)* + +- **Tasks timeline (Gantt)** — second mode of the Tasks view (`/tasks?mode=timeline`, command + palette "Open tasks timeline"): one bar per `type: task` note from `raised` (fallback `created`) + to `due`; a task with no usable due date is dashed and open-ended, running to today. Day/week/ + month zoom, a fitted range padded by three days, a today line, status-coloured bars (unmapped + statuses get their own colour) with priority badges, red outline when overdue, sticky title + column and horizontal panning (touch included). Click a bar or its row label to open the note. + Geometry is pure UTC-day arithmetic in `web/src/lib/gantt.ts`; no new runtime dependency, no + server change. Deliberately no dependencies, auto-scheduling, critical path or drag-to- + reschedule. *(PRD 1.10 - FR-16, issue #32)* +- **The Tasks mode is part of the URL again**: `tasksMode` lives in the store (not persisted) and + `pathToUrl`/`modeFromUrl` carry it, fixing a reload of `/tasks?mode=timeline` being rewritten to + the bare `/tasks` and silently falling back to the board. *(issue #32)* +- **Tasks view — Kanban board over `type: task` notes** (`/tasks`, `TASKS_PATH = 'tasks://view'`, + ribbon entry, command palette "Open tasks board"): four canonical columns (`open` → Backlog, + `in-progress` → Doing, `blocked` → Blocked, `done` → Done, plus aliases like `todo`/`wip`/`waiting`); + an unrecognised `status` value gets its own column, a missing one lands in Backlog with a "no status + field" marker. Drag a card (or use the "⋯" context menu) to change its column — this rewrites only + the `status:` and `updated:` frontmatter lines through the existing file write path, with an + optimistic-UI rollback and error notice on failure. Filter bar (folder scope, priority, owner, + free-text) with manual refresh and vault-watcher auto-refresh. New endpoints `GET /api/tasks` and + `GET /api/v1/tasks` (Agent API, `read` scope) return the normalised task records, backed by the + existing search index (no extra vault walk). *(PRD 1.9 - FR-15, issue #31)* +- `GET`/`PUT /api/files/content` gain an optional compare-and-set pair (`version` on read, + `baseVersion` on write) so a stale write — or one aimed at a note deleted/renamed meanwhile — is + rejected with `409 version_conflict` instead of clobbering (or resurrecting) it; omitting + `baseVersion` keeps the previous (unconditional) write behaviour. *(PRD 1.9 - FR-15)* + +### Dark themes — visible caret, and CodeMirror's Find panel follows the theme + +- **The caret is no longer black on a dark theme.** `drawSelection()` hides the native caret + (`caret-color: transparent !important`) and paints its own `.cm-cursor` element, whose border + CodeMirror hard-codes to `black` — its `&dark` variant only applies when the `darkTheme` facet is + on, and this app themes through CSS variables instead, so the facet never is. The drawn caret + (and the drop cursor) now takes `var(--text-normal)`; verified in a real browser as + `#dadada` on Obsidian Dark (was `#000` on `#1e1e1e`), `#222222` on light, `#cdd6f4` on Catppuccin + Mocha — and confirmed on a screenshot. +- **The Find & Replace panel (`Ctrl+F`) is dark on dark themes.** Same root cause: its background is + CodeMirror's hard-coded light `#f5f5f5` (with browser-default white inputs). The panel, its text + fields and buttons are now themed from the palette on every theme. +- Guard: `web/tests/editorTheme.test.ts` fails CI if these CodeMirror defaults are left at a literal + colour instead of a palette variable (it goes red if the caret rule is reverted to `black`). + +### Live Preview — clicking a row no longer edits the row below it + +- **The caret now lands on the row you click.** CodeMirror builds its height map from border-box + rects and assumes blocks stack directly on top of each other, so vertical `margin`s between + blocks were invisible to it: the map ran short (a title + properties block + table made it 76px + short) and every click below a gap resolved one or two lines further down. Spacing for the note + title, properties block, table, the `` ```html `` render toggle, raw-HTML block and mermaid +diagram is now + padding on the measured block, and the interactive table is `display: block; width: fit-content` + instead of `inline-block` (an inline-block's anonymous line box added ~7px the map could not see). + Every editor block is pixel-identical; the space the table's inline-block strut emitted is gone + (7px tighter below tables). +- **Attachments that arrive after layout no longer desync the map.** An image (or an iframe) that + loads after CodeMirror measured the line left the map short by the image's height until the next + scroll or keystroke, which moved every click below it — `mediaLoadRemeasure` re-measures on + `load`/`error`. +- **A line whose only content is a widget (an image row, say) now takes the caret too.** The + browser's own contenteditable caret placement picked a *neighbouring* line for clicks in the blank + part of such a row (the app's first-click fix could not stick against it). The caret is re-asserted + once the native handling has run, and the clicked row becomes active — so clicking an image row + behaves exactly like arriving on it with the keyboard (its embed source is revealed). Widgets that + own their interaction (tables, properties, media players, note transclusions) and drag-select are + untouched. +- Guards so it cannot come back: `web/tests/editorSpacing.test.ts` (CI) fails on a vertical margin + on an editor block, and a dev-only `livePreviewGeometryGuard` warns in the console when the height + map is shorter than the rendered content. README › *Live Preview geometry* explains the rule. +- Verified in a real browser (headless Chromium, local dev instance): 60/60 clicks across + widget-heavy, heading-heavy and wrapped-text notes put the caret on the clicked line (before the + fix: 17 of 22 clicks landed a line low), and every isolation note reports map height == rendered + height. + +### Docs — the vault must never be git-synced to this repository + +- Added the warning to `docs/DEPLOYMENT.md` (with the recovery procedure and one-line checks) and a + pointer in the README: pointing the app's **GitHub Sync** at this source repository pulls the whole + source tree into the vault, where it is served as notes. Use a dedicated notes-only repo for vault + versioning, and never store a push token for a repo your notes must not reach. + +### Graph view paints correct theme colours (fixes dark-mode labels) + +- **Labels are no longer black in dark themes.** The canvas read its palette once at mount, so + text kept the light-theme ink when the graph tab was restored before the saved theme applied, or + when the theme was toggled with the graph open. Now the graph subscribes to the active theme and + repaints labels, node tints and edges on every change. +- **Theme-colour resolution is done properly.** The graph reads palette variables through a + `resolveThemeColor` helper that follows `var()` alias chains and round-trips values through the + browser, so `hsl(...)`/`calc()` accents (Catppuccin) that Pixi's parser rejected now resolve + instead of silently using a hardcoded fallback. (Before, accent/accent-hover were always the + fallback colours — imperceptible on the Obsidian themes, wrong on Catppuccin.) +- **Catppuccin themes are now found.** The themed root was looked up by `.theme-light, .theme-dark`, + missing the four `theme-ctp-*` classes and falling through to `body`, which cannot see the palette + vars — every colour became its fallback. The lookup now uses all theme classes (from `lib/theme.ts`). +- Graph "Copy screenshot" now fills its background with the resolved theme `--bg-primary`, so a + dark-theme screenshot is no longer pasted on white. +- The existing `window.__graphCam` debug hook got the resolved palette + live label fill, so an + automated UI check can assert ink-vs-background; new unit tests cover the colour resolver + (`web/tests/cssColor.test.ts`), and root `npm test` now runs every web test file (was only one). + +### Agent API — safe read-modify-write, and an MCP server (adopted from other forks) + +- **Every read returns a `version`** (sha256 of the content — mtime-independent, so git autosync + cannot fake a conflict) and **writes can carry `base_version`**: the write applies only if the note + still has that version, otherwise `409 version_conflict` comes back with `currentVersion` to re-read. + `""` means "must not exist yet". Omitting it keeps the old last-writer-wins behaviour; set + `WEBOBSIDIAN_AGENT_REQUIRE_VERSION=1` to refuse unversioned writes (`400 missing_base_version`). +- **`PATCH {"find": …, "replace": …}`** edits a literal string in place, server-side, so a stale copy + can never be written back. Matching is literal (no regex, no `$&` expansion); a `find` that occurs + more than once is refused with `409 find_ambiguous` + the occurrence count unless `replaceAll: true`. +- **`GET /note-matches?path=&q=`** greps one note: every literal occurrence with its 1-based line + number, optional `context` lines, `case_sensitive`, `limit`. +- **Segmented reads** — `GET /notes/{path}?offset=&limit=` are line numbers; the response adds + `version`, `totalLines`, `hasMore`. Omitting `limit` still returns the whole note (no silent + truncation for existing clients). **`GET /notes?sort=&order=&folder=`** orders the listing + (default: most recently modified first). +- **`mcp-server/`** — new workspace: a stdio MCP server that wraps the Agent API, so MCP hosts + (Claude Code, Codex, …) get the vault as 10 tools, with `base_version` plumbed through. +- Source: forks `blueberry6401/webobsidian` and `Absenthome/webobsidian` — re-implemented against + this tree, credited in the code and in docs/UPSTREAM_PR_MERGES.md → "Adopted from other forks". +- Coverage: 20 new unit tests (find/replace literals, grep line numbers, version tokens), plus smoke + scenarios D–F (agent API end-to-end, strict mode, a real MCP handshake over stdio). + +### Docs — README now documents this fork's setup + +- New README section **§ This fork**: what the fork contains, where it runs, the deploy-on-merge + pipeline, **how to verify which build is live** (`GET /healthz` → `version` + `build`, image-id + comparison, the `Deploy (LXC 107)` run log) and the **upgrade notes** that matter when coming from + upstream `v0.1.1` (default password refused once a credential exists, `/auth/status` shape, the + `127.0.0.1` healthcheck replacing any local override, the build-arg identity, the new `packages/webo` + workspace, symlink behaviour). +- Quick start clones *this* fork, checks `/healthz` and says why no healthcheck override is needed; + the shell-script table gained `npm test`, the `webo` CLI and `scripts/smoke-test.sh`. +- Security notes and Contributing updated (default-password rule, `/auth/status`, `docs/agents/`, + "merging to `main` deploys itself — branch + PR, keep the smoke test green"). +- `desktop/README.md`: fork note that the auto-login secret means `123456` is never valid on the + desktop's loopback server, and that the bundled server carries the merged fixes. +- `docs/DEPLOYMENT.md`: where the app test pages live (vault `Testing/`) and a pointer to the README. + +### Build identity in `/healthz` — "which version is running?" + +- `GET /healthz` now returns `{"ok":true,"version":"","build":""}`; the + commit is baked into the image by the deploy pipeline (`--build-arg GIT_SHA=…`, surfaced as + `WEBOBSIDIAN_BUILD_SHA`), so the running version is one curl away — locally, from the host, or over + the public URL. `build: dev` means the image was built outside `deploy/deploy.sh`. +- `deploy/deploy.sh` passes that build arg, and its smoke test now **asserts the running `build` + equals the deployed commit**. +- **Fixed:** a deploy could rebuild the image while the old container kept running — `docker compose up + -d` does not always recreate when only the image content changed, and the smoke test cannot tell + because the previous container answers the same endpoints. `ensure_running_image` compares the + container's image id with the freshly built one, forces a recreate on mismatch, and fails the deploy + if the container still is not running the new build. + +### Deploy pipeline (LXC 107) — deploy-on-merge CI/CD + +- `deploy/deploy.sh`: idempotent deploy (sync → rolling backup → keep the previous image as + `webobsidian:rollback` → build → `up -d` → wait for healthy → smoke) with automatic rollback when + the build or the smoke test fails; `--bootstrap`, `--rollback`, `--backup-only` modes. +- `deploy/smoke.sh`: asserts a *running* deployment (`/healthz`, the SPA bundle, `/auth/status` + exposing only `passwordSet`, `123456` refused once a credential is configured, the operator password + logging in) — never prints a secret. +- `.github/workflows/deploy.yml`: deploys after **CI succeeds for a push to `main`** (plus manual + dispatch) on a self-hosted runner inside the target LXC, which is behind NAT. `workflow_run.event == + 'push'` is checked so a fork PR can never reach the deploy runner; `concurrency` prevents overlapping + deploys. +- `docs/DEPLOYMENT.md`: host layout, deploy path, runbook, backup/rollback, one-time runner setup. + +### Fixed + +- Healthcheck probed `localhost`, which resolves to `::1` inside the image while the server binds IPv4 + only — the container reported `unhealthy` forever while serving normally. Now `127.0.0.1` in both + `docker-compose.yml` and `Dockerfile`. + +### Fork integration — every open upstream PR merged + +This tree is the `phamtruonghung/webobsidian` fork with all 17 open pull requests from +`xnohat/webobsidian` merged on top of `v0.1.1` (see +[docs/UPSTREAM_PR_MERGES.md](docs/UPSTREAM_PR_MERGES.md) for the table, the conflict decisions and +the bug fixes made while merging): + +- **Security**: the well-known default password `123456` is refused as soon as any credential + (`userPasswordHash`, `auth.passwordHash`, `WEBOBSIDIAN_PASSWORD`) is configured, and + `GET /auth/status` no longer leaks `mustChangePassword` to unauthenticated callers (PRs #4 + #15); + `PUT /api/settings` authorizes `vault.path` against operator-configured roots, not the request body + (PR #2, with the test suite from #6/#7); shared canvases drop unsafe URL schemes (PR #3). +- **Vault**: symlinks inside the vault are listed/read/written when their target is an allowed root, + with a realpath cycle guard (PR #23). +- **Editor & UI**: reusable preview tabs (PR #29); graph mobile touch, node dragging and ghost-node + fix (PR #25); Catppuccin themes (PR #11); dark-mode text contrast (PR #10); Account settings tab + and code comments in English (PRs #8/#9); percent-encoded image targets and table-cell italics + (PRs #13/#14). +- **Tooling**: `webo` CLI process manager + graceful SIGTERM/SIGINT shutdown (PR #27); server test + suite (vitest) and web store tests (`node --test`); dependency refresh to 0 production advisories + (PR #24). + ### Added +- **`webo` Process Manager CLI** (`packages/webo`): command-line utility to manage WebObsidian as a background daemon process (`webo install`, `webo start`, `webo stop`, `webo status`, `webo logs`, `webo restart`, `webo config`, `webo uninstall`). Configured centrally via `~/.webobsidian/.env`. *(PRD 1.6 - FR-14)* +- Server graceful shutdown handlers for SIGTERM/SIGINT signals (cleans up HTTP server, WebSockets, file watcher, and autosync timers). - Open-source repository scaffolding: `README.md` (with logo), `LICENSE` (MIT), `CONTRIBUTING.md`, `SECURITY.md`, `CODE_OF_CONDUCT.md`, GitHub issue/PR templates and a CI workflow (typecheck, build, Docker image). diff --git a/CLAUDE.md b/CLAUDE.md index 0136c50b..0f9b958b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,4 +1,18 @@ -# CLAUDE.md — Hướng dẫn làm việc cho Claude Code trên dự án WebObsidian +# CLAUDE.md — WebObsidian contributor guidance + +## Upstream contribution — authoritative routing + +This branch contributes the integrated `macros0`, `phamtruonghung` and `lakylekidd` +community work to `xnohat/webobsidian`. Read `docs/FORK_INTEGRATION.md` for historical +source revisions and merge decisions. +Use `--repo xnohat/webobsidian` explicitly for upstream GitHub operations. References below +to the Pham issue tracker or LXC 107 describe the source fork and must not direct operations there. +Do not deploy or access a real vault unless explicitly requested. Use temporary local vaults +for tests. Automatic trash retention defaults to zero (keep forever). + +Validation: `npm ci`, `npm run typecheck`, `npm test`, `npm run build`, +`node scripts/integration-smoke.mjs`; desktop typecheck/build via its workspace scripts. +Linux CI also runs `scripts/smoke-test.sh` for auth, symlinks, Agent API and MCP. ## Bối cảnh WebObsidian là web app self-hosted clone toàn diện Obsidian. Thiết kế chính thức nằm ở @@ -41,3 +55,27 @@ docker compose up # chạy full stack - `web/` — React SPA (components, lib, styles). - `data/` — runtime config & index (gitignored). - `docs/` — tài liệu bổ sung. + +## Ghi chú riêng của fork +Đây là fork `phamtruonghung/webobsidian` (= upstream + toàn bộ PR đang mở đã merge). Xem +[docs/UPSTREAM_PR_MERGES.md](docs/UPSTREAM_PR_MERGES.md) trước khi "sửa" một lỗi trông giống lỗi +upstream. Deploy production chạy trên LXC 107 qua Docker Compose + self-hosted runner — quy trình, +runbook và rollback ở [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md). + +## Agent skills + +### Issue tracker + +Issues live as GitHub issues in this fork (`phamtruonghung/webobsidian`); use the `gh` CLI. See +`docs/agents/issue-tracker.md`. + +### Triage labels + +The five canonical roles map one-to-one: `needs-triage`, `needs-info`, `ready-for-agent`, +`ready-for-human`, `wontfix` (plus repo labels `deploy`, `upstream-sync`). See +`docs/agents/triage-labels.md`. + +### Domain docs + +Single-context: `PRD.md` + `IMPLEMENTATION_PLAN.md` are authoritative, `docs/adr/` and `CONTEXT.md` +are created lazily by `/domain-modeling`. See `docs/agents/domain.md`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c91d81a8..56424668 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,11 +20,16 @@ and design-driven — please read the few rules below before opening a PR. - **Runtime config is JSON only** (`data/settings.json`) — do not add a DB engine. - **Security:** never log secrets/tokens/API keys; hash before storing; guard against path traversal. +- **Editor CSS:** vertical spacing on an element CodeMirror renders as a *block* must be + `padding`, never `margin`. CodeMirror's height map is built from border-box rects and assumes + blocks stack flush, so a vertical margin between two blocks is invisible to it and every click + below that gap lands one or two rows low. [README › Live Preview geometry](README.md) has the + details; `web/tests/editorSpacing.test.ts` fails CI if a margin reappears. - Match the style, naming, and comment density of the surrounding code. ## Development setup -Requires **Node ≥ 20** and `git` (+ `git-lfs` if you use LFS). +Requires **Node ≥ 22.12** and `git` (+ `git-lfs` if you use LFS). CI uses Node 22. ```bash npm install @@ -34,15 +39,29 @@ npm run dev # server :8787 + web dev server :5173 (proxied) Before opening a PR: ```bash -npm run typecheck # must pass — CI runs this -npm run build # must succeed — CI runs this +npm ci +npm run check:secure-deps +npm audit --include=dev --audit-level=low +npm run typecheck +npm --workspace desktop run typecheck +npm test +npm run build +node scripts/integration-smoke.mjs +npm --workspace desktop run build ``` +CI also runs `scripts/smoke-test.sh`, Linux desktop directory packaging and a Docker image build. +On headless Linux, install Electron's system libraries, configure its `chrome-sandbox` helper, +and run tests through `xvfb-run --auto-servernum npm test`; see `.github/workflows/ci.yml`. +The dependency audit checks development dependencies too and rejects every advisory severity. +Download the `npm-audit` artifact from a CI run for its JSON report. CI can also be started +manually from the repository's Actions tab. + ## Pull requests 1. Fork and create a topic branch off `main`. 2. Make your change; keep commits focused and the diff minimal. -3. Ensure `npm run typecheck` and `npm run build` pass. +3. Run the checks above and ensure all three CI jobs pass. 4. Update PRD.md / IMPLEMENTATION_PLAN.md if your change touches design or scope. 5. Open the PR using the template; describe the *what* and the *why*. diff --git a/Dockerfile b/Dockerfile index 3ce98cd1..19ce7759 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,13 @@ WORKDIR /app COPY package.json package-lock.json* ./ COPY server/package.json ./server/ COPY web/package.json ./web/ -RUN npm install +COPY desktop/package.json ./desktop/ +# Every workspace in the lockfile needs its package.json present before `npm install`, +# otherwise its dependencies are never installed and the workspace build fails (mcp-server +# needs @modelcontextprotocol/sdk + zod at build time). +COPY mcp-server/package.json ./mcp-server/ +COPY packages/webo/package.json ./packages/webo/ +RUN ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm ci COPY . . RUN npm run build @@ -15,15 +21,25 @@ FROM node:22-alpine AS runtime WORKDIR /app ENV NODE_ENV=production +# Git commit this image was built from, injected by deploy/deploy.sh (--build-arg GIT_SHA=…) +# and surfaced by GET /healthz as `build`, so "which version is running?" is one curl away. +ARG GIT_SHA=dev +ENV WEBOBSIDIAN_BUILD_SHA=$GIT_SHA + # git + git-lfs are required for vault sync RUN apk add --no-cache git git-lfs && git lfs install --system # Install production deps for the server workspace only COPY package.json package-lock.json* ./ COPY server/package.json ./server/ -RUN npm install --omit=dev --workspace server +COPY web/package.json ./web/ +COPY desktop/package.json ./desktop/ +COPY mcp-server/package.json ./mcp-server/ +COPY packages/webo/package.json ./packages/webo/ +RUN npm ci --omit=dev --workspace server # Copy built artifacts +COPY --from=build /app/mcp-server/dist ./mcp-server/dist COPY --from=build /app/server/dist ./server/dist COPY --from=build /app/server/public ./server/public @@ -37,7 +53,8 @@ ENV PORT=8787 \ VOLUME ["/vault", "/data"] EXPOSE 8787 +# IPv4 literal: "localhost" resolves to ::1 in this image while the server binds IPv4. HEALTHCHECK --interval=30s --timeout=5s --start-period=20s \ - CMD wget -qO- http://localhost:8787/healthz || exit 1 + CMD wget -qO- http://127.0.0.1:8787/healthz || exit 1 CMD ["node", "server/dist/index.js"] diff --git a/IMPLEMENTATION_PLAN.md b/IMPLEMENTATION_PLAN.md index 1e703ce0..a58e6ba9 100644 --- a/IMPLEMENTATION_PLAN.md +++ b/IMPLEMENTATION_PLAN.md @@ -1,10 +1,239 @@ # IMPLEMENTATION PLAN — WebObsidian +## Remote MCP, indexing and editor recovery integration — 2026-10-30 + +- [x] Integrate authenticated remote MCP alongside local stdio and scoped keys. +- [x] Integrate cached indexing, reconciliation/hash audits and automatic search refresh. +- [x] Integrate module-based plugins, draft recovery, conflict resolution and adaptive toolbar layouts. +- [x] Preserve data-safety and authentication fixes with regression coverage. + +The upstream contribution retains one consolidated commit and source attribution. +Runtime sources and configuration match the reviewed integrated source tree; +upstream repository routing is applied separately in documentation and desktop metadata. +The viewport regression waits for exact expected dimensions before its unchanged zoom +and toolbar assertions, avoiding reads of the previous asynchronous layout. + +## Review fixes — 2026-10-30 + +- [x] R1: CLI default recovery password, including old installations. +- [x] R2: preserve dirty tabs across close/rename/delete. +- [x] R3/R4/R6: no-clobber rename, transactional versions and unique temporary files. +- [x] R5: validate nested copy targets and publish complete copies. +- [x] Regression tests, builds and integration verification. + +Progress 2026-10-30: all six review fixes implemented. Regression tests first reproduced default override login, dirty-tab loss, rename clobbering, concurrent CAS/append loss, nested outside-link copy, and temporary-file collisions. Independent review additionally closed Git-metadata aliases, unsupported-tab close loops, and temporary-copy exposure through watcher indexes and application Git snapshots. Final validation: 224 server tests passed / 9 Windows file-symlink skips; 388 web tests passed; all workspace and desktop typechecks, full build, desktop build, and disposable integration smoke passed. Linux-only smoke and manual browser interaction were not run. + + +## Upstream contribution preparation — 2026-10-29 + +- [x] Consolidate the reviewed community integration and preserve contributor attribution. +- [x] Restore upstream README, desktop release and contributor-routing references. +- [x] Reproduce the Windows CRLF fixture assertion failure and compare editor state before/after rendering. +- [x] Complete fresh validation and review the portability overlay for a PR to `xnohat/webobsidian:main`. + +Progress 2026-10-29: the upstream contribution uses one consolidated commit directly on +upstream `c41967a`. Source provenance and contributor credits accompany the result. +Source-fork deployment and scheduled issue workflows retain their repository guards. + +Validation: all workspace and desktop typechecks/builds pass; 188 server and 364 web tests +pass, with seven Windows symlink capability skips. The browser fixture assertion first failed +on a CRLF checkout and passed after correction. Disposable HTTP integration smoke passes; +the dependency guard accepts 27 copies and a fresh npm audit reports zero vulnerabilities. +Independent overlay review found no critical/important issues; historical routing was clarified. + +## Live code block selection — 2026-10-29 + +- [x] Keep code backgrounds below the selection layer, including the active line. +- [x] Move horizontal note margins outside the content box so multiline selection stays within block edges. +- [x] Add real browser pixel checks for wrapped, empty and active code lines, unselected margins, themes and viewport widths. + +The browser regression covers three themes and two viewport widths while retaining +readable line width and centering. The upstream contribution also retains the cross-platform +fixture assertion that compares the editor's source before and after rendering. + +## Literal color correction and Live mode verification — 2026-10-29 + +- [x] Reproduce red `` and replace it with body text color across modes/themes. +- [x] Exercise the real React Editor through Source/Live/Reading and verify unchanged note text. + +Progress 2026-10-29: exact multiline-backtick example compared in hidden Obsidian, +including blank paragraphs. Live now conceals delimiters and retains ordinary literal +body lines; underscore angle identifiers use body color. 188 server +363 web tests, +typecheck/build/HTTP smoke passed. + +## CI and dependency vulnerability audit — 2026-10-29 + +Cập nhật lần cuối: 2026-10-29. + +- [x] Inspect existing workflow, workspace validation commands and GitHub Actions status (enabled; latest main run passed). +- [x] Configure manual runs, read-only permissions, concurrency, timeouts and sandboxed Linux browser test prerequisites; preserve existing build, smoke and packaging checks. +- [x] Split dependency audit into a parallel blocking job; explicitly include dev dependencies and all severities, preserve the remediated-version guard, retain JSON reports on success/failure. +- [x] Local validation: actionlint 1.7.12, 27 protected dependency copies, npm audit (zero vulnerabilities), all workspace/desktop typechecks, 186 server tests +253 web tests, application/desktop builds and disposable HTTP integration smoke pass. Seven Windows symlink tests skipped. Local runtime: Windows/Node 26.3.0; Linux/Node 22, Bash runtime smoke, Docker and Linux desktop packaging require the first hosted run after push (Docker daemon unavailable locally). No hosted run of the edited workflow is claimed. + +Progress log 2026-10-29: user requested CI setup and vulnerability auditing, then explicitly authorized committing/pushing only these changes and verifying hosted Actions. Initial hosted run `40871273318` passed Docker and the zero-vulnerability audit but exposed Electron 43's lazy runtime installation: npm ci leaves chrome-sandbox absent. Install the pinned runtime explicitly before configuring the sandbox, then repeat hosted verification. Publish CI and its documentation separately from unrelated editor work; production access remains out of scope. + +## Full Editing Toolbar parity — planning 2026-10-29 + +Cập nhật lần cuối: 2026-10-29. + +- [x] Document native architecture, inventory of 64 standard commands, popup subpanels and selection behavior, rendering compatibility, settings/import and release checks. +- [x] Tasks 1–3: pinned behavior fixtures, shared command registry and all overlay types. +- [x] Tasks 4–7: basic/block formatting, colors/alignment/rendering, brush/eraser, insert/clipboard. +- [x] Tasks 8–9: all 15 text tools, layouts, settings/import and focus/fullscreen. +- [x] Task 10: complete parity matrix, regression checks and review including finished parallel changes. + +Design: `docs/superpowers/specs/2026-10-29-full-editing-toolbar-design.md`. +Plan: `docs/superpowers/plans/2026-10-29-full-editing-toolbar.md`. +Progress log 2026-10-29: planning requested by user; second screenshot explicitly adds popup subpanels to acceptance. Implementation subsequently completed; 188 server +359 web tests passed, with seven Windows skips. Detailed implementation record: docs/superpowers/plans/2026-10-29-full-editing-toolbar-progress.md. + +## Rendering compatibility audit and implementation — 2026-10-29 + +Cập nhật lần cuối: 2026-10-29. + +- [x] Map Live/Reading, Preview, embed, table-cell and public rendering paths; reproduce 14 groups of semantic inconsistencies with synthetic function/browser probes. +- [x] Record evidence, scope, priorities, reference requirements and an eight-stage plan in `docs/superpowers/plans/2026-10-29-rendering-parity.md`. +- [x] Implement and verify the first critical batch: code/escaping protection, inline HTML boundaries, literal identifiers, comments, heading embeds and attachment source paths. +- [x] Compare synthetic fixtures against Obsidian 1.14.5; unify web/public dialect and HTML policy; fix Reading footnotes, table formatting, nested callouts, block embeds, relative note resolution and unsafe YAML editing fallback. Record original UI evidence and source hash. +- [~] Execute the remaining compatibility plan: complete reference matrix, shared HTML policy, block targets, complex tables/frontmatter and visual parity. + +Follow-up 2026-10-29: shared policy and basic block targets are implemented; extended container/heading/cycle cases and full visual acceptance remain open. Original window screenshot capture times out, so the comparison report distinguishes accessibility/semantic evidence from pixel parity. See `docs/rendering-compatibility.md`. + +Background follow-up 2026-10-29: a separate hidden Obsidian 1.14.5 now supplies PNG/DOM/computed-style references without OS focus or input. Quoted/list tables (including empty columns and edit/Undo prefixes), compound heading paths and the observed six-level embed limit are implemented. Typography corrections are covered by measured-style assertions. Full visual acceptance across themes/widths and advanced container cases remain open. + +Progress log 2026-10-29: user authorized implementation. Critical fixes include regression fixtures, real CodeMirror browser checks and independent review; note source remains unchanged during rendering. Detailed evidence, scope and remaining work: `docs/superpowers/plans/2026-10-29-rendering-parity-progress.md`. No deployment in this batch. + +## Color and selection formatting — 2026-10-29 + +Cập nhật lần cuối: 2026-10-29. + +- [x] FR-2: text/background palettes and reset on existing toolbars; Obsidian-compatible source and safe preview rendering. +- [x] FR-2: floating selection toolbar, selection preservation, viewport placement, Escape and read-only guards. +- [x] Verify commands, rendering, browser interactions, full tests, typecheck and build. Final run: 186 server + 205 web tests pass (7 Windows symlink skips); 48 browser assertions across desktop/mobile, typecheck, build and disposable HTTP smoke pass. Independent review findings fixed with regressions for nested spans, Markdown block prefixes and inline code. + +Design/implementation: `docs/superpowers/plans/2026-10-29-color-toolbar.md`. + +## Literal angle-bracket text in Live Preview — 2026-10-29 + +Cập nhật lần cuối: 2026-10-29. + +- [x] FR-2: preserve `` as literal text in inline and standalone positions (including lists/quotes), without changing note source; retain ordinary HTML rendering. +- [x] Verify the regression in a hidden browser with the caret inside/outside the line and in Reading mode. Independent review caught nested-container recognition; all 16 browser checks pass. Final verification: 186 server + 194 web tests pass (7 Windows symlink skips), typecheck, build and temporary-vault integration smoke pass. + +## Rendering dependency remediation — 2026-10-29 + +- [x] Investigate inherited-trust boundary and both KaTeX copies independently; reproduce six failures. +- [x] Upgrade KaTeX 0.18.10/Mermaid 12.2.0; audit low2 ->0, every severity now gated in CI. +- [x] Verify all types, 186 server/178 web tests locally, all builds, HTTP and Windows packaging/runtime. +- [x] Independent candidate review found no confirmed surviving bypass or compatibility regression. +- [x] Hidden Electron fixture verifies inline/display math, math-labelled flowchart and sequence diagram + in live, reading and separate Preview; unsafe links/images blocked, no external requests. +- [x] Linux/Docker/MCP CI passed at `6c21cdb`: 193 server +178 web tests, 31 smoke assertions, + zero-vulnerability audit, all builds and Linux desktop directory packaging. + Evidence: https://github.com/macros0/webobsidian/actions/runs/40849754338 (PR #5). + +Use disposable fixtures only; the production installation and real vault remain untouched. + +## Moderate dependency remediation — 2026-10-29 + +- [x] Confirm baseline6 moderate /0 high /0 critical and investigate boundaries independently. +- [x] Reproduce encoded-scheme, query coercion, IPv6 classification and compiler CORS regressions. +- [x] Upgrade all six targets; audit moderate6 ->0 and complete KaTeX/Mermaid entries/declarations unchanged. +- [x] Types, 186 server/168 web tests locally, all builds, temporary HTTP, Windows packaging/runtime/renderer pass. +- [x] Independent candidate review found no confirmed surviving bypass or compatibility regression. +- [x] Linux/Docker/MCP CI passed at `1c12d10`: 193 server +168 web tests, 31 smoke assertions, + moderate audit gate, builds and Linux desktop directory packaging. + Evidence: https://github.com/macros0/webobsidian/actions/runs/40846431268 (PR #4). + +Only disposable test services are started; the installed server and real vault are untouched. + +## High dependency remediation — 2026-10-29 + +- [x] Audit baseline: 8 high / 0 critical; independent boundary and compatibility investigation. +- [x] Add bounded-collection security regression and fresh/legacy settings compatibility controls. +- [x] Upgrade parents and migrate settings defaults; audit reduced high8 ->0, critical remains0. +- [x] Verify types, 177 server/168 web tests locally, all builds, HTTP/uploads and Windows packaging/runtime. +- [x] Independent candidate review found no confirmed surviving bypass or compatibility regression. +- [x] Linux/Docker CI passed at `08188bb`: 184 server +168 web tests, 31 smoke assertions, + MCP stdio/schema constraints, high/critical audit, HTTP controls and Linux desktop packaging. + Evidence: https://github.com/macros0/webobsidian/actions/runs/40840116331 (PR #3). + +Production and real vaults remain outside scope; lower-severity unrelated migrations are deferred. + +## Critical dependency remediation — 2026-10-29 + +- [x] Capture npm audit baseline and investigate runtime/tooling boundaries independently. +- [x] Reproduce proxy trust and VISUAL parser defects with legitimate controls. +- [x] Upgrade supported dependency parents/transitive patches; audit critical entries reduced 9 to 0. +- [x] Verify types, regressions, Git clone/sync, all builds, Windows packaging and bundled-server startup. +- [x] Review candidate independently; reproduce and fix test Git config isolation without unsafe allowances. +- [x] Linux/Docker CI passed at `9aa361a`: 180 server + 168 web tests, 31 inherited smoke assertions, + critical audit gate, lockfile guard, integration smoke and desktop directory packaging. + Evidence: https://github.com/macros0/webobsidian/actions/runs/40837364949 (PR #2). + +Scope excludes production installation and unrelated high/moderate dependency upgrades. + +## Community integration — 2026-10-29 + +- [x] Create `macros0/webobsidian` and dedicated local checkout. +- [x] Merge pinned Pham and Lakyle source branches, preserving both histories. +- [x] Resolve editor, rendering, tree, state, server and documentation conflicts. +- [x] Default trash retention to zero; test new and legacy settings. +- [x] Verify build, tests and isolated HTTP integration; independent review fixes covered by tests. +- [x] Publish reviewed integration branch in PR #1; Linux CI passed all tests, smoke checks and builds. + +The following source-fork records are retained for provenance. Current evidence is in +`docs/FORK_INTEGRATION.md`; deployment is outside this task. + > Track tiến độ phát triển. Tham chiếu thiết kế: [PRD.md](PRD.md). > Quy ước: `[ ]` chưa làm · `[~]` đang làm · `[x]` xong. > Cập nhật file này **mỗi khi** một mục thay đổi trạng thái. -Cập nhật lần cuối: 2026-06-27 (security fix — chặn leo thang quyền token share; merge fix F-03 rate-limit, giữ `trust proxy` mặc định bật) +Cập nhật lần cuối: 2026-09-30 (Phase 45 — danh sách giá trị cho thuộc tính đóng: nút ▾ cạnh `status`/`priority`/… — FR-23, issue #61) + +--- + +## Phase 17 — Review bản production: sửa lỗi UX/bảo mật/hiệu năng — FR-2/FR-3/FR-11/FR-15/NFR +- [x] M17.1 Bảng không bẻ chữ giữa từ; bảng rộng cuộn ngang trong khung riêng (live/reading, desktop + mobile) +- [x] M17.2 Rate limit login theo `CLIENT_IP_HEADER` (vd `CF-Connecting-IP`) khi peer là proxy tin cậy + unit test +- [x] M17.3 WebSocket: client tự reconnect (backoff), server heartbeat 30s, `GET /ws` không upgrade → 426 +- [x] M17.4 Tasks board: cột co giãn 240–340px, nhãn "N hidden" +- [x] M17.5 Graph: fit-to-view một lần khi layout lắng, ẩn nhãn chồng nhau, footer "N nodes · M notes" +- [x] M17.6 Setting `ui.showInlineTitle` (Appearance → Show inline title) +- [x] M17.7 Recent/Bookmarks: hiện thư mục cha khi trùng tên file +- [x] M17.8 Snippet tìm kiếm bỏ cú pháp Markdown, giữ highlight (+ test); sửa line-clamp lộ dòng 3 +- [x] M17.9 Trang login dùng theme cache (localStorage) — không loé nền sáng +- [x] M17.10 Mobile: bỏ `maximum-scale=1`, ô nhập 16px (chặn iOS auto-zoom) +- [x] M17.11 `/assets/*` cache `max-age=1y, immutable` + +--- + +## Phase 16 — Build identity & deploy truthfulness — FR-9 +- [x] M16.1 `/healthz` trả `{ok, version, build}` (version = package.json repo, build = git commit nhúng lúc build qua `--build-arg GIT_SHA`) +- [x] M16.2 `deploy/deploy.sh` truyền build arg + `ensure_running_image` (phát hiện container đang chạy image cũ → `--force-recreate`, fail nếu vẫn không khớp) +- [x] M16.3 Smoke test assert `build` của deployment == commit vừa deploy (chống deploy "no-op") +- [x] M16.4 `docs/DEPLOYMENT.md` mục "Which version is running, and how to verify it" (curl, docker inspect, GitHub Actions, marker trên UI) + +--- + +## Phase 15 — Deploy pipeline (LXC 107) & CI/CD deploy-on-merge — FR-9 +- [x] M15.1 Sửa healthcheck IPv4 (`127.0.0.1`) trong `docker-compose.yml` + `Dockerfile` (bug `localhost` → `::1`) +- [x] M15.2 `deploy/deploy.sh` — idempotent: sync → backup rolling → tag rollback → build → `up -d` → wait healthy → smoke → tự rollback +- [x] M15.3 `deploy/smoke.sh` — assert hành vi bản fork trên deployment đang chạy (`/auth/status` chỉ có `passwordSet`, `123456` bị từ chối khi đã có credential, login bằng password operator) +- [x] M15.4 `.github/workflows/deploy.yml` — `workflow_run` sau CI xanh cho push vào `main` + `workflow_dispatch`, concurrency, chạy trên self-hosted runner +- [x] M15.5 Self-hosted runner trong LXC 107 (labels `webobsidian-107`) + service systemd +- [x] M15.6 Migrate LXC 107 sang bản fork (replace checkout upstream, giữ nguyên vault + volume `/data`), xoá override local + prune build cache +- [x] M15.7 Kiểm chứng sau migrate: data nguyên vẹn, login thật hoạt động, container healthy, URL public phục vụ bản fork +- [x] M15.8 `docs/DEPLOYMENT.md` (layout, quy trình, runbook, backup/rollback, ghi lại lần migrate) + +--- + +## Phase 14 — CLI Process Manager (`webo`) — FR-14 +- [x] M14.1 Workspace `packages/webo` khởi tạo với TypeScript + CLI entry (`bin.ts`) +- [x] M14.2 Server graceful shutdown: thêm handler SIGTERM/SIGINT trong `server/src/index.ts` giải phóng HTTP, WebSocket, file watcher, và autosync +- [x] M14.3 Implementing `webo` subcommands: `install`, `start`, `stop`, `restart`, `status`, `logs`, `config`, `uninstall` +- [x] M14.4 Setup PID file (`~/.webobsidian/webo.pid`), log file (`webo.log`), và scaffold configuration (`~/.webobsidian/.env`) +- [x] M14.5 Root package scripts (`npm run webo`) & documentation trong README.md / PRD.md / CHANGELOG.md +Cập nhật lần cuối: 2026-10-16 (issue #36 reveal active file in explorer; floating document outline #32; manual file/folder sorting kéo-thả theo thư mục #34; ẩn thư mục attachments trong tree; local attachment folders + nút xoá ảnh #30; trash retention; fix hanging indent list/task #20; nút xoá nhanh trong file tree + confirm trong app; double-click inline rename #19; trước đó: hanging indent list/task/ordered; multi-cursor #10; link preview card #7) --- @@ -30,6 +259,9 @@ Cập nhật lần cuối: 2026-06-27 (security fix — chặn leo thang quyền ## Phase 3 — Vault filesystem — FR-1 - [x] M3.1 Service vault: list tree, read, write, create, rename/move, delete→trash - [x] M3.2 Path traversal guard + allowedRoots +- [x] M3.7 Symlink vault roots: walks của `listTree`/`copy`/`listMarkdownFiles`/`buildFileIndex` theo symlink + (folder/file, kể cả trỏ ra ngoài vault root nếu realpath trong allowedRoots; link hỏng bỏ qua), cycle + guard bằng `realpath`; `assertRealpathInVault` kiểm tra đa allowedRoots; `fs.cp` bật `dereference: true` - [x] M3.3 Upload attachments (binary), serve binary với mime - [x] M3.4 Folder browser an toàn để chọn vault path - [x] M3.5 Filesystem watcher (chokidar) → events qua WebSocket @@ -82,6 +314,8 @@ Cập nhật lần cuối: 2026-06-27 (security fix — chặn leo thang quyền - [x] M9.9 Theme Obsidian-like (dark/light) - [x] M9.10 Navigation back/forward (toolbar ←/→ trên mọi view, history stack) - [x] M9.11 Search: filter/sort (match case, collapse, more context, sort) + sticky query box +- [x] M9.12 Preview tabs: reuse one italicized tab while browsing; double-click or edit to keep open; + preserve permanent tabs and workspace state, and verify navigation and rapid note selection. ## Phase 10 — Docker & docs — FR-9 - [x] M10.1 Multi-stage `Dockerfile` (web build → server runtime, git+git-lfs) @@ -428,8 +662,664 @@ Cập nhật lần cuối: 2026-06-27 (security fix — chặn leo thang quyền GitHub Release draft, `GH_TOKEN`, `CSC_IDENTITY_AUTO_DISCOVERY=false`). `ci.yml` thêm typecheck + build bundle desktop. Root scripts `desktop`/`desktop:dist`/`desktop:publish`; `.gitignore` thêm `desktop/.gen`, `desktop/release`. +- [x] M27.6 Chuẩn bị release v0.1.2 cho fork `lakylekidd/webobsidian`: bump root + desktop theo lịch sử v0.1.1, + đồng bộ lockfile, publish target/homepage/download links trỏ về fork; kiểm chứng typecheck + build + web/server/desktop OK. Workflow fork đang active; push annotated tag `v0.1.2` để CI tạo draft release, + chỉ Publish sau khi cả ba runner hoàn thành. + +- [x] M27.7 External media embeds (#6): URL YouTube/Instagram/Facebook đứng riêng một dòng render inline + (Reading, Live Preview, Public Share); whitelist trong `web/src/lib/embeds.ts` (+ bản server), iframe + dựng lại từ ID đã validate sau sanitize; CSP `frame-src` chỉ thêm 3 domain. + +## Phase 28 — Inline rename trong file tree (FR-1, issue #19) +- [x] M28.1 Double-click tên file/folder để vào inline rename qua `RenameInput` hiện có; giữ Rename context menu, + Enter xác nhận, Escape huỷ, click đơn vẫn xử lý bình thường. Web typecheck + production build sạch. + `Editor.tsx` không `v.focus()` khi đang rename (double-click note chưa mở: editor mount cướp focus làm input bị blur/đóng). + +## Phase 29 — List hanging indent compatibility (FR-2, issue #20) +- [x] M29.1 Tạo prefix indent bằng phép cộng và phép trừ CSS `calc()` thay phép nhân, để hanging indent hoạt động ổn định trên Edge với bullet, numbered, task và nested lists. Typecheck/build sạch; Chromium xác nhận wrapped line thẳng hàng cho bullet, numbered, task và nested list. + +## Phase 30 — Trash retention (FR-1, PRD 1.8) +- [x] M30.1 Setting `vault.trashRetentionDays` (int 0–3650, mặc định 30; 0 = giữ mãi) + validate ở `PUT /api/settings` + ô nhập trong Settings → Vault & Files. +- [x] M30.2 Ghi thời điểm vào trash: `services/trashindex.ts` (`/.trash-index.json`, khoá theo path, lock tuần tự, guard path escape); `vault.trash()` ghi, restore/xoá item cập nhật; `listTrash` trả thời điểm xoá thật. +- [x] M30.3 Purge: `services/trashretention.ts` — chạy sau khi khởi động (15s), mỗi giờ và ngay khi đổi setting; item chưa có index được backfill = "now" (không xoá ngay trash cũ); chỉ log số lượng, không log tên. + +## Phase 31 — Local attachment folders + xoá ảnh (FR-1/FR-2, PRD 1.9, issue #30) +- [x] M31.1 Dán/drop ảnh → `/attachments/` (tự tạo, tên unique), chèn `![](attachments/x.png)` tại caret. +- [x] M31.2 Server: `GET /files/content|resolve` nhận `from` (resolve tương đối theo note, fallback basename); `GET /files/references`; `DELETE /files?permanent=1`. +- [x] M31.3 Icon thùng rác khi hover ảnh (Live Preview + Reading): gỡ tham chiếu, kiểm tra tham chiếu khác, xoá vĩnh viễn hoặc cảnh báo + chỉ gỡ khỏi note. + +## Phase 32 — Manual sorting trong file explorer (FR-1, issue #34) +- [x] M32.1 Thêm sort mode `manual` vào `treeSort` (persist trong uistate), menu "Change sort order" có mục Manual. +- [x] M32.2 Lưu metadata thứ tự thủ công theo từng thư mục (`manualOrder`: key = parent folder path, value = child paths) và reconcile khi tree thay đổi để giữ thứ tự cũ, item mới append cuối. +- [x] M32.3 Drag-and-drop ở Manual mode: thả lên sibling row để reorder file/folder trong cùng thư mục; không rename file/folder. +- [x] M32.4 Chuyển sang mode sort khác không xoá metadata manual; chuyển lại Manual khôi phục thứ tự trước đó. + +## Phase 33 — Reveal active file in explorer (FR-1, issue #36) +- [x] M33.1 Thêm setting `Reveal active file in explorer` trong Settings → Vault & Files, dùng chung state `autoReveal` đã có (persist qua uistate), đồng bộ wording với nút toggle ở header Files. + +## Phase 32 — Live Preview: click đúng dòng (height map của CodeMirror) — FR-2 (theo yêu cầu người dùng) +- [x] M32.1 Xác định nguyên nhân bằng browser thật (Chromium + CDP, dev instance, vault test dựng riêng): + CodeMirror đo block theo border-box rect và giả định các block xếp liền nhau → `margin` dọc giữa hai + block không vào height map → map ngắn hơn DOM (đo: title+properties+table = −76px) → click phía dưới + rơi xuống 1–2 dòng. Bằng chứng trước/sau: 17/22 click lệch 1 dòng → 60/60 click đúng dòng. +- [x] M32.2 Sửa: bỏ `margin` dọc trên mọi block widget của editor, thay bằng `padding` trên đúng box mà + CodeMirror đo — `.cm-inline-title`, `.cm-properties` (shell trong `FrontmatterWidget.toDOM`), + `.cm-table-wrap` (+ `display:block; width:fit-content` để bỏ ~7px của line box ẩn do `inline-block`), + `.cm-html-preview`, `.cm-html-block`, `.cm-mermaid`. Margin **bên trong** block có padding vẫn giữ. +- [x] M32.3 Ảnh/iframe load sau khi CodeMirror đo → map thiếu đúng chiều cao ảnh: thêm + `mediaLoadRemeasure` (re-measure khi `load`/`error` trong editor). +- [x] M32.4 Guard chống tái phạm: `web/tests/editorSpacing.test.ts` (CI, fail khi có margin dọc trên block + của editor; self-check của parser) + `livePreviewGeometryGuard` (dev-only, warn khi map ngắn hơn nội + dung render). Quy ước ghi ở README › *Live Preview geometry* và CONTRIBUTING. +- [x] M32.5 Kiểm chứng: `npm test` + typecheck + build sạch; audit hình học trên 16 note test (mỗi loại + widget một note) cho `map height == rendered height`; layout các block khác không lệch 1px so với + trước khi sửa (chỉ khoảng trắng "ảo" dưới table mất đi). + +## Phase 33 — Dark mode: caret + panel Find & Replace của CodeMirror theo theme — FR-2 (theo yêu cầu người dùng) +- [x] M33.1 Xác định nguyên nhân: `drawSelection()` ẩn caret gốc và vẽ `.cm-cursor` với màu hard-code + `black`; `.cm-panels` (Find & Replace) hard-code `#f5f5f5`/chữ đen. Cả hai chỉ đổi sang bản `&dark` + khi facet `darkTheme` bật, mà app theme bằng CSS variable trên wrapper `.theme-*` → facet không bao + giờ bật. Đo được trên browser thật: caret `.cm-cursor` = `rgb(0,0,0)` trên nền `rgb(30,30,30)`; + panel `rgb(245,245,245)` + input trắng trên UI tối. +- [x] M33.2 Sửa trong `web/src/styles/obsidian.css`: caret dùng `var(--text-normal)` (kèm `.cm-dropCursor`), + panel/`.cm-textfield`/`button.cm-button` theo palette (`--background-secondary`, `--background-primary`, + `--bg-modifier-border`, `--interactive-accent`, `--text-on-accent`). +- [x] M33.3 Kiểm chứng (CDP + computed style + screenshot có vision đọc lại): caret `#dadada`/nền `#1e1e1e` + (Obsidian Dark — trước là `#000`), `#222222`/trắng (light), `#cdd6f4`/`#1e1e2e` (Catppuccin Mocha); + panel `rgb(38,38,38)`/chữ `#dadada`, light `#f6f6f6`, ctp-mocha `#181825`. Guard: `web/tests/editorTheme.test.ts`. + +## Phase 34 — Tasks view: Kanban board over `type: task` notes — FR-15 (issue #31) +- [x] M34.1 `server/src/services/tasks.ts`: module thuần chuẩn hoá `status`→cột (canonical + alias), + `taskRecordFrom(rel, parsedNote)` (loại trừ folder `templates`), `filterTasks`; unit test + `server/src/services/tasks.test.ts`. +- [x] M34.2 Tích hợp vào QMD index (`server/src/services/search.ts`): `tasks: Map` + tính trong `toDoc`, xoá trong `remove`, reset trong `build`; **không** persist — sau `restore()` lúc + boot gọi `qmd.refreshTasks()` (quét vault 1 lần) để không phục vụ trạng thái cũ sau restart + (test `server/src/services/search.test.ts`); expose `qmd.allTasks()`. +- [x] M34.3 `server/src/routes/tasks.ts` (`GET /api/tasks`, cookie auth) + `agentRouter.get('/tasks', …)` + scope `read` trong `server/src/routes/agent.ts`; mount `/api/tasks` trước `searchRouter` trong + `server/src/index.ts`. Test `server/src/routes/tasks.test.ts` (chọn task, từng filter, 401/403/200). +- [x] M34.4 Compare-and-set trên đường ghi file hiện có: `GET /api/files/content` trả thêm `version` + (`server/src/services/noteversion.ts`, helper `checkVersion`); `PUT /api/files/content` nhận + `baseVersion` tuỳ chọn → lệch (hoặc file đã mất mà `baseVersion ≠ ''`) `409 version_conflict` + (không ghi), absent thì hành vi cũ giữ nguyên. Test CAS trong `routes/tasks.test.ts` + + `services/noteversion.test.ts`. +- [x] M34.5 `web/src/lib/tasks.ts`: twin normalise trạng thái/alias/cột (đồng bộ comment với module + server), `columnsFor`, `columnIdFor`, `isMissingStatus`, `isOverdue`, `moveTask`, `setTaskStatus` + (chèn/thay `status:`/`updated:`, giữ nguyên phần còn lại + line ending), `changeTaskStatus` (dùng + `api`, truyền `version` làm base, propagate lỗi 409). Unit test `web/tests/tasks.test.ts`. +- [x] M34.6 Wiring: `web/src/lib/store.ts` (`TASKS_PATH = 'tasks://view'` + `openTasks()`, mọi chỗ so + sánh `GRAPH_PATH` như virtual view audit lại cho `TASKS_PATH`), `web/src/lib/urlsync.ts` + (`/tasks` ↔ `TASKS_PATH`, `?mode=`), ribbon (icon "Tasks"), command palette ("Open tasks board"). +- [x] M34.7 `web/src/components/TasksView.tsx`: cột + thẻ (title/priority/owner/due/tags/path hint, + dấu chấm "no status"), kéo-thả HTML5 giữa cột + context menu "Move to → …", filter bar + (folder/priority/owner/free-text) + Refresh thủ công + auto-refresh debounce theo sự kiện + `wo-fs`, mode toggle Board|Timeline (Timeline ẩn ở phần 1), empty state link + `Wiki/templates/task.md`, style dark/light qua CSS variable sẵn có. +- [x] M34.8 `deploy/smoke.sh`: assertion `GET /api/tasks` không session → 401; có `env_pw` thì login + + assert 200 với JSON `tasks` array. +- [x] M34.9 Docs: PRD.md (FR-15 + changelog), IMPLEMENTATION_PLAN.md (phase này), CHANGELOG.md + (Unreleased/Added), README.md (feature list), docs/AGENT_API.md (`GET /api/v1/tasks`). +- [x] M34.10 Kiểm chứng thật trên vault fixture: `/tasks` render đúng 6 note `Wiki/tasks/`, cột lạ/thiếu + status đúng quy tắc; kéo thẻ đổi `status:`/`updated:` trong file thật (paste `git diff`); ghi lỗi + (409/mất mạng) → rollback + notify; `curl` `GET /api/tasks` và `GET /api/v1/tasks`. +- [x] M34.11 Kiểm chứng deploy: sau khi merge `a1158ad`, CI xanh → `Deploy (LXC 107)` success; + `curl /healthz` → `build=a1158ad` (== merge commit), `/tasks` HTTP 200, bundle deploy chứa + `tasks://view`; `GET /api/v1/tasks` bằng key scope `read` trả **6 task thật** của vault (template + bị loại, alias `waiting`→`blocked` đúng); 401 khi thiếu key. Xem comment kiểm chứng trên issue #31. + +## Phase 35 — Tasks view: Timeline/Gantt — FR-16 (issue #32) +- [x] M35.1 `web/src/lib/gantt.ts`: module thuần trên **chỉ số ngày UTC** — `parseDay`/`dayToISO`, + `barFor` (raised→created→hôm nay; thiếu `due` → mở; kẹp `due` < start), `computeRange` (pad 3 ngày, + luôn chứa hôm nay, rỗng → ±15 ngày), `barGeometry` (bao gồm cả hai đầu, floor `MIN_BAR_PX`), + `todayX`, `ticksFor` (Day/Week/Month + fallback 1 nhãn). Unit test `web/tests/gantt.test.ts`. +- [x] M35.2 `web/src/components/GanttChart.tsx`: thanh theo trạng thái (màu cột board, lạ → + `status-unknown`), badge priority, quá hạn viền đỏ, mở nét đứt, đường hôm nay, cột nhãn sticky + + nhãn click mở note, zoom Day/Week/Month + nút cuộn về hôm nay, tooltip title·status·owner·ngày. + CSS `.gantt*` trong `web/src/styles/obsidian.css` (gridline theo `--gantt-day-w`). +- [x] M35.3 Nối vào TasksView: `mode` đọc từ store, nút Timeline hiện (bỏ `hidden`), Board|Timeline + chuyển tại chỗ; command palette thêm "Open tasks timeline". +- [x] M35.4 Deep link `/tasks?mode=timeline`: `tasksMode` trong store (không persist) + `pathToUrl(path, + tasksMode)` + `modeFromUrl(pathname, search)`; **sửa bug** URL bị `urlsync` ghi đè thành `/tasks` + khi restore (rơi âm thầm về board) — test hồi quy trong `web/tests/urlsync.test.ts` + kiểm chứng DOM + "reload giữ timeline". +- [x] M35.5 Kiểm chứng thật trên vault fixture (10 note = 6 note thật + 4 fixture biên): headless Chromium + so **hình học từng thanh với kỳ vọng tính độc lập bằng Python** từ frontmatter (10/10 khớp), đường + hôm nay, nhãn trục, 3 mức zoom, lớp overdue/open-ended/unknown, click thanh + nhãn mở note, toggle, + reload giữ timeline, cuộn ngang ở 390px, không lỗi console — 22/22 PASS. +- [x] M35.6 Kiểm chứng deploy: sau merge `5b59ac0`, CI xanh → `Deploy (LXC 107)` success; `curl /healthz` + → `build=5b59ac0`, `/tasks?mode=timeline` HTTP 200, bundle deploy chứa `gantt-bar`/`gantt-day-w`/ + `mode=timeline`; `GET /api/v1/tasks` (key scope `read`) trả 6 task thật của vault — comment trên issue #32. +- [ ] M35.7 Người dùng kiểm tra bằng mắt trên deployment thật (kéo thả của FR-15 + Timeline của FR-16). +- [x] M35.13 `weekZoomPxPerDay`/`daysAheadVisible`: zoom Week theo bề rộng trục, mục tiêu **8 tuần tới** + + 12% ngữ cảnh phía sau, kẹp `[4, 20]` px/ngày; Month còn 3px/ngày để giữ thứ tự zoom; unit test + cho cả ba bề rộng điển hình (rộng/laptop/390px) và trường hợp chạm sàn. +- [x] M35.14 `computeRange` luôn vẽ tới **hôm nay + 56 ngày** (runway 8 tuần) kể cả khi mọi task đến hạn + sớm hơn; test cập nhật theo hợp đồng mới. +- [x] M35.15 Nhãn tick tuần theo mật độ (`Sep 14` ↔ `14`) + quy tắc chống chồng nhãn 24/40px, đường lưới + giữ nguyên; test cho cả ba mức mật độ. +- [x] M35.16 Cột nhãn compact theo bề rộng **pane**; chip "N weeks ahead" trên thanh công cụ; kiểm chứng + headless ở 1440/1000/390px đều đạt **8.0 tuần tới** (42/42 check PASS). +- [x] M35.8 Dải tháng + tick tuần/ngày/tháng, nhãn ngày dạng `Sep 28`; helper thuần `dayToShort`, + `monthLabel`, `isWeekend`, `weekendSpans`, `monthSpans`, `dayGridlines` + unit test. +- [x] M35.9 Lưới phân cấp (hairline ngày / đường tuần / đường tháng 2px) thay cho gradient mỗi ngày; + nền cuối tuần; hôm nay = dải + đường + nhãn `Today`; cột nhãn sticky có bóng đổ. +- [x] M35.10 Thanh: chip priority, tên task trong thanh khi đủ rộng, mờ dần khi mở, viền+sọc khi quá + hạn, focus-visible; cột nhãn nêu **tên trạng thái bằng chữ**; đo tương phản ≥ 4.5:1 cả hai theme. +- [x] M35.11 Compact ≤640px: cột nhãn 132px, meta rút gọn, ẩn tên task trong thanh. +- [x] M35.12 Sửa bug auto-scroll "về hôm nay" (kẹp về 0 lúc chưa có task, `lineX` cũ) — effect phụ + thuộc `[lineX, pxPerDay]`, observe container **và** grid, nhường người dùng khi họ tự cuộn/đổi + zoom; test DOM khẳng định đường hôm nay phải **nằm trong vùng nhìn thấy**. + +## Phase 36 — Tasks view: lọc theo trạng thái, mặc định ẩn Done — FR-15 (issue #39) +- [x] M36.1 `web/src/lib/tasks.ts`: `DEFAULT_HIDDEN_STATUSES` (chỉ `done`), `statusFacets` (4 chuẩn theo + thứ tự cột kể cả 0 thẻ + giá trị lạ theo alphabet, kèm số thẻ), `filterByStatus` (resolve alias + trước khi ẩn), `hiddenByStatus`; unit test trong `web/tests/tasks.test.ts` (alias `closed`→done, + giá trị lạ, thẻ thiếu `status`, số đếm). +- [x] M36.2 TasksView: hàng "Status" với chip có số thẻ + `aria-pressed`, mặc định ẩn `done`; + `visibleTasks` cho timeline; mọi cột vẫn vẽ với `+N hidden` và lý do trong thân cột (cột Done giữ + vai trò chỗ thả); nút `N hidden — show all`. +- [x] M36.3 Kiểm chứng headless: Done ẩn mặc định / các trạng thái khác (kể cả `escalated`) hiện; bật + Done → 10 thanh, tắt → 9; cột Done rỗng với `+1 hidden`; hình học thanh vẫn khớp kỳ vọng Python + (9/9); 51/51 check PASS. + +## Phase 37 — Tasks view: đặt hạn từ board/timeline + quy ước `due` — FR-15 (issue #41) +- [x] M37.1 `web/src/lib/tasks.ts`: tách phép ghi frontmatter dùng chung `writeFrontmatterKeys` (một chỗ lo + BOM/CRLF/thứ tự key), `setTaskStatus`/`setTaskDue` chỉ còn khai báo key; thêm `isUndated`, + `changeTaskDue` (CAS). 9 unit test mới (thay/thêm dòng `due`, `none` không bị quote, tạo frontmatter, + giữ CRLF+BOM, và một test khoá hành vi `setTaskStatus` sau refactor). +- [x] M37.2 Nút hạn trên thẻ (caret ▾, editor tại chỗ) + menu `⋯` "Set due date…"/"Clear due date" + + control tương tự ở cột nhãn timeline (`.gantt-label-cell` tách khỏi nút tiêu đề để không lồng button); + optimistic + rollback + notify. +- [x] M37.3 Chip "Needs a due date" (đếm theo tập đang hiện) + bộ lọc chỉ-hiện-task-chưa-hạn. +- [x] M37.4 Vault: `Wiki/templates/task.md` (`due: YYYY-MM-DD` + quy ước), `Wiki/SCHEMA.md` (`due` bắt + buộc, `none` là ngoại lệ cố ý, hạn đặt từ board); bump `updated` cả hai. Patch skill + `document-to-action-items` + `meeting-action-items`: giữ nguyên "không bịa ngày", thêm yêu cầu + *quyết định* ngày — không có ngày thì ghi `due: none` để hiện ở "Needs a due date". +- [x] M37.5 Kiểm chứng headless 63/63 PASS, gồm 12 check cho hạn: đặt hạn từ thẻ → **đọc file trên đĩa** + xác nhận đúng dòng `due:` được ghi và chỉ `due:`/`updated:` đổi; chip đếm 3 → 2; lọc undated; + timeline có chip "no due" bấm được; Esc không ghi; Clear trả về `due: none`. Hai bug thật do kiểm + chứng bắt: (a) `showPicker()` nuốt phím Enter (bỏ); (b) click **Clear** làm input blur → commit → + editor unmount trước khi click tới nơi (sửa: blur chỉ commit khi focus rời khỏi editor). + +## Phase 38 — Tạo note từ template (New note from template) — FR-17 (issue #42) +- [x] M38.1 `web/src/lib/templates.ts` (thuần, không DOM/không server): `slugify` (bỏ dấu tiếng Việt + gồm cả `đ`/`Đ`, gom ký tự lạ thành `-`, cắt 60 ký tự), `substituteTemplate` (`{{title}}`, + `{{date}}`, `{{time}}`, `{{slug}}` + dạng chữ `YYYY-MM-DD-slug` xử lý **trước** `YYYY-MM-DD`), + `findTemplatesFolder` (BFS, thư mục nông nhất tên `templates`), `listTemplates`, + `targetCandidates` / `resolveTargetFolder` (`+s`, giữ nguyên tên, `y`→`ies`, `+es`, đoạn cuối sau + gạch), `uniqueNotePath` (`-2`, `-3`…). 16 unit test trong `web/tests/templates.test.ts`. +- [x] M38.2 Store: `templatePicker` + `setTemplatePicker`; action `newFromTemplate(templatePath, title, + folder)` đọc template bằng `api.read`, ghi **create-only** (`baseVersion: ''`) và nhảy hậu tố khi + 409, mở note, trả về path; từ chối title không ra slug và thư mục không tồn tại (không ghi gì). + 6 test trong `web/tests/store.test.ts`. +- [x] M38.3 UI: `web/src/components/TemplatePicker.tsx` (lọc template, Title, Folder luôn sửa được, dòng + `Creates ` hiện trước khi ghi, lỗi hiện trong modal), nút ribbon `file-plus`, mục command + palette "New note from template", CSS `.tpl-*` trong `obsidian.css`. +- [x] M38.4 Kiểm chứng: `npm test` **143 server + 127 web** PASS; `npm run typecheck` (4 workspace) PASS; + `npm run build` PASS; **headless Chromium trên bản COPY của vault thật**: modal liệt kê đủ 9 + template, `meeting` → `Wiki/meetings`, tên dự đoán khớp file thật, note mở thành tab active, tên + trùng → `-2` (file đầu không đổi), thư mục sai → "Folder not found" và không tạo thư mục; **0 + request lỗi, 0 pageerror/console error**; `deploy/smoke.sh` **7/7 PASS** trên server local. +- [x] M38.5 PR #44 → merge commit **6d86574**, deploy đã chứng minh: `https://webobsidian.digitalciapp.com/healthz` + trả `{"ok":true,"version":"0.1.1","build":"6d86574"}`; bundle trong image đã deploy chứa chuỗi + marker (`docker exec webobsidian grep -rl "New note from template" /app` → `index-BnoYvYat.js`, 3 lần — + đúng bundle đã kiểm chứng headless ở M38.4); `/`, `/tasks` và deep link `/note/Wiki/reviews/...` đều 200; + vault sau deploy: 9 template + 2 meeting nguyên vẹn, lint CLEAN. + +## Phase 39 — Sửa lỗi Template picker: chọn bằng click, thư mục bắt buộc — FR-17 (issue #46) +- [x] M39.1 Bỏ `onMouseEnter` khỏi hàng template (hover trước đây đặt đúng state mà click đặt, nên hover đã + chọn template và click trở nên vô nghĩa), bỏ template chọn sẵn, hàng chuyển thành `