obsidian-mcp-server 3.5.3 → 3.5.5

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.
Files changed (86) hide show
  1. package/AGENTS.md +47 -6
  2. package/CLAUDE.md +47 -6
  3. package/Dockerfile +3 -2
  4. package/README.md +144 -100
  5. package/changelog/3.5.x/3.5.3.md +4 -3
  6. package/changelog/3.5.x/3.5.4.md +42 -0
  7. package/changelog/3.5.x/3.5.5.md +20 -0
  8. package/changelog/template.md +7 -7
  9. package/dist/config/server-config.d.ts +1 -1
  10. package/dist/config/server-config.d.ts.map +1 -1
  11. package/dist/config/server-config.js +9 -2
  12. package/dist/config/server-config.js.map +1 -1
  13. package/dist/index.js +9 -0
  14. package/dist/index.js.map +1 -1
  15. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.d.ts.map +1 -1
  16. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js +19 -1
  17. package/dist/mcp-server/resources/definitions/obsidian-vault-note.resource.js.map +1 -1
  18. package/dist/mcp-server/tools/definitions/_shared/schemas.js +1 -1
  19. package/dist/mcp-server/tools/definitions/_shared/schemas.js.map +1 -1
  20. package/dist/mcp-server/tools/definitions/index.d.ts +157 -65
  21. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  22. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts +13 -2
  23. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.d.ts.map +1 -1
  24. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js +14 -3
  25. package/dist/mcp-server/tools/definitions/obsidian-append-to-note.tool.js.map +1 -1
  26. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts +9 -0
  27. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.d.ts.map +1 -1
  28. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js +9 -0
  29. package/dist/mcp-server/tools/definitions/obsidian-delete-note.tool.js.map +1 -1
  30. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.d.ts +1 -0
  31. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.d.ts.map +1 -1
  32. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.js +1 -0
  33. package/dist/mcp-server/tools/definitions/obsidian-execute-command.tool.js.map +1 -1
  34. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts +9 -0
  35. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.d.ts.map +1 -1
  36. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js +19 -26
  37. package/dist/mcp-server/tools/definitions/obsidian-get-note.tool.js.map +1 -1
  38. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts +3 -0
  39. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.d.ts.map +1 -1
  40. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js +3 -0
  41. package/dist/mcp-server/tools/definitions/obsidian-list-notes.tool.js.map +1 -1
  42. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts +13 -0
  43. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.d.ts.map +1 -1
  44. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js +19 -1
  45. package/dist/mcp-server/tools/definitions/obsidian-manage-frontmatter.tool.js.map +1 -1
  46. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts +17 -2
  47. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.d.ts.map +1 -1
  48. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js +22 -3
  49. package/dist/mcp-server/tools/definitions/obsidian-manage-tags.tool.js.map +1 -1
  50. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts +4 -0
  51. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.d.ts.map +1 -1
  52. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js +4 -0
  53. package/dist/mcp-server/tools/definitions/obsidian-open-in-ui.tool.js.map +1 -1
  54. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts +13 -2
  55. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.d.ts.map +1 -1
  56. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js +14 -3
  57. package/dist/mcp-server/tools/definitions/obsidian-patch-note.tool.js.map +1 -1
  58. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts +10 -2
  59. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.d.ts.map +1 -1
  60. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js +10 -2
  61. package/dist/mcp-server/tools/definitions/obsidian-replace-in-note.tool.js.map +1 -1
  62. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts +12 -5
  63. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.d.ts.map +1 -1
  64. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js +29 -24
  65. package/dist/mcp-server/tools/definitions/obsidian-search-notes.tool.js.map +1 -1
  66. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts +12 -2
  67. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.d.ts.map +1 -1
  68. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js +20 -10
  69. package/dist/mcp-server/tools/definitions/obsidian-write-note.tool.js.map +1 -1
  70. package/dist/services/obsidian/frontmatter-ops.d.ts +44 -11
  71. package/dist/services/obsidian/frontmatter-ops.d.ts.map +1 -1
  72. package/dist/services/obsidian/frontmatter-ops.js +370 -69
  73. package/dist/services/obsidian/frontmatter-ops.js.map +1 -1
  74. package/dist/services/obsidian/obsidian-service.d.ts +26 -5
  75. package/dist/services/obsidian/obsidian-service.d.ts.map +1 -1
  76. package/dist/services/obsidian/obsidian-service.js +469 -85
  77. package/dist/services/obsidian/obsidian-service.js.map +1 -1
  78. package/dist/services/obsidian/section-extractor.d.ts +33 -3
  79. package/dist/services/obsidian/section-extractor.d.ts.map +1 -1
  80. package/dist/services/obsidian/section-extractor.js +115 -75
  81. package/dist/services/obsidian/section-extractor.js.map +1 -1
  82. package/dist/services/obsidian/types.d.ts +11 -4
  83. package/dist/services/obsidian/types.d.ts.map +1 -1
  84. package/manifest.json +1 -1
  85. package/package.json +9 -9
  86. package/server.json +3 -3
@@ -2,9 +2,10 @@
2
2
  * @fileoverview obsidian_search_notes — text/jsonlogic/omnisearch search with
3
3
  * MCP-spec cursor pagination. The `omnisearch` mode is added conditionally by
4
4
  * the entry point only when the Omnisearch plugin's HTTP server is reachable
5
- * at startup. Text-mode hits additionally clip per file via `maxMatchesPerHit`
6
- * so a single match-heavy note can't blow the response budget — clipped hits
7
- * carry `truncated: true` and `totalMatches`.
5
+ * at startup. Text-mode hits carry match locations (the service merges a
6
+ * multi-token query's per-token spans) and additionally clip per file via
7
+ * `maxMatchesPerHit` so a single match-heavy note can't blow the response
8
+ * budget — clipped hits carry `truncated: true` and `totalMatches`.
8
9
  * @module mcp-server/tools/definitions/obsidian-search-notes.tool
9
10
  */
10
11
  import { tool, z } from '@cyanheads/mcp-ts-core';
@@ -26,34 +27,34 @@ const TextHitSchema = z
26
27
  matches: z
27
28
  .array(z
28
29
  .object({
29
- context: z.string().describe('Surrounding text around the match.'),
30
+ context: z.string().describe('Surrounding text around the location.'),
30
31
  match: z
31
32
  .object({
32
33
  start: z
33
34
  .number()
34
- .describe('Match start offset within the subject upstream matched — the note body in the usual case, or the note basename (extension stripped) when the filename itself matched, in which case `context` is that basename. This is not an offset into `context`; use `contextStart` for that. Note-body values index the same string `obsidian_get_note` returns.'),
35
+ .describe('Location start offset within the subject upstream matched — the note body in the usual case, or the note basename (extension stripped) when the filename itself matched, in which case `context` is that basename. This is not an offset into `context`; use `contextStart` for that. Note-body values index the same string `obsidian_get_note` returns.'),
35
36
  end: z
36
37
  .number()
37
- .describe('Match end offset within the same subject `start` indexes.'),
38
+ .describe('Location end offset within the same subject `start` indexes.'),
38
39
  contextStart: z
39
40
  .number()
40
- .describe('Match start offset within `context`. `context.slice(contextStart, contextEnd)` is the matched text.'),
41
- contextEnd: z.number().describe('Match end offset within `context`.'),
41
+ .describe('Location start offset within `context`. `context.slice(contextStart, contextEnd)` is the matched text, from the first matched token through the last.'),
42
+ contextEnd: z.number().describe('Location end offset within `context`.'),
42
43
  })
43
- .describe('Where the match sits, on two origins: `start`/`end` index the matched subject, `contextStart`/`contextEnd` index the accompanying `context` window.'),
44
+ .describe('Where the location sits, on two origins: `start`/`end` index the matched subject, `contextStart`/`contextEnd` index the accompanying `context` window.'),
44
45
  })
45
- .describe('A single match within a file.'))
46
- .describe('Per-match context windows. Capped per file by `maxMatchesPerHit`.'),
46
+ .describe('A match location within a file: one token occurrence, or several query tokens close enough to share one context window (a phrase).'))
47
+ .describe('Match locations with their context windows, in document order. Capped per file by `maxMatchesPerHit`.'),
47
48
  totalMatches: z
48
49
  .number()
49
50
  .optional()
50
- .describe('Total matches in this file. Present only when `matches` was clipped to `maxMatchesPerHit`.'),
51
+ .describe('Total match locations in this file. Present only when `matches` was clipped to `maxMatchesPerHit`.'),
51
52
  truncated: z
52
53
  .boolean()
53
54
  .optional()
54
- .describe('True when `matches` was clipped to `maxMatchesPerHit`. Use `obsidian_get_note` to read the full file when more context is needed.'),
55
+ .describe('True when `matches` was clipped to `maxMatchesPerHit` locations. Use `obsidian_get_note` to read the full file when more context is needed.'),
55
56
  })
56
- .describe('A file with one or more text-search matches.');
57
+ .describe('A file with one or more text-search match locations.');
57
58
  const StructuredHitSchema = z
58
59
  .object({
59
60
  filename: z.string().describe('Vault-relative path of the matching note.'),
@@ -92,18 +93,19 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
92
93
  ? ['text', 'jsonlogic', 'omnisearch']
93
94
  : ['text', 'jsonlogic'];
94
95
  const description = omnisearchReachable
95
- ? 'Search the vault by text substring, JSONLogic predicate, or BM25-ranked Omnisearch query. Pick the mode that matches the query shape — `omnisearch` is best for ranked relevance, typo tolerance, and PDF/OCR coverage (via the Text Extractor plugin). Results paginate via opaque cursors: omit `cursor` for the first page, then pass `nextCursor` from the prior response. Text-mode hits additionally clip per file at `maxMatchesPerHit`.'
96
- : 'Search the vault by text substring or JSONLogic predicate. Pick the mode that matches the query shape. Results paginate via opaque cursors: omit `cursor` for the first page, then pass `nextCursor` from the prior response. Text-mode hits additionally clip per file at `maxMatchesPerHit`.';
96
+ ? 'Search the vault by text tokens, JSONLogic predicate, or BM25-ranked Omnisearch query. Pick the mode that matches the query shape — `omnisearch` is best for ranked relevance, typo tolerance, and PDF/OCR coverage (via the Text Extractor plugin). Results paginate via opaque cursors: omit `cursor` for the first page, then pass `nextCursor` from the prior response. Text-mode hits additionally clip per file at `maxMatchesPerHit` match locations.'
97
+ : 'Search the vault by text tokens or JSONLogic predicate. Pick the mode that matches the query shape. Results paginate via opaque cursors: omit `cursor` for the first page, then pass `nextCursor` from the prior response. Text-mode hits additionally clip per file at `maxMatchesPerHit` match locations.';
98
+ const textModeDescription = '`text` splits `query` on whitespace and requires every token, each matched case-insensitively as a substring of the filename or note body. Quotes are literal characters, not a phrase operator. Each hit returns match locations with surrounding context windows; tokens that sit close together, such as the words of a phrase, share one location.';
97
99
  const inputSchema = z.object({
98
100
  mode: z
99
101
  .enum(modeEnum)
100
102
  .describe(omnisearchReachable
101
- ? 'Which search algorithm to run. `text` matches a substring case-insensitively across filenames and note bodies, returning surrounding context windows. `jsonlogic` evaluates a JSONLogic tree against each note, with `var` paths into `path`, `content`, `frontmatter.<key>`, `tags`, and `stat.{ctime,mtime,size}`, plus `glob` and `regexp` operators — both take their arguments as `[PATTERN, VALUE]`, so the pattern comes first and the `{"var": ...}` reference second. `omnisearch` runs a BM25-ranked query via the Omnisearch plugin — supports quoted phrases, `-exclusion`, `path:` / `ext:` filters, typo tolerance, and PDF/OCR (with Text Extractor); upstream caps results at 50.'
102
- : 'Which search algorithm to run. `text` matches a substring case-insensitively across filenames and note bodies, returning surrounding context windows. `jsonlogic` evaluates a JSONLogic tree against each note, with `var` paths into `path`, `content`, `frontmatter.<key>`, `tags`, and `stat.{ctime,mtime,size}`, plus `glob` and `regexp` operators — both take their arguments as `[PATTERN, VALUE]`, so the pattern comes first and the `{"var": ...}` reference second.'),
103
+ ? `Which search algorithm to run. ${textModeDescription} \`jsonlogic\` evaluates a JSONLogic tree against each note, with \`var\` paths into \`path\`, \`content\`, \`frontmatter.<key>\`, \`tags\`, and \`stat.{ctime,mtime,size}\`, plus \`glob\` and \`regexp\` operators — both take their arguments as \`[PATTERN, VALUE]\`, so the pattern comes first and the \`{"var": ...}\` reference second. \`omnisearch\` runs a BM25-ranked query via the Omnisearch plugin — supports quoted phrases, \`-exclusion\`, \`path:\` / \`ext:\` filters, typo tolerance, and PDF/OCR (with Text Extractor); upstream caps results at 50.`
104
+ : `Which search algorithm to run. ${textModeDescription} \`jsonlogic\` evaluates a JSONLogic tree against each note, with \`var\` paths into \`path\`, \`content\`, \`frontmatter.<key>\`, \`tags\`, and \`stat.{ctime,mtime,size}\`, plus \`glob\` and \`regexp\` operators — both take their arguments as \`[PATTERN, VALUE]\`, so the pattern comes first and the \`{"var": ...}\` reference second.`),
103
105
  query: z
104
106
  .string()
105
107
  .optional()
106
- .describe('The query string. Required for `text` and `omnisearch` modes; ignored in `jsonlogic` mode (use `logic` instead — this field must be a string, so passing a JSONLogic tree here is rejected).'),
108
+ .describe('The query string. Required for `text` and `omnisearch` modes; ignored in `jsonlogic` mode (use `logic` instead — this field must be a string, so passing a JSONLogic tree here is rejected). In `text` mode it is split on whitespace and every token must appear; quotes stay part of the tokens, so a quoted phrase matches nothing unless the note contains the quote characters.'),
107
109
  logic: z
108
110
  .record(z.string(), z.unknown())
109
111
  .optional()
@@ -113,7 +115,7 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
113
115
  .int()
114
116
  .positive()
115
117
  .default(100)
116
- .describe('Characters of context on each side of the match (text mode only). Sizes the rendered text as well as the structured payload, so a wide window multiplies the response across every match on the page.'),
118
+ .describe('Characters of context on each side of a match location (text mode only). Sizes the rendered text as well as the structured payload, so a wide window multiplies the response across every location on the page. Query tokens within 2 × `contextLength` of each other share a location.'),
117
119
  pathPrefix: z
118
120
  .string()
119
121
  .optional()
@@ -123,13 +125,13 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
123
125
  .int()
124
126
  .positive()
125
127
  .default(DEFAULT_MATCHES_PER_HIT)
126
- .describe('Cap on match contexts returned per file in text mode. When clipped, the hit carries `truncated: true` and `totalMatches`.'),
128
+ .describe('Cap on match locations returned per file in text mode. A phrase whose tokens share one location counts once. When clipped, the hit carries `truncated: true` and `totalMatches`.'),
127
129
  cursor: CursorSchema,
128
130
  });
129
131
  const textBranch = z
130
132
  .object({
131
133
  mode: z.literal('text').describe('Echoed mode.'),
132
- hits: z.array(TextHitSchema).describe('Matching files with per-match context.'),
134
+ hits: z.array(TextHitSchema).describe('Matching files with their match locations.'),
133
135
  totalCount: z
134
136
  .number()
135
137
  .describe('Total post-path-policy hit count across all pages, before pagination.'),
@@ -198,10 +200,11 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
198
200
  reason: 'query_required',
199
201
  code: JsonRpcErrorCode.ValidationError,
200
202
  when: '`query` is missing for `text` or `omnisearch` mode (required for both).',
201
- recovery: 'Pass `query` — substring for text mode, or BM25 query syntax (quoted phrases, `-exclusion`, `path:` / `ext:` filters) for omnisearch.',
203
+ recovery: 'Pass `query` — whitespace-separated tokens, all required, for text mode, or BM25 query syntax (quoted phrases, `-exclusion`, `path:` / `ext:` filters) for omnisearch.',
202
204
  },
203
205
  {
204
206
  reason: 'context_length_too_large',
207
+ thrownBy: 'service',
205
208
  code: JsonRpcErrorCode.ValidationError,
206
209
  when: 'The Local REST API exhausted its string capacity building one context window per match, so the whole text search failed.',
207
210
  recovery: 'Lower `contextLength`, or narrow the query so fewer notes match. The ceiling is the product of the two, so a broad query fails at a much smaller window than a narrow one does.',
@@ -214,12 +217,14 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
214
217
  },
215
218
  {
216
219
  reason: 'logic_invalid',
220
+ thrownBy: 'service',
217
221
  code: JsonRpcErrorCode.ValidationError,
218
222
  when: 'The Local REST API rejected the JSONLogic tree — an unrecognized operator, or an operand it could not evaluate (an uncompilable `regexp` pattern). A mis-arity operator is not rejected: it evaluates to false and the search returns zero hits.',
219
223
  recovery: 'Check the operator names and arity. `glob` and `regexp` take `[PATTERN, VALUE]` — pattern first, e.g. `{"regexp": ["^Inbox/", {"var": "path"}]}`; the reverse order compiles the note field as the pattern.',
220
224
  },
221
225
  {
222
226
  reason: 'omnisearch_unreachable',
227
+ thrownBy: 'service',
223
228
  code: JsonRpcErrorCode.ServiceUnavailable,
224
229
  when: 'Omnisearch was reachable at startup but is now unreachable (Obsidian quit, plugin disabled, or mobile session).',
225
230
  retryable: true,
@@ -325,7 +330,7 @@ export function buildSearchNotesTool({ omnisearchReachable }) {
325
330
  if (result.mode === 'text') {
326
331
  for (const h of result.hits) {
327
332
  const trunc = h.truncated
328
- ? ` — truncated, showing first ${h.matches.length} of ${h.totalMatches} matches`
333
+ ? ` — truncated, showing first ${h.matches.length} of ${h.totalMatches} locations`
329
334
  : '';
330
335
  lines.push(`### ${h.filename}${trunc}`);
331
336
  for (const m of h.matches) {
@@ -1 +1 @@
1
- {"version":3,"file":"obsidian-search-notes.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-search-notes.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,MAAM,aAAa,G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C;IAC1C,OAAO;QACL,GAAG,GAAG;QACN,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;QAClC,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM;KACjC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAS,MAAM,CAAC,IAAY,EAAE,IAAI,GAAG,MAAM;IACzC;;;;OAIG;IACH,MAAM,UAAU,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAChG,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACtD,OAAO,CAAC,GAAG,KAAK,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAU;IACnC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"obsidian-search-notes.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-search-notes.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE,OAAO,EAAE,aA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AAC;IACnB,CAAC;AACH,CAAC"}
@@ -50,51 +50,61 @@ export declare const obsidianWriteNote: import("@cyanheads/mcp-ts-core").ToolDef
50
50
  readonly recovery: "Retry with overwrite true or use obsidian_patch_note for in-place edits.";
51
51
  }, {
52
52
  readonly reason: "path_forbidden";
53
+ readonly thrownBy: "service";
53
54
  readonly code: JsonRpcErrorCode.Forbidden;
54
55
  readonly when: "The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.";
55
56
  readonly recovery: "Use a path inside the configured write scope. The error data echoes the active scope.";
56
57
  }, {
57
58
  readonly reason: "note_missing";
59
+ readonly thrownBy: "service";
58
60
  readonly code: JsonRpcErrorCode.NotFound;
59
61
  readonly when: "Section replace targets a path that does not resolve to an existing note (PATCH requires the file to exist).";
60
62
  readonly recovery: "Verify the path with obsidian_list_notes, or omit `section` to fall back to whole-file write (which creates the note when it is absent).";
61
63
  }, {
62
64
  readonly reason: "no_active_file";
65
+ readonly thrownBy: "service";
63
66
  readonly code: JsonRpcErrorCode.NotFound;
64
67
  readonly when: "Target was `active` but no file is currently open in Obsidian.";
65
68
  readonly recovery: "Call obsidian_open_in_ui to focus a file, or pass an explicit path target instead.";
66
69
  }, {
67
70
  readonly reason: "periodic_unsupported";
71
+ readonly thrownBy: "service";
68
72
  readonly code: JsonRpcErrorCode.NotFound;
69
73
  readonly when: "Target was `periodic` and this vault runs Local REST API v5.0.2 or later without the companion periodic-notes extension, so the `/periodic/` routes are not served at all.";
70
74
  readonly recovery: "Install the periodic-notes extension from https://github.com/coddingtonbear/obsidian-local-rest-api-periodic-notes, or address the note by an explicit vault path.";
71
75
  }, {
72
76
  readonly reason: "periodic_not_found";
77
+ readonly thrownBy: "service";
73
78
  readonly code: JsonRpcErrorCode.NotFound;
74
79
  readonly when: "Target was `periodic`, the `/periodic/` routes are served on this vault, and no note exists for the requested period.";
75
80
  readonly recovery: "Create the periodic note first or pass an explicit path target.";
76
81
  }, {
77
82
  readonly reason: "periodic_disabled";
83
+ readonly thrownBy: "service";
78
84
  readonly code: JsonRpcErrorCode.ValidationError;
79
85
  readonly when: "Target was `periodic` but the requested period is not enabled in Obsidian's Periodic Notes plugin settings.";
80
86
  readonly recovery: "Pass an explicit path target — the requested period is disabled in the operator's Periodic Notes plugin.";
81
87
  }, {
82
88
  readonly reason: "section_target_missing";
89
+ readonly thrownBy: "service";
83
90
  readonly code: JsonRpcErrorCode.ValidationError;
84
91
  readonly when: "`section` was provided but the named heading/block/frontmatter field does not exist in the note.";
85
92
  readonly recovery: "Call obsidian_get_note with format document-map to discover available targets.";
86
93
  }, {
87
94
  readonly reason: "ambiguous_section";
95
+ readonly thrownBy: "service";
88
96
  readonly code: JsonRpcErrorCode.Conflict;
89
- readonly when: "A bare heading leaf name matches more than one heading in the note, so the replacement target is undetermined.";
90
- readonly recovery: "Retry with one of the full Parent::Child heading paths listed in `candidates` on the error data.";
97
+ readonly when: "A bare heading leaf name matches more than one heading in the note, or the resolved full heading path occurs more than once, so the replacement target is undetermined.";
98
+ readonly recovery: "Retry with a distinct full Parent::Child heading path from `candidates` on the error data; when every candidate is the same path, rename the repeated headings first.";
91
99
  }, {
92
100
  readonly reason: "path_is_directory";
101
+ readonly thrownBy: "service";
93
102
  readonly code: JsonRpcErrorCode.ValidationError;
94
103
  readonly when: "The supplied path names a folder rather than a note file.";
95
104
  readonly recovery: "Call obsidian_list_notes with this path to list the folder, then retry with the full path of one of the files it returns.";
96
105
  }, {
97
106
  readonly reason: "path_traversal";
107
+ readonly thrownBy: "service";
98
108
  readonly code: JsonRpcErrorCode.ValidationError;
99
109
  readonly when: "The path contains a `.` or `..` segment, which is rejected to prevent vault escape.";
100
110
  readonly recovery: "Supply a vault-relative path with no `.` or `..` segments, e.g. \"Projects/Note.md\". Use obsidian_list_notes to browse the vault.";
@@ -1 +1 @@
1
- {"version":3,"file":"obsidian-write-note.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-write-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAIjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmM5B,CAAC"}
1
+ {"version":3,"file":"obsidian-write-note.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-write-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAKjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6M5B,CAAC"}
@@ -6,9 +6,10 @@
6
6
  import { tool, z } from '@cyanheads/mcp-ts-core';
7
7
  import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
8
8
  import { getObsidianService } from '../../../services/obsidian/obsidian-service.js';
9
+ import { parseAtxHeading } from '../../../services/obsidian/section-extractor.js';
9
10
  import { ContentTypeSchema, SectionSchema, TargetSchema } from './_shared/schemas.js';
10
11
  export const obsidianWriteNote = tool('obsidian_write_note', {
11
- description: 'Create or overwrite a note. With `section`, replaces just that heading/block/frontmatter section in place — use `obsidian_get_note` with `format: "document-map"` to discover available targets. A nested heading may be named either by its full `Parent::Child` path or by a bare leaf name that matches exactly one heading; a leaf shared by several headings is rejected with `ambiguous_section`. Whole-file writes fail with `file_exists` against an existing note unless `overwrite: true` — for in-place edits, prefer `obsidian_patch_note` (sections), `obsidian_append_to_note` (append), or `obsidian_replace_in_note` (find-and-replace). For heading sections, `content` is the new body; the heading line is preserved automatically.',
12
+ description: 'Create or overwrite a note. With `section`, replaces just that heading/block/frontmatter section in place — use `obsidian_get_note` with `format: "document-map"` to discover available targets. Name a heading by its full `Parent::Child` path as the document map lists it, or by a bare leaf name matched at any depth. A leaf shared by several headings is rejected with `ambiguous_section`, unless one of them has no parent heading, in which case the write targets that one; a full path that occurs more than once in the note is rejected with `ambiguous_section` too. Whole-file writes fail with `file_exists` against an existing note unless `overwrite: true` — for in-place edits, prefer `obsidian_patch_note` (sections), `obsidian_append_to_note` (append), or `obsidian_replace_in_note` (find-and-replace). For heading sections, `content` is the new body; the heading line is preserved automatically.',
12
13
  annotations: { idempotentHint: true, destructiveHint: true },
13
14
  input: z.object({
14
15
  target: TargetSchema.describe('Where the note lives.'),
@@ -51,60 +52,70 @@ export const obsidianWriteNote = tool('obsidian_write_note', {
51
52
  },
52
53
  {
53
54
  reason: 'path_forbidden',
55
+ thrownBy: 'service',
54
56
  code: JsonRpcErrorCode.Forbidden,
55
57
  when: 'The target path is outside OBSIDIAN_WRITE_PATHS, or OBSIDIAN_READ_ONLY=true denies all writes.',
56
58
  recovery: 'Use a path inside the configured write scope. The error data echoes the active scope.',
57
59
  },
58
60
  {
59
61
  reason: 'note_missing',
62
+ thrownBy: 'service',
60
63
  code: JsonRpcErrorCode.NotFound,
61
64
  when: 'Section replace targets a path that does not resolve to an existing note (PATCH requires the file to exist).',
62
65
  recovery: 'Verify the path with obsidian_list_notes, or omit `section` to fall back to whole-file write (which creates the note when it is absent).',
63
66
  },
64
67
  {
65
68
  reason: 'no_active_file',
69
+ thrownBy: 'service',
66
70
  code: JsonRpcErrorCode.NotFound,
67
71
  when: 'Target was `active` but no file is currently open in Obsidian.',
68
72
  recovery: 'Call obsidian_open_in_ui to focus a file, or pass an explicit path target instead.',
69
73
  },
70
74
  {
71
75
  reason: 'periodic_unsupported',
76
+ thrownBy: 'service',
72
77
  code: JsonRpcErrorCode.NotFound,
73
78
  when: 'Target was `periodic` and this vault runs Local REST API v5.0.2 or later without the companion periodic-notes extension, so the `/periodic/` routes are not served at all.',
74
79
  recovery: 'Install the periodic-notes extension from https://github.com/coddingtonbear/obsidian-local-rest-api-periodic-notes, or address the note by an explicit vault path.',
75
80
  },
76
81
  {
77
82
  reason: 'periodic_not_found',
83
+ thrownBy: 'service',
78
84
  code: JsonRpcErrorCode.NotFound,
79
85
  when: 'Target was `periodic`, the `/periodic/` routes are served on this vault, and no note exists for the requested period.',
80
86
  recovery: 'Create the periodic note first or pass an explicit path target.',
81
87
  },
82
88
  {
83
89
  reason: 'periodic_disabled',
90
+ thrownBy: 'service',
84
91
  code: JsonRpcErrorCode.ValidationError,
85
92
  when: "Target was `periodic` but the requested period is not enabled in Obsidian's Periodic Notes plugin settings.",
86
93
  recovery: "Pass an explicit path target — the requested period is disabled in the operator's Periodic Notes plugin.",
87
94
  },
88
95
  {
89
96
  reason: 'section_target_missing',
97
+ thrownBy: 'service',
90
98
  code: JsonRpcErrorCode.ValidationError,
91
99
  when: '`section` was provided but the named heading/block/frontmatter field does not exist in the note.',
92
100
  recovery: 'Call obsidian_get_note with format document-map to discover available targets.',
93
101
  },
94
102
  {
95
103
  reason: 'ambiguous_section',
104
+ thrownBy: 'service',
96
105
  code: JsonRpcErrorCode.Conflict,
97
- when: 'A bare heading leaf name matches more than one heading in the note, so the replacement target is undetermined.',
98
- recovery: 'Retry with one of the full Parent::Child heading paths listed in `candidates` on the error data.',
106
+ when: 'A bare heading leaf name matches more than one heading in the note, or the resolved full heading path occurs more than once, so the replacement target is undetermined.',
107
+ recovery: 'Retry with a distinct full Parent::Child heading path from `candidates` on the error data; when every candidate is the same path, rename the repeated headings first.',
99
108
  },
100
109
  {
101
110
  reason: 'path_is_directory',
111
+ thrownBy: 'service',
102
112
  code: JsonRpcErrorCode.ValidationError,
103
113
  when: 'The supplied path names a folder rather than a note file.',
104
114
  recovery: 'Call obsidian_list_notes with this path to list the folder, then retry with the full path of one of the files it returns.',
105
115
  },
106
116
  {
107
117
  reason: 'path_traversal',
118
+ thrownBy: 'service',
108
119
  code: JsonRpcErrorCode.ValidationError,
109
120
  when: 'The path contains a `.` or `..` segment, which is rejected to prevent vault escape.',
110
121
  recovery: 'Supply a vault-relative path with no `.` or `..` segments, e.g. "Projects/Note.md". Use obsidian_list_notes to browse the vault.',
@@ -174,19 +185,18 @@ export const obsidianWriteNote = tool('obsidian_write_note', {
174
185
  ],
175
186
  });
176
187
  /**
177
- * If `content` opens with a markdown heading whose text matches the leaf of
178
- * `headingTarget` (delimited by `::`), drop that heading line plus a single
179
- * blank line. Upstream PATCH-replace operates on the section *body*, so a
180
- * caller-supplied heading line would otherwise be embedded as a duplicate.
188
+ * If `content` opens with an ATX heading whose text — read by the same parser
189
+ * the section scan uses — matches the leaf of `headingTarget` (delimited by
190
+ * `::`), drop that heading line plus a single blank line. Upstream
191
+ * PATCH-replace operates on the section *body*, so a caller-supplied heading
192
+ * line would otherwise be embedded as a duplicate.
181
193
  */
182
194
  function stripLeadingHeading(content, headingTarget) {
183
195
  const leaf = headingTarget.split('::').pop()?.trim();
184
196
  if (!leaf)
185
197
  return content;
186
198
  const lines = content.split('\n');
187
- const first = lines[0]?.trimEnd() ?? '';
188
- const m = /^(#{1,6})\s+(.+)$/.exec(first);
189
- if (!m || m[2]?.trim() !== leaf)
199
+ if (parseAtxHeading(lines[0] ?? '')?.text !== leaf)
190
200
  return content;
191
201
  lines.shift();
192
202
  if (lines[0]?.trim() === '')
@@ -1 +1 @@
1
- {"version":3,"file":"obsidian-write-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-write-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,O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C,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC1G,cAAc,MAAM,CAAC,OAAO,EAAE;aAC/B,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF;CACF,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAS,mBAAmB,CAAC,OAAe,EAAE,aAAqB;IACjE,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC;IACrD,IAAI,CAAC,IAAI;QAAE,OAAO,OAAO,CAAC;IAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACxC,MAAM,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC;IAChD,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
1
+ {"version":3,"file":"obsidian-write-note.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/obsidian-write-note.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,eAAe,EAA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I,EAAE,MAAM;YACZ,IAAI,EAAE;gBACJ,KAAK,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,IAAI;gBAC5D,WAAW,MAAM,CAAC,mBAAmB,MAAM,MAAM,CAAC,kBAAkB,QAAQ;gBAC5E,uBAAuB,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;gBAC1G,cAAc,MAAM,CAAC,OAAO,EAAE;aAC/B,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF;CACF,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,OAAe,EAAE,aAAqB;IACjE,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC;IACrD,IAAI,CAAC,IAAI;QAAE,OAAO,OAAO,CAAC;IAC1B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC;IACnE,KAAK,CAAC,KAAK,EAAE,CAAC;IACd,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE;QAAE,KAAK,CAAC,KAAK,EAAE,CAAC;IAC3C,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -4,6 +4,21 @@
4
4
  * tools when the upstream Local REST API has no single-call equivalent.
5
5
  * @module services/obsidian/frontmatter-ops
6
6
  */
7
+ /**
8
+ * The outcome of a frontmatter mutation. A block that cannot be re-emitted
9
+ * faithfully is reported as a value rather than written or thrown: these
10
+ * helpers back a read-modify-write, so "cannot" means the caller would
11
+ * otherwise hand the vault a note with properties it never asked to change —
12
+ * or lose the block outright. The handlers turn `ok: false` into a typed,
13
+ * declared tool error and issue no write.
14
+ */
15
+ export type FrontmatterEdit = {
16
+ ok: true;
17
+ content: string;
18
+ } | {
19
+ ok: false;
20
+ problem: string;
21
+ };
7
22
  /** The two halves of a note: its raw frontmatter prefix and everything after it. */
8
23
  export interface Splice {
9
24
  /** Everything after the closing fence. The whole file when `hasFrontmatter` is false. */
@@ -34,9 +49,13 @@ export interface Splice {
34
49
  export declare function splice(content: string): Splice;
35
50
  /**
36
51
  * Describe why `yamlText` is not usable as a frontmatter block, or `undefined`
37
- * when it is. Catches YAML that no longer parses and YAML that parses to
52
+ * when it is. Catches YAML that no longer parses, YAML that parses to
38
53
  * something other than a mapping — the two states in which Obsidian reads no
39
- * properties at all.
54
+ * properties at all — and YAML that parses but cannot be emitted again.
55
+ *
56
+ * That last one is its own class: an unresolved alias (`bad: *missing`) is
57
+ * accepted by `parseDocument` with an empty `doc.errors` and refused only by
58
+ * the emitter, so the round trip is what surfaces it.
40
59
  *
41
60
  * It cannot catch an edit that stays well-formed while meaning something else:
42
61
  * a renamed key, a scalar that re-parses as a different type. Those are valid
@@ -44,11 +63,16 @@ export declare function splice(content: string): Splice;
44
63
  */
45
64
  export declare function frontmatterParseError(yamlText: string): string | undefined;
46
65
  /**
47
- * Returns the full file content with `key` removed from the frontmatter.
48
- * If the file has no frontmatter or the key isn't present, returns content
49
- * unchanged.
66
+ * The full file content with `key` removed from the frontmatter. A file with
67
+ * no frontmatter, or one where the key isn't present, comes back unchanged.
68
+ *
69
+ * Refuses — rather than writing — when the existing block does not parse as a
70
+ * mapping or the mutation leaves YAML that cannot be emitted. Both were silent
71
+ * data loss before: a block the parser recovered into a single malformed key
72
+ * was "emptied" by deleting that key, taking every sibling property and the
73
+ * block itself with it (issue #123).
50
74
  */
51
- export declare function deleteFrontmatterKey(content: string, key: string): string;
75
+ export declare function deleteFrontmatterKey(content: string, key: string): FrontmatterEdit;
52
76
  export interface TagReconcileResult {
53
77
  /** Tags actually changed (added/removed) at one or more locations. */
54
78
  applied: string[];
@@ -59,18 +83,27 @@ export interface TagReconcileResult {
59
83
  }
60
84
  export type TagOperation = 'add' | 'remove';
61
85
  export type TagLocation = 'frontmatter' | 'inline' | 'both';
86
+ /** A completed reconciliation, or the reason the frontmatter half refused. */
87
+ export type TagReconcileOutcome = ({
88
+ ok: true;
89
+ } & TagReconcileResult) | {
90
+ ok: false;
91
+ problem: string;
92
+ };
62
93
  /**
63
94
  * Add or remove tags across frontmatter (`tags:` array) and inline `#tag`
64
- * syntax. Inline detection skips code spans, link spans, and a hash escaped as
65
- * `\#` — see `splitProtectedSegments` and `TAG_LEFT_BOUNDARY`.
95
+ * syntax. Inline detection skips code spans, link spans, HTML comments, math,
96
+ * and a `#` preceded by anything but whitespace, line start, or markup such
97
+ * as `**` or `<br>` — see `splitProtectedSegments` and `TAG_LEFT_BOUNDARY`.
66
98
  */
67
- export declare function reconcileTags(content: string, tags: string[], operation: TagOperation, location: TagLocation): TagReconcileResult;
99
+ export declare function reconcileTags(content: string, tags: string[], operation: TagOperation, location: TagLocation): TagReconcileOutcome;
68
100
  /**
69
101
  * Read-only helpers for `obsidian_manage_tags list`. Inline tags are read from
70
102
  * the body only, and through the same protected-segment split and left boundary
71
103
  * a removal uses, so what `list` reports is exactly what `remove` can reach — a
72
- * `#` inside a YAML scalar, a code span, a link span, or escaped as `\#` is
73
- * none of them.
104
+ * `#` inside a YAML scalar, a code span, a link span, an HTML comment, or math,
105
+ * or one glued to the character before it (`\#`, `(#x`), is none of them. A tag
106
+ * runs for as long as `TAG_CHAR` matches, and an all-digit run is not a tag.
74
107
  */
75
108
  export declare function listTagsFromContent(content: string, frontmatter: Record<string, unknown>): {
76
109
  frontmatter: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"frontmatter-ops.d.ts","sourceRoot":"","sources":["../../../src/services/obsidian/frontmatter-ops.ts"],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