@markasso/mcp 0.5.0 → 0.5.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.
@@ -4202,7 +4202,7 @@ function escapeXml(str) {
4202
4202
  }
4203
4203
  //#endregion
4204
4204
  //#region package.json
4205
- var version = "0.5.0";
4205
+ var version = "0.5.1";
4206
4206
  //#endregion
4207
4207
  //#region ../src/core/layout.ts
4208
4208
  /** Orders vertices without recursion, preserving input order when unconstrained. */
@@ -5754,10 +5754,22 @@ var Diagram = class {
5754
5754
  }
5755
5755
  return byId;
5756
5756
  }
5757
+ /**
5758
+ * The node a caller's key names: exact keys first, then the key as addNodes
5759
+ * normalizes it (a model that added "Client" may keep writing "Client").
5760
+ */
5761
+ findId(key) {
5762
+ const normalized = slugify(key);
5763
+ for (const candidate of normalized && normalized !== key ? [key, normalized] : [key]) {
5764
+ const known = this.keys.get(candidate);
5765
+ if (known && this.elements.some((el) => el.id === known)) return known;
5766
+ for (const [id, k] of this.nodeKeys()) if (k === candidate) return id;
5767
+ }
5768
+ }
5769
+ /** `findId`, or the error the model can act on. */
5757
5770
  idOf(key) {
5758
- const known = this.keys.get(key);
5759
- if (known && this.elements.some((el) => el.id === known)) return known;
5760
- for (const [id, k] of this.nodeKeys()) if (k === key) return id;
5771
+ const id = this.findId(key);
5772
+ if (id !== void 0) return id;
5761
5773
  throw new DiagramError(`Unknown node "${key}". Call diagram_read to see the keys.`);
5762
5774
  }
5763
5775
  dispatch(command) {
@@ -6058,14 +6070,14 @@ var Diagram = class {
6058
6070
  }
6059
6071
  /**
6060
6072
  * Arranges nodes in layers following their connections (all nodes, or
6061
- * only `keys`) in one undoable step. Returns how many nodes moved.
6073
+ * only `keys`, resolved like the other tools; unknown ones are ignored) in
6074
+ * one undoable step. Returns how many nodes moved.
6062
6075
  */
6063
6076
  layout(direction, keys) {
6064
6077
  const nodeKeys = this.nodeKeys();
6065
- const wanted = keys ? new Set(keys) : null;
6078
+ const wanted = keys ? new Set(keys.flatMap((key) => this.findId(key) ?? [])) : null;
6066
6079
  const nodes = this.elements.filter((el) => {
6067
- const key = nodeKeys.get(el.id);
6068
- return key !== void 0 && (!wanted || wanted.has(key));
6080
+ return nodeKeys.get(el.id) !== void 0 && (!wanted || wanted.has(el.id));
6069
6081
  });
6070
6082
  if (nodes.length === 0) return 0;
6071
6083
  const ids = new Set(nodes.map((el) => el.id));
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@markasso/mcp",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "MCP server that lets AI agents create, read and edit Markasso diagrams, offline or live on a shared board",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/AlbertoBarrago/Markasso.git",
8
+ "url": "git+https://github.com/AlbertoBarrago/markasso.git",
9
9
  "directory": "mcp"
10
10
  },
11
- "homepage": "https://github.com/AlbertoBarrago/Markasso/tree/main/mcp#readme",
12
- "bugs": "https://github.com/AlbertoBarrago/Markasso/issues",
11
+ "homepage": "https://github.com/AlbertoBarrago/markasso/tree/main/mcp#readme",
12
+ "bugs": "https://github.com/AlbertoBarrago/markasso/issues",
13
13
  "keywords": [
14
14
  "mcp",
15
15
  "model-context-protocol",