@moldea.ai/cli 14.0.0 → 14.0.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/README.md +1 -1
- package/dist/portable/SHA256SUMS +16 -16
- package/dist/portable/analysis-worker.mjs +110 -133
- package/dist/portable/chunk-1306b995.mjs +2 -0
- package/dist/portable/chunk-24ea7c23.mjs +328 -0
- package/dist/portable/chunk-2cc3bf5c.mjs +399 -0
- package/dist/portable/chunk-2e9d4c63.mjs +95 -0
- package/dist/portable/chunk-43b8574a.mjs +1837 -0
- package/dist/portable/chunk-517c6bfb.mjs +2 -0
- package/dist/portable/chunk-8f198616.mjs +4414 -0
- package/dist/portable/chunk-936e5d09.mjs +112519 -0
- package/dist/portable/chunk-98d84174.mjs +422 -0
- package/dist/portable/chunk-9e42770a.mjs +3114 -0
- package/dist/portable/chunk-cea1378f.mjs +50 -0
- package/dist/portable/chunk-d6656fa6.mjs +14 -0
- package/dist/portable/chunk-d9e49acd.mjs +302 -0
- package/dist/portable/moldea.mjs +1995 -2868
- package/dist/portable/node-runner.mjs +77 -106
- package/package.json +1 -1
- package/dist/portable/chunk-131f8005.mjs +0 -115
- package/dist/portable/chunk-2ba7e89e.mjs +0 -26
- package/dist/portable/chunk-459da9cf.mjs +0 -4138
- package/dist/portable/chunk-728df961.mjs +0 -544
- package/dist/portable/chunk-8d6114d2.mjs +0 -588
- package/dist/portable/chunk-90403e67.mjs +0 -2
- package/dist/portable/chunk-94b5ac22.mjs +0 -59
- package/dist/portable/chunk-a5514957.mjs +0 -5870
- package/dist/portable/chunk-b98ca669.mjs +0 -2
- package/dist/portable/chunk-c13db66a.mjs +0 -380
- package/dist/portable/chunk-d5af3eda.mjs +0 -2926
- package/dist/portable/chunk-ec3f49d3.mjs +0 -367
- package/dist/portable/chunk-fcbcf4e3.mjs +0 -147458
|
@@ -1,146 +1,117 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { a as
|
|
3
|
-
import { n as
|
|
4
|
-
import
|
|
5
|
-
import { Worker } from "node:worker_threads";
|
|
1
|
+
import { n as e } from "./chunk-2cc3bf5c.mjs";
|
|
2
|
+
import { a as t, c as n, l as r, n as i, o as a } from "./chunk-24ea7c23.mjs";
|
|
3
|
+
import { n as o } from "./chunk-cea1378f.mjs";
|
|
4
|
+
import s from "node:process";
|
|
5
|
+
import { Worker as c } from "node:worker_threads";
|
|
6
6
|
//#region ../core/dist/node-runner.js
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
});
|
|
18
|
-
var close = async (failure) => {
|
|
19
|
-
if (isClosing) return;
|
|
20
|
-
isClosing = true;
|
|
21
|
-
clearTimeout(deadlineTimer);
|
|
22
|
-
const termination = worker?.terminate();
|
|
23
|
-
if (failure !== void 0 && attemptId !== void 0 && process.connected) try {
|
|
24
|
-
await send({
|
|
25
|
-
attemptId,
|
|
7
|
+
var l, u, d, f, p = !1, m = !1, h = new Set(), g = o((e, n) => {
|
|
8
|
+
if (s.send === void 0 || !s.connected) throw t();
|
|
9
|
+
s.send(e, n);
|
|
10
|
+
}), _ = async (e) => {
|
|
11
|
+
if (p) return;
|
|
12
|
+
p = !0, clearTimeout(f);
|
|
13
|
+
let t = l?.terminate();
|
|
14
|
+
if (e !== void 0 && u !== void 0 && s.connected) try {
|
|
15
|
+
await g({
|
|
16
|
+
attemptId: u,
|
|
26
17
|
kind: "failure",
|
|
27
|
-
failure:
|
|
18
|
+
failure: r(e)
|
|
28
19
|
});
|
|
29
20
|
} catch {}
|
|
30
|
-
await
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (process.connected) process.disconnect();
|
|
35
|
-
};
|
|
36
|
-
var handleDisconnect = () => {
|
|
37
|
-
close();
|
|
38
|
-
};
|
|
39
|
-
var handleWorkerMessage = (frame) => {
|
|
21
|
+
await t, h.clear(), s.removeListener("message", x), s.removeListener("disconnect", v), s.connected && s.disconnect();
|
|
22
|
+
}, v = () => {
|
|
23
|
+
_();
|
|
24
|
+
}, y = (e) => {
|
|
40
25
|
try {
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
if (
|
|
44
|
-
if (
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
} else if (
|
|
48
|
-
if (!
|
|
49
|
-
|
|
50
|
-
} else if (
|
|
26
|
+
let n = a(e);
|
|
27
|
+
if (p) return;
|
|
28
|
+
if (n.attemptId !== u) throw t();
|
|
29
|
+
if (n.kind === "ready") {
|
|
30
|
+
if (d !== void 0 || m) throw t();
|
|
31
|
+
d = n.maxAnalysisHeapBytes;
|
|
32
|
+
} else if (n.kind === "reader-request") {
|
|
33
|
+
if (!m || h.has(n.requestId) || h.size >= 4) throw t();
|
|
34
|
+
h.add(n.requestId);
|
|
35
|
+
} else if (n.kind === "failure" && n.failure.options.limit === "maxAnalysisHeapBytes") throw t();
|
|
51
36
|
else if (![
|
|
52
37
|
"prepared",
|
|
53
38
|
"page",
|
|
54
39
|
"failure"
|
|
55
|
-
].includes(
|
|
56
|
-
|
|
57
|
-
} catch (
|
|
58
|
-
|
|
40
|
+
].includes(n.kind)) throw t();
|
|
41
|
+
g(n).catch((e) => _(e));
|
|
42
|
+
} catch (e) {
|
|
43
|
+
_(e);
|
|
59
44
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (remaining <= 0) {
|
|
67
|
-
close(new CoreOperationException({
|
|
45
|
+
}, b = (r) => {
|
|
46
|
+
if (u !== void 0 || p) throw t();
|
|
47
|
+
u = r.attemptId, clearTimeout(f);
|
|
48
|
+
let a = Math.min(i, r.deadline - Date.now());
|
|
49
|
+
if (a <= 0) {
|
|
50
|
+
_(new e({
|
|
68
51
|
code: "INSPECTION_TIMEOUT",
|
|
69
52
|
operation: "create-project-inspection"
|
|
70
53
|
}));
|
|
71
54
|
return;
|
|
72
55
|
}
|
|
73
|
-
|
|
74
|
-
|
|
56
|
+
f = setTimeout(() => {
|
|
57
|
+
_(new e({
|
|
75
58
|
code: "INSPECTION_TIMEOUT",
|
|
76
59
|
operation: "create-project-inspection"
|
|
77
60
|
}));
|
|
78
|
-
},
|
|
79
|
-
worker = new Worker(new URL(new URL("./analysis-worker.mjs", import.meta.url).href), {
|
|
61
|
+
}, a), l = new c(new URL(new URL("./analysis-worker.mjs", import.meta.url).href), {
|
|
80
62
|
execArgv: [],
|
|
81
|
-
env:
|
|
82
|
-
stdout:
|
|
83
|
-
stderr:
|
|
63
|
+
env: s.env,
|
|
64
|
+
stdout: !0,
|
|
65
|
+
stderr: !0,
|
|
84
66
|
resourceLimits: {
|
|
85
67
|
maxOldGenerationSizeMb: 512,
|
|
86
68
|
maxYoungGenerationSizeMb: 24
|
|
87
69
|
},
|
|
88
|
-
workerData:
|
|
70
|
+
workerData: n(r)
|
|
89
71
|
});
|
|
90
|
-
let
|
|
91
|
-
|
|
92
|
-
stdioBytes += chunk.byteLength;
|
|
93
|
-
if (stdioBytes > 32768) close(createInspectionProcessFailure());
|
|
72
|
+
let o = 0, m = (e) => {
|
|
73
|
+
o += e.byteLength, o > 32768 && _(t());
|
|
94
74
|
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
close(createInspectionProcessFailure(cause));
|
|
100
|
-
});
|
|
101
|
-
worker.once("error", (error) => {
|
|
102
|
-
close(error.code === "ERR_WORKER_OUT_OF_MEMORY" && heapMaximum !== void 0 ? new CoreOperationException({
|
|
75
|
+
l.stdout.on("data", m), l.stderr.on("data", m), l.on("message", y), l.on("messageerror", (e) => {
|
|
76
|
+
_(t(e));
|
|
77
|
+
}), l.once("error", (n) => {
|
|
78
|
+
_(n.code === "ERR_WORKER_OUT_OF_MEMORY" && d !== void 0 ? new e({
|
|
103
79
|
code: "RESOURCE_LIMIT_EXCEEDED",
|
|
104
80
|
operation: "create-project-inspection",
|
|
105
81
|
limit: "maxAnalysisHeapBytes",
|
|
106
|
-
limitMaximum:
|
|
82
|
+
limitMaximum: d,
|
|
107
83
|
observedUsage: null,
|
|
108
84
|
nextAction: "review-inspection-capacity"
|
|
109
|
-
}) :
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
if (!isClosing) close(createInspectionProcessFailure());
|
|
85
|
+
}) : t(n));
|
|
86
|
+
}), l.once("exit", () => {
|
|
87
|
+
p || _(t());
|
|
113
88
|
});
|
|
114
|
-
}
|
|
115
|
-
var handleParentMessage = (frame) => {
|
|
89
|
+
}, x = (e) => {
|
|
116
90
|
try {
|
|
117
|
-
|
|
118
|
-
if (
|
|
119
|
-
if (
|
|
120
|
-
|
|
91
|
+
let r = a(e);
|
|
92
|
+
if (p) return;
|
|
93
|
+
if (r.kind === "start") {
|
|
94
|
+
b(r);
|
|
121
95
|
return;
|
|
122
96
|
}
|
|
123
|
-
if (
|
|
124
|
-
if (
|
|
125
|
-
|
|
97
|
+
if (r.attemptId !== u || l === void 0) throw t();
|
|
98
|
+
if (r.kind === "dispose") {
|
|
99
|
+
_();
|
|
126
100
|
return;
|
|
127
101
|
}
|
|
128
|
-
if (
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
} else if (
|
|
132
|
-
if (!
|
|
133
|
-
} else if (
|
|
134
|
-
|
|
135
|
-
} catch (
|
|
136
|
-
|
|
102
|
+
if (r.kind === "run") {
|
|
103
|
+
if (d === void 0 || m) throw t();
|
|
104
|
+
m = !0;
|
|
105
|
+
} else if (r.kind === "reader-response" || r.kind === "reader-failure") {
|
|
106
|
+
if (!h.delete(r.requestId)) throw t();
|
|
107
|
+
} else if (r.kind !== "read-page" || !m) throw t();
|
|
108
|
+
l.postMessage(n(r));
|
|
109
|
+
} catch (e) {
|
|
110
|
+
_(e);
|
|
137
111
|
}
|
|
138
112
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
close();
|
|
143
|
-
}, NODE_INSPECTION_LIFETIME_MS);
|
|
144
|
-
if (process.send === void 0 || !process.connected) close();
|
|
113
|
+
s.on("disconnect", v), s.on("message", x), f = setTimeout(() => {
|
|
114
|
+
_();
|
|
115
|
+
}, i), (s.send === void 0 || !s.connected) && _();
|
|
145
116
|
//#endregion
|
|
146
117
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moldea.ai/cli",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.1",
|
|
4
4
|
"description": "The canonical read-only local command-line composition for moldea repositories.",
|
|
5
5
|
"homepage": "https://github.com/moldea-ai/packages/tree/main/projects/cli#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { u as isObjectValid } from "./chunk-728df961.mjs";
|
|
2
|
-
import { c as isRepositoryPath, i as RepositorySourceException, l as parseRepositoryPath } from "./chunk-8d6114d2.mjs";
|
|
3
|
-
import { Buffer } from "node:buffer";
|
|
4
|
-
//#region ../core/dist/chunks/repository-rpc-DVgCPLGx.js
|
|
5
|
-
var invalidSource = () => {
|
|
6
|
-
throw new RepositorySourceException({
|
|
7
|
-
code: "INVALID_SOURCE_DATA",
|
|
8
|
-
operation: "create-reader",
|
|
9
|
-
path: null,
|
|
10
|
-
retryable: false
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var isInteger = (input) => typeof input === "number" && Number.isSafeInteger(input) && input >= 0;
|
|
14
|
-
var keysMatch = (input, keys) => Object.keys(input).length === keys.length && keys.every((key) => Object.hasOwn(input, key));
|
|
15
|
-
var parseSnapshot = (input) => {
|
|
16
|
-
if (!isObjectValid(input, true) || !keysMatch(input, ["id", "sourceKind"]) || typeof input["id"] !== "string" || input["id"].length === 0 || typeof input["sourceKind"] !== "string" || input["sourceKind"].length === 0) return invalidSource();
|
|
17
|
-
return {
|
|
18
|
-
id: input["id"],
|
|
19
|
-
sourceKind: input["sourceKind"]
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
var parseRpcEntry = (input) => {
|
|
23
|
-
if (input === null) return null;
|
|
24
|
-
if (!isObjectValid(input, true)) return invalidSource();
|
|
25
|
-
const entry = input;
|
|
26
|
-
if (!keysMatch(entry, [
|
|
27
|
-
"path",
|
|
28
|
-
"type",
|
|
29
|
-
"byteLength",
|
|
30
|
-
"contentIdentity"
|
|
31
|
-
]) || !isRepositoryPath(entry["path"]) || entry["type"] !== "file" && entry["type"] !== "directory" && entry["type"] !== "symlink" || entry["byteLength"] !== null && !isInteger(entry["byteLength"]) || entry["contentIdentity"] !== null && typeof entry["contentIdentity"] !== "string") return invalidSource();
|
|
32
|
-
return {
|
|
33
|
-
path: entry["path"],
|
|
34
|
-
type: entry["type"],
|
|
35
|
-
byteLength: entry["byteLength"],
|
|
36
|
-
contentIdentity: entry["contentIdentity"]
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
var parseRpcEntryPage = (input) => {
|
|
40
|
-
if (!isObjectValid(input, true)) return invalidSource();
|
|
41
|
-
const page = input;
|
|
42
|
-
if (!keysMatch(page, [
|
|
43
|
-
"entries",
|
|
44
|
-
"isComplete",
|
|
45
|
-
"nextCursor",
|
|
46
|
-
"snapshot"
|
|
47
|
-
]) || !Array.isArray(page["entries"]) || page["entries"].length > 128 || typeof page["isComplete"] !== "boolean" || page["nextCursor"] !== null && typeof page["nextCursor"] !== "string") return invalidSource();
|
|
48
|
-
const entries = [];
|
|
49
|
-
for (const candidate of page["entries"]) {
|
|
50
|
-
const entry = parseRpcEntry(candidate);
|
|
51
|
-
if (entry === null) return invalidSource();
|
|
52
|
-
entries.push(entry);
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
entries,
|
|
56
|
-
isComplete: page["isComplete"],
|
|
57
|
-
nextCursor: page["nextCursor"],
|
|
58
|
-
snapshot: parseSnapshot(page["snapshot"])
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
var parseRpcLinkText = (input) => {
|
|
62
|
-
if (input === null) return null;
|
|
63
|
-
if (typeof input !== "string" || Buffer.byteLength(input, "utf8") > 4096) return invalidSource();
|
|
64
|
-
return input;
|
|
65
|
-
};
|
|
66
|
-
var parseRpcFilePage = (input) => {
|
|
67
|
-
if (!isObjectValid(input, true)) return invalidSource();
|
|
68
|
-
const filePage = input;
|
|
69
|
-
if (!keysMatch(filePage, [
|
|
70
|
-
"bytes",
|
|
71
|
-
"isComplete",
|
|
72
|
-
"nextOffset",
|
|
73
|
-
"offset",
|
|
74
|
-
"snapshot",
|
|
75
|
-
"totalBytes"
|
|
76
|
-
]) || typeof filePage["bytes"] !== "string" || filePage["bytes"].length > Math.ceil(65536 / 3) * 4 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(filePage["bytes"]) || typeof filePage["isComplete"] !== "boolean" || !isInteger(filePage["offset"]) || !isInteger(filePage["totalBytes"]) || filePage["nextOffset"] !== null && !isInteger(filePage["nextOffset"])) return invalidSource();
|
|
77
|
-
const bytes = Buffer.from(filePage["bytes"], "base64");
|
|
78
|
-
if (bytes.byteLength > 65536 || bytes.toString("base64") !== filePage["bytes"]) return invalidSource();
|
|
79
|
-
return {
|
|
80
|
-
bytes,
|
|
81
|
-
isComplete: filePage["isComplete"],
|
|
82
|
-
nextOffset: filePage["nextOffset"],
|
|
83
|
-
offset: filePage["offset"],
|
|
84
|
-
snapshot: parseSnapshot(filePage["snapshot"]),
|
|
85
|
-
totalBytes: filePage["totalBytes"]
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
var encodeFilePage = (page, maxBytes) => {
|
|
89
|
-
if (!(page.bytes instanceof Uint8Array) || page.bytes.byteLength > maxBytes) return invalidSource();
|
|
90
|
-
const result = {
|
|
91
|
-
...page,
|
|
92
|
-
bytes: Buffer.from(page.bytes.buffer, page.bytes.byteOffset, page.bytes.byteLength).toString("base64")
|
|
93
|
-
};
|
|
94
|
-
parseRpcFilePage(result);
|
|
95
|
-
return result;
|
|
96
|
-
};
|
|
97
|
-
var executeRepositoryRpc = async (sources, request, signal) => {
|
|
98
|
-
const getReader = (source) => source === "repository" ? sources.repository : sources.instructions ?? invalidSource();
|
|
99
|
-
if (request.method === "readLinkText") return parseRpcLinkText(await getReader(request.source).readLinkText(parseRepositoryPath(request.path), { signal }));
|
|
100
|
-
if (request.method === "getEntry") return parseRpcEntry(await getReader(request.source).getEntry(parseRepositoryPath(request.path), { signal }));
|
|
101
|
-
const reader = sources.repository;
|
|
102
|
-
if (request.method === "listEntriesPage") return parseRpcEntryPage(await reader.listEntriesPage({
|
|
103
|
-
maxEntries: request.maxEntries,
|
|
104
|
-
signal,
|
|
105
|
-
...request.prefix === void 0 ? {} : { prefix: parseRepositoryPath(request.prefix) },
|
|
106
|
-
...request.cursor === void 0 ? {} : { cursor: request.cursor }
|
|
107
|
-
}));
|
|
108
|
-
return encodeFilePage(await getReader(request.source).readFilePage(parseRepositoryPath(request.path), {
|
|
109
|
-
maxBytes: request.maxBytes,
|
|
110
|
-
offset: request.offset,
|
|
111
|
-
signal
|
|
112
|
-
}), request.maxBytes);
|
|
113
|
-
};
|
|
114
|
-
//#endregion
|
|
115
|
-
export { parseRpcLinkText as a, parseRpcFilePage as i, parseRpcEntry as n, parseRpcEntryPage as r, executeRepositoryRpc as t };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
//#region \0rolldown/runtime.js
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
-
key = keys[i];
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
21
|
-
value: mod,
|
|
22
|
-
enumerable: true
|
|
23
|
-
}) : target, mod));
|
|
24
|
-
var __require = (() => createRequire(import.meta.url))();
|
|
25
|
-
//#endregion
|
|
26
|
-
export { __require as n, __toESM as r, __commonJSMin as t };
|