@markdy/mcp-server 1.1.1 → 1.1.2

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 +62 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -571,7 +571,12 @@ var SCOPES = {
571
571
  // `color` is unambiguous inside the block, but too generic at the root.
572
572
  chrome: { ...CHROME, color: CHROME.progressColor }
573
573
  };
574
+ var PLAYER_GROUPS = ["playback", "controls", "interaction", "chrome"];
574
575
  var PLAYER_FLAT_KEYS = Object.keys(FLAT);
576
+ function isKnownPlayerSetting(key, scope) {
577
+ if (scope) return Boolean(SCOPES[scope]?.[key]);
578
+ return PLAYER_GROUPS.includes(key) || Object.values(SCOPES).some((scopeMap) => Boolean(scopeMap[key]));
579
+ }
575
580
  function applyPlayerSetting(config, scope, key, rawValue) {
576
581
  const setting = SCOPES[scope][key];
577
582
  if (!setting) return `unknown player property '${key}'`;
@@ -1417,6 +1422,22 @@ function mirrorLegacySceneMeta(meta) {
1417
1422
  else if (chrome?.progressColor !== void 0) meta.progressColor = chrome.progressColor;
1418
1423
  return meta;
1419
1424
  }
1425
+ var NON_PLAYER_TOP_LEVEL_RE = /^(scene|player|layout|pattern|group|annotation|edge|beat|var|style)\b/;
1426
+ function isPlayerBlockLine(line) {
1427
+ if (PLAYER_GROUP_RE.test(line)) return true;
1428
+ const match = line.match(PLAYER_SETTING_RE);
1429
+ if (!match) return false;
1430
+ return isKnownPlayerSetting(match[1]);
1431
+ }
1432
+ function isNonPlayerTopLevelStatement(line) {
1433
+ if (line === "}") return true;
1434
+ if (NON_PLAYER_TOP_LEVEL_RE.test(line)) return true;
1435
+ if (isPlayerBlockLine(line)) return false;
1436
+ const nodeMatch = line.match(/^(\w[\w.-]*)\s+(\w[\w.-]*)/);
1437
+ if (!nodeMatch) return false;
1438
+ const kind = canonicalNodeKind(nodeMatch[1].toLowerCase());
1439
+ return NODE_KINDS.has(kind);
1440
+ }
1420
1441
  function isTopLevelStatement(line) {
1421
1442
  if (line === "}") return true;
1422
1443
  if (TOP_LEVEL_KEYWORDS_RE.test(line)) return true;
@@ -1670,8 +1691,32 @@ function parse(source, opts = {}) {
1670
1691
  const unsupportedMessage = unsupportedSyntaxMessage(line);
1671
1692
  if (unsupportedMessage) throw new ParseError(unsupportedMessage, lineNo);
1672
1693
  if (/^player\s*:\s*$/.test(line)) {
1673
- const { body, nextIdx } = readIndentedBody(blocks, i + 1, block.indent);
1674
- if (body.length === 0) throw new ParseError("player block requires at least one setting", lineNo);
1694
+ let { body, nextIdx } = readIndentedBody(blocks, i + 1, block.indent);
1695
+ if (body.length === 0 && i + 1 < blocks.length) {
1696
+ const unindented = [];
1697
+ let j = i + 1;
1698
+ while (j < blocks.length) {
1699
+ const nextBlock = blocks[j];
1700
+ if (nextBlock.indent < block.indent) break;
1701
+ if (nextBlock.indent === block.indent && isNonPlayerTopLevelStatement(nextBlock.text)) break;
1702
+ if (isNonPlayerTopLevelStatement(nextBlock.text)) break;
1703
+ unindented.push(nextBlock);
1704
+ j++;
1705
+ }
1706
+ if (unindented.length > 0) {
1707
+ body = unindented;
1708
+ nextIdx = j;
1709
+ }
1710
+ }
1711
+ if (body.length === 0) {
1712
+ if (i + 1 < blocks.length && isNonPlayerTopLevelStatement(blocks[i + 1].text)) {
1713
+ throw new ParseError(
1714
+ `player block requires at least one setting (found '${blocks[i + 1].text}' immediately following 'player:')`,
1715
+ lineNo
1716
+ );
1717
+ }
1718
+ throw new ParseError("player block requires at least one setting", lineNo);
1719
+ }
1675
1720
  const player = meta.player ??= {};
1676
1721
  const applySetting = (scope, setting) => {
1677
1722
  const match = setting.text.match(PLAYER_SETTING_RE);
@@ -1684,7 +1729,21 @@ function parse(source, opts = {}) {
1684
1729
  const groupMatch = setting.text.match(PLAYER_GROUP_RE);
1685
1730
  if (groupMatch) {
1686
1731
  const scope = groupMatch[1];
1687
- const { body: childBody, nextIdx: childNextIdx } = readIndentedBody(body, settingIdx + 1, setting.indent);
1732
+ let childBody = [];
1733
+ let childNextIdx = settingIdx + 1;
1734
+ const indented = readIndentedBody(body, settingIdx + 1, setting.indent);
1735
+ if (indented.body.length > 0) {
1736
+ childBody = indented.body;
1737
+ childNextIdx = indented.nextIdx;
1738
+ } else {
1739
+ let k = settingIdx + 1;
1740
+ while (k < body.length) {
1741
+ if (PLAYER_GROUP_RE.test(body[k].text)) break;
1742
+ childBody.push(body[k]);
1743
+ k++;
1744
+ }
1745
+ childNextIdx = k;
1746
+ }
1688
1747
  if (childBody.length === 0) {
1689
1748
  throw new ParseError(`player ${scope} block requires at least one setting`, setting.line);
1690
1749
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markdy/mcp-server",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Model Context Protocol server for Markdy diagram validation, transpilation, and generation.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,8 +39,8 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@modelcontextprotocol/sdk": "^1.6.1",
42
- "@markdy/compat": "1.1.1",
43
- "@markdy/core": "1.1.1"
42
+ "@markdy/compat": "1.1.2",
43
+ "@markdy/core": "1.1.2"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/node": "^25.9.5",