@radicaltools/mcp 0.3.3 → 0.3.4

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.
@@ -31,7 +31,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  var define_RADICAL_BUILD_default;
32
32
  var init_define_RADICAL_BUILD = __esm({
33
33
  "<define:__RADICAL_BUILD__>"() {
34
- define_RADICAL_BUILD_default = { version: "0.3.3", commit: "b56a895", date: "2026-11-03", release: true };
34
+ define_RADICAL_BUILD_default = { version: "0.3.4", commit: "1a00a35", date: "2026-11-06", release: true };
35
35
  }
36
36
  });
37
37
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  applyElkLayout,
3
3
  applyTreeLayout
4
- } from "./chunk-DRPYDYRL.js";
4
+ } from "./chunk-JTRIDVBS.js";
5
5
  export {
6
6
  applyElkLayout,
7
7
  applyTreeLayout
package/dist/index.js CHANGED
@@ -85,7 +85,7 @@ import {
85
85
  viewShowsEveryNode,
86
86
  wikiDepthOf,
87
87
  withCanvasPositions
88
- } from "./chunk-DRPYDYRL.js";
88
+ } from "./chunk-JTRIDVBS.js";
89
89
 
90
90
  // ../../node_modules/webcola/dist/src/powergraph.js
91
91
  var require_powergraph = __commonJS({
@@ -12033,9 +12033,6 @@ var STAGE_IDS = new Set(FORGE_STAGES.map((s) => s.id));
12033
12033
  // ../../packages/common/src/check/index.ts
12034
12034
  init_define_RADICAL_BUILD();
12035
12035
 
12036
- // ../../packages/common/src/check/rules.ts
12037
- init_define_RADICAL_BUILD();
12038
-
12039
12036
  // ../../packages/common/src/repositoryMapping.ts
12040
12037
  init_define_RADICAL_BUILD();
12041
12038
  var REPOSITORY_FILE = ".radical/radical.json";
@@ -12069,7 +12066,12 @@ function parseRepositoryFile(text2, file = REPOSITORY_FILE) {
12069
12066
  };
12070
12067
  const tests = settings("tests", ["include", "exclude"]);
12071
12068
  const ci = settings("ci", ["artifacts"]);
12069
+ const model = raw?.model;
12070
+ if (model !== void 0 && (typeof model?.repo !== "string" || !model.repo || model.ref !== void 0 && typeof model.ref !== "string")) {
12071
+ throw new Error(`${file}: "model" needs "repo" (the address of the model's repository), and "ref" is a branch or tag`);
12072
+ }
12072
12073
  return {
12074
+ ...model ? { model: { repo: model.repo, ...model.ref ? { ref: model.ref } : {} } } : {},
12073
12075
  ...tests ? { tests } : {},
12074
12076
  ...ci ? { ci } : {},
12075
12077
  implements: list("implements").map((e, i) => {
@@ -12095,6 +12097,7 @@ ${lines.join(",\n")}
12095
12097
  ` : ""}]`;
12096
12098
  const inline = (v) => `{ ${Object.entries(v).map(([k, list]) => `${JSON.stringify(k)}: [${list.map((x) => JSON.stringify(x)).join(", ")}]`).join(", ")} }`;
12097
12099
  const settings = [
12100
+ ...file.model ? [` "model": { ${Object.entries(file.model).map(([k, v]) => `${JSON.stringify(k)}: ${JSON.stringify(v)}`).join(", ")} }`] : [],
12098
12101
  ...file.tests ? [` "tests": ${inline(file.tests)}`] : [],
12099
12102
  ...file.ci ? [` "ci": ${inline(file.ci)}`] : []
12100
12103
  ];
@@ -12116,6 +12119,38 @@ function builtIn(mapped, id, parentOf) {
12116
12119
  }
12117
12120
  return null;
12118
12121
  }
12122
+ function repositoryPartIds(data, mapped) {
12123
+ const parent = new Map(data.nodes.map((n) => [n.id, n.parentId]));
12124
+ const under = (id, roots) => {
12125
+ for (let at = id; at; at = parent.get(at)) if (roots.has(at)) return true;
12126
+ return false;
12127
+ };
12128
+ const from = (type, targets) => data.relations.filter((r) => r.relationType === type && targets.has(r.targetId)).map((r) => r.sourceId);
12129
+ const to = (type, sources) => data.relations.filter((r) => r.relationType === type && sources.has(r.sourceId)).map((r) => r.targetId);
12130
+ const elements = new Set(data.nodes.filter((n) => builtIn(mapped, n.id, (id) => parent.get(id))).map((n) => n.id));
12131
+ const requirements = new Set(to("satisfies", elements));
12132
+ for (let size = -1; size !== requirements.size; ) {
12133
+ size = requirements.size;
12134
+ for (const id of to("derives", requirements)) requirements.add(id);
12135
+ }
12136
+ const realised = new Set(to("realises", elements));
12137
+ const machines = /* @__PURE__ */ new Set([...to("implements", elements), ...from("lifecycle-of", realised)]);
12138
+ const entities = [...realised, ...to("lifecycle-of", machines)];
12139
+ const behaviour = data.nodes.filter((n) => under(n.id, machines)).map((n) => n.id);
12140
+ const adrs = new Set(from("constrains", elements));
12141
+ return /* @__PURE__ */ new Set([
12142
+ ...elements,
12143
+ ...requirements,
12144
+ ...entities,
12145
+ ...behaviour,
12146
+ ...from("verifies", /* @__PURE__ */ new Set([...requirements, ...machines])),
12147
+ ...adrs,
12148
+ ...from("implements", adrs)
12149
+ ]);
12150
+ }
12151
+
12152
+ // ../../packages/common/src/check/rules.ts
12153
+ init_define_RADICAL_BUILD();
12119
12154
 
12120
12155
  // ../../packages/common/src/check/evidence.ts
12121
12156
  init_define_RADICAL_BUILD();
@@ -13431,7 +13466,8 @@ async function upwards(from) {
13431
13466
  const dirs = [];
13432
13467
  for (let dir = resolve(from); ; dir = dirname2(dir)) {
13433
13468
  dirs.push(dir);
13434
- if (await exists(join(dir, ".git")) || dirname2(dir) === dir) return dirs;
13469
+ const checkout = basename(dir) === "model" && basename(dirname2(dir)) === RADICAL_DIR;
13470
+ if (!checkout && await exists(join(dir, ".git")) || dirname2(dir) === dir) return dirs;
13435
13471
  }
13436
13472
  }
13437
13473
  async function repositoryRoot(from) {
@@ -13675,6 +13711,14 @@ import { promisify } from "util";
13675
13711
 
13676
13712
  // ../../packages/common/src/modelChanges.ts
13677
13713
  init_define_RADICAL_BUILD();
13714
+ function onlyPart(report, ids) {
13715
+ const element = (list) => list.filter((e) => ids.has(e.id));
13716
+ const relation = (list) => list.filter((r) => ids.has(r.source.id) || ids.has(r.target.id));
13717
+ return {
13718
+ elements: { added: element(report.elements.added), removed: element(report.elements.removed), changed: element(report.elements.changed) },
13719
+ relations: { added: relation(report.relations.added), removed: relation(report.relations.removed), changed: relation(report.relations.changed) }
13720
+ };
13721
+ }
13678
13722
  var NOT_MODEL = /* @__PURE__ */ new Set(["id", "x", "y", "width", "height", "collapsed"]);
13679
13723
  var SHOWN = /* @__PURE__ */ new Set(["type", "label", "parentId", "sourceId", "targetId", "relationType"]);
13680
13724
  var present = (value) => modelValue(value) !== null;
@@ -13958,8 +14002,12 @@ async function modelChangesSince(folder, current, since, options = {}) {
13958
14002
  }
13959
14003
  const before = { nodes: byId2(old.nodes), relations: byId2(old.relations) };
13960
14004
  const after = { nodes: byId2(current.nodes), relations: byId2(current.relations) };
13961
- const report = modelChangeReport(before, after);
14005
+ let report = modelChangeReport(before, after);
13962
14006
  const mapping = await readRepositoryMapping(folder).catch(() => null);
14007
+ if (options.part) {
14008
+ if (!mapping) throw new Error("--part needs the repository's .radical/radical.json");
14009
+ report = onlyPart(report, /* @__PURE__ */ new Set([...repositoryPartIds(old, mapping.implements), ...repositoryPartIds(current, mapping.implements)]));
14010
+ }
13963
14011
  if (mapping) {
13964
14012
  for (const change of [...report.elements.added, ...report.elements.changed, ...report.elements.removed]) {
13965
14013
  if (change.type === "scenario" || change.type === "fitness-fn") change.tests = testsBoundTo(mapping.verifies, change.id);
@@ -20953,7 +21001,7 @@ function unchangedResult(nodes, relations, style = "curved") {
20953
21001
  }
20954
21002
  async function runSmartLayoutELKPhase(inputNodes, inputRelations, metamodel, onProgress) {
20955
21003
  const { nodes, relations } = projectToVisibleGraph(inputNodes, inputRelations);
20956
- const { applyElkLayout } = await import("./elkLayout-XPMSDPVA.js");
21004
+ const { applyElkLayout } = await import("./elkLayout-ILGQJOJF.js");
20957
21005
  const depth2 = maxContainmentDepth(metamodel);
20958
21006
  const mmDirection = depth2 >= 2 ? "RIGHT" : "DOWN";
20959
21007
  const engines = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radicaltools/mcp",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Local MCP server for Radical Markdown model folders.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://radical.tools",