stellavault 0.1.0 → 0.2.1
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/cli/bin/ekh.js +2 -2
- package/packages/cli/dist/commands/federate-cmd.js +61 -31
- 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 +647 -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} +48 -67
- 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/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 +133 -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/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-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/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/bm25.d.ts +4 -0
- package/packages/core/dist/search/bm25.js +10 -0
- package/packages/core/dist/search/index.d.ts +13 -0
- package/packages/core/dist/search/index.js +63 -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/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 -236
- 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 -165
- 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/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/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,142 +0,0 @@
|
|
|
1
|
-
// Design Ref: §4.1 — MCP Server (stdio + SSE)
|
|
2
|
-
|
|
3
|
-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
5
|
-
import { CallToolRequestSchema, ListToolsRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
6
|
-
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
7
|
-
import type { VectorStore } from '../store/types.js';
|
|
8
|
-
import type { SearchEngine } from '../search/index.js';
|
|
9
|
-
import { searchToolDef, handleSearch } from './tools/search.js';
|
|
10
|
-
import { getDocumentToolDef, handleGetDocument } from './tools/get-document.js';
|
|
11
|
-
import { listTopicsToolDef, handleListTopics } from './tools/list-topics.js';
|
|
12
|
-
import { getRelatedToolDef, handleGetRelated } from './tools/get-related.js';
|
|
13
|
-
import { generateClaudeMdToolDef, handleGenerateClaudeMd } from './tools/generate-claude-md.js';
|
|
14
|
-
import { createSnapshotToolDef, loadSnapshotToolDef, handleCreateSnapshot, handleLoadSnapshot } from './tools/snapshot.js';
|
|
15
|
-
import { logDecisionToolDef, findDecisionsToolDef, handleLogDecision, handleFindDecisions } from './tools/decision-journal.js';
|
|
16
|
-
import { exportToolDef, handleExport } from './tools/export.js';
|
|
17
|
-
import { getDecayStatusToolDef, handleGetDecayStatus } from './tools/decay.js';
|
|
18
|
-
import { getMorningBriefToolDef, handleGetMorningBrief } from './tools/brief.js';
|
|
19
|
-
import { createLearningPathTool } from './tools/learning-path.js';
|
|
20
|
-
import type { DecayEngine } from '../intelligence/decay-engine.js';
|
|
21
|
-
|
|
22
|
-
export interface McpServerOptions {
|
|
23
|
-
store: VectorStore;
|
|
24
|
-
searchEngine: SearchEngine;
|
|
25
|
-
vaultPath?: string;
|
|
26
|
-
decayEngine?: DecayEngine;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function createMcpServer(options: McpServerOptions) {
|
|
30
|
-
const { store, searchEngine, vaultPath = '', decayEngine } = options;
|
|
31
|
-
|
|
32
|
-
const learningPathTool = createLearningPathTool(store);
|
|
33
|
-
|
|
34
|
-
const server = new Server(
|
|
35
|
-
{ name: 'stellavault', version: '0.2.0' },
|
|
36
|
-
{ capabilities: { tools: {} } },
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
// List tools
|
|
40
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
41
|
-
tools: [
|
|
42
|
-
searchToolDef, getDocumentToolDef, listTopicsToolDef, getRelatedToolDef,
|
|
43
|
-
generateClaudeMdToolDef, createSnapshotToolDef, loadSnapshotToolDef,
|
|
44
|
-
logDecisionToolDef, findDecisionsToolDef, exportToolDef,
|
|
45
|
-
...(decayEngine ? [getDecayStatusToolDef, getMorningBriefToolDef] : []),
|
|
46
|
-
{ name: learningPathTool.name, description: learningPathTool.description, inputSchema: learningPathTool.inputSchema },
|
|
47
|
-
],
|
|
48
|
-
}));
|
|
49
|
-
|
|
50
|
-
// Call tool
|
|
51
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
52
|
-
const { name, arguments: args } = request.params;
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
let result: unknown;
|
|
56
|
-
switch (name) {
|
|
57
|
-
case 'search':
|
|
58
|
-
result = await handleSearch(searchEngine, args as any);
|
|
59
|
-
// MCP 검색 이벤트 기록
|
|
60
|
-
if (decayEngine && result && typeof result === 'object' && 'results' in (result as any)) {
|
|
61
|
-
const now = new Date().toISOString();
|
|
62
|
-
for (const r of (result as any).results ?? []) {
|
|
63
|
-
if (r.documentId) decayEngine.recordAccess({ documentId: r.documentId, type: 'mcp_query', timestamp: now }).catch(() => {});
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
break;
|
|
67
|
-
case 'get-document':
|
|
68
|
-
result = await handleGetDocument(store, args as any);
|
|
69
|
-
// MCP 문서 조회 이벤트 기록
|
|
70
|
-
if (decayEngine && result && typeof result === 'object' && 'id' in (result as any)) {
|
|
71
|
-
decayEngine.recordAccess({ documentId: (result as any).id, type: 'mcp_query', timestamp: new Date().toISOString() }).catch(() => {});
|
|
72
|
-
}
|
|
73
|
-
break;
|
|
74
|
-
case 'list-topics':
|
|
75
|
-
result = await handleListTopics(store);
|
|
76
|
-
break;
|
|
77
|
-
case 'get-related':
|
|
78
|
-
result = await handleGetRelated(store, searchEngine, args as any);
|
|
79
|
-
break;
|
|
80
|
-
case 'generate-claude-md':
|
|
81
|
-
result = await handleGenerateClaudeMd(searchEngine, store, args as any);
|
|
82
|
-
break;
|
|
83
|
-
case 'create-snapshot':
|
|
84
|
-
result = await handleCreateSnapshot(searchEngine, args as any);
|
|
85
|
-
break;
|
|
86
|
-
case 'load-snapshot':
|
|
87
|
-
result = await handleLoadSnapshot(args as any);
|
|
88
|
-
break;
|
|
89
|
-
case 'log-decision':
|
|
90
|
-
result = await handleLogDecision(vaultPath, args as any);
|
|
91
|
-
break;
|
|
92
|
-
case 'find-decisions':
|
|
93
|
-
result = await handleFindDecisions(vaultPath, args as any);
|
|
94
|
-
break;
|
|
95
|
-
case 'export':
|
|
96
|
-
result = await handleExport(store, args as any);
|
|
97
|
-
break;
|
|
98
|
-
case 'get-decay-status':
|
|
99
|
-
if (!decayEngine) { result = { error: 'Decay engine not available' }; break; }
|
|
100
|
-
result = await handleGetDecayStatus(decayEngine, args as any);
|
|
101
|
-
break;
|
|
102
|
-
case 'get-morning-brief':
|
|
103
|
-
if (!decayEngine) { result = { error: 'Decay engine not available' }; break; }
|
|
104
|
-
result = await handleGetMorningBrief(decayEngine, store);
|
|
105
|
-
break;
|
|
106
|
-
case 'get-learning-path':
|
|
107
|
-
result = await learningPathTool.handler(args as any);
|
|
108
|
-
return result as any;
|
|
109
|
-
default:
|
|
110
|
-
return { content: [{ type: 'text', text: `Unknown tool: ${name}` }], isError: true };
|
|
111
|
-
}
|
|
112
|
-
return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
|
|
113
|
-
} catch (err) {
|
|
114
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
115
|
-
return { content: [{ type: 'text', text: `Error: ${msg}` }], isError: true };
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
async startStdio() {
|
|
121
|
-
const transport = new StdioServerTransport();
|
|
122
|
-
await server.connect(transport);
|
|
123
|
-
},
|
|
124
|
-
async startHttp(port: number = 3334) {
|
|
125
|
-
const { createServer } = await import('node:http');
|
|
126
|
-
const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: () => `sv-${Date.now()}` });
|
|
127
|
-
await server.connect(transport);
|
|
128
|
-
|
|
129
|
-
const httpServer = createServer(async (req, res) => {
|
|
130
|
-
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
131
|
-
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
132
|
-
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
|
133
|
-
if (req.method === 'OPTIONS') { res.writeHead(204); res.end(); return; }
|
|
134
|
-
await transport.handleRequest(req, res);
|
|
135
|
-
});
|
|
136
|
-
httpServer.listen(port, '127.0.0.1', () => {
|
|
137
|
-
console.error(`🔌 MCP HTTP server running at http://127.0.0.1:${port}/mcp`);
|
|
138
|
-
});
|
|
139
|
-
},
|
|
140
|
-
server,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// Agentic Graph Construction (P3-F23)
|
|
2
|
-
// AI가 MCP 세션 중 실시간으로 그래프 노드/엣지 생성
|
|
3
|
-
|
|
4
|
-
import type { VectorStore } from '../../store/types.js';
|
|
5
|
-
import type { Embedder } from '../../indexer/embedder.js';
|
|
6
|
-
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
7
|
-
import { join } from 'node:path';
|
|
8
|
-
|
|
9
|
-
export function createAgenticGraphTools(store: VectorStore, embedder: Embedder, vaultPath: string) {
|
|
10
|
-
return [
|
|
11
|
-
{
|
|
12
|
-
name: 'create-knowledge-node',
|
|
13
|
-
description: 'Create a new knowledge note in the vault. AI agents use this to capture decisions, insights, or summaries during a conversation. The note is automatically indexed and appears in the knowledge graph.',
|
|
14
|
-
inputSchema: {
|
|
15
|
-
type: 'object' as const,
|
|
16
|
-
properties: {
|
|
17
|
-
title: { type: 'string', description: 'Note title' },
|
|
18
|
-
content: { type: 'string', description: 'Note content (markdown)' },
|
|
19
|
-
tags: { type: 'array', items: { type: 'string' }, description: 'Tags for categorization' },
|
|
20
|
-
type: { type: 'string', description: 'Note type: note, decision, insight, summary' },
|
|
21
|
-
folder: { type: 'string', description: 'Vault subfolder (default: 01_Knowledge)' },
|
|
22
|
-
},
|
|
23
|
-
required: ['title', 'content'],
|
|
24
|
-
},
|
|
25
|
-
async handler(args: { title: string; content: string; tags?: string[]; type?: string; folder?: string }) {
|
|
26
|
-
const { title, content, tags = [], type = 'note', folder = '01_Knowledge' } = args;
|
|
27
|
-
|
|
28
|
-
// frontmatter 생성
|
|
29
|
-
const date = new Date().toISOString().slice(0, 10);
|
|
30
|
-
const fm = [
|
|
31
|
-
'---',
|
|
32
|
-
`title: "${title}"`,
|
|
33
|
-
`type: ${type}`,
|
|
34
|
-
`source: agent`,
|
|
35
|
-
`tags: [${tags.map(t => `"${t}"`).join(', ')}]`,
|
|
36
|
-
`created: ${date}`,
|
|
37
|
-
`auto_generated: true`,
|
|
38
|
-
'---',
|
|
39
|
-
].join('\n');
|
|
40
|
-
|
|
41
|
-
const fullContent = `${fm}\n\n# ${title}\n\n${content}`;
|
|
42
|
-
|
|
43
|
-
// vault에 파일 저장
|
|
44
|
-
const safeTitle = title.replace(/[<>:"/\\|?*]/g, '').replace(/\s+/g, ' ').trim().slice(0, 80);
|
|
45
|
-
const dir = join(vaultPath, folder);
|
|
46
|
-
mkdirSync(dir, { recursive: true });
|
|
47
|
-
const filePath = join(dir, `${safeTitle}.md`);
|
|
48
|
-
writeFileSync(filePath, fullContent, 'utf-8');
|
|
49
|
-
|
|
50
|
-
return {
|
|
51
|
-
content: [{
|
|
52
|
-
type: 'text' as const,
|
|
53
|
-
text: `Created knowledge node: "${title}" at ${folder}/${safeTitle}.md\nTags: ${tags.join(', ') || 'none'}\nType: ${type}\n\nRun 'stellavault index' to add to the graph.`,
|
|
54
|
-
}],
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
name: 'create-knowledge-link',
|
|
60
|
-
description: 'Create a link between two existing notes by adding a wiki-link reference. Strengthens connections in the knowledge graph.',
|
|
61
|
-
inputSchema: {
|
|
62
|
-
type: 'object' as const,
|
|
63
|
-
properties: {
|
|
64
|
-
sourceTitle: { type: 'string', description: 'Title of the source note' },
|
|
65
|
-
targetTitle: { type: 'string', description: 'Title of the target note to link to' },
|
|
66
|
-
context: { type: 'string', description: 'Why these notes are related (added as a comment)' },
|
|
67
|
-
},
|
|
68
|
-
required: ['sourceTitle', 'targetTitle'],
|
|
69
|
-
},
|
|
70
|
-
async handler(args: { sourceTitle: string; targetTitle: string; context?: string }) {
|
|
71
|
-
const docs = await store.getAllDocuments();
|
|
72
|
-
const source = docs.find(d => d.title.toLowerCase().includes(args.sourceTitle.toLowerCase()));
|
|
73
|
-
|
|
74
|
-
if (!source) {
|
|
75
|
-
return { content: [{ type: 'text' as const, text: `Source note "${args.sourceTitle}" not found.` }] };
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// 소스 노트에 링크 추가
|
|
79
|
-
const { readFileSync } = await import('node:fs');
|
|
80
|
-
const fullPath = join(vaultPath, source.filePath);
|
|
81
|
-
let existing = '';
|
|
82
|
-
try { existing = readFileSync(fullPath, 'utf-8'); } catch { /* new file */ }
|
|
83
|
-
|
|
84
|
-
const linkSection = `\n\n## Related\n\n- [[${args.targetTitle}]]${args.context ? ` — ${args.context}` : ''}\n`;
|
|
85
|
-
writeFileSync(fullPath, existing + linkSection, 'utf-8');
|
|
86
|
-
|
|
87
|
-
return {
|
|
88
|
-
content: [{
|
|
89
|
-
type: 'text' as const,
|
|
90
|
-
text: `Linked "${source.title}" → "${args.targetTitle}"${args.context ? ` (${args.context})` : ''}`,
|
|
91
|
-
}],
|
|
92
|
-
};
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
];
|
|
96
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// MCP tool: get-morning-brief — Claude 세션 시작 시 자동 브리핑
|
|
2
|
-
|
|
3
|
-
import type { DecayEngine } from '../../intelligence/decay-engine.js';
|
|
4
|
-
import type { VectorStore } from '../../store/types.js';
|
|
5
|
-
|
|
6
|
-
export const getMorningBriefToolDef = {
|
|
7
|
-
name: 'get-morning-brief',
|
|
8
|
-
description: '오늘의 지식 브리핑을 제공합니다. 감쇠 상태, 리뷰 대상, 최근 활동을 요약합니다. 세션 시작 시 호출하면 유용합니다.',
|
|
9
|
-
inputSchema: {
|
|
10
|
-
type: 'object' as const,
|
|
11
|
-
properties: {},
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export async function handleGetMorningBrief(
|
|
16
|
-
decayEngine: DecayEngine,
|
|
17
|
-
store: VectorStore,
|
|
18
|
-
) {
|
|
19
|
-
const stats = await store.getStats();
|
|
20
|
-
const report = await decayEngine.computeAll();
|
|
21
|
-
|
|
22
|
-
const reviewList = report.topDecaying.slice(0, 5).map(d => ({
|
|
23
|
-
title: d.title,
|
|
24
|
-
retrievability: Math.round(d.retrievability * 100) / 100,
|
|
25
|
-
daysSinceAccess: d.daysSinceAccess,
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
const unhealthyClusters = report.clusterHealth
|
|
29
|
-
.filter(c => c.avgR < 0.6)
|
|
30
|
-
.slice(0, 3)
|
|
31
|
-
.map(c => ({ label: c.label, avgR: c.avgR, count: c.count }));
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
greeting: `📚 ${stats.documentCount}개 노트, 전체 건강도 R=${report.averageR}`,
|
|
35
|
-
summary: {
|
|
36
|
-
totalDocs: stats.documentCount,
|
|
37
|
-
averageR: report.averageR,
|
|
38
|
-
decaying: report.decayingCount,
|
|
39
|
-
critical: report.criticalCount,
|
|
40
|
-
},
|
|
41
|
-
reviewSuggestions: reviewList,
|
|
42
|
-
unhealthyClusters,
|
|
43
|
-
tip: report.criticalCount > 0
|
|
44
|
-
? `⚠️ ${report.criticalCount}개 노트가 위험 수준입니다. 'stellavault review'로 리뷰하세요.`
|
|
45
|
-
: report.decayingCount > 0
|
|
46
|
-
? `📋 ${report.decayingCount}개 노트가 감쇠 중입니다.`
|
|
47
|
-
: '✨ 모든 지식이 건강합니다!',
|
|
48
|
-
};
|
|
49
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Design Ref: §4.2 — MCP tool: get-decay-status
|
|
2
|
-
// Plan SC: SC-04
|
|
3
|
-
|
|
4
|
-
import type { DecayEngine } from '../../intelligence/decay-engine.js';
|
|
5
|
-
|
|
6
|
-
export const getDecayStatusToolDef = {
|
|
7
|
-
name: 'get-decay-status',
|
|
8
|
-
description: '잊어가는 지식 노트를 조회합니다. 기억 강도(retrievability)가 낮은 노트 목록을 반환하여 리마인드합니다.',
|
|
9
|
-
inputSchema: {
|
|
10
|
-
type: 'object' as const,
|
|
11
|
-
properties: {
|
|
12
|
-
threshold: { type: 'number', description: '감쇠 임계값 (0~1, default: 0.5). 이 값 이하인 노트를 반환' },
|
|
13
|
-
limit: { type: 'number', description: '반환할 최대 노트 수 (default: 20)' },
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export async function handleGetDecayStatus(
|
|
19
|
-
decayEngine: DecayEngine,
|
|
20
|
-
args: { threshold?: number; limit?: number },
|
|
21
|
-
) {
|
|
22
|
-
const threshold = args.threshold ?? 0.5;
|
|
23
|
-
const limit = args.limit ?? 20;
|
|
24
|
-
|
|
25
|
-
const decaying = await decayEngine.getDecaying(threshold, limit);
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
count: decaying.length,
|
|
29
|
-
threshold,
|
|
30
|
-
notes: decaying.map(d => ({
|
|
31
|
-
title: d.title,
|
|
32
|
-
retrievability: Math.round(d.retrievability * 100) / 100,
|
|
33
|
-
stability: Math.round(d.stability * 10) / 10,
|
|
34
|
-
lastAccess: d.lastAccess,
|
|
35
|
-
})),
|
|
36
|
-
tip: decaying.length > 0
|
|
37
|
-
? `${decaying.length}개의 노트를 잊어가고 있습니다. 리뷰를 권장합니다.`
|
|
38
|
-
: '모든 지식이 건강한 상태입니다!',
|
|
39
|
-
};
|
|
40
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// Design Ref: §12.1 F14 — 결정 저널 (기술 결정 자동 기록)
|
|
2
|
-
|
|
3
|
-
import { writeFileSync, existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs';
|
|
4
|
-
import { join, resolve } from 'node:path';
|
|
5
|
-
import type { SearchEngine } from '../../search/index.js';
|
|
6
|
-
|
|
7
|
-
export const logDecisionToolDef = {
|
|
8
|
-
name: 'log-decision',
|
|
9
|
-
description: '기술적 결정을 구조화하여 기록합니다. 나중에 "왜 이 선택을 했지?"에 답변할 수 있습니다.',
|
|
10
|
-
inputSchema: {
|
|
11
|
-
type: 'object' as const,
|
|
12
|
-
properties: {
|
|
13
|
-
title: { type: 'string', description: '결정 제목 (예: Zustand 대신 Jotai 선택)' },
|
|
14
|
-
context: { type: 'string', description: '결정 배경/상황' },
|
|
15
|
-
decision: { type: 'string', description: '선택한 내용' },
|
|
16
|
-
alternatives: { type: 'array', items: { type: 'string' }, description: '고려한 대안들' },
|
|
17
|
-
reasoning: { type: 'string', description: '선택 이유' },
|
|
18
|
-
project: { type: 'string', description: '관련 프로젝트명' },
|
|
19
|
-
},
|
|
20
|
-
required: ['title', 'decision', 'reasoning'],
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const findDecisionsToolDef = {
|
|
25
|
-
name: 'find-decisions',
|
|
26
|
-
description: '과거 기술 결정을 검색합니다.',
|
|
27
|
-
inputSchema: {
|
|
28
|
-
type: 'object' as const,
|
|
29
|
-
properties: {
|
|
30
|
-
query: { type: 'string', description: '검색 쿼리' },
|
|
31
|
-
},
|
|
32
|
-
required: ['query'],
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export async function handleLogDecision(
|
|
37
|
-
vaultPath: string,
|
|
38
|
-
args: {
|
|
39
|
-
title: string; context?: string; decision: string;
|
|
40
|
-
alternatives?: string[]; reasoning: string; project?: string;
|
|
41
|
-
},
|
|
42
|
-
) {
|
|
43
|
-
const decisionsDir = join(vaultPath, 'decisions');
|
|
44
|
-
mkdirSync(decisionsDir, { recursive: true });
|
|
45
|
-
|
|
46
|
-
const date = new Date().toISOString().slice(0, 10);
|
|
47
|
-
const slug = args.title.replace(/[^a-zA-Z가-힣0-9\s-]/g, '').replace(/\s+/g, '-').slice(0, 50);
|
|
48
|
-
if (!slug) throw new Error('Invalid decision title');
|
|
49
|
-
const fileName = `${date}-${slug}.md`;
|
|
50
|
-
|
|
51
|
-
const content = [
|
|
52
|
-
'---',
|
|
53
|
-
`title: "${args.title}"`,
|
|
54
|
-
`date: ${date}`,
|
|
55
|
-
`project: "${args.project ?? ''}"`,
|
|
56
|
-
'type: decision',
|
|
57
|
-
'---',
|
|
58
|
-
'',
|
|
59
|
-
`# ${args.title}`,
|
|
60
|
-
'',
|
|
61
|
-
args.context ? `## 배경\n\n${args.context}\n` : '',
|
|
62
|
-
`## 결정\n\n${args.decision}\n`,
|
|
63
|
-
args.alternatives?.length
|
|
64
|
-
? `## 고려한 대안\n\n${args.alternatives.map(a => `- ${a}`).join('\n')}\n`
|
|
65
|
-
: '',
|
|
66
|
-
`## 이유\n\n${args.reasoning}\n`,
|
|
67
|
-
].filter(Boolean).join('\n');
|
|
68
|
-
|
|
69
|
-
const filePath = resolve(decisionsDir, fileName);
|
|
70
|
-
if (!filePath.startsWith(resolve(decisionsDir))) {
|
|
71
|
-
throw new Error('Path traversal detected');
|
|
72
|
-
}
|
|
73
|
-
writeFileSync(filePath, content, 'utf-8');
|
|
74
|
-
|
|
75
|
-
return { saved: filePath, fileName };
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export async function handleFindDecisions(vaultPath: string, args: { query: string }) {
|
|
79
|
-
const decisionsDir = join(vaultPath, 'decisions');
|
|
80
|
-
if (!existsSync(decisionsDir)) return { decisions: [], message: 'No decisions directory' };
|
|
81
|
-
|
|
82
|
-
const files = readdirSync(decisionsDir).filter(f => f.endsWith('.md'));
|
|
83
|
-
const query = args.query.toLowerCase();
|
|
84
|
-
|
|
85
|
-
const matches = files
|
|
86
|
-
.map(f => {
|
|
87
|
-
const content = readFileSync(join(decisionsDir, f), 'utf-8');
|
|
88
|
-
const score = content.toLowerCase().includes(query) ? 1 : 0;
|
|
89
|
-
return { file: f, content: content.slice(0, 300), score };
|
|
90
|
-
})
|
|
91
|
-
.filter(m => m.score > 0)
|
|
92
|
-
.slice(0, 10);
|
|
93
|
-
|
|
94
|
-
return { decisions: matches, total: files.length };
|
|
95
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// Design Ref: §12.1 F20 — 지식 내보내기 포맷 (락인 방지)
|
|
2
|
-
|
|
3
|
-
import { writeFileSync, mkdirSync } from 'node:fs';
|
|
4
|
-
import { join, dirname, resolve } from 'node:path';
|
|
5
|
-
import { homedir } from 'node:os';
|
|
6
|
-
import type { VectorStore } from '../../store/types.js';
|
|
7
|
-
|
|
8
|
-
const ALLOWED_EXPORT_DIRS = [
|
|
9
|
-
resolve(homedir(), '.stellavault'),
|
|
10
|
-
resolve('.'),
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
function validateExportPath(outputPath: string): string {
|
|
14
|
-
const resolved = resolve(outputPath);
|
|
15
|
-
const isAllowed = ALLOWED_EXPORT_DIRS.some(dir => resolved.startsWith(resolve(dir)));
|
|
16
|
-
if (!isAllowed) {
|
|
17
|
-
throw new Error(`Export path must be within current directory or ~/.stellavault/. Got: ${resolved}`);
|
|
18
|
-
}
|
|
19
|
-
return resolved;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const exportToolDef = {
|
|
23
|
-
name: 'export',
|
|
24
|
-
description: '벡터 DB의 문서와 메타데이터를 JSON 파일로 내보냅니다. 다른 도구로 이전 가능.',
|
|
25
|
-
inputSchema: {
|
|
26
|
-
type: 'object' as const,
|
|
27
|
-
properties: {
|
|
28
|
-
outputPath: { type: 'string', description: '출력 파일 경로 (예: ./export.json)' },
|
|
29
|
-
format: { type: 'string', enum: ['json', 'csv'], description: '출력 포맷 (기본: json)' },
|
|
30
|
-
},
|
|
31
|
-
required: ['outputPath'],
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export async function handleExport(
|
|
36
|
-
store: VectorStore,
|
|
37
|
-
args: { outputPath: string; format?: string },
|
|
38
|
-
) {
|
|
39
|
-
const docs = await store.getAllDocuments();
|
|
40
|
-
const stats = await store.getStats();
|
|
41
|
-
const topics = await store.getTopics();
|
|
42
|
-
|
|
43
|
-
const safePath = validateExportPath(args.outputPath);
|
|
44
|
-
mkdirSync(dirname(safePath), { recursive: true });
|
|
45
|
-
|
|
46
|
-
if (args.format === 'csv') {
|
|
47
|
-
const header = 'id,filePath,title,tags,lastModified,contentHash';
|
|
48
|
-
const rows = docs.map(d =>
|
|
49
|
-
`"${d.id}","${d.filePath}","${d.title.replace(/"/g, '""')}","${d.tags.join(';')}","${d.lastModified}","${d.contentHash}"`
|
|
50
|
-
);
|
|
51
|
-
writeFileSync(safePath, [header, ...rows].join('\n'), 'utf-8');
|
|
52
|
-
} else {
|
|
53
|
-
const exported = {
|
|
54
|
-
exportedAt: new Date().toISOString(),
|
|
55
|
-
version: '1.0',
|
|
56
|
-
stats,
|
|
57
|
-
topics,
|
|
58
|
-
documents: docs.map(d => ({
|
|
59
|
-
id: d.id,
|
|
60
|
-
filePath: d.filePath,
|
|
61
|
-
title: d.title,
|
|
62
|
-
tags: d.tags,
|
|
63
|
-
frontmatter: d.frontmatter,
|
|
64
|
-
lastModified: d.lastModified,
|
|
65
|
-
contentLength: d.content.length,
|
|
66
|
-
})),
|
|
67
|
-
};
|
|
68
|
-
writeFileSync(safePath, JSON.stringify(exported, null, 2), 'utf-8');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return { exported: docs.length, path: safePath, format: args.format ?? 'json' };
|
|
72
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// MCP Tool: federated-search (Federation Phase 1b)
|
|
2
|
-
// AI 에이전트가 연합 네트워크를 검색
|
|
3
|
-
|
|
4
|
-
import type { FederatedSearch } from '../../federation/search.js';
|
|
5
|
-
|
|
6
|
-
export function createFederatedSearchTool(federatedSearch: FederatedSearch | null) {
|
|
7
|
-
return {
|
|
8
|
-
name: 'federated-search',
|
|
9
|
-
description: 'Search across all connected Federation peers. Returns results from other Stellavault nodes in the P2P network. Only titles, similarity scores, and 50-char snippets are shared — no raw text leaves any node.',
|
|
10
|
-
inputSchema: {
|
|
11
|
-
type: 'object' as const,
|
|
12
|
-
properties: {
|
|
13
|
-
query: { type: 'string', description: 'Search query' },
|
|
14
|
-
limit: { type: 'number', description: 'Max results per peer (default: 5)' },
|
|
15
|
-
},
|
|
16
|
-
required: ['query'],
|
|
17
|
-
},
|
|
18
|
-
async handler(args: { query: string; limit?: number }) {
|
|
19
|
-
if (!federatedSearch) {
|
|
20
|
-
return { content: [{ type: 'text' as const, text: 'Federation not active. Run `sv federate join` first.' }] };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const results = await federatedSearch.search(args.query, { limit: args.limit ?? 5 });
|
|
24
|
-
|
|
25
|
-
if (results.length === 0) {
|
|
26
|
-
return { content: [{ type: 'text' as const, text: 'No results from federation peers. Either no peers connected or no matching documents.' }] };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const lines = [
|
|
30
|
-
`🌐 Federation Search: "${args.query}" — ${results.length} results from ${new Set(results.map(r => r.peerId)).size} peers`,
|
|
31
|
-
'',
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
for (const r of results) {
|
|
35
|
-
lines.push(`**${r.title}** (${Math.round(r.similarity * 100)}%) [${r.peerName}]`);
|
|
36
|
-
lines.push(` ${r.snippet}...`);
|
|
37
|
-
lines.push('');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return { content: [{ type: 'text' as const, text: lines.join('\n') }] };
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// Design Ref: §12.1 F13 — CLAUDE.md 자동 생성기 (킬러 유스케이스)
|
|
2
|
-
|
|
3
|
-
import type { SearchEngine } from '../../search/index.js';
|
|
4
|
-
import type { VectorStore } from '../../store/types.js';
|
|
5
|
-
|
|
6
|
-
export const generateClaudeMdToolDef = {
|
|
7
|
-
name: 'generate-claude-md',
|
|
8
|
-
description: '프로젝트명을 기반으로 관련 지식(아키텍처, 패턴, 교훈, 결정사항)을 검색하여 CLAUDE.md 초안을 자동 생성합니다.',
|
|
9
|
-
inputSchema: {
|
|
10
|
-
type: 'object' as const,
|
|
11
|
-
properties: {
|
|
12
|
-
projectName: { type: 'string', description: '프로젝트명 또는 주요 키워드' },
|
|
13
|
-
topics: {
|
|
14
|
-
type: 'array',
|
|
15
|
-
items: { type: 'string' },
|
|
16
|
-
description: '추가 검색할 토픽 (예: ["인증", "배포", "성능"])',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
required: ['projectName'],
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export async function handleGenerateClaudeMd(
|
|
24
|
-
searchEngine: SearchEngine,
|
|
25
|
-
store: VectorStore,
|
|
26
|
-
args: { projectName: string; topics?: string[] },
|
|
27
|
-
) {
|
|
28
|
-
const { projectName, topics = [] } = args;
|
|
29
|
-
|
|
30
|
-
// 프로젝트 관련 지식 검색 (여러 관점)
|
|
31
|
-
const queries = [
|
|
32
|
-
`${projectName} 아키텍처 설계`,
|
|
33
|
-
`${projectName} 패턴 컨벤션`,
|
|
34
|
-
`${projectName} 교훈 실수 주의사항`,
|
|
35
|
-
`${projectName} 기술 스택 의존성`,
|
|
36
|
-
...topics.map(t => `${projectName} ${t}`),
|
|
37
|
-
];
|
|
38
|
-
|
|
39
|
-
const allResults = new Map<string, { title: string; content: string; score: number; category: string }>();
|
|
40
|
-
|
|
41
|
-
for (const query of queries) {
|
|
42
|
-
const results = await searchEngine.search({ query, limit: 3 });
|
|
43
|
-
const category = query.replace(projectName, '').trim();
|
|
44
|
-
for (const r of results) {
|
|
45
|
-
const key = r.chunk.id;
|
|
46
|
-
if (!allResults.has(key) || (allResults.get(key)!.score < r.score)) {
|
|
47
|
-
allResults.set(key, {
|
|
48
|
-
title: `${r.document.title} §${r.chunk.heading}`,
|
|
49
|
-
content: r.chunk.content.slice(0, 500),
|
|
50
|
-
score: r.score,
|
|
51
|
-
category,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// 카테고리별 분류
|
|
58
|
-
const sorted = [...allResults.values()].sort((a, b) => b.score - a.score);
|
|
59
|
-
|
|
60
|
-
// CLAUDE.md 초안 생성
|
|
61
|
-
const sections: string[] = [];
|
|
62
|
-
sections.push(`# ${projectName} — CLAUDE.md`);
|
|
63
|
-
sections.push('');
|
|
64
|
-
sections.push('> 이 파일은 evan-knowledge-hub MCP에서 자동 생성되었습니다.');
|
|
65
|
-
sections.push(`> 생성일: ${new Date().toISOString().slice(0, 10)}`);
|
|
66
|
-
sections.push(`> 참조 지식: ${sorted.length}건`);
|
|
67
|
-
sections.push('');
|
|
68
|
-
|
|
69
|
-
// 아키텍처 섹션
|
|
70
|
-
const archResults = sorted.filter(r => r.category.includes('아키텍처') || r.category.includes('설계'));
|
|
71
|
-
if (archResults.length > 0) {
|
|
72
|
-
sections.push('## 아키텍처 & 설계');
|
|
73
|
-
sections.push('');
|
|
74
|
-
for (const r of archResults.slice(0, 3)) {
|
|
75
|
-
sections.push(`### ${r.title}`);
|
|
76
|
-
sections.push(r.content.trim());
|
|
77
|
-
sections.push('');
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// 패턴/컨벤션 섹션
|
|
82
|
-
const patternResults = sorted.filter(r => r.category.includes('패턴') || r.category.includes('컨벤션'));
|
|
83
|
-
if (patternResults.length > 0) {
|
|
84
|
-
sections.push('## 코딩 패턴 & 컨벤션');
|
|
85
|
-
sections.push('');
|
|
86
|
-
for (const r of patternResults.slice(0, 3)) {
|
|
87
|
-
sections.push(`### ${r.title}`);
|
|
88
|
-
sections.push(r.content.trim());
|
|
89
|
-
sections.push('');
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// 교훈 섹션
|
|
94
|
-
const lessonResults = sorted.filter(r => r.category.includes('교훈') || r.category.includes('실수'));
|
|
95
|
-
if (lessonResults.length > 0) {
|
|
96
|
-
sections.push('## 교훈 & 주의사항');
|
|
97
|
-
sections.push('');
|
|
98
|
-
for (const r of lessonResults.slice(0, 5)) {
|
|
99
|
-
sections.push(`- **${r.title}**: ${r.content.slice(0, 200).replace(/\n/g, ' ').trim()}`);
|
|
100
|
-
}
|
|
101
|
-
sections.push('');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// 기타 관련 지식
|
|
105
|
-
const otherResults = sorted.filter(r =>
|
|
106
|
-
!r.category.includes('아키텍처') && !r.category.includes('설계') &&
|
|
107
|
-
!r.category.includes('패턴') && !r.category.includes('교훈') && !r.category.includes('실수')
|
|
108
|
-
);
|
|
109
|
-
if (otherResults.length > 0) {
|
|
110
|
-
sections.push('## 관련 지식');
|
|
111
|
-
sections.push('');
|
|
112
|
-
for (const r of otherResults.slice(0, 5)) {
|
|
113
|
-
sections.push(`- **${r.title}** (score: ${r.score.toFixed(3)})`);
|
|
114
|
-
}
|
|
115
|
-
sections.push('');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const claudeMd = sections.join('\n');
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
content: claudeMd,
|
|
122
|
-
stats: {
|
|
123
|
-
queriesRun: queries.length,
|
|
124
|
-
uniqueResults: sorted.length,
|
|
125
|
-
sections: ['아키텍처', '패턴', '교훈', '관련 지식'].filter((_, i) =>
|
|
126
|
-
[archResults, patternResults, lessonResults, otherResults][i].length > 0
|
|
127
|
-
),
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
}
|