@triflux/core 10.0.0-alpha.2 → 10.0.0

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.
@@ -49,7 +49,8 @@
49
49
  "flags": "i"
50
50
  }
51
51
  ],
52
- "skill": "tfx-codex-swarm",
52
+ "skill": "tfx-swarm",
53
+ "deprecated_from": "tfx-codex-swarm",
53
54
  "priority": 1,
54
55
  "supersedes": [
55
56
  "tfx-codex"
@@ -183,4 +183,4 @@ export function createAdaptiveInjector(opts = {}) {
183
183
  });
184
184
  }
185
185
 
186
- export default createAdaptiveInjector;
186
+ export default createAdaptiveInjector;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@triflux/core",
3
- "version": "10.0.0-alpha.2",
3
+ "version": "10.0.0",
4
4
  "description": "triflux core — CLI routing, pipeline, adapters. Zero native dependencies.",
5
5
  "type": "module",
6
6
  "main": "hub/index.mjs",
@@ -1,4 +1,4 @@
1
- import { readdirSync, readFileSync } from "node:fs";
1
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
2
2
  import { basename, extname, join, relative } from "node:path";
3
3
 
4
4
  const IF_TAG_RE = /{{\s*(#if\s+([A-Za-z0-9_.-]+)|\/if)\s*}}/g;
@@ -39,6 +39,44 @@ function parseScalar(raw) {
39
39
  return bool ?? value;
40
40
  }
41
41
 
42
+ function parseMultilineValue(lines, startIndex, marker) {
43
+ const fold = marker.startsWith(">");
44
+ const chunks = [];
45
+ let index = startIndex;
46
+
47
+ while (index + 1 < lines.length && /^\s+/.test(lines[index + 1])) {
48
+ index += 1;
49
+ chunks.push(lines[index].replace(/^\s+/, ""));
50
+ }
51
+
52
+ return {
53
+ index,
54
+ value: fold ? chunks.join(" ").trim() : chunks.join("\n").trim(),
55
+ };
56
+ }
57
+
58
+ function parseListValue(lines, startIndex) {
59
+ const items = [];
60
+ let index = startIndex;
61
+
62
+ while (index + 1 < lines.length) {
63
+ const nextLine = lines[index + 1];
64
+ const match = nextLine.match(/^\s*-\s+(.*)$/);
65
+ if (match) {
66
+ index += 1;
67
+ items.push(parseScalar(match[1]));
68
+ continue;
69
+ }
70
+ if (/^\s*$/.test(nextLine)) {
71
+ index += 1;
72
+ continue;
73
+ }
74
+ break;
75
+ }
76
+
77
+ return { index, value: items };
78
+ }
79
+
42
80
  function parseFrontmatterBlock(block) {
43
81
  const lines = block.split(/\r?\n/);
44
82
  const data = {};
@@ -53,16 +91,21 @@ function parseFrontmatterBlock(block) {
53
91
  const value = rawValue.trim();
54
92
 
55
93
  if (value === ">" || value === "|" || value === ">-" || value === "|-") {
56
- const fold = value.startsWith(">");
57
- const chunks = [];
58
- while (i + 1 < lines.length && /^\s+/.test(lines[i + 1])) {
59
- i += 1;
60
- chunks.push(lines[i].replace(/^\s+/, ""));
61
- }
62
- data[key] = fold ? chunks.join(" ").trim() : chunks.join("\n").trim();
94
+ const parsed = parseMultilineValue(lines, i, value);
95
+ data[key] = parsed.value;
96
+ i = parsed.index;
63
97
  continue;
64
98
  }
65
99
 
100
+ if (!value) {
101
+ const parsed = parseListValue(lines, i);
102
+ if (parsed.index !== i) {
103
+ data[key] = parsed.value;
104
+ i = parsed.index;
105
+ continue;
106
+ }
107
+ }
108
+
66
109
  data[key] = parseScalar(value);
67
110
  }
68
111
 
@@ -140,7 +183,11 @@ function renderWithContext(source, context, partials, includeStack = []) {
140
183
  }
141
184
 
142
185
  function readAllTemplateFiles(rootDir, currentDir = rootDir) {
143
- const entries = readdirSync(currentDir, { withFileTypes: true });
186
+ if (!rootDir || !existsSync(rootDir)) return [];
187
+
188
+ const entries = readdirSync(currentDir, { withFileTypes: true }).sort((left, right) =>
189
+ left.name.localeCompare(right.name),
190
+ );
144
191
  const files = [];
145
192
 
146
193
  for (const entry of entries) {