create-claude-cabinet 0.11.0 → 0.11.1
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.
- package/lib/cli.js +40 -3
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -27,6 +27,9 @@ function parseFrontmatter(content) {
|
|
|
27
27
|
let nestedMap = null; // The nested map being built
|
|
28
28
|
let nestedSubKey = null; // Current sub-key within the nested map
|
|
29
29
|
let nestedSubValue = '';
|
|
30
|
+
let blockScalarKey = null; // Key when parsing a block scalar (description: >)
|
|
31
|
+
let blockScalarValue = '';
|
|
32
|
+
let blockScalarStyle = null; // '>' for folded, '|' for literal
|
|
30
33
|
|
|
31
34
|
function flushNested() {
|
|
32
35
|
if (nestedSubKey && nestedMap) {
|
|
@@ -50,6 +53,26 @@ function parseFrontmatter(content) {
|
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
for (const line of match[1].split('\n')) {
|
|
56
|
+
// Inside a block scalar (description: > or description: |)?
|
|
57
|
+
if (blockScalarKey) {
|
|
58
|
+
if (/^[\s]/.test(line) && line.trim() !== '') {
|
|
59
|
+
const sep = blockScalarStyle === '|' ? '\n' : ' ';
|
|
60
|
+
blockScalarValue += (blockScalarValue ? sep : '') + line.trim();
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
// Blank line inside block scalar — for '|' style, preserve as newline
|
|
64
|
+
if (line.trim() === '' && blockScalarStyle === '|') {
|
|
65
|
+
blockScalarValue += '\n';
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
// Not indented or blank line in '>' mode — end of block scalar
|
|
69
|
+
fm[blockScalarKey] = blockScalarValue.trim();
|
|
70
|
+
blockScalarKey = null;
|
|
71
|
+
blockScalarValue = '';
|
|
72
|
+
blockScalarStyle = null;
|
|
73
|
+
// Fall through to parse this line
|
|
74
|
+
}
|
|
75
|
+
|
|
53
76
|
// Inside a nested map?
|
|
54
77
|
if (nestedKey) {
|
|
55
78
|
// Nested sub-key (indented key: value)
|
|
@@ -63,6 +86,16 @@ function parseFrontmatter(content) {
|
|
|
63
86
|
nestedSubValue = subKv[2].replace(/^[>|]\s*$/, '');
|
|
64
87
|
continue;
|
|
65
88
|
}
|
|
89
|
+
// First indented line doesn't look like a sub-key — this is a block scalar, not a map
|
|
90
|
+
if (!nestedSubKey && /^[\s]/.test(line) && line.trim() !== '') {
|
|
91
|
+
// Convert from nested map mode to block scalar mode
|
|
92
|
+
blockScalarKey = nestedKey;
|
|
93
|
+
blockScalarStyle = '>'; // Default to folded
|
|
94
|
+
blockScalarValue = line.trim();
|
|
95
|
+
nestedKey = null;
|
|
96
|
+
nestedMap = null;
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
66
99
|
// Continuation of nested sub-value (deeply indented)
|
|
67
100
|
if (nestedSubKey && /^ /.test(line)) {
|
|
68
101
|
nestedSubValue += ' ' + line.trim();
|
|
@@ -94,11 +127,12 @@ function parseFrontmatter(content) {
|
|
|
94
127
|
const val = kvMatch[2].trim();
|
|
95
128
|
// Empty value after colon = start of nested map or block scalar
|
|
96
129
|
if (val === '' || val === '>' || val === '|') {
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
130
|
+
// Could be a nested map (directives:) or a block scalar (description: >).
|
|
131
|
+
// Start as nested map; if first indented line has no sub-key, fall back
|
|
132
|
+
// to block scalar mode.
|
|
100
133
|
nestedKey = kvMatch[1];
|
|
101
134
|
nestedMap = {};
|
|
135
|
+
blockScalarStyle = (val === '|') ? '|' : '>'; // Remember style hint
|
|
102
136
|
currentKey = null;
|
|
103
137
|
} else {
|
|
104
138
|
currentKey = kvMatch[1];
|
|
@@ -107,6 +141,9 @@ function parseFrontmatter(content) {
|
|
|
107
141
|
}
|
|
108
142
|
}
|
|
109
143
|
// Flush remaining
|
|
144
|
+
if (blockScalarKey) {
|
|
145
|
+
fm[blockScalarKey] = blockScalarValue.trim();
|
|
146
|
+
}
|
|
110
147
|
if (nestedSubKey && nestedMap) {
|
|
111
148
|
nestedMap[nestedSubKey] = nestedSubValue.trim();
|
|
112
149
|
}
|
package/package.json
CHANGED