@launchsecure/launch-kit 0.0.17 → 0.0.19
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/chart-client/assets/index--120d9P9.css +1 -0
- package/dist/chart-client/assets/index-C8ANseEa.js +441 -0
- package/dist/chart-client/index.html +2 -2
- package/dist/client/assets/index-Bf8zdL3x.css +32 -0
- package/dist/client/assets/index-Ds9UP_cj.js +291 -0
- package/dist/client/index.html +2 -2
- package/dist/council-client/assets/index-CofZh7pS.css +1 -0
- package/dist/council-client/assets/index-Dc41S-R2.js +198 -0
- package/dist/council-client/index.html +21 -0
- package/dist/deck-client/assets/{_baseUniq-BbqvoK-V.js → _baseUniq-DsfOm3t_.js} +1 -1
- package/dist/deck-client/assets/{arc-CMtYsIZt.js → arc-NJuvkBv1.js} +1 -1
- package/dist/deck-client/assets/{architectureDiagram-Q4EWVU46-BEN5hESa.js → architectureDiagram-Q4EWVU46-BgrcgZs0.js} +1 -1
- package/dist/deck-client/assets/{blockDiagram-DXYQGD6D-BV4CZ6k8.js → blockDiagram-DXYQGD6D-C3XoLi15.js} +1 -1
- package/dist/deck-client/assets/{c4Diagram-AHTNJAMY-fLcBXqdD.js → c4Diagram-AHTNJAMY-FX2PjLfb.js} +1 -1
- package/dist/deck-client/assets/channel-ChQjD1T1.js +1 -0
- package/dist/deck-client/assets/{chunk-4BX2VUAB-BO_19zwB.js → chunk-4BX2VUAB-D0aqsJV0.js} +1 -1
- package/dist/deck-client/assets/{chunk-4TB4RGXK-iYegd5fu.js → chunk-4TB4RGXK-7qRCCAgK.js} +1 -1
- package/dist/deck-client/assets/{chunk-55IACEB6-DM3QwYFL.js → chunk-55IACEB6-DfHG-iqb.js} +1 -1
- package/dist/deck-client/assets/{chunk-EDXVE4YY-DGznOul1.js → chunk-EDXVE4YY-DrR52j3B.js} +1 -1
- package/dist/deck-client/assets/{chunk-FMBD7UC4-DsANJqYW.js → chunk-FMBD7UC4-D5KSGATB.js} +1 -1
- package/dist/deck-client/assets/{chunk-OYMX7WX6-6PGH1F7d.js → chunk-OYMX7WX6-M7hsLRNU.js} +1 -1
- package/dist/deck-client/assets/{chunk-QZHKN3VN-Dihf0Uq7.js → chunk-QZHKN3VN-1ynAWO2m.js} +1 -1
- package/dist/deck-client/assets/{chunk-YZCP3GAM-Cali2wW5.js → chunk-YZCP3GAM-S2-nGw3D.js} +1 -1
- package/dist/deck-client/assets/classDiagram-6PBFFD2Q-B_9iqK1S.js +1 -0
- package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-B_9iqK1S.js +1 -0
- package/dist/deck-client/assets/clone-BYt1AMfz.js +1 -0
- package/dist/deck-client/assets/{cose-bilkent-S5V4N54A-DsRY4vbI.js → cose-bilkent-S5V4N54A-BcMwozS2.js} +1 -1
- package/dist/deck-client/assets/cytoscape.esm-BQk4lpUV.js +331 -0
- package/dist/deck-client/assets/{dagre-KV5264BT-DJIKE_pI.js → dagre-KV5264BT-DtKMhl_1.js} +1 -1
- package/dist/deck-client/assets/{diagram-5BDNPKRD-Ckgli1SP.js → diagram-5BDNPKRD-1plH69us.js} +1 -1
- package/dist/deck-client/assets/{diagram-G4DWMVQ6-CozcDzae.js → diagram-G4DWMVQ6-D_o-BHO3.js} +1 -1
- package/dist/deck-client/assets/{diagram-MMDJMWI5-xVSwW3f_.js → diagram-MMDJMWI5-ClZ1LIx6.js} +1 -1
- package/dist/deck-client/assets/{diagram-TYMM5635-CJeZVY-P.js → diagram-TYMM5635-B8dKHfRh.js} +1 -1
- package/dist/deck-client/assets/{erDiagram-SMLLAGMA-j4wjAERH.js → erDiagram-SMLLAGMA-CY2aCH7-.js} +1 -1
- package/dist/deck-client/assets/{flowDiagram-DWJPFMVM-CVLZ1efi.js → flowDiagram-DWJPFMVM-DZZWHti8.js} +1 -1
- package/dist/deck-client/assets/{ganttDiagram-T4ZO3ILL-CcIJ7pkP.js → ganttDiagram-T4ZO3ILL-OwGGa6Lu.js} +1 -1
- package/dist/deck-client/assets/{gitGraphDiagram-UUTBAWPF-BZRhQX-a.js → gitGraphDiagram-UUTBAWPF-GKyWD4Qt.js} +1 -1
- package/dist/deck-client/assets/{graph-D0l25xfo.js → graph-CORzYQdB.js} +1 -1
- package/dist/deck-client/assets/index-765AIQ9z.css +1 -0
- package/dist/deck-client/assets/{index-BXcoHWVM.js → index-hiIpM7EP.js} +93 -93
- package/dist/deck-client/assets/{infoDiagram-42DDH7IO-BLwgxnYT.js → infoDiagram-42DDH7IO-DmgqJCcF.js} +1 -1
- package/dist/deck-client/assets/{ishikawaDiagram-UXIWVN3A-BfOLoWv3.js → ishikawaDiagram-UXIWVN3A-D-1v7knu.js} +1 -1
- package/dist/deck-client/assets/{journeyDiagram-VCZTEJTY-CPuL6C9h.js → journeyDiagram-VCZTEJTY-CYrGQE7b.js} +1 -1
- package/dist/deck-client/assets/{kanban-definition-6JOO6SKY-D3uf7_tx.js → kanban-definition-6JOO6SKY-BJFDWiH-.js} +1 -1
- package/dist/deck-client/assets/{layout-CzToiXdK.js → layout-BTFFcaxF.js} +1 -1
- package/dist/deck-client/assets/{linear-BU36t460.js → linear-DAbl6COS.js} +1 -1
- package/dist/deck-client/assets/{min-DX_q-lqP.js → min-oWHBrFBm.js} +1 -1
- package/dist/deck-client/assets/{mindmap-definition-QFDTVHPH-Ccty4O16.js → mindmap-definition-QFDTVHPH-BTCB0VLO.js} +1 -1
- package/dist/deck-client/assets/{pieDiagram-DEJITSTG-DVjsvH19.js → pieDiagram-DEJITSTG-CUZChWNA.js} +1 -1
- package/dist/deck-client/assets/{quadrantDiagram-34T5L4WZ-DtOXFVW9.js → quadrantDiagram-34T5L4WZ-4M1Um_e4.js} +1 -1
- package/dist/deck-client/assets/{requirementDiagram-MS252O5E-BbO_kKg6.js → requirementDiagram-MS252O5E-DLzQZ0B3.js} +1 -1
- package/dist/deck-client/assets/{sankeyDiagram-XADWPNL6-qbbj-CmC.js → sankeyDiagram-XADWPNL6-DcNgzV3E.js} +1 -1
- package/dist/deck-client/assets/{sequenceDiagram-FGHM5R23-JNKZAgfQ.js → sequenceDiagram-FGHM5R23-CAcI2vC9.js} +1 -1
- package/dist/deck-client/assets/{stateDiagram-FHFEXIEX-dtFalcNx.js → stateDiagram-FHFEXIEX-CntjTTm5.js} +1 -1
- package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-YiaphOU_.js +1 -0
- package/dist/deck-client/assets/{timeline-definition-GMOUNBTQ-Dpp5nqSJ.js → timeline-definition-GMOUNBTQ-D8zrit4U.js} +1 -1
- package/dist/deck-client/assets/{vennDiagram-DHZGUBPP-D8qEutX7.js → vennDiagram-DHZGUBPP-C4SuFPgo.js} +1 -1
- package/dist/deck-client/assets/{wardley-RL74JXVD-BwMqiNcL.js → wardley-RL74JXVD-B3F-Olcq.js} +58 -58
- package/dist/deck-client/assets/{wardleyDiagram-NUSXRM2D-Bxl9X3CK.js → wardleyDiagram-NUSXRM2D-kj73r6f-.js} +1 -1
- package/dist/deck-client/assets/{xychartDiagram-5P7HB3ND-DYcvxLhi.js → xychartDiagram-5P7HB3ND-CC_d_Ey3.js} +1 -1
- package/dist/deck-client/index.html +2 -2
- package/dist/server/chart-serve.js +452 -244
- package/dist/server/cli.js +558 -750
- package/dist/server/council-entry.js +1418 -0
- package/dist/server/council-serve.js +1039 -0
- package/dist/server/graph-mcp-entry.js +486 -695
- package/package.json +10 -9
- package/dist/chart-client/assets/index-BUhuLBaw.js +0 -441
- package/dist/chart-client/assets/index-CWRZxjqR.css +0 -1
- package/dist/client/assets/index-CAAipH3V.js +0 -291
- package/dist/client/assets/index-DtbN793z.css +0 -32
- package/dist/deck-client/assets/channel-Nf-B3Qor.js +0 -1
- package/dist/deck-client/assets/classDiagram-6PBFFD2Q-3i3-miMR.js +0 -1
- package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-3i3-miMR.js +0 -1
- package/dist/deck-client/assets/clone-DXBuQlG8.js +0 -1
- package/dist/deck-client/assets/cytoscape.esm-BiciSPf8.js +0 -331
- package/dist/deck-client/assets/index-Cdh-f3-c.css +0 -1
- package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-CviYYulW.js +0 -1
package/dist/server/cli.js
CHANGED
|
@@ -34,43 +34,43 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
));
|
|
35
35
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
36
36
|
|
|
37
|
-
// ../../node_modules/uuid/dist/esm-node/max.js
|
|
37
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/max.js
|
|
38
38
|
var max_default;
|
|
39
39
|
var init_max = __esm({
|
|
40
|
-
"../../node_modules/uuid/dist/esm-node/max.js"() {
|
|
40
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/max.js"() {
|
|
41
41
|
max_default = "ffffffff-ffff-ffff-ffff-ffffffffffff";
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
// ../../node_modules/uuid/dist/esm-node/nil.js
|
|
45
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/nil.js
|
|
46
46
|
var nil_default;
|
|
47
47
|
var init_nil = __esm({
|
|
48
|
-
"../../node_modules/uuid/dist/esm-node/nil.js"() {
|
|
48
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/nil.js"() {
|
|
49
49
|
nil_default = "00000000-0000-0000-0000-000000000000";
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
|
|
53
|
-
// ../../node_modules/uuid/dist/esm-node/regex.js
|
|
53
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/regex.js
|
|
54
54
|
var regex_default;
|
|
55
55
|
var init_regex = __esm({
|
|
56
|
-
"../../node_modules/uuid/dist/esm-node/regex.js"() {
|
|
56
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/regex.js"() {
|
|
57
57
|
regex_default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
// ../../node_modules/uuid/dist/esm-node/validate.js
|
|
61
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/validate.js
|
|
62
62
|
function validate(uuid) {
|
|
63
63
|
return typeof uuid === "string" && regex_default.test(uuid);
|
|
64
64
|
}
|
|
65
65
|
var validate_default;
|
|
66
66
|
var init_validate = __esm({
|
|
67
|
-
"../../node_modules/uuid/dist/esm-node/validate.js"() {
|
|
67
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/validate.js"() {
|
|
68
68
|
init_regex();
|
|
69
69
|
validate_default = validate;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
|
|
73
|
-
// ../../node_modules/uuid/dist/esm-node/parse.js
|
|
73
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/parse.js
|
|
74
74
|
function parse(uuid) {
|
|
75
75
|
if (!validate_default(uuid)) {
|
|
76
76
|
throw TypeError("Invalid UUID");
|
|
@@ -97,13 +97,13 @@ function parse(uuid) {
|
|
|
97
97
|
}
|
|
98
98
|
var parse_default;
|
|
99
99
|
var init_parse = __esm({
|
|
100
|
-
"../../node_modules/uuid/dist/esm-node/parse.js"() {
|
|
100
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/parse.js"() {
|
|
101
101
|
init_validate();
|
|
102
102
|
parse_default = parse;
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
-
// ../../node_modules/uuid/dist/esm-node/stringify.js
|
|
106
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/stringify.js
|
|
107
107
|
function unsafeStringify(arr, offset = 0) {
|
|
108
108
|
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
109
109
|
}
|
|
@@ -116,7 +116,7 @@ function stringify(arr, offset = 0) {
|
|
|
116
116
|
}
|
|
117
117
|
var byteToHex, stringify_default;
|
|
118
118
|
var init_stringify = __esm({
|
|
119
|
-
"../../node_modules/uuid/dist/esm-node/stringify.js"() {
|
|
119
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/stringify.js"() {
|
|
120
120
|
init_validate();
|
|
121
121
|
byteToHex = [];
|
|
122
122
|
for (let i = 0; i < 256; ++i) {
|
|
@@ -126,7 +126,7 @@ var init_stringify = __esm({
|
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
// ../../node_modules/uuid/dist/esm-node/rng.js
|
|
129
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/rng.js
|
|
130
130
|
function rng() {
|
|
131
131
|
if (poolPtr > rnds8Pool.length - 16) {
|
|
132
132
|
import_node_crypto.default.randomFillSync(rnds8Pool);
|
|
@@ -136,14 +136,14 @@ function rng() {
|
|
|
136
136
|
}
|
|
137
137
|
var import_node_crypto, rnds8Pool, poolPtr;
|
|
138
138
|
var init_rng = __esm({
|
|
139
|
-
"../../node_modules/uuid/dist/esm-node/rng.js"() {
|
|
139
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/rng.js"() {
|
|
140
140
|
import_node_crypto = __toESM(require("node:crypto"));
|
|
141
141
|
rnds8Pool = new Uint8Array(256);
|
|
142
142
|
poolPtr = rnds8Pool.length;
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
-
// ../../node_modules/uuid/dist/esm-node/v1.js
|
|
146
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v1.js
|
|
147
147
|
function v1(options, buf, offset) {
|
|
148
148
|
let i = buf && offset || 0;
|
|
149
149
|
const b = buf || new Array(16);
|
|
@@ -209,7 +209,7 @@ function v1(options, buf, offset) {
|
|
|
209
209
|
}
|
|
210
210
|
var _nodeId, _clockseq, _lastMSecs, _lastNSecs, v1_default;
|
|
211
211
|
var init_v1 = __esm({
|
|
212
|
-
"../../node_modules/uuid/dist/esm-node/v1.js"() {
|
|
212
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v1.js"() {
|
|
213
213
|
init_rng();
|
|
214
214
|
init_stringify();
|
|
215
215
|
_lastMSecs = 0;
|
|
@@ -218,7 +218,7 @@ var init_v1 = __esm({
|
|
|
218
218
|
}
|
|
219
219
|
});
|
|
220
220
|
|
|
221
|
-
// ../../node_modules/uuid/dist/esm-node/v1ToV6.js
|
|
221
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v1ToV6.js
|
|
222
222
|
function v1ToV6(uuid) {
|
|
223
223
|
const v1Bytes = typeof uuid === "string" ? parse_default(uuid) : uuid;
|
|
224
224
|
const v6Bytes = _v1ToV6(v1Bytes);
|
|
@@ -228,13 +228,13 @@ function _v1ToV6(v1Bytes, randomize = false) {
|
|
|
228
228
|
return Uint8Array.of((v1Bytes[6] & 15) << 4 | v1Bytes[7] >> 4 & 15, (v1Bytes[7] & 15) << 4 | (v1Bytes[4] & 240) >> 4, (v1Bytes[4] & 15) << 4 | (v1Bytes[5] & 240) >> 4, (v1Bytes[5] & 15) << 4 | (v1Bytes[0] & 240) >> 4, (v1Bytes[0] & 15) << 4 | (v1Bytes[1] & 240) >> 4, (v1Bytes[1] & 15) << 4 | (v1Bytes[2] & 240) >> 4, 96 | v1Bytes[2] & 15, v1Bytes[3], v1Bytes[8], v1Bytes[9], v1Bytes[10], v1Bytes[11], v1Bytes[12], v1Bytes[13], v1Bytes[14], v1Bytes[15]);
|
|
229
229
|
}
|
|
230
230
|
var init_v1ToV6 = __esm({
|
|
231
|
-
"../../node_modules/uuid/dist/esm-node/v1ToV6.js"() {
|
|
231
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v1ToV6.js"() {
|
|
232
232
|
init_parse();
|
|
233
233
|
init_stringify();
|
|
234
234
|
}
|
|
235
235
|
});
|
|
236
236
|
|
|
237
|
-
// ../../node_modules/uuid/dist/esm-node/v35.js
|
|
237
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v35.js
|
|
238
238
|
function stringToBytes(str) {
|
|
239
239
|
str = unescape(encodeURIComponent(str));
|
|
240
240
|
const bytes = [];
|
|
@@ -280,7 +280,7 @@ function v35(name, version2, hashfunc) {
|
|
|
280
280
|
}
|
|
281
281
|
var DNS, URL2;
|
|
282
282
|
var init_v35 = __esm({
|
|
283
|
-
"../../node_modules/uuid/dist/esm-node/v35.js"() {
|
|
283
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v35.js"() {
|
|
284
284
|
init_stringify();
|
|
285
285
|
init_parse();
|
|
286
286
|
DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
|
|
@@ -288,7 +288,7 @@ var init_v35 = __esm({
|
|
|
288
288
|
}
|
|
289
289
|
});
|
|
290
290
|
|
|
291
|
-
// ../../node_modules/uuid/dist/esm-node/md5.js
|
|
291
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/md5.js
|
|
292
292
|
function md5(bytes) {
|
|
293
293
|
if (Array.isArray(bytes)) {
|
|
294
294
|
bytes = Buffer.from(bytes);
|
|
@@ -299,16 +299,16 @@ function md5(bytes) {
|
|
|
299
299
|
}
|
|
300
300
|
var import_node_crypto2, md5_default;
|
|
301
301
|
var init_md5 = __esm({
|
|
302
|
-
"../../node_modules/uuid/dist/esm-node/md5.js"() {
|
|
302
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/md5.js"() {
|
|
303
303
|
import_node_crypto2 = __toESM(require("node:crypto"));
|
|
304
304
|
md5_default = md5;
|
|
305
305
|
}
|
|
306
306
|
});
|
|
307
307
|
|
|
308
|
-
// ../../node_modules/uuid/dist/esm-node/v3.js
|
|
308
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v3.js
|
|
309
309
|
var v3, v3_default;
|
|
310
310
|
var init_v3 = __esm({
|
|
311
|
-
"../../node_modules/uuid/dist/esm-node/v3.js"() {
|
|
311
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v3.js"() {
|
|
312
312
|
init_v35();
|
|
313
313
|
init_md5();
|
|
314
314
|
v3 = v35("v3", 48, md5_default);
|
|
@@ -316,10 +316,10 @@ var init_v3 = __esm({
|
|
|
316
316
|
}
|
|
317
317
|
});
|
|
318
318
|
|
|
319
|
-
// ../../node_modules/uuid/dist/esm-node/native.js
|
|
319
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/native.js
|
|
320
320
|
var import_node_crypto3, native_default;
|
|
321
321
|
var init_native = __esm({
|
|
322
|
-
"../../node_modules/uuid/dist/esm-node/native.js"() {
|
|
322
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/native.js"() {
|
|
323
323
|
import_node_crypto3 = __toESM(require("node:crypto"));
|
|
324
324
|
native_default = {
|
|
325
325
|
randomUUID: import_node_crypto3.default.randomUUID
|
|
@@ -327,7 +327,7 @@ var init_native = __esm({
|
|
|
327
327
|
}
|
|
328
328
|
});
|
|
329
329
|
|
|
330
|
-
// ../../node_modules/uuid/dist/esm-node/v4.js
|
|
330
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v4.js
|
|
331
331
|
function v4(options, buf, offset) {
|
|
332
332
|
if (native_default.randomUUID && !buf && !options) {
|
|
333
333
|
return native_default.randomUUID();
|
|
@@ -347,7 +347,7 @@ function v4(options, buf, offset) {
|
|
|
347
347
|
}
|
|
348
348
|
var v4_default;
|
|
349
349
|
var init_v4 = __esm({
|
|
350
|
-
"../../node_modules/uuid/dist/esm-node/v4.js"() {
|
|
350
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v4.js"() {
|
|
351
351
|
init_native();
|
|
352
352
|
init_rng();
|
|
353
353
|
init_stringify();
|
|
@@ -355,7 +355,7 @@ var init_v4 = __esm({
|
|
|
355
355
|
}
|
|
356
356
|
});
|
|
357
357
|
|
|
358
|
-
// ../../node_modules/uuid/dist/esm-node/sha1.js
|
|
358
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/sha1.js
|
|
359
359
|
function sha1(bytes) {
|
|
360
360
|
if (Array.isArray(bytes)) {
|
|
361
361
|
bytes = Buffer.from(bytes);
|
|
@@ -366,16 +366,16 @@ function sha1(bytes) {
|
|
|
366
366
|
}
|
|
367
367
|
var import_node_crypto4, sha1_default;
|
|
368
368
|
var init_sha1 = __esm({
|
|
369
|
-
"../../node_modules/uuid/dist/esm-node/sha1.js"() {
|
|
369
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/sha1.js"() {
|
|
370
370
|
import_node_crypto4 = __toESM(require("node:crypto"));
|
|
371
371
|
sha1_default = sha1;
|
|
372
372
|
}
|
|
373
373
|
});
|
|
374
374
|
|
|
375
|
-
// ../../node_modules/uuid/dist/esm-node/v5.js
|
|
375
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v5.js
|
|
376
376
|
var v5, v5_default;
|
|
377
377
|
var init_v5 = __esm({
|
|
378
|
-
"../../node_modules/uuid/dist/esm-node/v5.js"() {
|
|
378
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v5.js"() {
|
|
379
379
|
init_v35();
|
|
380
380
|
init_sha1();
|
|
381
381
|
v5 = v35("v5", 80, sha1_default);
|
|
@@ -383,7 +383,7 @@ var init_v5 = __esm({
|
|
|
383
383
|
}
|
|
384
384
|
});
|
|
385
385
|
|
|
386
|
-
// ../../node_modules/uuid/dist/esm-node/v6.js
|
|
386
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v6.js
|
|
387
387
|
function v6(options = {}, buf, offset = 0) {
|
|
388
388
|
let bytes = v1_default({
|
|
389
389
|
...options,
|
|
@@ -399,14 +399,14 @@ function v6(options = {}, buf, offset = 0) {
|
|
|
399
399
|
return unsafeStringify(bytes);
|
|
400
400
|
}
|
|
401
401
|
var init_v6 = __esm({
|
|
402
|
-
"../../node_modules/uuid/dist/esm-node/v6.js"() {
|
|
402
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v6.js"() {
|
|
403
403
|
init_stringify();
|
|
404
404
|
init_v1();
|
|
405
405
|
init_v1ToV6();
|
|
406
406
|
}
|
|
407
407
|
});
|
|
408
408
|
|
|
409
|
-
// ../../node_modules/uuid/dist/esm-node/v6ToV1.js
|
|
409
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v6ToV1.js
|
|
410
410
|
function v6ToV1(uuid) {
|
|
411
411
|
const v6Bytes = typeof uuid === "string" ? parse_default(uuid) : uuid;
|
|
412
412
|
const v1Bytes = _v6ToV1(v6Bytes);
|
|
@@ -416,13 +416,13 @@ function _v6ToV1(v6Bytes) {
|
|
|
416
416
|
return Uint8Array.of((v6Bytes[3] & 15) << 4 | v6Bytes[4] >> 4 & 15, (v6Bytes[4] & 15) << 4 | (v6Bytes[5] & 240) >> 4, (v6Bytes[5] & 15) << 4 | v6Bytes[6] & 15, v6Bytes[7], (v6Bytes[1] & 15) << 4 | (v6Bytes[2] & 240) >> 4, (v6Bytes[2] & 15) << 4 | (v6Bytes[3] & 240) >> 4, 16 | (v6Bytes[0] & 240) >> 4, (v6Bytes[0] & 15) << 4 | (v6Bytes[1] & 240) >> 4, v6Bytes[8], v6Bytes[9], v6Bytes[10], v6Bytes[11], v6Bytes[12], v6Bytes[13], v6Bytes[14], v6Bytes[15]);
|
|
417
417
|
}
|
|
418
418
|
var init_v6ToV1 = __esm({
|
|
419
|
-
"../../node_modules/uuid/dist/esm-node/v6ToV1.js"() {
|
|
419
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v6ToV1.js"() {
|
|
420
420
|
init_parse();
|
|
421
421
|
init_stringify();
|
|
422
422
|
}
|
|
423
423
|
});
|
|
424
424
|
|
|
425
|
-
// ../../node_modules/uuid/dist/esm-node/v7.js
|
|
425
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v7.js
|
|
426
426
|
function v7(options, buf, offset) {
|
|
427
427
|
options = options || {};
|
|
428
428
|
let i = buf && offset || 0;
|
|
@@ -486,7 +486,7 @@ function v7(options, buf, offset) {
|
|
|
486
486
|
}
|
|
487
487
|
var _seqLow, _seqHigh, _msecs, v7_default;
|
|
488
488
|
var init_v7 = __esm({
|
|
489
|
-
"../../node_modules/uuid/dist/esm-node/v7.js"() {
|
|
489
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/v7.js"() {
|
|
490
490
|
init_rng();
|
|
491
491
|
init_stringify();
|
|
492
492
|
_seqLow = null;
|
|
@@ -496,7 +496,7 @@ var init_v7 = __esm({
|
|
|
496
496
|
}
|
|
497
497
|
});
|
|
498
498
|
|
|
499
|
-
// ../../node_modules/uuid/dist/esm-node/version.js
|
|
499
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/version.js
|
|
500
500
|
function version(uuid) {
|
|
501
501
|
if (!validate_default(uuid)) {
|
|
502
502
|
throw TypeError("Invalid UUID");
|
|
@@ -505,13 +505,13 @@ function version(uuid) {
|
|
|
505
505
|
}
|
|
506
506
|
var version_default;
|
|
507
507
|
var init_version = __esm({
|
|
508
|
-
"../../node_modules/uuid/dist/esm-node/version.js"() {
|
|
508
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/version.js"() {
|
|
509
509
|
init_validate();
|
|
510
510
|
version_default = version;
|
|
511
511
|
}
|
|
512
512
|
});
|
|
513
513
|
|
|
514
|
-
// ../../node_modules/uuid/dist/esm-node/index.js
|
|
514
|
+
// ../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/index.js
|
|
515
515
|
var esm_node_exports = {};
|
|
516
516
|
__export(esm_node_exports, {
|
|
517
517
|
MAX: () => max_default,
|
|
@@ -530,7 +530,7 @@ __export(esm_node_exports, {
|
|
|
530
530
|
version: () => version_default
|
|
531
531
|
});
|
|
532
532
|
var init_esm_node = __esm({
|
|
533
|
-
"../../node_modules/uuid/dist/esm-node/index.js"() {
|
|
533
|
+
"../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-node/index.js"() {
|
|
534
534
|
init_max();
|
|
535
535
|
init_nil();
|
|
536
536
|
init_parse();
|
|
@@ -554,7 +554,7 @@ var require_claude_bridge = __commonJS({
|
|
|
554
554
|
"use strict";
|
|
555
555
|
var { spawn: spawn3 } = require("node-pty");
|
|
556
556
|
var path9 = require("path");
|
|
557
|
-
var
|
|
557
|
+
var fs9 = require("fs");
|
|
558
558
|
var ClaudeBridge = class {
|
|
559
559
|
constructor() {
|
|
560
560
|
this.sessions = /* @__PURE__ */ new Map();
|
|
@@ -572,7 +572,7 @@ var require_claude_bridge = __commonJS({
|
|
|
572
572
|
];
|
|
573
573
|
for (const cmd of possibleCommands) {
|
|
574
574
|
try {
|
|
575
|
-
if (
|
|
575
|
+
if (fs9.existsSync(cmd) || this.commandExists(cmd)) {
|
|
576
576
|
console.log(`Found Claude command at: ${cmd}`);
|
|
577
577
|
return cmd;
|
|
578
578
|
}
|
|
@@ -600,6 +600,8 @@ var require_claude_bridge = __commonJS({
|
|
|
600
600
|
dangerouslySkipPermissions = false,
|
|
601
601
|
appendSystemPrompt,
|
|
602
602
|
initialPrompt,
|
|
603
|
+
mcpConfig,
|
|
604
|
+
strictMcpConfig = false,
|
|
603
605
|
onOutput = () => {
|
|
604
606
|
},
|
|
605
607
|
onExit = () => {
|
|
@@ -622,6 +624,8 @@ var require_claude_bridge = __commonJS({
|
|
|
622
624
|
}
|
|
623
625
|
const args = [];
|
|
624
626
|
if (dangerouslySkipPermissions) args.push("--dangerously-skip-permissions");
|
|
627
|
+
if (mcpConfig) args.push("--mcp-config", mcpConfig);
|
|
628
|
+
if (strictMcpConfig) args.push("--strict-mcp-config");
|
|
625
629
|
if (appendSystemPrompt) args.push("--append-system-prompt", appendSystemPrompt);
|
|
626
630
|
if (initialPrompt) args.push(initialPrompt);
|
|
627
631
|
const claudeProcess = spawn3(this.claudeCommand, args, {
|
|
@@ -773,7 +777,7 @@ var require_codex_bridge = __commonJS({
|
|
|
773
777
|
"use strict";
|
|
774
778
|
var { spawn: spawn3 } = require("node-pty");
|
|
775
779
|
var path9 = require("path");
|
|
776
|
-
var
|
|
780
|
+
var fs9 = require("fs");
|
|
777
781
|
var CodexBridge = class {
|
|
778
782
|
constructor() {
|
|
779
783
|
this.sessions = /* @__PURE__ */ new Map();
|
|
@@ -790,7 +794,7 @@ var require_codex_bridge = __commonJS({
|
|
|
790
794
|
];
|
|
791
795
|
for (const cmd of possibleCommands) {
|
|
792
796
|
try {
|
|
793
|
-
if (
|
|
797
|
+
if (fs9.existsSync(cmd) || this.commandExists(cmd)) {
|
|
794
798
|
console.log(`Found Codex command at: ${cmd}`);
|
|
795
799
|
return cmd;
|
|
796
800
|
}
|
|
@@ -966,7 +970,7 @@ var require_agent_bridge = __commonJS({
|
|
|
966
970
|
"use strict";
|
|
967
971
|
var { spawn: spawn3 } = require("node-pty");
|
|
968
972
|
var path9 = require("path");
|
|
969
|
-
var
|
|
973
|
+
var fs9 = require("fs");
|
|
970
974
|
var AgentBridge = class {
|
|
971
975
|
constructor() {
|
|
972
976
|
this.sessions = /* @__PURE__ */ new Map();
|
|
@@ -982,7 +986,7 @@ var require_agent_bridge = __commonJS({
|
|
|
982
986
|
];
|
|
983
987
|
for (const cmd of possibleCommands) {
|
|
984
988
|
try {
|
|
985
|
-
if (
|
|
989
|
+
if (fs9.existsSync(cmd) || this.commandExists(cmd)) {
|
|
986
990
|
console.log(`Found Agent command at: ${cmd}`);
|
|
987
991
|
return cmd;
|
|
988
992
|
}
|
|
@@ -1306,7 +1310,7 @@ var require_script_bridge = __commonJS({
|
|
|
1306
1310
|
var require_session_store = __commonJS({
|
|
1307
1311
|
"../claude-code-web/src/utils/session-store.js"(exports2, module2) {
|
|
1308
1312
|
"use strict";
|
|
1309
|
-
var
|
|
1313
|
+
var fs9 = require("fs").promises;
|
|
1310
1314
|
var path9 = require("path");
|
|
1311
1315
|
var os2 = require("os");
|
|
1312
1316
|
var SessionStore = class {
|
|
@@ -1317,14 +1321,14 @@ var require_session_store = __commonJS({
|
|
|
1317
1321
|
}
|
|
1318
1322
|
async initializeStorage() {
|
|
1319
1323
|
try {
|
|
1320
|
-
await
|
|
1324
|
+
await fs9.mkdir(this.storageDir, { recursive: true });
|
|
1321
1325
|
} catch (error) {
|
|
1322
1326
|
console.error("Failed to create storage directory:", error);
|
|
1323
1327
|
}
|
|
1324
1328
|
}
|
|
1325
1329
|
async saveSessions(sessions) {
|
|
1326
1330
|
try {
|
|
1327
|
-
await
|
|
1331
|
+
await fs9.mkdir(this.storageDir, { recursive: true });
|
|
1328
1332
|
const sessionsArray = Array.from(sessions.entries()).map(([id, session]) => ({
|
|
1329
1333
|
id,
|
|
1330
1334
|
name: session.name || "Unnamed Session",
|
|
@@ -1355,9 +1359,9 @@ var require_session_store = __commonJS({
|
|
|
1355
1359
|
sessions: sessionsArray
|
|
1356
1360
|
};
|
|
1357
1361
|
const tempFile = `${this.sessionsFile}.tmp`;
|
|
1358
|
-
await
|
|
1359
|
-
await
|
|
1360
|
-
await
|
|
1362
|
+
await fs9.writeFile(tempFile, JSON.stringify(data, null, 2));
|
|
1363
|
+
await fs9.mkdir(this.storageDir, { recursive: true });
|
|
1364
|
+
await fs9.rename(tempFile, this.sessionsFile);
|
|
1361
1365
|
return true;
|
|
1362
1366
|
} catch (error) {
|
|
1363
1367
|
console.error("Failed to save sessions:", error.message);
|
|
@@ -1366,8 +1370,8 @@ var require_session_store = __commonJS({
|
|
|
1366
1370
|
}
|
|
1367
1371
|
async loadSessions() {
|
|
1368
1372
|
try {
|
|
1369
|
-
await
|
|
1370
|
-
const data = await
|
|
1373
|
+
await fs9.access(this.sessionsFile);
|
|
1374
|
+
const data = await fs9.readFile(this.sessionsFile, "utf8");
|
|
1371
1375
|
if (!data || !data.trim()) {
|
|
1372
1376
|
console.log("Sessions file is empty, starting fresh");
|
|
1373
1377
|
return /* @__PURE__ */ new Map();
|
|
@@ -1378,7 +1382,7 @@ var require_session_store = __commonJS({
|
|
|
1378
1382
|
} catch (parseError) {
|
|
1379
1383
|
console.error("Sessions file is corrupted, starting fresh:", parseError.message);
|
|
1380
1384
|
try {
|
|
1381
|
-
await
|
|
1385
|
+
await fs9.rename(this.sessionsFile, `${this.sessionsFile}.corrupted.${Date.now()}`);
|
|
1382
1386
|
} catch (renameError) {
|
|
1383
1387
|
}
|
|
1384
1388
|
return /* @__PURE__ */ new Map();
|
|
@@ -1422,7 +1426,7 @@ var require_session_store = __commonJS({
|
|
|
1422
1426
|
}
|
|
1423
1427
|
async clearOldSessions() {
|
|
1424
1428
|
try {
|
|
1425
|
-
await
|
|
1429
|
+
await fs9.unlink(this.sessionsFile);
|
|
1426
1430
|
console.log("Cleared old sessions");
|
|
1427
1431
|
return true;
|
|
1428
1432
|
} catch (error) {
|
|
@@ -1434,9 +1438,9 @@ var require_session_store = __commonJS({
|
|
|
1434
1438
|
}
|
|
1435
1439
|
async getSessionMetadata() {
|
|
1436
1440
|
try {
|
|
1437
|
-
await
|
|
1438
|
-
const stats = await
|
|
1439
|
-
const data = await
|
|
1441
|
+
await fs9.access(this.sessionsFile);
|
|
1442
|
+
const stats = await fs9.stat(this.sessionsFile);
|
|
1443
|
+
const data = await fs9.readFile(this.sessionsFile, "utf8");
|
|
1440
1444
|
const parsed = JSON.parse(data);
|
|
1441
1445
|
return {
|
|
1442
1446
|
exists: true,
|
|
@@ -1461,7 +1465,7 @@ var require_session_store = __commonJS({
|
|
|
1461
1465
|
var require_usage_reader = __commonJS({
|
|
1462
1466
|
"../claude-code-web/src/usage-reader.js"(exports2, module2) {
|
|
1463
1467
|
"use strict";
|
|
1464
|
-
var
|
|
1468
|
+
var fs9 = require("fs").promises;
|
|
1465
1469
|
var path9 = require("path");
|
|
1466
1470
|
var readline = require("readline");
|
|
1467
1471
|
var { createReadStream } = require("fs");
|
|
@@ -1669,12 +1673,12 @@ var require_usage_reader = __commonJS({
|
|
|
1669
1673
|
const projectDirName = cwd.replace(/\//g, "-");
|
|
1670
1674
|
let projectPath = path9.join(this.claudeProjectsPath, projectDirName);
|
|
1671
1675
|
try {
|
|
1672
|
-
await
|
|
1676
|
+
await fs9.access(projectPath);
|
|
1673
1677
|
} catch (err2) {
|
|
1674
1678
|
console.log(`Project directory not found: ${projectPath}`);
|
|
1675
1679
|
return null;
|
|
1676
1680
|
}
|
|
1677
|
-
const files = await
|
|
1681
|
+
const files = await fs9.readdir(projectPath);
|
|
1678
1682
|
const jsonlFiles = files.filter((f) => f.endsWith(".jsonl"));
|
|
1679
1683
|
if (jsonlFiles.length === 0) {
|
|
1680
1684
|
return null;
|
|
@@ -1683,7 +1687,7 @@ var require_usage_reader = __commonJS({
|
|
|
1683
1687
|
let mostRecentTime = 0;
|
|
1684
1688
|
for (const file of jsonlFiles) {
|
|
1685
1689
|
const filePath = path9.join(projectPath, file);
|
|
1686
|
-
const stat = await
|
|
1690
|
+
const stat = await fs9.stat(filePath);
|
|
1687
1691
|
if (stat.mtime.getTime() > mostRecentTime) {
|
|
1688
1692
|
mostRecentTime = stat.mtime.getTime();
|
|
1689
1693
|
mostRecentFile = filePath;
|
|
@@ -1698,17 +1702,17 @@ var require_usage_reader = __commonJS({
|
|
|
1698
1702
|
async findJsonlFiles(onlyRecent = false) {
|
|
1699
1703
|
const files = [];
|
|
1700
1704
|
try {
|
|
1701
|
-
const projectDirs = await
|
|
1705
|
+
const projectDirs = await fs9.readdir(this.claudeProjectsPath);
|
|
1702
1706
|
for (const projectDir of projectDirs) {
|
|
1703
1707
|
const projectPath = path9.join(this.claudeProjectsPath, projectDir);
|
|
1704
|
-
const stat = await
|
|
1708
|
+
const stat = await fs9.stat(projectPath);
|
|
1705
1709
|
if (stat.isDirectory()) {
|
|
1706
|
-
const projectFiles = await
|
|
1710
|
+
const projectFiles = await fs9.readdir(projectPath);
|
|
1707
1711
|
const jsonlFiles = projectFiles.filter((f) => f.endsWith(".jsonl"));
|
|
1708
1712
|
for (const jsonlFile of jsonlFiles) {
|
|
1709
1713
|
const filePath = path9.join(projectPath, jsonlFile);
|
|
1710
1714
|
if (onlyRecent) {
|
|
1711
|
-
const fileStat = await
|
|
1715
|
+
const fileStat = await fs9.stat(filePath);
|
|
1712
1716
|
const hoursSinceModified = (Date.now() - fileStat.mtime.getTime()) / (1e3 * 60 * 60);
|
|
1713
1717
|
if (hoursSinceModified <= 24) {
|
|
1714
1718
|
files.push(filePath);
|
|
@@ -1727,7 +1731,7 @@ var require_usage_reader = __commonJS({
|
|
|
1727
1731
|
async readJsonlFile(filePath, cutoffTime) {
|
|
1728
1732
|
const entries = [];
|
|
1729
1733
|
const fileProcessedEntries = /* @__PURE__ */ new Set();
|
|
1730
|
-
return new Promise((
|
|
1734
|
+
return new Promise((resolve4) => {
|
|
1731
1735
|
const rl = readline.createInterface({
|
|
1732
1736
|
input: createReadStream(filePath),
|
|
1733
1737
|
crlfDelay: Infinity
|
|
@@ -1785,11 +1789,11 @@ var require_usage_reader = __commonJS({
|
|
|
1785
1789
|
}
|
|
1786
1790
|
});
|
|
1787
1791
|
rl.on("close", () => {
|
|
1788
|
-
|
|
1792
|
+
resolve4(entries);
|
|
1789
1793
|
});
|
|
1790
1794
|
rl.on("error", (error) => {
|
|
1791
1795
|
console.error("Error reading file:", filePath, error);
|
|
1792
|
-
|
|
1796
|
+
resolve4(entries);
|
|
1793
1797
|
});
|
|
1794
1798
|
});
|
|
1795
1799
|
}
|
|
@@ -1871,7 +1875,7 @@ var require_usage_reader = __commonJS({
|
|
|
1871
1875
|
}
|
|
1872
1876
|
const sessionFile = path9.join(this.claudeProjectsPath, path9.basename(process.cwd()).replace(/[^a-zA-Z0-9-]/g, "-"), `${sessionId}.jsonl`);
|
|
1873
1877
|
try {
|
|
1874
|
-
await
|
|
1878
|
+
await fs9.access(sessionFile);
|
|
1875
1879
|
} catch (err2) {
|
|
1876
1880
|
return null;
|
|
1877
1881
|
}
|
|
@@ -2537,7 +2541,7 @@ var require_src = __commonJS({
|
|
|
2537
2541
|
var SessionStore = require_session_store();
|
|
2538
2542
|
var UsageReader = require_usage_reader();
|
|
2539
2543
|
var UsageAnalytics = require_usage_analytics();
|
|
2540
|
-
var
|
|
2544
|
+
var fs9 = require("fs");
|
|
2541
2545
|
function stripAnsi(str) {
|
|
2542
2546
|
return str.replace(/\x1b\[[0-9;]*[a-zA-Z]/g, "").replace(/\x1b\][^\x07]*\x07/g, "").replace(/\x1b[()][AB012]/g, "").replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, "").replace(/\r\n?/g, "\n").trim();
|
|
2543
2547
|
}
|
|
@@ -2795,7 +2799,7 @@ var require_src = __commonJS({
|
|
|
2795
2799
|
return true;
|
|
2796
2800
|
}
|
|
2797
2801
|
try {
|
|
2798
|
-
const items =
|
|
2802
|
+
const items = fs9.readdirSync(validation.path, { withFileTypes: true });
|
|
2799
2803
|
const showHidden = url.searchParams.get("showHidden") === "true";
|
|
2800
2804
|
const folders = items.filter((item) => item.isDirectory()).filter((item) => !item.name.startsWith(".") || showHidden).map((item) => ({
|
|
2801
2805
|
name: item.name,
|
|
@@ -2830,7 +2834,7 @@ var require_src = __commonJS({
|
|
|
2830
2834
|
res.end(JSON.stringify({ error: validation.error }));
|
|
2831
2835
|
return;
|
|
2832
2836
|
}
|
|
2833
|
-
if (!
|
|
2837
|
+
if (!fs9.existsSync(validation.path) || !fs9.statSync(validation.path).isDirectory()) {
|
|
2834
2838
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
2835
2839
|
res.end(JSON.stringify({ error: "Not a valid directory" }));
|
|
2836
2840
|
return;
|
|
@@ -2857,7 +2861,7 @@ var require_src = __commonJS({
|
|
|
2857
2861
|
res.end(JSON.stringify({ error: validation.error }));
|
|
2858
2862
|
return;
|
|
2859
2863
|
}
|
|
2860
|
-
if (!
|
|
2864
|
+
if (!fs9.existsSync(validation.path) || !fs9.statSync(validation.path).isDirectory()) {
|
|
2861
2865
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
2862
2866
|
res.end(JSON.stringify({ error: "Invalid directory path" }));
|
|
2863
2867
|
return;
|
|
@@ -2892,12 +2896,12 @@ var require_src = __commonJS({
|
|
|
2892
2896
|
res.end(JSON.stringify({ message: "Cannot create folder outside the allowed area" }));
|
|
2893
2897
|
return;
|
|
2894
2898
|
}
|
|
2895
|
-
if (
|
|
2899
|
+
if (fs9.existsSync(fullValidation.path)) {
|
|
2896
2900
|
res.writeHead(409, { "Content-Type": "application/json" });
|
|
2897
2901
|
res.end(JSON.stringify({ message: "Folder already exists" }));
|
|
2898
2902
|
return;
|
|
2899
2903
|
}
|
|
2900
|
-
|
|
2904
|
+
fs9.mkdirSync(fullValidation.path, { recursive: true });
|
|
2901
2905
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
2902
2906
|
res.end(JSON.stringify({ success: true, path: fullValidation.path }));
|
|
2903
2907
|
} catch (e) {
|
|
@@ -2923,7 +2927,7 @@ var require_src = __commonJS({
|
|
|
2923
2927
|
if (!filePath || filePath === "") filePath = "index.html";
|
|
2924
2928
|
const fullPath = path9.join(__dirname, "public", filePath);
|
|
2925
2929
|
try {
|
|
2926
|
-
if (!
|
|
2930
|
+
if (!fs9.existsSync(fullPath)) return false;
|
|
2927
2931
|
const ext = path9.extname(fullPath);
|
|
2928
2932
|
const mimeTypes = {
|
|
2929
2933
|
".html": "text/html",
|
|
@@ -2935,7 +2939,7 @@ var require_src = __commonJS({
|
|
|
2935
2939
|
".ico": "image/x-icon"
|
|
2936
2940
|
};
|
|
2937
2941
|
const mime = mimeTypes[ext] || "application/octet-stream";
|
|
2938
|
-
const content =
|
|
2942
|
+
const content = fs9.readFileSync(fullPath);
|
|
2939
2943
|
res.writeHead(200, { "Content-Type": mime });
|
|
2940
2944
|
res.end(content);
|
|
2941
2945
|
return true;
|
|
@@ -3587,7 +3591,7 @@ var require_src = __commonJS({
|
|
|
3587
3591
|
if (session.active) throw new Error(`Agent already running in session ${sessionId}`);
|
|
3588
3592
|
const { command, args = [], env = {} } = options;
|
|
3589
3593
|
if (!command) throw new Error("startScriptInSession requires a command");
|
|
3590
|
-
return new Promise((
|
|
3594
|
+
return new Promise((resolve4, reject) => {
|
|
3591
3595
|
this.scriptBridge.startSession(sessionId, {
|
|
3592
3596
|
command,
|
|
3593
3597
|
args,
|
|
@@ -3609,7 +3613,7 @@ var require_src = __commonJS({
|
|
|
3609
3613
|
session.lastActivity = /* @__PURE__ */ new Date();
|
|
3610
3614
|
this.broadcastToSession(sessionId, { type: "script_stopped", sessionId });
|
|
3611
3615
|
if (exitCode === 0) {
|
|
3612
|
-
|
|
3616
|
+
resolve4({ code: exitCode, signal });
|
|
3613
3617
|
} else {
|
|
3614
3618
|
reject(new Error(`Script exited with code ${exitCode}`));
|
|
3615
3619
|
}
|
|
@@ -3761,15 +3765,15 @@ function getQuery(name) {
|
|
|
3761
3765
|
ensureInit();
|
|
3762
3766
|
const cached = queryCache.get(name);
|
|
3763
3767
|
if (cached) return cached;
|
|
3764
|
-
const scmPath = (0,
|
|
3765
|
-
const scm = (0,
|
|
3768
|
+
const scmPath = (0, import_node_path4.join)(queriesDir, `${name}.scm`);
|
|
3769
|
+
const scm = (0, import_node_fs4.readFileSync)(scmPath, "utf-8");
|
|
3766
3770
|
const query = tsxLanguage.query(scm);
|
|
3767
3771
|
queryCache.set(name, query);
|
|
3768
3772
|
return query;
|
|
3769
3773
|
}
|
|
3770
3774
|
function parseSource(absPath) {
|
|
3771
3775
|
ensureInit();
|
|
3772
|
-
const content = (0,
|
|
3776
|
+
const content = (0, import_node_fs4.readFileSync)(absPath, "utf-8");
|
|
3773
3777
|
return parserInstance.parse(content);
|
|
3774
3778
|
}
|
|
3775
3779
|
function parseCodeTS(code) {
|
|
@@ -4234,17 +4238,17 @@ function extractDeep(absPath) {
|
|
|
4234
4238
|
}
|
|
4235
4239
|
return { elements, stateVars, conditions, variables, responses, params };
|
|
4236
4240
|
}
|
|
4237
|
-
var
|
|
4241
|
+
var import_node_fs4, import_node_path4, tsxLanguage, parserInstance, initPromise, initialized, queriesDir, queryCache, PRISMA_MUTATION_METHODS_BUILTIN, DB_IDENTIFIERS_FALLBACK, extraDbIdentifiers, extraMutationMethods;
|
|
4238
4242
|
var init_ts_extractor = __esm({
|
|
4239
4243
|
"src/server/graph/core/ts-extractor.ts"() {
|
|
4240
4244
|
"use strict";
|
|
4241
|
-
|
|
4242
|
-
|
|
4245
|
+
import_node_fs4 = require("node:fs");
|
|
4246
|
+
import_node_path4 = require("node:path");
|
|
4243
4247
|
initialized = false;
|
|
4244
4248
|
queriesDir = (() => {
|
|
4245
|
-
const srcPath = (0,
|
|
4249
|
+
const srcPath = (0, import_node_path4.join)((0, import_node_path4.dirname)(__filename), "..", "queries");
|
|
4246
4250
|
if (require("fs").existsSync(srcPath)) return srcPath;
|
|
4247
|
-
return (0,
|
|
4251
|
+
return (0, import_node_path4.join)((0, import_node_path4.dirname)(__filename), "graph", "queries");
|
|
4248
4252
|
})();
|
|
4249
4253
|
queryCache = /* @__PURE__ */ new Map();
|
|
4250
4254
|
PRISMA_MUTATION_METHODS_BUILTIN = [
|
|
@@ -4632,7 +4636,7 @@ var NodeTriggerController = class {
|
|
|
4632
4636
|
this.workingDir = opts.workingDir;
|
|
4633
4637
|
this.maxConcurrent = opts.maxConcurrent ?? 1;
|
|
4634
4638
|
this.agentMap = /* @__PURE__ */ new Map();
|
|
4635
|
-
for (const ag of opts.graphData.
|
|
4639
|
+
for (const ag of opts.graphData.nd) {
|
|
4636
4640
|
this.agentMap.set(ag.id, ag);
|
|
4637
4641
|
}
|
|
4638
4642
|
}
|
|
@@ -4649,7 +4653,7 @@ var NodeTriggerController = class {
|
|
|
4649
4653
|
for (const change of changes) {
|
|
4650
4654
|
const agent = this.agentMap.get(change.agentId);
|
|
4651
4655
|
if (!agent) continue;
|
|
4652
|
-
if (agent.
|
|
4656
|
+
if (agent.tp === "script_pod" && change.newStatus === "in_progress") {
|
|
4653
4657
|
if (agent.gr === "per_unit" && !change.unitId) continue;
|
|
4654
4658
|
if (agent.gr !== "per_unit" && change.unitId) continue;
|
|
4655
4659
|
const executor = this.podExecutors.get(change.agentId);
|
|
@@ -4662,8 +4666,8 @@ var NodeTriggerController = class {
|
|
|
4662
4666
|
}
|
|
4663
4667
|
continue;
|
|
4664
4668
|
}
|
|
4665
|
-
if (agent.
|
|
4666
|
-
if (agent.
|
|
4669
|
+
if (agent.tp === "script") continue;
|
|
4670
|
+
if (agent.tp !== "llm") continue;
|
|
4667
4671
|
if (agent.gr === "per_unit") {
|
|
4668
4672
|
if (!change.unitId) continue;
|
|
4669
4673
|
} else {
|
|
@@ -4797,8 +4801,27 @@ var NodeTriggerController = class {
|
|
|
4797
4801
|
|
|
4798
4802
|
// src/server/adapters/claude-terminal-adapter.ts
|
|
4799
4803
|
var ClaudeTerminalAdapter = class {
|
|
4800
|
-
constructor() {
|
|
4804
|
+
constructor(opts = {}) {
|
|
4801
4805
|
this.activeSessions = /* @__PURE__ */ new Set();
|
|
4806
|
+
if (opts.mcpServers) {
|
|
4807
|
+
const { token, serverUrl } = opts.mcpServers;
|
|
4808
|
+
this.mcpConfigJson = JSON.stringify({
|
|
4809
|
+
mcpServers: {
|
|
4810
|
+
"launch-pod": {
|
|
4811
|
+
type: "http",
|
|
4812
|
+
url: `${serverUrl}/api/mcp/pipeline`,
|
|
4813
|
+
headers: { Authorization: `Bearer ${token}` }
|
|
4814
|
+
},
|
|
4815
|
+
"launch-chart": {
|
|
4816
|
+
command: "launch-chart",
|
|
4817
|
+
args: []
|
|
4818
|
+
}
|
|
4819
|
+
}
|
|
4820
|
+
});
|
|
4821
|
+
this.strictMcp = true;
|
|
4822
|
+
} else {
|
|
4823
|
+
this.strictMcp = false;
|
|
4824
|
+
}
|
|
4802
4825
|
}
|
|
4803
4826
|
async start(config) {
|
|
4804
4827
|
const sessionName = `Agent: ${config.agentId}${config.unitId ? ` [${config.unitId}]` : ""}`;
|
|
@@ -4809,7 +4832,8 @@ var ClaudeTerminalAdapter = class {
|
|
|
4809
4832
|
await startClaudeInSession(sessionId, {
|
|
4810
4833
|
dangerouslySkipPermissions: true,
|
|
4811
4834
|
appendSystemPrompt: config.prompt,
|
|
4812
|
-
initialPrompt: "Begin."
|
|
4835
|
+
initialPrompt: "Begin.",
|
|
4836
|
+
...this.mcpConfigJson ? { mcpConfig: this.mcpConfigJson, strictMcpConfig: this.strictMcp } : {}
|
|
4813
4837
|
});
|
|
4814
4838
|
this.activeSessions.add(sessionId);
|
|
4815
4839
|
return sessionId;
|
|
@@ -5884,7 +5908,7 @@ var PostImplLaunchExecutor = class {
|
|
|
5884
5908
|
return 3001;
|
|
5885
5909
|
}
|
|
5886
5910
|
startDevServer(port, databaseUrl) {
|
|
5887
|
-
return new Promise((
|
|
5911
|
+
return new Promise((resolve4) => {
|
|
5888
5912
|
const env = { ...process.env, PORT: String(port), ...databaseUrl ? { DATABASE_URL: databaseUrl } : {} };
|
|
5889
5913
|
this.devProcess = (0, import_child_process3.spawn)("npm", ["run", "dev"], {
|
|
5890
5914
|
cwd: this.workingDir,
|
|
@@ -5896,7 +5920,7 @@ var PostImplLaunchExecutor = class {
|
|
|
5896
5920
|
const timeout = setTimeout(() => {
|
|
5897
5921
|
if (!resolved) {
|
|
5898
5922
|
resolved = true;
|
|
5899
|
-
this.healthCheck(port).then(
|
|
5923
|
+
this.healthCheck(port).then(resolve4);
|
|
5900
5924
|
}
|
|
5901
5925
|
}, 15e3);
|
|
5902
5926
|
const onData = (data) => {
|
|
@@ -5905,7 +5929,7 @@ var PostImplLaunchExecutor = class {
|
|
|
5905
5929
|
if (!resolved) {
|
|
5906
5930
|
resolved = true;
|
|
5907
5931
|
clearTimeout(timeout);
|
|
5908
|
-
|
|
5932
|
+
resolve4(true);
|
|
5909
5933
|
}
|
|
5910
5934
|
}
|
|
5911
5935
|
};
|
|
@@ -5916,7 +5940,7 @@ var PostImplLaunchExecutor = class {
|
|
|
5916
5940
|
if (!resolved) {
|
|
5917
5941
|
resolved = true;
|
|
5918
5942
|
clearTimeout(timeout);
|
|
5919
|
-
|
|
5943
|
+
resolve4(false);
|
|
5920
5944
|
}
|
|
5921
5945
|
});
|
|
5922
5946
|
this.devProcess.unref();
|
|
@@ -6938,11 +6962,11 @@ ${links}
|
|
|
6938
6962
|
}
|
|
6939
6963
|
|
|
6940
6964
|
// src/server/graph/index.ts
|
|
6941
|
-
var
|
|
6965
|
+
var import_node_fs15 = require("node:fs");
|
|
6942
6966
|
var import_node_path16 = require("node:path");
|
|
6943
6967
|
|
|
6944
6968
|
// src/server/graph/core/graph-builder.ts
|
|
6945
|
-
var
|
|
6969
|
+
var import_node_fs12 = require("node:fs");
|
|
6946
6970
|
var import_node_path12 = require("node:path");
|
|
6947
6971
|
init_config();
|
|
6948
6972
|
|
|
@@ -6950,36 +6974,243 @@ init_config();
|
|
|
6950
6974
|
var import_node_path11 = require("node:path");
|
|
6951
6975
|
|
|
6952
6976
|
// src/server/graph/parsers/ts/typescript-project.ts
|
|
6953
|
-
var
|
|
6954
|
-
var
|
|
6977
|
+
var import_node_fs5 = require("node:fs");
|
|
6978
|
+
var import_node_path5 = require("node:path");
|
|
6955
6979
|
init_config();
|
|
6956
6980
|
|
|
6957
6981
|
// src/server/graph/core/resolve-paths.ts
|
|
6982
|
+
var import_node_fs3 = require("node:fs");
|
|
6983
|
+
var import_node_path3 = require("node:path");
|
|
6984
|
+
|
|
6985
|
+
// src/server/graph/core/walk.ts
|
|
6958
6986
|
var import_node_fs2 = require("node:fs");
|
|
6959
6987
|
var import_node_path2 = require("node:path");
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6988
|
+
var DEFAULT_IGNORE_DIRS = /* @__PURE__ */ new Set([
|
|
6989
|
+
"node_modules",
|
|
6990
|
+
".git",
|
|
6991
|
+
".next",
|
|
6992
|
+
".launchsecure",
|
|
6993
|
+
".claude",
|
|
6994
|
+
"dist",
|
|
6995
|
+
"build",
|
|
6996
|
+
"out",
|
|
6997
|
+
".turbo",
|
|
6998
|
+
".vercel",
|
|
6999
|
+
"coverage"
|
|
7000
|
+
]);
|
|
7001
|
+
function walk(dir, exts) {
|
|
7002
|
+
const results = [];
|
|
7003
|
+
if (!(0, import_node_fs2.existsSync)(dir)) return results;
|
|
7004
|
+
for (const entry of (0, import_node_fs2.readdirSync)(dir, { withFileTypes: true })) {
|
|
7005
|
+
const full = (0, import_node_path2.join)(dir, entry.name);
|
|
7006
|
+
if (entry.isDirectory()) {
|
|
7007
|
+
results.push(...walk(full, exts));
|
|
7008
|
+
} else if (exts.includes((0, import_node_path2.extname)(entry.name))) {
|
|
7009
|
+
results.push(full);
|
|
7010
|
+
}
|
|
7011
|
+
}
|
|
7012
|
+
return results;
|
|
6965
7013
|
}
|
|
6966
|
-
function
|
|
6967
|
-
const
|
|
6968
|
-
if (
|
|
6969
|
-
|
|
6970
|
-
|
|
6971
|
-
|
|
7014
|
+
function walkWithIgnore(dir, exts, opts = {}) {
|
|
7015
|
+
const results = [];
|
|
7016
|
+
if (!(0, import_node_fs2.existsSync)(dir)) return results;
|
|
7017
|
+
const skip = opts.extraIgnore ? /* @__PURE__ */ new Set([...DEFAULT_IGNORE_DIRS, ...opts.extraIgnore]) : DEFAULT_IGNORE_DIRS;
|
|
7018
|
+
for (const entry of (0, import_node_fs2.readdirSync)(dir, { withFileTypes: true })) {
|
|
7019
|
+
if (entry.isDirectory()) {
|
|
7020
|
+
if (skip.has(entry.name)) continue;
|
|
7021
|
+
results.push(...walkWithIgnore((0, import_node_path2.join)(dir, entry.name), exts, opts));
|
|
7022
|
+
} else if (exts.includes((0, import_node_path2.extname)(entry.name))) {
|
|
7023
|
+
results.push((0, import_node_path2.join)(dir, entry.name));
|
|
7024
|
+
}
|
|
7025
|
+
}
|
|
7026
|
+
return results;
|
|
7027
|
+
}
|
|
7028
|
+
|
|
7029
|
+
// src/server/graph/core/resolve-paths.ts
|
|
7030
|
+
function hasSqlFiles(dir) {
|
|
7031
|
+
if (!(0, import_node_fs3.existsSync)(dir)) return false;
|
|
7032
|
+
try {
|
|
7033
|
+
return (0, import_node_fs3.readdirSync)(dir, { withFileTypes: true }).some(
|
|
7034
|
+
(e) => e.isFile() && e.name.endsWith(".sql")
|
|
7035
|
+
);
|
|
7036
|
+
} catch {
|
|
7037
|
+
return false;
|
|
7038
|
+
}
|
|
7039
|
+
}
|
|
7040
|
+
function hasNestedMigrationSql(dir) {
|
|
7041
|
+
if (!(0, import_node_fs3.existsSync)(dir)) return false;
|
|
7042
|
+
try {
|
|
7043
|
+
return (0, import_node_fs3.readdirSync)(dir, { withFileTypes: true }).some(
|
|
7044
|
+
(e) => e.isDirectory() && (0, import_node_fs3.existsSync)((0, import_node_path3.join)(dir, e.name, "migration.sql"))
|
|
7045
|
+
);
|
|
7046
|
+
} catch {
|
|
7047
|
+
return false;
|
|
7048
|
+
}
|
|
7049
|
+
}
|
|
7050
|
+
function resolveDbFromDir(dir) {
|
|
7051
|
+
if (!(0, import_node_fs3.existsSync)(dir)) return { kind: "none", schemaPath: null, migrationsDir: null };
|
|
7052
|
+
const schemaPath = (0, import_node_path3.join)(dir, "schema.prisma");
|
|
7053
|
+
if ((0, import_node_fs3.existsSync)(schemaPath)) {
|
|
7054
|
+
const migrationsDir2 = (0, import_node_path3.join)(dir, "migrations");
|
|
7055
|
+
return {
|
|
7056
|
+
kind: "prisma",
|
|
7057
|
+
schemaPath,
|
|
7058
|
+
migrationsDir: (0, import_node_fs3.existsSync)(migrationsDir2) ? migrationsDir2 : null
|
|
7059
|
+
};
|
|
7060
|
+
}
|
|
7061
|
+
const migrationsDir = (0, import_node_path3.join)(dir, "migrations");
|
|
7062
|
+
if (hasSqlFiles(migrationsDir) || hasNestedMigrationSql(migrationsDir)) {
|
|
7063
|
+
return { kind: "sql-migrations", migrationsDir, schemaPath: null };
|
|
6972
7064
|
}
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
return { srcDir: (0, import_node_path2.join)(rootDir, "src"), appDir: srcApp, apiDir: (0, import_node_path2.join)(srcApp, "api"), dbDir };
|
|
7065
|
+
if (hasSqlFiles(dir) || hasNestedMigrationSql(dir)) {
|
|
7066
|
+
return { kind: "sql-migrations", migrationsDir: dir, schemaPath: null };
|
|
6976
7067
|
}
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
7068
|
+
return { kind: "none", schemaPath: null, migrationsDir: null };
|
|
7069
|
+
}
|
|
7070
|
+
function detectDbConfig(rootDir, config) {
|
|
7071
|
+
if (config.paths?.dbDir) {
|
|
7072
|
+
return resolveDbFromDir((0, import_node_path3.join)(rootDir, config.paths.dbDir));
|
|
6980
7073
|
}
|
|
7074
|
+
const candidates = ["prisma", "supabase", "drizzle", (0, import_node_path3.join)("db", "migrations"), "migrations"];
|
|
7075
|
+
for (const c of candidates) {
|
|
7076
|
+
const dir = (0, import_node_path3.join)(rootDir, c);
|
|
7077
|
+
const resolved = resolveDbFromDir(dir);
|
|
7078
|
+
if (resolved.kind !== "none") return resolved;
|
|
7079
|
+
}
|
|
7080
|
+
return { kind: "none", schemaPath: null, migrationsDir: null };
|
|
7081
|
+
}
|
|
7082
|
+
function detectDbDir(rootDir, config, dbConfig) {
|
|
7083
|
+
if (config.paths?.dbDir) return (0, import_node_path3.join)(rootDir, config.paths.dbDir);
|
|
7084
|
+
if (dbConfig.kind === "prisma") return (0, import_node_path3.dirname)(dbConfig.schemaPath);
|
|
7085
|
+
if (dbConfig.kind === "sql-migrations") return dbConfig.migrationsDir;
|
|
6981
7086
|
return null;
|
|
6982
7087
|
}
|
|
7088
|
+
var NON_SOURCE_DIRS = /* @__PURE__ */ new Set([
|
|
7089
|
+
...DEFAULT_IGNORE_DIRS,
|
|
7090
|
+
// DB conventions (handled by db parsers)
|
|
7091
|
+
"prisma",
|
|
7092
|
+
"supabase",
|
|
7093
|
+
"drizzle",
|
|
7094
|
+
"migrations",
|
|
7095
|
+
// Web assets
|
|
7096
|
+
"public",
|
|
7097
|
+
"static",
|
|
7098
|
+
"assets",
|
|
7099
|
+
// Docs
|
|
7100
|
+
"docs",
|
|
7101
|
+
"documentation",
|
|
7102
|
+
// Test dirs (project tests aren't part of the structural graph)
|
|
7103
|
+
"tests",
|
|
7104
|
+
"__tests__",
|
|
7105
|
+
"e2e",
|
|
7106
|
+
"playwright",
|
|
7107
|
+
"cypress",
|
|
7108
|
+
// Monorepo workspace roots — separate graph projects per .launchchart.json
|
|
7109
|
+
"packages",
|
|
7110
|
+
"apps",
|
|
7111
|
+
"services",
|
|
7112
|
+
"libs"
|
|
7113
|
+
]);
|
|
7114
|
+
function dirHasTSFiles(dir) {
|
|
7115
|
+
if (!(0, import_node_fs3.existsSync)(dir)) return false;
|
|
7116
|
+
try {
|
|
7117
|
+
const stack = [dir];
|
|
7118
|
+
while (stack.length > 0) {
|
|
7119
|
+
const cur = stack.pop();
|
|
7120
|
+
const entries = (0, import_node_fs3.readdirSync)(cur, { withFileTypes: true });
|
|
7121
|
+
for (const e of entries) {
|
|
7122
|
+
if (e.isFile() && (e.name.endsWith(".ts") || e.name.endsWith(".tsx"))) return true;
|
|
7123
|
+
if (e.isDirectory() && !e.name.startsWith(".") && !DEFAULT_IGNORE_DIRS.has(e.name)) {
|
|
7124
|
+
stack.push((0, import_node_path3.join)(cur, e.name));
|
|
7125
|
+
}
|
|
7126
|
+
}
|
|
7127
|
+
}
|
|
7128
|
+
} catch {
|
|
7129
|
+
}
|
|
7130
|
+
return false;
|
|
7131
|
+
}
|
|
7132
|
+
function collectCodeBearingChildren(dir, extraSkip) {
|
|
7133
|
+
if (!(0, import_node_fs3.existsSync)(dir)) return [];
|
|
7134
|
+
const out = [];
|
|
7135
|
+
try {
|
|
7136
|
+
for (const entry of (0, import_node_fs3.readdirSync)(dir, { withFileTypes: true })) {
|
|
7137
|
+
if (!entry.isDirectory()) continue;
|
|
7138
|
+
if (entry.name.startsWith(".")) continue;
|
|
7139
|
+
if (NON_SOURCE_DIRS.has(entry.name)) continue;
|
|
7140
|
+
if (extraSkip?.has(entry.name)) continue;
|
|
7141
|
+
const full = (0, import_node_path3.join)(dir, entry.name);
|
|
7142
|
+
if (dirHasTSFiles(full)) out.push(full);
|
|
7143
|
+
}
|
|
7144
|
+
} catch {
|
|
7145
|
+
}
|
|
7146
|
+
return out;
|
|
7147
|
+
}
|
|
7148
|
+
function detectSrcRoots(rootDir, srcDir, appDir, config) {
|
|
7149
|
+
if (config.paths?.srcRoots && config.paths.srcRoots.length > 0) {
|
|
7150
|
+
const roots2 = /* @__PURE__ */ new Set();
|
|
7151
|
+
roots2.add(appDir);
|
|
7152
|
+
for (const r of config.paths.srcRoots) {
|
|
7153
|
+
const abs = (0, import_node_path3.isAbsolute)(r) ? r : (0, import_node_path3.resolve)(rootDir, r);
|
|
7154
|
+
roots2.add(abs);
|
|
7155
|
+
}
|
|
7156
|
+
return [...roots2];
|
|
7157
|
+
}
|
|
7158
|
+
const roots = /* @__PURE__ */ new Set();
|
|
7159
|
+
roots.add(appDir);
|
|
7160
|
+
for (const c of collectCodeBearingChildren(srcDir)) roots.add(c);
|
|
7161
|
+
if (srcDir !== rootDir) {
|
|
7162
|
+
const skipSrcWrapper = /* @__PURE__ */ new Set([(0, import_node_path3.basename)(srcDir)]);
|
|
7163
|
+
for (const c of collectCodeBearingChildren(rootDir, skipSrcWrapper)) roots.add(c);
|
|
7164
|
+
}
|
|
7165
|
+
return [...roots];
|
|
7166
|
+
}
|
|
7167
|
+
var CONVENTION_NAMES = ["middleware.ts", "middleware.tsx", "instrumentation.ts", "instrumentation.tsx"];
|
|
7168
|
+
function detectConventionFiles(rootDir, srcDir) {
|
|
7169
|
+
const out = [];
|
|
7170
|
+
const seen = /* @__PURE__ */ new Set();
|
|
7171
|
+
const dirs = srcDir === rootDir ? [rootDir] : [srcDir, rootDir];
|
|
7172
|
+
for (const dir of dirs) {
|
|
7173
|
+
for (const name of CONVENTION_NAMES) {
|
|
7174
|
+
const full = (0, import_node_path3.join)(dir, name);
|
|
7175
|
+
if (!seen.has(full) && (0, import_node_fs3.existsSync)(full)) {
|
|
7176
|
+
try {
|
|
7177
|
+
if ((0, import_node_fs3.statSync)(full).isFile()) {
|
|
7178
|
+
seen.add(full);
|
|
7179
|
+
out.push(full);
|
|
7180
|
+
}
|
|
7181
|
+
} catch {
|
|
7182
|
+
}
|
|
7183
|
+
}
|
|
7184
|
+
}
|
|
7185
|
+
}
|
|
7186
|
+
return out;
|
|
7187
|
+
}
|
|
7188
|
+
function resolveProjectPaths(rootDir, config) {
|
|
7189
|
+
let srcDir;
|
|
7190
|
+
let appDir;
|
|
7191
|
+
if (config.paths?.appDir) {
|
|
7192
|
+
appDir = (0, import_node_path3.join)(rootDir, config.paths.appDir);
|
|
7193
|
+
srcDir = config.paths.srcDir ? (0, import_node_path3.join)(rootDir, config.paths.srcDir) : (0, import_node_path3.dirname)(appDir);
|
|
7194
|
+
} else {
|
|
7195
|
+
const srcApp = (0, import_node_path3.join)(rootDir, "src", "app");
|
|
7196
|
+
const rootApp = (0, import_node_path3.join)(rootDir, "app");
|
|
7197
|
+
if ((0, import_node_fs3.existsSync)(srcApp)) {
|
|
7198
|
+
srcDir = (0, import_node_path3.join)(rootDir, "src");
|
|
7199
|
+
appDir = srcApp;
|
|
7200
|
+
} else if ((0, import_node_fs3.existsSync)(rootApp)) {
|
|
7201
|
+
srcDir = rootDir;
|
|
7202
|
+
appDir = rootApp;
|
|
7203
|
+
} else {
|
|
7204
|
+
return null;
|
|
7205
|
+
}
|
|
7206
|
+
}
|
|
7207
|
+
const apiDir = (0, import_node_path3.join)(appDir, "api");
|
|
7208
|
+
const dbConfig = detectDbConfig(rootDir, config);
|
|
7209
|
+
const dbDir = detectDbDir(rootDir, config, dbConfig);
|
|
7210
|
+
const srcRoots = detectSrcRoots(rootDir, srcDir, appDir, config);
|
|
7211
|
+
const conventionFiles = detectConventionFiles(rootDir, srcDir);
|
|
7212
|
+
return { srcDir, appDir, apiDir, dbDir, srcRoots, conventionFiles, dbConfig };
|
|
7213
|
+
}
|
|
6983
7214
|
|
|
6984
7215
|
// src/server/graph/parsers/ts/typescript-project.ts
|
|
6985
7216
|
init_ts_extractor();
|
|
@@ -6997,48 +7228,26 @@ var CLASSIFICATION_TO_LAYER = {
|
|
|
6997
7228
|
"mcp-tool": "ui",
|
|
6998
7229
|
external: "ui"
|
|
6999
7230
|
};
|
|
7000
|
-
function
|
|
7001
|
-
const
|
|
7002
|
-
if (
|
|
7003
|
-
|
|
7004
|
-
const full = (0, import_node_path4.join)(dir, entry.name);
|
|
7005
|
-
if (entry.isDirectory()) {
|
|
7006
|
-
results.push(...walk(full, exts));
|
|
7007
|
-
} else if (exts.includes((0, import_node_path4.extname)(entry.name))) {
|
|
7008
|
-
results.push(full);
|
|
7009
|
-
}
|
|
7010
|
-
}
|
|
7011
|
-
return results;
|
|
7012
|
-
}
|
|
7013
|
-
function walkWithIgnore(dir, exts, ignoreDirs) {
|
|
7014
|
-
const results = [];
|
|
7015
|
-
if (!(0, import_node_fs4.existsSync)(dir)) return results;
|
|
7016
|
-
for (const entry of (0, import_node_fs4.readdirSync)(dir, { withFileTypes: true })) {
|
|
7017
|
-
if (entry.isDirectory()) {
|
|
7018
|
-
if (ignoreDirs.has(entry.name)) continue;
|
|
7019
|
-
results.push(...walkWithIgnore((0, import_node_path4.join)(dir, entry.name), exts, ignoreDirs));
|
|
7020
|
-
} else if (exts.includes((0, import_node_path4.extname)(entry.name))) {
|
|
7021
|
-
results.push((0, import_node_path4.join)(dir, entry.name));
|
|
7022
|
-
}
|
|
7231
|
+
function toNodeId(srcDir, rootDir, absPath) {
|
|
7232
|
+
const relFromSrc = (0, import_node_path5.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
7233
|
+
if (relFromSrc.startsWith("..")) {
|
|
7234
|
+
return (0, import_node_path5.relative)(rootDir, absPath).replace(/\\/g, "/");
|
|
7023
7235
|
}
|
|
7024
|
-
return
|
|
7025
|
-
}
|
|
7026
|
-
function toNodeId(srcDir, absPath) {
|
|
7027
|
-
return (0, import_node_path4.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
7236
|
+
return relFromSrc;
|
|
7028
7237
|
}
|
|
7029
7238
|
function resolveImport(srcDir, specifier) {
|
|
7030
7239
|
if (!specifier.startsWith("@/")) return null;
|
|
7031
7240
|
const rel = specifier.slice(2);
|
|
7032
|
-
const base = (0,
|
|
7033
|
-
for (const c of [base, base + ".ts", base + ".tsx", (0,
|
|
7034
|
-
if ((0,
|
|
7241
|
+
const base = (0, import_node_path5.join)(srcDir, rel);
|
|
7242
|
+
for (const c of [base, base + ".ts", base + ".tsx", (0, import_node_path5.join)(base, "index.ts"), (0, import_node_path5.join)(base, "index.tsx")]) {
|
|
7243
|
+
if ((0, import_node_fs5.existsSync)(c) && (0, import_node_fs5.statSync)(c).isFile()) return c;
|
|
7035
7244
|
}
|
|
7036
7245
|
return null;
|
|
7037
7246
|
}
|
|
7038
7247
|
function resolveRelativeImport(fromFile, specifier) {
|
|
7039
|
-
const base = (0,
|
|
7040
|
-
for (const c of [base, base + ".ts", base + ".tsx", (0,
|
|
7041
|
-
if ((0,
|
|
7248
|
+
const base = (0, import_node_path5.join)((0, import_node_path5.dirname)(fromFile), specifier);
|
|
7249
|
+
for (const c of [base, base + ".ts", base + ".tsx", (0, import_node_path5.join)(base, "index.ts"), (0, import_node_path5.join)(base, "index.tsx")]) {
|
|
7250
|
+
if ((0, import_node_fs5.existsSync)(c) && (0, import_node_fs5.statSync)(c).isFile()) return c;
|
|
7042
7251
|
}
|
|
7043
7252
|
return null;
|
|
7044
7253
|
}
|
|
@@ -7059,7 +7268,7 @@ function resolveBarrelMap(barrelAbsPath, parsedByPath, memo, visiting) {
|
|
|
7059
7268
|
const resolved = resolveRelativeImport(barrelAbsPath, re.from);
|
|
7060
7269
|
if (!resolved) continue;
|
|
7061
7270
|
if (re.isWildcard) {
|
|
7062
|
-
const targetBn = (0,
|
|
7271
|
+
const targetBn = (0, import_node_path5.basename)(resolved);
|
|
7063
7272
|
const targetIsBarrel = targetBn === "index.ts" || targetBn === "index.tsx";
|
|
7064
7273
|
if (targetIsBarrel) {
|
|
7065
7274
|
const nested = resolveBarrelMap(resolved, parsedByPath, memo, visiting);
|
|
@@ -7086,12 +7295,12 @@ function buildAllBarrelMaps(srcDir, parsedByPath) {
|
|
|
7086
7295
|
const barrels = /* @__PURE__ */ new Map();
|
|
7087
7296
|
const memo = /* @__PURE__ */ new Map();
|
|
7088
7297
|
for (const [absPath, parsed] of parsedByPath) {
|
|
7089
|
-
const bn = (0,
|
|
7298
|
+
const bn = (0, import_node_path5.basename)(absPath);
|
|
7090
7299
|
if (bn !== "index.ts" && bn !== "index.tsx") continue;
|
|
7091
7300
|
if (parsed.reExports.length === 0) continue;
|
|
7092
7301
|
const map = resolveBarrelMap(absPath, parsedByPath, memo, /* @__PURE__ */ new Set());
|
|
7093
7302
|
if (map.size > 0) {
|
|
7094
|
-
const barrelId = (0,
|
|
7303
|
+
const barrelId = (0, import_node_path5.relative)(srcDir, (0, import_node_path5.dirname)(absPath)).replace(/\\/g, "/");
|
|
7095
7304
|
barrels.set(barrelId, map);
|
|
7096
7305
|
}
|
|
7097
7306
|
}
|
|
@@ -7112,14 +7321,15 @@ function extractRoute(id) {
|
|
|
7112
7321
|
return route || "/";
|
|
7113
7322
|
}
|
|
7114
7323
|
function nameFromFilename(absPath) {
|
|
7115
|
-
return (0,
|
|
7324
|
+
return (0, import_node_path5.basename)(absPath, (0, import_node_path5.extname)(absPath)).replace(/[-_](\w)/g, (_, c) => c.toUpperCase()).replace(/^(\w)/, (_, c) => c.toUpperCase());
|
|
7116
7325
|
}
|
|
7117
|
-
function
|
|
7118
|
-
let route = "/" + (0,
|
|
7326
|
+
function filePathToAppRoute(appDir, absPath) {
|
|
7327
|
+
let route = ("/" + (0, import_node_path5.relative)(appDir, absPath).replace(/\\/g, "/")).replace(/\/route\.tsx?$/, "");
|
|
7328
|
+
route = route.replace(/\/\([^)]+\)/g, "");
|
|
7329
|
+
route = route.replace(/\[\.\.\.([^\]]+)\]/g, "*$1");
|
|
7119
7330
|
route = route.replace(/\[([^\]]+)\]/g, ":$1");
|
|
7120
7331
|
route = route.replace(/\/+/g, "/");
|
|
7121
|
-
|
|
7122
|
-
return "/api" + route;
|
|
7332
|
+
return route === "" ? "/" : route;
|
|
7123
7333
|
}
|
|
7124
7334
|
function camelToPascal(s) {
|
|
7125
7335
|
if (!s) return s;
|
|
@@ -7204,7 +7414,7 @@ function matchRouteToPage(route, routeToNodeId) {
|
|
|
7204
7414
|
if (routeToNodeId.has(normalized)) return routeToNodeId.get(normalized);
|
|
7205
7415
|
return null;
|
|
7206
7416
|
}
|
|
7207
|
-
function extractEdges(srcDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps, routeToNodeId) {
|
|
7417
|
+
function extractEdges(srcDir, rootDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps, routeToNodeId) {
|
|
7208
7418
|
const edges = [];
|
|
7209
7419
|
const flagged = [];
|
|
7210
7420
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -7232,7 +7442,7 @@ function extractEdges(srcDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps,
|
|
|
7232
7442
|
for (const name of names) {
|
|
7233
7443
|
const targetAbs = barrelMap.get(name);
|
|
7234
7444
|
if (targetAbs) {
|
|
7235
|
-
const targetId = toNodeId(srcDir, targetAbs);
|
|
7445
|
+
const targetId = toNodeId(srcDir, rootDir, targetAbs);
|
|
7236
7446
|
if (nodeIdSet.has(targetId)) {
|
|
7237
7447
|
if (!byTarget.has(targetId)) byTarget.set(targetId, []);
|
|
7238
7448
|
byTarget.get(targetId).push(name);
|
|
@@ -7246,7 +7456,7 @@ function extractEdges(srcDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps,
|
|
|
7246
7456
|
} else {
|
|
7247
7457
|
const resolved = resolveImport(srcDir, specifier);
|
|
7248
7458
|
if (resolved) {
|
|
7249
|
-
const targetId = toNodeId(srcDir, resolved);
|
|
7459
|
+
const targetId = toNodeId(srcDir, rootDir, resolved);
|
|
7250
7460
|
if (nodeIdSet.has(targetId) && !targetId.endsWith("/index.ts") && !targetId.endsWith("/index.tsx")) {
|
|
7251
7461
|
addEdge(targetId, edgeTypeFor(isTypeOnly, names));
|
|
7252
7462
|
}
|
|
@@ -7255,7 +7465,7 @@ function extractEdges(srcDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps,
|
|
|
7255
7465
|
} else if (specifier.startsWith(".")) {
|
|
7256
7466
|
const resolved = resolveRelativeImport(absPath, specifier);
|
|
7257
7467
|
if (resolved) {
|
|
7258
|
-
const targetId = toNodeId(srcDir, resolved);
|
|
7468
|
+
const targetId = toNodeId(srcDir, rootDir, resolved);
|
|
7259
7469
|
if (nodeIdSet.has(targetId) && !targetId.endsWith("/index.ts") && !targetId.endsWith("/index.tsx")) {
|
|
7260
7470
|
addEdge(targetId, edgeTypeFor(isTypeOnly, names));
|
|
7261
7471
|
}
|
|
@@ -7299,24 +7509,30 @@ function extractEdges(srcDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps,
|
|
|
7299
7509
|
}
|
|
7300
7510
|
return { edges, flagged };
|
|
7301
7511
|
}
|
|
7302
|
-
function hasNextConfig(rootDir) {
|
|
7303
|
-
return (0, import_node_fs4.existsSync)((0, import_node_path4.join)(rootDir, "next.config.ts")) || (0, import_node_fs4.existsSync)((0, import_node_path4.join)(rootDir, "next.config.js")) || (0, import_node_fs4.existsSync)((0, import_node_path4.join)(rootDir, "next.config.mjs"));
|
|
7304
|
-
}
|
|
7305
7512
|
function detect(rootDir) {
|
|
7306
7513
|
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
7307
|
-
return paths !== null
|
|
7514
|
+
return paths !== null;
|
|
7308
7515
|
}
|
|
7309
7516
|
function generate(rootDir) {
|
|
7310
7517
|
const config = loadConfig(rootDir);
|
|
7311
7518
|
const paths = resolveProjectPaths(rootDir, config);
|
|
7312
7519
|
const srcDir = paths.srcDir;
|
|
7313
|
-
const
|
|
7314
|
-
const
|
|
7315
|
-
const
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7520
|
+
const allDiscovered = [];
|
|
7521
|
+
const discoveredSet = /* @__PURE__ */ new Set();
|
|
7522
|
+
for (const root of paths.srcRoots) {
|
|
7523
|
+
for (const f of walk(root, [".tsx", ".ts"])) {
|
|
7524
|
+
if (!discoveredSet.has(f)) {
|
|
7525
|
+
discoveredSet.add(f);
|
|
7526
|
+
allDiscovered.push(f);
|
|
7527
|
+
}
|
|
7528
|
+
}
|
|
7529
|
+
}
|
|
7530
|
+
for (const conv of paths.conventionFiles) {
|
|
7531
|
+
if (!discoveredSet.has(conv)) {
|
|
7532
|
+
discoveredSet.add(conv);
|
|
7533
|
+
allDiscovered.push(conv);
|
|
7534
|
+
}
|
|
7535
|
+
}
|
|
7320
7536
|
const parsedByPath = /* @__PURE__ */ new Map();
|
|
7321
7537
|
for (const absPath of allDiscovered) {
|
|
7322
7538
|
parsedByPath.set(absPath, parseFileTS(absPath));
|
|
@@ -7326,9 +7542,9 @@ function generate(rootDir) {
|
|
|
7326
7542
|
const apiNodes = [];
|
|
7327
7543
|
const nodeIdSet = /* @__PURE__ */ new Set();
|
|
7328
7544
|
const routeToNodeId = /* @__PURE__ */ new Map();
|
|
7329
|
-
const fileSet = allDiscovered.filter((f) => !(0,
|
|
7545
|
+
const fileSet = allDiscovered.filter((f) => !(0, import_node_path5.basename)(f).startsWith("index."));
|
|
7330
7546
|
for (const absPath of fileSet) {
|
|
7331
|
-
const id = toNodeId(srcDir, absPath);
|
|
7547
|
+
const id = toNodeId(srcDir, rootDir, absPath);
|
|
7332
7548
|
const type = classifyType(absPath, id);
|
|
7333
7549
|
if (type === "test" || type === "story") continue;
|
|
7334
7550
|
const parsed = parsedByPath.get(absPath);
|
|
@@ -7343,7 +7559,7 @@ function generate(rootDir) {
|
|
|
7343
7559
|
const dbCalls = extractDbCallsTS(absPath);
|
|
7344
7560
|
const authWrappers = extractAuthWrappersTS(absPath);
|
|
7345
7561
|
const deep = extractDeep(absPath);
|
|
7346
|
-
const routePath = (
|
|
7562
|
+
const routePath = filePathToAppRoute(paths.appDir, absPath);
|
|
7347
7563
|
const mutations = dbCalls.filter((c) => c.isMutation);
|
|
7348
7564
|
const mutates = mutations.length > 0;
|
|
7349
7565
|
const authStrategy = [...authWrappers];
|
|
@@ -7387,11 +7603,12 @@ function generate(rootDir) {
|
|
|
7387
7603
|
const uiEdges = [];
|
|
7388
7604
|
const uiFlagged = [];
|
|
7389
7605
|
for (const absPath of fileSet) {
|
|
7390
|
-
const id = toNodeId(srcDir, absPath);
|
|
7606
|
+
const id = toNodeId(srcDir, rootDir, absPath);
|
|
7391
7607
|
if (!nodeIdSet.has(id)) continue;
|
|
7392
7608
|
const parsed = parsedByPath.get(absPath);
|
|
7393
7609
|
const { edges, flagged } = extractEdges(
|
|
7394
7610
|
srcDir,
|
|
7611
|
+
rootDir,
|
|
7395
7612
|
absPath,
|
|
7396
7613
|
id,
|
|
7397
7614
|
parsed,
|
|
@@ -7404,7 +7621,7 @@ function generate(rootDir) {
|
|
|
7404
7621
|
}
|
|
7405
7622
|
const fetchCallEntries = [];
|
|
7406
7623
|
for (const absPath of fileSet) {
|
|
7407
|
-
const sourceId = toNodeId(srcDir, absPath);
|
|
7624
|
+
const sourceId = toNodeId(srcDir, rootDir, absPath);
|
|
7408
7625
|
if (!nodeIdSet.has(sourceId)) continue;
|
|
7409
7626
|
const parsed = parsedByPath.get(absPath);
|
|
7410
7627
|
if (parsed.fetchCalls.length === 0) continue;
|
|
@@ -7420,20 +7637,7 @@ function generate(rootDir) {
|
|
|
7420
7637
|
});
|
|
7421
7638
|
}
|
|
7422
7639
|
const externalScanned = new Set(allDiscovered.map((f) => f.replace(/\\/g, "/")));
|
|
7423
|
-
const
|
|
7424
|
-
"node_modules",
|
|
7425
|
-
".next",
|
|
7426
|
-
"dist",
|
|
7427
|
-
".launchsecure",
|
|
7428
|
-
".git",
|
|
7429
|
-
"src",
|
|
7430
|
-
"coverage",
|
|
7431
|
-
".turbo",
|
|
7432
|
-
"build",
|
|
7433
|
-
"out",
|
|
7434
|
-
".vercel"
|
|
7435
|
-
]);
|
|
7436
|
-
const externalCandidates = walkWithIgnore(rootDir, [".ts", ".tsx"], IGNORE_DIRS2);
|
|
7640
|
+
const externalCandidates = walkWithIgnore(rootDir, [".ts", ".tsx"], { extraIgnore: /* @__PURE__ */ new Set(["src"]) });
|
|
7437
7641
|
for (const absPath of externalCandidates) {
|
|
7438
7642
|
const normalized = absPath.replace(/\\/g, "/");
|
|
7439
7643
|
if (externalScanned.has(normalized)) continue;
|
|
@@ -7443,7 +7647,7 @@ function generate(rootDir) {
|
|
|
7443
7647
|
} catch {
|
|
7444
7648
|
continue;
|
|
7445
7649
|
}
|
|
7446
|
-
const externalId = (0,
|
|
7650
|
+
const externalId = (0, import_node_path5.relative)(rootDir, absPath).replace(/\\/g, "/");
|
|
7447
7651
|
const edgesFromThis = [];
|
|
7448
7652
|
const seen = /* @__PURE__ */ new Set();
|
|
7449
7653
|
for (const imp of parsed.imports) {
|
|
@@ -7456,7 +7660,7 @@ function generate(rootDir) {
|
|
|
7456
7660
|
for (const name of names) {
|
|
7457
7661
|
const targetAbs = barrelMap.get(name);
|
|
7458
7662
|
if (!targetAbs) continue;
|
|
7459
|
-
const targetId2 = toNodeId(srcDir, targetAbs);
|
|
7663
|
+
const targetId2 = toNodeId(srcDir, rootDir, targetAbs);
|
|
7460
7664
|
if (!nodeIdSet.has(targetId2)) continue;
|
|
7461
7665
|
const key2 = `${externalId}\u2192${targetId2}`;
|
|
7462
7666
|
if (seen.has(key2)) continue;
|
|
@@ -7470,7 +7674,7 @@ function generate(rootDir) {
|
|
|
7470
7674
|
resolved = resolveRelativeImport(absPath, specifier);
|
|
7471
7675
|
}
|
|
7472
7676
|
if (!resolved) continue;
|
|
7473
|
-
const targetId = toNodeId(srcDir, resolved);
|
|
7677
|
+
const targetId = toNodeId(srcDir, rootDir, resolved);
|
|
7474
7678
|
if (!nodeIdSet.has(targetId)) continue;
|
|
7475
7679
|
if (targetId.endsWith("/index.ts") || targetId.endsWith("/index.tsx")) continue;
|
|
7476
7680
|
const key = `${externalId}\u2192${targetId}`;
|
|
@@ -7647,8 +7851,8 @@ var typescriptProjectParser = {
|
|
|
7647
7851
|
};
|
|
7648
7852
|
|
|
7649
7853
|
// src/server/graph/parsers/db/prisma-schema.ts
|
|
7650
|
-
var
|
|
7651
|
-
|
|
7854
|
+
var import_node_fs6 = require("node:fs");
|
|
7855
|
+
init_config();
|
|
7652
7856
|
function parseModels(content) {
|
|
7653
7857
|
const nodes = [];
|
|
7654
7858
|
const relations = [];
|
|
@@ -7739,11 +7943,25 @@ function parseEnums(content) {
|
|
|
7739
7943
|
return nodes;
|
|
7740
7944
|
}
|
|
7741
7945
|
function detect2(rootDir) {
|
|
7742
|
-
|
|
7946
|
+
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
7947
|
+
return paths?.dbConfig.kind === "prisma" && (0, import_node_fs6.existsSync)(paths.dbConfig.schemaPath);
|
|
7743
7948
|
}
|
|
7744
7949
|
function generate2(rootDir) {
|
|
7745
|
-
const
|
|
7746
|
-
|
|
7950
|
+
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
7951
|
+
if (paths.dbConfig.kind !== "prisma") {
|
|
7952
|
+
return {
|
|
7953
|
+
metadata: { generated: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), layer: "db", source: "none" },
|
|
7954
|
+
nodes: [],
|
|
7955
|
+
edges: [],
|
|
7956
|
+
cross_refs: [],
|
|
7957
|
+
contradictions: [],
|
|
7958
|
+
warnings: [],
|
|
7959
|
+
flagged_edges: [],
|
|
7960
|
+
patterns: { total_tables: 0, total_enums: 0, total_relations: 0 }
|
|
7961
|
+
};
|
|
7962
|
+
}
|
|
7963
|
+
const schemaPath = paths.dbConfig.schemaPath;
|
|
7964
|
+
const content = (0, import_node_fs6.readFileSync)(schemaPath, "utf-8");
|
|
7747
7965
|
const { nodes: modelNodes, relations } = parseModels(content);
|
|
7748
7966
|
const enumNodes = parseEnums(content);
|
|
7749
7967
|
const allNodes = [...modelNodes, ...enumNodes];
|
|
@@ -7763,7 +7981,7 @@ function generate2(rootDir) {
|
|
|
7763
7981
|
metadata: {
|
|
7764
7982
|
generated: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
7765
7983
|
scope: "prisma-schema",
|
|
7766
|
-
source:
|
|
7984
|
+
source: schemaPath,
|
|
7767
7985
|
provider: "postgresql",
|
|
7768
7986
|
layer: "db",
|
|
7769
7987
|
total_models: modelNodes.length,
|
|
@@ -7800,8 +8018,9 @@ var prismaSchemaParser = {
|
|
|
7800
8018
|
};
|
|
7801
8019
|
|
|
7802
8020
|
// src/server/graph/parsers/db/sql-migrations.ts
|
|
7803
|
-
var
|
|
8021
|
+
var import_node_fs7 = require("node:fs");
|
|
7804
8022
|
var import_node_path6 = require("node:path");
|
|
8023
|
+
init_config();
|
|
7805
8024
|
var PG_TO_PRISMA = {
|
|
7806
8025
|
"TEXT": "String",
|
|
7807
8026
|
"VARCHAR": "String",
|
|
@@ -7950,20 +8169,30 @@ function parseUniqueIndex(sql, state) {
|
|
|
7950
8169
|
state.uniqueIndexes.get(m[1]).add(m[2]);
|
|
7951
8170
|
}
|
|
7952
8171
|
}
|
|
7953
|
-
function
|
|
7954
|
-
|
|
8172
|
+
function discoverMigrationFiles(migrationsDir) {
|
|
8173
|
+
if (!(0, import_node_fs7.existsSync)(migrationsDir)) return [];
|
|
8174
|
+
const out = [];
|
|
8175
|
+
const entries = (0, import_node_fs7.readdirSync)(migrationsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
8176
|
+
for (const entry of entries) {
|
|
8177
|
+
if (entry.isDirectory()) {
|
|
8178
|
+
const sqlPath = (0, import_node_path6.join)(migrationsDir, entry.name, "migration.sql");
|
|
8179
|
+
if ((0, import_node_fs7.existsSync)(sqlPath)) out.push(sqlPath);
|
|
8180
|
+
} else if (entry.isFile() && entry.name.endsWith(".sql")) {
|
|
8181
|
+
out.push((0, import_node_path6.join)(migrationsDir, entry.name));
|
|
8182
|
+
}
|
|
8183
|
+
}
|
|
8184
|
+
return out;
|
|
8185
|
+
}
|
|
8186
|
+
function parseMigrations(migrationsDir) {
|
|
7955
8187
|
const state = {
|
|
7956
8188
|
tables: /* @__PURE__ */ new Map(),
|
|
7957
8189
|
enums: /* @__PURE__ */ new Map(),
|
|
7958
8190
|
fks: [],
|
|
7959
8191
|
uniqueIndexes: /* @__PURE__ */ new Map()
|
|
7960
8192
|
};
|
|
7961
|
-
if (!
|
|
7962
|
-
const
|
|
7963
|
-
|
|
7964
|
-
const sqlPath = (0, import_node_path6.join)(migrationsDir, dir, "migration.sql");
|
|
7965
|
-
if (!(0, import_node_fs6.existsSync)(sqlPath)) continue;
|
|
7966
|
-
const sql = (0, import_node_fs6.readFileSync)(sqlPath, "utf-8");
|
|
8193
|
+
if (!migrationsDir) return state;
|
|
8194
|
+
for (const sqlPath of discoverMigrationFiles(migrationsDir)) {
|
|
8195
|
+
const sql = (0, import_node_fs7.readFileSync)(sqlPath, "utf-8");
|
|
7967
8196
|
parseCreateEnum(sql, state);
|
|
7968
8197
|
parseCreateTable(sql, state);
|
|
7969
8198
|
parseAlterTable(sql, state);
|
|
@@ -7973,10 +8202,9 @@ function parseMigrations(rootDir) {
|
|
|
7973
8202
|
}
|
|
7974
8203
|
return state;
|
|
7975
8204
|
}
|
|
7976
|
-
function loadPrismaState(
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
const content = (0, import_node_fs6.readFileSync)(schemaPath, "utf-8");
|
|
8205
|
+
function loadPrismaState(schemaPath) {
|
|
8206
|
+
if (!schemaPath || !(0, import_node_fs7.existsSync)(schemaPath)) return null;
|
|
8207
|
+
const content = (0, import_node_fs7.readFileSync)(schemaPath, "utf-8");
|
|
7980
8208
|
const tables = /* @__PURE__ */ new Map();
|
|
7981
8209
|
const enums = /* @__PURE__ */ new Map();
|
|
7982
8210
|
const relations = [];
|
|
@@ -8140,14 +8368,28 @@ function verify(sqlState, prisma) {
|
|
|
8140
8368
|
}
|
|
8141
8369
|
return { contradictions, flaggedEdges };
|
|
8142
8370
|
}
|
|
8371
|
+
function migrationsDirFor(rootDir) {
|
|
8372
|
+
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
8373
|
+
if (!paths) return null;
|
|
8374
|
+
if (paths.dbConfig.kind === "prisma" || paths.dbConfig.kind === "sql-migrations") {
|
|
8375
|
+
return paths.dbConfig.migrationsDir;
|
|
8376
|
+
}
|
|
8377
|
+
return null;
|
|
8378
|
+
}
|
|
8379
|
+
function schemaPathFor(rootDir) {
|
|
8380
|
+
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
8381
|
+
if (!paths) return null;
|
|
8382
|
+
return paths.dbConfig.kind === "prisma" ? paths.dbConfig.schemaPath : null;
|
|
8383
|
+
}
|
|
8143
8384
|
function detect3(rootDir) {
|
|
8144
|
-
const
|
|
8145
|
-
if (!
|
|
8146
|
-
return (
|
|
8385
|
+
const dir = migrationsDirFor(rootDir);
|
|
8386
|
+
if (!dir) return false;
|
|
8387
|
+
return discoverMigrationFiles(dir).length > 0;
|
|
8147
8388
|
}
|
|
8148
8389
|
function generate3(rootDir) {
|
|
8149
|
-
const
|
|
8150
|
-
const
|
|
8390
|
+
const migrationsDir = migrationsDirFor(rootDir);
|
|
8391
|
+
const sqlState = parseMigrations(migrationsDir);
|
|
8392
|
+
const prisma = loadPrismaState(schemaPathFor(rootDir));
|
|
8151
8393
|
const prismaTableIds = prisma ? new Set(prisma.tables.keys()) : /* @__PURE__ */ new Set();
|
|
8152
8394
|
const prismaEnumIds = prisma ? new Set(prisma.enums.keys()) : /* @__PURE__ */ new Set();
|
|
8153
8395
|
const nodes = [];
|
|
@@ -8193,7 +8435,7 @@ function generate3(rootDir) {
|
|
|
8193
8435
|
metadata: {
|
|
8194
8436
|
generated: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
8195
8437
|
scope: "sql-migrations",
|
|
8196
|
-
source: "
|
|
8438
|
+
source: migrationsDir ?? "none",
|
|
8197
8439
|
layer: "db",
|
|
8198
8440
|
sql_tables: sqlState.tables.size,
|
|
8199
8441
|
sql_enums: sqlState.enums.size,
|
|
@@ -8431,13 +8673,13 @@ var fetchResolverParser = {
|
|
|
8431
8673
|
};
|
|
8432
8674
|
|
|
8433
8675
|
// src/server/graph/parsers/crosslayer/api-annotations.ts
|
|
8434
|
-
var
|
|
8676
|
+
var import_node_fs8 = require("node:fs");
|
|
8435
8677
|
var import_node_path7 = require("node:path");
|
|
8436
8678
|
var API_ANNOTATION_RE = /@api\s+(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)\s+(\/\S+)/g;
|
|
8437
8679
|
function walk2(dir, exts) {
|
|
8438
|
-
if (!(0,
|
|
8680
|
+
if (!(0, import_node_fs8.existsSync)(dir)) return [];
|
|
8439
8681
|
const results = [];
|
|
8440
|
-
for (const entry of (0,
|
|
8682
|
+
for (const entry of (0, import_node_fs8.readdirSync)(dir, { withFileTypes: true })) {
|
|
8441
8683
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
8442
8684
|
const full = (0, import_node_path7.join)(dir, entry.name);
|
|
8443
8685
|
if (entry.isDirectory()) {
|
|
@@ -8456,7 +8698,7 @@ var apiAnnotationsParser = {
|
|
|
8456
8698
|
layer: "crosslayer",
|
|
8457
8699
|
concern: "api-binding",
|
|
8458
8700
|
detect(rootDir) {
|
|
8459
|
-
return (0,
|
|
8701
|
+
return (0, import_node_fs8.existsSync)((0, import_node_path7.join)(rootDir, "src"));
|
|
8460
8702
|
},
|
|
8461
8703
|
generate(rootDir, layerOutputs) {
|
|
8462
8704
|
const apiOutput = layerOutputs.get("api");
|
|
@@ -8473,7 +8715,7 @@ var apiAnnotationsParser = {
|
|
|
8473
8715
|
const flaggedEdges = [];
|
|
8474
8716
|
const seen = /* @__PURE__ */ new Set();
|
|
8475
8717
|
for (const absPath of files) {
|
|
8476
|
-
const content = (0,
|
|
8718
|
+
const content = (0, import_node_fs8.readFileSync)(absPath, "utf-8");
|
|
8477
8719
|
const sourceId = toNodeId2(srcDir, absPath);
|
|
8478
8720
|
if (!uiNodeIds.has(sourceId)) continue;
|
|
8479
8721
|
let match;
|
|
@@ -8517,14 +8759,14 @@ var apiAnnotationsParser = {
|
|
|
8517
8759
|
};
|
|
8518
8760
|
|
|
8519
8761
|
// src/server/graph/parsers/crosslayer/url-literal-scanner.ts
|
|
8520
|
-
var
|
|
8762
|
+
var import_node_fs9 = require("node:fs");
|
|
8521
8763
|
var import_node_path8 = require("node:path");
|
|
8522
8764
|
init_config();
|
|
8523
8765
|
var URL_LITERAL_RE = /['"`](\/api\/[^'"`\s]+?)['"`]/g;
|
|
8524
8766
|
function walk3(dir, exts) {
|
|
8525
|
-
if (!(0,
|
|
8767
|
+
if (!(0, import_node_fs9.existsSync)(dir)) return [];
|
|
8526
8768
|
const results = [];
|
|
8527
|
-
for (const entry of (0,
|
|
8769
|
+
for (const entry of (0, import_node_fs9.readdirSync)(dir, { withFileTypes: true })) {
|
|
8528
8770
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
8529
8771
|
const full = (0, import_node_path8.join)(dir, entry.name);
|
|
8530
8772
|
if (entry.isDirectory()) {
|
|
@@ -8567,7 +8809,7 @@ var urlLiteralScannerParser = {
|
|
|
8567
8809
|
for (const absPath of files) {
|
|
8568
8810
|
const sourceId = toNodeId3(srcDir, absPath);
|
|
8569
8811
|
if (!uiNodeIds.has(sourceId)) continue;
|
|
8570
|
-
const content = (0,
|
|
8812
|
+
const content = (0, import_node_fs9.readFileSync)(absPath, "utf-8");
|
|
8571
8813
|
let match;
|
|
8572
8814
|
URL_LITERAL_RE.lastIndex = 0;
|
|
8573
8815
|
while ((match = URL_LITERAL_RE.exec(content)) !== null) {
|
|
@@ -8598,7 +8840,7 @@ var urlLiteralScannerParser = {
|
|
|
8598
8840
|
};
|
|
8599
8841
|
|
|
8600
8842
|
// src/server/graph/parsers/static/static-values.ts
|
|
8601
|
-
var
|
|
8843
|
+
var import_node_fs10 = require("node:fs");
|
|
8602
8844
|
var import_node_path9 = require("node:path");
|
|
8603
8845
|
var parseCode = null;
|
|
8604
8846
|
function tryLoadTreeSitter() {
|
|
@@ -8637,14 +8879,14 @@ function extractEnumValues(rootDir) {
|
|
|
8637
8879
|
];
|
|
8638
8880
|
let content = "";
|
|
8639
8881
|
for (const p of schemaPaths) {
|
|
8640
|
-
if ((0,
|
|
8882
|
+
if ((0, import_node_fs10.existsSync)(p)) {
|
|
8641
8883
|
try {
|
|
8642
|
-
const stat = (0,
|
|
8884
|
+
const stat = (0, import_node_fs10.statSync)(p);
|
|
8643
8885
|
if (stat.isFile()) {
|
|
8644
|
-
content = (0,
|
|
8886
|
+
content = (0, import_node_fs10.readFileSync)(p, "utf-8");
|
|
8645
8887
|
} else if (stat.isDirectory()) {
|
|
8646
|
-
const files = (0,
|
|
8647
|
-
content = files.map((f) => (0,
|
|
8888
|
+
const files = (0, import_node_fs10.readdirSync)(p).filter((f) => f.endsWith(".prisma"));
|
|
8889
|
+
content = files.map((f) => (0, import_node_fs10.readFileSync)((0, import_node_path9.join)(p, f), "utf-8")).join("\n");
|
|
8648
8890
|
}
|
|
8649
8891
|
} catch {
|
|
8650
8892
|
continue;
|
|
@@ -8718,7 +8960,7 @@ function extractStringArrayFromNode(node) {
|
|
|
8718
8960
|
return values;
|
|
8719
8961
|
}
|
|
8720
8962
|
function findArrayDecl(root, varName) {
|
|
8721
|
-
function
|
|
8963
|
+
function walk4(node) {
|
|
8722
8964
|
if (node.type === "variable_declarator") {
|
|
8723
8965
|
const nameNode = node.childForFieldName("name");
|
|
8724
8966
|
const valueNode = node.childForFieldName("value");
|
|
@@ -8731,12 +8973,12 @@ function findArrayDecl(root, varName) {
|
|
|
8731
8973
|
}
|
|
8732
8974
|
}
|
|
8733
8975
|
for (const child of node.namedChildren) {
|
|
8734
|
-
const found =
|
|
8976
|
+
const found = walk4(child);
|
|
8735
8977
|
if (found) return found;
|
|
8736
8978
|
}
|
|
8737
8979
|
return null;
|
|
8738
8980
|
}
|
|
8739
|
-
return
|
|
8981
|
+
return walk4(root);
|
|
8740
8982
|
}
|
|
8741
8983
|
function extractObjectPropsRegex(objStr) {
|
|
8742
8984
|
const props = {};
|
|
@@ -8803,10 +9045,10 @@ function extractSeedData(rootDir) {
|
|
|
8803
9045
|
(0, import_node_path9.join)(rootDir, "prisma", "seed.ts"),
|
|
8804
9046
|
(0, import_node_path9.join)(rootDir, "prisma", "seed.js"),
|
|
8805
9047
|
(0, import_node_path9.join)(rootDir, "src", "server", "lib", "system-tags.ts")
|
|
8806
|
-
].filter(
|
|
9048
|
+
].filter(import_node_fs10.existsSync);
|
|
8807
9049
|
const useTreeSitter = tryLoadTreeSitter();
|
|
8808
9050
|
for (const filePath of seedFiles) {
|
|
8809
|
-
const content = (0,
|
|
9051
|
+
const content = (0, import_node_fs10.readFileSync)(filePath, "utf-8");
|
|
8810
9052
|
const relPath = (0, import_node_path9.relative)(rootDir, filePath);
|
|
8811
9053
|
const seeded = detectSeededArrays(content, relPath);
|
|
8812
9054
|
let astRoot = null;
|
|
@@ -8901,9 +9143,9 @@ function extractSeedData(rootDir) {
|
|
|
8901
9143
|
return { nodes, edges };
|
|
8902
9144
|
}
|
|
8903
9145
|
function walkDir(dir, exts) {
|
|
8904
|
-
if (!(0,
|
|
9146
|
+
if (!(0, import_node_fs10.existsSync)(dir)) return [];
|
|
8905
9147
|
const results = [];
|
|
8906
|
-
for (const entry of (0,
|
|
9148
|
+
for (const entry of (0, import_node_fs10.readdirSync)(dir, { withFileTypes: true })) {
|
|
8907
9149
|
if (entry.name === "node_modules" || entry.name === ".next" || entry.name === "dist") continue;
|
|
8908
9150
|
const full = (0, import_node_path9.join)(dir, entry.name);
|
|
8909
9151
|
if (entry.isDirectory()) results.push(...walkDir(full, exts));
|
|
@@ -8914,9 +9156,9 @@ function walkDir(dir, exts) {
|
|
|
8914
9156
|
function extractConstants(rootDir) {
|
|
8915
9157
|
const nodes = [];
|
|
8916
9158
|
const srcDir = (0, import_node_path9.join)(rootDir, "src");
|
|
8917
|
-
if (!(0,
|
|
9159
|
+
if (!(0, import_node_fs10.existsSync)(srcDir)) return { nodes };
|
|
8918
9160
|
for (const filePath of walkDir(srcDir, [".ts", ".tsx"])) {
|
|
8919
|
-
const content = (0,
|
|
9161
|
+
const content = (0, import_node_fs10.readFileSync)(filePath, "utf-8");
|
|
8920
9162
|
const relPath = (0, import_node_path9.relative)(rootDir, filePath);
|
|
8921
9163
|
const constArrayRe = /export\s+const\s+([A-Z][A-Z_0-9]+)\s*(?::[^=]+)?\s*=\s*\[/g;
|
|
8922
9164
|
let cm;
|
|
@@ -8950,7 +9192,7 @@ function extractConstants(rootDir) {
|
|
|
8950
9192
|
return { nodes };
|
|
8951
9193
|
}
|
|
8952
9194
|
function detect4(rootDir) {
|
|
8953
|
-
return (0,
|
|
9195
|
+
return (0, import_node_fs10.existsSync)((0, import_node_path9.join)(rootDir, "prisma", "schema.prisma")) || (0, import_node_fs10.existsSync)((0, import_node_path9.join)(rootDir, "prisma", "seed.ts"));
|
|
8954
9196
|
}
|
|
8955
9197
|
function generate4(rootDir) {
|
|
8956
9198
|
const enumResult = extractEnumValues(rootDir);
|
|
@@ -9025,26 +9267,9 @@ var staticValuesParser = {
|
|
|
9025
9267
|
};
|
|
9026
9268
|
|
|
9027
9269
|
// src/server/graph/parsers/crosslayer/static-ref-scanner.ts
|
|
9028
|
-
var
|
|
9270
|
+
var import_node_fs11 = require("node:fs");
|
|
9029
9271
|
var import_node_path10 = require("node:path");
|
|
9030
9272
|
init_config();
|
|
9031
|
-
function walk4(dir, exts) {
|
|
9032
|
-
if (!(0, import_node_fs10.existsSync)(dir)) return [];
|
|
9033
|
-
const results = [];
|
|
9034
|
-
function recurse(d) {
|
|
9035
|
-
for (const entry of (0, import_node_fs10.readdirSync)(d, { withFileTypes: true })) {
|
|
9036
|
-
const full = (0, import_node_path10.join)(d, entry.name);
|
|
9037
|
-
if (entry.isDirectory()) {
|
|
9038
|
-
if (entry.name === "node_modules" || entry.name === ".next" || entry.name === "dist") continue;
|
|
9039
|
-
recurse(full);
|
|
9040
|
-
} else if (exts.some((ext) => entry.name.endsWith(ext))) {
|
|
9041
|
-
results.push(full);
|
|
9042
|
-
}
|
|
9043
|
-
}
|
|
9044
|
-
}
|
|
9045
|
-
recurse(dir);
|
|
9046
|
-
return results;
|
|
9047
|
-
}
|
|
9048
9273
|
var MIN_VALUE_LENGTH = 4;
|
|
9049
9274
|
var SKIP_VALUES = /* @__PURE__ */ new Set([
|
|
9050
9275
|
"true",
|
|
@@ -9187,11 +9412,11 @@ var staticRefScannerParser = {
|
|
|
9187
9412
|
if (!paths) return { cross_refs: [], flagged_edges: [], warnings: [] };
|
|
9188
9413
|
const srcDir = paths.srcDir;
|
|
9189
9414
|
const files = [
|
|
9190
|
-
...
|
|
9191
|
-
...
|
|
9192
|
-
...
|
|
9193
|
-
...
|
|
9194
|
-
...
|
|
9415
|
+
...walkWithIgnore((0, import_node_path10.join)(srcDir, "client"), [".ts", ".tsx"]),
|
|
9416
|
+
...walkWithIgnore(paths.appDir, [".ts", ".tsx"]),
|
|
9417
|
+
...walkWithIgnore((0, import_node_path10.join)(srcDir, "server"), [".ts", ".tsx"]),
|
|
9418
|
+
...walkWithIgnore((0, import_node_path10.join)(srcDir, "lib"), [".ts", ".tsx"]),
|
|
9419
|
+
...walkWithIgnore((0, import_node_path10.join)(srcDir, "config"), [".ts", ".tsx"])
|
|
9195
9420
|
];
|
|
9196
9421
|
const uiOutput = layerOutputs.get("ui");
|
|
9197
9422
|
const apiOutput = layerOutputs.get("api");
|
|
@@ -9212,7 +9437,7 @@ var staticRefScannerParser = {
|
|
|
9212
9437
|
const sourceId = (0, import_node_path10.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
9213
9438
|
const sourceLayer = uiNodeIds.has(sourceId) ? "ui" : apiNodeIds.has(sourceId) ? "api" : null;
|
|
9214
9439
|
if (!sourceLayer) continue;
|
|
9215
|
-
const content = (0,
|
|
9440
|
+
const content = (0, import_node_fs11.readFileSync)(absPath, "utf-8");
|
|
9216
9441
|
filesScanned++;
|
|
9217
9442
|
let fileRefs;
|
|
9218
9443
|
if (parseCode2) {
|
|
@@ -9459,9 +9684,9 @@ function applyCrossLayerResults(uiOutput, results) {
|
|
|
9459
9684
|
// src/server/graph/core/graph-builder.ts
|
|
9460
9685
|
function readGraphFromDisk(rootDir, layer) {
|
|
9461
9686
|
const filePath = (0, import_node_path12.join)(rootDir, ".launchsecure", "graphs", `${layer}.json`);
|
|
9462
|
-
if (!(0,
|
|
9687
|
+
if (!(0, import_node_fs12.existsSync)(filePath)) return null;
|
|
9463
9688
|
try {
|
|
9464
|
-
return JSON.parse((0,
|
|
9689
|
+
return JSON.parse((0, import_node_fs12.readFileSync)(filePath, "utf-8"));
|
|
9465
9690
|
} catch {
|
|
9466
9691
|
return null;
|
|
9467
9692
|
}
|
|
@@ -9565,7 +9790,7 @@ init_config();
|
|
|
9565
9790
|
var import_node_path14 = require("node:path");
|
|
9566
9791
|
|
|
9567
9792
|
// src/server/graph/taggers/module-tagger.ts
|
|
9568
|
-
var
|
|
9793
|
+
var import_node_fs13 = require("node:fs");
|
|
9569
9794
|
var import_node_path13 = require("node:path");
|
|
9570
9795
|
function matchGlob(pattern, id) {
|
|
9571
9796
|
const patParts = pattern.split("/");
|
|
@@ -9606,11 +9831,11 @@ function detectConventionDirs(rootDir, extraConventionDirs = []) {
|
|
|
9606
9831
|
for (const base of searchDirs) {
|
|
9607
9832
|
for (const convention of conventionDirs) {
|
|
9608
9833
|
const dir = (0, import_node_path13.join)(base, convention);
|
|
9609
|
-
if (!(0,
|
|
9834
|
+
if (!(0, import_node_fs13.existsSync)(dir)) continue;
|
|
9610
9835
|
try {
|
|
9611
|
-
const stat = (0,
|
|
9836
|
+
const stat = (0, import_node_fs13.statSync)(dir);
|
|
9612
9837
|
if (!stat.isDirectory()) continue;
|
|
9613
|
-
const entries = (0,
|
|
9838
|
+
const entries = (0, import_node_fs13.readdirSync)(dir, { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith(".")).map((e) => e.name);
|
|
9614
9839
|
if (entries.length > 0) {
|
|
9615
9840
|
const relPath = dir.replace(rootDir + "/", "").replace(rootDir + "\\", "");
|
|
9616
9841
|
result.set(relPath, entries);
|
|
@@ -9927,7 +10152,7 @@ function createTaggerRegistry(config, rootDir) {
|
|
|
9927
10152
|
}
|
|
9928
10153
|
|
|
9929
10154
|
// src/server/graph/core/tag-store.ts
|
|
9930
|
-
var
|
|
10155
|
+
var import_node_fs14 = require("node:fs");
|
|
9931
10156
|
var import_node_path15 = require("node:path");
|
|
9932
10157
|
var TAGS_FILENAME = "tags.json";
|
|
9933
10158
|
var GRAPHS_DIR = ".launchsecure/graphs";
|
|
@@ -9937,14 +10162,14 @@ function tagsFilePath(rootDir) {
|
|
|
9937
10162
|
}
|
|
9938
10163
|
function readTagStore(rootDir) {
|
|
9939
10164
|
const filePath = tagsFilePath(rootDir);
|
|
9940
|
-
if (!(0,
|
|
9941
|
-
const stat = (0,
|
|
10165
|
+
if (!(0, import_node_fs14.existsSync)(filePath)) return {};
|
|
10166
|
+
const stat = (0, import_node_fs14.statSync)(filePath);
|
|
9942
10167
|
const cached = tagCache.get(filePath);
|
|
9943
10168
|
if (cached && cached.mtimeMs === stat.mtimeMs) {
|
|
9944
10169
|
return cached.store;
|
|
9945
10170
|
}
|
|
9946
10171
|
try {
|
|
9947
|
-
const content = (0,
|
|
10172
|
+
const content = (0, import_node_fs14.readFileSync)(filePath, "utf-8");
|
|
9948
10173
|
const store = JSON.parse(content);
|
|
9949
10174
|
tagCache.set(filePath, { mtimeMs: stat.mtimeMs, store });
|
|
9950
10175
|
return store;
|
|
@@ -9955,14 +10180,14 @@ function readTagStore(rootDir) {
|
|
|
9955
10180
|
function writeTagStore(rootDir, store) {
|
|
9956
10181
|
const filePath = tagsFilePath(rootDir);
|
|
9957
10182
|
const dir = (0, import_node_path15.dirname)(filePath);
|
|
9958
|
-
(0,
|
|
10183
|
+
(0, import_node_fs14.mkdirSync)(dir, { recursive: true });
|
|
9959
10184
|
const cleaned = {};
|
|
9960
10185
|
for (const [nodeId, tags] of Object.entries(store)) {
|
|
9961
10186
|
if (Object.keys(tags).length > 0) {
|
|
9962
10187
|
cleaned[nodeId] = tags;
|
|
9963
10188
|
}
|
|
9964
10189
|
}
|
|
9965
|
-
(0,
|
|
10190
|
+
(0, import_node_fs14.writeFileSync)(filePath, JSON.stringify(cleaned, null, 2) + "\n", "utf-8");
|
|
9966
10191
|
tagCache.delete(filePath);
|
|
9967
10192
|
}
|
|
9968
10193
|
function setTag(rootDir, nodeId, key, value) {
|
|
@@ -9986,8 +10211,8 @@ init_ts_extractor();
|
|
|
9986
10211
|
var GRAPHS_DIR2 = ".launchsecure/graphs";
|
|
9987
10212
|
function getAvailableLayers(rootDir) {
|
|
9988
10213
|
const dir = (0, import_node_path16.join)(rootDir, GRAPHS_DIR2);
|
|
9989
|
-
if (!(0,
|
|
9990
|
-
return (0,
|
|
10214
|
+
if (!(0, import_node_fs15.existsSync)(dir)) return [];
|
|
10215
|
+
return (0, import_node_fs15.readdirSync)(dir).filter((f) => f.endsWith(".json") && f !== "tags.json").map((f) => f.replace(".json", ""));
|
|
9991
10216
|
}
|
|
9992
10217
|
var graphCache = /* @__PURE__ */ new Map();
|
|
9993
10218
|
var taggedCache = /* @__PURE__ */ new Map();
|
|
@@ -10001,8 +10226,8 @@ function tagsFilePath2(rootDir) {
|
|
|
10001
10226
|
return (0, import_node_path16.join)(graphsDir(rootDir), "tags.json");
|
|
10002
10227
|
}
|
|
10003
10228
|
function getMtimeMs(filePath) {
|
|
10004
|
-
if (!(0,
|
|
10005
|
-
return (0,
|
|
10229
|
+
if (!(0, import_node_fs15.existsSync)(filePath)) return 0;
|
|
10230
|
+
return (0, import_node_fs15.statSync)(filePath).mtimeMs;
|
|
10006
10231
|
}
|
|
10007
10232
|
function invalidateCache(filePath) {
|
|
10008
10233
|
graphCache.delete(filePath);
|
|
@@ -10041,20 +10266,20 @@ function applyTags(graph, layer, rootDir) {
|
|
|
10041
10266
|
}
|
|
10042
10267
|
function readGraphRaw(rootDir, layer) {
|
|
10043
10268
|
const filePath = graphFilePath(rootDir, layer);
|
|
10044
|
-
if (!(0,
|
|
10045
|
-
const stat = (0,
|
|
10269
|
+
if (!(0, import_node_fs15.existsSync)(filePath)) return null;
|
|
10270
|
+
const stat = (0, import_node_fs15.statSync)(filePath);
|
|
10046
10271
|
const cached = graphCache.get(filePath);
|
|
10047
10272
|
if (cached && cached.mtimeMs === stat.mtimeMs) {
|
|
10048
10273
|
return cached.graph;
|
|
10049
10274
|
}
|
|
10050
|
-
const content = (0,
|
|
10275
|
+
const content = (0, import_node_fs15.readFileSync)(filePath, "utf-8");
|
|
10051
10276
|
const graph = JSON.parse(content);
|
|
10052
10277
|
graphCache.set(filePath, { mtimeMs: stat.mtimeMs, graph });
|
|
10053
10278
|
return graph;
|
|
10054
10279
|
}
|
|
10055
10280
|
function readGraph(rootDir, layer) {
|
|
10056
10281
|
const rawFilePath = graphFilePath(rootDir, layer);
|
|
10057
|
-
if (!(0,
|
|
10282
|
+
if (!(0, import_node_fs15.existsSync)(rawFilePath)) return null;
|
|
10058
10283
|
const rawMtime = getMtimeMs(rawFilePath);
|
|
10059
10284
|
const tagsMtime = getMtimeMs(tagsFilePath2(rootDir));
|
|
10060
10285
|
const cacheKey = `${rootDir}:${layer}`;
|
|
@@ -10084,11 +10309,11 @@ async function generateGraph(rootDir, layer) {
|
|
|
10084
10309
|
mutationMethods: config.parsers?.patterns?.mutationMethods
|
|
10085
10310
|
});
|
|
10086
10311
|
const dir = graphsDir(rootDir);
|
|
10087
|
-
(0,
|
|
10312
|
+
(0, import_node_fs15.mkdirSync)(dir, { recursive: true });
|
|
10088
10313
|
const results = layer ? [generateLayer(rootDir, layer)].filter((r) => r !== null) : generateAll(rootDir);
|
|
10089
10314
|
for (const result of results) {
|
|
10090
10315
|
const filePath = graphFilePath(rootDir, result.layer);
|
|
10091
|
-
(0,
|
|
10316
|
+
(0, import_node_fs15.writeFileSync)(filePath, JSON.stringify(result.output, null, 2) + "\n", "utf-8");
|
|
10092
10317
|
invalidateCache(filePath);
|
|
10093
10318
|
invalidateTaggedCache(rootDir, result.layer);
|
|
10094
10319
|
}
|
|
@@ -10151,225 +10376,23 @@ async function handleGraphCommand(subcommand, args) {
|
|
|
10151
10376
|
|
|
10152
10377
|
// src/server/graph-mcp.ts
|
|
10153
10378
|
var import_node_fs19 = require("node:fs");
|
|
10154
|
-
var
|
|
10379
|
+
var import_node_path20 = require("node:path");
|
|
10155
10380
|
var import_node_child_process2 = require("node:child_process");
|
|
10156
10381
|
var import_node_os2 = require("node:os");
|
|
10157
10382
|
|
|
10158
|
-
// src/server/blast-radius-builder.ts
|
|
10159
|
-
var import_node_fs15 = __toESM(require("node:fs"));
|
|
10160
|
-
var import_node_path17 = require("node:path");
|
|
10161
|
-
var FALLBACK_DEFAULTS = {
|
|
10162
|
-
rings: [
|
|
10163
|
-
{ id: "modify", name: "Modify", color: "#ff6b00" },
|
|
10164
|
-
{ id: "ripple", name: "Ripple (verify)", color: "#ffff00" },
|
|
10165
|
-
{ id: "create", name: "Create", color: "#00ff00" }
|
|
10166
|
-
],
|
|
10167
|
-
layers: {
|
|
10168
|
-
db: { name: "Database", icon: "database", color: "#cbd5e1" },
|
|
10169
|
-
api: { name: "API", icon: "server", color: "#cbd5e1" },
|
|
10170
|
-
middleware: { name: "Middleware", icon: "shield", color: "#cbd5e1" },
|
|
10171
|
-
ui: { name: "UI", icon: "layout-dashboard", color: "#cbd5e1" },
|
|
10172
|
-
config: { name: "Config / Seed", icon: "settings", color: "#cbd5e1" },
|
|
10173
|
-
shared: { name: "Shared Types", icon: "box", color: "#cbd5e1" }
|
|
10174
|
-
},
|
|
10175
|
-
center: { color: "#ff0000" }
|
|
10176
|
-
};
|
|
10177
|
-
function loadDefaults(rootDir) {
|
|
10178
|
-
const filePath = (0, import_node_path17.join)(rootDir, ".launchsecure", "blast-radius-defaults.json");
|
|
10179
|
-
try {
|
|
10180
|
-
if (import_node_fs15.default.existsSync(filePath)) {
|
|
10181
|
-
const raw = import_node_fs15.default.readFileSync(filePath, "utf-8");
|
|
10182
|
-
return JSON.parse(raw);
|
|
10183
|
-
}
|
|
10184
|
-
} catch {
|
|
10185
|
-
}
|
|
10186
|
-
return FALLBACK_DEFAULTS;
|
|
10187
|
-
}
|
|
10188
|
-
function generateAcceptance(node, inspect) {
|
|
10189
|
-
const criteria = [];
|
|
10190
|
-
const t = node.type?.toLowerCase() ?? "";
|
|
10191
|
-
if (t === "endpoint" || t === "mcp-tool") {
|
|
10192
|
-
const methods = inspect?.methods ?? [];
|
|
10193
|
-
const path9 = inspect?.path ?? node.id;
|
|
10194
|
-
if (methods.length > 0) {
|
|
10195
|
-
criteria.push(`${methods.join("/")} ${path9} still returns correct responses for authorized users`);
|
|
10196
|
-
} else {
|
|
10197
|
-
criteria.push(`${path9} still responds correctly`);
|
|
10198
|
-
}
|
|
10199
|
-
if (inspect?.auth && inspect.auth.includes("withAuth")) {
|
|
10200
|
-
criteria.push("Authentication and authorization still enforced");
|
|
10201
|
-
}
|
|
10202
|
-
if (inspect?.db_models && inspect.db_models.length > 0) {
|
|
10203
|
-
criteria.push(`DB operations on ${inspect.db_models.join(", ")} still work correctly`);
|
|
10204
|
-
}
|
|
10205
|
-
} else if (t === "page" || t === "component" || t === "layout") {
|
|
10206
|
-
criteria.push(`${node.name} renders without errors`);
|
|
10207
|
-
if (inspect?.stateVars && inspect.stateVars.length > 0) {
|
|
10208
|
-
criteria.push("State management still works correctly");
|
|
10209
|
-
}
|
|
10210
|
-
if (inspect?.elements && inspect.elements.length > 5) {
|
|
10211
|
-
criteria.push("All child components render correctly");
|
|
10212
|
-
}
|
|
10213
|
-
} else if (t === "table" || t === "enum") {
|
|
10214
|
-
criteria.push(`${node.name} schema unchanged or migration applies cleanly`);
|
|
10215
|
-
criteria.push("Existing queries against this table still work");
|
|
10216
|
-
} else if (t === "hook") {
|
|
10217
|
-
criteria.push(`${node.name} returns expected shape`);
|
|
10218
|
-
if (inspect?.stateVars && inspect.stateVars.length > 0) {
|
|
10219
|
-
criteria.push(`State variables [${inspect.stateVars.map((s) => s.name).join(", ")}] still returned`);
|
|
10220
|
-
}
|
|
10221
|
-
} else if (t === "context") {
|
|
10222
|
-
criteria.push(`${node.name} provides correct context to consumers`);
|
|
10223
|
-
} else if (t === "lib" || t === "config" || t === "types") {
|
|
10224
|
-
criteria.push(`${node.name} exports still conform to expected interface`);
|
|
10225
|
-
} else if (t === "seed" || t === "seed_role" || t === "seed_permission") {
|
|
10226
|
-
criteria.push("Seed runs without errors");
|
|
10227
|
-
criteria.push("Expected rows created in database");
|
|
10228
|
-
} else {
|
|
10229
|
-
criteria.push("Verify no regression");
|
|
10230
|
-
}
|
|
10231
|
-
return criteria;
|
|
10232
|
-
}
|
|
10233
|
-
function buildManifest(input) {
|
|
10234
|
-
const { mode, title, description, subtitle, blastResults, createNodes, inspectData, defaults } = input;
|
|
10235
|
-
const nodeMap = /* @__PURE__ */ new Map();
|
|
10236
|
-
const centerNodeIds = /* @__PURE__ */ new Set();
|
|
10237
|
-
for (const result of blastResults) {
|
|
10238
|
-
centerNodeIds.add(result.center.id);
|
|
10239
|
-
for (const node of result.affected) {
|
|
10240
|
-
const existing = nodeMap.get(node.id);
|
|
10241
|
-
if (!existing || node.hop < existing.hop) {
|
|
10242
|
-
nodeMap.set(node.id, node);
|
|
10243
|
-
}
|
|
10244
|
-
}
|
|
10245
|
-
}
|
|
10246
|
-
for (const id of centerNodeIds) {
|
|
10247
|
-
nodeMap.delete(id);
|
|
10248
|
-
}
|
|
10249
|
-
const manifestNodes = [];
|
|
10250
|
-
for (const result of blastResults) {
|
|
10251
|
-
const c = result.center;
|
|
10252
|
-
if (manifestNodes.some((n) => n.id === c.id)) continue;
|
|
10253
|
-
const inspect = inspectData[c.id];
|
|
10254
|
-
manifestNodes.push({
|
|
10255
|
-
id: c.id,
|
|
10256
|
-
name: c.name,
|
|
10257
|
-
layer: c.layer,
|
|
10258
|
-
ring: "modify",
|
|
10259
|
-
type: c.type,
|
|
10260
|
-
reason: `Direct change target`,
|
|
10261
|
-
acceptance: generateAcceptance(
|
|
10262
|
-
{ id: c.id, name: c.name, type: c.type, layer: c.layer, hop: 0 },
|
|
10263
|
-
inspect
|
|
10264
|
-
)
|
|
10265
|
-
});
|
|
10266
|
-
}
|
|
10267
|
-
for (const [, node] of nodeMap) {
|
|
10268
|
-
const ring = node.hop <= 1 ? "modify" : "ripple";
|
|
10269
|
-
const inspect = inspectData[node.id];
|
|
10270
|
-
const reason = node.hop <= 1 ? `Directly depends on changed node` : `Indirect dependency (${node.hop} hops away)`;
|
|
10271
|
-
manifestNodes.push({
|
|
10272
|
-
id: node.id,
|
|
10273
|
-
name: node.name,
|
|
10274
|
-
layer: node.layer,
|
|
10275
|
-
ring,
|
|
10276
|
-
type: node.type,
|
|
10277
|
-
reason,
|
|
10278
|
-
acceptance: generateAcceptance(node, inspect)
|
|
10279
|
-
});
|
|
10280
|
-
}
|
|
10281
|
-
for (const cn of createNodes) {
|
|
10282
|
-
manifestNodes.push({
|
|
10283
|
-
id: cn.id,
|
|
10284
|
-
name: cn.name,
|
|
10285
|
-
layer: cn.layer,
|
|
10286
|
-
ring: "create",
|
|
10287
|
-
type: cn.type ?? "unknown",
|
|
10288
|
-
reason: cn.reason,
|
|
10289
|
-
acceptance: cn.acceptance ?? ["Verify implementation matches spec"]
|
|
10290
|
-
});
|
|
10291
|
-
}
|
|
10292
|
-
const layerIds = /* @__PURE__ */ new Set();
|
|
10293
|
-
for (const n of manifestNodes) {
|
|
10294
|
-
layerIds.add(n.layer);
|
|
10295
|
-
}
|
|
10296
|
-
const layers = [];
|
|
10297
|
-
for (const id of layerIds) {
|
|
10298
|
-
const def = defaults.layers[id];
|
|
10299
|
-
if (def) {
|
|
10300
|
-
layers.push({ id, name: def.name, icon: def.icon, color: def.color });
|
|
10301
|
-
} else {
|
|
10302
|
-
layers.push({ id, name: id, icon: "box", color: "#cbd5e1" });
|
|
10303
|
-
}
|
|
10304
|
-
}
|
|
10305
|
-
const edgeSet = /* @__PURE__ */ new Set();
|
|
10306
|
-
const edges = [];
|
|
10307
|
-
const allNodeIds = new Set(manifestNodes.map((n) => n.id));
|
|
10308
|
-
for (const cId of centerNodeIds) {
|
|
10309
|
-
for (const result of blastResults) {
|
|
10310
|
-
for (const affected of result.affected) {
|
|
10311
|
-
if (affected.hop === 1 && result.center.id === cId && allNodeIds.has(affected.id)) {
|
|
10312
|
-
const key = `${cId}->${affected.id}`;
|
|
10313
|
-
if (!edgeSet.has(key)) {
|
|
10314
|
-
edgeSet.add(key);
|
|
10315
|
-
edges.push({ source: cId, target: affected.id });
|
|
10316
|
-
}
|
|
10317
|
-
}
|
|
10318
|
-
}
|
|
10319
|
-
}
|
|
10320
|
-
}
|
|
10321
|
-
for (const result of blastResults) {
|
|
10322
|
-
if (result.edges) {
|
|
10323
|
-
for (const edge of result.edges) {
|
|
10324
|
-
if (allNodeIds.has(edge.source) && allNodeIds.has(edge.target)) {
|
|
10325
|
-
const key = `${edge.source}->${edge.target}`;
|
|
10326
|
-
if (!edgeSet.has(key)) {
|
|
10327
|
-
edgeSet.add(key);
|
|
10328
|
-
edges.push({ source: edge.source, target: edge.target });
|
|
10329
|
-
}
|
|
10330
|
-
}
|
|
10331
|
-
}
|
|
10332
|
-
}
|
|
10333
|
-
}
|
|
10334
|
-
for (const cn of createNodes) {
|
|
10335
|
-
edges.push({ source: "center", target: cn.id });
|
|
10336
|
-
if (cn.connects_to) {
|
|
10337
|
-
for (const targetId of cn.connects_to) {
|
|
10338
|
-
if (allNodeIds.has(targetId) || createNodes.some((c) => c.id === targetId)) {
|
|
10339
|
-
const key = `${cn.id}->${targetId}`;
|
|
10340
|
-
if (!edgeSet.has(key)) {
|
|
10341
|
-
edgeSet.add(key);
|
|
10342
|
-
edges.push({ source: cn.id, target: targetId });
|
|
10343
|
-
}
|
|
10344
|
-
}
|
|
10345
|
-
}
|
|
10346
|
-
}
|
|
10347
|
-
}
|
|
10348
|
-
return {
|
|
10349
|
-
mode,
|
|
10350
|
-
title,
|
|
10351
|
-
subtitle,
|
|
10352
|
-
layers,
|
|
10353
|
-
rings: defaults.rings,
|
|
10354
|
-
center: { name: title, description },
|
|
10355
|
-
nodes: manifestNodes,
|
|
10356
|
-
edges
|
|
10357
|
-
};
|
|
10358
|
-
}
|
|
10359
|
-
|
|
10360
10383
|
// src/server/lockfile.ts
|
|
10361
10384
|
var import_node_child_process = require("node:child_process");
|
|
10362
10385
|
var import_node_fs16 = require("node:fs");
|
|
10363
10386
|
var import_node_os = require("node:os");
|
|
10364
|
-
var
|
|
10387
|
+
var import_node_path17 = require("node:path");
|
|
10365
10388
|
function lockDir(projectRoot) {
|
|
10366
10389
|
if (projectRoot) {
|
|
10367
|
-
return (0,
|
|
10390
|
+
return (0, import_node_path17.join)(projectRoot, ".launchsecure");
|
|
10368
10391
|
}
|
|
10369
|
-
return (0,
|
|
10392
|
+
return (0, import_node_path17.join)((0, import_node_os.homedir)(), ".launchsecure");
|
|
10370
10393
|
}
|
|
10371
10394
|
function lockPath(projectRoot) {
|
|
10372
|
-
return (0,
|
|
10395
|
+
return (0, import_node_path17.join)(lockDir(projectRoot), "launch-chart.lock");
|
|
10373
10396
|
}
|
|
10374
10397
|
var _activeProjectRoot;
|
|
10375
10398
|
function readLock(projectRoot) {
|
|
@@ -10448,7 +10471,7 @@ init_config();
|
|
|
10448
10471
|
|
|
10449
10472
|
// src/server/graph/core/language-detection.ts
|
|
10450
10473
|
var import_node_fs17 = require("node:fs");
|
|
10451
|
-
var
|
|
10474
|
+
var import_node_path18 = require("node:path");
|
|
10452
10475
|
var EXTENSION_TO_LANGUAGE = {
|
|
10453
10476
|
// Web / Frontend
|
|
10454
10477
|
".ts": "typescript",
|
|
@@ -10571,9 +10594,9 @@ function walkForExtensions(dir, extCounts, depth = 0) {
|
|
|
10571
10594
|
if (entry.name.startsWith(".") && entry.isDirectory()) continue;
|
|
10572
10595
|
if (entry.isDirectory()) {
|
|
10573
10596
|
if (IGNORE_DIRS.has(entry.name)) continue;
|
|
10574
|
-
walkForExtensions((0,
|
|
10597
|
+
walkForExtensions((0, import_node_path18.join)(dir, entry.name), extCounts, depth + 1);
|
|
10575
10598
|
} else {
|
|
10576
|
-
const ext = (0,
|
|
10599
|
+
const ext = (0, import_node_path18.extname)(entry.name).toLowerCase();
|
|
10577
10600
|
if (ext && EXTENSION_TO_LANGUAGE[ext]) {
|
|
10578
10601
|
extCounts.set(ext, (extCounts.get(ext) ?? 0) + 1);
|
|
10579
10602
|
}
|
|
@@ -10615,9 +10638,9 @@ function detectLanguages(rootDir, supportedLanguages) {
|
|
|
10615
10638
|
|
|
10616
10639
|
// src/server/graph/core/audit-core.ts
|
|
10617
10640
|
var import_node_fs18 = require("node:fs");
|
|
10618
|
-
var
|
|
10641
|
+
var import_node_path19 = require("node:path");
|
|
10619
10642
|
function readGraphFile(rootDir, layer) {
|
|
10620
|
-
const filePath = (0,
|
|
10643
|
+
const filePath = (0, import_node_path19.join)(rootDir, ".launchsecure", "graphs", `${layer}.json`);
|
|
10621
10644
|
if (!(0, import_node_fs18.existsSync)(filePath)) return null;
|
|
10622
10645
|
try {
|
|
10623
10646
|
return JSON.parse((0, import_node_fs18.readFileSync)(filePath, "utf-8"));
|
|
@@ -10664,7 +10687,7 @@ function checkUnprotectedRoutes(rootDir) {
|
|
|
10664
10687
|
const api = readGraphFile(rootDir, "api");
|
|
10665
10688
|
const staticGraph = readGraphFile(rootDir, "static");
|
|
10666
10689
|
if (!api) return buildReport("api", "unprotected_routes", findings);
|
|
10667
|
-
const routePermsPath = (0,
|
|
10690
|
+
const routePermsPath = (0, import_node_path19.join)(rootDir, "src", "config", "route-permissions.ts");
|
|
10668
10691
|
let routePermsContent = "";
|
|
10669
10692
|
if ((0, import_node_fs18.existsSync)(routePermsPath)) {
|
|
10670
10693
|
routePermsContent = (0, import_node_fs18.readFileSync)(routePermsPath, "utf-8");
|
|
@@ -10744,7 +10767,7 @@ function checkUnenforcedPermissions(rootDir) {
|
|
|
10744
10767
|
const staticGraph = readGraphFile(rootDir, "static");
|
|
10745
10768
|
if (!staticGraph) return buildReport("static", "unenforced_permissions", findings);
|
|
10746
10769
|
const permissions = staticGraph.nodes.filter((n) => n.type === "seed_permission").map((n) => ({ id: n.id, key: n.value, name: n.name }));
|
|
10747
|
-
const routePermsPath = (0,
|
|
10770
|
+
const routePermsPath = (0, import_node_path19.join)(rootDir, "src", "config", "route-permissions.ts");
|
|
10748
10771
|
let routePermsContent = "";
|
|
10749
10772
|
if ((0, import_node_fs18.existsSync)(routePermsPath)) {
|
|
10750
10773
|
routePermsContent = (0, import_node_fs18.readFileSync)(routePermsPath, "utf-8");
|
|
@@ -10777,7 +10800,7 @@ function checkHardcodedValues(rootDir) {
|
|
|
10777
10800
|
const seen = /* @__PURE__ */ new Set();
|
|
10778
10801
|
for (const node of api.nodes) {
|
|
10779
10802
|
if (node.type !== "endpoint") continue;
|
|
10780
|
-
const filePath = (0,
|
|
10803
|
+
const filePath = (0, import_node_path19.join)(rootDir, "src", node.id);
|
|
10781
10804
|
if (!(0, import_node_fs18.existsSync)(filePath)) continue;
|
|
10782
10805
|
const content = (0, import_node_fs18.readFileSync)(filePath, "utf-8");
|
|
10783
10806
|
let m;
|
|
@@ -11178,81 +11201,6 @@ Example: blast_points(node_id: "server/auth/middleware.ts", hops: 2) \u2192 retu
|
|
|
11178
11201
|
},
|
|
11179
11202
|
required: ["node_id"]
|
|
11180
11203
|
}
|
|
11181
|
-
},
|
|
11182
|
-
{
|
|
11183
|
-
name: "generate_blast_radius",
|
|
11184
|
-
description: `Generate a complete BlastRadiusManifest from graph data \u2014 ready to push to deck.
|
|
11185
|
-
|
|
11186
|
-
Two modes:
|
|
11187
|
-
- **Structural**: single node changed \u2192 auto-discover what's affected via reverse BFS
|
|
11188
|
-
Example: generate_blast_radius({ mode: "structural", node_id: "CommentChannel", title: "CommentChannel refactor" })
|
|
11189
|
-
- **Feature**: new feature \u2192 multiple starting nodes + new nodes to create
|
|
11190
|
-
Example: generate_blast_radius({ mode: "feature", title: "Client Role", description: "...", center_nodes: ["CommentChannel", "ProjectMember"], create_nodes: [{ id: "ChannelMember", name: "ChannelMember table", layer: "db", reason: "..." }] })
|
|
11191
|
-
|
|
11192
|
-
Output is a BlastRadiusManifest JSON that passes directly to the deck tool's blast-radius block.
|
|
11193
|
-
Reads ring/layer/center colors from .launchsecure/blast-radius-defaults.json.
|
|
11194
|
-
Auto-generates acceptance criteria per node using inspect_node AST data.`,
|
|
11195
|
-
inputSchema: {
|
|
11196
|
-
type: "object",
|
|
11197
|
-
properties: {
|
|
11198
|
-
mode: {
|
|
11199
|
-
type: "string",
|
|
11200
|
-
enum: ["structural", "feature"],
|
|
11201
|
-
description: '"structural" = single node changed. "feature" = new feature with multiple nodes.'
|
|
11202
|
-
},
|
|
11203
|
-
title: {
|
|
11204
|
-
type: "string",
|
|
11205
|
-
description: "Title for the blast radius (shown in center node and header)."
|
|
11206
|
-
},
|
|
11207
|
-
description: {
|
|
11208
|
-
type: "string",
|
|
11209
|
-
description: "Description of the change or feature."
|
|
11210
|
-
},
|
|
11211
|
-
subtitle: {
|
|
11212
|
-
type: "string",
|
|
11213
|
-
description: "Optional subtitle shown above title in the viz."
|
|
11214
|
-
},
|
|
11215
|
-
node_id: {
|
|
11216
|
-
type: "string",
|
|
11217
|
-
description: "Structural mode only: the node being changed."
|
|
11218
|
-
},
|
|
11219
|
-
center_nodes: {
|
|
11220
|
-
type: "array",
|
|
11221
|
-
items: { type: "string" },
|
|
11222
|
-
description: "Feature mode: existing graph node IDs that are the starting points for traversal."
|
|
11223
|
-
},
|
|
11224
|
-
create_nodes: {
|
|
11225
|
-
type: "array",
|
|
11226
|
-
items: {
|
|
11227
|
-
type: "object",
|
|
11228
|
-
properties: {
|
|
11229
|
-
id: { type: "string" },
|
|
11230
|
-
name: { type: "string" },
|
|
11231
|
-
layer: { type: "string" },
|
|
11232
|
-
type: { type: "string" },
|
|
11233
|
-
reason: { type: "string" },
|
|
11234
|
-
acceptance: { type: "array", items: { type: "string" } },
|
|
11235
|
-
connects_to: { type: "array", items: { type: "string" }, description: "IDs of existing nodes this new node has FK/relationship edges to." }
|
|
11236
|
-
},
|
|
11237
|
-
required: ["id", "name", "layer", "reason"]
|
|
11238
|
-
},
|
|
11239
|
-
description: "Feature mode: new nodes that need to be created (not in graph yet)."
|
|
11240
|
-
},
|
|
11241
|
-
hops: {
|
|
11242
|
-
type: "number",
|
|
11243
|
-
description: "Max hops for traversal. Default 2. Hop 1 = modify ring, hop 2+ = ripple ring."
|
|
11244
|
-
},
|
|
11245
|
-
push_to_deck: {
|
|
11246
|
-
type: "boolean",
|
|
11247
|
-
description: "If true, pushes the manifest directly to LaunchDeck browser (requires deck server running). Default false."
|
|
11248
|
-
},
|
|
11249
|
-
session: {
|
|
11250
|
-
type: "string",
|
|
11251
|
-
description: "Session name for the deck tab. Required when push_to_deck is true."
|
|
11252
|
-
}
|
|
11253
|
-
},
|
|
11254
|
-
required: ["title"]
|
|
11255
|
-
}
|
|
11256
11204
|
}
|
|
11257
11205
|
];
|
|
11258
11206
|
function matchesSearch(node, query) {
|
|
@@ -11529,144 +11477,6 @@ function handleBlastPoints(args) {
|
|
|
11529
11477
|
}
|
|
11530
11478
|
});
|
|
11531
11479
|
}
|
|
11532
|
-
function handleGenerateBlastRadius(args) {
|
|
11533
|
-
const rootDir = process.cwd();
|
|
11534
|
-
const mode = args.mode ?? "structural";
|
|
11535
|
-
const title = args.title;
|
|
11536
|
-
const description = args.description ?? title;
|
|
11537
|
-
const subtitle = args.subtitle;
|
|
11538
|
-
const hops = args.hops ?? 2;
|
|
11539
|
-
const defaults = loadDefaults(rootDir);
|
|
11540
|
-
let centerNodeIds = [];
|
|
11541
|
-
if (mode === "structural") {
|
|
11542
|
-
const nodeId = args.node_id;
|
|
11543
|
-
if (!nodeId) return err("structural mode requires node_id");
|
|
11544
|
-
centerNodeIds = [nodeId];
|
|
11545
|
-
} else {
|
|
11546
|
-
centerNodeIds = args.center_nodes ?? [];
|
|
11547
|
-
if (centerNodeIds.length === 0) return err("feature mode requires center_nodes[]");
|
|
11548
|
-
}
|
|
11549
|
-
const createNodes = args.create_nodes ?? [];
|
|
11550
|
-
const blastResults = [];
|
|
11551
|
-
for (const nodeId of centerNodeIds) {
|
|
11552
|
-
let targetLayer;
|
|
11553
|
-
const graphs = readAllGraphs(rootDir);
|
|
11554
|
-
for (const [layer, graph2] of Object.entries(graphs)) {
|
|
11555
|
-
if (graph2 && graph2.nodes.some((n) => n.id === nodeId)) {
|
|
11556
|
-
targetLayer = layer;
|
|
11557
|
-
break;
|
|
11558
|
-
}
|
|
11559
|
-
}
|
|
11560
|
-
if (!targetLayer) continue;
|
|
11561
|
-
const graph = readGraph(rootDir, targetLayer);
|
|
11562
|
-
if (!graph) continue;
|
|
11563
|
-
const center = graph.nodes.find((n) => n.id === nodeId);
|
|
11564
|
-
if (!center) continue;
|
|
11565
|
-
const result2 = reverseNeighborhood(graph, nodeId, hops, "reverse");
|
|
11566
|
-
const affected = [];
|
|
11567
|
-
for (const [id, { node, hop }] of result2.nodes) {
|
|
11568
|
-
if (id === nodeId) continue;
|
|
11569
|
-
const tags = node.tags;
|
|
11570
|
-
affected.push({ id: node.id, name: node.name, type: node.type, layer: targetLayer, hop, module: tags?.module });
|
|
11571
|
-
}
|
|
11572
|
-
const otherLayers = getAvailableLayers(rootDir).filter((l) => l !== targetLayer && l !== "static");
|
|
11573
|
-
for (const otherLayer of otherLayers) {
|
|
11574
|
-
const otherGraph = readGraph(rootDir, otherLayer);
|
|
11575
|
-
if (!otherGraph) continue;
|
|
11576
|
-
for (const edge of otherGraph.edges) {
|
|
11577
|
-
if (edge.target === nodeId || edge.source === nodeId) {
|
|
11578
|
-
const dependentId = edge.target === nodeId ? edge.source : edge.target;
|
|
11579
|
-
if (affected.some((a) => a.id === dependentId)) continue;
|
|
11580
|
-
const depNode = otherGraph.nodes.find((n) => n.id === dependentId);
|
|
11581
|
-
if (depNode) {
|
|
11582
|
-
const tags = depNode.tags;
|
|
11583
|
-
affected.push({ id: depNode.id, name: depNode.name, type: depNode.type, layer: otherLayer, hop: 1, module: tags?.module });
|
|
11584
|
-
}
|
|
11585
|
-
}
|
|
11586
|
-
}
|
|
11587
|
-
}
|
|
11588
|
-
const centerTags = center.tags;
|
|
11589
|
-
const edges = result2.edges.map((e) => ({ source: e.source, target: e.target }));
|
|
11590
|
-
blastResults.push({
|
|
11591
|
-
center: { id: center.id, name: center.name, type: center.type, layer: targetLayer, module: centerTags?.module },
|
|
11592
|
-
affected,
|
|
11593
|
-
edges
|
|
11594
|
-
});
|
|
11595
|
-
}
|
|
11596
|
-
if (blastResults.length === 0) {
|
|
11597
|
-
return err(`None of the center nodes were found in any graph layer: ${centerNodeIds.join(", ")}`);
|
|
11598
|
-
}
|
|
11599
|
-
const inspectData = {};
|
|
11600
|
-
const allAffectedIds = /* @__PURE__ */ new Set();
|
|
11601
|
-
for (const r of blastResults) {
|
|
11602
|
-
allAffectedIds.add(r.center.id);
|
|
11603
|
-
for (const a of r.affected) allAffectedIds.add(a.id);
|
|
11604
|
-
}
|
|
11605
|
-
const allGraphs = readAllGraphs(rootDir);
|
|
11606
|
-
for (const id of allAffectedIds) {
|
|
11607
|
-
for (const [, graph] of Object.entries(allGraphs)) {
|
|
11608
|
-
if (!graph) continue;
|
|
11609
|
-
const node = graph.nodes.find((n) => n.id === id);
|
|
11610
|
-
if (node) {
|
|
11611
|
-
inspectData[id] = {
|
|
11612
|
-
type: node.type,
|
|
11613
|
-
name: node.name,
|
|
11614
|
-
methods: node.methods,
|
|
11615
|
-
path: node.path ?? node.handler,
|
|
11616
|
-
auth: node.auth,
|
|
11617
|
-
db_models: node.db_models
|
|
11618
|
-
};
|
|
11619
|
-
break;
|
|
11620
|
-
}
|
|
11621
|
-
}
|
|
11622
|
-
}
|
|
11623
|
-
const manifest = buildManifest({
|
|
11624
|
-
mode,
|
|
11625
|
-
title,
|
|
11626
|
-
description,
|
|
11627
|
-
subtitle,
|
|
11628
|
-
blastResults,
|
|
11629
|
-
createNodes,
|
|
11630
|
-
inspectData,
|
|
11631
|
-
defaults
|
|
11632
|
-
});
|
|
11633
|
-
const pushToDeck = args.push_to_deck;
|
|
11634
|
-
const session = args.session;
|
|
11635
|
-
let deckResult;
|
|
11636
|
-
if (pushToDeck) {
|
|
11637
|
-
if (!session) return err("push_to_deck requires a session name");
|
|
11638
|
-
const deckLockPath = (0, import_node_path21.join)(rootDir, ".launchsecure", "launch-deck.lock");
|
|
11639
|
-
if (!(0, import_node_fs19.existsSync)(deckLockPath)) {
|
|
11640
|
-
deckResult = { pushed: false, reason: "Deck server not running (no lock file). Push manually via deck tool." };
|
|
11641
|
-
} else {
|
|
11642
|
-
try {
|
|
11643
|
-
const lock = JSON.parse((0, import_node_fs19.readFileSync)(deckLockPath, "utf-8"));
|
|
11644
|
-
const deckUrl = lock.url;
|
|
11645
|
-
const body = JSON.stringify({
|
|
11646
|
-
session,
|
|
11647
|
-
mode: "show",
|
|
11648
|
-
blocks: [{ type: "blast-radius", label: title, manifest }]
|
|
11649
|
-
});
|
|
11650
|
-
(0, import_node_child_process2.execFileSync)("curl", [
|
|
11651
|
-
"-s",
|
|
11652
|
-
"-X",
|
|
11653
|
-
"POST",
|
|
11654
|
-
deckUrl + "/api/deck",
|
|
11655
|
-
"-H",
|
|
11656
|
-
"Content-Type: application/json",
|
|
11657
|
-
"-d",
|
|
11658
|
-
body
|
|
11659
|
-
], { timeout: 5e3, stdio: ["ignore", "pipe", "ignore"] });
|
|
11660
|
-
deckResult = { pushed: true, session, url: deckUrl };
|
|
11661
|
-
} catch (e) {
|
|
11662
|
-
deckResult = { pushed: false, reason: `Failed to push to deck: ${e}` };
|
|
11663
|
-
}
|
|
11664
|
-
}
|
|
11665
|
-
}
|
|
11666
|
-
const result = { ...manifest };
|
|
11667
|
-
if (deckResult) result._deck = deckResult;
|
|
11668
|
-
return okJson(result);
|
|
11669
|
-
}
|
|
11670
11480
|
function layerSummary(graph) {
|
|
11671
11481
|
const typeCounts = {};
|
|
11672
11482
|
const moduleCounts = {};
|
|
@@ -11895,11 +11705,11 @@ function handleReadGraph(args) {
|
|
|
11895
11705
|
return okJson(result);
|
|
11896
11706
|
}
|
|
11897
11707
|
function nodeToFilePath(rootDir, layer, nodeId) {
|
|
11898
|
-
if (layer === "ui" || layer === "api") return (0,
|
|
11899
|
-
if (layer === "db") return (0,
|
|
11900
|
-
const withSrc = (0,
|
|
11708
|
+
if (layer === "ui" || layer === "api") return (0, import_node_path20.join)(rootDir, "src", nodeId);
|
|
11709
|
+
if (layer === "db") return (0, import_node_path20.join)(rootDir, "prisma", "schema.prisma");
|
|
11710
|
+
const withSrc = (0, import_node_path20.join)(rootDir, "src", nodeId);
|
|
11901
11711
|
if ((0, import_node_fs19.existsSync)(withSrc)) return withSrc;
|
|
11902
|
-
const direct = (0,
|
|
11712
|
+
const direct = (0, import_node_path20.join)(rootDir, nodeId);
|
|
11903
11713
|
if ((0, import_node_fs19.existsSync)(direct)) return direct;
|
|
11904
11714
|
return null;
|
|
11905
11715
|
}
|
|
@@ -12112,9 +11922,9 @@ function handleStartChartServer(args) {
|
|
|
12112
11922
|
});
|
|
12113
11923
|
}
|
|
12114
11924
|
const entryPath = process.argv[1];
|
|
12115
|
-
const logDir = (0,
|
|
11925
|
+
const logDir = (0, import_node_path20.join)((0, import_node_os2.homedir)(), ".launchsecure");
|
|
12116
11926
|
(0, import_node_fs19.mkdirSync)(logDir, { recursive: true });
|
|
12117
|
-
const logPath = (0,
|
|
11927
|
+
const logPath = (0, import_node_path20.join)(logDir, "launch-chart.log");
|
|
12118
11928
|
const out = (0, import_node_fs19.openSync)(logPath, "a");
|
|
12119
11929
|
const err2 = (0, import_node_fs19.openSync)(logPath, "a");
|
|
12120
11930
|
const portArgs = args.port ? ["--port", String(args.port)] : [];
|
|
@@ -12236,18 +12046,18 @@ function handleDetectProjectStack() {
|
|
|
12236
12046
|
if (ref.type === "references_api") stats.references_api++;
|
|
12237
12047
|
}
|
|
12238
12048
|
}
|
|
12239
|
-
const srcDir = (0,
|
|
12049
|
+
const srcDir = (0, import_node_path20.join)(rootDir, "src");
|
|
12240
12050
|
if ((0, import_node_fs19.existsSync)(srcDir)) {
|
|
12241
12051
|
const scanDir = (dir) => {
|
|
12242
12052
|
if (!(0, import_node_fs19.existsSync)(dir)) return;
|
|
12243
12053
|
for (const entry of (0, import_node_fs19.readdirSync)(dir, { withFileTypes: true })) {
|
|
12244
12054
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
12245
|
-
const full = (0,
|
|
12055
|
+
const full = (0, import_node_path20.join)(dir, entry.name);
|
|
12246
12056
|
if (entry.isDirectory()) {
|
|
12247
12057
|
scanDir(full);
|
|
12248
12058
|
continue;
|
|
12249
12059
|
}
|
|
12250
|
-
if (![".ts", ".tsx"].includes((0,
|
|
12060
|
+
if (![".ts", ".tsx"].includes((0, import_node_path20.extname)(entry.name))) continue;
|
|
12251
12061
|
try {
|
|
12252
12062
|
const content = (0, import_node_fs19.readFileSync)(full, "utf-8");
|
|
12253
12063
|
const matches = content.match(/@api\s+(GET|POST|PUT|DELETE|PATCH)\s+\/\S+/g);
|
|
@@ -12368,10 +12178,6 @@ async function handleMessage(msg) {
|
|
|
12368
12178
|
respond(id ?? null, handleBlastPoints(args));
|
|
12369
12179
|
return;
|
|
12370
12180
|
}
|
|
12371
|
-
if (toolName === "generate_blast_radius") {
|
|
12372
|
-
respond(id ?? null, handleGenerateBlastRadius(args));
|
|
12373
|
-
return;
|
|
12374
|
-
}
|
|
12375
12181
|
respondError(id ?? null, -32601, `Unknown tool: ${toolName}`);
|
|
12376
12182
|
return;
|
|
12377
12183
|
}
|
|
@@ -12472,7 +12278,7 @@ function parseArgs() {
|
|
|
12472
12278
|
return { port, token, serverUrl: LAUNCHSECURE_URL, subcommand };
|
|
12473
12279
|
}
|
|
12474
12280
|
function tryListen(server, port, maxRetries = 10) {
|
|
12475
|
-
return new Promise((
|
|
12281
|
+
return new Promise((resolve4, reject) => {
|
|
12476
12282
|
let attempts = 0;
|
|
12477
12283
|
function attempt(p) {
|
|
12478
12284
|
server.once("error", (err2) => {
|
|
@@ -12483,7 +12289,7 @@ function tryListen(server, port, maxRetries = 10) {
|
|
|
12483
12289
|
reject(err2);
|
|
12484
12290
|
}
|
|
12485
12291
|
});
|
|
12486
|
-
server.listen(p, () =>
|
|
12292
|
+
server.listen(p, () => resolve4(p));
|
|
12487
12293
|
}
|
|
12488
12294
|
attempt(port);
|
|
12489
12295
|
});
|
|
@@ -12504,7 +12310,7 @@ function saveCredentials(creds) {
|
|
|
12504
12310
|
});
|
|
12505
12311
|
}
|
|
12506
12312
|
function verifyToken(serverUrl, token) {
|
|
12507
|
-
return new Promise((
|
|
12313
|
+
return new Promise((resolve4) => {
|
|
12508
12314
|
const url = new URL("/api/mcp/verify", serverUrl);
|
|
12509
12315
|
const body = JSON.stringify({ token });
|
|
12510
12316
|
const mod = url.protocol === "https:" ? import_https.default : import_http.default;
|
|
@@ -12519,30 +12325,30 @@ function verifyToken(serverUrl, token) {
|
|
|
12519
12325
|
res.on("data", (chunk) => data += chunk);
|
|
12520
12326
|
res.on("end", () => {
|
|
12521
12327
|
try {
|
|
12522
|
-
|
|
12328
|
+
resolve4(JSON.parse(data));
|
|
12523
12329
|
} catch {
|
|
12524
|
-
|
|
12330
|
+
resolve4({ valid: false, error: "Invalid response from server" });
|
|
12525
12331
|
}
|
|
12526
12332
|
});
|
|
12527
12333
|
});
|
|
12528
12334
|
req.on("error", (err2) => {
|
|
12529
|
-
|
|
12335
|
+
resolve4({ valid: false, error: `Cannot reach server: ${err2.message}` });
|
|
12530
12336
|
});
|
|
12531
12337
|
req.setTimeout(1e4, () => {
|
|
12532
12338
|
req.destroy();
|
|
12533
|
-
|
|
12339
|
+
resolve4({ valid: false, error: "Connection timed out" });
|
|
12534
12340
|
});
|
|
12535
12341
|
req.write(body);
|
|
12536
12342
|
req.end();
|
|
12537
12343
|
});
|
|
12538
12344
|
}
|
|
12539
12345
|
function httpRequest(reqUrl, options, body, timeout = 3e4) {
|
|
12540
|
-
return new Promise((
|
|
12346
|
+
return new Promise((resolve4, reject) => {
|
|
12541
12347
|
const mod = reqUrl.protocol === "https:" ? import_https.default : import_http.default;
|
|
12542
12348
|
const r = mod.request(reqUrl, options, (resp) => {
|
|
12543
12349
|
let data = "";
|
|
12544
12350
|
resp.on("data", (chunk) => data += chunk);
|
|
12545
|
-
resp.on("end", () =>
|
|
12351
|
+
resp.on("end", () => resolve4({ status: resp.statusCode || 0, headers: resp.headers, body: data }));
|
|
12546
12352
|
});
|
|
12547
12353
|
r.on("error", reject);
|
|
12548
12354
|
r.setTimeout(timeout, () => {
|
|
@@ -12803,7 +12609,7 @@ function parseTrackerData(result) {
|
|
|
12803
12609
|
} else if (result && typeof result === "object") {
|
|
12804
12610
|
obj = result;
|
|
12805
12611
|
}
|
|
12806
|
-
const agents = obj.agents ?? obj;
|
|
12612
|
+
const agents = obj.nodes ?? obj.agents ?? obj;
|
|
12807
12613
|
const interventions = Array.isArray(obj.interventions) ? obj.interventions : [];
|
|
12808
12614
|
const run = obj.run;
|
|
12809
12615
|
const runStatus = typeof run?.status === "string" ? run.status : void 0;
|
|
@@ -12824,7 +12630,9 @@ async function startPipelineSystem(creds, capabilities) {
|
|
|
12824
12630
|
{}
|
|
12825
12631
|
);
|
|
12826
12632
|
const graphData = graphResult.data ?? graphResult;
|
|
12827
|
-
const adapter = new ClaudeTerminalAdapter(
|
|
12633
|
+
const adapter = new ClaudeTerminalAdapter({
|
|
12634
|
+
mcpServers: { token: creds.token, serverUrl: creds.serverUrl }
|
|
12635
|
+
});
|
|
12828
12636
|
triggerController = new NodeTriggerController({
|
|
12829
12637
|
adapter,
|
|
12830
12638
|
graphData,
|
|
@@ -12946,7 +12754,7 @@ async function startPipelineSystem(creds, capabilities) {
|
|
|
12946
12754
|
creds.serverUrl,
|
|
12947
12755
|
creds.token,
|
|
12948
12756
|
"tracker_read",
|
|
12949
|
-
{ fields: ["run", "
|
|
12757
|
+
{ fields: ["run", "nodes", "interventions"] }
|
|
12950
12758
|
);
|
|
12951
12759
|
const data = parseTrackerData(result);
|
|
12952
12760
|
latestAgents = data.agents;
|
|
@@ -13110,7 +12918,7 @@ if (!__isMcpMode) {
|
|
|
13110
12918
|
res.end(JSON.stringify({ error: "Not authenticated" }));
|
|
13111
12919
|
return;
|
|
13112
12920
|
}
|
|
13113
|
-
mcpToolCall(creds.serverUrl, creds.token, "tracker_read", { fields: ["run", "
|
|
12921
|
+
mcpToolCall(creds.serverUrl, creds.token, "tracker_read", { fields: ["run", "nodes", "interventions"] }).then((result) => {
|
|
13114
12922
|
const { agents, interventions, runStatus } = parseTrackerData(result);
|
|
13115
12923
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
13116
12924
|
res.end(JSON.stringify({ agents, interventions, runStatus }));
|