@gtrabanco/pi-agentic-workflow 0.4.1 → 0.4.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.
@@ -34,7 +34,31 @@ export function readSkillMeta(text, dir) {
34
34
  if (colon === -1)
35
35
  continue;
36
36
  const key = line.slice(0, colon).trim();
37
- const value = line.slice(colon + 1).trim().replace(/^["']|["']$/gu, "");
37
+ const rawValue = line.slice(colon + 1).trim();
38
+ const value = rawValue.replace(/^["']|["']$/gu, "");
39
+ // YAML block scalars: `description: >` (folded) / `description: |` (literal)
40
+ // carry their content on the following indented lines, not inline. Collect
41
+ // those continuation lines (they never start a top-level `key: value` line)
42
+ // and advance the loop past them. ">" is not a description, so the old
43
+ // line-oriented reader storing `>` is the bug (#165).
44
+ if (key === "description" && (value === ">" || value === "|")) {
45
+ const folded = value === ">";
46
+ const collected = [];
47
+ let cursor = index + 1;
48
+ for (; cursor < lines.length; cursor += 1) {
49
+ const next = lines[cursor];
50
+ if (next.trim() === "---")
51
+ break;
52
+ // A non-empty, non-indented line starts the next top-level key.
53
+ if (next !== "" && !/^[ \t]/u.test(next))
54
+ break;
55
+ collected.push(next);
56
+ }
57
+ meta.description = buildBlockScalar(collected, folded);
58
+ // Outer loop += 1 moves past the last consumed continuation line.
59
+ index = cursor - 1;
60
+ continue;
61
+ }
38
62
  if (key === "name" && value !== "")
39
63
  meta.name = value;
40
64
  else if (key === "description" && value !== "")
@@ -44,6 +68,40 @@ export function readSkillMeta(text, dir) {
44
68
  }
45
69
  return meta;
46
70
  }
71
+ /**
72
+ * Assemble a YAML block scalar from its collected, indented continuation lines.
73
+ *
74
+ * Strip the common leading indentation, then: folded (`>`) joins non-blank
75
+ * lines into a single space-separated string (blank lines become page breaks);
76
+ * literal (`|`) preserves the line breaks. Both are trimmed of outer blank
77
+ * whitespace so the value matches the frontmatter's intended text.
78
+ */
79
+ function buildBlockScalar(lines, folded) {
80
+ const nonEmpty = lines.filter((line) => line.length > 0);
81
+ const indent = nonEmpty.reduce((min, line) => {
82
+ const width = /^[ \t]*/u.exec(line)[0].length;
83
+ return Math.min(min, width);
84
+ }, Number.POSITIVE_INFINITY);
85
+ if (!Number.isFinite(indent))
86
+ return "";
87
+ const unindented = lines.map((line) => (line.length === 0 ? "" : line.slice(indent)));
88
+ if (!folded)
89
+ return unindented.join("\n").trim();
90
+ const parts = [];
91
+ let pendingBreak = false;
92
+ for (const raw of unindented) {
93
+ const line = raw.trimEnd();
94
+ if (line === "") {
95
+ pendingBreak = true;
96
+ continue;
97
+ }
98
+ if (pendingBreak && parts.length > 0)
99
+ parts.push("\n");
100
+ pendingBreak = false;
101
+ parts.push(line);
102
+ }
103
+ return parts.join(" ").replace(/ \n/g, "\n").trim();
104
+ }
47
105
  /**
48
106
  * Read a bundled skills directory. A duplicate `name:` is reported instead of
49
107
  * silently shadowing an alias: two skills claiming one command is a packaging
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/pi-agentic-workflow",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Pi package: canonical agentic-workflow skills, friendly slash commands, and per-command model routing.",
5
5
  "keywords": [
6
6
  "pi-package",