@dogsbay/commands 0.2.0-beta.126 → 0.2.0-beta.128

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.
@@ -16,7 +16,7 @@
16
16
  import { z } from "zod";
17
17
  import { createHash } from "node:crypto";
18
18
  import { dump as dumpYaml, load as loadYaml } from "js-yaml";
19
- import { fenceOpenBefore, slugifyHeadingText } from "@dogsbay/format-dogsbay-md";
19
+ import { containerOpenBefore, fenceOpenBefore, slugifyHeadingText } from "@dogsbay/format-dogsbay-md";
20
20
  import { normalizeStoragePath } from "../storage.js";
21
21
  import { splitFrontmatter } from "../edits.js";
22
22
  import { defineCommand } from "../engine.js";
@@ -28,32 +28,23 @@ const fail = (code, message, file, extra = {}) => ({
28
28
  // CommonMark ATX heading: up to 3 leading spaces, optional closing #s, optional {#id}
29
29
  const HEADING = /^ {0,3}(#{1,6})\s+(.*?)(?:\s+#+)?\s*(?:\{#([^\s}]+)[^}]*\})?\s*$/;
30
30
  const strip = (line) => line.replace(/\r$/, "");
31
- /** Structure state per body line: code fence (shared grammar) + HTML comment + `:::` container depth. */
31
+ /** Structure state per body line: code fence (shared grammar) + HTML comment + `:::` block (as the parser nests them). */
32
32
  const structureMask = (lines) => {
33
33
  const fence = fenceOpenBefore(lines.join("\n"));
34
+ const container = containerOpenBefore(lines.join("\n"));
34
35
  const mask = [];
35
36
  let inComment = false;
36
- let depth = 0;
37
37
  for (let i = 0; i < lines.length; i++) {
38
38
  const line = strip(lines[i]);
39
39
  const inFence = fence[i];
40
40
  // state BEFORE this line decides whether it can be a heading
41
- mask.push(inFence || inComment || depth > 0);
41
+ mask.push(inFence || inComment || container[i] === true);
42
42
  if (inFence)
43
43
  continue;
44
44
  if (!inComment && /^\s*<!--/.test(line) && !/-->/.test(line))
45
45
  inComment = true;
46
46
  else if (inComment && /-->/.test(line))
47
47
  inComment = false;
48
- if (inComment)
49
- continue;
50
- const container = /^ {0,3}(:{3,})\s*(\S.*)?$/.exec(line);
51
- if (container) {
52
- if (container[2])
53
- depth++;
54
- else if (depth > 0)
55
- depth--;
56
- }
57
48
  }
58
49
  return mask;
59
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dogsbay/commands",
3
- "version": "0.2.0-beta.126",
3
+ "version": "0.2.0-beta.128",
4
4
  "description": "Typed, headless-first command engine for the Dogsbay platform — one zod-defined command yields CLI, JSON-RPC, and MCP surfaces",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -24,11 +24,11 @@
24
24
  "dependencies": {
25
25
  "js-yaml": "^5.2.1",
26
26
  "zod": "^4.4.3",
27
- "@dogsbay/format-dogsbay-md": "0.2.0-beta.126",
28
- "@dogsbay/format-topicmap": "0.2.0-beta.126",
29
- "@dogsbay/minja": "0.2.0-beta.126",
30
- "@dogsbay/types": "0.2.0-beta.126",
31
- "@dogsbay/render": "0.2.0-beta.126"
27
+ "@dogsbay/minja": "0.2.0-beta.128",
28
+ "@dogsbay/format-dogsbay-md": "0.2.0-beta.128",
29
+ "@dogsbay/format-topicmap": "0.2.0-beta.128",
30
+ "@dogsbay/render": "0.2.0-beta.128",
31
+ "@dogsbay/types": "0.2.0-beta.128"
32
32
  },
33
33
  "license": "MIT",
34
34
  "repository": {