@launchsecure/launch-kit 0.0.38 → 0.0.40
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/beacon/beacon.mjs +308 -298
- package/dist/beacon/beacon.mjs.map +1 -1
- package/dist/beacon/beacon.umd.js +6 -6
- package/dist/beacon/beacon.umd.js.map +1 -1
- package/dist/beacon/types/internal/screenshot.d.ts.map +1 -1
- package/dist/chart-client/assets/index-CWJFFDPu.css +1 -0
- package/dist/chart-client/index.html +2 -2
- package/dist/client/assets/index-CTzFcfGV.css +32 -0
- package/dist/client/index.html +2 -2
- package/dist/council-client/assets/index-ArgRc5mN.css +1 -0
- package/dist/council-client/index.html +2 -2
- package/dist/deck-client/assets/{_baseUniq-CgW32Gdk.js → _baseUniq-BZP7n41F.js} +1 -1
- package/dist/deck-client/assets/{arc-D-Mg9gvM.js → arc-31biU3Az.js} +1 -1
- package/dist/deck-client/assets/{architectureDiagram-Q4EWVU46-CdTsXsgl.js → architectureDiagram-Q4EWVU46-DHg6Ss--.js} +1 -1
- package/dist/deck-client/assets/{blockDiagram-DXYQGD6D-mwTneYyB.js → blockDiagram-DXYQGD6D-CUdblaWk.js} +1 -1
- package/dist/deck-client/assets/{c4Diagram-AHTNJAMY-C4R8IbjO.js → c4Diagram-AHTNJAMY-MfAO5lak.js} +1 -1
- package/dist/deck-client/assets/channel-BBkRLdnC.js +1 -0
- package/dist/deck-client/assets/{chunk-4BX2VUAB-ZWuRIUwb.js → chunk-4BX2VUAB-DQ1MrGgN.js} +1 -1
- package/dist/deck-client/assets/{chunk-4TB4RGXK-PNHX10sF.js → chunk-4TB4RGXK-BUJtZ7jO.js} +1 -1
- package/dist/deck-client/assets/{chunk-55IACEB6-CD9MUgPr.js → chunk-55IACEB6-BdSnXB6g.js} +1 -1
- package/dist/deck-client/assets/{chunk-EDXVE4YY-C_CpORb3.js → chunk-EDXVE4YY-94yZIUI8.js} +1 -1
- package/dist/deck-client/assets/{chunk-FMBD7UC4-Bg5RoVC-.js → chunk-FMBD7UC4-PnZ9v6ey.js} +1 -1
- package/dist/deck-client/assets/{chunk-OYMX7WX6-DhTwgQwd.js → chunk-OYMX7WX6-DXrWNOsV.js} +1 -1
- package/dist/deck-client/assets/{chunk-QZHKN3VN-C5VLMaFa.js → chunk-QZHKN3VN-CsIGIDKX.js} +1 -1
- package/dist/deck-client/assets/{chunk-YZCP3GAM-NAGHy4Sr.js → chunk-YZCP3GAM-DVkBO9tn.js} +1 -1
- package/dist/deck-client/assets/classDiagram-6PBFFD2Q-DFCaeF-7.js +1 -0
- package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-DFCaeF-7.js +1 -0
- package/dist/deck-client/assets/clone-GCEVRScB.js +1 -0
- package/dist/deck-client/assets/{cose-bilkent-S5V4N54A-CpUczjZk.js → cose-bilkent-S5V4N54A-m126Oh3b.js} +1 -1
- package/dist/deck-client/assets/{dagre-KV5264BT-BOvb07MG.js → dagre-KV5264BT-C2aig8U5.js} +1 -1
- package/dist/deck-client/assets/{diagram-5BDNPKRD-BPxwTiC-.js → diagram-5BDNPKRD-CKpoRfGn.js} +1 -1
- package/dist/deck-client/assets/{diagram-G4DWMVQ6-Dz_gsHgx.js → diagram-G4DWMVQ6-Cjh115Ep.js} +1 -1
- package/dist/deck-client/assets/{diagram-MMDJMWI5-B7z-oVTW.js → diagram-MMDJMWI5-DKlBv_2L.js} +1 -1
- package/dist/deck-client/assets/{diagram-TYMM5635-CAIAglLQ.js → diagram-TYMM5635-CdBh4cEn.js} +1 -1
- package/dist/deck-client/assets/{erDiagram-SMLLAGMA-BiViTWF3.js → erDiagram-SMLLAGMA-56pn_93p.js} +1 -1
- package/dist/deck-client/assets/{flowDiagram-DWJPFMVM-DYVemp0H.js → flowDiagram-DWJPFMVM-BtV3M5xJ.js} +1 -1
- package/dist/deck-client/assets/{ganttDiagram-T4ZO3ILL-Chc1Iyu1.js → ganttDiagram-T4ZO3ILL-DTIsC6Zg.js} +1 -1
- package/dist/deck-client/assets/{gitGraphDiagram-UUTBAWPF-B7eFgaj5.js → gitGraphDiagram-UUTBAWPF-CJYeyCLe.js} +1 -1
- package/dist/deck-client/assets/{graph-CKaIoNwb.js → graph-BDvMu1Ss.js} +1 -1
- package/dist/deck-client/assets/index-D4eSxcBn.css +1 -0
- package/dist/deck-client/assets/{index-BRawc7RA.js → index-QnGVE9PZ.js} +83 -83
- package/dist/deck-client/assets/{infoDiagram-42DDH7IO-BxsVq7vO.js → infoDiagram-42DDH7IO-BWyKJnpW.js} +1 -1
- package/dist/deck-client/assets/{ishikawaDiagram-UXIWVN3A-DAM7vPwa.js → ishikawaDiagram-UXIWVN3A-DXYkdO3T.js} +1 -1
- package/dist/deck-client/assets/{journeyDiagram-VCZTEJTY-Xe20Nf7R.js → journeyDiagram-VCZTEJTY-C2zBr-J5.js} +1 -1
- package/dist/deck-client/assets/{kanban-definition-6JOO6SKY-DS8YguzB.js → kanban-definition-6JOO6SKY-CdoYLS4Z.js} +1 -1
- package/dist/deck-client/assets/{layout-DKMBpzR-.js → layout-vOnxnCQU.js} +1 -1
- package/dist/deck-client/assets/{linear-DTNtBg5h.js → linear-B0J0WCGz.js} +1 -1
- package/dist/deck-client/assets/{min-C4DrxCcA.js → min-B0AXlT9L.js} +1 -1
- package/dist/deck-client/assets/{mindmap-definition-QFDTVHPH-B4nEtsw5.js → mindmap-definition-QFDTVHPH-oAybLedr.js} +1 -1
- package/dist/deck-client/assets/{pieDiagram-DEJITSTG-BzHdGNu5.js → pieDiagram-DEJITSTG-BjHyHxGk.js} +1 -1
- package/dist/deck-client/assets/{quadrantDiagram-34T5L4WZ-CaX0SD4-.js → quadrantDiagram-34T5L4WZ-dtluDZXs.js} +1 -1
- package/dist/deck-client/assets/{requirementDiagram-MS252O5E-QeG4p2ni.js → requirementDiagram-MS252O5E-Cq8l7bOl.js} +1 -1
- package/dist/deck-client/assets/{sankeyDiagram-XADWPNL6-BoAwgAj-.js → sankeyDiagram-XADWPNL6-C1Vih91z.js} +1 -1
- package/dist/deck-client/assets/{sequenceDiagram-FGHM5R23-Dn4pYYgu.js → sequenceDiagram-FGHM5R23-CYkd7oQK.js} +1 -1
- package/dist/deck-client/assets/{stateDiagram-FHFEXIEX-Is6KRmQV.js → stateDiagram-FHFEXIEX-CtyG8wBK.js} +1 -1
- package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-BLyKWfcN.js +1 -0
- package/dist/deck-client/assets/{timeline-definition-GMOUNBTQ-v64IZGuY.js → timeline-definition-GMOUNBTQ-DZIxSyd1.js} +1 -1
- package/dist/deck-client/assets/{vennDiagram-DHZGUBPP-noh9eouF.js → vennDiagram-DHZGUBPP-Ct4JVRDM.js} +1 -1
- package/dist/deck-client/assets/{wardley-RL74JXVD-cJ_1is2S.js → wardley-RL74JXVD-V29ycxOW.js} +1 -1
- package/dist/deck-client/assets/{wardleyDiagram-NUSXRM2D-DxR4j737.js → wardleyDiagram-NUSXRM2D-D-Ua6Cmi.js} +1 -1
- package/dist/deck-client/assets/{xychartDiagram-5P7HB3ND-B26vodaL.js → xychartDiagram-5P7HB3ND-BPCOuRVl.js} +1 -1
- package/dist/deck-client/index.html +2 -2
- package/dist/server/beacon-monitor-entry.js +106 -24
- package/dist/server/chart-serve.js +544 -247
- package/dist/server/cli.js +743 -324
- package/dist/server/council-entry.js +16 -3
- package/dist/server/council-serve.js +15 -2
- package/dist/server/deck-mcp-entry.js +270 -108
- package/dist/server/deck-serve.js +101 -23
- package/dist/server/fb-wizard.js +0 -0
- package/dist/server/graph-mcp-entry.js +866 -357
- package/dist/server/init-entry.js +152 -25
- package/dist/server/orbit-entry.js +91 -7
- package/dist/server/radar-docker-init-entry.js +0 -0
- package/dist/server/radar-entrypoint-entry.js +0 -0
- package/dist/server/radar-teardown-entry.js +0 -0
- package/dist/server/recall-entry.js +94 -12
- package/dist/server/rover-entry.js +44 -1
- package/package.json +23 -22
- package/scaffolds/ls-marketplace/plugins/kit/commands/activate-statusline.md +8 -7
- package/scaffolds/ls-marketplace/plugins/kit/commands/deactivate-statusline.md +2 -2
- package/scaffolds/ls-marketplace/plugins/kit/skills/comms/SKILL.md +88 -0
- package/scaffolds/ls-marketplace/plugins/kit/skills/project-info/SKILL.md +88 -0
- package/scaffolds/ls-marketplace/plugins/kit/skills/slides/SKILL.md +118 -0
- package/scaffolds/migrate-safety/scripts/migrate-with-backup.sh +0 -0
- package/scaffolds/recall-hook/scripts/ensure-recall.sh +0 -0
- package/scaffolds/statusline/statusline-base.sh +20 -0
- package/scaffolds/statusline/statusline-mcp.sh +68 -19
- package/scaffolds/statusline/statusline-wrapper.sh +12 -9
- package/dist/chart-client/assets/index-B6rR0CWx.css +0 -1
- package/dist/client/assets/index-D6uX1lQe.css +0 -32
- package/dist/council-client/assets/index-CleYLarJ.css +0 -1
- package/dist/deck-client/assets/channel-CuSee7GO.js +0 -1
- package/dist/deck-client/assets/classDiagram-6PBFFD2Q-_kTisqzs.js +0 -1
- package/dist/deck-client/assets/classDiagram-v2-HSJHXN6E-_kTisqzs.js +0 -1
- package/dist/deck-client/assets/clone-kb3zkY60.js +0 -1
- package/dist/deck-client/assets/index-55P73aS_.css +0 -1
- package/dist/deck-client/assets/stateDiagram-v2-QKLJ7IA2-Cy45Ttqq.js +0 -1
- /package/dist/chart-client/assets/{index-C_xCi3gW.js → index-Dzlj-oCj.js} +0 -0
- /package/dist/client/assets/{index-CRecYFUA.js → index-tTg_ezUF.js} +0 -0
- /package/dist/council-client/assets/{index-DO-Vn15O.js → index-B1v46vTE.js} +0 -0
package/dist/server/cli.js
CHANGED
|
@@ -1752,7 +1752,7 @@ var require_usage_reader = __commonJS({
|
|
|
1752
1752
|
async readJsonlFile(filePath, cutoffTime) {
|
|
1753
1753
|
const entries = [];
|
|
1754
1754
|
const fileProcessedEntries = /* @__PURE__ */ new Set();
|
|
1755
|
-
return new Promise((
|
|
1755
|
+
return new Promise((resolve7) => {
|
|
1756
1756
|
const rl = readline.createInterface({
|
|
1757
1757
|
input: createReadStream(filePath),
|
|
1758
1758
|
crlfDelay: Infinity
|
|
@@ -1810,11 +1810,11 @@ var require_usage_reader = __commonJS({
|
|
|
1810
1810
|
}
|
|
1811
1811
|
});
|
|
1812
1812
|
rl.on("close", () => {
|
|
1813
|
-
|
|
1813
|
+
resolve7(entries);
|
|
1814
1814
|
});
|
|
1815
1815
|
rl.on("error", (error) => {
|
|
1816
1816
|
console.error("Error reading file:", filePath, error);
|
|
1817
|
-
|
|
1817
|
+
resolve7(entries);
|
|
1818
1818
|
});
|
|
1819
1819
|
});
|
|
1820
1820
|
}
|
|
@@ -3623,7 +3623,7 @@ var require_src = __commonJS({
|
|
|
3623
3623
|
if (session.active) throw new Error(`Agent already running in session ${sessionId}`);
|
|
3624
3624
|
const { command, args = [], env = {} } = options;
|
|
3625
3625
|
if (!command) throw new Error("startScriptInSession requires a command");
|
|
3626
|
-
return new Promise((
|
|
3626
|
+
return new Promise((resolve7, reject) => {
|
|
3627
3627
|
this.scriptBridge.startSession(sessionId, {
|
|
3628
3628
|
command,
|
|
3629
3629
|
args,
|
|
@@ -3645,7 +3645,7 @@ var require_src = __commonJS({
|
|
|
3645
3645
|
session.lastActivity = /* @__PURE__ */ new Date();
|
|
3646
3646
|
this.broadcastToSession(sessionId, { type: "script_stopped", sessionId });
|
|
3647
3647
|
if (exitCode === 0) {
|
|
3648
|
-
|
|
3648
|
+
resolve7({ code: exitCode, signal });
|
|
3649
3649
|
} else {
|
|
3650
3650
|
reject(new Error(`Script exited with code ${exitCode}`));
|
|
3651
3651
|
}
|
|
@@ -5567,9 +5567,9 @@ var require_dispatcher_base = __commonJS({
|
|
|
5567
5567
|
}
|
|
5568
5568
|
close(callback) {
|
|
5569
5569
|
if (callback === void 0) {
|
|
5570
|
-
return new Promise((
|
|
5570
|
+
return new Promise((resolve7, reject) => {
|
|
5571
5571
|
this.close((err2, data) => {
|
|
5572
|
-
return err2 ? reject(err2) :
|
|
5572
|
+
return err2 ? reject(err2) : resolve7(data);
|
|
5573
5573
|
});
|
|
5574
5574
|
});
|
|
5575
5575
|
}
|
|
@@ -5607,12 +5607,12 @@ var require_dispatcher_base = __commonJS({
|
|
|
5607
5607
|
err2 = null;
|
|
5608
5608
|
}
|
|
5609
5609
|
if (callback === void 0) {
|
|
5610
|
-
return new Promise((
|
|
5610
|
+
return new Promise((resolve7, reject) => {
|
|
5611
5611
|
this.destroy(err2, (err3, data) => {
|
|
5612
5612
|
return err3 ? (
|
|
5613
5613
|
/* istanbul ignore next: should never error */
|
|
5614
5614
|
reject(err3)
|
|
5615
|
-
) :
|
|
5615
|
+
) : resolve7(data);
|
|
5616
5616
|
});
|
|
5617
5617
|
});
|
|
5618
5618
|
}
|
|
@@ -7879,8 +7879,8 @@ var require_util2 = __commonJS({
|
|
|
7879
7879
|
function createDeferredPromise() {
|
|
7880
7880
|
let res;
|
|
7881
7881
|
let rej;
|
|
7882
|
-
const promise = new Promise((
|
|
7883
|
-
res =
|
|
7882
|
+
const promise = new Promise((resolve7, reject) => {
|
|
7883
|
+
res = resolve7;
|
|
7884
7884
|
rej = reject;
|
|
7885
7885
|
});
|
|
7886
7886
|
return { promise, resolve: res, reject: rej };
|
|
@@ -10021,12 +10021,12 @@ upgrade: ${upgrade}\r
|
|
|
10021
10021
|
cb();
|
|
10022
10022
|
}
|
|
10023
10023
|
}
|
|
10024
|
-
const waitForDrain = () => new Promise((
|
|
10024
|
+
const waitForDrain = () => new Promise((resolve7, reject) => {
|
|
10025
10025
|
assert(callback === null);
|
|
10026
10026
|
if (socket[kError]) {
|
|
10027
10027
|
reject(socket[kError]);
|
|
10028
10028
|
} else {
|
|
10029
|
-
callback =
|
|
10029
|
+
callback = resolve7;
|
|
10030
10030
|
}
|
|
10031
10031
|
});
|
|
10032
10032
|
socket.on("close", onDrain).on("drain", onDrain);
|
|
@@ -10663,12 +10663,12 @@ var require_client_h2 = __commonJS({
|
|
|
10663
10663
|
cb();
|
|
10664
10664
|
}
|
|
10665
10665
|
}
|
|
10666
|
-
const waitForDrain = () => new Promise((
|
|
10666
|
+
const waitForDrain = () => new Promise((resolve7, reject) => {
|
|
10667
10667
|
assert(callback === null);
|
|
10668
10668
|
if (socket[kError]) {
|
|
10669
10669
|
reject(socket[kError]);
|
|
10670
10670
|
} else {
|
|
10671
|
-
callback =
|
|
10671
|
+
callback = resolve7;
|
|
10672
10672
|
}
|
|
10673
10673
|
});
|
|
10674
10674
|
h2stream.on("close", onDrain).on("drain", onDrain);
|
|
@@ -11146,16 +11146,16 @@ var require_client = __commonJS({
|
|
|
11146
11146
|
return this[kNeedDrain] < 2;
|
|
11147
11147
|
}
|
|
11148
11148
|
async [kClose]() {
|
|
11149
|
-
return new Promise((
|
|
11149
|
+
return new Promise((resolve7) => {
|
|
11150
11150
|
if (this[kSize]) {
|
|
11151
|
-
this[kClosedResolve] =
|
|
11151
|
+
this[kClosedResolve] = resolve7;
|
|
11152
11152
|
} else {
|
|
11153
|
-
|
|
11153
|
+
resolve7(null);
|
|
11154
11154
|
}
|
|
11155
11155
|
});
|
|
11156
11156
|
}
|
|
11157
11157
|
async [kDestroy](err2) {
|
|
11158
|
-
return new Promise((
|
|
11158
|
+
return new Promise((resolve7) => {
|
|
11159
11159
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
11160
11160
|
for (let i = 0; i < requests.length; i++) {
|
|
11161
11161
|
const request = requests[i];
|
|
@@ -11166,7 +11166,7 @@ var require_client = __commonJS({
|
|
|
11166
11166
|
this[kClosedResolve]();
|
|
11167
11167
|
this[kClosedResolve] = null;
|
|
11168
11168
|
}
|
|
11169
|
-
|
|
11169
|
+
resolve7(null);
|
|
11170
11170
|
};
|
|
11171
11171
|
if (this[kHTTPContext]) {
|
|
11172
11172
|
this[kHTTPContext].destroy(err2, callback);
|
|
@@ -11217,7 +11217,7 @@ var require_client = __commonJS({
|
|
|
11217
11217
|
});
|
|
11218
11218
|
}
|
|
11219
11219
|
try {
|
|
11220
|
-
const socket = await new Promise((
|
|
11220
|
+
const socket = await new Promise((resolve7, reject) => {
|
|
11221
11221
|
client[kConnector]({
|
|
11222
11222
|
host,
|
|
11223
11223
|
hostname,
|
|
@@ -11229,7 +11229,7 @@ var require_client = __commonJS({
|
|
|
11229
11229
|
if (err2) {
|
|
11230
11230
|
reject(err2);
|
|
11231
11231
|
} else {
|
|
11232
|
-
|
|
11232
|
+
resolve7(socket2);
|
|
11233
11233
|
}
|
|
11234
11234
|
});
|
|
11235
11235
|
});
|
|
@@ -11565,8 +11565,8 @@ var require_pool_base = __commonJS({
|
|
|
11565
11565
|
if (this[kQueue].isEmpty()) {
|
|
11566
11566
|
await Promise.all(this[kClients].map((c) => c.close()));
|
|
11567
11567
|
} else {
|
|
11568
|
-
await new Promise((
|
|
11569
|
-
this[kClosedResolve] =
|
|
11568
|
+
await new Promise((resolve7) => {
|
|
11569
|
+
this[kClosedResolve] = resolve7;
|
|
11570
11570
|
});
|
|
11571
11571
|
}
|
|
11572
11572
|
}
|
|
@@ -12781,7 +12781,7 @@ var require_readable = __commonJS({
|
|
|
12781
12781
|
if (this._readableState.closeEmitted) {
|
|
12782
12782
|
return null;
|
|
12783
12783
|
}
|
|
12784
|
-
return await new Promise((
|
|
12784
|
+
return await new Promise((resolve7, reject) => {
|
|
12785
12785
|
if (this[kContentLength] > limit) {
|
|
12786
12786
|
this.destroy(new AbortError());
|
|
12787
12787
|
}
|
|
@@ -12794,7 +12794,7 @@ var require_readable = __commonJS({
|
|
|
12794
12794
|
if (signal?.aborted) {
|
|
12795
12795
|
reject(signal.reason ?? new AbortError());
|
|
12796
12796
|
} else {
|
|
12797
|
-
|
|
12797
|
+
resolve7(null);
|
|
12798
12798
|
}
|
|
12799
12799
|
}).on("error", noop).on("data", function(chunk) {
|
|
12800
12800
|
limit -= chunk.length;
|
|
@@ -12813,7 +12813,7 @@ var require_readable = __commonJS({
|
|
|
12813
12813
|
}
|
|
12814
12814
|
async function consume(stream, type) {
|
|
12815
12815
|
assert(!stream[kConsume]);
|
|
12816
|
-
return new Promise((
|
|
12816
|
+
return new Promise((resolve7, reject) => {
|
|
12817
12817
|
if (isUnusable(stream)) {
|
|
12818
12818
|
const rState = stream._readableState;
|
|
12819
12819
|
if (rState.destroyed && rState.closeEmitted === false) {
|
|
@@ -12830,7 +12830,7 @@ var require_readable = __commonJS({
|
|
|
12830
12830
|
stream[kConsume] = {
|
|
12831
12831
|
type,
|
|
12832
12832
|
stream,
|
|
12833
|
-
resolve:
|
|
12833
|
+
resolve: resolve7,
|
|
12834
12834
|
reject,
|
|
12835
12835
|
length: 0,
|
|
12836
12836
|
body: []
|
|
@@ -12900,18 +12900,18 @@ var require_readable = __commonJS({
|
|
|
12900
12900
|
return buffer;
|
|
12901
12901
|
}
|
|
12902
12902
|
function consumeEnd(consume2) {
|
|
12903
|
-
const { type, body, resolve:
|
|
12903
|
+
const { type, body, resolve: resolve7, stream, length } = consume2;
|
|
12904
12904
|
try {
|
|
12905
12905
|
if (type === "text") {
|
|
12906
|
-
|
|
12906
|
+
resolve7(chunksDecode(body, length));
|
|
12907
12907
|
} else if (type === "json") {
|
|
12908
|
-
|
|
12908
|
+
resolve7(JSON.parse(chunksDecode(body, length)));
|
|
12909
12909
|
} else if (type === "arrayBuffer") {
|
|
12910
|
-
|
|
12910
|
+
resolve7(chunksConcat(body, length).buffer);
|
|
12911
12911
|
} else if (type === "blob") {
|
|
12912
|
-
|
|
12912
|
+
resolve7(new Blob(body, { type: stream[kContentType] }));
|
|
12913
12913
|
} else if (type === "bytes") {
|
|
12914
|
-
|
|
12914
|
+
resolve7(chunksConcat(body, length));
|
|
12915
12915
|
}
|
|
12916
12916
|
consumeFinish(consume2);
|
|
12917
12917
|
} catch (err2) {
|
|
@@ -13168,9 +13168,9 @@ var require_api_request = __commonJS({
|
|
|
13168
13168
|
};
|
|
13169
13169
|
function request(opts, callback) {
|
|
13170
13170
|
if (callback === void 0) {
|
|
13171
|
-
return new Promise((
|
|
13171
|
+
return new Promise((resolve7, reject) => {
|
|
13172
13172
|
request.call(this, opts, (err2, data) => {
|
|
13173
|
-
return err2 ? reject(err2) :
|
|
13173
|
+
return err2 ? reject(err2) : resolve7(data);
|
|
13174
13174
|
});
|
|
13175
13175
|
});
|
|
13176
13176
|
}
|
|
@@ -13393,9 +13393,9 @@ var require_api_stream = __commonJS({
|
|
|
13393
13393
|
};
|
|
13394
13394
|
function stream(opts, factory, callback) {
|
|
13395
13395
|
if (callback === void 0) {
|
|
13396
|
-
return new Promise((
|
|
13396
|
+
return new Promise((resolve7, reject) => {
|
|
13397
13397
|
stream.call(this, opts, factory, (err2, data) => {
|
|
13398
|
-
return err2 ? reject(err2) :
|
|
13398
|
+
return err2 ? reject(err2) : resolve7(data);
|
|
13399
13399
|
});
|
|
13400
13400
|
});
|
|
13401
13401
|
}
|
|
@@ -13680,9 +13680,9 @@ var require_api_upgrade = __commonJS({
|
|
|
13680
13680
|
};
|
|
13681
13681
|
function upgrade(opts, callback) {
|
|
13682
13682
|
if (callback === void 0) {
|
|
13683
|
-
return new Promise((
|
|
13683
|
+
return new Promise((resolve7, reject) => {
|
|
13684
13684
|
upgrade.call(this, opts, (err2, data) => {
|
|
13685
|
-
return err2 ? reject(err2) :
|
|
13685
|
+
return err2 ? reject(err2) : resolve7(data);
|
|
13686
13686
|
});
|
|
13687
13687
|
});
|
|
13688
13688
|
}
|
|
@@ -13774,9 +13774,9 @@ var require_api_connect = __commonJS({
|
|
|
13774
13774
|
};
|
|
13775
13775
|
function connect(opts, callback) {
|
|
13776
13776
|
if (callback === void 0) {
|
|
13777
|
-
return new Promise((
|
|
13777
|
+
return new Promise((resolve7, reject) => {
|
|
13778
13778
|
connect.call(this, opts, (err2, data) => {
|
|
13779
|
-
return err2 ? reject(err2) :
|
|
13779
|
+
return err2 ? reject(err2) : resolve7(data);
|
|
13780
13780
|
});
|
|
13781
13781
|
});
|
|
13782
13782
|
}
|
|
@@ -17638,7 +17638,7 @@ var require_fetch = __commonJS({
|
|
|
17638
17638
|
function dispatch({ body }) {
|
|
17639
17639
|
const url = requestCurrentURL(request);
|
|
17640
17640
|
const agent = fetchParams.controller.dispatcher;
|
|
17641
|
-
return new Promise((
|
|
17641
|
+
return new Promise((resolve7, reject) => agent.dispatch(
|
|
17642
17642
|
{
|
|
17643
17643
|
path: url.pathname + url.search,
|
|
17644
17644
|
origin: url.origin,
|
|
@@ -17714,7 +17714,7 @@ var require_fetch = __commonJS({
|
|
|
17714
17714
|
}
|
|
17715
17715
|
}
|
|
17716
17716
|
const onError = this.onError.bind(this);
|
|
17717
|
-
|
|
17717
|
+
resolve7({
|
|
17718
17718
|
status,
|
|
17719
17719
|
statusText,
|
|
17720
17720
|
headersList,
|
|
@@ -17760,7 +17760,7 @@ var require_fetch = __commonJS({
|
|
|
17760
17760
|
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
17761
17761
|
headersList.append(bufferToLowerCasedHeaderName(rawHeaders[i]), rawHeaders[i + 1].toString("latin1"), true);
|
|
17762
17762
|
}
|
|
17763
|
-
|
|
17763
|
+
resolve7({
|
|
17764
17764
|
status,
|
|
17765
17765
|
statusText: STATUS_CODES[status],
|
|
17766
17766
|
headersList,
|
|
@@ -21436,8 +21436,8 @@ var require_util8 = __commonJS({
|
|
|
21436
21436
|
return true;
|
|
21437
21437
|
}
|
|
21438
21438
|
function delay(ms) {
|
|
21439
|
-
return new Promise((
|
|
21440
|
-
setTimeout(
|
|
21439
|
+
return new Promise((resolve7) => {
|
|
21440
|
+
setTimeout(resolve7, ms).unref();
|
|
21441
21441
|
});
|
|
21442
21442
|
}
|
|
21443
21443
|
module2.exports = {
|
|
@@ -22628,7 +22628,7 @@ function resolveWorkerPath() {
|
|
|
22628
22628
|
);
|
|
22629
22629
|
}
|
|
22630
22630
|
function runParseInWorker(req) {
|
|
22631
|
-
return new Promise((
|
|
22631
|
+
return new Promise((resolve7, reject) => {
|
|
22632
22632
|
let workerPath;
|
|
22633
22633
|
try {
|
|
22634
22634
|
workerPath = resolveWorkerPath();
|
|
@@ -22647,7 +22647,7 @@ function runParseInWorker(req) {
|
|
|
22647
22647
|
};
|
|
22648
22648
|
worker.on("message", (reply) => {
|
|
22649
22649
|
if (reply.ok) {
|
|
22650
|
-
finish(() =>
|
|
22650
|
+
finish(() => resolve7({ results: reply.results, failedFiles: reply.failedFiles }));
|
|
22651
22651
|
} else {
|
|
22652
22652
|
const err2 = new Error(reply.error.message);
|
|
22653
22653
|
err2.name = reply.error.name;
|
|
@@ -22741,6 +22741,328 @@ var init_effects_index = __esm({
|
|
|
22741
22741
|
}
|
|
22742
22742
|
});
|
|
22743
22743
|
|
|
22744
|
+
// src/server/graph/core/context/types.ts
|
|
22745
|
+
function higherConfidence(a, b) {
|
|
22746
|
+
return CONFIDENCE_RANK[a] >= CONFIDENCE_RANK[b] ? a : b;
|
|
22747
|
+
}
|
|
22748
|
+
function stateId(token) {
|
|
22749
|
+
return `state:${token}`;
|
|
22750
|
+
}
|
|
22751
|
+
function actionId(key) {
|
|
22752
|
+
return `action:${key}`;
|
|
22753
|
+
}
|
|
22754
|
+
function stateNode(token, label) {
|
|
22755
|
+
return { id: stateId(token), type: CONTEXT_NODE_STATE, name: token, label };
|
|
22756
|
+
}
|
|
22757
|
+
function actionNode(key, name, meta = {}) {
|
|
22758
|
+
return { id: actionId(key), type: CONTEXT_NODE_ACTION, name, ...meta };
|
|
22759
|
+
}
|
|
22760
|
+
function contextEdge(fromActionId, toStateId, type, confidence, origin) {
|
|
22761
|
+
return { source: fromActionId, target: toStateId, type, label: `${type} (${origin})`, confidence, origin };
|
|
22762
|
+
}
|
|
22763
|
+
var CONTEXT_NODE_ACTION, CONTEXT_NODE_STATE, CONFIDENCE_RANK;
|
|
22764
|
+
var init_types = __esm({
|
|
22765
|
+
"src/server/graph/core/context/types.ts"() {
|
|
22766
|
+
"use strict";
|
|
22767
|
+
CONTEXT_NODE_ACTION = "action";
|
|
22768
|
+
CONTEXT_NODE_STATE = "state";
|
|
22769
|
+
CONFIDENCE_RANK = { low: 0, medium: 1, high: 2 };
|
|
22770
|
+
}
|
|
22771
|
+
});
|
|
22772
|
+
|
|
22773
|
+
// src/server/graph/core/context/providers/nextjs-prisma.ts
|
|
22774
|
+
function isPublic(auth) {
|
|
22775
|
+
if (!auth || auth.length === 0) return true;
|
|
22776
|
+
return auth.every((a) => a === "public");
|
|
22777
|
+
}
|
|
22778
|
+
function notFoundEntity(consequence) {
|
|
22779
|
+
if (!consequence) return null;
|
|
22780
|
+
const m = consequence.match(/notFound\(\s*['"]([A-Za-z0-9_]+)['"]/);
|
|
22781
|
+
return m ? m[1] : null;
|
|
22782
|
+
}
|
|
22783
|
+
var PRODUCING_METHODS, nextjsPrismaContextProvider;
|
|
22784
|
+
var init_nextjs_prisma = __esm({
|
|
22785
|
+
"src/server/graph/core/context/providers/nextjs-prisma.ts"() {
|
|
22786
|
+
"use strict";
|
|
22787
|
+
init_types();
|
|
22788
|
+
PRODUCING_METHODS = /* @__PURE__ */ new Set(["create", "createMany", "upsert"]);
|
|
22789
|
+
nextjsPrismaContextProvider = {
|
|
22790
|
+
id: "nextjs-prisma",
|
|
22791
|
+
detect(layerOutputs) {
|
|
22792
|
+
const api = layerOutputs["api"];
|
|
22793
|
+
return !!api && (api.nodes ?? []).some((n) => n.type === "endpoint");
|
|
22794
|
+
},
|
|
22795
|
+
derive(layerOutputs) {
|
|
22796
|
+
const api = layerOutputs["api"];
|
|
22797
|
+
const states = /* @__PURE__ */ new Map();
|
|
22798
|
+
const actions = [];
|
|
22799
|
+
const edges = [];
|
|
22800
|
+
const seenEdge = /* @__PURE__ */ new Set();
|
|
22801
|
+
const ensureState = (token, label) => {
|
|
22802
|
+
const id = stateId(token);
|
|
22803
|
+
if (!states.has(id)) states.set(id, stateNode(token, label));
|
|
22804
|
+
return id;
|
|
22805
|
+
};
|
|
22806
|
+
const addEdge = (from, to, type, confidence, origin) => {
|
|
22807
|
+
const key = `${from}|${type}|${to}`;
|
|
22808
|
+
if (seenEdge.has(key)) return;
|
|
22809
|
+
seenEdge.add(key);
|
|
22810
|
+
edges.push(contextEdge(from, to, type, confidence, origin));
|
|
22811
|
+
};
|
|
22812
|
+
const endpoints = (api?.nodes ?? []).filter((n) => n.type === "endpoint");
|
|
22813
|
+
for (const ep of endpoints) {
|
|
22814
|
+
const aId = actionId(ep.id);
|
|
22815
|
+
actions.push(actionNode(ep.id, ep.name, { methods: ep.methods ?? [], endpoint: ep.id }));
|
|
22816
|
+
if (!isPublic(ep.auth)) {
|
|
22817
|
+
addEdge(aId, ensureState("session", "Authenticated session"), "requires", "high", "auth-wrapper");
|
|
22818
|
+
}
|
|
22819
|
+
for (const op of ep.db_operations ?? []) {
|
|
22820
|
+
const [model, method] = op.split(".");
|
|
22821
|
+
if (!model || !PRODUCING_METHODS.has(method ?? "")) continue;
|
|
22822
|
+
addEdge(aId, ensureState(model, `${model} record exists`), "produces", "medium", `db:${op}`);
|
|
22823
|
+
}
|
|
22824
|
+
for (const cond of ep.conditions ?? []) {
|
|
22825
|
+
const entity = notFoundEntity(cond.consequence);
|
|
22826
|
+
if (!entity) continue;
|
|
22827
|
+
const token = entity.toLowerCase();
|
|
22828
|
+
addEdge(aId, ensureState(token, `${token} record exists`), "requires", "low", "guard:notFound");
|
|
22829
|
+
}
|
|
22830
|
+
}
|
|
22831
|
+
return { nodes: [...actions, ...states.values()], edges };
|
|
22832
|
+
}
|
|
22833
|
+
};
|
|
22834
|
+
}
|
|
22835
|
+
});
|
|
22836
|
+
|
|
22837
|
+
// src/server/graph/core/context/overlay.ts
|
|
22838
|
+
function overlayPath(rootDir) {
|
|
22839
|
+
return (0, import_node_path12.join)(rootDir, OVERLAY_FILE);
|
|
22840
|
+
}
|
|
22841
|
+
function loadOverlay(rootDir) {
|
|
22842
|
+
const path13 = overlayPath(rootDir);
|
|
22843
|
+
if (!(0, import_node_fs10.existsSync)(path13)) return null;
|
|
22844
|
+
try {
|
|
22845
|
+
return JSON.parse((0, import_node_fs10.readFileSync)(path13, "utf-8"));
|
|
22846
|
+
} catch (e) {
|
|
22847
|
+
process.stderr.write(`[launch-chart] failed to parse ${OVERLAY_FILE}: ${e.message}
|
|
22848
|
+
`);
|
|
22849
|
+
return null;
|
|
22850
|
+
}
|
|
22851
|
+
}
|
|
22852
|
+
function applyOverlayRejections(edges, rootDir) {
|
|
22853
|
+
const overlay = loadOverlay(rootDir);
|
|
22854
|
+
const rejects = overlay?.reject ?? [];
|
|
22855
|
+
if (rejects.length === 0) return edges;
|
|
22856
|
+
const rejectKeys = new Set(
|
|
22857
|
+
rejects.map((r) => `${actionId(r.action)}|${r.type}|${stateId(r.state)}`)
|
|
22858
|
+
);
|
|
22859
|
+
return edges.filter((e) => !rejectKeys.has(`${e.source}|${e.type}|${e.target}`));
|
|
22860
|
+
}
|
|
22861
|
+
var import_node_fs10, import_node_path12, OVERLAY_FILE, overlayProvider;
|
|
22862
|
+
var init_overlay = __esm({
|
|
22863
|
+
"src/server/graph/core/context/overlay.ts"() {
|
|
22864
|
+
"use strict";
|
|
22865
|
+
import_node_fs10 = require("node:fs");
|
|
22866
|
+
import_node_path12 = require("node:path");
|
|
22867
|
+
init_types();
|
|
22868
|
+
OVERLAY_FILE = ".launchchart.context.json";
|
|
22869
|
+
overlayProvider = {
|
|
22870
|
+
id: "overlay",
|
|
22871
|
+
detect(_layerOutputs, rootDir) {
|
|
22872
|
+
return (0, import_node_fs10.existsSync)(overlayPath(rootDir));
|
|
22873
|
+
},
|
|
22874
|
+
derive(_layerOutputs, rootDir) {
|
|
22875
|
+
const overlay = loadOverlay(rootDir);
|
|
22876
|
+
if (!overlay) return { nodes: [], edges: [] };
|
|
22877
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
22878
|
+
const edges = [];
|
|
22879
|
+
const seenEdge = /* @__PURE__ */ new Set();
|
|
22880
|
+
const ensureState = (token, label) => {
|
|
22881
|
+
const id = stateId(token);
|
|
22882
|
+
if (!nodes.has(id)) nodes.set(id, stateNode(token, label ?? `${token} (overlay)`));
|
|
22883
|
+
return id;
|
|
22884
|
+
};
|
|
22885
|
+
const ensureAction = (key, name) => {
|
|
22886
|
+
const id = actionId(key);
|
|
22887
|
+
if (!nodes.has(id)) nodes.set(id, actionNode(key, name ?? key, { source: "overlay" }));
|
|
22888
|
+
return id;
|
|
22889
|
+
};
|
|
22890
|
+
for (const s of overlay.states ?? []) ensureState(s.token, s.label);
|
|
22891
|
+
for (const a of overlay.actions ?? []) ensureAction(a.id, a.name);
|
|
22892
|
+
for (const e of overlay.edges ?? []) {
|
|
22893
|
+
const aId = ensureAction(e.action);
|
|
22894
|
+
const link = (token, type) => {
|
|
22895
|
+
const sId = ensureState(token);
|
|
22896
|
+
const key = `${aId}|${type}|${sId}`;
|
|
22897
|
+
if (seenEdge.has(key)) return;
|
|
22898
|
+
seenEdge.add(key);
|
|
22899
|
+
edges.push(contextEdge(aId, sId, type, "high", "overlay"));
|
|
22900
|
+
};
|
|
22901
|
+
for (const token of e.requires ?? []) link(token, "requires");
|
|
22902
|
+
for (const token of e.produces ?? []) link(token, "produces");
|
|
22903
|
+
}
|
|
22904
|
+
return { nodes: [...nodes.values()], edges };
|
|
22905
|
+
}
|
|
22906
|
+
};
|
|
22907
|
+
}
|
|
22908
|
+
});
|
|
22909
|
+
|
|
22910
|
+
// src/server/graph/core/context/registry.ts
|
|
22911
|
+
function registerBuiltins2(registry, disabled) {
|
|
22912
|
+
const builtins = [nextjsPrismaContextProvider, overlayProvider];
|
|
22913
|
+
for (const provider of builtins) {
|
|
22914
|
+
if (disabled.has(provider.id)) continue;
|
|
22915
|
+
registry.register(provider);
|
|
22916
|
+
}
|
|
22917
|
+
}
|
|
22918
|
+
function loadCustomProviders(registry, config, rootDir, disabled) {
|
|
22919
|
+
for (const entry of config.context?.providers ?? []) {
|
|
22920
|
+
try {
|
|
22921
|
+
const absPath = (0, import_node_path13.resolve)(rootDir, entry.path);
|
|
22922
|
+
const mod = require(absPath);
|
|
22923
|
+
const provider = "default" in mod ? mod.default : mod;
|
|
22924
|
+
if (disabled.has(provider.id)) continue;
|
|
22925
|
+
registry.register(provider);
|
|
22926
|
+
} catch (err2) {
|
|
22927
|
+
process.stderr.write(`[launch-chart] failed to load custom context provider from ${entry.path}: ${err2}
|
|
22928
|
+
`);
|
|
22929
|
+
}
|
|
22930
|
+
}
|
|
22931
|
+
}
|
|
22932
|
+
function createContextProviderRegistry(config, rootDir) {
|
|
22933
|
+
const registry = new ContextProviderRegistry();
|
|
22934
|
+
const disabled = new Set(config.context?.disabled ?? []);
|
|
22935
|
+
registerBuiltins2(registry, disabled);
|
|
22936
|
+
loadCustomProviders(registry, config, rootDir, disabled);
|
|
22937
|
+
return registry;
|
|
22938
|
+
}
|
|
22939
|
+
var import_node_path13, ContextProviderRegistry;
|
|
22940
|
+
var init_registry = __esm({
|
|
22941
|
+
"src/server/graph/core/context/registry.ts"() {
|
|
22942
|
+
"use strict";
|
|
22943
|
+
import_node_path13 = require("node:path");
|
|
22944
|
+
init_nextjs_prisma();
|
|
22945
|
+
init_overlay();
|
|
22946
|
+
ContextProviderRegistry = class {
|
|
22947
|
+
constructor() {
|
|
22948
|
+
this.providers = [];
|
|
22949
|
+
this.ids = /* @__PURE__ */ new Set();
|
|
22950
|
+
}
|
|
22951
|
+
register(provider) {
|
|
22952
|
+
if (this.ids.has(provider.id)) {
|
|
22953
|
+
throw new Error(`Duplicate context provider id: ${provider.id}`);
|
|
22954
|
+
}
|
|
22955
|
+
this.ids.add(provider.id);
|
|
22956
|
+
this.providers.push(provider);
|
|
22957
|
+
}
|
|
22958
|
+
getAll() {
|
|
22959
|
+
return [...this.providers];
|
|
22960
|
+
}
|
|
22961
|
+
};
|
|
22962
|
+
}
|
|
22963
|
+
});
|
|
22964
|
+
|
|
22965
|
+
// src/server/graph/core/context-map.ts
|
|
22966
|
+
function buildContextMap(layerOutputs, rootDir) {
|
|
22967
|
+
const generated = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
22968
|
+
const config = loadConfig(rootDir);
|
|
22969
|
+
const registry = createContextProviderRegistry(config, rootDir);
|
|
22970
|
+
const nodesById = /* @__PURE__ */ new Map();
|
|
22971
|
+
const edgesByKey = /* @__PURE__ */ new Map();
|
|
22972
|
+
const providerStats = {};
|
|
22973
|
+
const usedProviders = [];
|
|
22974
|
+
for (const provider of registry.getAll()) {
|
|
22975
|
+
let detected = false;
|
|
22976
|
+
try {
|
|
22977
|
+
detected = provider.detect(layerOutputs, rootDir);
|
|
22978
|
+
} catch (e) {
|
|
22979
|
+
process.stderr.write(`[launch-chart] context provider "${provider.id}" detect failed: ${e.message}
|
|
22980
|
+
`);
|
|
22981
|
+
continue;
|
|
22982
|
+
}
|
|
22983
|
+
if (!detected) continue;
|
|
22984
|
+
let contribution;
|
|
22985
|
+
try {
|
|
22986
|
+
contribution = provider.derive(layerOutputs, rootDir);
|
|
22987
|
+
} catch (e) {
|
|
22988
|
+
process.stderr.write(`[launch-chart] context provider "${provider.id}" derive failed: ${e.message}
|
|
22989
|
+
`);
|
|
22990
|
+
continue;
|
|
22991
|
+
}
|
|
22992
|
+
usedProviders.push(provider.id);
|
|
22993
|
+
providerStats[provider.id] = { nodes: contribution.nodes.length, edges: contribution.edges.length };
|
|
22994
|
+
for (const node of contribution.nodes) {
|
|
22995
|
+
if (!nodesById.has(node.id)) nodesById.set(node.id, node);
|
|
22996
|
+
}
|
|
22997
|
+
for (const edge of contribution.edges) {
|
|
22998
|
+
const key = `${edge.source}|${edge.type}|${edge.target}`;
|
|
22999
|
+
const existing = edgesByKey.get(key);
|
|
23000
|
+
const edgeConf = edge.confidence ?? "low";
|
|
23001
|
+
if (!existing) {
|
|
23002
|
+
edgesByKey.set(key, { ...edge, providers: [provider.id] });
|
|
23003
|
+
} else {
|
|
23004
|
+
const existingConf = existing.confidence ?? "low";
|
|
23005
|
+
existing.confidence = higherConfidence(existingConf, edgeConf);
|
|
23006
|
+
const provs = existing.providers ?? [];
|
|
23007
|
+
if (!provs.includes(provider.id)) provs.push(provider.id);
|
|
23008
|
+
existing.providers = provs;
|
|
23009
|
+
}
|
|
23010
|
+
}
|
|
23011
|
+
}
|
|
23012
|
+
const merged = [...edgesByKey.values()];
|
|
23013
|
+
const edges = applyOverlayRejections(merged, rootDir);
|
|
23014
|
+
const rejectedCount = merged.length - edges.length;
|
|
23015
|
+
const flagged = edges.map((e) => ({
|
|
23016
|
+
source: e.source,
|
|
23017
|
+
target: e.target,
|
|
23018
|
+
type: e.type,
|
|
23019
|
+
label: e.label ?? `${e.type}`,
|
|
23020
|
+
confidence: e.confidence ?? "low"
|
|
23021
|
+
}));
|
|
23022
|
+
const nodes = [...nodesById.values()];
|
|
23023
|
+
const stateCount = nodes.filter((n) => n.type === CONTEXT_NODE_STATE).length;
|
|
23024
|
+
return {
|
|
23025
|
+
metadata: {
|
|
23026
|
+
generated,
|
|
23027
|
+
scope: "derived",
|
|
23028
|
+
layer: "context",
|
|
23029
|
+
source: "context-map-builder",
|
|
23030
|
+
derived: true,
|
|
23031
|
+
providers: usedProviders,
|
|
23032
|
+
provider_stats: providerStats,
|
|
23033
|
+
action_count: nodes.length - stateCount,
|
|
23034
|
+
state_count: stateCount,
|
|
23035
|
+
candidate_edge_count: edges.length,
|
|
23036
|
+
rejected_edge_count: rejectedCount,
|
|
23037
|
+
note: "Edges are candidates (see flagged_edges + confidence) from the context providers. Promote via the curation overlay."
|
|
23038
|
+
},
|
|
23039
|
+
nodes,
|
|
23040
|
+
edges,
|
|
23041
|
+
cross_refs: [],
|
|
23042
|
+
contradictions: [],
|
|
23043
|
+
warnings: [],
|
|
23044
|
+
flagged_edges: flagged
|
|
23045
|
+
};
|
|
23046
|
+
}
|
|
23047
|
+
function writeContextMap(rootDir, output) {
|
|
23048
|
+
const path13 = (0, import_node_path14.join)(rootDir, LAUNCHSECURE_DIR, "graphs", "context.json");
|
|
23049
|
+
atomicWriteFileSync(path13, JSON.stringify(output, null, 2) + "\n");
|
|
23050
|
+
return path13;
|
|
23051
|
+
}
|
|
23052
|
+
var import_node_path14;
|
|
23053
|
+
var init_context_map = __esm({
|
|
23054
|
+
"src/server/graph/core/context-map.ts"() {
|
|
23055
|
+
"use strict";
|
|
23056
|
+
init_atomic_write();
|
|
23057
|
+
import_node_path14 = require("node:path");
|
|
23058
|
+
init_launch_kit_paths();
|
|
23059
|
+
init_config();
|
|
23060
|
+
init_registry();
|
|
23061
|
+
init_overlay();
|
|
23062
|
+
init_types();
|
|
23063
|
+
}
|
|
23064
|
+
});
|
|
23065
|
+
|
|
22744
23066
|
// src/server/graph/core/freshness.ts
|
|
22745
23067
|
function exactFilenameRegex(name) {
|
|
22746
23068
|
return new RegExp(`^${name.replace(/\./g, "\\.")}$`);
|
|
@@ -22756,12 +23078,12 @@ function getFreshnessTracker(rootDir) {
|
|
|
22756
23078
|
}
|
|
22757
23079
|
return t;
|
|
22758
23080
|
}
|
|
22759
|
-
var
|
|
23081
|
+
var import_node_fs11, import_node_path15, SCHEMA_VERSION, MAX_PATCHED_FILES_TRACKED, DRIFTING_PATCH_THRESHOLD, HARD_ESCALATION_PATTERNS, FreshnessTracker, trackers;
|
|
22760
23082
|
var init_freshness = __esm({
|
|
22761
23083
|
"src/server/graph/core/freshness.ts"() {
|
|
22762
23084
|
"use strict";
|
|
22763
|
-
|
|
22764
|
-
|
|
23085
|
+
import_node_fs11 = require("node:fs");
|
|
23086
|
+
import_node_path15 = require("node:path");
|
|
22765
23087
|
init_launch_kit_paths();
|
|
22766
23088
|
init_atomic_write();
|
|
22767
23089
|
SCHEMA_VERSION = 1;
|
|
@@ -22778,7 +23100,7 @@ var init_freshness = __esm({
|
|
|
22778
23100
|
FreshnessTracker = class {
|
|
22779
23101
|
constructor(rootDir) {
|
|
22780
23102
|
this.dirty = false;
|
|
22781
|
-
this.filePath = (0,
|
|
23103
|
+
this.filePath = (0, import_node_path15.join)(rootDir, LAUNCHSECURE_DIR, "graphs", ".freshness.json");
|
|
22782
23104
|
this.snapshot = this.load() ?? {
|
|
22783
23105
|
state: "fresh",
|
|
22784
23106
|
lastFullRegenAt: null,
|
|
@@ -22865,9 +23187,9 @@ var init_freshness = __esm({
|
|
|
22865
23187
|
}
|
|
22866
23188
|
}
|
|
22867
23189
|
load() {
|
|
22868
|
-
if (!(0,
|
|
23190
|
+
if (!(0, import_node_fs11.existsSync)(this.filePath)) return null;
|
|
22869
23191
|
try {
|
|
22870
|
-
const parsed = JSON.parse((0,
|
|
23192
|
+
const parsed = JSON.parse((0, import_node_fs11.readFileSync)(this.filePath, "utf-8"));
|
|
22871
23193
|
if (parsed.schemaVersion !== SCHEMA_VERSION) return null;
|
|
22872
23194
|
return {
|
|
22873
23195
|
state: parsed.state,
|
|
@@ -22889,22 +23211,22 @@ var init_freshness = __esm({
|
|
|
22889
23211
|
|
|
22890
23212
|
// src/server/graph/index.ts
|
|
22891
23213
|
function getAvailableLayers(rootDir) {
|
|
22892
|
-
const dir = (0,
|
|
22893
|
-
if (!(0,
|
|
22894
|
-
return (0,
|
|
23214
|
+
const dir = (0, import_node_path16.join)(rootDir, GRAPHS_DIR2);
|
|
23215
|
+
if (!(0, import_node_fs12.existsSync)(dir)) return [];
|
|
23216
|
+
return (0, import_node_fs12.readdirSync)(dir).filter((f) => f.endsWith(".json") && !f.startsWith(".") && !NON_LAYER_GRAPH_FILES.has(f)).map((f) => f.replace(".json", ""));
|
|
22895
23217
|
}
|
|
22896
23218
|
function graphsDir(rootDir) {
|
|
22897
|
-
return (0,
|
|
23219
|
+
return (0, import_node_path16.join)(rootDir, GRAPHS_DIR2);
|
|
22898
23220
|
}
|
|
22899
23221
|
function graphFilePath(rootDir, layer) {
|
|
22900
|
-
return (0,
|
|
23222
|
+
return (0, import_node_path16.join)(graphsDir(rootDir), `${layer}.json`);
|
|
22901
23223
|
}
|
|
22902
23224
|
function tagsFilePath2(rootDir) {
|
|
22903
|
-
return (0,
|
|
23225
|
+
return (0, import_node_path16.join)(graphsDir(rootDir), "tags.json");
|
|
22904
23226
|
}
|
|
22905
23227
|
function getMtimeMs(filePath) {
|
|
22906
|
-
if (!(0,
|
|
22907
|
-
return (0,
|
|
23228
|
+
if (!(0, import_node_fs12.existsSync)(filePath)) return 0;
|
|
23229
|
+
return (0, import_node_fs12.statSync)(filePath).mtimeMs;
|
|
22908
23230
|
}
|
|
22909
23231
|
function invalidateCache(filePath) {
|
|
22910
23232
|
graphCache.delete(filePath);
|
|
@@ -22943,20 +23265,20 @@ function applyTags(graph, layer, rootDir) {
|
|
|
22943
23265
|
}
|
|
22944
23266
|
function readGraphRaw(rootDir, layer) {
|
|
22945
23267
|
const filePath = graphFilePath(rootDir, layer);
|
|
22946
|
-
if (!(0,
|
|
22947
|
-
const stat = (0,
|
|
23268
|
+
if (!(0, import_node_fs12.existsSync)(filePath)) return null;
|
|
23269
|
+
const stat = (0, import_node_fs12.statSync)(filePath);
|
|
22948
23270
|
const cached = graphCache.get(filePath);
|
|
22949
23271
|
if (cached && cached.mtimeMs === stat.mtimeMs) {
|
|
22950
23272
|
return cached.graph;
|
|
22951
23273
|
}
|
|
22952
|
-
const content = (0,
|
|
23274
|
+
const content = (0, import_node_fs12.readFileSync)(filePath, "utf-8");
|
|
22953
23275
|
const graph = JSON.parse(content);
|
|
22954
23276
|
graphCache.set(filePath, { mtimeMs: stat.mtimeMs, graph });
|
|
22955
23277
|
return graph;
|
|
22956
23278
|
}
|
|
22957
23279
|
function readGraph(rootDir, layer) {
|
|
22958
23280
|
const rawFilePath = graphFilePath(rootDir, layer);
|
|
22959
|
-
if (!(0,
|
|
23281
|
+
if (!(0, import_node_fs12.existsSync)(rawFilePath)) return null;
|
|
22960
23282
|
const rawMtime = getMtimeMs(rawFilePath);
|
|
22961
23283
|
const tagsMtime = getMtimeMs(tagsFilePath2(rootDir));
|
|
22962
23284
|
const cacheKey = `${rootDir}:${layer}`;
|
|
@@ -22980,7 +23302,7 @@ function readAllGraphs(rootDir) {
|
|
|
22980
23302
|
}
|
|
22981
23303
|
async function generateGraph(rootDir, layer) {
|
|
22982
23304
|
const dir = graphsDir(rootDir);
|
|
22983
|
-
(0,
|
|
23305
|
+
(0, import_node_fs12.mkdirSync)(dir, { recursive: true });
|
|
22984
23306
|
const { results, failedFiles } = await runParseInWorker({ rootDir, layer });
|
|
22985
23307
|
for (const result of results) {
|
|
22986
23308
|
const filePath = graphFilePath(rootDir, result.layer);
|
|
@@ -22991,13 +23313,13 @@ async function generateGraph(rootDir, layer) {
|
|
|
22991
23313
|
if (!layer) {
|
|
22992
23314
|
const producedLayers = new Set(results.map((r) => r.layer));
|
|
22993
23315
|
try {
|
|
22994
|
-
for (const f of (0,
|
|
22995
|
-
if (!f.endsWith(".json") || f === "tags.json" || f === "effects-index.json") continue;
|
|
23316
|
+
for (const f of (0, import_node_fs12.readdirSync)(dir)) {
|
|
23317
|
+
if (!f.endsWith(".json") || f === "tags.json" || f === "effects-index.json" || f === "context.json") continue;
|
|
22996
23318
|
const layerName = f.replace(/\.json$/, "");
|
|
22997
23319
|
if (producedLayers.has(layerName)) continue;
|
|
22998
|
-
const orphan = (0,
|
|
23320
|
+
const orphan = (0, import_node_path16.join)(dir, f);
|
|
22999
23321
|
try {
|
|
23000
|
-
(0,
|
|
23322
|
+
(0, import_node_fs12.unlinkSync)(orphan);
|
|
23001
23323
|
invalidateCache(orphan);
|
|
23002
23324
|
invalidateTaggedCache(rootDir, layerName);
|
|
23003
23325
|
process.stderr.write(`[launch-chart] removed orphan layer file: ${f} (no parser produced ${layerName} this run)
|
|
@@ -23008,22 +23330,31 @@ async function generateGraph(rootDir, layer) {
|
|
|
23008
23330
|
} catch {
|
|
23009
23331
|
}
|
|
23010
23332
|
}
|
|
23011
|
-
|
|
23012
|
-
|
|
23013
|
-
|
|
23014
|
-
|
|
23015
|
-
|
|
23016
|
-
|
|
23017
|
-
|
|
23018
|
-
|
|
23019
|
-
|
|
23020
|
-
if (existing) allLayers[layerName] = existing;
|
|
23021
|
-
}
|
|
23333
|
+
const allLayers = {};
|
|
23334
|
+
for (const r of results) allLayers[r.layer] = r.output;
|
|
23335
|
+
if (layer) {
|
|
23336
|
+
for (const f of (0, import_node_fs12.readdirSync)(dir)) {
|
|
23337
|
+
if (!f.endsWith(".json") || f.startsWith(".") || f === "tags.json" || f === "effects-index.json" || f === "context.json") continue;
|
|
23338
|
+
const layerName = f.replace(/\.json$/, "");
|
|
23339
|
+
if (allLayers[layerName]) continue;
|
|
23340
|
+
const existing = readGraphRaw(rootDir, layerName);
|
|
23341
|
+
if (existing) allLayers[layerName] = existing;
|
|
23022
23342
|
}
|
|
23343
|
+
}
|
|
23344
|
+
try {
|
|
23023
23345
|
const idx = buildEffectsIndex(allLayers);
|
|
23024
23346
|
writeEffectsIndex(rootDir, idx);
|
|
23025
23347
|
} catch (e) {
|
|
23026
23348
|
process.stderr.write(`[launch-chart] effects-index build failed: ${e.message}
|
|
23349
|
+
`);
|
|
23350
|
+
}
|
|
23351
|
+
try {
|
|
23352
|
+
const ctx = buildContextMap(allLayers, rootDir);
|
|
23353
|
+
const ctxPath = writeContextMap(rootDir, ctx);
|
|
23354
|
+
invalidateCache(ctxPath);
|
|
23355
|
+
invalidateTaggedCache(rootDir, "context");
|
|
23356
|
+
} catch (e) {
|
|
23357
|
+
process.stderr.write(`[launch-chart] context-map build failed: ${e.message}
|
|
23027
23358
|
`);
|
|
23028
23359
|
}
|
|
23029
23360
|
try {
|
|
@@ -23040,25 +23371,26 @@ async function generateGraph(rootDir, layer) {
|
|
|
23040
23371
|
return results;
|
|
23041
23372
|
}
|
|
23042
23373
|
function readEffectsIndex(rootDir) {
|
|
23043
|
-
const path13 = (0,
|
|
23044
|
-
if (!(0,
|
|
23374
|
+
const path13 = (0, import_node_path16.join)(rootDir, GRAPHS_DIR2, "effects-index.json");
|
|
23375
|
+
if (!(0, import_node_fs12.existsSync)(path13)) return null;
|
|
23045
23376
|
try {
|
|
23046
|
-
return JSON.parse((0,
|
|
23377
|
+
return JSON.parse((0, import_node_fs12.readFileSync)(path13, "utf-8"));
|
|
23047
23378
|
} catch {
|
|
23048
23379
|
return null;
|
|
23049
23380
|
}
|
|
23050
23381
|
}
|
|
23051
|
-
var
|
|
23382
|
+
var import_node_fs12, import_node_path16, GRAPHS_DIR2, NON_LAYER_GRAPH_FILES, graphCache, taggedCache;
|
|
23052
23383
|
var init_graph = __esm({
|
|
23053
23384
|
"src/server/graph/index.ts"() {
|
|
23054
23385
|
"use strict";
|
|
23055
|
-
|
|
23056
|
-
|
|
23386
|
+
import_node_fs12 = require("node:fs");
|
|
23387
|
+
import_node_path16 = require("node:path");
|
|
23057
23388
|
init_config();
|
|
23058
23389
|
init_tagger_registry();
|
|
23059
23390
|
init_tag_store();
|
|
23060
23391
|
init_parse_worker_host();
|
|
23061
23392
|
init_effects_index();
|
|
23393
|
+
init_context_map();
|
|
23062
23394
|
init_atomic_write();
|
|
23063
23395
|
init_freshness();
|
|
23064
23396
|
init_tag_store();
|
|
@@ -23136,8 +23468,8 @@ function getQuery(name) {
|
|
|
23136
23468
|
ensureInit();
|
|
23137
23469
|
const cached = queryCache.get(name);
|
|
23138
23470
|
if (cached) return cached;
|
|
23139
|
-
const scmPath = (0,
|
|
23140
|
-
const scm = (0,
|
|
23471
|
+
const scmPath = (0, import_node_path20.join)(queriesDir, `${name}.scm`);
|
|
23472
|
+
const scm = (0, import_node_fs16.readFileSync)(scmPath, "utf-8");
|
|
23141
23473
|
const query = tsxLanguage.query(scm);
|
|
23142
23474
|
queryCache.set(name, query);
|
|
23143
23475
|
return query;
|
|
@@ -23157,13 +23489,13 @@ function parseSource(absPath) {
|
|
|
23157
23489
|
ensureInit();
|
|
23158
23490
|
let content;
|
|
23159
23491
|
try {
|
|
23160
|
-
const stat = (0,
|
|
23492
|
+
const stat = (0, import_node_fs16.statSync)(absPath);
|
|
23161
23493
|
if (stat.size > MAX_PARSEABLE_BYTES) {
|
|
23162
23494
|
process.stderr.write(`[lc-extractor] skipping ${absPath}: ${stat.size} bytes exceeds max ${MAX_PARSEABLE_BYTES}
|
|
23163
23495
|
`);
|
|
23164
23496
|
return null;
|
|
23165
23497
|
}
|
|
23166
|
-
content = (0,
|
|
23498
|
+
content = (0, import_node_fs16.readFileSync)(absPath, "utf-8");
|
|
23167
23499
|
} catch (e) {
|
|
23168
23500
|
process.stderr.write(`[lc-extractor] read failed for ${absPath}: ${e instanceof Error ? e.message : String(e)}
|
|
23169
23501
|
`);
|
|
@@ -24197,18 +24529,18 @@ function collectUiLabels(root) {
|
|
|
24197
24529
|
visit(root);
|
|
24198
24530
|
return out;
|
|
24199
24531
|
}
|
|
24200
|
-
var
|
|
24532
|
+
var import_node_fs16, import_node_path20, tsxLanguage, parserInstance, TreeSitterCtor, initPromise, initialized, queriesDir, queryCache, MAX_PARSEABLE_BYTES, MAX_CONSECUTIVE_PARSE_FAILURES, consecutiveParseFailures, ParseCascadeError, PRISMA_MUTATION_METHODS_BUILTIN, SUPABASE_MUTATION_METHODS_BUILTIN, DB_IDENTIFIERS_FALLBACK, extraDbIdentifiers, extraMutationMethods, INLINE_AUTH_IMPORTS, EXEMPT_NAME_PATTERNS, PROTECT_NAME_PATTERNS, TRUST_AS_PROTECT_KEYS, TIMER_FNS, DOM_METHOD_NAMES, CLASSLIST_METHODS, STORAGE_OBJECTS, HISTORY_METHODS, LOCATION_METHODS, ASSIGN_DOM_PROPS, UI_LABEL_KEYS, UI_LABELS_MAX, NOTE_REGEX, NOTES_MAX;
|
|
24201
24533
|
var init_ts_extractor = __esm({
|
|
24202
24534
|
"src/server/graph/core/ts-extractor.ts"() {
|
|
24203
24535
|
"use strict";
|
|
24204
|
-
|
|
24205
|
-
|
|
24536
|
+
import_node_fs16 = require("node:fs");
|
|
24537
|
+
import_node_path20 = require("node:path");
|
|
24206
24538
|
init_parse_failure_cache();
|
|
24207
24539
|
initialized = false;
|
|
24208
24540
|
queriesDir = (() => {
|
|
24209
|
-
const srcPath = (0,
|
|
24541
|
+
const srcPath = (0, import_node_path20.join)((0, import_node_path20.dirname)(__filename), "..", "queries");
|
|
24210
24542
|
if (require("fs").existsSync(srcPath)) return srcPath;
|
|
24211
|
-
return (0,
|
|
24543
|
+
return (0, import_node_path20.join)((0, import_node_path20.dirname)(__filename), "graph", "queries");
|
|
24212
24544
|
})();
|
|
24213
24545
|
queryCache = /* @__PURE__ */ new Map();
|
|
24214
24546
|
MAX_PARSEABLE_BYTES = 2 * 1024 * 1024;
|
|
@@ -24348,7 +24680,7 @@ __export(watcher_exports, {
|
|
|
24348
24680
|
function isIgnoredPath(rel) {
|
|
24349
24681
|
if (rel.startsWith(GRAPHS_RELATIVE)) return true;
|
|
24350
24682
|
if (rel.endsWith(".lock") || rel.endsWith(".log")) return true;
|
|
24351
|
-
for (const part of rel.split(
|
|
24683
|
+
for (const part of rel.split(import_node_path35.sep)) {
|
|
24352
24684
|
if (IGNORE_SEGMENTS.has(part)) return true;
|
|
24353
24685
|
}
|
|
24354
24686
|
return false;
|
|
@@ -24390,7 +24722,7 @@ function startGraphWatcher(rootDir, opts = {}) {
|
|
|
24390
24722
|
regenerating = false;
|
|
24391
24723
|
}
|
|
24392
24724
|
}
|
|
24393
|
-
const watcher = (0,
|
|
24725
|
+
const watcher = (0, import_node_fs28.watch)(rootDir, { recursive: true }, (event, filename) => {
|
|
24394
24726
|
if (!filename) return;
|
|
24395
24727
|
const rel = filename.toString();
|
|
24396
24728
|
if (process.env.LAUNCH_CHART_WATCH_TRACE === "1") {
|
|
@@ -24423,12 +24755,12 @@ function startGraphWatcher(rootDir, opts = {}) {
|
|
|
24423
24755
|
freshness: () => getFreshnessTracker(rootDir).get()
|
|
24424
24756
|
};
|
|
24425
24757
|
}
|
|
24426
|
-
var
|
|
24758
|
+
var import_node_fs28, import_node_path35, IGNORE_SEGMENTS, TRIGGER_EXTENSIONS, GRAPHS_RELATIVE;
|
|
24427
24759
|
var init_watcher = __esm({
|
|
24428
24760
|
"src/server/graph/core/watcher.ts"() {
|
|
24429
24761
|
"use strict";
|
|
24430
|
-
|
|
24431
|
-
|
|
24762
|
+
import_node_fs28 = require("node:fs");
|
|
24763
|
+
import_node_path35 = require("node:path");
|
|
24432
24764
|
init_launch_kit_paths();
|
|
24433
24765
|
init_graph();
|
|
24434
24766
|
init_freshness();
|
|
@@ -24457,7 +24789,7 @@ var init_watcher = __esm({
|
|
|
24457
24789
|
".prisma",
|
|
24458
24790
|
".sql"
|
|
24459
24791
|
]);
|
|
24460
|
-
GRAPHS_RELATIVE = (0,
|
|
24792
|
+
GRAPHS_RELATIVE = (0, import_node_path35.join)(LAUNCHSECURE_DIR, "graphs");
|
|
24461
24793
|
}
|
|
24462
24794
|
});
|
|
24463
24795
|
|
|
@@ -26135,7 +26467,7 @@ var PostImplLaunchExecutor = class {
|
|
|
26135
26467
|
return 3001;
|
|
26136
26468
|
}
|
|
26137
26469
|
startDevServer(port, databaseUrl) {
|
|
26138
|
-
return new Promise((
|
|
26470
|
+
return new Promise((resolve7) => {
|
|
26139
26471
|
const env = { ...process.env, PORT: String(port), ...databaseUrl ? { DATABASE_URL: databaseUrl } : {} };
|
|
26140
26472
|
this.devProcess = (0, import_child_process3.spawn)("npm", ["run", "dev"], {
|
|
26141
26473
|
cwd: this.workingDir,
|
|
@@ -26147,7 +26479,7 @@ var PostImplLaunchExecutor = class {
|
|
|
26147
26479
|
const timeout = setTimeout(() => {
|
|
26148
26480
|
if (!resolved) {
|
|
26149
26481
|
resolved = true;
|
|
26150
|
-
this.healthCheck(port).then(
|
|
26482
|
+
this.healthCheck(port).then(resolve7);
|
|
26151
26483
|
}
|
|
26152
26484
|
}, 15e3);
|
|
26153
26485
|
const onData = (data) => {
|
|
@@ -26156,7 +26488,7 @@ var PostImplLaunchExecutor = class {
|
|
|
26156
26488
|
if (!resolved) {
|
|
26157
26489
|
resolved = true;
|
|
26158
26490
|
clearTimeout(timeout);
|
|
26159
|
-
|
|
26491
|
+
resolve7(true);
|
|
26160
26492
|
}
|
|
26161
26493
|
}
|
|
26162
26494
|
};
|
|
@@ -26167,7 +26499,7 @@ var PostImplLaunchExecutor = class {
|
|
|
26167
26499
|
if (!resolved) {
|
|
26168
26500
|
resolved = true;
|
|
26169
26501
|
clearTimeout(timeout);
|
|
26170
|
-
|
|
26502
|
+
resolve7(false);
|
|
26171
26503
|
}
|
|
26172
26504
|
});
|
|
26173
26505
|
this.devProcess.unref();
|
|
@@ -27564,7 +27896,7 @@ var ProjectMcpClient = class {
|
|
|
27564
27896
|
this.initialized = true;
|
|
27565
27897
|
}
|
|
27566
27898
|
send(body) {
|
|
27567
|
-
return new Promise((
|
|
27899
|
+
return new Promise((resolve7, reject) => {
|
|
27568
27900
|
const headers = {
|
|
27569
27901
|
...this.headers,
|
|
27570
27902
|
"Content-Length": String(Buffer.byteLength(body))
|
|
@@ -27589,7 +27921,7 @@ var ProjectMcpClient = class {
|
|
|
27589
27921
|
return;
|
|
27590
27922
|
}
|
|
27591
27923
|
const sid = res.headers["mcp-session-id"];
|
|
27592
|
-
|
|
27924
|
+
resolve7({ body: text, sessionId: typeof sid === "string" ? sid : void 0 });
|
|
27593
27925
|
});
|
|
27594
27926
|
}
|
|
27595
27927
|
);
|
|
@@ -28688,16 +29020,16 @@ var CloudflaredTunnel = class extends import_node_events.EventEmitter {
|
|
|
28688
29020
|
const tun = this.tunnel;
|
|
28689
29021
|
this.tunnel = null;
|
|
28690
29022
|
if (!tun) return;
|
|
28691
|
-
return new Promise((
|
|
29023
|
+
return new Promise((resolve7) => {
|
|
28692
29024
|
tun.once("exit", () => {
|
|
28693
29025
|
this.emit("stopped");
|
|
28694
|
-
|
|
29026
|
+
resolve7();
|
|
28695
29027
|
});
|
|
28696
29028
|
try {
|
|
28697
29029
|
tun.stop();
|
|
28698
29030
|
} catch {
|
|
28699
29031
|
}
|
|
28700
|
-
setTimeout(() =>
|
|
29032
|
+
setTimeout(() => resolve7(), 6e3);
|
|
28701
29033
|
});
|
|
28702
29034
|
}
|
|
28703
29035
|
spawnOnce() {
|
|
@@ -29439,38 +29771,71 @@ function streamTranscript(opts) {
|
|
|
29439
29771
|
}
|
|
29440
29772
|
|
|
29441
29773
|
// src/server/graph-mcp.ts
|
|
29442
|
-
var
|
|
29443
|
-
var
|
|
29774
|
+
var import_node_fs29 = require("node:fs");
|
|
29775
|
+
var import_node_path36 = require("node:path");
|
|
29444
29776
|
var import_node_child_process3 = require("node:child_process");
|
|
29445
29777
|
var import_node_os6 = require("node:os");
|
|
29446
29778
|
init_launch_kit_paths();
|
|
29447
29779
|
init_graph();
|
|
29448
29780
|
|
|
29781
|
+
// src/server/graph/core/context/snippet.ts
|
|
29782
|
+
function toExportName(name) {
|
|
29783
|
+
const words = name.replace(/^action:/, "").replace(/^state:/, "").split(/[^A-Za-z0-9]+/).filter(Boolean).filter((w) => w.toLowerCase() !== "api");
|
|
29784
|
+
if (words.length === 0) return "snippet";
|
|
29785
|
+
const camel = words.map((w, i) => i === 0 ? w.charAt(0).toLowerCase() + w.slice(1) : w.charAt(0).toUpperCase() + w.slice(1)).join("");
|
|
29786
|
+
return /^[0-9]/.test(camel) ? `s${camel}` : camel;
|
|
29787
|
+
}
|
|
29788
|
+
function scaffoldSnippet(input) {
|
|
29789
|
+
const exportName = toExportName(input.name || input.nodeId);
|
|
29790
|
+
const arr = (xs) => `[${xs.map((x) => `'${x}'`).join(", ")}]`;
|
|
29791
|
+
const code = `import { type Page } from '@playwright/test';
|
|
29792
|
+
|
|
29793
|
+
/**
|
|
29794
|
+
* Snippet: ${input.name}
|
|
29795
|
+
* Scaffolded by launch-chart \`scaffold_snippet\` \u2014 conforms to the Snippet shape.
|
|
29796
|
+
* requires/produces are derived from the context graph. TODO(you):
|
|
29797
|
+
* 1. fill \`params\` from the endpoint's request/validation schema;
|
|
29798
|
+
* 2. implement \`run()\` with real Playwright steps (navigate, fill, click, assert).
|
|
29799
|
+
*/
|
|
29800
|
+
export const ${exportName} = {
|
|
29801
|
+
id: '${input.nodeId}',
|
|
29802
|
+
requires: ${arr(input.requires)},
|
|
29803
|
+
produces: ${arr(input.produces)},
|
|
29804
|
+
params: [], // TODO: e.g. ['name', 'color'] \u2014 from the endpoint schema
|
|
29805
|
+
async run(page: Page, params: Record<string, unknown>) {
|
|
29806
|
+
// TODO: implement with Playwright.
|
|
29807
|
+
// e.g. await page.goto('/...'); await page.fill('#...', params.x); await page.click('text=Save');
|
|
29808
|
+
},
|
|
29809
|
+
};
|
|
29810
|
+
`;
|
|
29811
|
+
return { exportName, code };
|
|
29812
|
+
}
|
|
29813
|
+
|
|
29449
29814
|
// src/server/lockfile.ts
|
|
29450
29815
|
var import_node_child_process2 = require("node:child_process");
|
|
29451
|
-
var
|
|
29816
|
+
var import_node_fs13 = require("node:fs");
|
|
29452
29817
|
var import_node_os4 = require("node:os");
|
|
29453
|
-
var
|
|
29818
|
+
var import_node_path17 = require("node:path");
|
|
29454
29819
|
init_launch_kit_paths();
|
|
29455
29820
|
function lockDir(projectRoot) {
|
|
29456
29821
|
if (projectRoot) {
|
|
29457
|
-
return (0,
|
|
29822
|
+
return (0, import_node_path17.join)(projectRoot, LAUNCHSECURE_DIR);
|
|
29458
29823
|
}
|
|
29459
|
-
return (0,
|
|
29824
|
+
return (0, import_node_path17.join)((0, import_node_os4.homedir)(), LAUNCHSECURE_DIR);
|
|
29460
29825
|
}
|
|
29461
29826
|
function lockPath(projectRoot) {
|
|
29462
|
-
return (0,
|
|
29827
|
+
return (0, import_node_path17.join)(lockDir(projectRoot), "launch-chart.lock");
|
|
29463
29828
|
}
|
|
29464
29829
|
var _activeProjectRoot;
|
|
29465
29830
|
function readLock(projectRoot) {
|
|
29466
29831
|
const root = projectRoot ?? _activeProjectRoot;
|
|
29467
29832
|
const p = lockPath(root);
|
|
29468
|
-
if (!(0,
|
|
29833
|
+
if (!(0, import_node_fs13.existsSync)(p)) {
|
|
29469
29834
|
if (root) {
|
|
29470
29835
|
const globalP = lockPath();
|
|
29471
|
-
if ((0,
|
|
29836
|
+
if ((0, import_node_fs13.existsSync)(globalP)) {
|
|
29472
29837
|
try {
|
|
29473
|
-
const data = JSON.parse((0,
|
|
29838
|
+
const data = JSON.parse((0, import_node_fs13.readFileSync)(globalP, "utf-8"));
|
|
29474
29839
|
if (typeof data.pid === "number" && typeof data.port === "number" && data.cwd === root) {
|
|
29475
29840
|
return data;
|
|
29476
29841
|
}
|
|
@@ -29481,7 +29846,7 @@ function readLock(projectRoot) {
|
|
|
29481
29846
|
return null;
|
|
29482
29847
|
}
|
|
29483
29848
|
try {
|
|
29484
|
-
const data = JSON.parse((0,
|
|
29849
|
+
const data = JSON.parse((0, import_node_fs13.readFileSync)(p, "utf-8"));
|
|
29485
29850
|
if (typeof data.pid !== "number" || typeof data.port !== "number") return null;
|
|
29486
29851
|
return data;
|
|
29487
29852
|
} catch {
|
|
@@ -29518,7 +29883,7 @@ function getLiveLock(projectRoot) {
|
|
|
29518
29883
|
const live = listenerPid !== null ? listenerPid === lock.pid : isPidAlive(lock.pid);
|
|
29519
29884
|
if (!live) {
|
|
29520
29885
|
try {
|
|
29521
|
-
(0,
|
|
29886
|
+
(0, import_node_fs13.unlinkSync)(lockPath(root));
|
|
29522
29887
|
} catch {
|
|
29523
29888
|
}
|
|
29524
29889
|
return null;
|
|
@@ -29528,7 +29893,7 @@ function getLiveLock(projectRoot) {
|
|
|
29528
29893
|
function clearLock(projectRoot) {
|
|
29529
29894
|
const root = projectRoot ?? _activeProjectRoot;
|
|
29530
29895
|
try {
|
|
29531
|
-
(0,
|
|
29896
|
+
(0, import_node_fs13.unlinkSync)(lockPath(root));
|
|
29532
29897
|
} catch {
|
|
29533
29898
|
}
|
|
29534
29899
|
}
|
|
@@ -29537,20 +29902,20 @@ function clearLock(projectRoot) {
|
|
|
29537
29902
|
init_config();
|
|
29538
29903
|
|
|
29539
29904
|
// src/server/graph/core/parser-registry.ts
|
|
29540
|
-
var
|
|
29905
|
+
var import_node_path28 = require("node:path");
|
|
29541
29906
|
|
|
29542
29907
|
// src/server/graph/parsers/ts/typescript-project.ts
|
|
29543
|
-
var
|
|
29544
|
-
var
|
|
29908
|
+
var import_node_fs17 = require("node:fs");
|
|
29909
|
+
var import_node_path21 = require("node:path");
|
|
29545
29910
|
init_config();
|
|
29546
29911
|
|
|
29547
29912
|
// src/server/graph/core/resolve-paths.ts
|
|
29548
|
-
var
|
|
29549
|
-
var
|
|
29913
|
+
var import_node_fs15 = require("node:fs");
|
|
29914
|
+
var import_node_path19 = require("node:path");
|
|
29550
29915
|
|
|
29551
29916
|
// src/server/graph/core/walk.ts
|
|
29552
|
-
var
|
|
29553
|
-
var
|
|
29917
|
+
var import_node_fs14 = require("node:fs");
|
|
29918
|
+
var import_node_path18 = require("node:path");
|
|
29554
29919
|
var DEFAULT_IGNORE_DIRS = /* @__PURE__ */ new Set([
|
|
29555
29920
|
"node_modules",
|
|
29556
29921
|
"dist",
|
|
@@ -29560,12 +29925,12 @@ var DEFAULT_IGNORE_DIRS = /* @__PURE__ */ new Set([
|
|
|
29560
29925
|
]);
|
|
29561
29926
|
function walk(dir, exts) {
|
|
29562
29927
|
const results = [];
|
|
29563
|
-
if (!(0,
|
|
29564
|
-
for (const entry of (0,
|
|
29565
|
-
const full = (0,
|
|
29928
|
+
if (!(0, import_node_fs14.existsSync)(dir)) return results;
|
|
29929
|
+
for (const entry of (0, import_node_fs14.readdirSync)(dir, { withFileTypes: true })) {
|
|
29930
|
+
const full = (0, import_node_path18.join)(dir, entry.name);
|
|
29566
29931
|
if (entry.isDirectory()) {
|
|
29567
29932
|
results.push(...walk(full, exts));
|
|
29568
|
-
} else if (exts.includes((0,
|
|
29933
|
+
} else if (exts.includes((0, import_node_path18.extname)(entry.name))) {
|
|
29569
29934
|
results.push(full);
|
|
29570
29935
|
}
|
|
29571
29936
|
}
|
|
@@ -29573,15 +29938,15 @@ function walk(dir, exts) {
|
|
|
29573
29938
|
}
|
|
29574
29939
|
function walkWithIgnore(dir, exts, opts = {}) {
|
|
29575
29940
|
const results = [];
|
|
29576
|
-
if (!(0,
|
|
29941
|
+
if (!(0, import_node_fs14.existsSync)(dir)) return results;
|
|
29577
29942
|
const skip = opts.extraIgnore ? /* @__PURE__ */ new Set([...DEFAULT_IGNORE_DIRS, ...opts.extraIgnore]) : DEFAULT_IGNORE_DIRS;
|
|
29578
|
-
for (const entry of (0,
|
|
29943
|
+
for (const entry of (0, import_node_fs14.readdirSync)(dir, { withFileTypes: true })) {
|
|
29579
29944
|
if (entry.isDirectory()) {
|
|
29580
29945
|
if (entry.name.startsWith(".")) continue;
|
|
29581
29946
|
if (skip.has(entry.name)) continue;
|
|
29582
|
-
results.push(...walkWithIgnore((0,
|
|
29583
|
-
} else if (exts.includes((0,
|
|
29584
|
-
results.push((0,
|
|
29947
|
+
results.push(...walkWithIgnore((0, import_node_path18.join)(dir, entry.name), exts, opts));
|
|
29948
|
+
} else if (exts.includes((0, import_node_path18.extname)(entry.name))) {
|
|
29949
|
+
results.push((0, import_node_path18.join)(dir, entry.name));
|
|
29585
29950
|
}
|
|
29586
29951
|
}
|
|
29587
29952
|
return results;
|
|
@@ -29589,9 +29954,9 @@ function walkWithIgnore(dir, exts, opts = {}) {
|
|
|
29589
29954
|
|
|
29590
29955
|
// src/server/graph/core/resolve-paths.ts
|
|
29591
29956
|
function hasSqlFiles(dir) {
|
|
29592
|
-
if (!(0,
|
|
29957
|
+
if (!(0, import_node_fs15.existsSync)(dir)) return false;
|
|
29593
29958
|
try {
|
|
29594
|
-
return (0,
|
|
29959
|
+
return (0, import_node_fs15.readdirSync)(dir, { withFileTypes: true }).some(
|
|
29595
29960
|
(e) => e.isFile() && e.name.endsWith(".sql")
|
|
29596
29961
|
);
|
|
29597
29962
|
} catch {
|
|
@@ -29599,27 +29964,27 @@ function hasSqlFiles(dir) {
|
|
|
29599
29964
|
}
|
|
29600
29965
|
}
|
|
29601
29966
|
function hasNestedMigrationSql(dir) {
|
|
29602
|
-
if (!(0,
|
|
29967
|
+
if (!(0, import_node_fs15.existsSync)(dir)) return false;
|
|
29603
29968
|
try {
|
|
29604
|
-
return (0,
|
|
29605
|
-
(e) => e.isDirectory() && (0,
|
|
29969
|
+
return (0, import_node_fs15.readdirSync)(dir, { withFileTypes: true }).some(
|
|
29970
|
+
(e) => e.isDirectory() && (0, import_node_fs15.existsSync)((0, import_node_path19.join)(dir, e.name, "migration.sql"))
|
|
29606
29971
|
);
|
|
29607
29972
|
} catch {
|
|
29608
29973
|
return false;
|
|
29609
29974
|
}
|
|
29610
29975
|
}
|
|
29611
29976
|
function resolveDbFromDir(dir) {
|
|
29612
|
-
if (!(0,
|
|
29613
|
-
const schemaPath = (0,
|
|
29614
|
-
if ((0,
|
|
29615
|
-
const migrationsDir2 = (0,
|
|
29977
|
+
if (!(0, import_node_fs15.existsSync)(dir)) return { kind: "none", schemaPath: null, migrationsDir: null };
|
|
29978
|
+
const schemaPath = (0, import_node_path19.join)(dir, "schema.prisma");
|
|
29979
|
+
if ((0, import_node_fs15.existsSync)(schemaPath)) {
|
|
29980
|
+
const migrationsDir2 = (0, import_node_path19.join)(dir, "migrations");
|
|
29616
29981
|
return {
|
|
29617
29982
|
kind: "prisma",
|
|
29618
29983
|
schemaPath,
|
|
29619
|
-
migrationsDir: (0,
|
|
29984
|
+
migrationsDir: (0, import_node_fs15.existsSync)(migrationsDir2) ? migrationsDir2 : null
|
|
29620
29985
|
};
|
|
29621
29986
|
}
|
|
29622
|
-
const migrationsDir = (0,
|
|
29987
|
+
const migrationsDir = (0, import_node_path19.join)(dir, "migrations");
|
|
29623
29988
|
if (hasSqlFiles(migrationsDir) || hasNestedMigrationSql(migrationsDir)) {
|
|
29624
29989
|
return { kind: "sql-migrations", migrationsDir, schemaPath: null };
|
|
29625
29990
|
}
|
|
@@ -29630,19 +29995,19 @@ function resolveDbFromDir(dir) {
|
|
|
29630
29995
|
}
|
|
29631
29996
|
function detectDbConfig(rootDir, config) {
|
|
29632
29997
|
if (config.paths?.dbDir) {
|
|
29633
|
-
return resolveDbFromDir((0,
|
|
29998
|
+
return resolveDbFromDir((0, import_node_path19.join)(rootDir, config.paths.dbDir));
|
|
29634
29999
|
}
|
|
29635
|
-
const candidates = ["prisma", "supabase", "drizzle", (0,
|
|
30000
|
+
const candidates = ["prisma", "supabase", "drizzle", (0, import_node_path19.join)("db", "migrations"), "migrations"];
|
|
29636
30001
|
for (const c of candidates) {
|
|
29637
|
-
const dir = (0,
|
|
30002
|
+
const dir = (0, import_node_path19.join)(rootDir, c);
|
|
29638
30003
|
const resolved = resolveDbFromDir(dir);
|
|
29639
30004
|
if (resolved.kind !== "none") return resolved;
|
|
29640
30005
|
}
|
|
29641
30006
|
return { kind: "none", schemaPath: null, migrationsDir: null };
|
|
29642
30007
|
}
|
|
29643
30008
|
function detectDbDir(rootDir, config, dbConfig) {
|
|
29644
|
-
if (config.paths?.dbDir) return (0,
|
|
29645
|
-
if (dbConfig.kind === "prisma") return (0,
|
|
30009
|
+
if (config.paths?.dbDir) return (0, import_node_path19.join)(rootDir, config.paths.dbDir);
|
|
30010
|
+
if (dbConfig.kind === "prisma") return (0, import_node_path19.dirname)(dbConfig.schemaPath);
|
|
29646
30011
|
if (dbConfig.kind === "sql-migrations") return dbConfig.migrationsDir;
|
|
29647
30012
|
return null;
|
|
29648
30013
|
}
|
|
@@ -29673,16 +30038,16 @@ var NON_SOURCE_DIRS = /* @__PURE__ */ new Set([
|
|
|
29673
30038
|
"libs"
|
|
29674
30039
|
]);
|
|
29675
30040
|
function dirHasTSFiles(dir) {
|
|
29676
|
-
if (!(0,
|
|
30041
|
+
if (!(0, import_node_fs15.existsSync)(dir)) return false;
|
|
29677
30042
|
try {
|
|
29678
30043
|
const stack = [dir];
|
|
29679
30044
|
while (stack.length > 0) {
|
|
29680
30045
|
const cur = stack.pop();
|
|
29681
|
-
const entries = (0,
|
|
30046
|
+
const entries = (0, import_node_fs15.readdirSync)(cur, { withFileTypes: true });
|
|
29682
30047
|
for (const e of entries) {
|
|
29683
30048
|
if (e.isFile() && (e.name.endsWith(".ts") || e.name.endsWith(".tsx"))) return true;
|
|
29684
30049
|
if (e.isDirectory() && !e.name.startsWith(".") && !DEFAULT_IGNORE_DIRS.has(e.name)) {
|
|
29685
|
-
stack.push((0,
|
|
30050
|
+
stack.push((0, import_node_path19.join)(cur, e.name));
|
|
29686
30051
|
}
|
|
29687
30052
|
}
|
|
29688
30053
|
}
|
|
@@ -29691,15 +30056,15 @@ function dirHasTSFiles(dir) {
|
|
|
29691
30056
|
return false;
|
|
29692
30057
|
}
|
|
29693
30058
|
function collectCodeBearingChildren(dir, extraSkip) {
|
|
29694
|
-
if (!(0,
|
|
30059
|
+
if (!(0, import_node_fs15.existsSync)(dir)) return [];
|
|
29695
30060
|
const out = [];
|
|
29696
30061
|
try {
|
|
29697
|
-
for (const entry of (0,
|
|
30062
|
+
for (const entry of (0, import_node_fs15.readdirSync)(dir, { withFileTypes: true })) {
|
|
29698
30063
|
if (!entry.isDirectory()) continue;
|
|
29699
30064
|
if (entry.name.startsWith(".")) continue;
|
|
29700
30065
|
if (NON_SOURCE_DIRS.has(entry.name)) continue;
|
|
29701
30066
|
if (extraSkip?.has(entry.name)) continue;
|
|
29702
|
-
const full = (0,
|
|
30067
|
+
const full = (0, import_node_path19.join)(dir, entry.name);
|
|
29703
30068
|
if (dirHasTSFiles(full)) out.push(full);
|
|
29704
30069
|
}
|
|
29705
30070
|
} catch {
|
|
@@ -29711,7 +30076,7 @@ function detectSrcRoots(rootDir, srcDir, appDir, config) {
|
|
|
29711
30076
|
const roots2 = /* @__PURE__ */ new Set();
|
|
29712
30077
|
roots2.add(appDir);
|
|
29713
30078
|
for (const r of config.paths.srcRoots) {
|
|
29714
|
-
const abs = (0,
|
|
30079
|
+
const abs = (0, import_node_path19.isAbsolute)(r) ? r : (0, import_node_path19.resolve)(rootDir, r);
|
|
29715
30080
|
roots2.add(abs);
|
|
29716
30081
|
}
|
|
29717
30082
|
return [...roots2];
|
|
@@ -29720,7 +30085,7 @@ function detectSrcRoots(rootDir, srcDir, appDir, config) {
|
|
|
29720
30085
|
roots.add(appDir);
|
|
29721
30086
|
for (const c of collectCodeBearingChildren(srcDir)) roots.add(c);
|
|
29722
30087
|
if (srcDir !== rootDir) {
|
|
29723
|
-
const skipSrcWrapper = /* @__PURE__ */ new Set([(0,
|
|
30088
|
+
const skipSrcWrapper = /* @__PURE__ */ new Set([(0, import_node_path19.basename)(srcDir)]);
|
|
29724
30089
|
for (const c of collectCodeBearingChildren(rootDir, skipSrcWrapper)) roots.add(c);
|
|
29725
30090
|
}
|
|
29726
30091
|
return [...roots];
|
|
@@ -29732,10 +30097,10 @@ function detectConventionFiles(rootDir, srcDir) {
|
|
|
29732
30097
|
const dirs = srcDir === rootDir ? [rootDir] : [srcDir, rootDir];
|
|
29733
30098
|
for (const dir of dirs) {
|
|
29734
30099
|
for (const name of CONVENTION_NAMES) {
|
|
29735
|
-
const full = (0,
|
|
29736
|
-
if (!seen.has(full) && (0,
|
|
30100
|
+
const full = (0, import_node_path19.join)(dir, name);
|
|
30101
|
+
if (!seen.has(full) && (0, import_node_fs15.existsSync)(full)) {
|
|
29737
30102
|
try {
|
|
29738
|
-
if ((0,
|
|
30103
|
+
if ((0, import_node_fs15.statSync)(full).isFile()) {
|
|
29739
30104
|
seen.add(full);
|
|
29740
30105
|
out.push(full);
|
|
29741
30106
|
}
|
|
@@ -29750,22 +30115,22 @@ function resolveProjectPaths(rootDir, config) {
|
|
|
29750
30115
|
let srcDir;
|
|
29751
30116
|
let appDir;
|
|
29752
30117
|
if (config.paths?.appDir) {
|
|
29753
|
-
appDir = (0,
|
|
29754
|
-
srcDir = config.paths.srcDir ? (0,
|
|
30118
|
+
appDir = (0, import_node_path19.join)(rootDir, config.paths.appDir);
|
|
30119
|
+
srcDir = config.paths.srcDir ? (0, import_node_path19.join)(rootDir, config.paths.srcDir) : (0, import_node_path19.dirname)(appDir);
|
|
29755
30120
|
} else {
|
|
29756
|
-
const srcApp = (0,
|
|
29757
|
-
const rootApp = (0,
|
|
29758
|
-
if ((0,
|
|
29759
|
-
srcDir = (0,
|
|
30121
|
+
const srcApp = (0, import_node_path19.join)(rootDir, "src", "app");
|
|
30122
|
+
const rootApp = (0, import_node_path19.join)(rootDir, "app");
|
|
30123
|
+
if ((0, import_node_fs15.existsSync)(srcApp)) {
|
|
30124
|
+
srcDir = (0, import_node_path19.join)(rootDir, "src");
|
|
29760
30125
|
appDir = srcApp;
|
|
29761
|
-
} else if ((0,
|
|
30126
|
+
} else if ((0, import_node_fs15.existsSync)(rootApp)) {
|
|
29762
30127
|
srcDir = rootDir;
|
|
29763
30128
|
appDir = rootApp;
|
|
29764
30129
|
} else {
|
|
29765
30130
|
return null;
|
|
29766
30131
|
}
|
|
29767
30132
|
}
|
|
29768
|
-
const apiDir = (0,
|
|
30133
|
+
const apiDir = (0, import_node_path19.join)(appDir, "api");
|
|
29769
30134
|
const dbConfig = detectDbConfig(rootDir, config);
|
|
29770
30135
|
const dbDir = detectDbDir(rootDir, config, dbConfig);
|
|
29771
30136
|
const srcRoots = detectSrcRoots(rootDir, srcDir, appDir, config);
|
|
@@ -29792,25 +30157,25 @@ var CLASSIFICATION_TO_LAYER = {
|
|
|
29792
30157
|
external: "ui"
|
|
29793
30158
|
};
|
|
29794
30159
|
function toNodeId(srcDir, rootDir, absPath) {
|
|
29795
|
-
const relFromSrc = (0,
|
|
30160
|
+
const relFromSrc = (0, import_node_path21.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
29796
30161
|
if (relFromSrc.startsWith("..")) {
|
|
29797
|
-
return (0,
|
|
30162
|
+
return (0, import_node_path21.relative)(rootDir, absPath).replace(/\\/g, "/");
|
|
29798
30163
|
}
|
|
29799
30164
|
return relFromSrc;
|
|
29800
30165
|
}
|
|
29801
30166
|
function resolveImport(srcDir, specifier) {
|
|
29802
30167
|
if (!specifier.startsWith("@/")) return null;
|
|
29803
30168
|
const rel = specifier.slice(2);
|
|
29804
|
-
const base = (0,
|
|
29805
|
-
for (const c of [base, base + ".ts", base + ".tsx", (0,
|
|
29806
|
-
if ((0,
|
|
30169
|
+
const base = (0, import_node_path21.join)(srcDir, rel);
|
|
30170
|
+
for (const c of [base, base + ".ts", base + ".tsx", (0, import_node_path21.join)(base, "index.ts"), (0, import_node_path21.join)(base, "index.tsx")]) {
|
|
30171
|
+
if ((0, import_node_fs17.existsSync)(c) && (0, import_node_fs17.statSync)(c).isFile()) return c;
|
|
29807
30172
|
}
|
|
29808
30173
|
return null;
|
|
29809
30174
|
}
|
|
29810
30175
|
function resolveRelativeImport(fromFile, specifier) {
|
|
29811
|
-
const base = (0,
|
|
29812
|
-
for (const c of [base, base + ".ts", base + ".tsx", (0,
|
|
29813
|
-
if ((0,
|
|
30176
|
+
const base = (0, import_node_path21.join)((0, import_node_path21.dirname)(fromFile), specifier);
|
|
30177
|
+
for (const c of [base, base + ".ts", base + ".tsx", (0, import_node_path21.join)(base, "index.ts"), (0, import_node_path21.join)(base, "index.tsx")]) {
|
|
30178
|
+
if ((0, import_node_fs17.existsSync)(c) && (0, import_node_fs17.statSync)(c).isFile()) return c;
|
|
29814
30179
|
}
|
|
29815
30180
|
return null;
|
|
29816
30181
|
}
|
|
@@ -29831,7 +30196,7 @@ function resolveBarrelMap(barrelAbsPath, parsedByPath, memo, visiting) {
|
|
|
29831
30196
|
const resolved = resolveRelativeImport(barrelAbsPath, re.from);
|
|
29832
30197
|
if (!resolved) continue;
|
|
29833
30198
|
if (re.isWildcard) {
|
|
29834
|
-
const targetBn = (0,
|
|
30199
|
+
const targetBn = (0, import_node_path21.basename)(resolved);
|
|
29835
30200
|
const targetIsBarrel = targetBn === "index.ts" || targetBn === "index.tsx";
|
|
29836
30201
|
if (targetIsBarrel) {
|
|
29837
30202
|
const nested = resolveBarrelMap(resolved, parsedByPath, memo, visiting);
|
|
@@ -29858,12 +30223,12 @@ function buildAllBarrelMaps(srcDir, parsedByPath) {
|
|
|
29858
30223
|
const barrels = /* @__PURE__ */ new Map();
|
|
29859
30224
|
const memo = /* @__PURE__ */ new Map();
|
|
29860
30225
|
for (const [absPath, parsed] of parsedByPath) {
|
|
29861
|
-
const bn = (0,
|
|
30226
|
+
const bn = (0, import_node_path21.basename)(absPath);
|
|
29862
30227
|
if (bn !== "index.ts" && bn !== "index.tsx") continue;
|
|
29863
30228
|
if (parsed.reExports.length === 0) continue;
|
|
29864
30229
|
const map = resolveBarrelMap(absPath, parsedByPath, memo, /* @__PURE__ */ new Set());
|
|
29865
30230
|
if (map.size > 0) {
|
|
29866
|
-
const barrelId = (0,
|
|
30231
|
+
const barrelId = (0, import_node_path21.relative)(srcDir, (0, import_node_path21.dirname)(absPath)).replace(/\\/g, "/");
|
|
29867
30232
|
barrels.set(barrelId, map);
|
|
29868
30233
|
}
|
|
29869
30234
|
}
|
|
@@ -29888,10 +30253,10 @@ function extractRoute(id) {
|
|
|
29888
30253
|
return route || "/";
|
|
29889
30254
|
}
|
|
29890
30255
|
function nameFromFilename(absPath) {
|
|
29891
|
-
return (0,
|
|
30256
|
+
return (0, import_node_path21.basename)(absPath, (0, import_node_path21.extname)(absPath)).replace(/[-_](\w)/g, (_, c) => c.toUpperCase()).replace(/^(\w)/, (_, c) => c.toUpperCase());
|
|
29892
30257
|
}
|
|
29893
30258
|
function filePathToAppRoute(appDir, absPath) {
|
|
29894
|
-
let route = ("/" + (0,
|
|
30259
|
+
let route = ("/" + (0, import_node_path21.relative)(appDir, absPath).replace(/\\/g, "/")).replace(/\/route\.tsx?$/, "");
|
|
29895
30260
|
route = route.replace(/\/\([^)]+\)/g, "");
|
|
29896
30261
|
route = route.replace(/\[\[\.\.\.([^\]]+)\]\]/g, "*$1?");
|
|
29897
30262
|
route = route.replace(/\[\.\.\.([^\]]+)\]/g, "*$1");
|
|
@@ -30139,7 +30504,7 @@ function generate(rootDir) {
|
|
|
30139
30504
|
const apiNodes = [];
|
|
30140
30505
|
const nodeIdSet = /* @__PURE__ */ new Set();
|
|
30141
30506
|
const routeToNodeId = /* @__PURE__ */ new Map();
|
|
30142
|
-
const fileSet = allDiscovered.filter((f) => !(0,
|
|
30507
|
+
const fileSet = allDiscovered.filter((f) => !(0, import_node_path21.basename)(f).startsWith("index."));
|
|
30143
30508
|
for (const absPath of fileSet) {
|
|
30144
30509
|
const id = toNodeId(srcDir, rootDir, absPath);
|
|
30145
30510
|
const type = classifyType(absPath, id);
|
|
@@ -30299,7 +30664,7 @@ function generate(rootDir) {
|
|
|
30299
30664
|
} catch {
|
|
30300
30665
|
continue;
|
|
30301
30666
|
}
|
|
30302
|
-
const externalId = (0,
|
|
30667
|
+
const externalId = (0, import_node_path21.relative)(rootDir, absPath).replace(/\\/g, "/");
|
|
30303
30668
|
const edgesFromThis = [];
|
|
30304
30669
|
const seen = /* @__PURE__ */ new Set();
|
|
30305
30670
|
for (const imp of parsed.imports) {
|
|
@@ -30649,7 +31014,7 @@ var typescriptProjectParser = {
|
|
|
30649
31014
|
};
|
|
30650
31015
|
|
|
30651
31016
|
// src/server/graph/parsers/db/prisma-schema.ts
|
|
30652
|
-
var
|
|
31017
|
+
var import_node_fs18 = require("node:fs");
|
|
30653
31018
|
init_config();
|
|
30654
31019
|
function parseModels(content) {
|
|
30655
31020
|
const nodes = [];
|
|
@@ -30742,7 +31107,7 @@ function parseEnums(content) {
|
|
|
30742
31107
|
}
|
|
30743
31108
|
function detect2(rootDir) {
|
|
30744
31109
|
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
30745
|
-
return paths?.dbConfig.kind === "prisma" && (0,
|
|
31110
|
+
return paths?.dbConfig.kind === "prisma" && (0, import_node_fs18.existsSync)(paths.dbConfig.schemaPath);
|
|
30746
31111
|
}
|
|
30747
31112
|
function generate2(rootDir) {
|
|
30748
31113
|
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
@@ -30759,7 +31124,7 @@ function generate2(rootDir) {
|
|
|
30759
31124
|
};
|
|
30760
31125
|
}
|
|
30761
31126
|
const schemaPath = paths.dbConfig.schemaPath;
|
|
30762
|
-
const content = (0,
|
|
31127
|
+
const content = (0, import_node_fs18.readFileSync)(schemaPath, "utf-8");
|
|
30763
31128
|
const { nodes: modelNodes, relations } = parseModels(content);
|
|
30764
31129
|
const enumNodes = parseEnums(content);
|
|
30765
31130
|
const allNodes = [...modelNodes, ...enumNodes];
|
|
@@ -30816,8 +31181,8 @@ var prismaSchemaParser = {
|
|
|
30816
31181
|
};
|
|
30817
31182
|
|
|
30818
31183
|
// src/server/graph/parsers/db/sql-migrations.ts
|
|
30819
|
-
var
|
|
30820
|
-
var
|
|
31184
|
+
var import_node_fs19 = require("node:fs");
|
|
31185
|
+
var import_node_path22 = require("node:path");
|
|
30821
31186
|
var import_pgsql_parser = require("pgsql-parser");
|
|
30822
31187
|
init_config();
|
|
30823
31188
|
var PG_TO_PRISMA = {
|
|
@@ -30851,15 +31216,15 @@ function pgTypeToPrisma(pgType) {
|
|
|
30851
31216
|
return PG_TO_PRISMA[upper] ?? upper;
|
|
30852
31217
|
}
|
|
30853
31218
|
function discoverMigrationFiles(migrationsDir) {
|
|
30854
|
-
if (!(0,
|
|
31219
|
+
if (!(0, import_node_fs19.existsSync)(migrationsDir)) return [];
|
|
30855
31220
|
const out = [];
|
|
30856
|
-
const entries = (0,
|
|
31221
|
+
const entries = (0, import_node_fs19.readdirSync)(migrationsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
|
|
30857
31222
|
for (const entry of entries) {
|
|
30858
31223
|
if (entry.isDirectory()) {
|
|
30859
|
-
const sqlPath = (0,
|
|
30860
|
-
if ((0,
|
|
31224
|
+
const sqlPath = (0, import_node_path22.join)(migrationsDir, entry.name, "migration.sql");
|
|
31225
|
+
if ((0, import_node_fs19.existsSync)(sqlPath)) out.push(sqlPath);
|
|
30861
31226
|
} else if (entry.isFile() && entry.name.endsWith(".sql")) {
|
|
30862
|
-
out.push((0,
|
|
31227
|
+
out.push((0, import_node_path22.join)(migrationsDir, entry.name));
|
|
30863
31228
|
}
|
|
30864
31229
|
}
|
|
30865
31230
|
return out;
|
|
@@ -30904,7 +31269,7 @@ function parseMigrations(migrationsDir, dialect = postgresDialect) {
|
|
|
30904
31269
|
};
|
|
30905
31270
|
if (!migrationsDir) return state;
|
|
30906
31271
|
for (const sqlPath of discoverMigrationFiles(migrationsDir)) {
|
|
30907
|
-
const sql = (0,
|
|
31272
|
+
const sql = (0, import_node_fs19.readFileSync)(sqlPath, "utf-8");
|
|
30908
31273
|
let ast;
|
|
30909
31274
|
try {
|
|
30910
31275
|
ast = dialect.parse(sql);
|
|
@@ -31473,8 +31838,8 @@ function indexIsPrismaUncoverable(idx) {
|
|
|
31473
31838
|
return idx.hasPredicate || idx.hasExpressions || idx.method !== "btree";
|
|
31474
31839
|
}
|
|
31475
31840
|
function loadPrismaState(schemaPath) {
|
|
31476
|
-
if (!schemaPath || !(0,
|
|
31477
|
-
const content = (0,
|
|
31841
|
+
if (!schemaPath || !(0, import_node_fs19.existsSync)(schemaPath)) return null;
|
|
31842
|
+
const content = (0, import_node_fs19.readFileSync)(schemaPath, "utf-8");
|
|
31478
31843
|
const tables = /* @__PURE__ */ new Map();
|
|
31479
31844
|
const enums = /* @__PURE__ */ new Map();
|
|
31480
31845
|
const relations = [];
|
|
@@ -31881,7 +32246,7 @@ function generate3(rootDir) {
|
|
|
31881
32246
|
const migrationFiles = migrationsDir ? discoverMigrationFiles(migrationsDir) : [];
|
|
31882
32247
|
let migrationNodeCount = 0;
|
|
31883
32248
|
for (const sqlPath of migrationFiles) {
|
|
31884
|
-
const sql = (0,
|
|
32249
|
+
const sql = (0, import_node_fs19.readFileSync)(sqlPath, "utf-8");
|
|
31885
32250
|
const name = deriveMigrationName(sqlPath);
|
|
31886
32251
|
let ast;
|
|
31887
32252
|
try {
|
|
@@ -32199,14 +32564,14 @@ var fetchResolverParser = {
|
|
|
32199
32564
|
};
|
|
32200
32565
|
|
|
32201
32566
|
// src/server/graph/parsers/crosslayer/api-annotations.ts
|
|
32202
|
-
var
|
|
32203
|
-
var
|
|
32567
|
+
var import_node_fs20 = require("node:fs");
|
|
32568
|
+
var import_node_path23 = require("node:path");
|
|
32204
32569
|
init_config();
|
|
32205
32570
|
var API_ANNOTATION_RE = /@api\s+(GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)\s+(\/\S+)/g;
|
|
32206
32571
|
function toNodeId2(srcDir, rootDir, absPath) {
|
|
32207
|
-
const relFromSrc = (0,
|
|
32572
|
+
const relFromSrc = (0, import_node_path23.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
32208
32573
|
if (relFromSrc.startsWith("..")) {
|
|
32209
|
-
return (0,
|
|
32574
|
+
return (0, import_node_path23.relative)(rootDir, absPath).replace(/\\/g, "/");
|
|
32210
32575
|
}
|
|
32211
32576
|
return relFromSrc;
|
|
32212
32577
|
}
|
|
@@ -32251,7 +32616,7 @@ var apiAnnotationsParser = {
|
|
|
32251
32616
|
const flaggedEdges = [];
|
|
32252
32617
|
const seenEdge = /* @__PURE__ */ new Set();
|
|
32253
32618
|
for (const absPath of files) {
|
|
32254
|
-
const content = (0,
|
|
32619
|
+
const content = (0, import_node_fs20.readFileSync)(absPath, "utf-8");
|
|
32255
32620
|
const sourceId = toNodeId2(srcDir, rootDir, absPath);
|
|
32256
32621
|
if (!uiNodeIds.has(sourceId)) continue;
|
|
32257
32622
|
let match;
|
|
@@ -32295,14 +32660,14 @@ var apiAnnotationsParser = {
|
|
|
32295
32660
|
};
|
|
32296
32661
|
|
|
32297
32662
|
// src/server/graph/parsers/crosslayer/url-literal-scanner.ts
|
|
32298
|
-
var
|
|
32299
|
-
var
|
|
32663
|
+
var import_node_fs21 = require("node:fs");
|
|
32664
|
+
var import_node_path24 = require("node:path");
|
|
32300
32665
|
init_config();
|
|
32301
32666
|
var URL_LITERAL_RE = /['"`](\/[a-zA-Z][^'"`\s]*?)['"`]/g;
|
|
32302
32667
|
function toNodeId3(srcDir, rootDir, absPath) {
|
|
32303
|
-
const relFromSrc = (0,
|
|
32668
|
+
const relFromSrc = (0, import_node_path24.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
32304
32669
|
if (relFromSrc.startsWith("..")) {
|
|
32305
|
-
return (0,
|
|
32670
|
+
return (0, import_node_path24.relative)(rootDir, absPath).replace(/\\/g, "/");
|
|
32306
32671
|
}
|
|
32307
32672
|
return relFromSrc;
|
|
32308
32673
|
}
|
|
@@ -32346,7 +32711,7 @@ var urlLiteralScannerParser = {
|
|
|
32346
32711
|
for (const absPath of files) {
|
|
32347
32712
|
const sourceId = toNodeId3(srcDir, rootDir, absPath);
|
|
32348
32713
|
if (!uiNodeIds.has(sourceId)) continue;
|
|
32349
|
-
const content = (0,
|
|
32714
|
+
const content = (0, import_node_fs21.readFileSync)(absPath, "utf-8");
|
|
32350
32715
|
let match;
|
|
32351
32716
|
URL_LITERAL_RE.lastIndex = 0;
|
|
32352
32717
|
while ((match = URL_LITERAL_RE.exec(content)) !== null) {
|
|
@@ -32377,8 +32742,8 @@ var urlLiteralScannerParser = {
|
|
|
32377
32742
|
};
|
|
32378
32743
|
|
|
32379
32744
|
// src/server/graph/parsers/static/static-values.ts
|
|
32380
|
-
var
|
|
32381
|
-
var
|
|
32745
|
+
var import_node_fs22 = require("node:fs");
|
|
32746
|
+
var import_node_path25 = require("node:path");
|
|
32382
32747
|
init_config();
|
|
32383
32748
|
var parseCode = null;
|
|
32384
32749
|
function tryLoadTreeSitter() {
|
|
@@ -32415,21 +32780,21 @@ function extractEnumValues(rootDir) {
|
|
|
32415
32780
|
const schemaPaths = [];
|
|
32416
32781
|
if (paths?.dbConfig.kind === "prisma" && paths.dbConfig.schemaPath) {
|
|
32417
32782
|
schemaPaths.push(paths.dbConfig.schemaPath);
|
|
32418
|
-
schemaPaths.push((0,
|
|
32783
|
+
schemaPaths.push((0, import_node_path25.join)((0, import_node_path25.dirname)(paths.dbConfig.schemaPath), "schema"));
|
|
32419
32784
|
} else {
|
|
32420
|
-
schemaPaths.push((0,
|
|
32421
|
-
schemaPaths.push((0,
|
|
32785
|
+
schemaPaths.push((0, import_node_path25.join)(rootDir, "prisma", "schema.prisma"));
|
|
32786
|
+
schemaPaths.push((0, import_node_path25.join)(rootDir, "prisma", "schema"));
|
|
32422
32787
|
}
|
|
32423
32788
|
let content = "";
|
|
32424
32789
|
for (const p of schemaPaths) {
|
|
32425
|
-
if ((0,
|
|
32790
|
+
if ((0, import_node_fs22.existsSync)(p)) {
|
|
32426
32791
|
try {
|
|
32427
|
-
const stat = (0,
|
|
32792
|
+
const stat = (0, import_node_fs22.statSync)(p);
|
|
32428
32793
|
if (stat.isFile()) {
|
|
32429
|
-
content = (0,
|
|
32794
|
+
content = (0, import_node_fs22.readFileSync)(p, "utf-8");
|
|
32430
32795
|
} else if (stat.isDirectory()) {
|
|
32431
|
-
const files = (0,
|
|
32432
|
-
content = files.map((f) => (0,
|
|
32796
|
+
const files = (0, import_node_fs22.readdirSync)(p).filter((f) => f.endsWith(".prisma"));
|
|
32797
|
+
content = files.map((f) => (0, import_node_fs22.readFileSync)((0, import_node_path25.join)(p, f), "utf-8")).join("\n");
|
|
32433
32798
|
}
|
|
32434
32799
|
} catch {
|
|
32435
32800
|
continue;
|
|
@@ -32587,27 +32952,27 @@ function extractSeedData(rootDir) {
|
|
|
32587
32952
|
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
32588
32953
|
const candidates = [];
|
|
32589
32954
|
if (paths?.dbDir) {
|
|
32590
|
-
candidates.push((0,
|
|
32591
|
-
candidates.push((0,
|
|
32955
|
+
candidates.push((0, import_node_path25.join)(paths.dbDir, "seed.ts"));
|
|
32956
|
+
candidates.push((0, import_node_path25.join)(paths.dbDir, "seed.js"));
|
|
32592
32957
|
} else {
|
|
32593
|
-
candidates.push((0,
|
|
32594
|
-
candidates.push((0,
|
|
32958
|
+
candidates.push((0, import_node_path25.join)(rootDir, "prisma", "seed.ts"));
|
|
32959
|
+
candidates.push((0, import_node_path25.join)(rootDir, "prisma", "seed.js"));
|
|
32595
32960
|
}
|
|
32596
|
-
const baseRoots = paths?.srcRoots ?? [(0,
|
|
32961
|
+
const baseRoots = paths?.srcRoots ?? [(0, import_node_path25.join)(rootDir, "src")];
|
|
32597
32962
|
for (const root of baseRoots) {
|
|
32598
|
-
candidates.push((0,
|
|
32963
|
+
candidates.push((0, import_node_path25.join)(root, "server", "lib", "system-tags.ts"));
|
|
32599
32964
|
}
|
|
32600
32965
|
const seedFiles = candidates.filter((p) => {
|
|
32601
32966
|
try {
|
|
32602
|
-
return (0,
|
|
32967
|
+
return (0, import_node_fs22.existsSync)(p) && (0, import_node_fs22.statSync)(p).isFile();
|
|
32603
32968
|
} catch {
|
|
32604
32969
|
return false;
|
|
32605
32970
|
}
|
|
32606
32971
|
});
|
|
32607
32972
|
const useTreeSitter = tryLoadTreeSitter();
|
|
32608
32973
|
for (const filePath of seedFiles) {
|
|
32609
|
-
const content = (0,
|
|
32610
|
-
const relPath = (0,
|
|
32974
|
+
const content = (0, import_node_fs22.readFileSync)(filePath, "utf-8");
|
|
32975
|
+
const relPath = (0, import_node_path25.relative)(rootDir, filePath);
|
|
32611
32976
|
const seeded = detectSeededArrays(content, relPath);
|
|
32612
32977
|
let astRoot = null;
|
|
32613
32978
|
if (useTreeSitter && parseCode) {
|
|
@@ -32701,11 +33066,11 @@ function extractSeedData(rootDir) {
|
|
|
32701
33066
|
return { nodes, edges };
|
|
32702
33067
|
}
|
|
32703
33068
|
function walkDir(dir, exts) {
|
|
32704
|
-
if (!(0,
|
|
33069
|
+
if (!(0, import_node_fs22.existsSync)(dir)) return [];
|
|
32705
33070
|
const results = [];
|
|
32706
|
-
for (const entry of (0,
|
|
33071
|
+
for (const entry of (0, import_node_fs22.readdirSync)(dir, { withFileTypes: true })) {
|
|
32707
33072
|
if (entry.name === "node_modules" || entry.name === ".next" || entry.name === "dist") continue;
|
|
32708
|
-
const full = (0,
|
|
33073
|
+
const full = (0, import_node_path25.join)(dir, entry.name);
|
|
32709
33074
|
if (entry.isDirectory()) results.push(...walkDir(full, exts));
|
|
32710
33075
|
else if (exts.some((ext) => entry.name.endsWith(ext))) results.push(full);
|
|
32711
33076
|
}
|
|
@@ -32714,7 +33079,7 @@ function walkDir(dir, exts) {
|
|
|
32714
33079
|
function extractConstants(rootDir) {
|
|
32715
33080
|
const nodes = [];
|
|
32716
33081
|
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
32717
|
-
const roots = paths?.srcRoots ?? [(0,
|
|
33082
|
+
const roots = paths?.srcRoots ?? [(0, import_node_path25.join)(rootDir, "src")];
|
|
32718
33083
|
const seenFile = /* @__PURE__ */ new Set();
|
|
32719
33084
|
const allFiles = [];
|
|
32720
33085
|
for (const root of roots) {
|
|
@@ -32727,8 +33092,8 @@ function extractConstants(rootDir) {
|
|
|
32727
33092
|
}
|
|
32728
33093
|
if (allFiles.length === 0) return { nodes };
|
|
32729
33094
|
for (const filePath of allFiles) {
|
|
32730
|
-
const content = (0,
|
|
32731
|
-
const relPath = (0,
|
|
33095
|
+
const content = (0, import_node_fs22.readFileSync)(filePath, "utf-8");
|
|
33096
|
+
const relPath = (0, import_node_path25.relative)(rootDir, filePath);
|
|
32732
33097
|
const constArrayRe = /export\s+const\s+([A-Z][A-Z_0-9]+)\s*(?::[^=]+)?\s*=\s*\[/g;
|
|
32733
33098
|
let cm;
|
|
32734
33099
|
while ((cm = constArrayRe.exec(content)) !== null) {
|
|
@@ -32762,13 +33127,13 @@ function extractConstants(rootDir) {
|
|
|
32762
33127
|
}
|
|
32763
33128
|
function detect4(rootDir) {
|
|
32764
33129
|
const paths = resolveProjectPaths(rootDir, loadConfig(rootDir));
|
|
32765
|
-
if (paths?.dbConfig.kind === "prisma" && paths.dbConfig.schemaPath && (0,
|
|
33130
|
+
if (paths?.dbConfig.kind === "prisma" && paths.dbConfig.schemaPath && (0, import_node_fs22.existsSync)(paths.dbConfig.schemaPath)) {
|
|
32766
33131
|
return true;
|
|
32767
33132
|
}
|
|
32768
33133
|
if (paths?.dbDir) {
|
|
32769
|
-
if ((0,
|
|
33134
|
+
if ((0, import_node_fs22.existsSync)((0, import_node_path25.join)(paths.dbDir, "seed.ts")) || (0, import_node_fs22.existsSync)((0, import_node_path25.join)(paths.dbDir, "seed.js"))) return true;
|
|
32770
33135
|
}
|
|
32771
|
-
return (0,
|
|
33136
|
+
return (0, import_node_fs22.existsSync)((0, import_node_path25.join)(rootDir, "prisma", "schema.prisma")) || (0, import_node_fs22.existsSync)((0, import_node_path25.join)(rootDir, "prisma", "seed.ts"));
|
|
32772
33137
|
}
|
|
32773
33138
|
function generate4(rootDir) {
|
|
32774
33139
|
const enumResult = extractEnumValues(rootDir);
|
|
@@ -32843,8 +33208,8 @@ var staticValuesParser = {
|
|
|
32843
33208
|
};
|
|
32844
33209
|
|
|
32845
33210
|
// src/server/graph/parsers/crosslayer/static-ref-scanner.ts
|
|
32846
|
-
var
|
|
32847
|
-
var
|
|
33211
|
+
var import_node_fs23 = require("node:fs");
|
|
33212
|
+
var import_node_path26 = require("node:path");
|
|
32848
33213
|
init_config();
|
|
32849
33214
|
var MIN_VALUE_LENGTH = 4;
|
|
32850
33215
|
var SKIP_VALUES = /* @__PURE__ */ new Set([
|
|
@@ -33019,11 +33384,11 @@ var staticRefScannerParser = {
|
|
|
33019
33384
|
const seen = /* @__PURE__ */ new Set();
|
|
33020
33385
|
let filesScanned = 0;
|
|
33021
33386
|
for (const absPath of files) {
|
|
33022
|
-
const relFromSrc = (0,
|
|
33023
|
-
const sourceId = relFromSrc.startsWith("..") ? (0,
|
|
33387
|
+
const relFromSrc = (0, import_node_path26.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
33388
|
+
const sourceId = relFromSrc.startsWith("..") ? (0, import_node_path26.relative)(rootDir, absPath).replace(/\\/g, "/") : relFromSrc;
|
|
33024
33389
|
const sourceLayer = uiNodeIds.has(sourceId) ? "ui" : apiNodeIds.has(sourceId) ? "api" : null;
|
|
33025
33390
|
if (!sourceLayer) continue;
|
|
33026
|
-
const content = (0,
|
|
33391
|
+
const content = (0, import_node_fs23.readFileSync)(absPath, "utf-8");
|
|
33027
33392
|
filesScanned++;
|
|
33028
33393
|
let fileRefs;
|
|
33029
33394
|
if (parseCode2) {
|
|
@@ -33065,13 +33430,13 @@ var staticRefScannerParser = {
|
|
|
33065
33430
|
};
|
|
33066
33431
|
|
|
33067
33432
|
// src/server/graph/parsers/crosslayer/middleware-gates.ts
|
|
33068
|
-
var
|
|
33433
|
+
var import_node_path27 = require("node:path");
|
|
33069
33434
|
init_ts_extractor();
|
|
33070
33435
|
init_config();
|
|
33071
33436
|
function toNodeId4(srcDir, rootDir, absPath) {
|
|
33072
|
-
const relFromSrc = (0,
|
|
33437
|
+
const relFromSrc = (0, import_node_path27.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
33073
33438
|
if (relFromSrc.startsWith("..")) {
|
|
33074
|
-
return (0,
|
|
33439
|
+
return (0, import_node_path27.relative)(rootDir, absPath).replace(/\\/g, "/");
|
|
33075
33440
|
}
|
|
33076
33441
|
return relFromSrc;
|
|
33077
33442
|
}
|
|
@@ -33352,7 +33717,7 @@ var ParserRegistry = class {
|
|
|
33352
33717
|
return all2;
|
|
33353
33718
|
}
|
|
33354
33719
|
};
|
|
33355
|
-
function
|
|
33720
|
+
function registerBuiltins3(registry, disabled) {
|
|
33356
33721
|
const builtins = [
|
|
33357
33722
|
typescriptProjectParser,
|
|
33358
33723
|
prismaSchemaParser,
|
|
@@ -33373,7 +33738,7 @@ function registerBuiltins2(registry, disabled) {
|
|
|
33373
33738
|
function loadCustomParsers(registry, config, rootDir, disabled) {
|
|
33374
33739
|
for (const entry of config.parsers?.custom ?? []) {
|
|
33375
33740
|
try {
|
|
33376
|
-
const absPath = (0,
|
|
33741
|
+
const absPath = (0, import_node_path28.resolve)(rootDir, entry.path);
|
|
33377
33742
|
const mod = require(absPath);
|
|
33378
33743
|
const parser = "default" in mod ? mod.default : mod;
|
|
33379
33744
|
if (disabled.has(parser.id)) continue;
|
|
@@ -33396,14 +33761,14 @@ function loadCustomParsers(registry, config, rootDir, disabled) {
|
|
|
33396
33761
|
function createRegistry(config, rootDir) {
|
|
33397
33762
|
const registry = new ParserRegistry();
|
|
33398
33763
|
const disabled = new Set(config.parsers?.disabled ?? []);
|
|
33399
|
-
|
|
33764
|
+
registerBuiltins3(registry, disabled);
|
|
33400
33765
|
loadCustomParsers(registry, config, rootDir, disabled);
|
|
33401
33766
|
return registry;
|
|
33402
33767
|
}
|
|
33403
33768
|
|
|
33404
33769
|
// src/server/graph/core/language-detection.ts
|
|
33405
|
-
var
|
|
33406
|
-
var
|
|
33770
|
+
var import_node_fs24 = require("node:fs");
|
|
33771
|
+
var import_node_path29 = require("node:path");
|
|
33407
33772
|
init_launch_kit_paths();
|
|
33408
33773
|
var EXTENSION_TO_LANGUAGE = {
|
|
33409
33774
|
// Web / Frontend
|
|
@@ -33516,10 +33881,10 @@ var AUXILIARY_LANGUAGES = /* @__PURE__ */ new Set([
|
|
|
33516
33881
|
]);
|
|
33517
33882
|
function walkForExtensions(dir, extCounts, depth = 0) {
|
|
33518
33883
|
if (depth > 10) return;
|
|
33519
|
-
if (!(0,
|
|
33884
|
+
if (!(0, import_node_fs24.existsSync)(dir)) return;
|
|
33520
33885
|
let entries;
|
|
33521
33886
|
try {
|
|
33522
|
-
entries = (0,
|
|
33887
|
+
entries = (0, import_node_fs24.readdirSync)(dir, { withFileTypes: true });
|
|
33523
33888
|
} catch {
|
|
33524
33889
|
return;
|
|
33525
33890
|
}
|
|
@@ -33527,9 +33892,9 @@ function walkForExtensions(dir, extCounts, depth = 0) {
|
|
|
33527
33892
|
if (entry.name.startsWith(".") && entry.isDirectory()) continue;
|
|
33528
33893
|
if (entry.isDirectory()) {
|
|
33529
33894
|
if (IGNORE_DIRS.has(entry.name)) continue;
|
|
33530
|
-
walkForExtensions((0,
|
|
33895
|
+
walkForExtensions((0, import_node_path29.join)(dir, entry.name), extCounts, depth + 1);
|
|
33531
33896
|
} else {
|
|
33532
|
-
const ext = (0,
|
|
33897
|
+
const ext = (0, import_node_path29.extname)(entry.name).toLowerCase();
|
|
33533
33898
|
if (ext && EXTENSION_TO_LANGUAGE[ext]) {
|
|
33534
33899
|
extCounts.set(ext, (extCounts.get(ext) ?? 0) + 1);
|
|
33535
33900
|
}
|
|
@@ -33570,13 +33935,13 @@ function detectLanguages(rootDir, supportedLanguages) {
|
|
|
33570
33935
|
}
|
|
33571
33936
|
|
|
33572
33937
|
// src/server/graph/core/audit-core.ts
|
|
33573
|
-
var
|
|
33574
|
-
var
|
|
33938
|
+
var import_node_fs26 = require("node:fs");
|
|
33939
|
+
var import_node_path31 = require("node:path");
|
|
33575
33940
|
init_launch_kit_paths();
|
|
33576
33941
|
|
|
33577
33942
|
// src/server/graph/core/audit-security.ts
|
|
33578
|
-
var
|
|
33579
|
-
var
|
|
33943
|
+
var import_node_fs25 = require("node:fs");
|
|
33944
|
+
var import_node_path30 = require("node:path");
|
|
33580
33945
|
init_ts_extractor();
|
|
33581
33946
|
init_config();
|
|
33582
33947
|
function collectSourceFiles(rootDir) {
|
|
@@ -33601,9 +33966,9 @@ function collectSourceFiles(rootDir) {
|
|
|
33601
33966
|
return out;
|
|
33602
33967
|
}
|
|
33603
33968
|
function toNodeId5(rootDir, srcDir, absPath) {
|
|
33604
|
-
const relFromSrc = (0,
|
|
33969
|
+
const relFromSrc = (0, import_node_path30.relative)(srcDir, absPath).replace(/\\/g, "/");
|
|
33605
33970
|
if (relFromSrc.startsWith("..")) {
|
|
33606
|
-
return (0,
|
|
33971
|
+
return (0, import_node_path30.relative)(rootDir, absPath).replace(/\\/g, "/");
|
|
33607
33972
|
}
|
|
33608
33973
|
return relFromSrc;
|
|
33609
33974
|
}
|
|
@@ -33713,18 +34078,18 @@ function collectDeclaredEnvKeys(rootDir) {
|
|
|
33713
34078
|
const files = [];
|
|
33714
34079
|
let entries = [];
|
|
33715
34080
|
try {
|
|
33716
|
-
entries = (0,
|
|
34081
|
+
entries = (0, import_node_fs25.readdirSync)(rootDir);
|
|
33717
34082
|
} catch {
|
|
33718
34083
|
return { keys, files };
|
|
33719
34084
|
}
|
|
33720
34085
|
for (const name of entries) {
|
|
33721
34086
|
if (!name.startsWith(".env")) continue;
|
|
33722
|
-
const abs = (0,
|
|
33723
|
-
if (!(0,
|
|
34087
|
+
const abs = (0, import_node_path30.join)(rootDir, name);
|
|
34088
|
+
if (!(0, import_node_fs25.existsSync)(abs)) continue;
|
|
33724
34089
|
files.push(name);
|
|
33725
34090
|
let content = "";
|
|
33726
34091
|
try {
|
|
33727
|
-
content = (0,
|
|
34092
|
+
content = (0, import_node_fs25.readFileSync)(abs, "utf-8");
|
|
33728
34093
|
} catch {
|
|
33729
34094
|
continue;
|
|
33730
34095
|
}
|
|
@@ -33911,10 +34276,10 @@ function checkHardcodedUrlFallback(rootDir, core) {
|
|
|
33911
34276
|
|
|
33912
34277
|
// src/server/graph/core/audit-core.ts
|
|
33913
34278
|
function readGraphFile(rootDir, layer) {
|
|
33914
|
-
const filePath = (0,
|
|
33915
|
-
if (!(0,
|
|
34279
|
+
const filePath = (0, import_node_path31.join)(rootDir, LAUNCHSECURE_DIR, "graphs", `${layer}.json`);
|
|
34280
|
+
if (!(0, import_node_fs26.existsSync)(filePath)) return null;
|
|
33916
34281
|
try {
|
|
33917
|
-
return JSON.parse((0,
|
|
34282
|
+
return JSON.parse((0, import_node_fs26.readFileSync)(filePath, "utf-8"));
|
|
33918
34283
|
} catch {
|
|
33919
34284
|
return null;
|
|
33920
34285
|
}
|
|
@@ -33956,15 +34321,15 @@ function checkUnprotectedRoutes(rootDir) {
|
|
|
33956
34321
|
const findings = [];
|
|
33957
34322
|
const api = readGraphFile(rootDir, "api");
|
|
33958
34323
|
if (!api) return buildSkipped("api", "unprotected_routes", "no api graph");
|
|
33959
|
-
const routePermsPath = (0,
|
|
33960
|
-
if (!(0,
|
|
34324
|
+
const routePermsPath = (0, import_node_path31.join)(rootDir, "src", "config", "route-permissions.ts");
|
|
34325
|
+
if (!(0, import_node_fs26.existsSync)(routePermsPath)) {
|
|
33961
34326
|
return buildSkipped(
|
|
33962
34327
|
"api",
|
|
33963
34328
|
"unprotected_routes",
|
|
33964
34329
|
`no src/config/route-permissions.ts \u2014 this check needs a centralized ROUTE_PERMISSIONS inventory to compare endpoints against`
|
|
33965
34330
|
);
|
|
33966
34331
|
}
|
|
33967
|
-
const routePermsContent = (0,
|
|
34332
|
+
const routePermsContent = (0, import_node_fs26.readFileSync)(routePermsPath, "utf-8");
|
|
33968
34333
|
const registeredRoutes = /* @__PURE__ */ new Set();
|
|
33969
34334
|
const routeEntryRe = /path:\s*'([^']+)'/g;
|
|
33970
34335
|
let rm;
|
|
@@ -34049,15 +34414,15 @@ function checkUnenforcedPermissions(rootDir) {
|
|
|
34049
34414
|
`no seed_permission nodes \u2014 this project either has no seed permissions or hasn't tagged them in seed.ts`
|
|
34050
34415
|
);
|
|
34051
34416
|
}
|
|
34052
|
-
const routePermsPath = (0,
|
|
34053
|
-
if (!(0,
|
|
34417
|
+
const routePermsPath = (0, import_node_path31.join)(rootDir, "src", "config", "route-permissions.ts");
|
|
34418
|
+
if (!(0, import_node_fs26.existsSync)(routePermsPath)) {
|
|
34054
34419
|
return buildSkipped(
|
|
34055
34420
|
"static",
|
|
34056
34421
|
"unenforced_permissions",
|
|
34057
34422
|
`no src/config/route-permissions.ts to compare seed permissions against`
|
|
34058
34423
|
);
|
|
34059
34424
|
}
|
|
34060
|
-
const routePermsContent = (0,
|
|
34425
|
+
const routePermsContent = (0, import_node_fs26.readFileSync)(routePermsPath, "utf-8");
|
|
34061
34426
|
for (const perm of permissions) {
|
|
34062
34427
|
const regex = new RegExp(`permission:\\s*['"]${perm.key}['"]`);
|
|
34063
34428
|
if (!regex.test(routePermsContent)) {
|
|
@@ -34093,9 +34458,9 @@ function checkHardcodedValues(rootDir) {
|
|
|
34093
34458
|
const seen = /* @__PURE__ */ new Set();
|
|
34094
34459
|
for (const node of api.nodes) {
|
|
34095
34460
|
if (node.type !== "endpoint") continue;
|
|
34096
|
-
const filePath = (0,
|
|
34097
|
-
if (!(0,
|
|
34098
|
-
const content = (0,
|
|
34461
|
+
const filePath = (0, import_node_path31.join)(rootDir, "src", node.id);
|
|
34462
|
+
if (!(0, import_node_fs26.existsSync)(filePath)) continue;
|
|
34463
|
+
const content = (0, import_node_fs26.readFileSync)(filePath, "utf-8");
|
|
34099
34464
|
let m;
|
|
34100
34465
|
allCapsRe.lastIndex = 0;
|
|
34101
34466
|
while ((m = allCapsRe.exec(content)) !== null) {
|
|
@@ -34200,26 +34565,26 @@ function runAudit(rootDir, layer, check) {
|
|
|
34200
34565
|
}
|
|
34201
34566
|
|
|
34202
34567
|
// src/server/graph/core/projects.ts
|
|
34203
|
-
var
|
|
34568
|
+
var import_node_path34 = require("node:path");
|
|
34204
34569
|
|
|
34205
34570
|
// src/server/lib/worktree.ts
|
|
34206
|
-
var
|
|
34571
|
+
var import_node_path33 = require("node:path");
|
|
34207
34572
|
|
|
34208
34573
|
// src/server/orbit/registry.ts
|
|
34209
|
-
var
|
|
34574
|
+
var import_node_fs27 = require("node:fs");
|
|
34210
34575
|
var import_node_os5 = require("node:os");
|
|
34211
|
-
var
|
|
34576
|
+
var import_node_path32 = require("node:path");
|
|
34212
34577
|
init_launch_kit_paths();
|
|
34213
|
-
var REGISTRY_DIR = (0,
|
|
34214
|
-
var REGISTRY_PATH = (0,
|
|
34215
|
-
var LOCK_PATH = (0,
|
|
34578
|
+
var REGISTRY_DIR = (0, import_node_path32.join)((0, import_node_os5.homedir)(), LAUNCHSECURE_DIR, "orbit");
|
|
34579
|
+
var REGISTRY_PATH = (0, import_node_path32.join)(REGISTRY_DIR, "state.json");
|
|
34580
|
+
var LOCK_PATH = (0, import_node_path32.join)(REGISTRY_DIR, "state.json.lock");
|
|
34216
34581
|
function emptyRegistry() {
|
|
34217
34582
|
return { version: 1, worktrees: {} };
|
|
34218
34583
|
}
|
|
34219
34584
|
function readRegistry() {
|
|
34220
|
-
if (!(0,
|
|
34585
|
+
if (!(0, import_node_fs27.existsSync)(REGISTRY_PATH)) return emptyRegistry();
|
|
34221
34586
|
try {
|
|
34222
|
-
const parsed = JSON.parse((0,
|
|
34587
|
+
const parsed = JSON.parse((0, import_node_fs27.readFileSync)(REGISTRY_PATH, "utf-8"));
|
|
34223
34588
|
if (parsed?.version === 1 && parsed.worktrees && typeof parsed.worktrees === "object") {
|
|
34224
34589
|
return parsed;
|
|
34225
34590
|
}
|
|
@@ -34249,7 +34614,7 @@ function resolveWorktreeRoot(slug, monorepoRoot) {
|
|
|
34249
34614
|
function resolveWorktreeOrProjectRoot(args, monorepoRoot) {
|
|
34250
34615
|
const projectRoot = typeof args.project_root === "string" ? args.project_root.trim() : "";
|
|
34251
34616
|
if (projectRoot) {
|
|
34252
|
-
return (0,
|
|
34617
|
+
return (0, import_node_path33.isAbsolute)(projectRoot) ? projectRoot : (0, import_node_path33.resolve)(monorepoRoot, projectRoot);
|
|
34253
34618
|
}
|
|
34254
34619
|
const worktree = typeof args.worktree === "string" ? args.worktree.trim() : "";
|
|
34255
34620
|
if (worktree) {
|
|
@@ -34268,7 +34633,7 @@ function listProjects(monorepoRoot) {
|
|
|
34268
34633
|
return entries.map((p) => ({
|
|
34269
34634
|
name: p.name,
|
|
34270
34635
|
root: p.root,
|
|
34271
|
-
absoluteRoot: (0,
|
|
34636
|
+
absoluteRoot: (0, import_node_path34.resolve)(monorepoRoot, p.root)
|
|
34272
34637
|
}));
|
|
34273
34638
|
}
|
|
34274
34639
|
function resolveProject(name, projects) {
|
|
@@ -34677,6 +35042,20 @@ USE THIS FOR: "are there unsafe migrations on this branch", "audit the migration
|
|
|
34677
35042
|
required: ["from", "to"]
|
|
34678
35043
|
}
|
|
34679
35044
|
},
|
|
35045
|
+
{
|
|
35046
|
+
name: "scaffold_snippet",
|
|
35047
|
+
description: 'Scaffold a standardised test "snippet" for a context-graph action/state node. Returns a ready-to-complete snippet file: requires/produces are filled from the context graph (certain); params + the run() body are left as TODOs for you to fill from the endpoint source.\n\nUSE THIS FOR: turning a context `action` (e.g. "create tag", "pay via UPI") into a reusable Playwright snippet in the project\'s standard shape, instead of hand-writing the requires/produces wiring. Requires the `context` layer (run generate_graph first).',
|
|
35048
|
+
inputSchema: {
|
|
35049
|
+
type: "object",
|
|
35050
|
+
properties: {
|
|
35051
|
+
target: { type: "string", description: 'Context node id (e.g. "action:app/api/orgs/[orgSlug]/tags/route.ts") or the bare key (the "action:"/"state:" prefix is added if missing).' },
|
|
35052
|
+
project: { type: "string", description: PROJECT_PARAM_DESCRIPTION },
|
|
35053
|
+
worktree: { type: "string", description: WORKTREE_PARAM_DESCRIPTION2 },
|
|
35054
|
+
project_root: { type: "string", description: PROJECT_ROOT_PARAM_DESCRIPTION2 }
|
|
35055
|
+
},
|
|
35056
|
+
required: ["target"]
|
|
35057
|
+
}
|
|
35058
|
+
},
|
|
34680
35059
|
{
|
|
34681
35060
|
name: "auth_coverage_report",
|
|
34682
35061
|
description: 'Aggregate every API endpoint by its auth[] wrapper(s) \u2014 surfaces endpoints with empty auth, groups by module, shows which auth strategies dominate. Computed from api.json endpoint auth field (100% populated).\n\nUSE THIS FOR: "are there unauthenticated endpoints", "which auth wrappers are in use", "audit auth strategy consistency across modules". Paginated. Returns { total, by_strategy: {strategy: count}, unauthenticated: [endpoint_ids], by_module: {module: {total, by_strategy}} } plus the paginated endpoint list.',
|
|
@@ -35660,12 +36039,12 @@ function handleReadGraph(args) {
|
|
|
35660
36039
|
return okJson(result);
|
|
35661
36040
|
}
|
|
35662
36041
|
function nodeToFilePath(rootDir, layer, nodeId) {
|
|
35663
|
-
if (layer === "ui" || layer === "api") return (0,
|
|
35664
|
-
if (layer === "db") return (0,
|
|
35665
|
-
const withSrc = (0,
|
|
35666
|
-
if ((0,
|
|
35667
|
-
const direct = (0,
|
|
35668
|
-
if ((0,
|
|
36042
|
+
if (layer === "ui" || layer === "api") return (0, import_node_path36.join)(rootDir, "src", nodeId);
|
|
36043
|
+
if (layer === "db") return (0, import_node_path36.join)(rootDir, "prisma", "schema.prisma");
|
|
36044
|
+
const withSrc = (0, import_node_path36.join)(rootDir, "src", nodeId);
|
|
36045
|
+
if ((0, import_node_fs29.existsSync)(withSrc)) return withSrc;
|
|
36046
|
+
const direct = (0, import_node_path36.join)(rootDir, nodeId);
|
|
36047
|
+
if ((0, import_node_fs29.existsSync)(direct)) return direct;
|
|
35669
36048
|
return null;
|
|
35670
36049
|
}
|
|
35671
36050
|
function handleInspectNode(args) {
|
|
@@ -35933,11 +36312,11 @@ function handleGrepNodes(args) {
|
|
|
35933
36312
|
let filesSearched = 0;
|
|
35934
36313
|
let truncated = false;
|
|
35935
36314
|
for (const [filePath, nodeId] of filePaths) {
|
|
35936
|
-
if (!(0,
|
|
36315
|
+
if (!(0, import_node_fs29.existsSync)(filePath)) continue;
|
|
35937
36316
|
filesSearched++;
|
|
35938
36317
|
let content;
|
|
35939
36318
|
try {
|
|
35940
|
-
content = (0,
|
|
36319
|
+
content = (0, import_node_fs29.readFileSync)(filePath, "utf-8");
|
|
35941
36320
|
} catch {
|
|
35942
36321
|
continue;
|
|
35943
36322
|
}
|
|
@@ -36156,11 +36535,11 @@ function handleStartChartServer(args) {
|
|
|
36156
36535
|
});
|
|
36157
36536
|
}
|
|
36158
36537
|
const entryPath = process.argv[1];
|
|
36159
|
-
const logDir = (0,
|
|
36160
|
-
(0,
|
|
36161
|
-
const logPath = (0,
|
|
36162
|
-
const out = (0,
|
|
36163
|
-
const err2 = (0,
|
|
36538
|
+
const logDir = (0, import_node_path36.join)((0, import_node_os6.homedir)(), LAUNCHSECURE_DIR);
|
|
36539
|
+
(0, import_node_fs29.mkdirSync)(logDir, { recursive: true });
|
|
36540
|
+
const logPath = (0, import_node_path36.join)(logDir, "launch-chart.log");
|
|
36541
|
+
const out = (0, import_node_fs29.openSync)(logPath, "a");
|
|
36542
|
+
const err2 = (0, import_node_fs29.openSync)(logPath, "a");
|
|
36164
36543
|
const portArgs = args.port ? ["--port", String(args.port)] : [];
|
|
36165
36544
|
const child = (0, import_node_child_process3.spawn)(process.execPath, [entryPath, "serve", ...portArgs], {
|
|
36166
36545
|
detached: true,
|
|
@@ -36338,6 +36717,42 @@ function handleDriftReport(args) {
|
|
|
36338
36717
|
items: page
|
|
36339
36718
|
});
|
|
36340
36719
|
}
|
|
36720
|
+
function handleScaffoldSnippet(args) {
|
|
36721
|
+
const __resolved = resolveOrErr(args);
|
|
36722
|
+
if ("content" in __resolved) return __resolved;
|
|
36723
|
+
const { rootDir } = __resolved;
|
|
36724
|
+
const target = typeof args.target === "string" ? args.target.trim() : "";
|
|
36725
|
+
if (!target) return err('target is required (a context node id, e.g. "action:app/api/.../tags/route.ts").');
|
|
36726
|
+
const g = readGraph(rootDir, "context");
|
|
36727
|
+
if (!g) return err("No `context` layer found. Run generate_graph first to build context.json.");
|
|
36728
|
+
let node = g.nodes.find((n) => n.id === target);
|
|
36729
|
+
if (!node && !target.startsWith("action:") && !target.startsWith("state:")) {
|
|
36730
|
+
node = g.nodes.find((n) => n.id === `action:${target}`) ?? g.nodes.find((n) => n.id === `state:${target}`);
|
|
36731
|
+
}
|
|
36732
|
+
if (!node) return err(`No context node matching "${target}". Use read_graph layer:context to list nodes.`);
|
|
36733
|
+
const out = g.edges.filter((e) => e.source === node.id);
|
|
36734
|
+
const tokensOf = (type) => [...new Set(out.filter((e) => e.type === type).map((e) => String(e.target).replace(/^state:/, "")))].sort();
|
|
36735
|
+
const requires = tokensOf("requires");
|
|
36736
|
+
const produces = tokensOf("produces");
|
|
36737
|
+
const { exportName, code } = scaffoldSnippet({
|
|
36738
|
+
nodeId: node.id,
|
|
36739
|
+
name: String(node.name ?? node.id),
|
|
36740
|
+
requires,
|
|
36741
|
+
produces
|
|
36742
|
+
});
|
|
36743
|
+
const requiresDetail = out.filter((e) => e.type === "requires").map((e) => ({ state: String(e.target).replace(/^state:/, ""), confidence: e.confidence ?? "low", origin: e.origin ?? null }));
|
|
36744
|
+
return okJson({
|
|
36745
|
+
target: node.id,
|
|
36746
|
+
name: node.name ?? node.id,
|
|
36747
|
+
requires,
|
|
36748
|
+
produces,
|
|
36749
|
+
requires_detail: requiresDetail,
|
|
36750
|
+
export_name: exportName,
|
|
36751
|
+
suggested_path: `tests/snippets/${exportName}.ts`,
|
|
36752
|
+
snippet: code,
|
|
36753
|
+
next: "Fill `params` from the endpoint request/validation schema and implement run() with Playwright, then write the file to suggested_path."
|
|
36754
|
+
});
|
|
36755
|
+
}
|
|
36341
36756
|
function handleWhoUses(args) {
|
|
36342
36757
|
const __resolved = resolveOrErr(args);
|
|
36343
36758
|
if ("content" in __resolved) return __resolved;
|
|
@@ -36583,20 +36998,20 @@ function handleDetectProjectStack() {
|
|
|
36583
36998
|
if (ref.type === "references_api") stats.references_api++;
|
|
36584
36999
|
}
|
|
36585
37000
|
}
|
|
36586
|
-
const srcDir = (0,
|
|
36587
|
-
if ((0,
|
|
37001
|
+
const srcDir = (0, import_node_path36.join)(rootDir, "src");
|
|
37002
|
+
if ((0, import_node_fs29.existsSync)(srcDir)) {
|
|
36588
37003
|
const scanDir = (dir) => {
|
|
36589
|
-
if (!(0,
|
|
36590
|
-
for (const entry of (0,
|
|
37004
|
+
if (!(0, import_node_fs29.existsSync)(dir)) return;
|
|
37005
|
+
for (const entry of (0, import_node_fs29.readdirSync)(dir, { withFileTypes: true })) {
|
|
36591
37006
|
if (entry.name.startsWith(".") || entry.name === "node_modules") continue;
|
|
36592
|
-
const full = (0,
|
|
37007
|
+
const full = (0, import_node_path36.join)(dir, entry.name);
|
|
36593
37008
|
if (entry.isDirectory()) {
|
|
36594
37009
|
scanDir(full);
|
|
36595
37010
|
continue;
|
|
36596
37011
|
}
|
|
36597
|
-
if (![".ts", ".tsx"].includes((0,
|
|
37012
|
+
if (![".ts", ".tsx"].includes((0, import_node_path36.extname)(entry.name))) continue;
|
|
36598
37013
|
try {
|
|
36599
|
-
const content = (0,
|
|
37014
|
+
const content = (0, import_node_fs29.readFileSync)(full, "utf-8");
|
|
36600
37015
|
const matches = content.match(/@api\s+(GET|POST|PUT|DELETE|PATCH)\s+\/\S+/g);
|
|
36601
37016
|
if (matches) stats.annotations += matches.length;
|
|
36602
37017
|
} catch {
|
|
@@ -36615,7 +37030,7 @@ function handleDetectProjectStack() {
|
|
|
36615
37030
|
name: p.name,
|
|
36616
37031
|
root: p.root,
|
|
36617
37032
|
absolute_root: p.absoluteRoot,
|
|
36618
|
-
has_graph: (0,
|
|
37033
|
+
has_graph: (0, import_node_fs29.existsSync)((0, import_node_path36.join)(p.absoluteRoot, LAUNCHSECURE_DIR, "graphs"))
|
|
36619
37034
|
}));
|
|
36620
37035
|
return okJson({
|
|
36621
37036
|
languages,
|
|
@@ -36745,6 +37160,10 @@ async function handleMessage(msg) {
|
|
|
36745
37160
|
respond(id ?? null, withFreshnessMeta(handleWhoUses(args), args));
|
|
36746
37161
|
return;
|
|
36747
37162
|
}
|
|
37163
|
+
if (toolName === "scaffold_snippet") {
|
|
37164
|
+
respond(id ?? null, withFreshnessMeta(handleScaffoldSnippet(args), args));
|
|
37165
|
+
return;
|
|
37166
|
+
}
|
|
36748
37167
|
if (toolName === "trace_path") {
|
|
36749
37168
|
respond(id ?? null, withFreshnessMeta(handleTracePath(args), args));
|
|
36750
37169
|
return;
|
|
@@ -36932,7 +37351,7 @@ function parseArgs() {
|
|
|
36932
37351
|
return { port, token, serverUrl: LAUNCHSECURE_URL, subcommand, course };
|
|
36933
37352
|
}
|
|
36934
37353
|
function tryListen(server, port, maxRetries = 10) {
|
|
36935
|
-
return new Promise((
|
|
37354
|
+
return new Promise((resolve7, reject) => {
|
|
36936
37355
|
let attempts = 0;
|
|
36937
37356
|
function attempt(p) {
|
|
36938
37357
|
server.once("error", (err2) => {
|
|
@@ -36943,7 +37362,7 @@ function tryListen(server, port, maxRetries = 10) {
|
|
|
36943
37362
|
reject(err2);
|
|
36944
37363
|
}
|
|
36945
37364
|
});
|
|
36946
|
-
server.listen(p, "127.0.0.1", () =>
|
|
37365
|
+
server.listen(p, "127.0.0.1", () => resolve7(p));
|
|
36947
37366
|
}
|
|
36948
37367
|
attempt(port);
|
|
36949
37368
|
});
|
|
@@ -36964,7 +37383,7 @@ function saveCredentials(creds) {
|
|
|
36964
37383
|
});
|
|
36965
37384
|
}
|
|
36966
37385
|
function verifyToken(serverUrl, token) {
|
|
36967
|
-
return new Promise((
|
|
37386
|
+
return new Promise((resolve7) => {
|
|
36968
37387
|
const url = new URL("/api/mcp/verify", serverUrl);
|
|
36969
37388
|
const body = JSON.stringify({ token });
|
|
36970
37389
|
const mod = url.protocol === "https:" ? import_https.default : import_http.default;
|
|
@@ -36979,30 +37398,30 @@ function verifyToken(serverUrl, token) {
|
|
|
36979
37398
|
res.on("data", (chunk) => data += chunk);
|
|
36980
37399
|
res.on("end", () => {
|
|
36981
37400
|
try {
|
|
36982
|
-
|
|
37401
|
+
resolve7(JSON.parse(data));
|
|
36983
37402
|
} catch {
|
|
36984
|
-
|
|
37403
|
+
resolve7({ valid: false, error: "Invalid response from server" });
|
|
36985
37404
|
}
|
|
36986
37405
|
});
|
|
36987
37406
|
});
|
|
36988
37407
|
req.on("error", (err2) => {
|
|
36989
|
-
|
|
37408
|
+
resolve7({ valid: false, error: `Cannot reach server: ${err2.message}` });
|
|
36990
37409
|
});
|
|
36991
37410
|
req.setTimeout(1e4, () => {
|
|
36992
37411
|
req.destroy();
|
|
36993
|
-
|
|
37412
|
+
resolve7({ valid: false, error: "Connection timed out" });
|
|
36994
37413
|
});
|
|
36995
37414
|
req.write(body);
|
|
36996
37415
|
req.end();
|
|
36997
37416
|
});
|
|
36998
37417
|
}
|
|
36999
37418
|
function httpRequest2(reqUrl, options, body, timeout = 3e4) {
|
|
37000
|
-
return new Promise((
|
|
37419
|
+
return new Promise((resolve7, reject) => {
|
|
37001
37420
|
const mod = reqUrl.protocol === "https:" ? import_https.default : import_http.default;
|
|
37002
37421
|
const r = mod.request(reqUrl, options, (resp) => {
|
|
37003
37422
|
let data = "";
|
|
37004
37423
|
resp.on("data", (chunk) => data += chunk);
|
|
37005
|
-
resp.on("end", () =>
|
|
37424
|
+
resp.on("end", () => resolve7({ status: resp.statusCode || 0, headers: resp.headers, body: data }));
|
|
37006
37425
|
});
|
|
37007
37426
|
r.on("error", reject);
|
|
37008
37427
|
r.setTimeout(timeout, () => {
|