@theholocron/astromech 5.0.0-alpha.548 → 5.0.0-alpha.549

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.
@@ -87,10 +87,11 @@ function packageOf(file, readPackage) {
87
87
  * text has no marker.
88
88
  */
89
89
  function parseSkipDocs(text) {
90
- const match = /\[skip docs(?::\s*([^\]]*?))?\][ \t]*([^\n]*)/i.exec(text);
90
+ const match = /\[skip docs(?::([^\]]*))?\][ \t]*([^\n]*)/i.exec(text);
91
91
  if (!match) return null;
92
+ const names = match[1]?.trim();
92
93
  return {
93
- scope: match[1] ? match[1].split(",").map((s) => s.trim()).filter(Boolean) : null,
94
+ scope: names ? names.split(",").map((s) => s.trim()).filter(Boolean) : null,
94
95
  reason: match[2].trim()
95
96
  };
96
97
  }
@@ -430,7 +431,7 @@ function reconcileSpecStatus({ file, tag, synced }) {
430
431
  /** The longest summary a post carries; a chat message caps near 2000 and the post adds a link and a footer. */
431
432
  const MAX_SUMMARY = 1e3;
432
433
  /** The headings whose first paragraph says what the document is for, in the order they are looked for. */
433
- const SUMMARY_HEADINGS = /^#{2,3}[ \t]+(problem|why|context|summary|overview)[ \t]*#*[ \t]*$/i;
434
+ const SUMMARY_HEADINGS = /^#{2,3}[ \t]+(problem|why|context|summary|overview)(?:[ \t]*#+)?[ \t]*$/i;
434
435
  /**
435
436
  * The first paragraph of a block of lines starting at `from`: skips blank lines, then reads lines up to the next blank
436
437
  * one. A heading, a table row or a code fence is not a paragraph, so the search goes on past it.
@@ -474,13 +475,31 @@ function plain(text) {
474
475
  return cleaned.length > MAX_TITLE ? `${cleaned.slice(0, 99)}…` : cleaned;
475
476
  }
476
477
  /**
478
+ * The text of the first `# ` heading of `body` (closing `#`s and the spaces around them dropped), or `undefined`. Read one
479
+ * line at a time from both ends, not with a pattern, so a long run of spaces or hashes costs one pass.
480
+ */
481
+ function firstHeading(body) {
482
+ const blank = (c) => c === " " || c === " ";
483
+ for (const raw of body.split("\n")) {
484
+ const line = raw.endsWith("\r") ? raw.slice(0, -1) : raw;
485
+ if (line[0] !== "#" || !blank(line[1])) continue;
486
+ let start = 1;
487
+ while (blank(line[start])) start += 1;
488
+ let end = line.length;
489
+ while (end > start && blank(line[end - 1])) end -= 1;
490
+ while (end > start && line[end - 1] === "#") end -= 1;
491
+ while (end > start && blank(line[end - 1])) end -= 1;
492
+ const text = end > start ? line.slice(start, end) : line.slice(start, start + 1);
493
+ if (text !== "") return text;
494
+ }
495
+ }
496
+ /**
477
497
  * A spec's title for a chat post: its first `# ` heading after the frontmatter, else its file name without `.spec.md`.
478
498
  * What the file says is written by whoever opened the pull request, so the result carries no markdown, brackets or
479
499
  * line breaks that could turn it into a link or a layout of its own.
480
500
  */
481
501
  function specTitle(path, text) {
482
- const body = text.replace(/^---\n[\s\S]*?\n---\n?/, "");
483
- const heading = /^#[ \t]+(.+?)[ \t]*#*[ \t]*$/m.exec(body)?.[1];
502
+ const heading = firstHeading(text.replace(/^---\n[\s\S]*?\n---\n?/, ""));
484
503
  const name = path.slice(path.lastIndexOf("/") + 1).replace(/\.spec\.md$/, "");
485
504
  return (heading === void 0 ? "" : plain(heading)) || plain(name);
486
505
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/astromech",
3
- "version": "5.0.0-alpha.548",
3
+ "version": "5.0.0-alpha.549",
4
4
  "description": "The Holocron task runner — one task manifest drives `holocron run`, `holocron run ci`, the CI workflows, package.json scripts, linters, and required checks.",
5
5
  "keywords": [
6
6
  "ci",
@@ -55,11 +55,11 @@
55
55
  "@commitlint/lint": "^21.2.3",
56
56
  "@commitlint/load": "^21.2.3",
57
57
  "@commitlint/types": "^21.2.3",
58
- "@theholocron/datapad": "5.0.0-alpha.548",
58
+ "@theholocron/datapad": "5.0.0-alpha.549",
59
59
  "@theholocron/fs-utils": "^1.17.0-alpha.6",
60
60
  "@theholocron/json-utils": "^1.17.0-alpha.6",
61
- "@theholocron/pkg-utils": "^1.17.0-alpha.6",
62
- "@theholocron/misc-utils": "^1.17.0-alpha.6"
61
+ "@theholocron/misc-utils": "^1.17.0-alpha.6",
62
+ "@theholocron/pkg-utils": "^1.17.0-alpha.6"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@commitlint/config-conventional": "^21.2.3",
@@ -74,12 +74,12 @@
74
74
  "typescript": "^6.0.3",
75
75
  "vitest": "^5.1.1",
76
76
  "@theholocron/ci": "1.0.0",
77
- "@theholocron/commitlint-config": "^8.9.0-alpha.23",
78
- "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.23",
79
- "@theholocron/eslint-config": "^8.9.0-alpha.23",
80
- "@theholocron/tsconfig": "^8.9.0-alpha.23",
81
- "@theholocron/tsdown-config": "^8.9.0-alpha.23",
82
- "@theholocron/vitest-config": "^8.9.0-alpha.23"
77
+ "@theholocron/commitlint-config": "^8.9.0-alpha.24",
78
+ "@theholocron/eslint-config": "^8.9.0-alpha.24",
79
+ "@theholocron/rollup-plugin-transform-template": "^8.9.0-alpha.24",
80
+ "@theholocron/tsconfig": "^8.9.0-alpha.24",
81
+ "@theholocron/tsdown-config": "^8.9.0-alpha.24",
82
+ "@theholocron/vitest-config": "^8.9.0-alpha.24"
83
83
  },
84
84
  "engines": {
85
85
  "node": ">=22"