stellavault 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/core/dist/api/dashboard.d.ts +3 -0
- package/packages/core/{src/api/dashboard.ts → dist/api/dashboard.js} +8 -11
- package/packages/core/dist/api/graph-data.d.ts +11 -0
- package/packages/core/dist/api/graph-data.js +255 -0
- package/packages/core/dist/api/pwa.d.ts +3 -0
- package/packages/core/{src/api/pwa.ts → dist/api/pwa.js} +27 -32
- package/packages/core/dist/api/server.d.ts +16 -0
- package/packages/core/dist/api/server.js +718 -0
- package/packages/core/dist/capture/voice.d.ts +24 -0
- package/packages/core/dist/capture/voice.js +135 -0
- package/packages/core/{src/cloud/index.ts → dist/cloud/index.d.ts} +1 -0
- package/packages/core/dist/cloud/index.js +2 -0
- package/packages/core/dist/cloud/sync.d.ts +29 -0
- package/packages/core/dist/cloud/sync.js +137 -0
- package/packages/core/dist/config.d.ts +27 -0
- package/packages/core/dist/config.js +55 -0
- package/packages/core/dist/federation/credits.d.ts +26 -0
- package/packages/core/dist/federation/credits.js +56 -0
- package/packages/core/dist/federation/identity.d.ts +14 -0
- package/packages/core/dist/federation/identity.js +74 -0
- package/packages/core/{src/federation/index.ts → dist/federation/index.d.ts} +1 -2
- package/packages/core/dist/federation/index.js +5 -0
- package/packages/core/dist/federation/node.d.ts +31 -0
- package/packages/core/dist/federation/node.js +216 -0
- package/packages/core/dist/federation/privacy.d.ts +8 -0
- package/packages/core/dist/federation/privacy.js +40 -0
- package/packages/core/dist/federation/reputation.d.ts +37 -0
- package/packages/core/dist/federation/reputation.js +139 -0
- package/packages/core/dist/federation/search.d.ts +19 -0
- package/packages/core/dist/federation/search.js +101 -0
- package/packages/core/dist/federation/sharing.d.ts +72 -0
- package/packages/core/dist/federation/sharing.js +246 -0
- package/packages/core/dist/federation/trust.d.ts +15 -0
- package/packages/core/dist/federation/trust.js +60 -0
- package/packages/core/dist/federation/types.d.ts +40 -0
- package/packages/core/dist/federation/types.js +3 -0
- package/packages/core/dist/i18n/index.d.ts +6 -0
- package/packages/core/dist/i18n/index.js +81 -0
- package/packages/core/{src/index.ts → dist/index.d.ts} +46 -65
- package/packages/core/dist/index.js +69 -0
- package/packages/core/dist/indexer/chunker.d.ts +14 -0
- package/packages/core/dist/indexer/chunker.js +148 -0
- package/packages/core/dist/indexer/embedder.d.ts +8 -0
- package/packages/core/dist/indexer/embedder.js +3 -0
- package/packages/core/dist/indexer/index.d.ts +28 -0
- package/packages/core/dist/indexer/index.js +74 -0
- package/packages/core/dist/indexer/local-embedder.d.ts +3 -0
- package/packages/core/dist/indexer/local-embedder.js +29 -0
- package/packages/core/dist/indexer/scanner.d.ts +11 -0
- package/packages/core/dist/indexer/scanner.js +137 -0
- package/packages/core/dist/indexer/watcher.d.ts +19 -0
- package/packages/core/dist/indexer/watcher.js +49 -0
- package/packages/core/dist/intelligence/code-linker.d.ts +20 -0
- package/packages/core/dist/intelligence/code-linker.js +88 -0
- package/packages/core/dist/intelligence/contradiction-detector.d.ts +20 -0
- package/packages/core/dist/intelligence/contradiction-detector.js +115 -0
- package/packages/core/dist/intelligence/decay-engine.d.ts +27 -0
- package/packages/core/dist/intelligence/decay-engine.js +190 -0
- package/packages/core/dist/intelligence/duplicate-detector.d.ts +20 -0
- package/packages/core/dist/intelligence/duplicate-detector.js +55 -0
- package/packages/core/dist/intelligence/fsrs.d.ts +43 -0
- package/packages/core/dist/intelligence/fsrs.js +70 -0
- package/packages/core/dist/intelligence/gap-detector.d.ts +25 -0
- package/packages/core/dist/intelligence/gap-detector.js +78 -0
- package/packages/core/dist/intelligence/learning-path.d.ts +31 -0
- package/packages/core/dist/intelligence/learning-path.js +53 -0
- package/packages/core/dist/intelligence/notifications.d.ts +31 -0
- package/packages/core/dist/intelligence/notifications.js +65 -0
- package/packages/core/dist/intelligence/predictive-gaps.d.ts +14 -0
- package/packages/core/dist/intelligence/predictive-gaps.js +74 -0
- package/packages/core/dist/intelligence/semantic-versioning.d.ts +37 -0
- package/packages/core/dist/intelligence/semantic-versioning.js +68 -0
- package/packages/core/dist/intelligence/types.d.ts +28 -0
- package/packages/core/dist/intelligence/types.js +3 -0
- package/packages/core/dist/mcp/custom-tools.d.ts +29 -0
- package/packages/core/dist/mcp/custom-tools.js +70 -0
- package/packages/core/{src/mcp/index.ts → dist/mcp/index.d.ts} +1 -0
- package/packages/core/dist/mcp/index.js +2 -0
- package/packages/core/dist/mcp/server.d.ts +49 -0
- package/packages/core/dist/mcp/server.js +151 -0
- package/packages/core/dist/mcp/tools/agentic-graph.d.ts +87 -0
- package/packages/core/dist/mcp/tools/agentic-graph.js +88 -0
- package/packages/core/dist/mcp/tools/brief.d.ts +31 -0
- package/packages/core/dist/mcp/tools/brief.js +39 -0
- package/packages/core/dist/mcp/tools/decay.d.ts +33 -0
- package/packages/core/dist/mcp/tools/decay.js +32 -0
- package/packages/core/dist/mcp/tools/decision-journal.d.ts +78 -0
- package/packages/core/dist/mcp/tools/decision-journal.js +79 -0
- package/packages/core/dist/mcp/tools/detect-gaps.d.ts +24 -0
- package/packages/core/dist/mcp/tools/detect-gaps.js +47 -0
- package/packages/core/dist/mcp/tools/export.d.ts +29 -0
- package/packages/core/dist/mcp/tools/export.js +60 -0
- package/packages/core/dist/mcp/tools/federated-search.d.ts +29 -0
- package/packages/core/dist/mcp/tools/federated-search.js +36 -0
- package/packages/core/dist/mcp/tools/generate-claude-md.d.ts +35 -0
- package/packages/core/dist/mcp/tools/generate-claude-md.js +107 -0
- package/packages/core/dist/mcp/tools/get-document.d.ts +35 -0
- package/packages/core/dist/mcp/tools/get-document.js +25 -0
- package/packages/core/dist/mcp/tools/get-evolution.d.ts +28 -0
- package/packages/core/dist/mcp/tools/get-evolution.js +70 -0
- package/packages/core/dist/mcp/tools/get-related.d.ts +32 -0
- package/packages/core/dist/mcp/tools/get-related.js +33 -0
- package/packages/core/dist/mcp/tools/learning-path.d.ts +23 -0
- package/packages/core/dist/mcp/tools/learning-path.js +45 -0
- package/packages/core/dist/mcp/tools/link-code.d.ts +34 -0
- package/packages/core/dist/mcp/tools/link-code.js +44 -0
- package/packages/core/dist/mcp/tools/list-topics.d.ts +15 -0
- package/packages/core/dist/mcp/tools/list-topics.js +18 -0
- package/packages/core/dist/mcp/tools/search.d.ts +39 -0
- package/packages/core/dist/mcp/tools/search.js +29 -0
- package/packages/core/dist/mcp/tools/snapshot.d.ts +47 -0
- package/packages/core/dist/mcp/tools/snapshot.js +84 -0
- package/packages/core/dist/multi-vault/index.d.ts +26 -0
- package/packages/core/dist/multi-vault/index.js +80 -0
- package/packages/core/dist/pack/creator.d.ts +21 -0
- package/packages/core/dist/pack/creator.js +105 -0
- package/packages/core/dist/pack/exporter.d.ts +4 -0
- package/packages/core/dist/pack/exporter.js +18 -0
- package/packages/core/dist/pack/importer.d.ts +10 -0
- package/packages/core/dist/pack/importer.js +55 -0
- package/packages/core/{src/pack/index.ts → dist/pack/index.d.ts} +1 -0
- package/packages/core/dist/pack/index.js +5 -0
- package/packages/core/dist/pack/marketplace.d.ts +14 -0
- package/packages/core/dist/pack/marketplace.js +90 -0
- package/packages/core/dist/pack/pii-masker.d.ts +7 -0
- package/packages/core/dist/pack/pii-masker.js +29 -0
- package/packages/core/dist/pack/types.d.ts +36 -0
- package/packages/core/dist/pack/types.js +3 -0
- package/packages/core/dist/plugins/index.d.ts +35 -0
- package/packages/core/dist/plugins/index.js +57 -0
- package/packages/core/dist/plugins/webhooks.d.ts +30 -0
- package/packages/core/dist/plugins/webhooks.js +79 -0
- package/packages/core/dist/search/adaptive.d.ts +16 -0
- package/packages/core/dist/search/adaptive.js +67 -0
- package/packages/core/dist/search/bm25.d.ts +4 -0
- package/packages/core/dist/search/bm25.js +10 -0
- package/packages/core/dist/search/index.d.ts +15 -0
- package/packages/core/dist/search/index.js +64 -0
- package/packages/core/dist/search/rrf.d.ts +7 -0
- package/packages/core/dist/search/rrf.js +21 -0
- package/packages/core/dist/search/semantic.d.ts +5 -0
- package/packages/core/dist/search/semantic.js +6 -0
- package/packages/core/{src/store/index.ts → dist/store/index.d.ts} +1 -0
- package/packages/core/dist/store/index.js +2 -0
- package/packages/core/dist/store/sqlite-vec.d.ts +6 -0
- package/packages/core/dist/store/sqlite-vec.js +251 -0
- package/packages/core/dist/store/types.d.ts +20 -0
- package/packages/core/dist/store/types.js +3 -0
- package/packages/core/dist/team/index.d.ts +25 -0
- package/packages/core/dist/team/index.js +97 -0
- package/packages/core/dist/types/chunk.d.ts +23 -0
- package/packages/core/dist/types/chunk.js +3 -0
- package/packages/core/dist/types/document.d.ts +23 -0
- package/packages/core/dist/types/document.js +3 -0
- package/packages/core/dist/types/graph.d.ts +39 -0
- package/packages/core/dist/types/graph.js +3 -0
- package/packages/core/dist/types/index.d.ts +5 -0
- package/packages/core/dist/types/index.js +2 -0
- package/packages/core/dist/types/search.d.ts +39 -0
- package/packages/core/dist/types/search.js +3 -0
- package/packages/core/dist/utils/retry.d.ts +25 -0
- package/packages/core/dist/utils/retry.js +59 -0
- package/.github/workflows/pages.yml +0 -37
- package/memory/MEMORY.md +0 -25
- package/packages/cli/dist/commands/brief-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/brief-cmd.js.map +0 -1
- package/packages/cli/dist/commands/capture-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/capture-cmd.js.map +0 -1
- package/packages/cli/dist/commands/card-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/card-cmd.js.map +0 -1
- package/packages/cli/dist/commands/clip-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/clip-cmd.js.map +0 -1
- package/packages/cli/dist/commands/cloud-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/cloud-cmd.js.map +0 -1
- package/packages/cli/dist/commands/contradictions-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/contradictions-cmd.js.map +0 -1
- package/packages/cli/dist/commands/decay-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/decay-cmd.js.map +0 -1
- package/packages/cli/dist/commands/digest-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/digest-cmd.js.map +0 -1
- package/packages/cli/dist/commands/duplicates-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/duplicates-cmd.js.map +0 -1
- package/packages/cli/dist/commands/federate-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/federate-cmd.js.map +0 -1
- package/packages/cli/dist/commands/gaps-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/gaps-cmd.js.map +0 -1
- package/packages/cli/dist/commands/graph-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/graph-cmd.js.map +0 -1
- package/packages/cli/dist/commands/index-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/index-cmd.js.map +0 -1
- package/packages/cli/dist/commands/init-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/init-cmd.js.map +0 -1
- package/packages/cli/dist/commands/learn-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/learn-cmd.js.map +0 -1
- package/packages/cli/dist/commands/pack-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/pack-cmd.js.map +0 -1
- package/packages/cli/dist/commands/review-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/review-cmd.js.map +0 -1
- package/packages/cli/dist/commands/search-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/search-cmd.js.map +0 -1
- package/packages/cli/dist/commands/serve-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/serve-cmd.js.map +0 -1
- package/packages/cli/dist/commands/status-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/status-cmd.js.map +0 -1
- package/packages/cli/dist/commands/sync-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/sync-cmd.js.map +0 -1
- package/packages/cli/dist/commands/vault-cmd.d.ts.map +0 -1
- package/packages/cli/dist/commands/vault-cmd.js.map +0 -1
- package/packages/cli/dist/index.d.ts.map +0 -1
- package/packages/cli/dist/index.js.map +0 -1
- package/packages/cli/src/commands/brief-cmd.ts +0 -87
- package/packages/cli/src/commands/capture-cmd.ts +0 -34
- package/packages/cli/src/commands/card-cmd.ts +0 -29
- package/packages/cli/src/commands/clip-cmd.ts +0 -172
- package/packages/cli/src/commands/cloud-cmd.ts +0 -75
- package/packages/cli/src/commands/contradictions-cmd.ts +0 -41
- package/packages/cli/src/commands/decay-cmd.ts +0 -57
- package/packages/cli/src/commands/digest-cmd.ts +0 -89
- package/packages/cli/src/commands/duplicates-cmd.ts +0 -38
- package/packages/cli/src/commands/federate-cmd.ts +0 -256
- package/packages/cli/src/commands/gaps-cmd.ts +0 -40
- package/packages/cli/src/commands/graph-cmd.ts +0 -88
- package/packages/cli/src/commands/index-cmd.ts +0 -65
- package/packages/cli/src/commands/init-cmd.ts +0 -145
- package/packages/cli/src/commands/learn-cmd.ts +0 -56
- package/packages/cli/src/commands/pack-cmd.ts +0 -121
- package/packages/cli/src/commands/review-cmd.ts +0 -125
- package/packages/cli/src/commands/search-cmd.ts +0 -45
- package/packages/cli/src/commands/serve-cmd.ts +0 -17
- package/packages/cli/src/commands/status-cmd.ts +0 -37
- package/packages/cli/src/commands/sync-cmd.ts +0 -68
- package/packages/cli/src/commands/vault-cmd.ts +0 -64
- package/packages/cli/src/index.ts +0 -187
- package/packages/core/src/api/graph-data.ts +0 -286
- package/packages/core/src/api/server.ts +0 -660
- package/packages/core/src/capture/voice.ts +0 -168
- package/packages/core/src/cloud/sync.ts +0 -167
- package/packages/core/src/config.ts +0 -82
- package/packages/core/src/federation/credits.ts +0 -80
- package/packages/core/src/federation/hyperswarm.d.ts +0 -19
- package/packages/core/src/federation/identity.ts +0 -90
- package/packages/core/src/federation/node.ts +0 -235
- package/packages/core/src/federation/privacy.ts +0 -52
- package/packages/core/src/federation/reputation.ts +0 -202
- package/packages/core/src/federation/search.ts +0 -129
- package/packages/core/src/federation/sharing.ts +0 -315
- package/packages/core/src/federation/trust.ts +0 -76
- package/packages/core/src/federation/types.ts +0 -25
- package/packages/core/src/i18n/index.ts +0 -85
- package/packages/core/src/indexer/chunker.ts +0 -180
- package/packages/core/src/indexer/embedder.ts +0 -9
- package/packages/core/src/indexer/index.ts +0 -113
- package/packages/core/src/indexer/local-embedder.ts +0 -35
- package/packages/core/src/indexer/scanner.ts +0 -142
- package/packages/core/src/indexer/watcher.ts +0 -62
- package/packages/core/src/intelligence/contradiction-detector.ts +0 -134
- package/packages/core/src/intelligence/decay-engine.ts +0 -229
- package/packages/core/src/intelligence/duplicate-detector.ts +0 -71
- package/packages/core/src/intelligence/fsrs.ts +0 -79
- package/packages/core/src/intelligence/gap-detector.ts +0 -109
- package/packages/core/src/intelligence/learning-path.ts +0 -86
- package/packages/core/src/intelligence/notifications.ts +0 -106
- package/packages/core/src/intelligence/predictive-gaps.ts +0 -94
- package/packages/core/src/intelligence/semantic-versioning.ts +0 -97
- package/packages/core/src/intelligence/types.ts +0 -28
- package/packages/core/src/mcp/custom-tools.ts +0 -97
- package/packages/core/src/mcp/server.ts +0 -142
- package/packages/core/src/mcp/tools/agentic-graph.ts +0 -96
- package/packages/core/src/mcp/tools/brief.ts +0 -49
- package/packages/core/src/mcp/tools/decay.ts +0 -40
- package/packages/core/src/mcp/tools/decision-journal.ts +0 -95
- package/packages/core/src/mcp/tools/export.ts +0 -72
- package/packages/core/src/mcp/tools/federated-search.ts +0 -43
- package/packages/core/src/mcp/tools/generate-claude-md.ts +0 -130
- package/packages/core/src/mcp/tools/get-document.ts +0 -26
- package/packages/core/src/mcp/tools/get-related.ts +0 -41
- package/packages/core/src/mcp/tools/learning-path.ts +0 -52
- package/packages/core/src/mcp/tools/list-topics.ts +0 -20
- package/packages/core/src/mcp/tools/search.ts +0 -35
- package/packages/core/src/mcp/tools/snapshot.ts +0 -98
- package/packages/core/src/multi-vault/index.ts +0 -118
- package/packages/core/src/pack/creator.ts +0 -127
- package/packages/core/src/pack/exporter.ts +0 -21
- package/packages/core/src/pack/importer.ts +0 -82
- package/packages/core/src/pack/marketplace.ts +0 -103
- package/packages/core/src/pack/pii-masker.ts +0 -38
- package/packages/core/src/pack/types.ts +0 -39
- package/packages/core/src/plugins/index.ts +0 -100
- package/packages/core/src/plugins/webhooks.ts +0 -110
- package/packages/core/src/search/bm25.ts +0 -16
- package/packages/core/src/search/index.ts +0 -83
- package/packages/core/src/search/rrf.ts +0 -31
- package/packages/core/src/search/semantic.ts +0 -15
- package/packages/core/src/store/sqlite-vec.ts +0 -290
- package/packages/core/src/store/types.ts +0 -22
- package/packages/core/src/team/index.ts +0 -126
- package/packages/core/src/types/chunk.ts +0 -25
- package/packages/core/src/types/document.ts +0 -24
- package/packages/core/src/types/graph.ts +0 -44
- package/packages/core/src/types/index.ts +0 -15
- package/packages/core/src/types/search.ts +0 -38
- package/packages/core/src/utils/retry.ts +0 -85
- package/packages/core/tests/api-card.test.ts +0 -60
- package/packages/core/tests/api-routes.test.ts +0 -98
- package/packages/core/tests/bm25.test.ts +0 -87
- package/packages/core/tests/chunker.test.ts +0 -48
- package/packages/core/tests/cluster.test.ts +0 -75
- package/packages/core/tests/constellation.test.ts +0 -77
- package/packages/core/tests/export-utils.test.ts +0 -97
- package/packages/core/tests/fsrs.test.ts +0 -96
- package/packages/core/tests/gesture-detector.test.ts +0 -45
- package/packages/core/tests/graph-data.test.ts +0 -87
- package/packages/core/tests/layout.test.ts +0 -83
- package/packages/core/tests/mcp.test.ts +0 -148
- package/packages/core/tests/pack.test.ts +0 -127
- package/packages/core/tests/pii-masker.test.ts +0 -42
- package/packages/core/tests/profile-card.test.ts +0 -62
- package/packages/core/tests/rrf.test.ts +0 -29
- package/packages/core/tests/search-integration.test.ts +0 -139
- package/packages/core/tests/store.test.ts +0 -80
- package/packages/graph/click-result.png +0 -0
- package/packages/graph/dist/assets/camera_utils-BMxqtvoZ.js +0 -1
- package/packages/graph/dist/assets/hands-DXA01_mx.js +0 -18
- package/packages/graph/dist/assets/index-DMEe2diW.js +0 -4192
- package/packages/graph/dist/assets/layout.worker-DbKCEFTz.js +0 -1
- package/packages/graph/dist/index.html +0 -17
- package/packages/graph/index.html +0 -17
- package/packages/graph/package.json +0 -32
- package/packages/graph/src/App.tsx +0 -7
- package/packages/graph/src/api/client.ts +0 -39
- package/packages/graph/src/components/ClusterFilter.tsx +0 -73
- package/packages/graph/src/components/ConstellationView.tsx +0 -232
- package/packages/graph/src/components/ExportPanel.tsx +0 -177
- package/packages/graph/src/components/Graph3D.tsx +0 -230
- package/packages/graph/src/components/GraphEdges.tsx +0 -100
- package/packages/graph/src/components/GraphNodes.tsx +0 -386
- package/packages/graph/src/components/HealthDashboard.tsx +0 -173
- package/packages/graph/src/components/Layout.tsx +0 -214
- package/packages/graph/src/components/MotionOverlay.tsx +0 -81
- package/packages/graph/src/components/MotionToggle.tsx +0 -33
- package/packages/graph/src/components/MultiverseView.tsx +0 -286
- package/packages/graph/src/components/NodeDetail.tsx +0 -232
- package/packages/graph/src/components/PulseParticle.tsx +0 -232
- package/packages/graph/src/components/SearchBar.tsx +0 -107
- package/packages/graph/src/components/StarField.tsx +0 -197
- package/packages/graph/src/components/StatusBar.tsx +0 -53
- package/packages/graph/src/components/Timeline.tsx +0 -148
- package/packages/graph/src/components/ToolsPanel.tsx +0 -512
- package/packages/graph/src/components/Tooltip.tsx +0 -100
- package/packages/graph/src/components/TypeFilter.tsx +0 -131
- package/packages/graph/src/embed/EmbedGraph.tsx +0 -144
- package/packages/graph/src/hooks/useConstellationLOD.ts +0 -76
- package/packages/graph/src/hooks/useDecay.ts +0 -37
- package/packages/graph/src/hooks/useExport.ts +0 -165
- package/packages/graph/src/hooks/useGraph.ts +0 -69
- package/packages/graph/src/hooks/useKeyboardNav.ts +0 -122
- package/packages/graph/src/hooks/useLayout.ts +0 -45
- package/packages/graph/src/hooks/useMotion.ts +0 -120
- package/packages/graph/src/hooks/usePulse.ts +0 -58
- package/packages/graph/src/hooks/useSearch.ts +0 -71
- package/packages/graph/src/lib/constellation.ts +0 -107
- package/packages/graph/src/lib/export-utils.ts +0 -48
- package/packages/graph/src/lib/gesture-detector.ts +0 -123
- package/packages/graph/src/lib/layout.worker.ts +0 -153
- package/packages/graph/src/lib/motion-controller.ts +0 -83
- package/packages/graph/src/lib/profile-card.ts +0 -122
- package/packages/graph/src/main.tsx +0 -4
- package/packages/graph/src/stores/graph-store.ts +0 -155
- package/packages/graph/success.png +0 -0
- package/packages/graph/test-click.mjs +0 -49
- package/packages/graph/test-explore.mjs +0 -102
- package/packages/graph/test-final.mjs +0 -61
- package/packages/graph/test-graph.mjs +0 -139
- package/packages/graph/test-hover.mjs +0 -48
- package/packages/graph/test-pulse.mjs +0 -68
- package/packages/graph/test-screenshot.mjs +0 -56
- package/packages/graph/test-v2.mjs +0 -97
- package/packages/graph/tsconfig.tsbuildinfo +0 -1
- package/packages/graph/vite.config.ts +0 -15
- package/packages/sync/.env.example +0 -11
- package/packages/sync/.sync-state.json +0 -317
- package/packages/sync/.upload-state.json +0 -1009
- package/packages/sync/create-stella-network-notion.mjs +0 -151
- package/packages/sync/create-stellavault-project-notion.mjs +0 -322
- package/packages/sync/logs/sync-2026-03-28.log +0 -6
- package/packages/sync/logs/sync-2026-03-29.log +0 -12
- package/packages/sync/logs/sync-2026-03-30.log +0 -6
- package/packages/sync/logs/sync-2026-03-31.log +0 -6
- package/packages/sync/logs/sync-2026-04-01.log +0 -6
- package/packages/sync/logs/sync-2026-04-02.log +0 -6
- package/packages/sync/package-lock.json +0 -373
- package/packages/sync/package.json +0 -16
- package/packages/sync/run-sync.bat +0 -18
- package/packages/sync/run-sync.mjs +0 -46
- package/packages/sync/setup-scheduler.mjs +0 -119
- package/packages/sync/structured-sync.mjs +0 -187
- package/packages/sync/sync-to-obsidian.mjs +0 -264
- package/packages/sync/upload-pdca-to-notion.mjs +0 -495
- package/tsconfig.base.json +0 -18
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notion DB → Obsidian vault 구조화 동기화 (Federation Phase 1b)
|
|
3
|
-
*
|
|
4
|
-
* 기존 sync-to-obsidian.mjs는 페이지 계층을 그대로 복사.
|
|
5
|
-
* 이 스크립트는 Notion DB 속성을 frontmatter로 매핑하고,
|
|
6
|
-
* DB 이름에 따라 vault 폴더를 자동 결정합니다.
|
|
7
|
-
*
|
|
8
|
-
* 사용법: node structured-sync.mjs
|
|
9
|
-
* 환경변수: .env (NOTION_API_KEY, NOTION_ROOT_PAGE_ID, OBSIDIAN_PATH)
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { Client } from '@notionhq/client';
|
|
13
|
-
import { NotionToMarkdown } from 'notion-to-md';
|
|
14
|
-
import fs from 'fs';
|
|
15
|
-
import path from 'path';
|
|
16
|
-
import { fileURLToPath } from 'url';
|
|
17
|
-
|
|
18
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
19
|
-
|
|
20
|
-
// .env 로드
|
|
21
|
-
function loadEnv() {
|
|
22
|
-
const envPath = path.join(__dirname, '.env');
|
|
23
|
-
if (!fs.existsSync(envPath)) { console.error('❌ .env 필요'); process.exit(1); }
|
|
24
|
-
for (const line of fs.readFileSync(envPath, 'utf-8').split('\n')) {
|
|
25
|
-
const t = line.trim();
|
|
26
|
-
if (!t || t.startsWith('#')) continue;
|
|
27
|
-
const eq = t.indexOf('=');
|
|
28
|
-
if (eq === -1) continue;
|
|
29
|
-
const k = t.slice(0, eq).trim(), v = t.slice(eq + 1).trim();
|
|
30
|
-
if (!process.env[k]) process.env[k] = v;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
loadEnv();
|
|
34
|
-
|
|
35
|
-
const NOTION_API_KEY = process.env.NOTION_API_KEY;
|
|
36
|
-
const ROOT_PAGE_ID = process.env.NOTION_ROOT_PAGE_ID;
|
|
37
|
-
const OBSIDIAN_PATH = process.env.OBSIDIAN_PATH || './vault';
|
|
38
|
-
|
|
39
|
-
const notion = new Client({ auth: NOTION_API_KEY });
|
|
40
|
-
const n2m = new NotionToMarkdown({ notionClient: notion });
|
|
41
|
-
|
|
42
|
-
// DB 이름 → vault 폴더 매핑
|
|
43
|
-
const DB_FOLDER_MAP = {
|
|
44
|
-
'Projects': '02_Projects',
|
|
45
|
-
'Research': '04_Resources',
|
|
46
|
-
'Meeting Notes': '02_Projects/meetings',
|
|
47
|
-
'Daily Journal': '03_Daily',
|
|
48
|
-
'Knowledge': '01_Knowledge',
|
|
49
|
-
'Resources': '04_Resources',
|
|
50
|
-
'Archive': '06_Archive',
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// Notion 속성 → frontmatter 변환
|
|
54
|
-
function extractFrontmatter(page) {
|
|
55
|
-
const props = page.properties || {};
|
|
56
|
-
const fm = {
|
|
57
|
-
title: '',
|
|
58
|
-
source: 'notion',
|
|
59
|
-
type: 'note',
|
|
60
|
-
tags: [],
|
|
61
|
-
notion_id: page.id,
|
|
62
|
-
synced_at: new Date().toISOString(),
|
|
63
|
-
last_edited: page.last_edited_time,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
for (const [key, prop] of Object.entries(props)) {
|
|
67
|
-
switch (prop.type) {
|
|
68
|
-
case 'title':
|
|
69
|
-
fm.title = prop.title?.map(t => t.plain_text).join('') || '';
|
|
70
|
-
break;
|
|
71
|
-
case 'multi_select':
|
|
72
|
-
if (key.toLowerCase().includes('tag')) {
|
|
73
|
-
fm.tags = prop.multi_select?.map(s => s.name) || [];
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
case 'select':
|
|
77
|
-
if (key.toLowerCase().includes('type') || key.toLowerCase().includes('category')) {
|
|
78
|
-
fm.type = prop.select?.name || 'note';
|
|
79
|
-
}
|
|
80
|
-
break;
|
|
81
|
-
case 'date':
|
|
82
|
-
if (prop.date?.start) fm[key.toLowerCase().replace(/\s+/g, '_')] = prop.date.start;
|
|
83
|
-
break;
|
|
84
|
-
case 'rich_text':
|
|
85
|
-
const text = prop.rich_text?.map(t => t.plain_text).join('') || '';
|
|
86
|
-
if (text && key.toLowerCase() !== 'title') {
|
|
87
|
-
fm[key.toLowerCase().replace(/\s+/g, '_')] = text;
|
|
88
|
-
}
|
|
89
|
-
break;
|
|
90
|
-
case 'url':
|
|
91
|
-
if (prop.url) fm[key.toLowerCase().replace(/\s+/g, '_')] = prop.url;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return fm;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// frontmatter를 YAML 문자열로 변환
|
|
100
|
-
function toYamlFrontmatter(fm) {
|
|
101
|
-
const lines = ['---'];
|
|
102
|
-
for (const [key, value] of Object.entries(fm)) {
|
|
103
|
-
if (value === null || value === undefined || value === '') continue;
|
|
104
|
-
if (Array.isArray(value)) {
|
|
105
|
-
lines.push(`${key}: [${value.map(v => `"${v}"`).join(', ')}]`);
|
|
106
|
-
} else if (typeof value === 'string' && (value.includes(':') || value.includes('"'))) {
|
|
107
|
-
lines.push(`${key}: "${value.replace(/"/g, '\\"')}"`);
|
|
108
|
-
} else {
|
|
109
|
-
lines.push(`${key}: ${value}`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
lines.push('---');
|
|
113
|
-
return lines.join('\n');
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// DB의 페이지들을 동기화
|
|
117
|
-
async function syncDatabase(dbId, dbName) {
|
|
118
|
-
const folder = DB_FOLDER_MAP[dbName] || `01_Knowledge/${dbName}`;
|
|
119
|
-
const targetDir = path.join(OBSIDIAN_PATH, folder);
|
|
120
|
-
fs.mkdirSync(targetDir, { recursive: true });
|
|
121
|
-
|
|
122
|
-
console.log(`📁 ${dbName} → ${folder}`);
|
|
123
|
-
|
|
124
|
-
let cursor;
|
|
125
|
-
let synced = 0;
|
|
126
|
-
do {
|
|
127
|
-
const response = await notion.databases.query({
|
|
128
|
-
database_id: dbId,
|
|
129
|
-
start_cursor: cursor,
|
|
130
|
-
page_size: 100,
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
for (const page of response.results) {
|
|
134
|
-
try {
|
|
135
|
-
const fm = extractFrontmatter(page);
|
|
136
|
-
if (!fm.title) continue;
|
|
137
|
-
|
|
138
|
-
// 마크다운 변환
|
|
139
|
-
const mdBlocks = await n2m.pageToMarkdown(page.id);
|
|
140
|
-
const mdContent = n2m.toMarkdownString(mdBlocks)?.parent || '';
|
|
141
|
-
|
|
142
|
-
// frontmatter + content
|
|
143
|
-
const fullContent = `${toYamlFrontmatter(fm)}\n\n# ${fm.title}\n\n${mdContent}`;
|
|
144
|
-
|
|
145
|
-
// 파일 저장
|
|
146
|
-
const safeTitle = fm.title.replace(/[<>:"/\\|?*]/g, '').replace(/\s+/g, ' ').trim().slice(0, 80);
|
|
147
|
-
const filePath = path.join(targetDir, `${safeTitle}.md`);
|
|
148
|
-
fs.writeFileSync(filePath, fullContent, 'utf-8');
|
|
149
|
-
synced++;
|
|
150
|
-
} catch (err) {
|
|
151
|
-
console.error(` ⚠ ${page.id}: ${err.message}`);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
cursor = response.has_more ? response.next_cursor : undefined;
|
|
156
|
-
} while (cursor);
|
|
157
|
-
|
|
158
|
-
console.log(` ✅ ${synced}개 페이지 동기화`);
|
|
159
|
-
return synced;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// 루트 페이지 하위의 DB들을 찾아서 동기화
|
|
163
|
-
async function main() {
|
|
164
|
-
console.log('\n✦ Stellavault Structured Sync\n');
|
|
165
|
-
|
|
166
|
-
// 루트 페이지의 자식 블록에서 DB 찾기
|
|
167
|
-
const blocks = await notion.blocks.children.list({ block_id: ROOT_PAGE_ID, page_size: 100 });
|
|
168
|
-
const databases = blocks.results.filter(b => b.type === 'child_database');
|
|
169
|
-
|
|
170
|
-
if (databases.length === 0) {
|
|
171
|
-
// DB가 없으면 기존 방식(페이지 기반)으로 폴백
|
|
172
|
-
console.log(' DB 없음 — 페이지 기반 동기화로 폴백');
|
|
173
|
-
console.log(' → node sync-to-obsidian.mjs 실행하세요');
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
let totalSynced = 0;
|
|
178
|
-
for (const db of databases) {
|
|
179
|
-
const dbName = db.child_database?.title || 'Untitled';
|
|
180
|
-
totalSynced += await syncDatabase(db.id, dbName);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
console.log(`\n✅ 총 ${totalSynced}개 페이지 구조화 동기화 완료`);
|
|
184
|
-
console.log('💡 stellavault index로 재인덱싱하면 검색에 반영됩니다\n');
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
main().catch(err => { console.error('❌', err.message); process.exit(1); });
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 노션 프로젝트 페이지 → 옵시디언 마크다운 동기화 스크립트
|
|
3
|
-
*
|
|
4
|
-
* 기능:
|
|
5
|
-
* - "프로젝트" 페이지 하위의 모든 페이지를 재귀적으로 순회
|
|
6
|
-
* - 각 페이지를 마크다운으로 변환하여 옵시디언 볼트에 저장
|
|
7
|
-
* - 페이지 계층 구조를 폴더 구조로 변환
|
|
8
|
-
* - 마지막 동기화 이후 변경된 페이지만 업데이트 (증분 동기화)
|
|
9
|
-
*
|
|
10
|
-
* 사용법: node sync-to-obsidian.mjs
|
|
11
|
-
* 환경변수: .env 파일 참조
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { Client } from '@notionhq/client';
|
|
15
|
-
import { NotionToMarkdown } from 'notion-to-md';
|
|
16
|
-
import fs from 'fs';
|
|
17
|
-
import path from 'path';
|
|
18
|
-
import { fileURLToPath } from 'url';
|
|
19
|
-
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = path.dirname(__filename);
|
|
22
|
-
|
|
23
|
-
// ─── 환경변수 로드 (.env 파일 직접 파싱, dotenv 의존성 제거) ───
|
|
24
|
-
function loadEnv() {
|
|
25
|
-
const envPath = path.join(__dirname, '.env');
|
|
26
|
-
if (!fs.existsSync(envPath)) {
|
|
27
|
-
console.error('❌ .env 파일이 없습니다. .env.example을 복사하여 .env를 만들어주세요.');
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
const lines = fs.readFileSync(envPath, 'utf-8').split('\n');
|
|
31
|
-
for (const line of lines) {
|
|
32
|
-
const trimmed = line.trim();
|
|
33
|
-
if (!trimmed || trimmed.startsWith('#')) continue;
|
|
34
|
-
const eqIdx = trimmed.indexOf('=');
|
|
35
|
-
if (eqIdx === -1) continue;
|
|
36
|
-
const key = trimmed.slice(0, eqIdx).trim();
|
|
37
|
-
const value = trimmed.slice(eqIdx + 1).trim();
|
|
38
|
-
if (!process.env[key]) process.env[key] = value;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
loadEnv();
|
|
42
|
-
|
|
43
|
-
// ─── 설정 ───
|
|
44
|
-
const NOTION_API_KEY = process.env.NOTION_API_KEY;
|
|
45
|
-
const ROOT_PAGE_ID = process.env.NOTION_ROOT_PAGE_ID;
|
|
46
|
-
const OBSIDIAN_PATH = process.env.OBSIDIAN_PATH || 'F:/obsidian/Notion-Projects';
|
|
47
|
-
const STATE_FILE = path.join(__dirname, '.sync-state.json');
|
|
48
|
-
|
|
49
|
-
if (!NOTION_API_KEY || !ROOT_PAGE_ID) {
|
|
50
|
-
console.error('❌ NOTION_API_KEY와 NOTION_ROOT_PAGE_ID가 필요합니다.');
|
|
51
|
-
process.exit(1);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// ─── 클라이언트 초기화 ───
|
|
55
|
-
const notion = new Client({ auth: NOTION_API_KEY });
|
|
56
|
-
const n2m = new NotionToMarkdown({ notionClient: notion });
|
|
57
|
-
|
|
58
|
-
// ─── 동기화 상태 관리 (증분 동기화용) ───
|
|
59
|
-
function loadSyncState() {
|
|
60
|
-
if (fs.existsSync(STATE_FILE)) {
|
|
61
|
-
const data = JSON.parse(fs.readFileSync(STATE_FILE, 'utf-8'));
|
|
62
|
-
if (!data.children) data.children = {};
|
|
63
|
-
return data;
|
|
64
|
-
}
|
|
65
|
-
return { lastSync: null, pages: {}, children: {} };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function saveSyncState(state) {
|
|
69
|
-
state.lastSync = new Date().toISOString();
|
|
70
|
-
fs.writeFileSync(STATE_FILE, JSON.stringify(state, null, 2), 'utf-8');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// ─── 페이지 제목에서 파일명 안전 문자열 생성 ───
|
|
74
|
-
function sanitizeFileName(name) {
|
|
75
|
-
return name
|
|
76
|
-
.replace(/[<>:"/\\|?*]/g, '') // Windows 금지 문자 제거
|
|
77
|
-
.replace(/\s+/g, ' ') // 연속 공백 정리
|
|
78
|
-
.trim()
|
|
79
|
-
.slice(0, 100); // 최대 100자
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// ─── 아이콘을 문자열로 변환 ───
|
|
83
|
-
function getIcon(page) {
|
|
84
|
-
if (!page.icon) return '';
|
|
85
|
-
if (page.icon.type === 'emoji') return page.icon.emoji + ' ';
|
|
86
|
-
return '';
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// ─── 페이지 제목 추출 ───
|
|
90
|
-
function getTitle(page) {
|
|
91
|
-
const titleProp = page.properties?.title || page.properties?.Name;
|
|
92
|
-
if (!titleProp) return 'Untitled';
|
|
93
|
-
const titleArr = titleProp.title || titleProp;
|
|
94
|
-
if (Array.isArray(titleArr)) {
|
|
95
|
-
return titleArr.map(t => t.plain_text).join('');
|
|
96
|
-
}
|
|
97
|
-
return 'Untitled';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// ─── 하위 페이지 목록 가져오기 ───
|
|
101
|
-
async function getChildPages(pageId) {
|
|
102
|
-
const children = [];
|
|
103
|
-
let cursor = undefined;
|
|
104
|
-
|
|
105
|
-
while (true) {
|
|
106
|
-
const response = await notion.blocks.children.list({
|
|
107
|
-
block_id: pageId,
|
|
108
|
-
start_cursor: cursor,
|
|
109
|
-
page_size: 100,
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
for (const block of response.results) {
|
|
113
|
-
if (block.type === 'child_page') {
|
|
114
|
-
children.push({
|
|
115
|
-
id: block.id,
|
|
116
|
-
title: block.child_page.title,
|
|
117
|
-
lastEdited: block.last_edited_time,
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (!response.has_more) break;
|
|
123
|
-
cursor = response.next_cursor;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return children;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// ─── 페이지를 마크다운으로 변환 ───
|
|
130
|
-
async function pageToMarkdown(pageId) {
|
|
131
|
-
try {
|
|
132
|
-
const mdBlocks = await n2m.pageToMarkdown(pageId);
|
|
133
|
-
const mdString = n2m.toMarkdownString(mdBlocks);
|
|
134
|
-
// notion-to-md v3는 { parent: string } 객체를 반환할 수 있음
|
|
135
|
-
return typeof mdString === 'string' ? mdString : mdString.parent || '';
|
|
136
|
-
} catch (err) {
|
|
137
|
-
console.warn(` ⚠️ 마크다운 변환 실패 (${pageId}): ${err.message}`);
|
|
138
|
-
return `> 변환 실패: ${err.message}`;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// ─── 마크다운 프론트매터 추가 ───
|
|
143
|
-
function addFrontmatter(markdown, page, title) {
|
|
144
|
-
const fm = [
|
|
145
|
-
'---',
|
|
146
|
-
`title: "${title.replace(/"/g, '\\"')}"`,
|
|
147
|
-
`notion_id: "${page.id || ''}"`,
|
|
148
|
-
`last_edited: "${page.lastEdited || new Date().toISOString()}"`,
|
|
149
|
-
`synced_at: "${new Date().toISOString()}"`,
|
|
150
|
-
'---',
|
|
151
|
-
'',
|
|
152
|
-
].join('\n');
|
|
153
|
-
return fm + markdown;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// ─── 재귀적으로 페이지 트리 동기화 ───
|
|
157
|
-
async function syncPageTree(pageId, dirPath, depth = 0, state) {
|
|
158
|
-
const indent = ' '.repeat(depth);
|
|
159
|
-
const children = await getChildPages(pageId);
|
|
160
|
-
|
|
161
|
-
let syncCount = 0;
|
|
162
|
-
let skipCount = 0;
|
|
163
|
-
|
|
164
|
-
for (const child of children) {
|
|
165
|
-
const title = child.title;
|
|
166
|
-
const safeName = sanitizeFileName(title);
|
|
167
|
-
|
|
168
|
-
// 변경 여부 확인 (증분 동기화)
|
|
169
|
-
const prevEdited = state.pages[child.id];
|
|
170
|
-
const hasChildren = state.children?.[child.id];
|
|
171
|
-
|
|
172
|
-
if (prevEdited === child.lastEdited) {
|
|
173
|
-
// 변경 없는 페이지 — 하위 페이지가 있었으면 재귀만 수행 (API 호출 없음)
|
|
174
|
-
if (hasChildren) {
|
|
175
|
-
const subDir = path.join(dirPath, safeName);
|
|
176
|
-
const subResult = await syncPageTree(child.id, subDir, depth + 1, state);
|
|
177
|
-
syncCount += subResult.syncCount;
|
|
178
|
-
skipCount += 1 + subResult.skipCount;
|
|
179
|
-
} else {
|
|
180
|
-
skipCount++;
|
|
181
|
-
}
|
|
182
|
-
continue;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
console.log(`${indent}📄 ${title}`);
|
|
186
|
-
|
|
187
|
-
// 하위 페이지 확인
|
|
188
|
-
const grandChildren = await getChildPages(child.id);
|
|
189
|
-
await new Promise(r => setTimeout(r, 350));
|
|
190
|
-
|
|
191
|
-
if (grandChildren.length > 0) {
|
|
192
|
-
// 하위 페이지가 있으면 폴더 생성 + index.md
|
|
193
|
-
const subDir = path.join(dirPath, safeName);
|
|
194
|
-
fs.mkdirSync(subDir, { recursive: true });
|
|
195
|
-
|
|
196
|
-
const markdown = await pageToMarkdown(child.id);
|
|
197
|
-
const content = addFrontmatter(markdown, child, title);
|
|
198
|
-
fs.writeFileSync(path.join(subDir, `${safeName}.md`), content, 'utf-8');
|
|
199
|
-
|
|
200
|
-
// 하위 페이지 재귀 동기화
|
|
201
|
-
const subResult = await syncPageTree(child.id, subDir, depth + 1, state);
|
|
202
|
-
syncCount += 1 + subResult.syncCount;
|
|
203
|
-
skipCount += subResult.skipCount;
|
|
204
|
-
state.children[child.id] = true;
|
|
205
|
-
} else {
|
|
206
|
-
const markdown = await pageToMarkdown(child.id);
|
|
207
|
-
const content = addFrontmatter(markdown, child, title);
|
|
208
|
-
fs.writeFileSync(path.join(dirPath, `${safeName}.md`), content, 'utf-8');
|
|
209
|
-
syncCount++;
|
|
210
|
-
delete state.children?.[child.id];
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
// 상태 업데이트
|
|
214
|
-
state.pages[child.id] = child.lastEdited;
|
|
215
|
-
|
|
216
|
-
// Rate limit 방지 (Notion API: 3 req/sec)
|
|
217
|
-
await new Promise(r => setTimeout(r, 350));
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return { syncCount, skipCount };
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// ─── 메인 실행 ───
|
|
224
|
-
async function main() {
|
|
225
|
-
console.log('');
|
|
226
|
-
console.log('╔══════════════════════════════════════════════╗');
|
|
227
|
-
console.log('║ 📚 Notion → Obsidian 동기화 시작 ║');
|
|
228
|
-
console.log('╚══════════════════════════════════════════════╝');
|
|
229
|
-
console.log('');
|
|
230
|
-
console.log(`📁 저장 경로: ${OBSIDIAN_PATH}`);
|
|
231
|
-
console.log(`🔗 루트 페이지: ${ROOT_PAGE_ID}`);
|
|
232
|
-
|
|
233
|
-
// 상태 로드
|
|
234
|
-
const state = loadSyncState();
|
|
235
|
-
if (state.lastSync) {
|
|
236
|
-
console.log(`🕐 마지막 동기화: ${state.lastSync}`);
|
|
237
|
-
} else {
|
|
238
|
-
console.log('🆕 첫 동기화 실행');
|
|
239
|
-
}
|
|
240
|
-
console.log('');
|
|
241
|
-
|
|
242
|
-
// 출력 디렉토리 생성
|
|
243
|
-
fs.mkdirSync(OBSIDIAN_PATH, { recursive: true });
|
|
244
|
-
|
|
245
|
-
// 동기화 실행
|
|
246
|
-
const startTime = Date.now();
|
|
247
|
-
const result = await syncPageTree(ROOT_PAGE_ID, OBSIDIAN_PATH, 0, state);
|
|
248
|
-
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
249
|
-
|
|
250
|
-
// 상태 저장
|
|
251
|
-
saveSyncState(state);
|
|
252
|
-
|
|
253
|
-
console.log('');
|
|
254
|
-
console.log('╔══════════════════════════════════════════════╗');
|
|
255
|
-
console.log(`║ ✅ 동기화 완료 (${elapsed}초) ║`);
|
|
256
|
-
console.log(`║ 📄 업데이트: ${result.syncCount}건 | ⏭️ 스킵: ${result.skipCount}건 ║`);
|
|
257
|
-
console.log(`║ 📁 저장: ${OBSIDIAN_PATH} ║`);
|
|
258
|
-
console.log('╚══════════════════════════════════════════════╝');
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
main().catch(err => {
|
|
262
|
-
console.error('❌ 동기화 실패:', err.message);
|
|
263
|
-
process.exit(1);
|
|
264
|
-
});
|