@boboddy/sdk 0.0.13-alpha → 0.0.16-alpha
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/dist/boboddy-config-parser.d.ts +34 -0
- package/dist/boboddy-config-parser.js +510 -0
- package/dist/client.d.ts +3 -1
- package/dist/client.js +1402 -45
- package/dist/define-step.d.ts +21 -1
- package/dist/define-step.js +11065 -69
- package/dist/generated/client/client.gen.d.ts +2 -0
- package/dist/generated/client/index.d.ts +8 -0
- package/dist/generated/client/types.gen.d.ts +117 -0
- package/dist/generated/client/utils.gen.d.ts +33 -0
- package/dist/generated/client.gen.d.ts +12 -0
- package/dist/generated/core/auth.gen.d.ts +18 -0
- package/dist/generated/core/bodySerializer.gen.d.ts +25 -0
- package/dist/generated/core/params.gen.d.ts +43 -0
- package/dist/generated/core/pathSerializer.gen.d.ts +33 -0
- package/dist/generated/core/queryKeySerializer.gen.d.ts +18 -0
- package/dist/generated/core/serverSentEvents.gen.d.ts +71 -0
- package/dist/generated/core/types.gen.d.ts +78 -0
- package/dist/generated/core/utils.gen.d.ts +19 -0
- package/dist/generated/index.d.ts +2 -0
- package/dist/generated/sdk.gen.d.ts +162 -0
- package/dist/generated/types.gen.d.ts +9193 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +16288 -957
- package/dist/jsonc.d.ts +3 -0
- package/dist/jsonc.js +133 -0
- package/dist/opencode-mcp.d.ts +73 -0
- package/dist/opencode-mcp.js +14326 -0
- package/dist/step-definitions-client.d.ts +138 -143
- package/dist/step-definitions-client.js +1354 -29
- package/dist/step-execution-plane-client.d.ts +107 -287
- package/package.json +30 -17
- package/dist/treaty.d.ts +0 -13
- package/dist/treaty.js +0 -34
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const BOBODDY_CONFIG_RELATIVE_PATH = ".boboddy/boboddy.jsonc";
|
|
2
|
+
export type BoboddyCommandDefinition = {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
run: string;
|
|
6
|
+
cwd: string | null;
|
|
7
|
+
};
|
|
8
|
+
export type BoboddyServiceDefinition = {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
run: string;
|
|
12
|
+
cwd: string | null;
|
|
13
|
+
dependsOn: string[];
|
|
14
|
+
expose: {
|
|
15
|
+
targetPort: number;
|
|
16
|
+
protocol: string;
|
|
17
|
+
};
|
|
18
|
+
healthcheck: {
|
|
19
|
+
protocol: string;
|
|
20
|
+
path: string | null;
|
|
21
|
+
expectedStatus: number | null;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export type BoboddyConfig = {
|
|
25
|
+
commands: BoboddyCommandDefinition[];
|
|
26
|
+
services: BoboddyServiceDefinition[];
|
|
27
|
+
};
|
|
28
|
+
export type ParseBoboddyConfigResult = {
|
|
29
|
+
found: false;
|
|
30
|
+
} | {
|
|
31
|
+
found: true;
|
|
32
|
+
config: BoboddyConfig;
|
|
33
|
+
};
|
|
34
|
+
export declare function parseBoboddyConfig(workspacePath: string): Promise<ParseBoboddyConfigResult>;
|
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __returnValue = (v) => v;
|
|
3
|
+
function __exportSetter(name, newValue) {
|
|
4
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
5
|
+
}
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
set: __exportSetter.bind(all, name)
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// src/boboddy-config-parser.ts
|
|
17
|
+
var {access, readFile} = (() => ({}));
|
|
18
|
+
|
|
19
|
+
// node:path
|
|
20
|
+
function assertPath(path) {
|
|
21
|
+
if (typeof path !== "string")
|
|
22
|
+
throw TypeError("Path must be a string. Received " + JSON.stringify(path));
|
|
23
|
+
}
|
|
24
|
+
function normalizeStringPosix(path, allowAboveRoot) {
|
|
25
|
+
var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code;
|
|
26
|
+
for (var i = 0;i <= path.length; ++i) {
|
|
27
|
+
if (i < path.length)
|
|
28
|
+
code = path.charCodeAt(i);
|
|
29
|
+
else if (code === 47)
|
|
30
|
+
break;
|
|
31
|
+
else
|
|
32
|
+
code = 47;
|
|
33
|
+
if (code === 47) {
|
|
34
|
+
if (lastSlash === i - 1 || dots === 1)
|
|
35
|
+
;
|
|
36
|
+
else if (lastSlash !== i - 1 && dots === 2) {
|
|
37
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
|
|
38
|
+
if (res.length > 2) {
|
|
39
|
+
var lastSlashIndex = res.lastIndexOf("/");
|
|
40
|
+
if (lastSlashIndex !== res.length - 1) {
|
|
41
|
+
if (lastSlashIndex === -1)
|
|
42
|
+
res = "", lastSegmentLength = 0;
|
|
43
|
+
else
|
|
44
|
+
res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
45
|
+
lastSlash = i, dots = 0;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
} else if (res.length === 2 || res.length === 1) {
|
|
49
|
+
res = "", lastSegmentLength = 0, lastSlash = i, dots = 0;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (allowAboveRoot) {
|
|
54
|
+
if (res.length > 0)
|
|
55
|
+
res += "/..";
|
|
56
|
+
else
|
|
57
|
+
res = "..";
|
|
58
|
+
lastSegmentLength = 2;
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
if (res.length > 0)
|
|
62
|
+
res += "/" + path.slice(lastSlash + 1, i);
|
|
63
|
+
else
|
|
64
|
+
res = path.slice(lastSlash + 1, i);
|
|
65
|
+
lastSegmentLength = i - lastSlash - 1;
|
|
66
|
+
}
|
|
67
|
+
lastSlash = i, dots = 0;
|
|
68
|
+
} else if (code === 46 && dots !== -1)
|
|
69
|
+
++dots;
|
|
70
|
+
else
|
|
71
|
+
dots = -1;
|
|
72
|
+
}
|
|
73
|
+
return res;
|
|
74
|
+
}
|
|
75
|
+
function _format(sep, pathObject) {
|
|
76
|
+
var dir = pathObject.dir || pathObject.root, base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
77
|
+
if (!dir)
|
|
78
|
+
return base;
|
|
79
|
+
if (dir === pathObject.root)
|
|
80
|
+
return dir + base;
|
|
81
|
+
return dir + sep + base;
|
|
82
|
+
}
|
|
83
|
+
function resolve() {
|
|
84
|
+
var resolvedPath = "", resolvedAbsolute = false, cwd;
|
|
85
|
+
for (var i = arguments.length - 1;i >= -1 && !resolvedAbsolute; i--) {
|
|
86
|
+
var path;
|
|
87
|
+
if (i >= 0)
|
|
88
|
+
path = arguments[i];
|
|
89
|
+
else {
|
|
90
|
+
if (cwd === undefined)
|
|
91
|
+
cwd = process.cwd();
|
|
92
|
+
path = cwd;
|
|
93
|
+
}
|
|
94
|
+
if (assertPath(path), path.length === 0)
|
|
95
|
+
continue;
|
|
96
|
+
resolvedPath = path + "/" + resolvedPath, resolvedAbsolute = path.charCodeAt(0) === 47;
|
|
97
|
+
}
|
|
98
|
+
if (resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute)
|
|
99
|
+
if (resolvedPath.length > 0)
|
|
100
|
+
return "/" + resolvedPath;
|
|
101
|
+
else
|
|
102
|
+
return "/";
|
|
103
|
+
else if (resolvedPath.length > 0)
|
|
104
|
+
return resolvedPath;
|
|
105
|
+
else
|
|
106
|
+
return ".";
|
|
107
|
+
}
|
|
108
|
+
function normalize(path) {
|
|
109
|
+
if (assertPath(path), path.length === 0)
|
|
110
|
+
return ".";
|
|
111
|
+
var isAbsolute = path.charCodeAt(0) === 47, trailingSeparator = path.charCodeAt(path.length - 1) === 47;
|
|
112
|
+
if (path = normalizeStringPosix(path, !isAbsolute), path.length === 0 && !isAbsolute)
|
|
113
|
+
path = ".";
|
|
114
|
+
if (path.length > 0 && trailingSeparator)
|
|
115
|
+
path += "/";
|
|
116
|
+
if (isAbsolute)
|
|
117
|
+
return "/" + path;
|
|
118
|
+
return path;
|
|
119
|
+
}
|
|
120
|
+
function isAbsolute(path) {
|
|
121
|
+
return assertPath(path), path.length > 0 && path.charCodeAt(0) === 47;
|
|
122
|
+
}
|
|
123
|
+
function join() {
|
|
124
|
+
if (arguments.length === 0)
|
|
125
|
+
return ".";
|
|
126
|
+
var joined;
|
|
127
|
+
for (var i = 0;i < arguments.length; ++i) {
|
|
128
|
+
var arg = arguments[i];
|
|
129
|
+
if (assertPath(arg), arg.length > 0)
|
|
130
|
+
if (joined === undefined)
|
|
131
|
+
joined = arg;
|
|
132
|
+
else
|
|
133
|
+
joined += "/" + arg;
|
|
134
|
+
}
|
|
135
|
+
if (joined === undefined)
|
|
136
|
+
return ".";
|
|
137
|
+
return normalize(joined);
|
|
138
|
+
}
|
|
139
|
+
function relative(from, to) {
|
|
140
|
+
if (assertPath(from), assertPath(to), from === to)
|
|
141
|
+
return "";
|
|
142
|
+
if (from = resolve(from), to = resolve(to), from === to)
|
|
143
|
+
return "";
|
|
144
|
+
var fromStart = 1;
|
|
145
|
+
for (;fromStart < from.length; ++fromStart)
|
|
146
|
+
if (from.charCodeAt(fromStart) !== 47)
|
|
147
|
+
break;
|
|
148
|
+
var fromEnd = from.length, fromLen = fromEnd - fromStart, toStart = 1;
|
|
149
|
+
for (;toStart < to.length; ++toStart)
|
|
150
|
+
if (to.charCodeAt(toStart) !== 47)
|
|
151
|
+
break;
|
|
152
|
+
var toEnd = to.length, toLen = toEnd - toStart, length = fromLen < toLen ? fromLen : toLen, lastCommonSep = -1, i = 0;
|
|
153
|
+
for (;i <= length; ++i) {
|
|
154
|
+
if (i === length) {
|
|
155
|
+
if (toLen > length) {
|
|
156
|
+
if (to.charCodeAt(toStart + i) === 47)
|
|
157
|
+
return to.slice(toStart + i + 1);
|
|
158
|
+
else if (i === 0)
|
|
159
|
+
return to.slice(toStart + i);
|
|
160
|
+
} else if (fromLen > length) {
|
|
161
|
+
if (from.charCodeAt(fromStart + i) === 47)
|
|
162
|
+
lastCommonSep = i;
|
|
163
|
+
else if (i === 0)
|
|
164
|
+
lastCommonSep = 0;
|
|
165
|
+
}
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
var fromCode = from.charCodeAt(fromStart + i), toCode = to.charCodeAt(toStart + i);
|
|
169
|
+
if (fromCode !== toCode)
|
|
170
|
+
break;
|
|
171
|
+
else if (fromCode === 47)
|
|
172
|
+
lastCommonSep = i;
|
|
173
|
+
}
|
|
174
|
+
var out = "";
|
|
175
|
+
for (i = fromStart + lastCommonSep + 1;i <= fromEnd; ++i)
|
|
176
|
+
if (i === fromEnd || from.charCodeAt(i) === 47)
|
|
177
|
+
if (out.length === 0)
|
|
178
|
+
out += "..";
|
|
179
|
+
else
|
|
180
|
+
out += "/..";
|
|
181
|
+
if (out.length > 0)
|
|
182
|
+
return out + to.slice(toStart + lastCommonSep);
|
|
183
|
+
else {
|
|
184
|
+
if (toStart += lastCommonSep, to.charCodeAt(toStart) === 47)
|
|
185
|
+
++toStart;
|
|
186
|
+
return to.slice(toStart);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
function _makeLong(path) {
|
|
190
|
+
return path;
|
|
191
|
+
}
|
|
192
|
+
function dirname(path) {
|
|
193
|
+
if (assertPath(path), path.length === 0)
|
|
194
|
+
return ".";
|
|
195
|
+
var code = path.charCodeAt(0), hasRoot = code === 47, end = -1, matchedSlash = true;
|
|
196
|
+
for (var i = path.length - 1;i >= 1; --i)
|
|
197
|
+
if (code = path.charCodeAt(i), code === 47) {
|
|
198
|
+
if (!matchedSlash) {
|
|
199
|
+
end = i;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
} else
|
|
203
|
+
matchedSlash = false;
|
|
204
|
+
if (end === -1)
|
|
205
|
+
return hasRoot ? "/" : ".";
|
|
206
|
+
if (hasRoot && end === 1)
|
|
207
|
+
return "//";
|
|
208
|
+
return path.slice(0, end);
|
|
209
|
+
}
|
|
210
|
+
function basename(path, ext) {
|
|
211
|
+
if (ext !== undefined && typeof ext !== "string")
|
|
212
|
+
throw TypeError('"ext" argument must be a string');
|
|
213
|
+
assertPath(path);
|
|
214
|
+
var start = 0, end = -1, matchedSlash = true, i;
|
|
215
|
+
if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
|
|
216
|
+
if (ext.length === path.length && ext === path)
|
|
217
|
+
return "";
|
|
218
|
+
var extIdx = ext.length - 1, firstNonSlashEnd = -1;
|
|
219
|
+
for (i = path.length - 1;i >= 0; --i) {
|
|
220
|
+
var code = path.charCodeAt(i);
|
|
221
|
+
if (code === 47) {
|
|
222
|
+
if (!matchedSlash) {
|
|
223
|
+
start = i + 1;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
} else {
|
|
227
|
+
if (firstNonSlashEnd === -1)
|
|
228
|
+
matchedSlash = false, firstNonSlashEnd = i + 1;
|
|
229
|
+
if (extIdx >= 0)
|
|
230
|
+
if (code === ext.charCodeAt(extIdx)) {
|
|
231
|
+
if (--extIdx === -1)
|
|
232
|
+
end = i;
|
|
233
|
+
} else
|
|
234
|
+
extIdx = -1, end = firstNonSlashEnd;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (start === end)
|
|
238
|
+
end = firstNonSlashEnd;
|
|
239
|
+
else if (end === -1)
|
|
240
|
+
end = path.length;
|
|
241
|
+
return path.slice(start, end);
|
|
242
|
+
} else {
|
|
243
|
+
for (i = path.length - 1;i >= 0; --i)
|
|
244
|
+
if (path.charCodeAt(i) === 47) {
|
|
245
|
+
if (!matchedSlash) {
|
|
246
|
+
start = i + 1;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
} else if (end === -1)
|
|
250
|
+
matchedSlash = false, end = i + 1;
|
|
251
|
+
if (end === -1)
|
|
252
|
+
return "";
|
|
253
|
+
return path.slice(start, end);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function extname(path) {
|
|
257
|
+
assertPath(path);
|
|
258
|
+
var startDot = -1, startPart = 0, end = -1, matchedSlash = true, preDotState = 0;
|
|
259
|
+
for (var i = path.length - 1;i >= 0; --i) {
|
|
260
|
+
var code = path.charCodeAt(i);
|
|
261
|
+
if (code === 47) {
|
|
262
|
+
if (!matchedSlash) {
|
|
263
|
+
startPart = i + 1;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (end === -1)
|
|
269
|
+
matchedSlash = false, end = i + 1;
|
|
270
|
+
if (code === 46) {
|
|
271
|
+
if (startDot === -1)
|
|
272
|
+
startDot = i;
|
|
273
|
+
else if (preDotState !== 1)
|
|
274
|
+
preDotState = 1;
|
|
275
|
+
} else if (startDot !== -1)
|
|
276
|
+
preDotState = -1;
|
|
277
|
+
}
|
|
278
|
+
if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)
|
|
279
|
+
return "";
|
|
280
|
+
return path.slice(startDot, end);
|
|
281
|
+
}
|
|
282
|
+
function format(pathObject) {
|
|
283
|
+
if (pathObject === null || typeof pathObject !== "object")
|
|
284
|
+
throw TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
|
|
285
|
+
return _format("/", pathObject);
|
|
286
|
+
}
|
|
287
|
+
function parse(path) {
|
|
288
|
+
assertPath(path);
|
|
289
|
+
var ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
290
|
+
if (path.length === 0)
|
|
291
|
+
return ret;
|
|
292
|
+
var code = path.charCodeAt(0), isAbsolute2 = code === 47, start;
|
|
293
|
+
if (isAbsolute2)
|
|
294
|
+
ret.root = "/", start = 1;
|
|
295
|
+
else
|
|
296
|
+
start = 0;
|
|
297
|
+
var startDot = -1, startPart = 0, end = -1, matchedSlash = true, i = path.length - 1, preDotState = 0;
|
|
298
|
+
for (;i >= start; --i) {
|
|
299
|
+
if (code = path.charCodeAt(i), code === 47) {
|
|
300
|
+
if (!matchedSlash) {
|
|
301
|
+
startPart = i + 1;
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
continue;
|
|
305
|
+
}
|
|
306
|
+
if (end === -1)
|
|
307
|
+
matchedSlash = false, end = i + 1;
|
|
308
|
+
if (code === 46) {
|
|
309
|
+
if (startDot === -1)
|
|
310
|
+
startDot = i;
|
|
311
|
+
else if (preDotState !== 1)
|
|
312
|
+
preDotState = 1;
|
|
313
|
+
} else if (startDot !== -1)
|
|
314
|
+
preDotState = -1;
|
|
315
|
+
}
|
|
316
|
+
if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
|
|
317
|
+
if (end !== -1)
|
|
318
|
+
if (startPart === 0 && isAbsolute2)
|
|
319
|
+
ret.base = ret.name = path.slice(1, end);
|
|
320
|
+
else
|
|
321
|
+
ret.base = ret.name = path.slice(startPart, end);
|
|
322
|
+
} else {
|
|
323
|
+
if (startPart === 0 && isAbsolute2)
|
|
324
|
+
ret.name = path.slice(1, startDot), ret.base = path.slice(1, end);
|
|
325
|
+
else
|
|
326
|
+
ret.name = path.slice(startPart, startDot), ret.base = path.slice(startPart, end);
|
|
327
|
+
ret.ext = path.slice(startDot, end);
|
|
328
|
+
}
|
|
329
|
+
if (startPart > 0)
|
|
330
|
+
ret.dir = path.slice(0, startPart - 1);
|
|
331
|
+
else if (isAbsolute2)
|
|
332
|
+
ret.dir = "/";
|
|
333
|
+
return ret;
|
|
334
|
+
}
|
|
335
|
+
var sep = "/";
|
|
336
|
+
var delimiter = ":";
|
|
337
|
+
var posix = ((p) => (p.posix = p, p))({ resolve, normalize, isAbsolute, join, relative, _makeLong, dirname, basename, extname, format, parse, sep, delimiter, win32: null, posix: null });
|
|
338
|
+
var path_default = posix;
|
|
339
|
+
|
|
340
|
+
// src/boboddy-config-parser.ts
|
|
341
|
+
var BOBODDY_CONFIG_RELATIVE_PATH = ".boboddy/boboddy.jsonc";
|
|
342
|
+
var stripJsoncComments = (content) => {
|
|
343
|
+
let result = "";
|
|
344
|
+
let inString = false;
|
|
345
|
+
let escapeNextCharacter = false;
|
|
346
|
+
let lineComment = false;
|
|
347
|
+
let blockComment = false;
|
|
348
|
+
for (let index = 0;index < content.length; index += 1) {
|
|
349
|
+
const character = content.charAt(index);
|
|
350
|
+
const nextCharacter = content.charAt(index + 1);
|
|
351
|
+
if (lineComment) {
|
|
352
|
+
if (character === `
|
|
353
|
+
`) {
|
|
354
|
+
lineComment = false;
|
|
355
|
+
result += character;
|
|
356
|
+
}
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
if (blockComment) {
|
|
360
|
+
if (character === "*" && nextCharacter === "/") {
|
|
361
|
+
blockComment = false;
|
|
362
|
+
index += 1;
|
|
363
|
+
}
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
if (inString) {
|
|
367
|
+
result += character;
|
|
368
|
+
if (escapeNextCharacter) {
|
|
369
|
+
escapeNextCharacter = false;
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
if (character === "\\") {
|
|
373
|
+
escapeNextCharacter = true;
|
|
374
|
+
continue;
|
|
375
|
+
}
|
|
376
|
+
if (character === '"') {
|
|
377
|
+
inString = false;
|
|
378
|
+
}
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
if (character === '"') {
|
|
382
|
+
inString = true;
|
|
383
|
+
result += character;
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
if (character === "/" && nextCharacter === "/") {
|
|
387
|
+
lineComment = true;
|
|
388
|
+
index += 1;
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
if (character === "/" && nextCharacter === "*") {
|
|
392
|
+
blockComment = true;
|
|
393
|
+
index += 1;
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
result += character;
|
|
397
|
+
}
|
|
398
|
+
return result;
|
|
399
|
+
};
|
|
400
|
+
var stripTrailingCommas = (content) => {
|
|
401
|
+
let result = "";
|
|
402
|
+
let inString = false;
|
|
403
|
+
let escapeNextCharacter = false;
|
|
404
|
+
for (let index = 0;index < content.length; index += 1) {
|
|
405
|
+
const character = content.charAt(index);
|
|
406
|
+
if (inString) {
|
|
407
|
+
result += character;
|
|
408
|
+
if (escapeNextCharacter) {
|
|
409
|
+
escapeNextCharacter = false;
|
|
410
|
+
continue;
|
|
411
|
+
}
|
|
412
|
+
if (character === "\\") {
|
|
413
|
+
escapeNextCharacter = true;
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
if (character === '"') {
|
|
417
|
+
inString = false;
|
|
418
|
+
}
|
|
419
|
+
continue;
|
|
420
|
+
}
|
|
421
|
+
if (character === '"') {
|
|
422
|
+
inString = true;
|
|
423
|
+
result += character;
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
if (character === ",") {
|
|
427
|
+
let lookaheadIndex = index + 1;
|
|
428
|
+
while (lookaheadIndex < content.length) {
|
|
429
|
+
const lookaheadCharacter2 = content.charAt(lookaheadIndex);
|
|
430
|
+
if (/\s/u.test(lookaheadCharacter2)) {
|
|
431
|
+
lookaheadIndex += 1;
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
if (lookaheadCharacter2 === "}" || lookaheadCharacter2 === "]") {
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
result += character;
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
if (lookaheadIndex >= content.length) {
|
|
441
|
+
continue;
|
|
442
|
+
}
|
|
443
|
+
const lookaheadCharacter = content.charAt(lookaheadIndex);
|
|
444
|
+
if (lookaheadCharacter === "}" || lookaheadCharacter === "]") {
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
result += character;
|
|
450
|
+
}
|
|
451
|
+
return result;
|
|
452
|
+
};
|
|
453
|
+
var parseJsonc = (content) => JSON.parse(stripTrailingCommas(stripJsoncComments(content)));
|
|
454
|
+
var asString = (value) => typeof value === "string" ? value : null;
|
|
455
|
+
var asNumber = (value) => typeof value === "number" ? value : null;
|
|
456
|
+
var parseCommands = (raw) => {
|
|
457
|
+
if (!raw)
|
|
458
|
+
return [];
|
|
459
|
+
return Object.entries(raw).map(([name, entry]) => ({
|
|
460
|
+
name,
|
|
461
|
+
description: asString(entry.description) ?? "",
|
|
462
|
+
run: asString(entry.run) ?? "",
|
|
463
|
+
cwd: asString(entry.cwd) ?? null
|
|
464
|
+
}));
|
|
465
|
+
};
|
|
466
|
+
var parseServices = (raw) => {
|
|
467
|
+
if (!raw)
|
|
468
|
+
return [];
|
|
469
|
+
return Object.entries(raw).map(([name, entry]) => {
|
|
470
|
+
const expose = entry.expose ?? {};
|
|
471
|
+
const healthcheck = entry.healthcheck ?? {};
|
|
472
|
+
const dependsOn = Array.isArray(entry.dependsOn) ? entry.dependsOn.filter((d) => typeof d === "string") : [];
|
|
473
|
+
return {
|
|
474
|
+
name,
|
|
475
|
+
description: asString(entry.description) ?? "",
|
|
476
|
+
run: asString(entry.run) ?? "",
|
|
477
|
+
cwd: asString(entry.cwd) ?? null,
|
|
478
|
+
dependsOn,
|
|
479
|
+
expose: {
|
|
480
|
+
targetPort: asNumber(expose.targetPort) ?? 0,
|
|
481
|
+
protocol: asString(expose.protocol) ?? "http"
|
|
482
|
+
},
|
|
483
|
+
healthcheck: {
|
|
484
|
+
protocol: asString(healthcheck.protocol) ?? "http",
|
|
485
|
+
path: asString(healthcheck.path) ?? null,
|
|
486
|
+
expectedStatus: asNumber(healthcheck.expectedStatus) ?? null
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
});
|
|
490
|
+
};
|
|
491
|
+
async function parseBoboddyConfig(workspacePath) {
|
|
492
|
+
const filePath = path_default.join(workspacePath, BOBODDY_CONFIG_RELATIVE_PATH);
|
|
493
|
+
const exists = await access(filePath).then(() => true).catch(() => false);
|
|
494
|
+
if (!exists) {
|
|
495
|
+
return { found: false };
|
|
496
|
+
}
|
|
497
|
+
const content = await readFile(filePath, "utf8");
|
|
498
|
+
const raw = parseJsonc(content);
|
|
499
|
+
return {
|
|
500
|
+
found: true,
|
|
501
|
+
config: {
|
|
502
|
+
commands: parseCommands(raw.commands),
|
|
503
|
+
services: parseServices(raw.services)
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
export {
|
|
508
|
+
parseBoboddyConfig,
|
|
509
|
+
BOBODDY_CONFIG_RELATIVE_PATH
|
|
510
|
+
};
|
package/dist/client.d.ts
CHANGED