@sunub/obsidian-mcp-server 0.2.0 → 0.3.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/README.md +217 -25
- package/build/cli/AppContainer.d.ts +1 -0
- package/build/cli/AppContainer.js +197 -0
- package/build/cli/AppContainer.js.map +1 -0
- package/build/cli/config/SettingContext.d.ts +1 -0
- package/build/cli/config/SettingContext.js +2 -0
- package/build/cli/config/SettingContext.js.map +1 -0
- package/build/cli/config/mcpServersConfig.d.ts +18 -0
- package/build/cli/config/mcpServersConfig.js +119 -0
- package/build/cli/config/mcpServersConfig.js.map +1 -0
- package/build/cli/config/settingSchema.d.ts +180 -0
- package/build/cli/config/settingSchema.js +128 -0
- package/build/cli/config/settingSchema.js.map +1 -0
- package/build/cli/context/InputContext.d.ts +12 -0
- package/build/cli/context/InputContext.js +10 -0
- package/build/cli/context/InputContext.js.map +1 -0
- package/build/cli/context/KeypressContext.d.ts +30 -0
- package/build/cli/context/KeypressContext.js +200 -0
- package/build/cli/context/KeypressContext.js.map +1 -0
- package/build/cli/context/KeypressContext.util.d.ts +7 -0
- package/build/cli/context/KeypressContext.util.js +474 -0
- package/build/cli/context/KeypressContext.util.js.map +1 -0
- package/build/cli/hooks/useAtCompletion.d.ts +12 -0
- package/build/cli/hooks/useAtCompletion.js +5 -0
- package/build/cli/hooks/useAtCompletion.js.map +1 -0
- package/build/cli/hooks/useCommandCompletion.d.ts +59 -0
- package/build/cli/hooks/useCommandCompletion.js +344 -0
- package/build/cli/hooks/useCommandCompletion.js.map +1 -0
- package/build/cli/hooks/useCompletion.d.ts +22 -0
- package/build/cli/hooks/useCompletion.js +84 -0
- package/build/cli/hooks/useCompletion.js.map +1 -0
- package/build/cli/hooks/useDispatcher.d.ts +6 -0
- package/build/cli/hooks/useDispatcher.js +286 -0
- package/build/cli/hooks/useDispatcher.js.map +1 -0
- package/build/cli/hooks/useFocus.d.ts +2 -0
- package/build/cli/hooks/useFocus.js +3 -0
- package/build/cli/hooks/useFocus.js.map +1 -0
- package/build/cli/hooks/useInputHistory.d.ts +24 -0
- package/build/cli/hooks/useInputHistory.js +159 -0
- package/build/cli/hooks/useInputHistory.js.map +1 -0
- package/build/cli/hooks/useKeyMatchers.d.ts +17 -0
- package/build/cli/hooks/useKeyMatchers.js +13 -0
- package/build/cli/hooks/useKeyMatchers.js.map +1 -0
- package/build/cli/hooks/useKeypress.d.ts +19 -0
- package/build/cli/hooks/useKeypress.js +28 -0
- package/build/cli/hooks/useKeypress.js.map +1 -0
- package/build/cli/hooks/useLlmStream.d.ts +12 -0
- package/build/cli/hooks/useLlmStream.js +365 -0
- package/build/cli/hooks/useLlmStream.js.map +1 -0
- package/build/cli/hooks/useMcpClient.d.ts +10 -0
- package/build/cli/hooks/useMcpClient.js +100 -0
- package/build/cli/hooks/useMcpClient.js.map +1 -0
- package/build/cli/hooks/useMcpManager.d.ts +22 -0
- package/build/cli/hooks/useMcpManager.js +86 -0
- package/build/cli/hooks/useMcpManager.js.map +1 -0
- package/build/cli/hooks/usePromptCompletion.d.ts +19 -0
- package/build/cli/hooks/usePromptCompletion.js +13 -0
- package/build/cli/hooks/usePromptCompletion.js.map +1 -0
- package/build/cli/hooks/useRagContext.d.ts +6 -0
- package/build/cli/hooks/useRagContext.js +83 -0
- package/build/cli/hooks/useRagContext.js.map +1 -0
- package/build/cli/hooks/useShellCompletion.d.ts +18 -0
- package/build/cli/hooks/useShellCompletion.js +10 -0
- package/build/cli/hooks/useShellCompletion.js.map +1 -0
- package/build/cli/hooks/useSlashCompletion.d.ts +21 -0
- package/build/cli/hooks/useSlashCompletion.js +11 -0
- package/build/cli/hooks/useSlashCompletion.js.map +1 -0
- package/build/cli/hooks/useTerminalSize.d.ts +9 -0
- package/build/cli/hooks/useTerminalSize.js +26 -0
- package/build/cli/hooks/useTerminalSize.js.map +1 -0
- package/build/cli/index.js +27 -0
- package/build/cli/index.js.map +1 -0
- package/build/cli/key/keyBindings.d.ts +152 -0
- package/build/cli/key/keyBindings.js +630 -0
- package/build/cli/key/keyBindings.js.map +1 -0
- package/build/cli/key/keyMatchers.d.ts +27 -0
- package/build/cli/key/keyMatchers.js +33 -0
- package/build/cli/key/keyMatchers.js.map +1 -0
- package/build/cli/key/text-buffer.js +918 -0
- package/build/cli/key/text-buffer.js.map +1 -0
- package/build/cli/reference/HistoryItemDisplay.d.ts +23 -0
- package/build/cli/reference/HistoryItemDisplay.js +63 -0
- package/build/cli/reference/HistoryItemDisplay.js.map +1 -0
- package/build/cli/reference/InputContext.d.ts +17 -0
- package/build/cli/reference/InputContext.js +16 -0
- package/build/cli/reference/InputContext.js.map +1 -0
- package/build/cli/reference/KerypressContext.d.ts +37 -0
- package/build/cli/reference/KerypressContext.js +791 -0
- package/build/cli/reference/KerypressContext.js.map +1 -0
- package/build/cli/reference/MainContent.d.ts +6 -0
- package/build/cli/reference/MainContent.js +207 -0
- package/build/cli/reference/MainContent.js.map +1 -0
- package/build/cli/reference/UIStateContext.d.ts +188 -0
- package/build/cli/reference/UIStateContext.js +16 -0
- package/build/cli/reference/UIStateContext.js.map +1 -0
- package/build/cli/reference/useGeminiStream.d.ts +42 -0
- package/build/cli/reference/useGeminiStream.js +1404 -0
- package/build/cli/reference/useGeminiStream.js.map +1 -0
- package/build/cli/services/McpClientService.d.ts +32 -0
- package/build/cli/services/McpClientService.js +123 -0
- package/build/cli/services/McpClientService.js.map +1 -0
- package/build/cli/services/McpManager.d.ts +28 -0
- package/build/cli/services/McpManager.js +146 -0
- package/build/cli/services/McpManager.js.map +1 -0
- package/build/cli/tmp.js +27 -0
- package/build/cli/tmp.js.map +1 -0
- package/build/cli/ui/ConnectionStatus.d.ts +13 -0
- package/build/cli/ui/ConnectionStatus.js +24 -0
- package/build/cli/ui/ConnectionStatus.js.map +1 -0
- package/build/cli/ui/HelpCommands.d.ts +5 -0
- package/build/cli/ui/HelpCommands.js +11 -0
- package/build/cli/ui/HelpCommands.js.map +1 -0
- package/build/cli/ui/HistoryItemDisplay.d.ts +9 -0
- package/build/cli/ui/HistoryItemDisplay.js +38 -0
- package/build/cli/ui/HistoryItemDisplay.js.map +1 -0
- package/build/cli/ui/InputPrompt-bestcase.d.ts +63 -0
- package/build/cli/ui/InputPrompt-bestcase.js +1301 -0
- package/build/cli/ui/InputPrompt-bestcase.js.map +1 -0
- package/build/cli/ui/InputPrompt.d.ts +12 -0
- package/build/cli/ui/InputPrompt.js +145 -0
- package/build/cli/ui/InputPrompt.js.map +1 -0
- package/build/cli/ui/InputPrompt.tmp.d.ts +7 -0
- package/build/cli/ui/InputPrompt.tmp.js +215 -0
- package/build/cli/ui/InputPrompt.tmp.js.map +1 -0
- package/build/cli/ui/MainContent.d.ts +10 -0
- package/build/cli/ui/MainContent.js +24 -0
- package/build/cli/ui/MainContent.js.map +1 -0
- package/build/cli/ui/MouseContext.d.ts +1 -0
- package/build/cli/ui/MouseContext.js +2 -0
- package/build/cli/ui/MouseContext.js.map +1 -0
- package/build/cli/ui/SuggestionsDisplay.d.ts +25 -0
- package/build/cli/ui/SuggestionsDisplay.js +45 -0
- package/build/cli/ui/SuggestionsDisplay.js.map +1 -0
- package/build/cli/ui/ThinkingIndicator.d.ts +2 -0
- package/build/cli/ui/ThinkingIndicator.js +16 -0
- package/build/cli/ui/ThinkingIndicator.js.map +1 -0
- package/build/cli/ui/layout/DefaultAppLayout.d.ts +2 -0
- package/build/cli/ui/layout/DefaultAppLayout.js +6 -0
- package/build/cli/ui/layout/DefaultAppLayout.js.map +1 -0
- package/build/cli/ui/shared/ExpandableText.d.ts +14 -0
- package/build/cli/ui/shared/ExpandableText.js +19 -0
- package/build/cli/ui/shared/ExpandableText.js.map +1 -0
- package/build/cli/utils/commandUtils.d.ts +11 -0
- package/build/cli/utils/commandUtils.js +16 -0
- package/build/cli/utils/commandUtils.js.map +1 -0
- package/build/cli/utils/debugLogger.d.ts +12 -0
- package/build/cli/utils/debugLogger.js +52 -0
- package/build/cli/utils/debugLogger.js.map +1 -0
- package/build/cli/utils/historyStorage.d.ts +13 -0
- package/build/cli/utils/historyStorage.js +64 -0
- package/build/cli/utils/historyStorage.js.map +1 -0
- package/build/cli/utils/textUtil.d.ts +68 -0
- package/build/cli/utils/textUtil.js +236 -0
- package/build/cli/utils/textUtil.js.map +1 -0
- package/build/db.js +55 -0
- package/build/db.js.map +1 -0
- package/build/index.js +4 -0
- package/build/index.js.map +1 -0
- package/build/tools/create_document_with_properties/index.d.ts +60 -0
- package/build/tools/create_document_with_properties/index.js +7 -1
- package/build/tools/create_document_with_properties/index.js.map +1 -0
- package/build/tools/create_document_with_properties/params.d.ts +66 -0
- package/build/tools/generate_property/index.js +6 -0
- package/build/tools/generate_property/index.js.map +1 -0
- package/build/tools/index.d.ts +184 -0
- package/build/tools/organize_attachments/index.js +7 -1
- package/build/tools/organize_attachments/index.js.map +1 -0
- package/build/tools/organize_attachments/params.d.ts +122 -0
- package/build/tools/vault/index.js +17 -3
- package/build/tools/vault/index.js.map +1 -0
- package/build/tools/vault/params.d.ts +115 -0
- package/build/tools/vault/types/collect_context.d.ts +1340 -0
- package/build/tools/vault/types/list_all.d.ts +387 -0
- package/build/tools/vault/types/read_specific.d.ts +297 -0
- package/build/tools/vault/types/search.d.ts +598 -0
- package/build/tools/vault/utils/actions/collect_context.js +26 -1
- package/build/tools/vault/utils/actions/collect_context.js.map +1 -0
- package/build/tools/vault/utils/actions/index_rag.js +27 -0
- package/build/tools/vault/utils/actions/index_rag.js.map +1 -0
- package/build/tools/vault/utils/actions/list_all.js +1 -0
- package/build/tools/vault/utils/actions/list_all.js.map +1 -0
- package/build/tools/vault/utils/actions/load_memory.js +23 -13
- package/build/tools/vault/utils/actions/load_memory.js.map +1 -0
- package/build/tools/vault/utils/actions/read.js +2 -1
- package/build/tools/vault/utils/actions/read.js.map +1 -0
- package/build/tools/vault/utils/actions/search.js +2 -1
- package/build/tools/vault/utils/actions/search.js.map +1 -0
- package/build/tools/vault/utils/actions/search_semantic.js +54 -0
- package/build/tools/vault/utils/actions/search_semantic.js.map +1 -0
- package/build/tools/vault/utils/actions/stats.js +1 -0
- package/build/tools/vault/utils/actions/stats.js.map +1 -0
- package/build/tools/vault/utils/document.js +1 -0
- package/build/tools/vault/utils/document.js.map +1 -0
- package/build/tools/write_property/index.d.ts +58 -0
- package/build/tools/write_property/index.js +7 -1
- package/build/tools/write_property/index.js.map +1 -0
- package/build/utils/DirectoryWalker.d.ts +6 -0
- package/build/utils/DirectoryWalker.js +7 -0
- package/build/utils/DirectoryWalker.js.map +1 -0
- package/build/utils/Indexer.d.ts +18 -0
- package/build/utils/Indexer.js +5 -9
- package/build/utils/Indexer.js.map +1 -0
- package/build/utils/LLMClient.d.ts +37 -0
- package/build/utils/LLMClient.js +82 -0
- package/build/utils/LLMClient.js.map +1 -0
- package/build/utils/RAGIndexer.d.ts +22 -0
- package/build/utils/RAGIndexer.js +206 -0
- package/build/utils/RAGIndexer.js.map +1 -0
- package/build/utils/RerankerClient.d.ts +27 -0
- package/build/utils/RerankerClient.js +69 -0
- package/build/utils/RerankerClient.js.map +1 -0
- package/build/utils/VaultManger/VaultManager.d.ts +34 -0
- package/build/utils/VaultManger/VaultManager.js +1 -0
- package/build/utils/VaultManger/VaultManager.js.map +1 -0
- package/build/utils/VaultManger/VaultPathError.d.ts +6 -0
- package/build/utils/VaultManger/VaultPathError.js +1 -0
- package/build/utils/VaultManger/VaultPathError.js.map +1 -0
- package/build/utils/VaultManger/index.d.ts +3 -0
- package/build/utils/VaultManger/index.js +1 -0
- package/build/utils/VaultManger/index.js.map +1 -0
- package/build/utils/VaultManger/types.d.ts +16 -0
- package/build/utils/VaultManger/types.js +1 -0
- package/build/utils/VaultManger/types.js.map +1 -0
- package/build/utils/VaultWatcher.d.ts +8 -0
- package/build/utils/VaultWatcher.js +96 -0
- package/build/utils/VaultWatcher.js.map +1 -0
- package/build/utils/VectorDB.d.ts +53 -0
- package/build/utils/VectorDB.js +243 -0
- package/build/utils/VectorDB.js.map +1 -0
- package/build/utils/createToolError.d.ts +2 -0
- package/build/utils/createToolError.js +1 -0
- package/build/utils/createToolError.js.map +1 -0
- package/build/utils/getVaultManager.d.ts +2 -0
- package/build/utils/getVaultManager.js +2 -1
- package/build/utils/getVaultManager.js.map +1 -0
- package/build/utils/processor/LinkExtractor.d.ts +2 -0
- package/build/utils/processor/LinkExtractor.js +1 -0
- package/build/utils/processor/LinkExtractor.js.map +1 -0
- package/build/utils/processor/MatterParser.d.ts +2 -0
- package/build/utils/processor/MatterParser.js +12 -3
- package/build/utils/processor/MatterParser.js.map +1 -0
- package/build/utils/processor/types.d.ts +100 -0
- package/package.json +29 -3
- package/build/config.js +0 -55
- package/build/server.js +0 -32
- package/build/tools/create_document_with_properties/params.js +0 -32
- package/build/tools/generate_property/params.js +0 -54
- package/build/tools/index.js +0 -12
- package/build/tools/organize_attachments/params.js +0 -60
- package/build/tools/organize_attachments/utils.js +0 -65
- package/build/tools/vault/metrics.js +0 -126
- package/build/tools/vault/params.js +0 -141
- package/build/tools/vault/types/collect_context.js +0 -102
- package/build/tools/vault/types/list_all.js +0 -52
- package/build/tools/vault/types/read_specific.js +0 -40
- package/build/tools/vault/types/search.js +0 -58
- package/build/tools/vault/utils/constants.js +0 -2
- package/build/tools/vault/utils/shared.js +0 -74
- package/build/tools/vault/utils.js +0 -6
- package/build/tools/write_property/params.js +0 -51
- package/build/utils/processor/types.js +0 -27
- package/build/utils/semaphore.js +0 -25
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { FrontMatterSchema } from "../../../utils/processor/types.js";
|
|
3
|
-
const DocumentMetadataSchema = FrontMatterSchema;
|
|
4
|
-
const DocumentStatsSchema = z.object({
|
|
5
|
-
contentLength: z.number(),
|
|
6
|
-
hasContent: z.boolean(),
|
|
7
|
-
wordCount: z.number(),
|
|
8
|
-
});
|
|
9
|
-
// Schema for content when includeContent is true
|
|
10
|
-
const FullContentSchema = z.object({
|
|
11
|
-
full: z.string(),
|
|
12
|
-
excerpt: z.string(),
|
|
13
|
-
});
|
|
14
|
-
// Schema for content when includeContent is false
|
|
15
|
-
const PreviewContentSchema = z.object({
|
|
16
|
-
preview: z.string(),
|
|
17
|
-
note: z.string(),
|
|
18
|
-
});
|
|
19
|
-
// Schema for a single document
|
|
20
|
-
export const DocumentSchema = z.object({
|
|
21
|
-
filename: z.string(),
|
|
22
|
-
fullPath: z.string(),
|
|
23
|
-
metadata: DocumentMetadataSchema,
|
|
24
|
-
stats: DocumentStatsSchema,
|
|
25
|
-
content: z.union([FullContentSchema, PreviewContentSchema]),
|
|
26
|
-
});
|
|
27
|
-
// Schema for the main successful search result
|
|
28
|
-
export const SearchSuccessSchema = z.object({
|
|
29
|
-
query: z.string(),
|
|
30
|
-
found: z.number(),
|
|
31
|
-
total_in_vault: z.number(),
|
|
32
|
-
documents: z.array(DocumentSchema),
|
|
33
|
-
});
|
|
34
|
-
// Schema for when no documents are found
|
|
35
|
-
export const SearchNotFoundSchema = z.object({
|
|
36
|
-
query: z.string(),
|
|
37
|
-
found: z.literal(0),
|
|
38
|
-
message: z.string(),
|
|
39
|
-
suggestion: z.string(),
|
|
40
|
-
});
|
|
41
|
-
// Schema for the quiet mode response
|
|
42
|
-
export const SearchQuietSchema = z.object({
|
|
43
|
-
found: z.number(),
|
|
44
|
-
filenames: z.array(z.string()),
|
|
45
|
-
});
|
|
46
|
-
// Schema for an error response
|
|
47
|
-
export const SearchErrorSchema = z.object({
|
|
48
|
-
error: z.string(),
|
|
49
|
-
action: z.string(),
|
|
50
|
-
parameters: z.any(),
|
|
51
|
-
});
|
|
52
|
-
// Union schema for all possible search results
|
|
53
|
-
export const SearchResultSchema = z.union([
|
|
54
|
-
SearchSuccessSchema,
|
|
55
|
-
SearchNotFoundSchema,
|
|
56
|
-
SearchQuietSchema,
|
|
57
|
-
SearchErrorSchema,
|
|
58
|
-
]);
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
export const SEARCH_DEFAULT_LIMIT = {
|
|
2
|
-
aggressive: 3,
|
|
3
|
-
balanced: 5,
|
|
4
|
-
};
|
|
5
|
-
export const SEARCH_DEFAULT_EXCERPT = {
|
|
6
|
-
aggressive: 220,
|
|
7
|
-
balanced: 500,
|
|
8
|
-
};
|
|
9
|
-
export const READ_DEFAULT_CONTENT_MAX_CHARS = {
|
|
10
|
-
aggressive: 1200,
|
|
11
|
-
balanced: 2500,
|
|
12
|
-
};
|
|
13
|
-
export const READ_DEFAULT_BACKLINK_LIMIT = {
|
|
14
|
-
aggressive: 5,
|
|
15
|
-
balanced: 10,
|
|
16
|
-
};
|
|
17
|
-
export const ACTION_DEFAULT_MAX_OUTPUT_CHARS = {
|
|
18
|
-
search: {
|
|
19
|
-
aggressive: 1800,
|
|
20
|
-
balanced: 2500,
|
|
21
|
-
},
|
|
22
|
-
read: {
|
|
23
|
-
aggressive: 2200,
|
|
24
|
-
balanced: 4000,
|
|
25
|
-
},
|
|
26
|
-
collect_context: {
|
|
27
|
-
aggressive: 2800,
|
|
28
|
-
balanced: 5200,
|
|
29
|
-
},
|
|
30
|
-
load_memory: {
|
|
31
|
-
aggressive: 2000,
|
|
32
|
-
balanced: 3200,
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
export function resolveCompressionMode(params) {
|
|
36
|
-
return params.compressionMode ?? "balanced";
|
|
37
|
-
}
|
|
38
|
-
function estimateTokensByChars(chars) {
|
|
39
|
-
return Math.ceil(chars / 3);
|
|
40
|
-
}
|
|
41
|
-
export function finalizePayloadWithCompression(payload, compression) {
|
|
42
|
-
const output_chars = JSON.stringify(payload).length;
|
|
43
|
-
const estimated_tokens = estimateTokensByChars(output_chars);
|
|
44
|
-
return {
|
|
45
|
-
...payload,
|
|
46
|
-
compression: {
|
|
47
|
-
...compression,
|
|
48
|
-
output_chars,
|
|
49
|
-
estimated_tokens,
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export function jsonCharLength(data) {
|
|
54
|
-
return JSON.stringify(data).length;
|
|
55
|
-
}
|
|
56
|
-
export function trimWithEllipsis(value, maxLength) {
|
|
57
|
-
if (value.length <= maxLength) {
|
|
58
|
-
return value;
|
|
59
|
-
}
|
|
60
|
-
return `${value.substring(0, maxLength)}...`;
|
|
61
|
-
}
|
|
62
|
-
export function normalizeWhitespace(value) {
|
|
63
|
-
return value.replace(/\s+/g, " ").trim();
|
|
64
|
-
}
|
|
65
|
-
export function stripFrontmatterBlock(content) {
|
|
66
|
-
if (!content.startsWith("---")) {
|
|
67
|
-
return content;
|
|
68
|
-
}
|
|
69
|
-
const end = content.indexOf("\n---", 3);
|
|
70
|
-
if (end === -1) {
|
|
71
|
-
return content;
|
|
72
|
-
}
|
|
73
|
-
return content.substring(end + 4).trimStart();
|
|
74
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { collectContext } from "./utils/actions/collect_context.js";
|
|
2
|
-
export { listAllDocuments } from "./utils/actions/list_all.js";
|
|
3
|
-
export { loadMemory } from "./utils/actions/load_memory.js";
|
|
4
|
-
export { readSpecificFile } from "./utils/actions/read.js";
|
|
5
|
-
export { searchDocuments } from "./utils/actions/search.js";
|
|
6
|
-
export { statsAllDocuments } from "./utils/actions/stats.js";
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
// input properties
|
|
3
|
-
const obsidianCssClassesProperty = z
|
|
4
|
-
.array(z.string())
|
|
5
|
-
.describe("List of CSS classes associated with the document");
|
|
6
|
-
const obsidianTagsProperty = z
|
|
7
|
-
.array(z.string())
|
|
8
|
-
.describe("List of tags associated with the document");
|
|
9
|
-
const obsidianTitleProperty = z.string().describe("Title of the document");
|
|
10
|
-
const obsidianDateProperty = z
|
|
11
|
-
.string()
|
|
12
|
-
.describe("Creation date of the document in ISO 8601 format");
|
|
13
|
-
const obsidianSummaryProperty = z
|
|
14
|
-
.string()
|
|
15
|
-
.describe("Brief summary or abstract of the document");
|
|
16
|
-
const obsidianSlugProperty = z
|
|
17
|
-
.string()
|
|
18
|
-
.describe("URL-friendly identifier for the document");
|
|
19
|
-
const obsidianCategoryProperty = z
|
|
20
|
-
.string()
|
|
21
|
-
.describe("Category or classification of the document");
|
|
22
|
-
const obsidianCompletedProperty = z
|
|
23
|
-
.boolean()
|
|
24
|
-
.describe("Indicates whether a task or item is completed");
|
|
25
|
-
const quiteMode = z
|
|
26
|
-
.boolean()
|
|
27
|
-
.default(true)
|
|
28
|
-
.describe("If true, suppresses non-error output messages. Default is false.");
|
|
29
|
-
const obsidianPropertySchema = z
|
|
30
|
-
.object({
|
|
31
|
-
cssclasses: obsidianCssClassesProperty.optional(),
|
|
32
|
-
tags: obsidianTagsProperty.optional(),
|
|
33
|
-
title: obsidianTitleProperty.optional(),
|
|
34
|
-
date: obsidianDateProperty.optional(),
|
|
35
|
-
summary: obsidianSummaryProperty.optional(),
|
|
36
|
-
slug: obsidianSlugProperty.optional(),
|
|
37
|
-
category: obsidianCategoryProperty.optional(),
|
|
38
|
-
completed: obsidianCompletedProperty.optional(),
|
|
39
|
-
})
|
|
40
|
-
.describe("Schema for Obsidian frontmatter properties");
|
|
41
|
-
// input schema
|
|
42
|
-
export const obsidianPropertyParamsSchema = z
|
|
43
|
-
.object({
|
|
44
|
-
filePath: z
|
|
45
|
-
.string()
|
|
46
|
-
.min(1)
|
|
47
|
-
.describe("Path to the target markdown file within the Obsidian vault"),
|
|
48
|
-
properties: obsidianPropertySchema.describe("Key-value pairs to be written to the file's frontmatter"),
|
|
49
|
-
quiet: quiteMode.optional(),
|
|
50
|
-
})
|
|
51
|
-
.describe("Parameters for writing properties to an Obsidian markdown file");
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
const PostCategorySchema = z
|
|
3
|
-
.union([
|
|
4
|
-
z.literal("web"),
|
|
5
|
-
z.literal("algorithm"),
|
|
6
|
-
z.literal("cs"),
|
|
7
|
-
z.literal("code"),
|
|
8
|
-
])
|
|
9
|
-
.optional();
|
|
10
|
-
const DateStringSchema = z.union([z.string(), z.date()]).optional();
|
|
11
|
-
export const FrontMatterSchema = z.object({
|
|
12
|
-
title: z.string().optional(),
|
|
13
|
-
date: DateStringSchema,
|
|
14
|
-
tags: z.array(z.string()).optional(),
|
|
15
|
-
summary: z.string().optional(),
|
|
16
|
-
slug: z.string().optional(),
|
|
17
|
-
category: PostCategorySchema,
|
|
18
|
-
completed: z.boolean().optional(),
|
|
19
|
-
});
|
|
20
|
-
export const DocumentIndexSchema = z.object({
|
|
21
|
-
filePath: z.string(),
|
|
22
|
-
frontmatter: FrontMatterSchema,
|
|
23
|
-
contentLength: z.number(),
|
|
24
|
-
imageLinks: z.array(z.string()),
|
|
25
|
-
documentLinks: z.array(z.string()),
|
|
26
|
-
});
|
|
27
|
-
export { PostCategorySchema };
|
package/build/utils/semaphore.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export class Semaphore {
|
|
2
|
-
permits = 0;
|
|
3
|
-
waitingQueue = [];
|
|
4
|
-
constructor(permits) {
|
|
5
|
-
this.permits = permits;
|
|
6
|
-
}
|
|
7
|
-
async acquire() {
|
|
8
|
-
if (this.permits > 0) {
|
|
9
|
-
this.permits--;
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
return new Promise((resolve) => {
|
|
13
|
-
this.waitingQueue.push(resolve);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
release() {
|
|
17
|
-
const next = this.waitingQueue.shift();
|
|
18
|
-
if (next) {
|
|
19
|
-
next();
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
this.permits++;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|