@moldea.ai/cli 14.0.0 → 14.0.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.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/{composition-_3bygS_a.js → composition-BzwNJ346.js} +2 -2
  3. package/dist/chunks/{composition-_3bygS_a.js.map → composition-BzwNJ346.js.map} +1 -1
  4. package/dist/chunks/{composition-D1OYuZ5d.js → composition-aJXeA6un.js} +1 -1
  5. package/dist/chunks/{core-composition-BKcJ--NX.js → core-composition-CzdeqYS9.js} +2 -2
  6. package/dist/chunks/{core-composition-BKcJ--NX.js.map → core-composition-CzdeqYS9.js.map} +1 -1
  7. package/dist/moldea.js +3 -3
  8. package/dist/portable/SHA256SUMS +16 -16
  9. package/dist/portable/analysis-worker.mjs +110 -133
  10. package/dist/portable/chunk-1b3c5f05.mjs +1837 -0
  11. package/dist/portable/chunk-24ea7c23.mjs +328 -0
  12. package/dist/portable/chunk-2cc3bf5c.mjs +399 -0
  13. package/dist/portable/chunk-2e9d4c63.mjs +95 -0
  14. package/dist/portable/chunk-8a1dadf9.mjs +2 -0
  15. package/dist/portable/chunk-8f198616.mjs +4414 -0
  16. package/dist/portable/chunk-936e5d09.mjs +112519 -0
  17. package/dist/portable/chunk-98d84174.mjs +422 -0
  18. package/dist/portable/chunk-a6007228.mjs +302 -0
  19. package/dist/portable/chunk-b1f86976.mjs +2 -0
  20. package/dist/portable/chunk-cea1378f.mjs +50 -0
  21. package/dist/portable/chunk-d372f5e0.mjs +3120 -0
  22. package/dist/portable/chunk-d6656fa6.mjs +14 -0
  23. package/dist/portable/moldea.mjs +1997 -2870
  24. package/dist/portable/node-runner.mjs +77 -106
  25. package/package.json +2 -2
  26. package/dist/portable/chunk-131f8005.mjs +0 -115
  27. package/dist/portable/chunk-2ba7e89e.mjs +0 -26
  28. package/dist/portable/chunk-459da9cf.mjs +0 -4138
  29. package/dist/portable/chunk-728df961.mjs +0 -544
  30. package/dist/portable/chunk-8d6114d2.mjs +0 -588
  31. package/dist/portable/chunk-90403e67.mjs +0 -2
  32. package/dist/portable/chunk-94b5ac22.mjs +0 -59
  33. package/dist/portable/chunk-a5514957.mjs +0 -5870
  34. package/dist/portable/chunk-b98ca669.mjs +0 -2
  35. package/dist/portable/chunk-c13db66a.mjs +0 -380
  36. package/dist/portable/chunk-d5af3eda.mjs +0 -2926
  37. package/dist/portable/chunk-ec3f49d3.mjs +0 -367
  38. package/dist/portable/chunk-fcbcf4e3.mjs +0 -147458
@@ -0,0 +1,302 @@
1
+ import { n as e, u as t } from "./chunk-2cc3bf5c.mjs";
2
+ import { o as n, t as r } from "./chunk-1b3c5f05.mjs";
3
+ import { p as i, u as a } from "./chunk-8f198616.mjs";
4
+ import { i as o } from "./chunk-98d84174.mjs";
5
+ import { a as s, i as c, l, n as u, o as d, s as f } from "./chunk-24ea7c23.mjs";
6
+ import { n as p, r as m, t as h } from "./chunk-cea1378f.mjs";
7
+ import { t as g } from "./chunk-2e9d4c63.mjs";
8
+ import { fileURLToPath as _ } from "node:url";
9
+ import { fork as v } from "node:child_process";
10
+ import { randomBytes as y } from "node:crypto";
11
+ //#region ../core/dist/node.js
12
+ var b = 0, x = () => {
13
+ let e = Promise.withResolvers();
14
+ return e.promise.catch(() => {}), e;
15
+ }, S = (e) => t(e, !0) && typeof e.id == "string" && e.id.length > 0 && typeof e.sourceKind == "string" && e.sourceKind.length > 0, C = (e) => {
16
+ if (e === void 0) return null;
17
+ if (!(!t(e, !0) || typeof e.getEntry != "function" || typeof e.readFilePage != "function" || typeof e.readLinkText != "function" || !S(e.snapshot))) return { snapshot: {
18
+ id: e.snapshot.id,
19
+ sourceKind: e.snapshot.sourceKind
20
+ } };
21
+ }, w = (t) => new e({
22
+ code: "ABORTED",
23
+ operation: "create-project-inspection",
24
+ ...t === void 0 ? {} : { cause: t }
25
+ }), T = async (t) => {
26
+ if (typeof t != "object" || !t || t.repository === null || typeof t.repository != "object" || typeof t.repository.getEntry != "function" || typeof t.repository.listEntriesPage != "function" || typeof t.repository.readFilePage != "function" || typeof t.repository.readLinkText != "function" || t.repository.snapshot === null || typeof t.repository.snapshot != "object" || typeof t.repository.snapshot.id != "string" || t.repository.snapshot.id.length === 0 || typeof t.repository.snapshot.sourceKind != "string" || t.repository.snapshot.sourceKind.length === 0) throw new e({
27
+ code: "INVALID_ARGUMENT",
28
+ operation: "create-project-inspection"
29
+ });
30
+ let n = C(t.instructions);
31
+ if (n === void 0) throw new e({
32
+ code: "INVALID_ARGUMENT",
33
+ operation: "create-project-inspection"
34
+ });
35
+ let r = {
36
+ repository: t.repository,
37
+ ...t.instructions === void 0 ? {} : { instructions: t.instructions }
38
+ }, S = {
39
+ id: t.repository.snapshot.id,
40
+ sourceKind: t.repository.snapshot.sourceKind
41
+ }, T = t.signal;
42
+ if (T !== void 0 && (typeof T != "object" || !T || typeof T.aborted != "boolean" || typeof T.addEventListener != "function" || typeof T.removeEventListener != "function")) throw new e({
43
+ code: "INVALID_ARGUMENT",
44
+ operation: "create-project-inspection"
45
+ });
46
+ let { limits: E } = a({ ...t.limits === void 0 ? {} : { limits: t.limits } });
47
+ if (t.deadline !== void 0 && (!Number.isSafeInteger(t.deadline) || t.deadline < 0)) throw new e({
48
+ code: "INVALID_ARGUMENT",
49
+ operation: "create-project-inspection"
50
+ });
51
+ let D = t.maxConcurrentInspections, O = D === void 0 ? 1 : D;
52
+ if (!Number.isSafeInteger(O) || O < 1) throw new e({
53
+ code: "INVALID_ARGUMENT",
54
+ operation: "create-project-inspection"
55
+ });
56
+ if (T?.aborted === !0) throw w(T.reason);
57
+ if (b >= O) throw new e({
58
+ code: "INSPECTION_BUSY",
59
+ operation: "create-project-inspection"
60
+ });
61
+ if (E.maxRetainedBytes <= 50331648) throw new e({
62
+ code: "RESOURCE_LIMIT_EXCEEDED",
63
+ operation: "create-project-inspection",
64
+ limit: "maxRetainedBytes",
65
+ limitMaximum: E.maxRetainedBytes,
66
+ observedUsage: c,
67
+ nextAction: "reduce-input-or-increase-limit"
68
+ });
69
+ let k = Math.min(Date.now() + u, t.deadline ?? Infinity);
70
+ if (k <= Date.now()) throw new e({
71
+ code: "INSPECTION_TIMEOUT",
72
+ operation: "create-project-inspection"
73
+ });
74
+ b++;
75
+ let A = new AbortController(), j = y(16).toString("hex"), M = x(), N, P = 0, F = -1, I = !1, L, R = !1, z = !1, B, V, H = new Set(), U = new Set(), W = (() => {
76
+ try {
77
+ return v(_(new URL("./node-runner.mjs", import.meta.url).href), [], {
78
+ execPath: process.execPath,
79
+ execArgv: [],
80
+ env: h(),
81
+ serialization: "advanced",
82
+ stdio: [
83
+ "ignore",
84
+ "ignore",
85
+ "pipe",
86
+ "ipc"
87
+ ]
88
+ });
89
+ } catch (e) {
90
+ throw b--, s(e);
91
+ }
92
+ })(), G = p((e, t) => {
93
+ if (!W.connected) throw s();
94
+ W.send(e, t);
95
+ }), K = m(W, () => {
96
+ G({
97
+ attemptId: j,
98
+ kind: "dispose"
99
+ }).catch(() => {
100
+ W.kill("SIGKILL");
101
+ });
102
+ }), q = () => (V ??= (async () => {
103
+ z = !0, A.abort(B?.cause), K.terminate(), await K.closed, await Promise.allSettled([...H, ...U]), r = void 0, clearTimeout(Z), B === void 0 && Date.now() >= k && J(new e({
104
+ code: "INSPECTION_TIMEOUT",
105
+ operation: "create-project-inspection"
106
+ })), T?.removeEventListener("abort", X), W.removeAllListeners("message"), W.removeAllListeners("error"), W.stderr?.removeAllListeners("data"), b--;
107
+ })(), V), J = (e) => {
108
+ B === void 0 && (B = { cause: e instanceof Error ? e : s(e) }), M.reject(B.cause), N?.reject(B.cause), q();
109
+ }, Y = () => B?.cause, X = () => {
110
+ J(w(T?.reason));
111
+ }, Z = setTimeout(() => {
112
+ J(new e({
113
+ code: "INSPECTION_TIMEOUT",
114
+ operation: "create-project-inspection"
115
+ }));
116
+ }, Math.max(1, k - Date.now()));
117
+ T?.addEventListener("abort", X, { once: !0 }), T?.aborted === !0 && X(), W.once("error", (e) => {
118
+ J(s(e));
119
+ }), K.closed.then(() => {
120
+ z || J(s());
121
+ });
122
+ let Q = 0;
123
+ W.stderr?.on("data", (e) => {
124
+ Q += e.byteLength, Q > 32768 && J(s());
125
+ }), W.on("message", (e) => {
126
+ if (!z) try {
127
+ let t = d(e);
128
+ if (t.attemptId !== j) throw s();
129
+ if (t.kind === "ready") {
130
+ if (I) throw s();
131
+ L = t.maxAnalysisHeapBytes, I = !0, G({
132
+ attemptId: j,
133
+ kind: "run"
134
+ }).catch(J);
135
+ } else if (t.kind === "prepared") {
136
+ if (!I || R || t.inspection.maxAnalysisHeapBytes !== L || t.inspection.source.id !== S.id || t.inspection.source.sourceKind !== S.sourceKind) throw s();
137
+ R = !0, M.resolve(i(t.inspection));
138
+ } else if (t.kind === "reader-request") {
139
+ if (!I || R || t.requestId !== F + 1 || H.size >= 4 || (F = t.requestId, r === void 0)) throw s();
140
+ let e = g(r, t.request, A.signal);
141
+ H.add(e);
142
+ let n = (async () => {
143
+ try {
144
+ let n = await e;
145
+ H.delete(e), z || await G({
146
+ attemptId: j,
147
+ kind: "reader-response",
148
+ requestId: t.requestId,
149
+ result: n
150
+ });
151
+ } catch (e) {
152
+ if (e instanceof o && [
153
+ "ENTRY_NOT_FOUND",
154
+ "ENTRY_NOT_FILE",
155
+ "RESOURCE_LIMIT_EXCEEDED"
156
+ ].includes(e.code)) try {
157
+ z || await G({
158
+ attemptId: j,
159
+ kind: "reader-failure",
160
+ requestId: t.requestId,
161
+ failure: l(e)
162
+ });
163
+ } catch (e) {
164
+ J(e);
165
+ }
166
+ else J(e);
167
+ } finally {
168
+ H.delete(e);
169
+ }
170
+ })();
171
+ U.add(n), n.finally(() => U.delete(n));
172
+ } else if (t.kind === "page") {
173
+ if (!R || N === void 0 || t.requestId !== P) throw s();
174
+ let e = N;
175
+ N = void 0, e.resolve(i(t.result));
176
+ } else if (t.kind === "failure") {
177
+ if (t.failure.options.nextAction === "review-inspection-capacity" && (L === void 0 || t.failure.options.limitMaximum !== L)) throw s();
178
+ J(f(t.failure));
179
+ } else throw s();
180
+ } catch (e) {
181
+ J(e);
182
+ }
183
+ });
184
+ try {
185
+ await G({
186
+ attemptId: j,
187
+ kind: "start",
188
+ snapshot: S,
189
+ instructions: n,
190
+ limits: E,
191
+ deadline: k
192
+ });
193
+ let t = await M.promise;
194
+ if (Date.now() >= k) throw new e({
195
+ code: "INSPECTION_TIMEOUT",
196
+ operation: "create-project-inspection"
197
+ });
198
+ return Object.freeze({
199
+ ...t,
200
+ readPage: async (t) => {
201
+ if (B !== void 0 || z) throw B?.cause ?? w();
202
+ if (N !== void 0 || typeof t != "object" || !t || Reflect.ownKeys(t).some((e) => e !== "cursor" && e !== "maxItems" && e !== "view") || !Number.isSafeInteger(t.maxItems) || t.maxItems < 1 || t.maxItems > E.maxEntries || ![
203
+ "all",
204
+ "diagnostics",
205
+ "coverage",
206
+ "metadata"
207
+ ].includes(t.view) || t.cursor !== void 0 && typeof t.cursor != "string") throw new e({
208
+ code: "INVALID_ARGUMENT",
209
+ operation: "create-project-inspection"
210
+ });
211
+ let n = x();
212
+ N = n, P++;
213
+ try {
214
+ if (Date.now() >= k) throw new e({
215
+ code: "INSPECTION_TIMEOUT",
216
+ operation: "create-project-inspection"
217
+ });
218
+ await G({
219
+ attemptId: j,
220
+ kind: "read-page",
221
+ requestId: P,
222
+ input: {
223
+ maxItems: t.maxItems,
224
+ view: t.view,
225
+ ...t.cursor === void 0 ? {} : { cursor: t.cursor }
226
+ }
227
+ });
228
+ let r = await n.promise;
229
+ if (Date.now() >= k) throw new e({
230
+ code: "INSPECTION_TIMEOUT",
231
+ operation: "create-project-inspection"
232
+ });
233
+ return r;
234
+ } catch (e) {
235
+ throw J(e), await q(), Y() ?? s(e);
236
+ } finally {
237
+ N === n && (N = void 0);
238
+ }
239
+ },
240
+ dispose: async () => {
241
+ N?.reject(B?.cause ?? w()), await q();
242
+ let e = Y();
243
+ if (e !== void 0) throw e;
244
+ }
245
+ });
246
+ } catch (e) {
247
+ throw J(e), await q(), Y() ?? s(e);
248
+ }
249
+ }, E = (e) => e > Math.floor((2 ** 53 - 1) / 4) ? 2 ** 53 - 1 : e * 4, D = ((e = T) => async (t) => {
250
+ let i = await e({
251
+ repository: t.repository,
252
+ ...t.instructions === void 0 ? {} : { instructions: t.instructions },
253
+ limits: {
254
+ maxDiagnostics: t.resourceLimits.maxDiagnostics,
255
+ maxEntries: t.resourceLimits.maxEntries,
256
+ maxCoverage: t.resourceLimits.maxCoverage,
257
+ maxFileBytes: t.resourceLimits.maxFileBytes,
258
+ maxManifestBytes: t.resourceLimits.maxManifestBytes,
259
+ maxRetainedBytes: E(t.resourceLimits.maxTotalBytes),
260
+ maxTotalBytesRead: t.resourceLimits.maxTotalBytes
261
+ },
262
+ ...t.signal === void 0 ? {} : { signal: t.signal }
263
+ });
264
+ try {
265
+ if (r({ packageMetadata: t.packageMetadata }).kind === "invalid") throw new n();
266
+ if (t.command === "inspect") return await i.readPage({
267
+ ...t.cursor === void 0 ? {} : { cursor: t.cursor },
268
+ maxItems: Math.min(256, t.resourceLimits.maxEntries),
269
+ view: "all"
270
+ });
271
+ let e = [], a = [];
272
+ for (let n of ["diagnostics", "coverage"]) {
273
+ let r;
274
+ do {
275
+ let o = await i.readPage({
276
+ view: n,
277
+ maxItems: Math.min(256, t.resourceLimits.maxEntries),
278
+ ...r === void 0 ? {} : { cursor: r }
279
+ });
280
+ for (let { item: t } of o.page.records) t.kind === "diagnostic" ? e.push(t.diagnostic) : t.kind === "coverage" && a.push(t.coverage);
281
+ r = o.page.nextCursor ?? void 0;
282
+ } while (r !== void 0);
283
+ }
284
+ return Object.freeze({
285
+ diagnostics: Object.freeze(e),
286
+ coverage: Object.freeze(a),
287
+ coverageCounts: i.coverageCounts,
288
+ diagnosticCount: i.counts.diagnostics,
289
+ acceptedWarningCount: i.counts.acceptedWarnings,
290
+ errorCount: i.counts.errors,
291
+ warningCount: i.counts.warnings,
292
+ valid: i.valid,
293
+ formatVersion: i.formatVersion,
294
+ source: i.source,
295
+ summary: i.summary
296
+ });
297
+ } finally {
298
+ await i.dispose();
299
+ }
300
+ })();
301
+ //#endregion
302
+ export { D as executeMoldeaCliCoreInspection };
@@ -0,0 +1,2 @@
1
+ import { t as e } from "./chunk-d372f5e0.mjs";
2
+ export { e as t };
@@ -0,0 +1,50 @@
1
+ import { a as e, c as t, r as n } from "./chunk-24ea7c23.mjs";
2
+ import r from "node:process";
3
+ //#region ../core/dist/chunks/lifecycle-z05THc0s.js
4
+ var i = (n) => {
5
+ let r = 0, i = Promise.resolve();
6
+ return async (a) => {
7
+ if (r >= 4) throw e();
8
+ r++;
9
+ let o = i.then(() => new Promise((r, i) => {
10
+ try {
11
+ n(t(a), (t) => {
12
+ t === null ? r() : i(e(t));
13
+ });
14
+ } catch (t) {
15
+ i(t instanceof Error ? t : e(t));
16
+ }
17
+ }));
18
+ i = o.catch(() => {});
19
+ try {
20
+ await o;
21
+ } finally {
22
+ r--;
23
+ }
24
+ };
25
+ }, a = () => {
26
+ let e = new Set([
27
+ "systemroot",
28
+ "windir",
29
+ "temp",
30
+ "tmp",
31
+ "tmpdir"
32
+ ]);
33
+ return Object.fromEntries(Object.entries(r.env).filter(([t]) => e.has(t.toLowerCase())));
34
+ }, o = (e, t) => {
35
+ let r = !1, i;
36
+ return {
37
+ closed: new Promise((t) => {
38
+ e.once("close", () => {
39
+ r = !0, clearTimeout(i), t();
40
+ });
41
+ }),
42
+ terminate: () => {
43
+ r || i !== void 0 || (i = setTimeout(() => {
44
+ r || e.kill("SIGKILL");
45
+ }, n), t());
46
+ }
47
+ };
48
+ };
49
+ //#endregion
50
+ export { i as n, o as r, a as t };