@launchsecure/launch-kit 0.0.18 → 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-C8ANseEa.js +441 -0
- package/dist/chart-client/index.html +1 -1
- package/dist/deck-client/assets/{_baseUniq-2gclQXo7.js → _baseUniq-DsfOm3t_.js} +1 -1
- package/dist/deck-client/assets/{arc-DcMY5Wm0.js → arc-NJuvkBv1.js} +1 -1
- package/dist/deck-client/assets/{architectureDiagram-Q4EWVU46-B8iirmmJ.js → architectureDiagram-Q4EWVU46-BgrcgZs0.js} +1 -1
- package/dist/deck-client/assets/{blockDiagram-DXYQGD6D-B4JBLjmJ.js → blockDiagram-DXYQGD6D-C3XoLi15.js} +1 -1
- package/dist/deck-client/assets/{c4Diagram-AHTNJAMY-CojrJAk8.js → c4Diagram-AHTNJAMY-FX2PjLfb.js} +1 -1
- package/dist/deck-client/assets/channel-ChQjD1T1.js +1 -0
- package/dist/deck-client/assets/{chunk-4BX2VUAB-Bmb_BMDo.js → chunk-4BX2VUAB-D0aqsJV0.js} +1 -1
- package/dist/deck-client/assets/{chunk-4TB4RGXK-CumBy8qe.js → chunk-4TB4RGXK-7qRCCAgK.js} +1 -1
- package/dist/deck-client/assets/{chunk-55IACEB6-Ka8Hb1wD.js → chunk-55IACEB6-DfHG-iqb.js} +1 -1
- package/dist/deck-client/assets/{chunk-EDXVE4YY-B3sIPiQo.js → chunk-EDXVE4YY-DrR52j3B.js} +1 -1
- package/dist/deck-client/assets/{chunk-FMBD7UC4-C1tYkaqu.js → chunk-FMBD7UC4-D5KSGATB.js} +1 -1
- package/dist/deck-client/assets/{chunk-OYMX7WX6-D7Wacbky.js → chunk-OYMX7WX6-M7hsLRNU.js} +1 -1
- package/dist/deck-client/assets/{chunk-QZHKN3VN-ChXI0vO3.js → chunk-QZHKN3VN-1ynAWO2m.js} +1 -1
- package/dist/deck-client/assets/{chunk-YZCP3GAM-BXhiqf8u.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-Bqp3p68D.js → cose-bilkent-S5V4N54A-BcMwozS2.js} +1 -1
- package/dist/deck-client/assets/{dagre-KV5264BT-BS-rtyhZ.js → dagre-KV5264BT-DtKMhl_1.js} +1 -1
- package/dist/deck-client/assets/{diagram-5BDNPKRD-BIrj9YGI.js → diagram-5BDNPKRD-1plH69us.js} +1 -1
- package/dist/deck-client/assets/{diagram-G4DWMVQ6-noHWPIg4.js → diagram-G4DWMVQ6-D_o-BHO3.js} +1 -1
- package/dist/deck-client/assets/{diagram-MMDJMWI5-C2qHxvqV.js → diagram-MMDJMWI5-ClZ1LIx6.js} +1 -1
- package/dist/deck-client/assets/{diagram-TYMM5635-BytnGQr-.js → diagram-TYMM5635-B8dKHfRh.js} +1 -1
- package/dist/deck-client/assets/{erDiagram-SMLLAGMA-BfK5m2YQ.js → erDiagram-SMLLAGMA-CY2aCH7-.js} +1 -1
- package/dist/deck-client/assets/{flowDiagram-DWJPFMVM-Cq925G1Z.js → flowDiagram-DWJPFMVM-DZZWHti8.js} +1 -1
- package/dist/deck-client/assets/{ganttDiagram-T4ZO3ILL-DhhHPAmj.js → ganttDiagram-T4ZO3ILL-OwGGa6Lu.js} +1 -1
- package/dist/deck-client/assets/{gitGraphDiagram-UUTBAWPF-B3Lc0h9q.js → gitGraphDiagram-UUTBAWPF-GKyWD4Qt.js} +1 -1
- package/dist/deck-client/assets/{graph-RTawgVWm.js → graph-CORzYQdB.js} +1 -1
- package/dist/deck-client/assets/{index-BfIfJXmS.js → index-hiIpM7EP.js} +3 -3
- package/dist/deck-client/assets/{infoDiagram-42DDH7IO-BlR584kX.js → infoDiagram-42DDH7IO-DmgqJCcF.js} +1 -1
- package/dist/deck-client/assets/{ishikawaDiagram-UXIWVN3A-DygKoNGY.js → ishikawaDiagram-UXIWVN3A-D-1v7knu.js} +1 -1
- package/dist/deck-client/assets/{journeyDiagram-VCZTEJTY-BnaiYp9N.js → journeyDiagram-VCZTEJTY-CYrGQE7b.js} +1 -1
- package/dist/deck-client/assets/{kanban-definition-6JOO6SKY-BQBUBzJC.js → kanban-definition-6JOO6SKY-BJFDWiH-.js} +1 -1
- package/dist/deck-client/assets/{layout-DeZ8HI1T.js → layout-BTFFcaxF.js} +1 -1
- package/dist/deck-client/assets/{linear-C6roLi_9.js → linear-DAbl6COS.js} +1 -1
- package/dist/deck-client/assets/{min-CbUksbuI.js → min-oWHBrFBm.js} +1 -1
- package/dist/deck-client/assets/{mindmap-definition-QFDTVHPH-iNxV62yN.js → mindmap-definition-QFDTVHPH-BTCB0VLO.js} +1 -1
- package/dist/deck-client/assets/{pieDiagram-DEJITSTG-DHVA0jaG.js → pieDiagram-DEJITSTG-CUZChWNA.js} +1 -1
- package/dist/deck-client/assets/{quadrantDiagram-34T5L4WZ-DBeKKLUQ.js → quadrantDiagram-34T5L4WZ-4M1Um_e4.js} +1 -1
- package/dist/deck-client/assets/{requirementDiagram-MS252O5E-CBwITx7p.js → requirementDiagram-MS252O5E-DLzQZ0B3.js} +1 -1
- package/dist/deck-client/assets/{sankeyDiagram-XADWPNL6-BtE-1YTU.js → sankeyDiagram-XADWPNL6-DcNgzV3E.js} +1 -1
- package/dist/deck-client/assets/{sequenceDiagram-FGHM5R23-DN96yPP2.js → sequenceDiagram-FGHM5R23-CAcI2vC9.js} +1 -1
- package/dist/deck-client/assets/{stateDiagram-FHFEXIEX-VUkKC2uJ.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-oUeZhRns.js → timeline-definition-GMOUNBTQ-D8zrit4U.js} +1 -1
- package/dist/deck-client/assets/{vennDiagram-DHZGUBPP-D87fK90n.js → vennDiagram-DHZGUBPP-C4SuFPgo.js} +1 -1
- package/dist/deck-client/assets/wardley-RL74JXVD-B3F-Olcq.js +162 -0
- package/dist/deck-client/assets/{wardleyDiagram-NUSXRM2D-Ca_i0QRA.js → wardleyDiagram-NUSXRM2D-kj73r6f-.js} +1 -1
- package/dist/deck-client/assets/{xychartDiagram-5P7HB3ND-CUOJVIvq.js → xychartDiagram-5P7HB3ND-CC_d_Ey3.js} +1 -1
- package/dist/deck-client/index.html +1 -1
- package/dist/server/chart-serve.js +392 -169
- package/dist/server/cli.js +384 -168
- package/dist/server/council-entry.js +0 -0
- package/dist/server/deck-server/deck-mcp-entry.js +0 -0
- package/dist/server/fb-wizard.js +0 -0
- package/dist/server/graph-mcp-entry.js +430 -206
- package/dist/server/server/cli.js +0 -0
- package/dist/server/server/fb-wizard.js +0 -0
- package/dist/server/server/graph-mcp-entry.js +0 -0
- package/package.json +18 -17
- package/dist/chart-client/assets/index-D7x8nz-H.js +0 -441
- package/dist/deck-client/assets/channel-ERh5jKXV.js +0 -1
- package/dist/deck-client/assets/classDiagram-6PBFFD2Q-CMi1Gaev.js +0 -1
- package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-CMi1Gaev.js +0 -1
- package/dist/deck-client/assets/clone-DfWhlD4X.js +0 -1
- package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-CA0IjulK.js +0 -1
- package/dist/deck-client/assets/wardley-RL74JXVD-DYbYcpDp.js +0 -162
|
@@ -155,48 +155,15 @@ var init_config = __esm({
|
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
// src/server/graph/core/resolve-paths.ts
|
|
159
|
-
function detectDbDir(rootDir, config) {
|
|
160
|
-
if (config.paths?.dbDir) return (0, import_node_path3.join)(rootDir, config.paths.dbDir);
|
|
161
|
-
const prismaDir = (0, import_node_path3.join)(rootDir, "prisma");
|
|
162
|
-
if ((0, import_node_fs3.existsSync)(prismaDir)) return prismaDir;
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
function resolveProjectPaths(rootDir, config) {
|
|
166
|
-
const dbDir = detectDbDir(rootDir, config);
|
|
167
|
-
if (config.paths?.appDir) {
|
|
168
|
-
const appDir = (0, import_node_path3.join)(rootDir, config.paths.appDir);
|
|
169
|
-
const srcDir = config.paths.srcDir ? (0, import_node_path3.join)(rootDir, config.paths.srcDir) : (0, import_node_path3.dirname)(appDir);
|
|
170
|
-
return { srcDir, appDir, apiDir: (0, import_node_path3.join)(appDir, "api"), dbDir };
|
|
171
|
-
}
|
|
172
|
-
const srcApp = (0, import_node_path3.join)(rootDir, "src", "app");
|
|
173
|
-
if ((0, import_node_fs3.existsSync)(srcApp)) {
|
|
174
|
-
return { srcDir: (0, import_node_path3.join)(rootDir, "src"), appDir: srcApp, apiDir: (0, import_node_path3.join)(srcApp, "api"), dbDir };
|
|
175
|
-
}
|
|
176
|
-
const rootApp = (0, import_node_path3.join)(rootDir, "app");
|
|
177
|
-
if ((0, import_node_fs3.existsSync)(rootApp)) {
|
|
178
|
-
return { srcDir: rootDir, appDir: rootApp, apiDir: (0, import_node_path3.join)(rootApp, "api"), dbDir };
|
|
179
|
-
}
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
var import_node_fs3, import_node_path3;
|
|
183
|
-
var init_resolve_paths = __esm({
|
|
184
|
-
"src/server/graph/core/resolve-paths.ts"() {
|
|
185
|
-
"use strict";
|
|
186
|
-
import_node_fs3 = require("node:fs");
|
|
187
|
-
import_node_path3 = require("node:path");
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
|
|
191
158
|
// src/server/graph/core/walk.ts
|
|
192
159
|
function walk(dir, exts) {
|
|
193
160
|
const results = [];
|
|
194
|
-
if (!(0,
|
|
195
|
-
for (const entry of (0,
|
|
196
|
-
const full = (0,
|
|
161
|
+
if (!(0, import_node_fs3.existsSync)(dir)) return results;
|
|
162
|
+
for (const entry of (0, import_node_fs3.readdirSync)(dir, { withFileTypes: true })) {
|
|
163
|
+
const full = (0, import_node_path3.join)(dir, entry.name);
|
|
197
164
|
if (entry.isDirectory()) {
|
|
198
165
|
results.push(...walk(full, exts));
|
|
199
|
-
} else if (exts.includes((0,
|
|
166
|
+
} else if (exts.includes((0, import_node_path3.extname)(entry.name))) {
|
|
200
167
|
results.push(full);
|
|
201
168
|
}
|
|
202
169
|
}
|
|
@@ -204,24 +171,24 @@ function walk(dir, exts) {
|
|
|
204
171
|
}
|
|
205
172
|
function walkWithIgnore(dir, exts, opts = {}) {
|
|
206
173
|
const results = [];
|
|
207
|
-
if (!(0,
|
|
174
|
+
if (!(0, import_node_fs3.existsSync)(dir)) return results;
|
|
208
175
|
const skip = opts.extraIgnore ? /* @__PURE__ */ new Set([...DEFAULT_IGNORE_DIRS, ...opts.extraIgnore]) : DEFAULT_IGNORE_DIRS;
|
|
209
|
-
for (const entry of (0,
|
|
176
|
+
for (const entry of (0, import_node_fs3.readdirSync)(dir, { withFileTypes: true })) {
|
|
210
177
|
if (entry.isDirectory()) {
|
|
211
178
|
if (skip.has(entry.name)) continue;
|
|
212
|
-
results.push(...walkWithIgnore((0,
|
|
213
|
-
} else if (exts.includes((0,
|
|
214
|
-
results.push((0,
|
|
179
|
+
results.push(...walkWithIgnore((0, import_node_path3.join)(dir, entry.name), exts, opts));
|
|
180
|
+
} else if (exts.includes((0, import_node_path3.extname)(entry.name))) {
|
|
181
|
+
results.push((0, import_node_path3.join)(dir, entry.name));
|
|
215
182
|
}
|
|
216
183
|
}
|
|
217
184
|
return results;
|
|
218
185
|
}
|
|
219
|
-
var
|
|
186
|
+
var import_node_fs3, import_node_path3, DEFAULT_IGNORE_DIRS;
|
|
220
187
|
var init_walk = __esm({
|
|
221
188
|
"src/server/graph/core/walk.ts"() {
|
|
222
189
|
"use strict";
|
|
223
|
-
|
|
224
|
-
|
|
190
|
+
import_node_fs3 = require("node:fs");
|
|
191
|
+
import_node_path3 = require("node:path");
|
|
225
192
|
DEFAULT_IGNORE_DIRS = /* @__PURE__ */ new Set([
|
|
226
193
|
"node_modules",
|
|
227
194
|
".git",
|
|
@@ -238,6 +205,201 @@ var init_walk = __esm({
|
|
|
238
205
|
}
|
|
239
206
|
});
|
|
240
207
|
|
|
208
|
+
// src/server/graph/core/resolve-paths.ts
|
|
209
|
+
function hasSqlFiles(dir) {
|
|
210
|
+
if (!(0, import_node_fs4.existsSync)(dir)) return false;
|
|
211
|
+
try {
|
|
212
|
+
return (0, import_node_fs4.readdirSync)(dir, { withFileTypes: true }).some(
|
|
213
|
+
(e) => e.isFile() && e.name.endsWith(".sql")
|
|
214
|
+
);
|
|
215
|
+
} catch {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function hasNestedMigrationSql(dir) {
|
|
220
|
+
if (!(0, import_node_fs4.existsSync)(dir)) return false;
|
|
221
|
+
try {
|
|
222
|
+
return (0, import_node_fs4.readdirSync)(dir, { withFileTypes: true }).some(
|
|
223
|
+
(e) => e.isDirectory() && (0, import_node_fs4.existsSync)((0, import_node_path4.join)(dir, e.name, "migration.sql"))
|
|
224
|
+
);
|
|
225
|
+
} catch {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function resolveDbFromDir(dir) {
|
|
230
|
+
if (!(0, import_node_fs4.existsSync)(dir)) return { kind: "none", schemaPath: null, migrationsDir: null };
|
|
231
|
+
const schemaPath = (0, import_node_path4.join)(dir, "schema.prisma");
|
|
232
|
+
if ((0, import_node_fs4.existsSync)(schemaPath)) {
|
|
233
|
+
const migrationsDir2 = (0, import_node_path4.join)(dir, "migrations");
|
|
234
|
+
return {
|
|
235
|
+
kind: "prisma",
|
|
236
|
+
schemaPath,
|
|
237
|
+
migrationsDir: (0, import_node_fs4.existsSync)(migrationsDir2) ? migrationsDir2 : null
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
const migrationsDir = (0, import_node_path4.join)(dir, "migrations");
|
|
241
|
+
if (hasSqlFiles(migrationsDir) || hasNestedMigrationSql(migrationsDir)) {
|
|
242
|
+
return { kind: "sql-migrations", migrationsDir, schemaPath: null };
|
|
243
|
+
}
|
|
244
|
+
if (hasSqlFiles(dir) || hasNestedMigrationSql(dir)) {
|
|
245
|
+
return { kind: "sql-migrations", migrationsDir: dir, schemaPath: null };
|
|
246
|
+
}
|
|
247
|
+
return { kind: "none", schemaPath: null, migrationsDir: null };
|
|
248
|
+
}
|
|
249
|
+
function detectDbConfig(rootDir, config) {
|
|
250
|
+
if (config.paths?.dbDir) {
|
|
251
|
+
return resolveDbFromDir((0, import_node_path4.join)(rootDir, config.paths.dbDir));
|
|
252
|
+
}
|
|
253
|
+
const candidates = ["prisma", "supabase", "drizzle", (0, import_node_path4.join)("db", "migrations"), "migrations"];
|
|
254
|
+
for (const c of candidates) {
|
|
255
|
+
const dir = (0, import_node_path4.join)(rootDir, c);
|
|
256
|
+
const resolved = resolveDbFromDir(dir);
|
|
257
|
+
if (resolved.kind !== "none") return resolved;
|
|
258
|
+
}
|
|
259
|
+
return { kind: "none", schemaPath: null, migrationsDir: null };
|
|
260
|
+
}
|
|
261
|
+
function detectDbDir(rootDir, config, dbConfig) {
|
|
262
|
+
if (config.paths?.dbDir) return (0, import_node_path4.join)(rootDir, config.paths.dbDir);
|
|
263
|
+
if (dbConfig.kind === "prisma") return (0, import_node_path4.dirname)(dbConfig.schemaPath);
|
|
264
|
+
if (dbConfig.kind === "sql-migrations") return dbConfig.migrationsDir;
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
function dirHasTSFiles(dir) {
|
|
268
|
+
if (!(0, import_node_fs4.existsSync)(dir)) return false;
|
|
269
|
+
try {
|
|
270
|
+
const stack = [dir];
|
|
271
|
+
while (stack.length > 0) {
|
|
272
|
+
const cur = stack.pop();
|
|
273
|
+
const entries = (0, import_node_fs4.readdirSync)(cur, { withFileTypes: true });
|
|
274
|
+
for (const e of entries) {
|
|
275
|
+
if (e.isFile() && (e.name.endsWith(".ts") || e.name.endsWith(".tsx"))) return true;
|
|
276
|
+
if (e.isDirectory() && !e.name.startsWith(".") && !DEFAULT_IGNORE_DIRS.has(e.name)) {
|
|
277
|
+
stack.push((0, import_node_path4.join)(cur, e.name));
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
} catch {
|
|
282
|
+
}
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
function collectCodeBearingChildren(dir, extraSkip) {
|
|
286
|
+
if (!(0, import_node_fs4.existsSync)(dir)) return [];
|
|
287
|
+
const out = [];
|
|
288
|
+
try {
|
|
289
|
+
for (const entry of (0, import_node_fs4.readdirSync)(dir, { withFileTypes: true })) {
|
|
290
|
+
if (!entry.isDirectory()) continue;
|
|
291
|
+
if (entry.name.startsWith(".")) continue;
|
|
292
|
+
if (NON_SOURCE_DIRS.has(entry.name)) continue;
|
|
293
|
+
if (extraSkip?.has(entry.name)) continue;
|
|
294
|
+
const full = (0, import_node_path4.join)(dir, entry.name);
|
|
295
|
+
if (dirHasTSFiles(full)) out.push(full);
|
|
296
|
+
}
|
|
297
|
+
} catch {
|
|
298
|
+
}
|
|
299
|
+
return out;
|
|
300
|
+
}
|
|
301
|
+
function detectSrcRoots(rootDir, srcDir, appDir, config) {
|
|
302
|
+
if (config.paths?.srcRoots && config.paths.srcRoots.length > 0) {
|
|
303
|
+
const roots2 = /* @__PURE__ */ new Set();
|
|
304
|
+
roots2.add(appDir);
|
|
305
|
+
for (const r of config.paths.srcRoots) {
|
|
306
|
+
const abs = (0, import_node_path4.isAbsolute)(r) ? r : (0, import_node_path4.resolve)(rootDir, r);
|
|
307
|
+
roots2.add(abs);
|
|
308
|
+
}
|
|
309
|
+
return [...roots2];
|
|
310
|
+
}
|
|
311
|
+
const roots = /* @__PURE__ */ new Set();
|
|
312
|
+
roots.add(appDir);
|
|
313
|
+
for (const c of collectCodeBearingChildren(srcDir)) roots.add(c);
|
|
314
|
+
if (srcDir !== rootDir) {
|
|
315
|
+
const skipSrcWrapper = /* @__PURE__ */ new Set([(0, import_node_path4.basename)(srcDir)]);
|
|
316
|
+
for (const c of collectCodeBearingChildren(rootDir, skipSrcWrapper)) roots.add(c);
|
|
317
|
+
}
|
|
318
|
+
return [...roots];
|
|
319
|
+
}
|
|
320
|
+
function detectConventionFiles(rootDir, srcDir) {
|
|
321
|
+
const out = [];
|
|
322
|
+
const seen = /* @__PURE__ */ new Set();
|
|
323
|
+
const dirs = srcDir === rootDir ? [rootDir] : [srcDir, rootDir];
|
|
324
|
+
for (const dir of dirs) {
|
|
325
|
+
for (const name of CONVENTION_NAMES) {
|
|
326
|
+
const full = (0, import_node_path4.join)(dir, name);
|
|
327
|
+
if (!seen.has(full) && (0, import_node_fs4.existsSync)(full)) {
|
|
328
|
+
try {
|
|
329
|
+
if ((0, import_node_fs4.statSync)(full).isFile()) {
|
|
330
|
+
seen.add(full);
|
|
331
|
+
out.push(full);
|
|
332
|
+
}
|
|
333
|
+
} catch {
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
return out;
|
|
339
|
+
}
|
|
340
|
+
function resolveProjectPaths(rootDir, config) {
|
|
341
|
+
let srcDir;
|
|
342
|
+
let appDir;
|
|
343
|
+
if (config.paths?.appDir) {
|
|
344
|
+
appDir = (0, import_node_path4.join)(rootDir, config.paths.appDir);
|
|
345
|
+
srcDir = config.paths.srcDir ? (0, import_node_path4.join)(rootDir, config.paths.srcDir) : (0, import_node_path4.dirname)(appDir);
|
|
346
|
+
} else {
|
|
347
|
+
const srcApp = (0, import_node_path4.join)(rootDir, "src", "app");
|
|
348
|
+
const rootApp = (0, import_node_path4.join)(rootDir, "app");
|
|
349
|
+
if ((0, import_node_fs4.existsSync)(srcApp)) {
|
|
350
|
+
srcDir = (0, import_node_path4.join)(rootDir, "src");
|
|
351
|
+
appDir = srcApp;
|
|
352
|
+
} else if ((0, import_node_fs4.existsSync)(rootApp)) {
|
|
353
|
+
srcDir = rootDir;
|
|
354
|
+
appDir = rootApp;
|
|
355
|
+
} else {
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const apiDir = (0, import_node_path4.join)(appDir, "api");
|
|
360
|
+
const dbConfig = detectDbConfig(rootDir, config);
|
|
361
|
+
const dbDir = detectDbDir(rootDir, config, dbConfig);
|
|
362
|
+
const srcRoots = detectSrcRoots(rootDir, srcDir, appDir, config);
|
|
363
|
+
const conventionFiles = detectConventionFiles(rootDir, srcDir);
|
|
364
|
+
return { srcDir, appDir, apiDir, dbDir, srcRoots, conventionFiles, dbConfig };
|
|
365
|
+
}
|
|
366
|
+
var import_node_fs4, import_node_path4, NON_SOURCE_DIRS, CONVENTION_NAMES;
|
|
367
|
+
var init_resolve_paths = __esm({
|
|
368
|
+
"src/server/graph/core/resolve-paths.ts"() {
|
|
369
|
+
"use strict";
|
|
370
|
+
import_node_fs4 = require("node:fs");
|
|
371
|
+
import_node_path4 = require("node:path");
|
|
372
|
+
init_walk();
|
|
373
|
+
NON_SOURCE_DIRS = /* @__PURE__ */ new Set([
|
|
374
|
+
...DEFAULT_IGNORE_DIRS,
|
|
375
|
+
// DB conventions (handled by db parsers)
|
|
376
|
+
"prisma",
|
|
377
|
+
"supabase",
|
|
378
|
+
"drizzle",
|
|
379
|
+
"migrations",
|
|
380
|
+
// Web assets
|
|
381
|
+
"public",
|
|
382
|
+
"static",
|
|
383
|
+
"assets",
|
|
384
|
+
// Docs
|
|
385
|
+
"docs",
|
|
386
|
+
"documentation",
|
|
387
|
+
// Test dirs (project tests aren't part of the structural graph)
|
|
388
|
+
"tests",
|
|
389
|
+
"__tests__",
|
|
390
|
+
"e2e",
|
|
391
|
+
"playwright",
|
|
392
|
+
"cypress",
|
|
393
|
+
// Monorepo workspace roots — separate graph projects per .launchchart.json
|
|
394
|
+
"packages",
|
|
395
|
+
"apps",
|
|
396
|
+
"services",
|
|
397
|
+
"libs"
|
|
398
|
+
]);
|
|
399
|
+
CONVENTION_NAMES = ["middleware.ts", "middleware.tsx", "instrumentation.ts", "instrumentation.tsx"];
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
|
|
241
403
|
// src/server/graph/core/ts-extractor.ts
|
|
242
404
|
var ts_extractor_exports = {};
|
|
243
405
|
__export(ts_extractor_exports, {
|
|
@@ -778,8 +940,12 @@ var init_ts_extractor = __esm({
|
|
|
778
940
|
});
|
|
779
941
|
|
|
780
942
|
// src/server/graph/parsers/ts/typescript-project.ts
|
|
781
|
-
function toNodeId(srcDir, absPath) {
|
|
782
|
-
|
|
943
|
+
function toNodeId(srcDir, rootDir, absPath) {
|
|
944
|
+
const relFromSrc = (0, import_node_path6.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
945
|
+
if (relFromSrc.startsWith("..")) {
|
|
946
|
+
return (0, import_node_path6.relative)(rootDir, absPath).replace(/\\/g, "/");
|
|
947
|
+
}
|
|
948
|
+
return relFromSrc;
|
|
783
949
|
}
|
|
784
950
|
function resolveImport(srcDir, specifier) {
|
|
785
951
|
if (!specifier.startsWith("@/")) return null;
|
|
@@ -869,12 +1035,13 @@ function extractRoute(id) {
|
|
|
869
1035
|
function nameFromFilename(absPath) {
|
|
870
1036
|
return (0, import_node_path6.basename)(absPath, (0, import_node_path6.extname)(absPath)).replace(/[-_](\w)/g, (_, c) => c.toUpperCase()).replace(/^(\w)/, (_, c) => c.toUpperCase());
|
|
871
1037
|
}
|
|
872
|
-
function
|
|
873
|
-
let route = "/" + (0, import_node_path6.relative)(
|
|
1038
|
+
function filePathToAppRoute(appDir, absPath) {
|
|
1039
|
+
let route = ("/" + (0, import_node_path6.relative)(appDir, absPath).replace(/\\/g, "/")).replace(/\/route\.tsx?$/, "");
|
|
1040
|
+
route = route.replace(/\/\([^)]+\)/g, "");
|
|
1041
|
+
route = route.replace(/\[\.\.\.([^\]]+)\]/g, "*$1");
|
|
874
1042
|
route = route.replace(/\[([^\]]+)\]/g, ":$1");
|
|
875
1043
|
route = route.replace(/\/+/g, "/");
|
|
876
|
-
|
|
877
|
-
return "/api" + route;
|
|
1044
|
+
return route === "" ? "/" : route;
|
|
878
1045
|
}
|
|
879
1046
|
function camelToPascal(s) {
|
|
880
1047
|
if (!s) return s;
|
|
@@ -959,7 +1126,7 @@ function matchRouteToPage(route, routeToNodeId) {
|
|
|
959
1126
|
if (routeToNodeId.has(normalized)) return routeToNodeId.get(normalized);
|
|
960
1127
|
return null;
|
|
961
1128
|
}
|
|
962
|
-
function extractEdges(srcDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps, routeToNodeId) {
|
|
1129
|
+
function extractEdges(srcDir, rootDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps, routeToNodeId) {
|
|
963
1130
|
const edges = [];
|
|
964
1131
|
const flagged = [];
|
|
965
1132
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -987,7 +1154,7 @@ function extractEdges(srcDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps,
|
|
|
987
1154
|
for (const name of names) {
|
|
988
1155
|
const targetAbs = barrelMap.get(name);
|
|
989
1156
|
if (targetAbs) {
|
|
990
|
-
const targetId = toNodeId(srcDir, targetAbs);
|
|
1157
|
+
const targetId = toNodeId(srcDir, rootDir, targetAbs);
|
|
991
1158
|
if (nodeIdSet.has(targetId)) {
|
|
992
1159
|
if (!byTarget.has(targetId)) byTarget.set(targetId, []);
|
|
993
1160
|
byTarget.get(targetId).push(name);
|
|
@@ -1001,7 +1168,7 @@ function extractEdges(srcDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps,
|
|
|
1001
1168
|
} else {
|
|
1002
1169
|
const resolved = resolveImport(srcDir, specifier);
|
|
1003
1170
|
if (resolved) {
|
|
1004
|
-
const targetId = toNodeId(srcDir, resolved);
|
|
1171
|
+
const targetId = toNodeId(srcDir, rootDir, resolved);
|
|
1005
1172
|
if (nodeIdSet.has(targetId) && !targetId.endsWith("/index.ts") && !targetId.endsWith("/index.tsx")) {
|
|
1006
1173
|
addEdge(targetId, edgeTypeFor(isTypeOnly, names));
|
|
1007
1174
|
}
|
|
@@ -1010,7 +1177,7 @@ function extractEdges(srcDir, absPath, sourceId, parsed, nodeIdSet, barrelMaps,
|
|
|
1010
1177
|
} else if (specifier.startsWith(".")) {
|
|
1011
1178
|
const resolved = resolveRelativeImport(absPath, specifier);
|
|
1012
1179
|
if (resolved) {
|
|
1013
|
-
const targetId = toNodeId(srcDir, resolved);
|
|
1180
|
+
const targetId = toNodeId(srcDir, rootDir, resolved);
|
|
1014
1181
|
if (nodeIdSet.has(targetId) && !targetId.endsWith("/index.ts") && !targetId.endsWith("/index.tsx")) {
|
|
1015
1182
|
addEdge(targetId, edgeTypeFor(isTypeOnly, names));
|
|
1016
1183
|
}
|
|
@@ -1062,13 +1229,22 @@ function generate(rootDir) {
|
|
|
1062
1229
|
const config = loadConfig(rootDir);
|
|
1063
1230
|
const paths = resolveProjectPaths(rootDir, config);
|
|
1064
1231
|
const srcDir = paths.srcDir;
|
|
1065
|
-
const
|
|
1066
|
-
const
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1232
|
+
const allDiscovered = [];
|
|
1233
|
+
const discoveredSet = /* @__PURE__ */ new Set();
|
|
1234
|
+
for (const root of paths.srcRoots) {
|
|
1235
|
+
for (const f of walk(root, [".tsx", ".ts"])) {
|
|
1236
|
+
if (!discoveredSet.has(f)) {
|
|
1237
|
+
discoveredSet.add(f);
|
|
1238
|
+
allDiscovered.push(f);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
for (const conv of paths.conventionFiles) {
|
|
1243
|
+
if (!discoveredSet.has(conv)) {
|
|
1244
|
+
discoveredSet.add(conv);
|
|
1245
|
+
allDiscovered.push(conv);
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1072
1248
|
const parsedByPath = /* @__PURE__ */ new Map();
|
|
1073
1249
|
for (const absPath of allDiscovered) {
|
|
1074
1250
|
parsedByPath.set(absPath, parseFileTS(absPath));
|
|
@@ -1080,7 +1256,7 @@ function generate(rootDir) {
|
|
|
1080
1256
|
const routeToNodeId = /* @__PURE__ */ new Map();
|
|
1081
1257
|
const fileSet = allDiscovered.filter((f) => !(0, import_node_path6.basename)(f).startsWith("index."));
|
|
1082
1258
|
for (const absPath of fileSet) {
|
|
1083
|
-
const id = toNodeId(srcDir, absPath);
|
|
1259
|
+
const id = toNodeId(srcDir, rootDir, absPath);
|
|
1084
1260
|
const type = classifyType(absPath, id);
|
|
1085
1261
|
if (type === "test" || type === "story") continue;
|
|
1086
1262
|
const parsed = parsedByPath.get(absPath);
|
|
@@ -1095,7 +1271,7 @@ function generate(rootDir) {
|
|
|
1095
1271
|
const dbCalls = extractDbCallsTS(absPath);
|
|
1096
1272
|
const authWrappers = extractAuthWrappersTS(absPath);
|
|
1097
1273
|
const deep = extractDeep(absPath);
|
|
1098
|
-
const routePath = (
|
|
1274
|
+
const routePath = filePathToAppRoute(paths.appDir, absPath);
|
|
1099
1275
|
const mutations = dbCalls.filter((c) => c.isMutation);
|
|
1100
1276
|
const mutates = mutations.length > 0;
|
|
1101
1277
|
const authStrategy = [...authWrappers];
|
|
@@ -1139,11 +1315,12 @@ function generate(rootDir) {
|
|
|
1139
1315
|
const uiEdges = [];
|
|
1140
1316
|
const uiFlagged = [];
|
|
1141
1317
|
for (const absPath of fileSet) {
|
|
1142
|
-
const id = toNodeId(srcDir, absPath);
|
|
1318
|
+
const id = toNodeId(srcDir, rootDir, absPath);
|
|
1143
1319
|
if (!nodeIdSet.has(id)) continue;
|
|
1144
1320
|
const parsed = parsedByPath.get(absPath);
|
|
1145
1321
|
const { edges, flagged } = extractEdges(
|
|
1146
1322
|
srcDir,
|
|
1323
|
+
rootDir,
|
|
1147
1324
|
absPath,
|
|
1148
1325
|
id,
|
|
1149
1326
|
parsed,
|
|
@@ -1156,7 +1333,7 @@ function generate(rootDir) {
|
|
|
1156
1333
|
}
|
|
1157
1334
|
const fetchCallEntries = [];
|
|
1158
1335
|
for (const absPath of fileSet) {
|
|
1159
|
-
const sourceId = toNodeId(srcDir, absPath);
|
|
1336
|
+
const sourceId = toNodeId(srcDir, rootDir, absPath);
|
|
1160
1337
|
if (!nodeIdSet.has(sourceId)) continue;
|
|
1161
1338
|
const parsed = parsedByPath.get(absPath);
|
|
1162
1339
|
if (parsed.fetchCalls.length === 0) continue;
|
|
@@ -1195,7 +1372,7 @@ function generate(rootDir) {
|
|
|
1195
1372
|
for (const name of names) {
|
|
1196
1373
|
const targetAbs = barrelMap.get(name);
|
|
1197
1374
|
if (!targetAbs) continue;
|
|
1198
|
-
const targetId2 = toNodeId(srcDir, targetAbs);
|
|
1375
|
+
const targetId2 = toNodeId(srcDir, rootDir, targetAbs);
|
|
1199
1376
|
if (!nodeIdSet.has(targetId2)) continue;
|
|
1200
1377
|
const key2 = `${externalId}\u2192${targetId2}`;
|
|
1201
1378
|
if (seen.has(key2)) continue;
|
|
@@ -1209,7 +1386,7 @@ function generate(rootDir) {
|
|
|
1209
1386
|
resolved = resolveRelativeImport(absPath, specifier);
|
|
1210
1387
|
}
|
|
1211
1388
|
if (!resolved) continue;
|
|
1212
|
-
const targetId = toNodeId(srcDir, resolved);
|
|
1389
|
+
const targetId = toNodeId(srcDir, rootDir, resolved);
|
|
1213
1390
|
if (!nodeIdSet.has(targetId)) continue;
|
|
1214
1391
|
if (targetId.endsWith("/index.ts") || targetId.endsWith("/index.tsx")) continue;
|
|
1215
1392
|
const key = `${externalId}\u2192${targetId}`;
|
|
@@ -1502,10 +1679,24 @@ function parseEnums(content) {
|
|
|
1502
1679
|
return nodes;
|
|
1503
1680
|
}
|
|
1504
1681
|
function detect2(rootDir) {
|
|
1505
|
-
|
|
1682
|
+
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
1683
|
+
return paths?.dbConfig.kind === "prisma" && (0, import_node_fs7.existsSync)(paths.dbConfig.schemaPath);
|
|
1506
1684
|
}
|
|
1507
1685
|
function generate2(rootDir) {
|
|
1508
|
-
const
|
|
1686
|
+
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
1687
|
+
if (paths.dbConfig.kind !== "prisma") {
|
|
1688
|
+
return {
|
|
1689
|
+
metadata: { generated: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), layer: "db", source: "none" },
|
|
1690
|
+
nodes: [],
|
|
1691
|
+
edges: [],
|
|
1692
|
+
cross_refs: [],
|
|
1693
|
+
contradictions: [],
|
|
1694
|
+
warnings: [],
|
|
1695
|
+
flagged_edges: [],
|
|
1696
|
+
patterns: { total_tables: 0, total_enums: 0, total_relations: 0 }
|
|
1697
|
+
};
|
|
1698
|
+
}
|
|
1699
|
+
const schemaPath = paths.dbConfig.schemaPath;
|
|
1509
1700
|
const content = (0, import_node_fs7.readFileSync)(schemaPath, "utf-8");
|
|
1510
1701
|
const { nodes: modelNodes, relations } = parseModels(content);
|
|
1511
1702
|
const enumNodes = parseEnums(content);
|
|
@@ -1526,7 +1717,7 @@ function generate2(rootDir) {
|
|
|
1526
1717
|
metadata: {
|
|
1527
1718
|
generated: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
1528
1719
|
scope: "prisma-schema",
|
|
1529
|
-
source:
|
|
1720
|
+
source: schemaPath,
|
|
1530
1721
|
provider: "postgresql",
|
|
1531
1722
|
layer: "db",
|
|
1532
1723
|
total_models: modelNodes.length,
|
|
@@ -1555,12 +1746,13 @@ function generate2(rootDir) {
|
|
|
1555
1746
|
}
|
|
1556
1747
|
};
|
|
1557
1748
|
}
|
|
1558
|
-
var import_node_fs7,
|
|
1749
|
+
var import_node_fs7, prismaSchemaParser;
|
|
1559
1750
|
var init_prisma_schema = __esm({
|
|
1560
1751
|
"src/server/graph/parsers/db/prisma-schema.ts"() {
|
|
1561
1752
|
"use strict";
|
|
1562
1753
|
import_node_fs7 = require("node:fs");
|
|
1563
|
-
|
|
1754
|
+
init_config();
|
|
1755
|
+
init_resolve_paths();
|
|
1564
1756
|
prismaSchemaParser = {
|
|
1565
1757
|
id: "prisma-schema",
|
|
1566
1758
|
layer: "db",
|
|
@@ -1693,19 +1885,29 @@ function parseUniqueIndex(sql, state) {
|
|
|
1693
1885
|
state.uniqueIndexes.get(m[1]).add(m[2]);
|
|
1694
1886
|
}
|
|
1695
1887
|
}
|
|
1696
|
-
function
|
|
1697
|
-
|
|
1888
|
+
function discoverMigrationFiles(migrationsDir) {
|
|
1889
|
+
if (!(0, import_node_fs8.existsSync)(migrationsDir)) return [];
|
|
1890
|
+
const out = [];
|
|
1891
|
+
const entries = (0, import_node_fs8.readdirSync)(migrationsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
1892
|
+
for (const entry of entries) {
|
|
1893
|
+
if (entry.isDirectory()) {
|
|
1894
|
+
const sqlPath = (0, import_node_path7.join)(migrationsDir, entry.name, "migration.sql");
|
|
1895
|
+
if ((0, import_node_fs8.existsSync)(sqlPath)) out.push(sqlPath);
|
|
1896
|
+
} else if (entry.isFile() && entry.name.endsWith(".sql")) {
|
|
1897
|
+
out.push((0, import_node_path7.join)(migrationsDir, entry.name));
|
|
1898
|
+
}
|
|
1899
|
+
}
|
|
1900
|
+
return out;
|
|
1901
|
+
}
|
|
1902
|
+
function parseMigrations(migrationsDir) {
|
|
1698
1903
|
const state = {
|
|
1699
1904
|
tables: /* @__PURE__ */ new Map(),
|
|
1700
1905
|
enums: /* @__PURE__ */ new Map(),
|
|
1701
1906
|
fks: [],
|
|
1702
1907
|
uniqueIndexes: /* @__PURE__ */ new Map()
|
|
1703
1908
|
};
|
|
1704
|
-
if (!
|
|
1705
|
-
const
|
|
1706
|
-
for (const dir of dirs) {
|
|
1707
|
-
const sqlPath = (0, import_node_path8.join)(migrationsDir, dir, "migration.sql");
|
|
1708
|
-
if (!(0, import_node_fs8.existsSync)(sqlPath)) continue;
|
|
1909
|
+
if (!migrationsDir) return state;
|
|
1910
|
+
for (const sqlPath of discoverMigrationFiles(migrationsDir)) {
|
|
1709
1911
|
const sql = (0, import_node_fs8.readFileSync)(sqlPath, "utf-8");
|
|
1710
1912
|
parseCreateEnum(sql, state);
|
|
1711
1913
|
parseCreateTable(sql, state);
|
|
@@ -1716,9 +1918,8 @@ function parseMigrations(rootDir) {
|
|
|
1716
1918
|
}
|
|
1717
1919
|
return state;
|
|
1718
1920
|
}
|
|
1719
|
-
function loadPrismaState(
|
|
1720
|
-
|
|
1721
|
-
if (!(0, import_node_fs8.existsSync)(schemaPath)) return null;
|
|
1921
|
+
function loadPrismaState(schemaPath) {
|
|
1922
|
+
if (!schemaPath || !(0, import_node_fs8.existsSync)(schemaPath)) return null;
|
|
1722
1923
|
const content = (0, import_node_fs8.readFileSync)(schemaPath, "utf-8");
|
|
1723
1924
|
const tables = /* @__PURE__ */ new Map();
|
|
1724
1925
|
const enums = /* @__PURE__ */ new Map();
|
|
@@ -1883,14 +2084,28 @@ function verify(sqlState, prisma) {
|
|
|
1883
2084
|
}
|
|
1884
2085
|
return { contradictions, flaggedEdges };
|
|
1885
2086
|
}
|
|
2087
|
+
function migrationsDirFor(rootDir) {
|
|
2088
|
+
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
2089
|
+
if (!paths) return null;
|
|
2090
|
+
if (paths.dbConfig.kind === "prisma" || paths.dbConfig.kind === "sql-migrations") {
|
|
2091
|
+
return paths.dbConfig.migrationsDir;
|
|
2092
|
+
}
|
|
2093
|
+
return null;
|
|
2094
|
+
}
|
|
2095
|
+
function schemaPathFor(rootDir) {
|
|
2096
|
+
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
2097
|
+
if (!paths) return null;
|
|
2098
|
+
return paths.dbConfig.kind === "prisma" ? paths.dbConfig.schemaPath : null;
|
|
2099
|
+
}
|
|
1886
2100
|
function detect3(rootDir) {
|
|
1887
|
-
const
|
|
1888
|
-
if (!
|
|
1889
|
-
return (
|
|
2101
|
+
const dir = migrationsDirFor(rootDir);
|
|
2102
|
+
if (!dir) return false;
|
|
2103
|
+
return discoverMigrationFiles(dir).length > 0;
|
|
1890
2104
|
}
|
|
1891
2105
|
function generate3(rootDir) {
|
|
1892
|
-
const
|
|
1893
|
-
const
|
|
2106
|
+
const migrationsDir = migrationsDirFor(rootDir);
|
|
2107
|
+
const sqlState = parseMigrations(migrationsDir);
|
|
2108
|
+
const prisma = loadPrismaState(schemaPathFor(rootDir));
|
|
1894
2109
|
const prismaTableIds = prisma ? new Set(prisma.tables.keys()) : /* @__PURE__ */ new Set();
|
|
1895
2110
|
const prismaEnumIds = prisma ? new Set(prisma.enums.keys()) : /* @__PURE__ */ new Set();
|
|
1896
2111
|
const nodes = [];
|
|
@@ -1936,7 +2151,7 @@ function generate3(rootDir) {
|
|
|
1936
2151
|
metadata: {
|
|
1937
2152
|
generated: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
|
|
1938
2153
|
scope: "sql-migrations",
|
|
1939
|
-
source: "
|
|
2154
|
+
source: migrationsDir ?? "none",
|
|
1940
2155
|
layer: "db",
|
|
1941
2156
|
sql_tables: sqlState.tables.size,
|
|
1942
2157
|
sql_enums: sqlState.enums.size,
|
|
@@ -1953,12 +2168,14 @@ function generate3(rootDir) {
|
|
|
1953
2168
|
flagged_edges: flaggedEdges
|
|
1954
2169
|
};
|
|
1955
2170
|
}
|
|
1956
|
-
var import_node_fs8,
|
|
2171
|
+
var import_node_fs8, import_node_path7, PG_TO_PRISMA, sqlMigrationsParser;
|
|
1957
2172
|
var init_sql_migrations = __esm({
|
|
1958
2173
|
"src/server/graph/parsers/db/sql-migrations.ts"() {
|
|
1959
2174
|
"use strict";
|
|
1960
2175
|
import_node_fs8 = require("node:fs");
|
|
1961
|
-
|
|
2176
|
+
import_node_path7 = require("node:path");
|
|
2177
|
+
init_config();
|
|
2178
|
+
init_resolve_paths();
|
|
1962
2179
|
PG_TO_PRISMA = {
|
|
1963
2180
|
"TEXT": "String",
|
|
1964
2181
|
"VARCHAR": "String",
|
|
@@ -2225,24 +2442,24 @@ function walk2(dir, exts) {
|
|
|
2225
2442
|
const results = [];
|
|
2226
2443
|
for (const entry of (0, import_node_fs9.readdirSync)(dir, { withFileTypes: true })) {
|
|
2227
2444
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
2228
|
-
const full = (0,
|
|
2445
|
+
const full = (0, import_node_path8.join)(dir, entry.name);
|
|
2229
2446
|
if (entry.isDirectory()) {
|
|
2230
2447
|
results.push(...walk2(full, exts));
|
|
2231
|
-
} else if (exts.includes((0,
|
|
2448
|
+
} else if (exts.includes((0, import_node_path8.extname)(entry.name))) {
|
|
2232
2449
|
results.push(full);
|
|
2233
2450
|
}
|
|
2234
2451
|
}
|
|
2235
2452
|
return results;
|
|
2236
2453
|
}
|
|
2237
2454
|
function toNodeId2(srcDir, absPath) {
|
|
2238
|
-
return (0,
|
|
2455
|
+
return (0, import_node_path8.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
2239
2456
|
}
|
|
2240
|
-
var import_node_fs9,
|
|
2457
|
+
var import_node_fs9, import_node_path8, API_ANNOTATION_RE, apiAnnotationsParser;
|
|
2241
2458
|
var init_api_annotations = __esm({
|
|
2242
2459
|
"src/server/graph/parsers/crosslayer/api-annotations.ts"() {
|
|
2243
2460
|
"use strict";
|
|
2244
2461
|
import_node_fs9 = require("node:fs");
|
|
2245
|
-
|
|
2462
|
+
import_node_path8 = require("node:path");
|
|
2246
2463
|
init_api_route_matching();
|
|
2247
2464
|
API_ANNOTATION_RE = /@api\s+(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)\s+(\/\S+)/g;
|
|
2248
2465
|
apiAnnotationsParser = {
|
|
@@ -2250,7 +2467,7 @@ var init_api_annotations = __esm({
|
|
|
2250
2467
|
layer: "crosslayer",
|
|
2251
2468
|
concern: "api-binding",
|
|
2252
2469
|
detect(rootDir) {
|
|
2253
|
-
return (0, import_node_fs9.existsSync)((0,
|
|
2470
|
+
return (0, import_node_fs9.existsSync)((0, import_node_path8.join)(rootDir, "src"));
|
|
2254
2471
|
},
|
|
2255
2472
|
generate(rootDir, layerOutputs) {
|
|
2256
2473
|
const apiOutput = layerOutputs.get("api");
|
|
@@ -2261,7 +2478,7 @@ var init_api_annotations = __esm({
|
|
|
2261
2478
|
const uiNodeIds = new Set(uiOutput?.nodes.map((n) => n.id) ?? []);
|
|
2262
2479
|
const apiRoutes = loadApiRoutesFromOutput(apiOutput);
|
|
2263
2480
|
const apiPathMap = buildApiPathMap(apiRoutes);
|
|
2264
|
-
const srcDir = (0,
|
|
2481
|
+
const srcDir = (0, import_node_path8.join)(rootDir, "src");
|
|
2265
2482
|
const files = walk2(srcDir, [".ts", ".tsx"]);
|
|
2266
2483
|
const crossRefs = [];
|
|
2267
2484
|
const flaggedEdges = [];
|
|
@@ -2318,24 +2535,24 @@ function walk3(dir, exts) {
|
|
|
2318
2535
|
const results = [];
|
|
2319
2536
|
for (const entry of (0, import_node_fs10.readdirSync)(dir, { withFileTypes: true })) {
|
|
2320
2537
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
2321
|
-
const full = (0,
|
|
2538
|
+
const full = (0, import_node_path9.join)(dir, entry.name);
|
|
2322
2539
|
if (entry.isDirectory()) {
|
|
2323
2540
|
results.push(...walk3(full, exts));
|
|
2324
|
-
} else if (exts.includes((0,
|
|
2541
|
+
} else if (exts.includes((0, import_node_path9.extname)(entry.name))) {
|
|
2325
2542
|
results.push(full);
|
|
2326
2543
|
}
|
|
2327
2544
|
}
|
|
2328
2545
|
return results;
|
|
2329
2546
|
}
|
|
2330
2547
|
function toNodeId3(srcDir, absPath) {
|
|
2331
|
-
return (0,
|
|
2548
|
+
return (0, import_node_path9.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
2332
2549
|
}
|
|
2333
|
-
var import_node_fs10,
|
|
2550
|
+
var import_node_fs10, import_node_path9, URL_LITERAL_RE, urlLiteralScannerParser;
|
|
2334
2551
|
var init_url_literal_scanner = __esm({
|
|
2335
2552
|
"src/server/graph/parsers/crosslayer/url-literal-scanner.ts"() {
|
|
2336
2553
|
"use strict";
|
|
2337
2554
|
import_node_fs10 = require("node:fs");
|
|
2338
|
-
|
|
2555
|
+
import_node_path9 = require("node:path");
|
|
2339
2556
|
init_api_route_matching();
|
|
2340
2557
|
init_config();
|
|
2341
2558
|
init_resolve_paths();
|
|
@@ -2359,7 +2576,7 @@ var init_url_literal_scanner = __esm({
|
|
|
2359
2576
|
const apiPathMap = buildApiPathMap(apiRoutes);
|
|
2360
2577
|
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
2361
2578
|
const srcDir = paths.srcDir;
|
|
2362
|
-
const clientDir = (0,
|
|
2579
|
+
const clientDir = (0, import_node_path9.join)(srcDir, "client");
|
|
2363
2580
|
const files = [
|
|
2364
2581
|
...walk3(clientDir, [".ts", ".tsx"]),
|
|
2365
2582
|
...walk3(paths.appDir, [".ts", ".tsx"])
|
|
@@ -2431,8 +2648,8 @@ function extractEnumValues(rootDir) {
|
|
|
2431
2648
|
const nodes = [];
|
|
2432
2649
|
const edges = [];
|
|
2433
2650
|
const schemaPaths = [
|
|
2434
|
-
(0,
|
|
2435
|
-
(0,
|
|
2651
|
+
(0, import_node_path10.join)(rootDir, "prisma", "schema.prisma"),
|
|
2652
|
+
(0, import_node_path10.join)(rootDir, "prisma", "schema")
|
|
2436
2653
|
];
|
|
2437
2654
|
let content = "";
|
|
2438
2655
|
for (const p of schemaPaths) {
|
|
@@ -2443,7 +2660,7 @@ function extractEnumValues(rootDir) {
|
|
|
2443
2660
|
content = (0, import_node_fs11.readFileSync)(p, "utf-8");
|
|
2444
2661
|
} else if (stat.isDirectory()) {
|
|
2445
2662
|
const files = (0, import_node_fs11.readdirSync)(p).filter((f) => f.endsWith(".prisma"));
|
|
2446
|
-
content = files.map((f) => (0, import_node_fs11.readFileSync)((0,
|
|
2663
|
+
content = files.map((f) => (0, import_node_fs11.readFileSync)((0, import_node_path10.join)(p, f), "utf-8")).join("\n");
|
|
2447
2664
|
}
|
|
2448
2665
|
} catch {
|
|
2449
2666
|
continue;
|
|
@@ -2599,14 +2816,14 @@ function extractSeedData(rootDir) {
|
|
|
2599
2816
|
const nodes = [];
|
|
2600
2817
|
const edges = [];
|
|
2601
2818
|
const seedFiles = [
|
|
2602
|
-
(0,
|
|
2603
|
-
(0,
|
|
2604
|
-
(0,
|
|
2819
|
+
(0, import_node_path10.join)(rootDir, "prisma", "seed.ts"),
|
|
2820
|
+
(0, import_node_path10.join)(rootDir, "prisma", "seed.js"),
|
|
2821
|
+
(0, import_node_path10.join)(rootDir, "src", "server", "lib", "system-tags.ts")
|
|
2605
2822
|
].filter(import_node_fs11.existsSync);
|
|
2606
2823
|
const useTreeSitter = tryLoadTreeSitter();
|
|
2607
2824
|
for (const filePath of seedFiles) {
|
|
2608
2825
|
const content = (0, import_node_fs11.readFileSync)(filePath, "utf-8");
|
|
2609
|
-
const relPath = (0,
|
|
2826
|
+
const relPath = (0, import_node_path10.relative)(rootDir, filePath);
|
|
2610
2827
|
const seeded = detectSeededArrays(content, relPath);
|
|
2611
2828
|
let astRoot = null;
|
|
2612
2829
|
if (useTreeSitter && parseCode) {
|
|
@@ -2704,7 +2921,7 @@ function walkDir(dir, exts) {
|
|
|
2704
2921
|
const results = [];
|
|
2705
2922
|
for (const entry of (0, import_node_fs11.readdirSync)(dir, { withFileTypes: true })) {
|
|
2706
2923
|
if (entry.name === "node_modules" || entry.name === ".next" || entry.name === "dist") continue;
|
|
2707
|
-
const full = (0,
|
|
2924
|
+
const full = (0, import_node_path10.join)(dir, entry.name);
|
|
2708
2925
|
if (entry.isDirectory()) results.push(...walkDir(full, exts));
|
|
2709
2926
|
else if (exts.some((ext) => entry.name.endsWith(ext))) results.push(full);
|
|
2710
2927
|
}
|
|
@@ -2712,11 +2929,11 @@ function walkDir(dir, exts) {
|
|
|
2712
2929
|
}
|
|
2713
2930
|
function extractConstants(rootDir) {
|
|
2714
2931
|
const nodes = [];
|
|
2715
|
-
const srcDir = (0,
|
|
2932
|
+
const srcDir = (0, import_node_path10.join)(rootDir, "src");
|
|
2716
2933
|
if (!(0, import_node_fs11.existsSync)(srcDir)) return { nodes };
|
|
2717
2934
|
for (const filePath of walkDir(srcDir, [".ts", ".tsx"])) {
|
|
2718
2935
|
const content = (0, import_node_fs11.readFileSync)(filePath, "utf-8");
|
|
2719
|
-
const relPath = (0,
|
|
2936
|
+
const relPath = (0, import_node_path10.relative)(rootDir, filePath);
|
|
2720
2937
|
const constArrayRe = /export\s+const\s+([A-Z][A-Z_0-9]+)\s*(?::[^=]+)?\s*=\s*\[/g;
|
|
2721
2938
|
let cm;
|
|
2722
2939
|
while ((cm = constArrayRe.exec(content)) !== null) {
|
|
@@ -2749,7 +2966,7 @@ function extractConstants(rootDir) {
|
|
|
2749
2966
|
return { nodes };
|
|
2750
2967
|
}
|
|
2751
2968
|
function detect4(rootDir) {
|
|
2752
|
-
return (0, import_node_fs11.existsSync)((0,
|
|
2969
|
+
return (0, import_node_fs11.existsSync)((0, import_node_path10.join)(rootDir, "prisma", "schema.prisma")) || (0, import_node_fs11.existsSync)((0, import_node_path10.join)(rootDir, "prisma", "seed.ts"));
|
|
2753
2970
|
}
|
|
2754
2971
|
function generate4(rootDir) {
|
|
2755
2972
|
const enumResult = extractEnumValues(rootDir);
|
|
@@ -2816,12 +3033,12 @@ function generate4(rootDir) {
|
|
|
2816
3033
|
}
|
|
2817
3034
|
};
|
|
2818
3035
|
}
|
|
2819
|
-
var import_node_fs11,
|
|
3036
|
+
var import_node_fs11, import_node_path10, parseCode, SHARED_MODELS, DB_MODELS, staticValuesParser;
|
|
2820
3037
|
var init_static_values = __esm({
|
|
2821
3038
|
"src/server/graph/parsers/static/static-values.ts"() {
|
|
2822
3039
|
"use strict";
|
|
2823
3040
|
import_node_fs11 = require("node:fs");
|
|
2824
|
-
|
|
3041
|
+
import_node_path10 = require("node:path");
|
|
2825
3042
|
parseCode = null;
|
|
2826
3043
|
SHARED_MODELS = /* @__PURE__ */ new Set(["permission", "role", "tag"]);
|
|
2827
3044
|
DB_MODELS = /* @__PURE__ */ new Set(["subscriptionPlan", "providerDefinition", "pipelineMasterTemplate"]);
|
|
@@ -2919,12 +3136,12 @@ function collectStaticRefsRegex(content, valueLookup, allValues) {
|
|
|
2919
3136
|
}
|
|
2920
3137
|
return refs;
|
|
2921
3138
|
}
|
|
2922
|
-
var import_node_fs12,
|
|
3139
|
+
var import_node_fs12, import_node_path11, MIN_VALUE_LENGTH, SKIP_VALUES, staticRefScannerParser;
|
|
2923
3140
|
var init_static_ref_scanner = __esm({
|
|
2924
3141
|
"src/server/graph/parsers/crosslayer/static-ref-scanner.ts"() {
|
|
2925
3142
|
"use strict";
|
|
2926
3143
|
import_node_fs12 = require("node:fs");
|
|
2927
|
-
|
|
3144
|
+
import_node_path11 = require("node:path");
|
|
2928
3145
|
init_config();
|
|
2929
3146
|
init_resolve_paths();
|
|
2930
3147
|
init_walk();
|
|
@@ -2986,11 +3203,11 @@ var init_static_ref_scanner = __esm({
|
|
|
2986
3203
|
if (!paths) return { cross_refs: [], flagged_edges: [], warnings: [] };
|
|
2987
3204
|
const srcDir = paths.srcDir;
|
|
2988
3205
|
const files = [
|
|
2989
|
-
...walkWithIgnore((0,
|
|
3206
|
+
...walkWithIgnore((0, import_node_path11.join)(srcDir, "client"), [".ts", ".tsx"]),
|
|
2990
3207
|
...walkWithIgnore(paths.appDir, [".ts", ".tsx"]),
|
|
2991
|
-
...walkWithIgnore((0,
|
|
2992
|
-
...walkWithIgnore((0,
|
|
2993
|
-
...walkWithIgnore((0,
|
|
3208
|
+
...walkWithIgnore((0, import_node_path11.join)(srcDir, "server"), [".ts", ".tsx"]),
|
|
3209
|
+
...walkWithIgnore((0, import_node_path11.join)(srcDir, "lib"), [".ts", ".tsx"]),
|
|
3210
|
+
...walkWithIgnore((0, import_node_path11.join)(srcDir, "config"), [".ts", ".tsx"])
|
|
2994
3211
|
];
|
|
2995
3212
|
const uiOutput = layerOutputs.get("ui");
|
|
2996
3213
|
const apiOutput = layerOutputs.get("api");
|
|
@@ -3008,7 +3225,7 @@ var init_static_ref_scanner = __esm({
|
|
|
3008
3225
|
const seen = /* @__PURE__ */ new Set();
|
|
3009
3226
|
let filesScanned = 0;
|
|
3010
3227
|
for (const absPath of files) {
|
|
3011
|
-
const sourceId = (0,
|
|
3228
|
+
const sourceId = (0, import_node_path11.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
3012
3229
|
const sourceLayer = uiNodeIds.has(sourceId) ? "ui" : apiNodeIds.has(sourceId) ? "api" : null;
|
|
3013
3230
|
if (!sourceLayer) continue;
|
|
3014
3231
|
const content = (0, import_node_fs12.readFileSync)(absPath, "utf-8");
|
|
@@ -3077,7 +3294,7 @@ function registerBuiltins(registry, disabled) {
|
|
|
3077
3294
|
function loadCustomParsers(registry, config, rootDir, disabled) {
|
|
3078
3295
|
for (const entry of config.parsers?.custom ?? []) {
|
|
3079
3296
|
try {
|
|
3080
|
-
const absPath = (0,
|
|
3297
|
+
const absPath = (0, import_node_path12.resolve)(rootDir, entry.path);
|
|
3081
3298
|
const mod = require(absPath);
|
|
3082
3299
|
const parser = "default" in mod ? mod.default : mod;
|
|
3083
3300
|
if (disabled.has(parser.id)) continue;
|
|
@@ -3104,11 +3321,11 @@ function createRegistry(config, rootDir) {
|
|
|
3104
3321
|
loadCustomParsers(registry, config, rootDir, disabled);
|
|
3105
3322
|
return registry;
|
|
3106
3323
|
}
|
|
3107
|
-
var
|
|
3324
|
+
var import_node_path12, ParserRegistry;
|
|
3108
3325
|
var init_parser_registry = __esm({
|
|
3109
3326
|
"src/server/graph/core/parser-registry.ts"() {
|
|
3110
3327
|
"use strict";
|
|
3111
|
-
|
|
3328
|
+
import_node_path12 = require("node:path");
|
|
3112
3329
|
init_typescript_project();
|
|
3113
3330
|
init_prisma_schema();
|
|
3114
3331
|
init_sql_migrations();
|
|
@@ -3279,7 +3496,7 @@ var init_merge = __esm({
|
|
|
3279
3496
|
|
|
3280
3497
|
// src/server/graph/core/graph-builder.ts
|
|
3281
3498
|
function readGraphFromDisk(rootDir, layer) {
|
|
3282
|
-
const filePath = (0,
|
|
3499
|
+
const filePath = (0, import_node_path13.join)(rootDir, ".launchsecure", "graphs", `${layer}.json`);
|
|
3283
3500
|
if (!(0, import_node_fs13.existsSync)(filePath)) return null;
|
|
3284
3501
|
try {
|
|
3285
3502
|
return JSON.parse((0, import_node_fs13.readFileSync)(filePath, "utf-8"));
|
|
@@ -3378,12 +3595,12 @@ function generateAll(rootDir) {
|
|
|
3378
3595
|
const extras = [...byLayer.keys()].filter((l) => !wellKnownOrder.includes(l)).sort();
|
|
3379
3596
|
return [...wellKnownOrder, ...extras].map((l) => byLayer.get(l)).filter((r) => !!r);
|
|
3380
3597
|
}
|
|
3381
|
-
var import_node_fs13,
|
|
3598
|
+
var import_node_fs13, import_node_path13;
|
|
3382
3599
|
var init_graph_builder = __esm({
|
|
3383
3600
|
"src/server/graph/core/graph-builder.ts"() {
|
|
3384
3601
|
"use strict";
|
|
3385
3602
|
import_node_fs13 = require("node:fs");
|
|
3386
|
-
|
|
3603
|
+
import_node_path13 = require("node:path");
|
|
3387
3604
|
init_config();
|
|
3388
3605
|
init_parser_registry();
|
|
3389
3606
|
init_merge();
|
|
@@ -3422,13 +3639,13 @@ function detectConventionDirs(rootDir, extraConventionDirs = []) {
|
|
|
3422
3639
|
const conventionDirs = [...CONVENTION_DIRS_BUILTIN, ...extraConventionDirs];
|
|
3423
3640
|
const searchDirs = [
|
|
3424
3641
|
rootDir,
|
|
3425
|
-
(0,
|
|
3426
|
-
(0,
|
|
3427
|
-
(0,
|
|
3642
|
+
(0, import_node_path14.join)(rootDir, "src"),
|
|
3643
|
+
(0, import_node_path14.join)(rootDir, "app"),
|
|
3644
|
+
(0, import_node_path14.join)(rootDir, "lib")
|
|
3428
3645
|
];
|
|
3429
3646
|
for (const base of searchDirs) {
|
|
3430
3647
|
for (const convention of conventionDirs) {
|
|
3431
|
-
const dir = (0,
|
|
3648
|
+
const dir = (0, import_node_path14.join)(base, convention);
|
|
3432
3649
|
if (!(0, import_node_fs14.existsSync)(dir)) continue;
|
|
3433
3650
|
try {
|
|
3434
3651
|
const stat = (0, import_node_fs14.statSync)(dir);
|
|
@@ -3505,12 +3722,12 @@ function extractModuleFromPath(id, extraTrivial, extraSkipSegments) {
|
|
|
3505
3722
|
}
|
|
3506
3723
|
return "root";
|
|
3507
3724
|
}
|
|
3508
|
-
var import_node_fs14,
|
|
3725
|
+
var import_node_fs14, import_node_path14, CONVENTION_DIRS_BUILTIN, GENERIC_ROLE_NAMES_BUILTIN, SKIP_SEGMENTS_BUILTIN, TRIVIAL_GROUPS, cachedRootDir, cachedConventionDirs, moduleTagger;
|
|
3509
3726
|
var init_module_tagger = __esm({
|
|
3510
3727
|
"src/server/graph/taggers/module-tagger.ts"() {
|
|
3511
3728
|
"use strict";
|
|
3512
3729
|
import_node_fs14 = require("node:fs");
|
|
3513
|
-
|
|
3730
|
+
import_node_path14 = require("node:path");
|
|
3514
3731
|
CONVENTION_DIRS_BUILTIN = ["features", "modules", "domains", "areas"];
|
|
3515
3732
|
GENERIC_ROLE_NAMES_BUILTIN = /* @__PURE__ */ new Set([
|
|
3516
3733
|
// JS/TS
|
|
@@ -3722,7 +3939,7 @@ function loadCustomTaggers(registry, config, rootDir, disabled) {
|
|
|
3722
3939
|
for (const entry of config.taggers?.custom ?? []) {
|
|
3723
3940
|
if (disabled.has(entry.id)) continue;
|
|
3724
3941
|
try {
|
|
3725
|
-
const absPath = (0,
|
|
3942
|
+
const absPath = (0, import_node_path15.resolve)(rootDir, entry.path);
|
|
3726
3943
|
const mod = require(absPath);
|
|
3727
3944
|
const tagger = "default" in mod ? mod.default : mod;
|
|
3728
3945
|
const override = config.taggers?.trackUntagged?.[tagger.id];
|
|
@@ -3743,11 +3960,11 @@ function createTaggerRegistry(config, rootDir) {
|
|
|
3743
3960
|
loadCustomTaggers(registry, config, rootDir, disabled);
|
|
3744
3961
|
return registry;
|
|
3745
3962
|
}
|
|
3746
|
-
var
|
|
3963
|
+
var import_node_path15, TaggerRegistry, BUILTIN_TAGGERS;
|
|
3747
3964
|
var init_tagger_registry = __esm({
|
|
3748
3965
|
"src/server/graph/core/tagger-registry.ts"() {
|
|
3749
3966
|
"use strict";
|
|
3750
|
-
|
|
3967
|
+
import_node_path15 = require("node:path");
|
|
3751
3968
|
init_module_tagger();
|
|
3752
3969
|
init_screen_tagger();
|
|
3753
3970
|
TaggerRegistry = class {
|
|
@@ -3775,7 +3992,7 @@ var init_tagger_registry = __esm({
|
|
|
3775
3992
|
|
|
3776
3993
|
// src/server/graph/core/tag-store.ts
|
|
3777
3994
|
function tagsFilePath(rootDir) {
|
|
3778
|
-
return (0,
|
|
3995
|
+
return (0, import_node_path16.join)(rootDir, GRAPHS_DIR, TAGS_FILENAME);
|
|
3779
3996
|
}
|
|
3780
3997
|
function readTagStore(rootDir) {
|
|
3781
3998
|
const filePath = tagsFilePath(rootDir);
|
|
@@ -3796,7 +4013,7 @@ function readTagStore(rootDir) {
|
|
|
3796
4013
|
}
|
|
3797
4014
|
function writeTagStore(rootDir, store) {
|
|
3798
4015
|
const filePath = tagsFilePath(rootDir);
|
|
3799
|
-
const dir = (0,
|
|
4016
|
+
const dir = (0, import_node_path16.dirname)(filePath);
|
|
3800
4017
|
(0, import_node_fs15.mkdirSync)(dir, { recursive: true });
|
|
3801
4018
|
const cleaned = {};
|
|
3802
4019
|
for (const [nodeId, tags] of Object.entries(store)) {
|
|
@@ -3822,12 +4039,12 @@ function removeTag(rootDir, nodeId, key) {
|
|
|
3822
4039
|
}
|
|
3823
4040
|
writeTagStore(rootDir, store);
|
|
3824
4041
|
}
|
|
3825
|
-
var import_node_fs15,
|
|
4042
|
+
var import_node_fs15, import_node_path16, TAGS_FILENAME, GRAPHS_DIR, tagCache;
|
|
3826
4043
|
var init_tag_store = __esm({
|
|
3827
4044
|
"src/server/graph/core/tag-store.ts"() {
|
|
3828
4045
|
"use strict";
|
|
3829
4046
|
import_node_fs15 = require("node:fs");
|
|
3830
|
-
|
|
4047
|
+
import_node_path16 = require("node:path");
|
|
3831
4048
|
TAGS_FILENAME = "tags.json";
|
|
3832
4049
|
GRAPHS_DIR = ".launchsecure/graphs";
|
|
3833
4050
|
tagCache = /* @__PURE__ */ new Map();
|
|
@@ -3836,18 +4053,18 @@ var init_tag_store = __esm({
|
|
|
3836
4053
|
|
|
3837
4054
|
// src/server/graph/index.ts
|
|
3838
4055
|
function getAvailableLayers(rootDir) {
|
|
3839
|
-
const dir = (0,
|
|
4056
|
+
const dir = (0, import_node_path17.join)(rootDir, GRAPHS_DIR2);
|
|
3840
4057
|
if (!(0, import_node_fs16.existsSync)(dir)) return [];
|
|
3841
4058
|
return (0, import_node_fs16.readdirSync)(dir).filter((f) => f.endsWith(".json") && f !== "tags.json").map((f) => f.replace(".json", ""));
|
|
3842
4059
|
}
|
|
3843
4060
|
function graphsDir(rootDir) {
|
|
3844
|
-
return (0,
|
|
4061
|
+
return (0, import_node_path17.join)(rootDir, GRAPHS_DIR2);
|
|
3845
4062
|
}
|
|
3846
4063
|
function graphFilePath(rootDir, layer) {
|
|
3847
|
-
return (0,
|
|
4064
|
+
return (0, import_node_path17.join)(graphsDir(rootDir), `${layer}.json`);
|
|
3848
4065
|
}
|
|
3849
4066
|
function tagsFilePath2(rootDir) {
|
|
3850
|
-
return (0,
|
|
4067
|
+
return (0, import_node_path17.join)(graphsDir(rootDir), "tags.json");
|
|
3851
4068
|
}
|
|
3852
4069
|
function getMtimeMs(filePath) {
|
|
3853
4070
|
if (!(0, import_node_fs16.existsSync)(filePath)) return 0;
|
|
@@ -3943,12 +4160,12 @@ async function generateGraph(rootDir, layer) {
|
|
|
3943
4160
|
}
|
|
3944
4161
|
return results;
|
|
3945
4162
|
}
|
|
3946
|
-
var import_node_fs16,
|
|
4163
|
+
var import_node_fs16, import_node_path17, GRAPHS_DIR2, graphCache, taggedCache;
|
|
3947
4164
|
var init_graph = __esm({
|
|
3948
4165
|
"src/server/graph/index.ts"() {
|
|
3949
4166
|
"use strict";
|
|
3950
4167
|
import_node_fs16 = require("node:fs");
|
|
3951
|
-
|
|
4168
|
+
import_node_path17 = require("node:path");
|
|
3952
4169
|
init_graph_builder();
|
|
3953
4170
|
init_config();
|
|
3954
4171
|
init_tagger_registry();
|
|
@@ -3963,7 +4180,7 @@ var init_graph = __esm({
|
|
|
3963
4180
|
|
|
3964
4181
|
// src/server/graph/core/audit-core.ts
|
|
3965
4182
|
function readGraphFile(rootDir, layer) {
|
|
3966
|
-
const filePath = (0,
|
|
4183
|
+
const filePath = (0, import_node_path18.join)(rootDir, ".launchsecure", "graphs", `${layer}.json`);
|
|
3967
4184
|
if (!(0, import_node_fs17.existsSync)(filePath)) return null;
|
|
3968
4185
|
try {
|
|
3969
4186
|
return JSON.parse((0, import_node_fs17.readFileSync)(filePath, "utf-8"));
|
|
@@ -4010,7 +4227,7 @@ function checkUnprotectedRoutes(rootDir) {
|
|
|
4010
4227
|
const api = readGraphFile(rootDir, "api");
|
|
4011
4228
|
const staticGraph = readGraphFile(rootDir, "static");
|
|
4012
4229
|
if (!api) return buildReport("api", "unprotected_routes", findings);
|
|
4013
|
-
const routePermsPath = (0,
|
|
4230
|
+
const routePermsPath = (0, import_node_path18.join)(rootDir, "src", "config", "route-permissions.ts");
|
|
4014
4231
|
let routePermsContent = "";
|
|
4015
4232
|
if ((0, import_node_fs17.existsSync)(routePermsPath)) {
|
|
4016
4233
|
routePermsContent = (0, import_node_fs17.readFileSync)(routePermsPath, "utf-8");
|
|
@@ -4090,7 +4307,7 @@ function checkUnenforcedPermissions(rootDir) {
|
|
|
4090
4307
|
const staticGraph = readGraphFile(rootDir, "static");
|
|
4091
4308
|
if (!staticGraph) return buildReport("static", "unenforced_permissions", findings);
|
|
4092
4309
|
const permissions = staticGraph.nodes.filter((n) => n.type === "seed_permission").map((n) => ({ id: n.id, key: n.value, name: n.name }));
|
|
4093
|
-
const routePermsPath = (0,
|
|
4310
|
+
const routePermsPath = (0, import_node_path18.join)(rootDir, "src", "config", "route-permissions.ts");
|
|
4094
4311
|
let routePermsContent = "";
|
|
4095
4312
|
if ((0, import_node_fs17.existsSync)(routePermsPath)) {
|
|
4096
4313
|
routePermsContent = (0, import_node_fs17.readFileSync)(routePermsPath, "utf-8");
|
|
@@ -4123,7 +4340,7 @@ function checkHardcodedValues(rootDir) {
|
|
|
4123
4340
|
const seen = /* @__PURE__ */ new Set();
|
|
4124
4341
|
for (const node of api.nodes) {
|
|
4125
4342
|
if (node.type !== "endpoint") continue;
|
|
4126
|
-
const filePath = (0,
|
|
4343
|
+
const filePath = (0, import_node_path18.join)(rootDir, "src", node.id);
|
|
4127
4344
|
if (!(0, import_node_fs17.existsSync)(filePath)) continue;
|
|
4128
4345
|
const content = (0, import_node_fs17.readFileSync)(filePath, "utf-8");
|
|
4129
4346
|
let m;
|
|
@@ -4219,12 +4436,12 @@ function formatAsPrompt(reports) {
|
|
|
4219
4436
|
if (lines.length === 0) return "No audit findings.";
|
|
4220
4437
|
return lines.join("\n");
|
|
4221
4438
|
}
|
|
4222
|
-
var import_node_fs17,
|
|
4439
|
+
var import_node_fs17, import_node_path18, CHECKS;
|
|
4223
4440
|
var init_audit_core = __esm({
|
|
4224
4441
|
"src/server/graph/core/audit-core.ts"() {
|
|
4225
4442
|
"use strict";
|
|
4226
4443
|
import_node_fs17 = require("node:fs");
|
|
4227
|
-
|
|
4444
|
+
import_node_path18 = require("node:path");
|
|
4228
4445
|
CHECKS = {
|
|
4229
4446
|
db: {
|
|
4230
4447
|
schema_drift: checkSchemaDrift,
|
|
@@ -4256,16 +4473,16 @@ function randomPort() {
|
|
|
4256
4473
|
function findProjectRoot(startDir) {
|
|
4257
4474
|
let dir = startDir;
|
|
4258
4475
|
for (let i = 0; i < 8; i++) {
|
|
4259
|
-
const graphsDir2 =
|
|
4260
|
-
if (import_node_fs18.default.existsSync(
|
|
4261
|
-
const parent =
|
|
4476
|
+
const graphsDir2 = import_node_path19.default.join(dir, ".launchsecure", "graphs");
|
|
4477
|
+
if (import_node_fs18.default.existsSync(import_node_path19.default.join(graphsDir2, "ui.json")) || import_node_fs18.default.existsSync(import_node_path19.default.join(graphsDir2, "api.json")) || import_node_fs18.default.existsSync(import_node_path19.default.join(graphsDir2, "db.json"))) return dir;
|
|
4478
|
+
const parent = import_node_path19.default.dirname(dir);
|
|
4262
4479
|
if (parent === dir) break;
|
|
4263
4480
|
dir = parent;
|
|
4264
4481
|
}
|
|
4265
4482
|
dir = startDir;
|
|
4266
4483
|
for (let i = 0; i < 8; i++) {
|
|
4267
|
-
if (import_node_fs18.default.existsSync(
|
|
4268
|
-
const parent =
|
|
4484
|
+
if (import_node_fs18.default.existsSync(import_node_path19.default.join(dir, ".git"))) return dir;
|
|
4485
|
+
const parent = import_node_path19.default.dirname(dir);
|
|
4269
4486
|
if (parent === dir) break;
|
|
4270
4487
|
dir = parent;
|
|
4271
4488
|
}
|
|
@@ -4274,7 +4491,7 @@ function findProjectRoot(startDir) {
|
|
|
4274
4491
|
function resolveRequestRoot(url, monorepoRoot, projects) {
|
|
4275
4492
|
const projectParam = url.searchParams.get("project");
|
|
4276
4493
|
if (!projectParam || projects.length === 0) return monorepoRoot;
|
|
4277
|
-
const resolved =
|
|
4494
|
+
const resolved = import_node_path19.default.resolve(monorepoRoot, projectParam);
|
|
4278
4495
|
if (!resolved.startsWith(monorepoRoot)) {
|
|
4279
4496
|
throw new Error("Project path outside monorepo root");
|
|
4280
4497
|
}
|
|
@@ -4326,14 +4543,14 @@ async function buildMergedGraph(root) {
|
|
|
4326
4543
|
}
|
|
4327
4544
|
function serveStatic(res, filePath) {
|
|
4328
4545
|
if (!import_node_fs18.default.existsSync(filePath) || !import_node_fs18.default.statSync(filePath).isFile()) return false;
|
|
4329
|
-
const ext =
|
|
4546
|
+
const ext = import_node_path19.default.extname(filePath).toLowerCase();
|
|
4330
4547
|
const mime = MIME_TYPES[ext] ?? "application/octet-stream";
|
|
4331
4548
|
res.writeHead(200, { "Content-Type": mime, "Cache-Control": "no-cache" });
|
|
4332
4549
|
import_node_fs18.default.createReadStream(filePath).pipe(res);
|
|
4333
4550
|
return true;
|
|
4334
4551
|
}
|
|
4335
4552
|
function serveIndex(res, clientDir) {
|
|
4336
|
-
const indexPath =
|
|
4553
|
+
const indexPath = import_node_path19.default.join(clientDir, "index.html");
|
|
4337
4554
|
if (!import_node_fs18.default.existsSync(indexPath)) {
|
|
4338
4555
|
res.writeHead(500, { "Content-Type": "text/plain" });
|
|
4339
4556
|
res.end(`LaunchChart client bundle not found at ${clientDir}. Run 'npm run build:chart-client'.`);
|
|
@@ -4342,14 +4559,14 @@ function serveIndex(res, clientDir) {
|
|
|
4342
4559
|
serveStatic(res, indexPath);
|
|
4343
4560
|
}
|
|
4344
4561
|
function tryListen(server, port) {
|
|
4345
|
-
return new Promise((
|
|
4562
|
+
return new Promise((resolve4, reject) => {
|
|
4346
4563
|
const onError = (err2) => {
|
|
4347
4564
|
server.off("listening", onListening);
|
|
4348
4565
|
reject(err2);
|
|
4349
4566
|
};
|
|
4350
4567
|
const onListening = () => {
|
|
4351
4568
|
server.off("error", onError);
|
|
4352
|
-
|
|
4569
|
+
resolve4(port);
|
|
4353
4570
|
};
|
|
4354
4571
|
server.once("error", onError);
|
|
4355
4572
|
server.once("listening", onListening);
|
|
@@ -4386,7 +4603,7 @@ async function startChartServer(opts = {}) {
|
|
|
4386
4603
|
}
|
|
4387
4604
|
return { port: existing.port, url: existing.url };
|
|
4388
4605
|
}
|
|
4389
|
-
const clientDir = opts.clientDir ??
|
|
4606
|
+
const clientDir = opts.clientDir ?? import_node_path19.default.join(__dirname, "..", "chart-client");
|
|
4390
4607
|
const rootConfig = loadConfig(projectRoot);
|
|
4391
4608
|
const projects = rootConfig.projects ?? [];
|
|
4392
4609
|
const server = import_node_http.default.createServer((req, res) => {
|
|
@@ -4402,11 +4619,11 @@ async function startChartServer(opts = {}) {
|
|
|
4402
4619
|
}
|
|
4403
4620
|
if (req.method === "GET" && url2.pathname === "/api/projects") {
|
|
4404
4621
|
const projectList = projects.length > 0 ? projects.map((p) => {
|
|
4405
|
-
const absRoot =
|
|
4406
|
-
const hasGraphs = import_node_fs18.default.existsSync(
|
|
4407
|
-
const hasNextConfig = import_node_fs18.default.existsSync(
|
|
4622
|
+
const absRoot = import_node_path19.default.resolve(projectRoot, p.root);
|
|
4623
|
+
const hasGraphs = import_node_fs18.default.existsSync(import_node_path19.default.join(absRoot, ".launchsecure", "graphs"));
|
|
4624
|
+
const hasNextConfig = import_node_fs18.default.existsSync(import_node_path19.default.join(absRoot, "next.config.ts")) || import_node_fs18.default.existsSync(import_node_path19.default.join(absRoot, "next.config.js")) || import_node_fs18.default.existsSync(import_node_path19.default.join(absRoot, "next.config.mjs"));
|
|
4408
4625
|
return { name: p.name, root: p.root, hasGraphs, hasNextConfig };
|
|
4409
|
-
}) : [{ name:
|
|
4626
|
+
}) : [{ name: import_node_path19.default.basename(projectRoot), root: ".", hasGraphs: import_node_fs18.default.existsSync(import_node_path19.default.join(projectRoot, ".launchsecure", "graphs")), hasNextConfig: true }];
|
|
4410
4627
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
4411
4628
|
res.end(JSON.stringify({ projects: projectList, monorepoRoot: projectRoot }));
|
|
4412
4629
|
return;
|
|
@@ -4452,18 +4669,18 @@ async function startChartServer(opts = {}) {
|
|
|
4452
4669
|
}
|
|
4453
4670
|
if (req.method === "GET" && url2.pathname === "/api/file-content") {
|
|
4454
4671
|
const relPath = url2.searchParams.get("path");
|
|
4455
|
-
if (!relPath || relPath.includes("..") ||
|
|
4672
|
+
if (!relPath || relPath.includes("..") || import_node_path19.default.isAbsolute(relPath)) {
|
|
4456
4673
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
4457
4674
|
res.end(JSON.stringify({ error: "Invalid path" }));
|
|
4458
4675
|
return;
|
|
4459
4676
|
}
|
|
4460
|
-
const filePath =
|
|
4677
|
+
const filePath = import_node_path19.default.join(reqRoot, relPath);
|
|
4461
4678
|
if (!filePath.startsWith(reqRoot) || !import_node_fs18.default.existsSync(filePath) || !import_node_fs18.default.statSync(filePath).isFile()) {
|
|
4462
4679
|
res.writeHead(404, { "Content-Type": "application/json" });
|
|
4463
4680
|
res.end(JSON.stringify({ error: "File not found" }));
|
|
4464
4681
|
return;
|
|
4465
4682
|
}
|
|
4466
|
-
const ext =
|
|
4683
|
+
const ext = import_node_path19.default.extname(filePath).toLowerCase();
|
|
4467
4684
|
const langMap = { ".ts": "typescript", ".tsx": "tsx", ".js": "javascript", ".jsx": "jsx", ".prisma": "prisma", ".json": "json", ".css": "css" };
|
|
4468
4685
|
const content = import_node_fs18.default.readFileSync(filePath, "utf-8");
|
|
4469
4686
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
@@ -4507,7 +4724,7 @@ async function startChartServer(opts = {}) {
|
|
|
4507
4724
|
req.on("end", () => {
|
|
4508
4725
|
try {
|
|
4509
4726
|
const newConfig = JSON.parse(body);
|
|
4510
|
-
const configPath =
|
|
4727
|
+
const configPath = import_node_path19.default.join(reqRoot, ".launchchart.json");
|
|
4511
4728
|
import_node_fs18.default.writeFileSync(configPath, JSON.stringify(newConfig, null, 2) + "\n", "utf-8");
|
|
4512
4729
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
4513
4730
|
res.end(JSON.stringify({ ok: true }));
|
|
@@ -4541,7 +4758,7 @@ async function startChartServer(opts = {}) {
|
|
|
4541
4758
|
const taggerConfig = JSON.parse(body);
|
|
4542
4759
|
const config2 = loadConfig(reqRoot);
|
|
4543
4760
|
config2.taggers = taggerConfig;
|
|
4544
|
-
const configPath =
|
|
4761
|
+
const configPath = import_node_path19.default.join(reqRoot, ".launchchart.json");
|
|
4545
4762
|
import_node_fs18.default.writeFileSync(configPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
4546
4763
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
4547
4764
|
res.end(JSON.stringify({ ok: true }));
|
|
@@ -4609,16 +4826,23 @@ async function startChartServer(opts = {}) {
|
|
|
4609
4826
|
const paths = resolveProjectPaths(reqRoot, config2);
|
|
4610
4827
|
const overrides = {
|
|
4611
4828
|
appDir: !!config2.paths?.appDir,
|
|
4612
|
-
dbDir: !!config2.paths?.dbDir
|
|
4829
|
+
dbDir: !!config2.paths?.dbDir,
|
|
4830
|
+
srcRoots: !!(config2.paths?.srcRoots && config2.paths.srcRoots.length > 0)
|
|
4613
4831
|
};
|
|
4832
|
+
const relFromRoot = (abs) => import_node_path19.default.relative(reqRoot, abs) || ".";
|
|
4614
4833
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
4615
4834
|
res.end(JSON.stringify({
|
|
4616
4835
|
projectRoot: reqRoot,
|
|
4617
4836
|
detected: paths ? {
|
|
4618
|
-
srcDir:
|
|
4619
|
-
appDir:
|
|
4620
|
-
apiDir:
|
|
4621
|
-
dbDir: paths.dbDir ?
|
|
4837
|
+
srcDir: relFromRoot(paths.srcDir),
|
|
4838
|
+
appDir: relFromRoot(paths.appDir),
|
|
4839
|
+
apiDir: relFromRoot(paths.apiDir),
|
|
4840
|
+
dbDir: paths.dbDir ? relFromRoot(paths.dbDir) : null,
|
|
4841
|
+
dbKind: paths.dbConfig.kind,
|
|
4842
|
+
dbSchemaPath: paths.dbConfig.schemaPath ? relFromRoot(paths.dbConfig.schemaPath) : null,
|
|
4843
|
+
dbMigrationsDir: paths.dbConfig.migrationsDir ? relFromRoot(paths.dbConfig.migrationsDir) : null,
|
|
4844
|
+
srcRoots: paths.srcRoots.map(relFromRoot),
|
|
4845
|
+
conventionFiles: paths.conventionFiles.map(relFromRoot)
|
|
4622
4846
|
} : null,
|
|
4623
4847
|
overrides,
|
|
4624
4848
|
isOverride: overrides.appDir
|
|
@@ -4627,8 +4851,8 @@ async function startChartServer(opts = {}) {
|
|
|
4627
4851
|
}
|
|
4628
4852
|
if (req.method === "GET" && url2.pathname === "/api/browse-dir") {
|
|
4629
4853
|
const browsePath = url2.searchParams.get("path") || projectRoot;
|
|
4630
|
-
const abs =
|
|
4631
|
-
const twoUp =
|
|
4854
|
+
const abs = import_node_path19.default.resolve(browsePath);
|
|
4855
|
+
const twoUp = import_node_path19.default.resolve(projectRoot, "..", "..");
|
|
4632
4856
|
if (!abs.startsWith(twoUp)) {
|
|
4633
4857
|
res.writeHead(403, { "Content-Type": "application/json" });
|
|
4634
4858
|
res.end(JSON.stringify({ ok: false, error: "Path outside allowed range" }));
|
|
@@ -4637,9 +4861,9 @@ async function startChartServer(opts = {}) {
|
|
|
4637
4861
|
try {
|
|
4638
4862
|
const entries = import_node_fs18.default.readdirSync(abs, { withFileTypes: true });
|
|
4639
4863
|
const dirs = entries.filter((e) => e.isDirectory() && !e.name.startsWith(".") && e.name !== "node_modules" && e.name !== "dist" && e.name !== ".next").map((e) => e.name).sort();
|
|
4640
|
-
const parent = abs !== twoUp ?
|
|
4864
|
+
const parent = abs !== twoUp ? import_node_path19.default.dirname(abs) : null;
|
|
4641
4865
|
res.writeHead(200, { "Content-Type": "application/json" });
|
|
4642
|
-
res.end(JSON.stringify({ current: abs, parent, dirs, relative:
|
|
4866
|
+
res.end(JSON.stringify({ current: abs, parent, dirs, relative: import_node_path19.default.relative(projectRoot, abs) || "." }));
|
|
4643
4867
|
} catch (err2) {
|
|
4644
4868
|
res.writeHead(400, { "Content-Type": "application/json" });
|
|
4645
4869
|
res.end(JSON.stringify({ ok: false, error: String(err2) }));
|
|
@@ -4665,7 +4889,7 @@ async function startChartServer(opts = {}) {
|
|
|
4665
4889
|
const { projects: newProjects } = JSON.parse(body);
|
|
4666
4890
|
const config2 = loadConfig(projectRoot);
|
|
4667
4891
|
config2.projects = newProjects.length > 0 ? newProjects : void 0;
|
|
4668
|
-
const configPath =
|
|
4892
|
+
const configPath = import_node_path19.default.join(projectRoot, ".launchchart.json");
|
|
4669
4893
|
import_node_fs18.default.writeFileSync(configPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
4670
4894
|
projects.length = 0;
|
|
4671
4895
|
if (config2.projects) projects.push(...config2.projects);
|
|
@@ -4679,7 +4903,7 @@ async function startChartServer(opts = {}) {
|
|
|
4679
4903
|
return;
|
|
4680
4904
|
}
|
|
4681
4905
|
if (url2.pathname !== "/") {
|
|
4682
|
-
const staticPath =
|
|
4906
|
+
const staticPath = import_node_path19.default.join(clientDir, url2.pathname);
|
|
4683
4907
|
if (serveStatic(res, staticPath)) return;
|
|
4684
4908
|
}
|
|
4685
4909
|
serveIndex(res, clientDir);
|
|
@@ -4739,13 +4963,13 @@ function runServeCli(argv) {
|
|
|
4739
4963
|
process.exit(1);
|
|
4740
4964
|
});
|
|
4741
4965
|
}
|
|
4742
|
-
var import_node_http, import_node_fs18,
|
|
4966
|
+
var import_node_http, import_node_fs18, import_node_path19, MAX_PORT_SCAN, MIME_TYPES;
|
|
4743
4967
|
var init_chart_serve = __esm({
|
|
4744
4968
|
"src/server/chart-serve.ts"() {
|
|
4745
4969
|
"use strict";
|
|
4746
4970
|
import_node_http = __toESM(require("node:http"));
|
|
4747
4971
|
import_node_fs18 = __toESM(require("node:fs"));
|
|
4748
|
-
|
|
4972
|
+
import_node_path19 = __toESM(require("node:path"));
|
|
4749
4973
|
init_graph();
|
|
4750
4974
|
init_lockfile();
|
|
4751
4975
|
init_config();
|
|
@@ -4781,9 +5005,9 @@ function walkForExtensions(dir, extCounts, depth = 0) {
|
|
|
4781
5005
|
if (entry.name.startsWith(".") && entry.isDirectory()) continue;
|
|
4782
5006
|
if (entry.isDirectory()) {
|
|
4783
5007
|
if (IGNORE_DIRS.has(entry.name)) continue;
|
|
4784
|
-
walkForExtensions((0,
|
|
5008
|
+
walkForExtensions((0, import_node_path20.join)(dir, entry.name), extCounts, depth + 1);
|
|
4785
5009
|
} else {
|
|
4786
|
-
const ext = (0,
|
|
5010
|
+
const ext = (0, import_node_path20.extname)(entry.name).toLowerCase();
|
|
4787
5011
|
if (ext && EXTENSION_TO_LANGUAGE[ext]) {
|
|
4788
5012
|
extCounts.set(ext, (extCounts.get(ext) ?? 0) + 1);
|
|
4789
5013
|
}
|
|
@@ -4822,12 +5046,12 @@ function detectLanguages(rootDir, supportedLanguages) {
|
|
|
4822
5046
|
});
|
|
4823
5047
|
return results;
|
|
4824
5048
|
}
|
|
4825
|
-
var import_node_fs19,
|
|
5049
|
+
var import_node_fs19, import_node_path20, EXTENSION_TO_LANGUAGE, IGNORE_DIRS, AUXILIARY_LANGUAGES;
|
|
4826
5050
|
var init_language_detection = __esm({
|
|
4827
5051
|
"src/server/graph/core/language-detection.ts"() {
|
|
4828
5052
|
"use strict";
|
|
4829
5053
|
import_node_fs19 = require("node:fs");
|
|
4830
|
-
|
|
5054
|
+
import_node_path20 = require("node:path");
|
|
4831
5055
|
EXTENSION_TO_LANGUAGE = {
|
|
4832
5056
|
// Web / Frontend
|
|
4833
5057
|
".ts": "typescript",
|
|
@@ -5388,11 +5612,11 @@ function handleReadGraph(args) {
|
|
|
5388
5612
|
return okJson(result);
|
|
5389
5613
|
}
|
|
5390
5614
|
function nodeToFilePath(rootDir, layer, nodeId) {
|
|
5391
|
-
if (layer === "ui" || layer === "api") return (0,
|
|
5392
|
-
if (layer === "db") return (0,
|
|
5393
|
-
const withSrc = (0,
|
|
5615
|
+
if (layer === "ui" || layer === "api") return (0, import_node_path21.join)(rootDir, "src", nodeId);
|
|
5616
|
+
if (layer === "db") return (0, import_node_path21.join)(rootDir, "prisma", "schema.prisma");
|
|
5617
|
+
const withSrc = (0, import_node_path21.join)(rootDir, "src", nodeId);
|
|
5394
5618
|
if ((0, import_node_fs20.existsSync)(withSrc)) return withSrc;
|
|
5395
|
-
const direct = (0,
|
|
5619
|
+
const direct = (0, import_node_path21.join)(rootDir, nodeId);
|
|
5396
5620
|
if ((0, import_node_fs20.existsSync)(direct)) return direct;
|
|
5397
5621
|
return null;
|
|
5398
5622
|
}
|
|
@@ -5605,9 +5829,9 @@ function handleStartChartServer(args) {
|
|
|
5605
5829
|
});
|
|
5606
5830
|
}
|
|
5607
5831
|
const entryPath = process.argv[1];
|
|
5608
|
-
const logDir = (0,
|
|
5832
|
+
const logDir = (0, import_node_path21.join)((0, import_node_os2.homedir)(), ".launchsecure");
|
|
5609
5833
|
(0, import_node_fs20.mkdirSync)(logDir, { recursive: true });
|
|
5610
|
-
const logPath = (0,
|
|
5834
|
+
const logPath = (0, import_node_path21.join)(logDir, "launch-chart.log");
|
|
5611
5835
|
const out = (0, import_node_fs20.openSync)(logPath, "a");
|
|
5612
5836
|
const err2 = (0, import_node_fs20.openSync)(logPath, "a");
|
|
5613
5837
|
const portArgs = args.port ? ["--port", String(args.port)] : [];
|
|
@@ -5729,18 +5953,18 @@ function handleDetectProjectStack() {
|
|
|
5729
5953
|
if (ref.type === "references_api") stats.references_api++;
|
|
5730
5954
|
}
|
|
5731
5955
|
}
|
|
5732
|
-
const srcDir = (0,
|
|
5956
|
+
const srcDir = (0, import_node_path21.join)(rootDir, "src");
|
|
5733
5957
|
if ((0, import_node_fs20.existsSync)(srcDir)) {
|
|
5734
5958
|
const scanDir = (dir) => {
|
|
5735
5959
|
if (!(0, import_node_fs20.existsSync)(dir)) return;
|
|
5736
5960
|
for (const entry of (0, import_node_fs20.readdirSync)(dir, { withFileTypes: true })) {
|
|
5737
5961
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
5738
|
-
const full = (0,
|
|
5962
|
+
const full = (0, import_node_path21.join)(dir, entry.name);
|
|
5739
5963
|
if (entry.isDirectory()) {
|
|
5740
5964
|
scanDir(full);
|
|
5741
5965
|
continue;
|
|
5742
5966
|
}
|
|
5743
|
-
if (![".ts", ".tsx"].includes((0,
|
|
5967
|
+
if (![".ts", ".tsx"].includes((0, import_node_path21.extname)(entry.name))) continue;
|
|
5744
5968
|
try {
|
|
5745
5969
|
const content = (0, import_node_fs20.readFileSync)(full, "utf-8");
|
|
5746
5970
|
const matches = content.match(/@api\s+(GET|POST|PUT|DELETE|PATCH)\s+\/\S+/g);
|
|
@@ -5896,12 +6120,12 @@ function startGraphMcpServer() {
|
|
|
5896
6120
|
process.stderr.write(`[launchsecure-graph] MCP server started (cwd: ${process.cwd()})
|
|
5897
6121
|
`);
|
|
5898
6122
|
}
|
|
5899
|
-
var import_node_fs20,
|
|
6123
|
+
var import_node_fs20, import_node_path21, import_node_child_process2, import_node_os2, SERVER_INFO, TOOLS, COMPACT_SCHEMA, COMPACT_NODE_KNOWN_KEYS, DEEP_FIELDS, EST_CHARS_PER_NODE_FULL, EST_CHARS_PER_NODE_MIN, EST_CHARS_PER_EDGE, DEFAULT_EST_NODE_FULL, DEFAULT_EST_NODE_MIN, DEFAULT_EST_EDGE, NEIGHBORHOOD_BUDGET_CHARS, BATCH_BUDGET_CHARS;
|
|
5900
6124
|
var init_graph_mcp = __esm({
|
|
5901
6125
|
"src/server/graph-mcp.ts"() {
|
|
5902
6126
|
"use strict";
|
|
5903
6127
|
import_node_fs20 = require("node:fs");
|
|
5904
|
-
|
|
6128
|
+
import_node_path21 = require("node:path");
|
|
5905
6129
|
import_node_child_process2 = require("node:child_process");
|
|
5906
6130
|
import_node_os2 = require("node:os");
|
|
5907
6131
|
init_graph();
|
|
@@ -6288,7 +6512,7 @@ Example: blast_points(node_id: "server/auth/middleware.ts", hops: 2) \u2192 retu
|
|
|
6288
6512
|
// src/server/graph-mcp-entry.ts
|
|
6289
6513
|
var import_node_child_process3 = require("node:child_process");
|
|
6290
6514
|
var import_node_fs21 = require("node:fs");
|
|
6291
|
-
var
|
|
6515
|
+
var import_node_path22 = __toESM(require("node:path"));
|
|
6292
6516
|
var import_node_os3 = require("node:os");
|
|
6293
6517
|
var import_node_fs22 = require("node:fs");
|
|
6294
6518
|
init_lockfile();
|
|
@@ -6306,9 +6530,9 @@ function maybeAutoServe() {
|
|
|
6306
6530
|
return;
|
|
6307
6531
|
}
|
|
6308
6532
|
try {
|
|
6309
|
-
const logDir =
|
|
6533
|
+
const logDir = import_node_path22.default.join((0, import_node_os3.homedir)(), ".launchsecure");
|
|
6310
6534
|
(0, import_node_fs22.mkdirSync)(logDir, { recursive: true });
|
|
6311
|
-
const logPath =
|
|
6535
|
+
const logPath = import_node_path22.default.join(logDir, "launch-chart.log");
|
|
6312
6536
|
const out = (0, import_node_fs21.openSync)(logPath, "a");
|
|
6313
6537
|
const err2 = (0, import_node_fs21.openSync)(logPath, "a");
|
|
6314
6538
|
const entryPath = process.argv[1];
|