@theglitchking/semantic-pages 0.5.0 → 0.6.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.
@@ -4393,52 +4393,54 @@ async function createServer(notesPath, options = {}) {
4393
4393
  return textResponse(JSON.stringify(list, null, 2));
4394
4394
  }
4395
4395
  );
4396
- server.tool(
4397
- "create_note",
4398
- "Create a new markdown note",
4399
- {
4400
- path: external_exports.string(),
4401
- content: external_exports.string(),
4402
- frontmatter: external_exports.record(external_exports.unknown()).optional()
4403
- },
4404
- async ({ path, content, frontmatter }) => {
4405
- await crud.create(path, content, frontmatter);
4406
- return textResponse(`Created: ${path}`);
4407
- }
4408
- );
4409
- server.tool(
4410
- "update_note",
4411
- "Edit note content \u2014 overwrite, append, prepend, or patch by heading",
4412
- {
4413
- path: external_exports.string(),
4414
- content: external_exports.string(),
4415
- mode: external_exports.enum(["overwrite", "append", "prepend", "patch-by-heading"]),
4416
- heading: external_exports.string().optional()
4417
- },
4418
- async ({ path, content, mode, heading }) => {
4419
- await crud.update(path, content, { mode, heading });
4420
- return textResponse(`Updated: ${path} (${mode})`);
4421
- }
4422
- );
4423
- server.tool(
4424
- "delete_note",
4425
- "Delete a note permanently",
4426
- { path: external_exports.string(), confirm: external_exports.boolean().default(false) },
4427
- async ({ path, confirm }) => {
4428
- if (!confirm) return textResponse(`Set confirm=true to delete ${path}`);
4429
- await crud.delete(path);
4430
- return textResponse(`Deleted: ${path}`);
4431
- }
4432
- );
4433
- server.tool(
4434
- "move_note",
4435
- "Move or rename a note \u2014 updates wikilinks across the vault",
4436
- { from: external_exports.string(), to: external_exports.string() },
4437
- async ({ from, to }) => {
4438
- await crud.move(from, to);
4439
- return textResponse(`Moved: ${from} \u2192 ${to}`);
4440
- }
4441
- );
4396
+ if (!options.readOnly) {
4397
+ server.tool(
4398
+ "create_note",
4399
+ "Create a new markdown note",
4400
+ {
4401
+ path: external_exports.string(),
4402
+ content: external_exports.string(),
4403
+ frontmatter: external_exports.record(external_exports.unknown()).optional()
4404
+ },
4405
+ async ({ path, content, frontmatter }) => {
4406
+ await crud.create(path, content, frontmatter);
4407
+ return textResponse(`Created: ${path}`);
4408
+ }
4409
+ );
4410
+ server.tool(
4411
+ "update_note",
4412
+ "Edit note content \u2014 overwrite, append, prepend, or patch by heading",
4413
+ {
4414
+ path: external_exports.string(),
4415
+ content: external_exports.string(),
4416
+ mode: external_exports.enum(["overwrite", "append", "prepend", "patch-by-heading"]),
4417
+ heading: external_exports.string().optional()
4418
+ },
4419
+ async ({ path, content, mode, heading }) => {
4420
+ await crud.update(path, content, { mode, heading });
4421
+ return textResponse(`Updated: ${path} (${mode})`);
4422
+ }
4423
+ );
4424
+ server.tool(
4425
+ "delete_note",
4426
+ "Delete a note permanently",
4427
+ { path: external_exports.string(), confirm: external_exports.boolean().default(false) },
4428
+ async ({ path, confirm }) => {
4429
+ if (!confirm) return textResponse(`Set confirm=true to delete ${path}`);
4430
+ await crud.delete(path);
4431
+ return textResponse(`Deleted: ${path}`);
4432
+ }
4433
+ );
4434
+ server.tool(
4435
+ "move_note",
4436
+ "Move or rename a note \u2014 updates wikilinks across the vault",
4437
+ { from: external_exports.string(), to: external_exports.string() },
4438
+ async ({ from, to }) => {
4439
+ await crud.move(from, to);
4440
+ return textResponse(`Moved: ${from} \u2192 ${to}`);
4441
+ }
4442
+ );
4443
+ }
4442
4444
  server.tool(
4443
4445
  "get_frontmatter",
4444
4446
  "Read parsed YAML frontmatter from a note as JSON",
@@ -4448,51 +4450,53 @@ async function createServer(notesPath, options = {}) {
4448
4450
  return textResponse(JSON.stringify(fm, null, 2));
4449
4451
  }
4450
4452
  );
4451
- server.tool(
4452
- "update_frontmatter",
4453
- "Set or delete YAML frontmatter keys \u2014 pass null to delete a key",
4454
- { path: external_exports.string(), fields: external_exports.record(external_exports.unknown()) },
4455
- async ({ path, fields }) => {
4456
- await frontmatterManager.update(path, fields);
4457
- return textResponse(`Frontmatter updated: ${path}`);
4458
- }
4459
- );
4460
- server.tool(
4461
- "manage_tags",
4462
- "Add, remove, or list tags on a note (frontmatter and inline)",
4463
- {
4464
- path: external_exports.string(),
4465
- action: external_exports.enum(["add", "remove", "list"]),
4466
- tags: external_exports.array(external_exports.string()).optional()
4467
- },
4468
- async ({ path, action, tags }) => {
4469
- switch (action) {
4470
- case "list": {
4471
- const result = await tagManager.list(path);
4472
- return textResponse(JSON.stringify(result));
4473
- }
4474
- case "add": {
4475
- if (!tags?.length) return textResponse("No tags provided");
4476
- await tagManager.add(path, tags);
4477
- return textResponse(`Added tags to ${path}: ${tags.join(", ")}`);
4478
- }
4479
- case "remove": {
4480
- if (!tags?.length) return textResponse("No tags provided");
4481
- await tagManager.remove(path, tags);
4482
- return textResponse(`Removed tags from ${path}: ${tags.join(", ")}`);
4453
+ if (!options.readOnly) {
4454
+ server.tool(
4455
+ "update_frontmatter",
4456
+ "Set or delete YAML frontmatter keys \u2014 pass null to delete a key",
4457
+ { path: external_exports.string(), fields: external_exports.record(external_exports.unknown()) },
4458
+ async ({ path, fields }) => {
4459
+ await frontmatterManager.update(path, fields);
4460
+ return textResponse(`Frontmatter updated: ${path}`);
4461
+ }
4462
+ );
4463
+ server.tool(
4464
+ "manage_tags",
4465
+ "Add, remove, or list tags on a note (frontmatter and inline)",
4466
+ {
4467
+ path: external_exports.string(),
4468
+ action: external_exports.enum(["add", "remove", "list"]),
4469
+ tags: external_exports.array(external_exports.string()).optional()
4470
+ },
4471
+ async ({ path, action, tags }) => {
4472
+ switch (action) {
4473
+ case "list": {
4474
+ const result = await tagManager.list(path);
4475
+ return textResponse(JSON.stringify(result));
4476
+ }
4477
+ case "add": {
4478
+ if (!tags?.length) return textResponse("No tags provided");
4479
+ await tagManager.add(path, tags);
4480
+ return textResponse(`Added tags to ${path}: ${tags.join(", ")}`);
4481
+ }
4482
+ case "remove": {
4483
+ if (!tags?.length) return textResponse("No tags provided");
4484
+ await tagManager.remove(path, tags);
4485
+ return textResponse(`Removed tags from ${path}: ${tags.join(", ")}`);
4486
+ }
4483
4487
  }
4484
4488
  }
4485
- }
4486
- );
4487
- server.tool(
4488
- "rename_tag",
4489
- "Rename a tag across all notes in the vault",
4490
- { oldTag: external_exports.string(), newTag: external_exports.string() },
4491
- async ({ oldTag, newTag }) => {
4492
- const count = await tagManager.renameVaultWide(oldTag, newTag);
4493
- return textResponse(`Renamed #${oldTag} \u2192 #${newTag} in ${count} files`);
4494
- }
4495
- );
4489
+ );
4490
+ server.tool(
4491
+ "rename_tag",
4492
+ "Rename a tag across all notes in the vault",
4493
+ { oldTag: external_exports.string(), newTag: external_exports.string() },
4494
+ async ({ oldTag, newTag }) => {
4495
+ const count = await tagManager.renameVaultWide(oldTag, newTag);
4496
+ return textResponse(`Renamed #${oldTag} \u2192 #${newTag} in ${count} files`);
4497
+ }
4498
+ );
4499
+ }
4496
4500
  server.tool(
4497
4501
  "backlinks",
4498
4502
  "Find all notes that link TO a given note",