@velvetmonkey/flywheel-crank 0.11.4 → 0.11.6

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 (2) hide show
  1. package/dist/index.js +50 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -268,19 +268,7 @@ function insertInSection(content, section, newContent, position, options) {
268
268
  const formattedContent = newContent.trim();
269
269
  if (position === "prepend") {
270
270
  if (options?.preserveListNesting) {
271
- let indent = "";
272
- for (let i = section.contentStartLine; i <= section.endLine; i++) {
273
- const line = lines[i];
274
- const trimmed = line.trim();
275
- if (trimmed === "")
276
- continue;
277
- const listMatch = line.match(/^(\s*)[-*+]\s|^(\s*)\d+\.\s|^(\s*)[-*+]\s*\[[ xX]\]/);
278
- if (listMatch) {
279
- indent = listMatch[1] || listMatch[2] || listMatch[3] || "";
280
- break;
281
- }
282
- break;
283
- }
271
+ const indent = detectSectionBaseIndentation(lines, section.contentStartLine, section.endLine);
284
272
  if (indent) {
285
273
  const contentLines = formattedContent.split("\n");
286
274
  const indentedContent = contentLines.map((line, i) => {
@@ -1336,7 +1324,49 @@ var STOPWORDS = /* @__PURE__ */ new Set([
1336
1324
  "meanwhile",
1337
1325
  "furthermore",
1338
1326
  "moreover",
1339
- "nevertheless"
1327
+ "nevertheless",
1328
+ // Domain-specific (vault/PKM terms - prevent false matches)
1329
+ "note",
1330
+ "notes",
1331
+ "page",
1332
+ "pages",
1333
+ "vault",
1334
+ "link",
1335
+ "links",
1336
+ "wikilink",
1337
+ "wikilinks",
1338
+ "markdown",
1339
+ "frontmatter",
1340
+ "file",
1341
+ "files",
1342
+ "folder",
1343
+ "folders",
1344
+ "path",
1345
+ "paths",
1346
+ "section",
1347
+ "sections",
1348
+ "heading",
1349
+ "headings",
1350
+ "template",
1351
+ "templates",
1352
+ // Task/productivity terms
1353
+ "todo",
1354
+ "todos",
1355
+ "task",
1356
+ "tasks",
1357
+ "pending",
1358
+ "inbox",
1359
+ "archive",
1360
+ "draft",
1361
+ // Additional discourse markers
1362
+ "nonetheless",
1363
+ "accordingly",
1364
+ "alternatively",
1365
+ "specifically",
1366
+ "essentially",
1367
+ "particularly",
1368
+ "primarily",
1369
+ "additionally"
1340
1370
  ]);
1341
1371
  function isConsonant(word, i) {
1342
1372
  const c = word[i];
@@ -2090,7 +2120,7 @@ function registerMutationTools(server2, vaultPath2) {
2090
2120
  result2.tokensEstimate = estimateTokens(result2);
2091
2121
  return { content: [{ type: "text", text: JSON.stringify(result2, null, 2) }] };
2092
2122
  }
2093
- const { content: fileContent, frontmatter } = await readVaultFile(vaultPath2, notePath);
2123
+ const { content: fileContent, frontmatter, lineEnding } = await readVaultFile(vaultPath2, notePath);
2094
2124
  const sectionBoundary = findSection(fileContent, section);
2095
2125
  if (!sectionBoundary) {
2096
2126
  const headings = extractHeadings(fileContent);
@@ -2145,7 +2175,7 @@ function registerMutationTools(server2, vaultPath2) {
2145
2175
  position,
2146
2176
  { preserveListNesting }
2147
2177
  );
2148
- await writeVaultFile(vaultPath2, notePath, updatedContent, frontmatter);
2178
+ await writeVaultFile(vaultPath2, notePath, updatedContent, frontmatter, lineEnding);
2149
2179
  let gitCommit;
2150
2180
  let gitError;
2151
2181
  if (commit) {
@@ -2213,7 +2243,7 @@ function registerMutationTools(server2, vaultPath2) {
2213
2243
  result2.tokensEstimate = estimateTokens(result2);
2214
2244
  return { content: [{ type: "text", text: JSON.stringify(result2, null, 2) }] };
2215
2245
  }
2216
- const { content: fileContent, frontmatter } = await readVaultFile(vaultPath2, notePath);
2246
+ const { content: fileContent, frontmatter, lineEnding } = await readVaultFile(vaultPath2, notePath);
2217
2247
  const sectionBoundary = findSection(fileContent, section);
2218
2248
  if (!sectionBoundary) {
2219
2249
  const headings = extractHeadings(fileContent);
@@ -2250,7 +2280,7 @@ function registerMutationTools(server2, vaultPath2) {
2250
2280
  result2.tokensEstimate = estimateTokens(result2);
2251
2281
  return { content: [{ type: "text", text: JSON.stringify(result2, null, 2) }] };
2252
2282
  }
2253
- await writeVaultFile(vaultPath2, notePath, removeResult.content, frontmatter);
2283
+ await writeVaultFile(vaultPath2, notePath, removeResult.content, frontmatter, lineEnding);
2254
2284
  let gitCommit;
2255
2285
  let gitError;
2256
2286
  if (commit) {
@@ -2317,7 +2347,7 @@ function registerMutationTools(server2, vaultPath2) {
2317
2347
  result2.tokensEstimate = estimateTokens(result2);
2318
2348
  return { content: [{ type: "text", text: JSON.stringify(result2, null, 2) }] };
2319
2349
  }
2320
- const { content: fileContent, frontmatter } = await readVaultFile(vaultPath2, notePath);
2350
+ const { content: fileContent, frontmatter, lineEnding } = await readVaultFile(vaultPath2, notePath);
2321
2351
  const sectionBoundary = findSection(fileContent, section);
2322
2352
  if (!sectionBoundary) {
2323
2353
  const headings = extractHeadings(fileContent);
@@ -2382,7 +2412,7 @@ function registerMutationTools(server2, vaultPath2) {
2382
2412
  result2.tokensEstimate = estimateTokens(result2);
2383
2413
  return { content: [{ type: "text", text: JSON.stringify(result2, null, 2) }] };
2384
2414
  }
2385
- await writeVaultFile(vaultPath2, notePath, replaceResult.content, frontmatter);
2415
+ await writeVaultFile(vaultPath2, notePath, replaceResult.content, frontmatter, lineEnding);
2386
2416
  let gitCommit;
2387
2417
  let gitError;
2388
2418
  if (commit) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velvetmonkey/flywheel-crank",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "description": "Deterministic vault mutations for Obsidian via MCP",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",