@sentry/junior 0.202.0 → 0.204.0
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/agent-CMyTD4DD.js +17509 -0
- package/dist/agent-hooks-Bbcp9e33.js +4040 -0
- package/dist/agent-runner-DNb1A49M.js +678 -0
- package/dist/api/schema.d.ts +2728 -2639
- package/dist/api/schema.js +4 -169
- package/dist/api.d.ts +23 -17
- package/dist/api.js +3881 -5326
- package/dist/app-B1TOqBI8.d.ts +246 -0
- package/dist/app.d.ts +4 -520
- package/dist/app.js +9522 -11875
- package/dist/auth-pause-state-DosEalIG.js +168 -0
- package/dist/catalog-runtime-BReos-D4.js +7 -0
- package/dist/checkpoint-CNrPyRJN.js +2450 -0
- package/dist/cli/chat.d.ts +20 -0
- package/dist/cli/chat.js +229 -336
- package/dist/cli/check.d.ts +8 -0
- package/dist/cli/check.js +513 -806
- package/dist/cli/env.d.ts +13 -0
- package/dist/cli/env.js +63 -12
- package/dist/cli/init.d.ts +3 -0
- package/dist/cli/init.js +90 -159
- package/dist/cli/main.d.ts +6 -0
- package/dist/cli/main.js +43 -64
- package/dist/cli/plugins.d.ts +13 -0
- package/dist/cli/plugins.js +148 -227
- package/dist/cli/run.d.ts +16 -0
- package/dist/cli/run.js +52 -8
- package/dist/cli/snapshot-create.d.ts +4 -0
- package/dist/cli/snapshot-create.js +71 -125
- package/dist/cli/upgrade.d.ts +15 -0
- package/dist/cli/upgrade.js +232 -335
- package/dist/config-nGCW1OTG.js +941 -0
- package/dist/context-B45_WqVX.js +298 -0
- package/dist/conversation-privacy-B4voFRSm.js +182 -0
- package/dist/conversation-work-C6y3T5Hx.js +51 -0
- package/dist/credential-sync-kXr1hvO1.js +2660 -0
- package/dist/db-BeyXKJOI.d.ts +5 -0
- package/dist/destinations-BeBiJeEM.js +29 -0
- package/dist/execution-stats-DWfSihcH.js +373 -0
- package/dist/executor-DcMSlI5c.js +721 -0
- package/dist/experimental-CIXf7Uye.js +46 -0
- package/dist/history-ClE4toxe.d.ts +32 -0
- package/dist/history-CqTuSAdI.js +441 -0
- package/dist/instrumentation.d.ts +3 -3
- package/dist/instrumentation.js +130 -176
- package/dist/job-queue-Drn_LXlM.js +63 -0
- package/dist/logging-BzAk1S_s.js +1210 -0
- package/dist/model-profile-CZmVoGdX.js +49 -0
- package/dist/nitro.d.ts +31 -36
- package/dist/nitro.js +275 -456
- package/dist/oauth-callback-server-JiftokvA.js +130 -0
- package/dist/oauth-relay-CdCnu80W.js +62 -0
- package/dist/package-discovery-7a9YqLhE.js +455 -0
- package/dist/pending-auth-CWmSdZVg.js +185 -0
- package/dist/plugin-module-BKGOXca2.js +81 -0
- package/dist/plugins-BI9A1vKA.d.ts +95 -0
- package/dist/plugins-egKWjgue.js +99 -0
- package/dist/private-trace-result-BLvBjy_e.js +16 -0
- package/dist/profile-CrT5nXbw.js +861 -0
- package/dist/registry-DH1xUo2N.js +1419 -0
- package/dist/reporting-schema-DosTN__Q.js +105 -0
- package/dist/resolve-CZHnfxaS.js +546 -0
- package/dist/rolldown-runtime-B4FMCO8f.js +28 -0
- package/dist/runner-CZV2sC46.js +392 -0
- package/dist/sandbox-egress-signals-bHZfmhbd.js +46 -0
- package/dist/schema-Rn8-XEaN.js +1140 -0
- package/dist/sentry-CD3SdJl-.js +26 -0
- package/dist/skills-CIcDQSgM.js +316 -0
- package/dist/spawn-DdkUFRmq.js +29 -0
- package/dist/stats-DTUbAb88.js +2634 -0
- package/dist/store-C5qxF2ac.d.ts +208 -0
- package/dist/task-queue-CJIR4RF7.js +136 -0
- package/dist/task-runner-D-O3A-Cp.js +639 -0
- package/dist/thread-state-CRc9jTJS.js +431 -0
- package/dist/turn-execution-BkinIdJF.js +47 -0
- package/dist/turn-lifecycle-DQV19VTW.js +54 -0
- package/dist/usage-D3EbSO7w.js +296 -0
- package/dist/usage-schema-CKaDkH_j.js +20 -0
- package/dist/validation-C2CR-OX3.js +40 -0
- package/dist/vercel-queue-DIkVcfK4.js +167 -0
- package/dist/vercel.d.ts +6 -6
- package/dist/vercel.js +14 -6
- package/dist/version-CnXZ614E.d.ts +5 -0
- package/dist/version-DxcWdoKa.js +8 -0
- package/dist/version.d.ts +2 -4
- package/dist/version.js +2 -6
- package/dist/web-authorization-RMBxAR_t.js +76 -0
- package/dist/web-input-3EPfpf55.js +494 -0
- package/dist/work-fGofI7Op.js +509 -0
- package/dist/worker-CsOLq-mR.js +625 -0
- package/package.json +9 -9
- package/dist/agent-hooks-UXITLYOK.js +0 -51
- package/dist/catalog-runtime-BG3JLLK2.js +0 -14
- package/dist/chunk-2LYHWMR4.js +0 -46
- package/dist/chunk-2MK3QBGA.js +0 -321
- package/dist/chunk-3PGQSKJV.js +0 -692
- package/dist/chunk-3UI3WFTX.js +0 -519
- package/dist/chunk-3Y47VMHV.js +0 -6
- package/dist/chunk-4UO6FK4G.js +0 -64
- package/dist/chunk-5NOPO64K.js +0 -198
- package/dist/chunk-5PKWYPFT.js +0 -2943
- package/dist/chunk-63NKKFJL.js +0 -1228
- package/dist/chunk-6AYH6252.js +0 -787
- package/dist/chunk-6Y5B5PEX.js +0 -80
- package/dist/chunk-7DHZP5KJ.js +0 -333
- package/dist/chunk-7H2VZTWN.js +0 -103
- package/dist/chunk-7NL7T6VU.js +0 -406
- package/dist/chunk-A76OIMYN.js +0 -102
- package/dist/chunk-AWMS3SPP.js +0 -58
- package/dist/chunk-B3LY5RCL.js +0 -229
- package/dist/chunk-BD2KT3OB.js +0 -36
- package/dist/chunk-BXCX5QKA.js +0 -2086
- package/dist/chunk-C6VVF43U.js +0 -81
- package/dist/chunk-CEMMLV5L.js +0 -98
- package/dist/chunk-CM5HNV2W.js +0 -131
- package/dist/chunk-DA2KGZZI.js +0 -13
- package/dist/chunk-DBVY6HLX.js +0 -64
- package/dist/chunk-DIB4GX3G.js +0 -8
- package/dist/chunk-DKIJ2RP5.js +0 -68
- package/dist/chunk-DL2KLKVH.js +0 -931
- package/dist/chunk-DWPN6SCH.js +0 -172
- package/dist/chunk-ELWOYVOY.js +0 -206
- package/dist/chunk-EWT7H65X.js +0 -506
- package/dist/chunk-FA6POGLH.js +0 -70
- package/dist/chunk-HMREVIO2.js +0 -135
- package/dist/chunk-IIWUT4FO.js +0 -820
- package/dist/chunk-JAL3CH4G.js +0 -27
- package/dist/chunk-JSJQEWBJ.js +0 -3295
- package/dist/chunk-KHKKHDLD.js +0 -387
- package/dist/chunk-LA6R4A7Q.js +0 -706
- package/dist/chunk-LOOU2DUR.js +0 -20428
- package/dist/chunk-M6FHWXE3.js +0 -700
- package/dist/chunk-M76HMB7M.js +0 -1856
- package/dist/chunk-MAGNK5J4.js +0 -1520
- package/dist/chunk-MTM5IFCY.js +0 -1190
- package/dist/chunk-N7TMSOZH.js +0 -235
- package/dist/chunk-NHJU2ZAL.js +0 -56
- package/dist/chunk-NSXKRGRT.js +0 -717
- package/dist/chunk-OWMPFXJA.js +0 -1764
- package/dist/chunk-PDO5BLNM.js +0 -22
- package/dist/chunk-PEQXYSSE.js +0 -45
- package/dist/chunk-PW4P4JYF.js +0 -1135
- package/dist/chunk-QB54UQUS.js +0 -320
- package/dist/chunk-QP3OGJXF.js +0 -105
- package/dist/chunk-RC745GGZ.js +0 -122
- package/dist/chunk-REOIRYPR.js +0 -37
- package/dist/chunk-SCOZRLZ4.js +0 -164
- package/dist/chunk-TXJSXBV5.js +0 -1433
- package/dist/chunk-TXKUKMVO.js +0 -417
- package/dist/chunk-U2GPUYAL.js +0 -3656
- package/dist/chunk-UIE3R5XU.js +0 -17
- package/dist/chunk-UXPG6ZIN.js +0 -84
- package/dist/chunk-VFUK3X5B.js +0 -50
- package/dist/chunk-WQSHDTTI.js +0 -1163
- package/dist/chunk-X6GDDWQH.js +0 -60
- package/dist/chunk-Y2CM7HXH.js +0 -111
- package/dist/chunk-Y7X25LFY.js +0 -15
- package/dist/chunk-YDUR3ZYW.js +0 -10
- package/dist/conversation-work-VIOQ5ZF3.js +0 -54
- package/dist/db-3L2MCVRI.js +0 -26
- package/dist/discovery-DWVDM7UK.js +0 -44
- package/dist/experimental-P5FZM4CU.js +0 -12
- package/dist/oauth-callback-server-YVV6C6T2.js +0 -243
- package/dist/oauth-relay-5XPVRPYB.js +0 -8
- package/dist/plugins-YTYJMMJF.js +0 -14
- package/dist/runner-LQ7RETDP.js +0 -522
- package/dist/sandbox-egress-signals-FIL7EGPR.js +0 -73
- package/dist/sentry-MB3NL3IR.js +0 -42
- package/dist/skills-XRWYEDCD.js +0 -27
- package/dist/spawn-RC6SJUAI.js +0 -42
- package/dist/task-runner-7DY7ARYH.js +0 -36
- package/dist/validation-7MNQGCJA.js +0 -17
- package/dist/work-COALHUCG.js +0 -51
- package/dist/worker-6MURZIPD.js +0 -24
package/dist/chunk-TXKUKMVO.js
DELETED
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
// src/chat/discovery.ts
|
|
2
|
-
import fs, { statSync as statSync2 } from "fs";
|
|
3
|
-
import path2 from "path";
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
5
|
-
|
|
6
|
-
// src/package-resolution.ts
|
|
7
|
-
import { statSync } from "fs";
|
|
8
|
-
import { createRequire } from "module";
|
|
9
|
-
import path from "path";
|
|
10
|
-
function isDirectory(targetPath) {
|
|
11
|
-
try {
|
|
12
|
-
return statSync(targetPath).isDirectory();
|
|
13
|
-
} catch {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function isFile(targetPath) {
|
|
18
|
-
try {
|
|
19
|
-
return statSync(targetPath).isFile();
|
|
20
|
-
} catch {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function uniqueResolvedPathsInOrder(values) {
|
|
25
|
-
const seen = /* @__PURE__ */ new Set();
|
|
26
|
-
const resolved = [];
|
|
27
|
-
for (const value of values) {
|
|
28
|
-
const normalized = path.resolve(value);
|
|
29
|
-
if (seen.has(normalized)) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
seen.add(normalized);
|
|
33
|
-
resolved.push(normalized);
|
|
34
|
-
}
|
|
35
|
-
return resolved;
|
|
36
|
-
}
|
|
37
|
-
function ancestorNodeModulesDirs(cwd) {
|
|
38
|
-
const dirs = [];
|
|
39
|
-
let current = path.resolve(cwd);
|
|
40
|
-
while (true) {
|
|
41
|
-
const nodeModulesDir = path.join(current, "node_modules");
|
|
42
|
-
if (isDirectory(nodeModulesDir)) {
|
|
43
|
-
dirs.push(nodeModulesDir);
|
|
44
|
-
}
|
|
45
|
-
const parent = path.dirname(current);
|
|
46
|
-
if (parent === current) {
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
current = parent;
|
|
50
|
-
}
|
|
51
|
-
return dirs;
|
|
52
|
-
}
|
|
53
|
-
function packageDirInNodeModules(nodeModulesDir, packageName) {
|
|
54
|
-
const packageDir = path.join(nodeModulesDir, ...packageName.split("/"));
|
|
55
|
-
return isDirectory(packageDir) ? path.resolve(packageDir) : void 0;
|
|
56
|
-
}
|
|
57
|
-
function isValidPackageSegment(segment) {
|
|
58
|
-
return Boolean(segment) && segment !== "." && segment !== ".." && !segment.startsWith(".") && /^[A-Za-z0-9._~-]+$/.test(segment);
|
|
59
|
-
}
|
|
60
|
-
function isValidPackageName(packageName) {
|
|
61
|
-
if (!packageName || packageName.includes("\\") || path.isAbsolute(packageName)) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
const parts = packageName.split("/");
|
|
65
|
-
if (parts[0].startsWith("@")) {
|
|
66
|
-
return parts.length === 2 && parts[0].length > 1 && isValidPackageSegment(parts[0].slice(1)) && isValidPackageSegment(parts[1]);
|
|
67
|
-
}
|
|
68
|
-
return parts.length === 1 && isValidPackageSegment(parts[0]);
|
|
69
|
-
}
|
|
70
|
-
function findPackageRoot(entryPath) {
|
|
71
|
-
let dir = path.dirname(entryPath);
|
|
72
|
-
while (dir !== path.dirname(dir)) {
|
|
73
|
-
if (isFile(path.join(dir, "package.json"))) {
|
|
74
|
-
return path.resolve(dir);
|
|
75
|
-
}
|
|
76
|
-
dir = path.dirname(dir);
|
|
77
|
-
}
|
|
78
|
-
return void 0;
|
|
79
|
-
}
|
|
80
|
-
function findPackageNodeModulesDir(packageDir, packageName) {
|
|
81
|
-
const parts = path.resolve(packageDir).split(path.sep);
|
|
82
|
-
const packageParts = packageName.split("/");
|
|
83
|
-
for (let index = parts.length - 1; index >= 0; index -= 1) {
|
|
84
|
-
if (parts[index] !== "node_modules") {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
const candidatePackageParts = parts.slice(
|
|
88
|
-
index + 1,
|
|
89
|
-
index + 1 + packageParts.length
|
|
90
|
-
);
|
|
91
|
-
if (candidatePackageParts.join("/") !== packageParts.join("/")) {
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
return path.resolve(parts.slice(0, index + 1).join(path.sep) || path.sep);
|
|
95
|
-
}
|
|
96
|
-
return void 0;
|
|
97
|
-
}
|
|
98
|
-
function resolvePackageWithNode(cwd, packageName) {
|
|
99
|
-
let requireFromCwd;
|
|
100
|
-
try {
|
|
101
|
-
requireFromCwd = createRequire(path.join(cwd, "package.json"));
|
|
102
|
-
} catch {
|
|
103
|
-
return void 0;
|
|
104
|
-
}
|
|
105
|
-
for (const specifier of [`${packageName}/package.json`, packageName]) {
|
|
106
|
-
try {
|
|
107
|
-
const resolved = requireFromCwd.resolve(specifier);
|
|
108
|
-
const dir = specifier.endsWith("/package.json") ? path.dirname(resolved) : findPackageRoot(resolved);
|
|
109
|
-
if (!dir) {
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
const nodeModulesDir = findPackageNodeModulesDir(dir, packageName);
|
|
113
|
-
return {
|
|
114
|
-
dir,
|
|
115
|
-
...nodeModulesDir ? { nodeModulesDir } : void 0
|
|
116
|
-
};
|
|
117
|
-
} catch {
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return void 0;
|
|
121
|
-
}
|
|
122
|
-
function resolvePackageLocation(cwd, packageName, options) {
|
|
123
|
-
if (!isValidPackageName(packageName)) {
|
|
124
|
-
return void 0;
|
|
125
|
-
}
|
|
126
|
-
const nodeModulesDirs = uniqueResolvedPathsInOrder([
|
|
127
|
-
...options?.nodeModulesDirs ?? [],
|
|
128
|
-
...ancestorNodeModulesDirs(cwd)
|
|
129
|
-
]);
|
|
130
|
-
for (const nodeModulesDir of nodeModulesDirs) {
|
|
131
|
-
const dir = packageDirInNodeModules(nodeModulesDir, packageName);
|
|
132
|
-
if (dir) {
|
|
133
|
-
return { dir, nodeModulesDir };
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return resolvePackageWithNode(cwd, packageName);
|
|
137
|
-
}
|
|
138
|
-
function resolvePackageDir(cwd, packageName) {
|
|
139
|
-
return resolvePackageLocation(cwd, packageName)?.dir;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// src/chat/discovery.ts
|
|
143
|
-
function isDirectory2(targetPath) {
|
|
144
|
-
try {
|
|
145
|
-
return statSync2(targetPath).isDirectory();
|
|
146
|
-
} catch {
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function isFile2(targetPath) {
|
|
151
|
-
try {
|
|
152
|
-
return statSync2(targetPath).isFile();
|
|
153
|
-
} catch {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function normalizePath(targetPath) {
|
|
158
|
-
return path2.resolve(targetPath);
|
|
159
|
-
}
|
|
160
|
-
function uniqueResolvedPathsInOrder2(values) {
|
|
161
|
-
const seen = /* @__PURE__ */ new Set();
|
|
162
|
-
const resolved = [];
|
|
163
|
-
for (const value of values) {
|
|
164
|
-
const normalized = normalizePath(value);
|
|
165
|
-
if (seen.has(normalized)) {
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
seen.add(normalized);
|
|
169
|
-
resolved.push(normalized);
|
|
170
|
-
}
|
|
171
|
-
return resolved;
|
|
172
|
-
}
|
|
173
|
-
function isNodeModulesPath(candidatePath) {
|
|
174
|
-
return path2.basename(candidatePath) === "node_modules";
|
|
175
|
-
}
|
|
176
|
-
function isInsidePnpmStore(candidatePath) {
|
|
177
|
-
return candidatePath.split(path2.sep).includes(".pnpm");
|
|
178
|
-
}
|
|
179
|
-
function runningFromInstalledPackage() {
|
|
180
|
-
const currentFile = fileURLToPath(import.meta.url);
|
|
181
|
-
const marker = `${path2.sep}node_modules${path2.sep}@sentry${path2.sep}junior${path2.sep}`;
|
|
182
|
-
return currentFile.includes(marker);
|
|
183
|
-
}
|
|
184
|
-
function listInstalledPackageNodeModulesDirs() {
|
|
185
|
-
if (!runningFromInstalledPackage()) {
|
|
186
|
-
return [];
|
|
187
|
-
}
|
|
188
|
-
const dirs = [];
|
|
189
|
-
let current = path2.resolve(path2.dirname(fileURLToPath(import.meta.url)));
|
|
190
|
-
while (true) {
|
|
191
|
-
if (isNodeModulesPath(current) && !isInsidePnpmStore(current) && isDirectory2(current)) {
|
|
192
|
-
dirs.push(current);
|
|
193
|
-
}
|
|
194
|
-
const parent = path2.dirname(current);
|
|
195
|
-
if (parent === current) {
|
|
196
|
-
break;
|
|
197
|
-
}
|
|
198
|
-
current = parent;
|
|
199
|
-
}
|
|
200
|
-
return dirs;
|
|
201
|
-
}
|
|
202
|
-
function listCwdAncestorNodeModulesDirs(cwd) {
|
|
203
|
-
const resolvedCwd = normalizePath(cwd);
|
|
204
|
-
const dirs = [];
|
|
205
|
-
let current = resolvedCwd;
|
|
206
|
-
while (true) {
|
|
207
|
-
const nodeModulesDir = path2.join(current, "node_modules");
|
|
208
|
-
if (isDirectory2(nodeModulesDir)) {
|
|
209
|
-
dirs.push(nodeModulesDir);
|
|
210
|
-
}
|
|
211
|
-
if (isFile2(path2.join(current, "package.json"))) {
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
const parent = path2.dirname(current);
|
|
215
|
-
if (parent === current) {
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
current = parent;
|
|
219
|
-
}
|
|
220
|
-
return dirs;
|
|
221
|
-
}
|
|
222
|
-
function discoverNodeModulesDirs(cwd = process.cwd(), options) {
|
|
223
|
-
const explicit = options?.candidateDirs?.filter((dir) => isDirectory2(dir)) ?? [];
|
|
224
|
-
if (explicit.length > 0) {
|
|
225
|
-
return uniqueResolvedPathsInOrder2(explicit);
|
|
226
|
-
}
|
|
227
|
-
return uniqueResolvedPathsInOrder2([
|
|
228
|
-
...listInstalledPackageNodeModulesDirs(),
|
|
229
|
-
...listCwdAncestorNodeModulesDirs(cwd)
|
|
230
|
-
]);
|
|
231
|
-
}
|
|
232
|
-
function discoverProjectRoots(cwd = process.cwd(), options) {
|
|
233
|
-
const roots = discoverNodeModulesDirs(
|
|
234
|
-
cwd,
|
|
235
|
-
options?.nodeModulesDirs ? { candidateDirs: options.nodeModulesDirs } : void 0
|
|
236
|
-
).map((nodeModulesDir) => path2.dirname(nodeModulesDir));
|
|
237
|
-
return uniqueResolvedPathsInOrder2([cwd, ...roots]);
|
|
238
|
-
}
|
|
239
|
-
function unique(values) {
|
|
240
|
-
return [...new Set(values)];
|
|
241
|
-
}
|
|
242
|
-
function pathExists(targetPath) {
|
|
243
|
-
try {
|
|
244
|
-
fs.accessSync(targetPath);
|
|
245
|
-
return true;
|
|
246
|
-
} catch {
|
|
247
|
-
return false;
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
function hasAnyDataMarkers(appDir) {
|
|
251
|
-
return pathExists(path2.join(appDir, "SOUL.md")) || pathExists(path2.join(appDir, "WORLD.md"));
|
|
252
|
-
}
|
|
253
|
-
function scoreAppCandidate(appDir) {
|
|
254
|
-
let score = 0;
|
|
255
|
-
if (pathExists(path2.join(appDir, "SOUL.md"))) {
|
|
256
|
-
score += 4;
|
|
257
|
-
}
|
|
258
|
-
if (pathExists(path2.join(appDir, "WORLD.md"))) {
|
|
259
|
-
score += 2;
|
|
260
|
-
}
|
|
261
|
-
if (pathExists(path2.join(appDir, "skills"))) {
|
|
262
|
-
score += 1;
|
|
263
|
-
}
|
|
264
|
-
if (pathExists(path2.join(appDir, "plugins"))) {
|
|
265
|
-
score += 1;
|
|
266
|
-
}
|
|
267
|
-
return score;
|
|
268
|
-
}
|
|
269
|
-
function resolveCandidateAppDirs(cwd, projectRoots) {
|
|
270
|
-
const roots = projectRoots ?? discoverProjectRoots(cwd);
|
|
271
|
-
const resolved = [];
|
|
272
|
-
const seen = /* @__PURE__ */ new Set();
|
|
273
|
-
for (const root of roots) {
|
|
274
|
-
const appDir = path2.resolve(root, "app");
|
|
275
|
-
if (!pathExists(appDir)) {
|
|
276
|
-
continue;
|
|
277
|
-
}
|
|
278
|
-
if (seen.has(appDir)) {
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
seen.add(appDir);
|
|
282
|
-
resolved.push(appDir);
|
|
283
|
-
}
|
|
284
|
-
return resolved;
|
|
285
|
-
}
|
|
286
|
-
function homeDir() {
|
|
287
|
-
return resolveHomeDir();
|
|
288
|
-
}
|
|
289
|
-
function resolveHomeDir(cwd = process.cwd(), options) {
|
|
290
|
-
const resolvedCwd = path2.resolve(cwd);
|
|
291
|
-
const directApp = path2.resolve(resolvedCwd, "app");
|
|
292
|
-
if (pathExists(directApp) && hasAnyDataMarkers(directApp)) {
|
|
293
|
-
return directApp;
|
|
294
|
-
}
|
|
295
|
-
const candidates = resolveCandidateAppDirs(
|
|
296
|
-
resolvedCwd,
|
|
297
|
-
options?.projectRoots
|
|
298
|
-
);
|
|
299
|
-
if (candidates.length === 0) {
|
|
300
|
-
return directApp;
|
|
301
|
-
}
|
|
302
|
-
candidates.sort((left, right) => {
|
|
303
|
-
const leftScore = scoreAppCandidate(left);
|
|
304
|
-
const rightScore = scoreAppCandidate(right);
|
|
305
|
-
if (leftScore !== rightScore) {
|
|
306
|
-
return rightScore - leftScore;
|
|
307
|
-
}
|
|
308
|
-
const leftDistance = path2.relative(resolvedCwd, left).split(path2.sep).length;
|
|
309
|
-
const rightDistance = path2.relative(resolvedCwd, right).split(path2.sep).length;
|
|
310
|
-
if (leftDistance !== rightDistance) {
|
|
311
|
-
return leftDistance - rightDistance;
|
|
312
|
-
}
|
|
313
|
-
return left.localeCompare(right);
|
|
314
|
-
});
|
|
315
|
-
return candidates[0];
|
|
316
|
-
}
|
|
317
|
-
function resolveContentRoots(subdir) {
|
|
318
|
-
if (subdir === "data") {
|
|
319
|
-
return [homeDir()];
|
|
320
|
-
}
|
|
321
|
-
return [path2.join(homeDir(), subdir)];
|
|
322
|
-
}
|
|
323
|
-
function builtInSkillsDir() {
|
|
324
|
-
const moduleDir = path2.dirname(fileURLToPath(import.meta.url));
|
|
325
|
-
if (path2.basename(moduleDir) === "dist") {
|
|
326
|
-
return path2.join(path2.dirname(moduleDir), "skills");
|
|
327
|
-
}
|
|
328
|
-
if (path2.basename(moduleDir) === "chat" && path2.basename(path2.dirname(moduleDir)) === "src") {
|
|
329
|
-
return path2.resolve(moduleDir, "../../skills");
|
|
330
|
-
}
|
|
331
|
-
const packageDir = resolvePackageDir(process.cwd(), "@sentry/junior");
|
|
332
|
-
return path2.join(packageDir ?? moduleDir, "skills");
|
|
333
|
-
}
|
|
334
|
-
function dataDir() {
|
|
335
|
-
return resolveContentRoots("data")[0];
|
|
336
|
-
}
|
|
337
|
-
function soulPath() {
|
|
338
|
-
return path2.join(dataDir(), "SOUL.md");
|
|
339
|
-
}
|
|
340
|
-
function worldPath() {
|
|
341
|
-
return path2.join(dataDir(), "WORLD.md");
|
|
342
|
-
}
|
|
343
|
-
function descriptionPath() {
|
|
344
|
-
return path2.join(dataDir(), "DESCRIPTION.md");
|
|
345
|
-
}
|
|
346
|
-
function skillsDir() {
|
|
347
|
-
return resolveContentRoots("skills")[0];
|
|
348
|
-
}
|
|
349
|
-
function pluginsDir() {
|
|
350
|
-
return resolveContentRoots("plugins")[0];
|
|
351
|
-
}
|
|
352
|
-
function dataRoots() {
|
|
353
|
-
return unique(resolveContentRoots("data"));
|
|
354
|
-
}
|
|
355
|
-
function skillRoots() {
|
|
356
|
-
return unique([builtInSkillsDir(), ...resolveContentRoots("skills")]);
|
|
357
|
-
}
|
|
358
|
-
function pluginRoots() {
|
|
359
|
-
return unique(resolveContentRoots("plugins"));
|
|
360
|
-
}
|
|
361
|
-
function soulPathCandidates() {
|
|
362
|
-
const candidates = dataRoots().map((root) => path2.join(root, "SOUL.md"));
|
|
363
|
-
return unique(candidates);
|
|
364
|
-
}
|
|
365
|
-
function worldPathCandidates() {
|
|
366
|
-
const candidates = dataRoots().map((root) => path2.join(root, "WORLD.md"));
|
|
367
|
-
return unique(candidates);
|
|
368
|
-
}
|
|
369
|
-
function descriptionPathCandidates() {
|
|
370
|
-
const candidates = dataRoots().map(
|
|
371
|
-
(root) => path2.join(root, "DESCRIPTION.md")
|
|
372
|
-
);
|
|
373
|
-
return unique(candidates);
|
|
374
|
-
}
|
|
375
|
-
var RESERVED_APP_FILES = /* @__PURE__ */ new Set([
|
|
376
|
-
"SOUL.md",
|
|
377
|
-
"WORLD.md",
|
|
378
|
-
"DESCRIPTION.md",
|
|
379
|
-
"ABOUT.md"
|
|
380
|
-
]);
|
|
381
|
-
function listReferenceFiles() {
|
|
382
|
-
const appDir = homeDir();
|
|
383
|
-
try {
|
|
384
|
-
const entries = fs.readdirSync(appDir, { withFileTypes: true });
|
|
385
|
-
return entries.filter(
|
|
386
|
-
(entry) => entry.isFile() && entry.name.endsWith(".md") && !RESERVED_APP_FILES.has(entry.name)
|
|
387
|
-
).map((entry) => path2.join(appDir, entry.name)).sort();
|
|
388
|
-
} catch {
|
|
389
|
-
return [];
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
export {
|
|
394
|
-
isValidPackageName,
|
|
395
|
-
resolvePackageLocation,
|
|
396
|
-
resolvePackageDir,
|
|
397
|
-
isDirectory2 as isDirectory,
|
|
398
|
-
isFile2 as isFile,
|
|
399
|
-
discoverNodeModulesDirs,
|
|
400
|
-
discoverProjectRoots,
|
|
401
|
-
homeDir,
|
|
402
|
-
resolveHomeDir,
|
|
403
|
-
builtInSkillsDir,
|
|
404
|
-
dataDir,
|
|
405
|
-
soulPath,
|
|
406
|
-
worldPath,
|
|
407
|
-
descriptionPath,
|
|
408
|
-
skillsDir,
|
|
409
|
-
pluginsDir,
|
|
410
|
-
dataRoots,
|
|
411
|
-
skillRoots,
|
|
412
|
-
pluginRoots,
|
|
413
|
-
soulPathCandidates,
|
|
414
|
-
worldPathCandidates,
|
|
415
|
-
descriptionPathCandidates,
|
|
416
|
-
listReferenceFiles
|
|
417
|
-
};
|