toolcraft 0.0.38 → 0.0.40
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/README.md +41 -4
- package/dist/cli.js +40 -9
- package/dist/http-errors.d.ts +57 -0
- package/dist/http-errors.js +72 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +15 -0
- package/dist/mcp-proxy.js +16 -1
- package/dist/mcp.js +224 -12
- package/node_modules/@poe-code/frontmatter/README.md +35 -0
- package/node_modules/@poe-code/frontmatter/dist/fences.d.ts +8 -0
- package/node_modules/@poe-code/frontmatter/dist/fences.js +72 -0
- package/node_modules/@poe-code/frontmatter/dist/index.d.ts +3 -0
- package/node_modules/@poe-code/frontmatter/dist/index.js +3 -0
- package/node_modules/@poe-code/frontmatter/dist/parse.d.ts +20 -0
- package/node_modules/@poe-code/frontmatter/dist/parse.js +137 -0
- package/node_modules/@poe-code/frontmatter/dist/stringify.d.ts +1 -0
- package/node_modules/@poe-code/frontmatter/dist/stringify.js +35 -0
- package/node_modules/@poe-code/frontmatter/package.json +25 -0
- package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.d.ts +1 -0
- package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +25 -1
- package/node_modules/tiny-mcp-client/README.md +7 -0
- package/node_modules/tiny-mcp-client/dist/internal.d.ts +2 -0
- package/node_modules/tiny-mcp-client/dist/internal.js +3 -0
- package/node_modules/tiny-mcp-client/dist/mcp-tool-types.compile-check.js +10 -0
- package/node_modules/tiny-mcp-client/src/http-oauth.test.ts +2 -8
- package/node_modules/tiny-mcp-client/src/internal.ts +6 -0
- package/node_modules/tiny-mcp-client/src/mcp-tool-types.compile-check.ts +10 -0
- package/node_modules/toolcraft-design/README.md +12 -0
- package/node_modules/toolcraft-design/dist/prompts/index.d.ts +39 -14
- package/node_modules/toolcraft-design/dist/prompts/index.js +10 -6
- package/node_modules/toolcraft-design/dist/prompts/interactive/cancel-symbol.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/cancel-symbol.js +4 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/confirm.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/confirm.js +47 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.d.ts +55 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.js +274 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/glyphs.d.ts +20 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/glyphs.js +53 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/index.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/index.js +6 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/keys.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/keys.js +28 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/multiselect.d.ts +13 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/multiselect.js +131 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/pagination.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/pagination.js +52 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/password.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/password.js +55 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/select.d.ts +18 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/select.js +89 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/test-helpers.d.ts +21 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/test-helpers.js +32 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/text.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/text.js +60 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/wrap.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/wrap.js +18 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/cancel.d.ts +1 -1
- package/node_modules/toolcraft-design/dist/prompts/primitives/cancel.js +1 -1
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.js +20 -453
- package/node_modules/toolcraft-design/package.json +6 -3
- package/package.json +9 -6
|
@@ -1,469 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
}
|
|
3
|
-
class YamlSubsetParser {
|
|
4
|
-
lines;
|
|
5
|
-
position = 0;
|
|
6
|
-
constructor(yamlBlock) {
|
|
7
|
-
this.lines = tokenizeYamlBlock(yamlBlock);
|
|
8
|
-
}
|
|
9
|
-
parse() {
|
|
10
|
-
this.skipBlankLines();
|
|
11
|
-
if (this.position >= this.lines.length) {
|
|
12
|
-
return {};
|
|
13
|
-
}
|
|
14
|
-
return this.parseObject(0);
|
|
15
|
-
}
|
|
16
|
-
parseObject(expectedIndent) {
|
|
17
|
-
const result = {};
|
|
18
|
-
while (true) {
|
|
19
|
-
this.skipBlankLines();
|
|
20
|
-
const line = this.lines[this.position];
|
|
21
|
-
if (line === undefined) {
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
if (line.indent < expectedIndent) {
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
if (line.indent !== expectedIndent || isArrayItem(line.content)) {
|
|
28
|
-
throw new FrontmatterParseError("Invalid object indentation.");
|
|
29
|
-
}
|
|
30
|
-
const entry = parseKeyValue(line.content);
|
|
31
|
-
if (entry === null || hasOwn(result, entry.key)) {
|
|
32
|
-
throw new FrontmatterParseError("Invalid mapping entry.");
|
|
33
|
-
}
|
|
34
|
-
this.position += 1;
|
|
35
|
-
Object.defineProperty(result, entry.key, {
|
|
36
|
-
configurable: true,
|
|
37
|
-
enumerable: true,
|
|
38
|
-
value: this.readEntryValue(entry, expectedIndent),
|
|
39
|
-
writable: true
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
parseArray(expectedIndent) {
|
|
45
|
-
const result = [];
|
|
46
|
-
while (true) {
|
|
47
|
-
this.skipBlankLines();
|
|
48
|
-
const line = this.lines[this.position];
|
|
49
|
-
if (line === undefined) {
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
if (line.indent < expectedIndent) {
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
if (line.indent !== expectedIndent) {
|
|
56
|
-
throw new FrontmatterParseError("Invalid array indentation.");
|
|
57
|
-
}
|
|
58
|
-
const item = parseArrayItem(line.content);
|
|
59
|
-
if (item === null) {
|
|
60
|
-
throw new FrontmatterParseError("Invalid array item.");
|
|
61
|
-
}
|
|
62
|
-
this.position += 1;
|
|
63
|
-
if (item.length > 0) {
|
|
64
|
-
result.push(parseScalar(item));
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
const nestedLine = this.peekMeaningfulLine();
|
|
68
|
-
if (nestedLine === undefined || nestedLine.indent <= expectedIndent) {
|
|
69
|
-
result.push(null);
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
result.push(isArrayItem(nestedLine.content)
|
|
73
|
-
? this.parseArray(nestedLine.indent)
|
|
74
|
-
: this.parseObject(nestedLine.indent));
|
|
75
|
-
}
|
|
76
|
-
return result;
|
|
77
|
-
}
|
|
78
|
-
readEntryValue(entry, currentIndent) {
|
|
79
|
-
if (entry.value !== undefined) {
|
|
80
|
-
const chomping = blockScalarChomping(entry.value);
|
|
81
|
-
if (chomping !== null) {
|
|
82
|
-
return this.readBlockScalar(currentIndent, chomping);
|
|
83
|
-
}
|
|
84
|
-
return parseScalar(entry.value);
|
|
85
|
-
}
|
|
86
|
-
const nestedLine = this.peekMeaningfulLine();
|
|
87
|
-
if (nestedLine === undefined || nestedLine.indent <= currentIndent) {
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
return isArrayItem(nestedLine.content)
|
|
91
|
-
? this.parseArray(nestedLine.indent)
|
|
92
|
-
: this.parseObject(nestedLine.indent);
|
|
93
|
-
}
|
|
94
|
-
readBlockScalar(parentIndent, chomping) {
|
|
95
|
-
const collected = [];
|
|
96
|
-
while (this.position < this.lines.length) {
|
|
97
|
-
const line = this.lines[this.position];
|
|
98
|
-
if (line.content.length > 0 && line.indent <= parentIndent) {
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
collected.push(line);
|
|
102
|
-
this.position += 1;
|
|
103
|
-
}
|
|
104
|
-
const contentIndents = collected
|
|
105
|
-
.filter((line) => line.content.length > 0)
|
|
106
|
-
.map((line) => line.indent);
|
|
107
|
-
const blockIndent = contentIndents.length === 0 ? parentIndent + 1 : Math.min(...contentIndents);
|
|
108
|
-
const textLines = collected.map((line) => line.content.length === 0
|
|
109
|
-
? ""
|
|
110
|
-
: " ".repeat(Math.max(0, line.indent - blockIndent)) + line.content);
|
|
111
|
-
return chompBlockScalar(textLines, chomping);
|
|
112
|
-
}
|
|
113
|
-
peekMeaningfulLine() {
|
|
114
|
-
let index = this.position;
|
|
115
|
-
while (index < this.lines.length) {
|
|
116
|
-
const line = this.lines[index];
|
|
117
|
-
if (line.content.length > 0) {
|
|
118
|
-
return line;
|
|
119
|
-
}
|
|
120
|
-
index += 1;
|
|
121
|
-
}
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
skipBlankLines() {
|
|
125
|
-
while (this.position < this.lines.length && this.lines[this.position].content.length === 0) {
|
|
126
|
-
this.position += 1;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
1
|
+
import { FrontmatterParseError, parseFrontmatter } from "@poe-code/frontmatter";
|
|
130
2
|
export function extractFrontmatter(markdown) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const openingLine = readLine(markdown, 0);
|
|
135
|
-
if (stripBom(openingLine.text) !== "---") {
|
|
136
|
-
return { body: markdown };
|
|
3
|
+
let parsed;
|
|
4
|
+
try {
|
|
5
|
+
parsed = parseFrontmatter(markdown);
|
|
137
6
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const line = readLine(markdown, position);
|
|
143
|
-
if (line.text === "---") {
|
|
144
|
-
closingFenceStart = line.start;
|
|
145
|
-
closingFenceNextPosition = line.nextPosition;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
if (line.nextPosition >= markdown.length) {
|
|
149
|
-
break;
|
|
7
|
+
catch (error) {
|
|
8
|
+
if (error instanceof FrontmatterParseError &&
|
|
9
|
+
error.message === "Missing YAML frontmatter end delimiter (---).") {
|
|
10
|
+
return { body: markdown };
|
|
150
11
|
}
|
|
151
|
-
|
|
12
|
+
throw error;
|
|
152
13
|
}
|
|
153
|
-
if (
|
|
14
|
+
if (parsed.body === markdown && Object.keys(parsed.frontmatter).length === 0) {
|
|
154
15
|
return { body: markdown };
|
|
155
16
|
}
|
|
156
|
-
const rawFrontmatter = sliceFrontmatterBlock(markdown, openingLine.nextPosition, closingFenceStart);
|
|
157
|
-
const frontmatter = parseFrontmatterBlock(rawFrontmatter);
|
|
158
17
|
return withRange({
|
|
159
|
-
frontmatter,
|
|
160
|
-
body:
|
|
18
|
+
frontmatter: parsed.frontmatter,
|
|
19
|
+
body: parsed.body
|
|
161
20
|
}, {
|
|
162
21
|
start: 0,
|
|
163
|
-
end: Buffer.byteLength(markdown.slice(0,
|
|
22
|
+
end: Buffer.byteLength(markdown.slice(0, markdown.length - parsed.body.length), "utf8")
|
|
164
23
|
});
|
|
165
24
|
}
|
|
166
|
-
function
|
|
167
|
-
if (
|
|
168
|
-
return
|
|
169
|
-
}
|
|
170
|
-
try {
|
|
171
|
-
return new YamlSubsetParser(yamlBlock).parse();
|
|
172
|
-
}
|
|
173
|
-
catch (error) {
|
|
174
|
-
if (error instanceof FrontmatterParseError) {
|
|
175
|
-
return { raw: yamlBlock };
|
|
176
|
-
}
|
|
177
|
-
throw error;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
function tokenizeYamlBlock(yamlBlock) {
|
|
181
|
-
const lines = yamlBlock.replaceAll("\r\n", "\n").replaceAll("\r", "\n").split("\n");
|
|
182
|
-
return lines.map((line) => {
|
|
183
|
-
let indent = 0;
|
|
184
|
-
while (indent < line.length && line[indent] === " ") {
|
|
185
|
-
indent += 1;
|
|
186
|
-
}
|
|
187
|
-
for (let index = 0; index < indent; index += 1) {
|
|
188
|
-
if (line[index] === "\t") {
|
|
189
|
-
throw new FrontmatterParseError("Tabs are not supported in frontmatter indentation.");
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
if (indent < line.length && line[indent] === "\t") {
|
|
193
|
-
throw new FrontmatterParseError("Tabs are not supported in frontmatter indentation.");
|
|
194
|
-
}
|
|
195
|
-
return {
|
|
196
|
-
indent,
|
|
197
|
-
content: line.slice(indent)
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
function parseKeyValue(content) {
|
|
202
|
-
const separator = findUnquotedMappingSeparator(content);
|
|
203
|
-
if (separator === -1) {
|
|
204
|
-
return null;
|
|
205
|
-
}
|
|
206
|
-
const key = trimAsciiWhitespace(content.slice(0, separator));
|
|
207
|
-
if (key.length === 0) {
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
|
-
const rawValue = trimAsciiWhitespaceStart(content.slice(separator + 1));
|
|
211
|
-
return rawValue.length === 0 ? { key } : { key, value: rawValue };
|
|
212
|
-
}
|
|
213
|
-
function parseArrayItem(content) {
|
|
214
|
-
if (!isArrayItem(content)) {
|
|
215
|
-
return null;
|
|
216
|
-
}
|
|
217
|
-
return trimAsciiWhitespaceStart(content.slice(1));
|
|
218
|
-
}
|
|
219
|
-
function isArrayItem(content) {
|
|
220
|
-
if (!content.startsWith("-")) {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
if (content.length === 1) {
|
|
224
|
-
return true;
|
|
225
|
-
}
|
|
226
|
-
const nextCharacter = content[1];
|
|
227
|
-
return nextCharacter === " " || nextCharacter === "\t";
|
|
228
|
-
}
|
|
229
|
-
function blockScalarChomping(value) {
|
|
230
|
-
if (value === "|") {
|
|
231
|
-
return "clip";
|
|
232
|
-
}
|
|
233
|
-
if (value === "|-") {
|
|
234
|
-
return "strip";
|
|
235
|
-
}
|
|
236
|
-
if (value === "|+") {
|
|
237
|
-
return "keep";
|
|
238
|
-
}
|
|
239
|
-
return null;
|
|
240
|
-
}
|
|
241
|
-
function chompBlockScalar(lines, chomping) {
|
|
242
|
-
if (chomping === "keep") {
|
|
243
|
-
return lines.map((line) => `${line}\n`).join("");
|
|
244
|
-
}
|
|
245
|
-
let end = lines.length;
|
|
246
|
-
while (end > 0 && lines[end - 1].length === 0) {
|
|
247
|
-
end -= 1;
|
|
248
|
-
}
|
|
249
|
-
const trimmed = lines.slice(0, end);
|
|
250
|
-
if (trimmed.length === 0) {
|
|
251
|
-
return "";
|
|
252
|
-
}
|
|
253
|
-
const joined = trimmed.join("\n");
|
|
254
|
-
return chomping === "clip" ? `${joined}\n` : joined;
|
|
255
|
-
}
|
|
256
|
-
function parseScalar(value) {
|
|
257
|
-
if (value.length === 0) {
|
|
258
|
-
return "";
|
|
259
|
-
}
|
|
260
|
-
if (isQuoted(value, "'")) {
|
|
261
|
-
return value.slice(1, -1).replaceAll("''", "'");
|
|
262
|
-
}
|
|
263
|
-
if (isQuoted(value, '"')) {
|
|
264
|
-
return parseDoubleQuotedString(value.slice(1, -1));
|
|
265
|
-
}
|
|
266
|
-
if (value === "true") {
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
|
-
if (value === "false") {
|
|
270
|
-
return false;
|
|
271
|
-
}
|
|
272
|
-
if (value === "null") {
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
275
|
-
if (isNumberLiteral(value)) {
|
|
276
|
-
return Number(value);
|
|
277
|
-
}
|
|
278
|
-
if (hasUnquotedMappingSeparator(value)) {
|
|
279
|
-
throw new FrontmatterParseError("Unquoted mapping separators are not supported in scalar values.");
|
|
280
|
-
}
|
|
281
|
-
return value;
|
|
282
|
-
}
|
|
283
|
-
function parseDoubleQuotedString(value) {
|
|
284
|
-
let result = "";
|
|
285
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
286
|
-
const character = value[index];
|
|
287
|
-
if (character !== "\\") {
|
|
288
|
-
result += character;
|
|
289
|
-
continue;
|
|
290
|
-
}
|
|
291
|
-
index += 1;
|
|
292
|
-
if (index >= value.length) {
|
|
293
|
-
result += "\\";
|
|
294
|
-
break;
|
|
295
|
-
}
|
|
296
|
-
const escaped = value[index];
|
|
297
|
-
if (escaped === "n") {
|
|
298
|
-
result += "\n";
|
|
299
|
-
continue;
|
|
300
|
-
}
|
|
301
|
-
if (escaped === "r") {
|
|
302
|
-
result += "\r";
|
|
303
|
-
continue;
|
|
304
|
-
}
|
|
305
|
-
if (escaped === "t") {
|
|
306
|
-
result += "\t";
|
|
307
|
-
continue;
|
|
308
|
-
}
|
|
309
|
-
if (escaped === "b") {
|
|
310
|
-
result += "\b";
|
|
311
|
-
continue;
|
|
312
|
-
}
|
|
313
|
-
if (escaped === "f") {
|
|
314
|
-
result += "\f";
|
|
315
|
-
continue;
|
|
316
|
-
}
|
|
317
|
-
if (escaped === '"' || escaped === "\\" || escaped === "/") {
|
|
318
|
-
result += escaped;
|
|
319
|
-
continue;
|
|
320
|
-
}
|
|
321
|
-
if (escaped === "u") {
|
|
322
|
-
const codePoint = value.slice(index + 1, index + 5);
|
|
323
|
-
if (codePoint.length === 4 && isHexadecimal(codePoint)) {
|
|
324
|
-
result += String.fromCodePoint(Number.parseInt(codePoint, 16));
|
|
325
|
-
index += 4;
|
|
326
|
-
continue;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
result += `\\${escaped}`;
|
|
330
|
-
}
|
|
331
|
-
return result;
|
|
332
|
-
}
|
|
333
|
-
function isQuoted(value, quote) {
|
|
334
|
-
return value.length >= 2 && value[0] === quote && value[value.length - 1] === quote;
|
|
335
|
-
}
|
|
336
|
-
function isNumberLiteral(value) {
|
|
337
|
-
let index = 0;
|
|
338
|
-
let hasDigits = false;
|
|
339
|
-
let hasDecimal = false;
|
|
340
|
-
if (value[index] === "-" || value[index] === "+") {
|
|
341
|
-
index += 1;
|
|
342
|
-
}
|
|
343
|
-
while (index < value.length) {
|
|
344
|
-
const character = value[index];
|
|
345
|
-
if (character >= "0" && character <= "9") {
|
|
346
|
-
hasDigits = true;
|
|
347
|
-
index += 1;
|
|
348
|
-
continue;
|
|
349
|
-
}
|
|
350
|
-
if (character === "." && !hasDecimal) {
|
|
351
|
-
hasDecimal = true;
|
|
352
|
-
index += 1;
|
|
353
|
-
continue;
|
|
354
|
-
}
|
|
355
|
-
return false;
|
|
356
|
-
}
|
|
357
|
-
return hasDigits;
|
|
358
|
-
}
|
|
359
|
-
function hasUnquotedMappingSeparator(value) {
|
|
360
|
-
return findUnquotedMappingSeparator(value) !== -1;
|
|
361
|
-
}
|
|
362
|
-
function findUnquotedMappingSeparator(value) {
|
|
363
|
-
let quote = null;
|
|
364
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
365
|
-
const character = value[index];
|
|
366
|
-
if (quote !== null) {
|
|
367
|
-
if (character === "\\" && quote === '"') {
|
|
368
|
-
index += 1;
|
|
369
|
-
continue;
|
|
370
|
-
}
|
|
371
|
-
if (character === quote) {
|
|
372
|
-
quote = null;
|
|
373
|
-
}
|
|
374
|
-
continue;
|
|
375
|
-
}
|
|
376
|
-
if (character === "'" || character === '"') {
|
|
377
|
-
quote = character;
|
|
378
|
-
continue;
|
|
379
|
-
}
|
|
380
|
-
if (character !== ":") {
|
|
381
|
-
continue;
|
|
382
|
-
}
|
|
383
|
-
const nextCharacter = value[index + 1];
|
|
384
|
-
if (nextCharacter === undefined || nextCharacter === " " || nextCharacter === "\t") {
|
|
385
|
-
return index;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return -1;
|
|
389
|
-
}
|
|
390
|
-
function sliceFrontmatterBlock(content, start, end) {
|
|
391
|
-
let sliceEnd = end;
|
|
392
|
-
if (sliceEnd > start && content[sliceEnd - 1] === "\n") {
|
|
393
|
-
sliceEnd -= 1;
|
|
394
|
-
if (sliceEnd > start && content[sliceEnd - 1] === "\r") {
|
|
395
|
-
sliceEnd -= 1;
|
|
396
|
-
}
|
|
25
|
+
function withRange(result, range) {
|
|
26
|
+
if (result.frontmatter === undefined) {
|
|
27
|
+
return result;
|
|
397
28
|
}
|
|
398
|
-
|
|
399
|
-
}
|
|
400
|
-
function startsWithFrontmatterFence(value) {
|
|
401
|
-
return (value.startsWith("---\n") ||
|
|
402
|
-
value.startsWith("---\r\n") ||
|
|
403
|
-
value.startsWith("---\r") ||
|
|
404
|
-
value.startsWith("\uFEFF---\n") ||
|
|
405
|
-
value.startsWith("\uFEFF---\r\n") ||
|
|
406
|
-
value.startsWith("\uFEFF---\r"));
|
|
407
|
-
}
|
|
408
|
-
function stripBom(value) {
|
|
409
|
-
return value.startsWith("\uFEFF") ? value.slice(1) : value;
|
|
410
|
-
}
|
|
411
|
-
function withRange(value, range) {
|
|
412
|
-
Object.defineProperty(value, "range", {
|
|
413
|
-
value: range,
|
|
414
|
-
enumerable: false,
|
|
29
|
+
Object.defineProperty(result, "range", {
|
|
415
30
|
configurable: true,
|
|
31
|
+
enumerable: false,
|
|
32
|
+
value: range,
|
|
416
33
|
writable: true
|
|
417
34
|
});
|
|
418
|
-
return
|
|
419
|
-
}
|
|
420
|
-
function readLine(input, position) {
|
|
421
|
-
let end = position;
|
|
422
|
-
while (end < input.length && input[end] !== "\n" && input[end] !== "\r") {
|
|
423
|
-
end += 1;
|
|
424
|
-
}
|
|
425
|
-
let nextPosition = end;
|
|
426
|
-
if (input[nextPosition] === "\r" && input[nextPosition + 1] === "\n") {
|
|
427
|
-
nextPosition += 2;
|
|
428
|
-
}
|
|
429
|
-
else if (input[nextPosition] === "\n" || input[nextPosition] === "\r") {
|
|
430
|
-
nextPosition += 1;
|
|
431
|
-
}
|
|
432
|
-
return {
|
|
433
|
-
text: input.slice(position, end),
|
|
434
|
-
start: position,
|
|
435
|
-
nextPosition
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
function trimAsciiWhitespace(value) {
|
|
439
|
-
return trimAsciiWhitespaceEnd(trimAsciiWhitespaceStart(value));
|
|
440
|
-
}
|
|
441
|
-
function trimAsciiWhitespaceStart(value) {
|
|
442
|
-
let start = 0;
|
|
443
|
-
while (start < value.length && (value[start] === " " || value[start] === "\t")) {
|
|
444
|
-
start += 1;
|
|
445
|
-
}
|
|
446
|
-
return value.slice(start);
|
|
447
|
-
}
|
|
448
|
-
function trimAsciiWhitespaceEnd(value) {
|
|
449
|
-
let end = value.length;
|
|
450
|
-
while (end > 0 && (value[end - 1] === " " || value[end - 1] === "\t")) {
|
|
451
|
-
end -= 1;
|
|
452
|
-
}
|
|
453
|
-
return value.slice(0, end);
|
|
454
|
-
}
|
|
455
|
-
function hasOwn(record, key) {
|
|
456
|
-
return Object.prototype.hasOwnProperty.call(record, key);
|
|
457
|
-
}
|
|
458
|
-
function isHexadecimal(value) {
|
|
459
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
460
|
-
const character = value[index];
|
|
461
|
-
if ((character >= "0" && character <= "9") ||
|
|
462
|
-
(character >= "a" && character <= "f") ||
|
|
463
|
-
(character >= "A" && character <= "F")) {
|
|
464
|
-
continue;
|
|
465
|
-
}
|
|
466
|
-
return false;
|
|
467
|
-
}
|
|
468
|
-
return true;
|
|
35
|
+
return result;
|
|
469
36
|
}
|
|
@@ -19,8 +19,11 @@
|
|
|
19
19
|
"files": [
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
|
-
"
|
|
23
|
-
"@
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@poe-code/frontmatter": "*",
|
|
24
|
+
"fast-string-width": "^3.0.2",
|
|
25
|
+
"fast-wrap-ansi": "^0.2.0",
|
|
26
|
+
"sisteransi": "^1.0.5"
|
|
24
27
|
},
|
|
25
28
|
"exports": {
|
|
26
29
|
".": {
|
|
@@ -29,7 +32,7 @@
|
|
|
29
32
|
}
|
|
30
33
|
},
|
|
31
34
|
"engines": {
|
|
32
|
-
"node": ">=
|
|
35
|
+
"node": ">=18.18"
|
|
33
36
|
},
|
|
34
37
|
"repository": {
|
|
35
38
|
"type": "git",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -43,16 +43,17 @@
|
|
|
43
43
|
"test": "cd ../.. && vitest run packages/toolcraft/src",
|
|
44
44
|
"test:unit": "cd ../.. && vitest run packages/toolcraft/src",
|
|
45
45
|
"lint": "cd ../.. && eslint packages/toolcraft/src --ext ts && tsc -p packages/toolcraft/tsconfig.json --noEmit",
|
|
46
|
-
"prepack": "node ../../scripts/manage-bundled-workspace-deps.mjs prepare . toolcraft-design @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/process-runner tiny-mcp-client mcp-oauth auth-store",
|
|
47
|
-
"postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . toolcraft-design @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/process-runner tiny-mcp-client mcp-oauth auth-store"
|
|
46
|
+
"prepack": "node ../../scripts/manage-bundled-workspace-deps.mjs prepare . toolcraft-design @poe-code/frontmatter @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/process-runner tiny-mcp-client mcp-oauth auth-store",
|
|
47
|
+
"postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . toolcraft-design @poe-code/frontmatter @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/process-runner tiny-mcp-client mcp-oauth auth-store"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"
|
|
51
|
-
"@clack/prompts": "^1.0.0",
|
|
52
|
-
"toolcraft-schema": "0.0.38",
|
|
50
|
+
"toolcraft-schema": "0.0.40",
|
|
53
51
|
"commander": "^14.0.3",
|
|
52
|
+
"fast-string-width": "^3.0.2",
|
|
53
|
+
"fast-wrap-ansi": "^0.2.0",
|
|
54
54
|
"jose": "^6.1.2",
|
|
55
55
|
"jsonc-parser": "^3.3.1",
|
|
56
|
+
"sisteransi": "^1.0.5",
|
|
56
57
|
"smol-toml": "^1.3.0",
|
|
57
58
|
"tiny-stdio-mcp-server": "^0.1.0",
|
|
58
59
|
"yaml": "^2.8.2"
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
},
|
|
71
72
|
"bundleDependencies": [
|
|
72
73
|
"toolcraft-design",
|
|
74
|
+
"@poe-code/frontmatter",
|
|
73
75
|
"@poe-code/agent-mcp-config",
|
|
74
76
|
"@poe-code/agent-human-in-loop",
|
|
75
77
|
"@poe-code/task-list",
|
|
@@ -82,6 +84,7 @@
|
|
|
82
84
|
],
|
|
83
85
|
"optionalDependencies": {
|
|
84
86
|
"toolcraft-design": "^0.0.2",
|
|
87
|
+
"@poe-code/frontmatter": "*",
|
|
85
88
|
"@poe-code/agent-mcp-config": "*",
|
|
86
89
|
"@poe-code/agent-human-in-loop": "*",
|
|
87
90
|
"@poe-code/task-list": "*",
|