botversion-sdk 1.1.7 → 2.0.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/bin/scan-frontend.js +49 -0
- package/client.js +12 -6
- package/index.js +150 -23
- package/interceptor.js +160 -2
- package/package.json +2 -2
- package/scanner.js +7 -106
- package/bin/init.js +0 -605
- package/cli/detector.js +0 -1149
- package/cli/generator.js +0 -187
- package/cli/prompts.js +0 -163
- package/cli/writer.js +0 -511
package/scanner.js
CHANGED
|
@@ -1146,112 +1146,13 @@ function findAllFrontendDirs(cwd) {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
}
|
|
1148
1148
|
|
|
1149
|
-
//
|
|
1150
|
-
//
|
|
1151
|
-
//
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
"Documents",
|
|
1157
|
-
"Downloads",
|
|
1158
|
-
"Pictures",
|
|
1159
|
-
"Videos",
|
|
1160
|
-
"Music",
|
|
1161
|
-
"home",
|
|
1162
|
-
"users",
|
|
1163
|
-
"Users",
|
|
1164
|
-
"var",
|
|
1165
|
-
"www",
|
|
1166
|
-
"srv",
|
|
1167
|
-
"opt",
|
|
1168
|
-
"tmp",
|
|
1169
|
-
"workspace",
|
|
1170
|
-
"Workspace",
|
|
1171
|
-
"projects",
|
|
1172
|
-
"Projects",
|
|
1173
|
-
"code",
|
|
1174
|
-
"Code",
|
|
1175
|
-
"sites",
|
|
1176
|
-
"Sites",
|
|
1177
|
-
"dev",
|
|
1178
|
-
"Dev",
|
|
1179
|
-
"work",
|
|
1180
|
-
"Work",
|
|
1181
|
-
]);
|
|
1182
|
-
|
|
1183
|
-
if (UNSAFE_PARENTS.has(path.basename(parentDir))) {
|
|
1184
|
-
if (found.length === 0) found.push(cwd);
|
|
1185
|
-
return found;
|
|
1186
|
-
}
|
|
1187
|
-
// Safety check — only scan siblings if the parent folder
|
|
1188
|
-
// looks like a project root (has package.json OR common project folders)
|
|
1189
|
-
// This prevents scanning unrelated projects on the Desktop
|
|
1190
|
-
const parentHasPackageJson = fs.existsSync(
|
|
1191
|
-
path.join(parentDir, "package.json"),
|
|
1192
|
-
);
|
|
1193
|
-
const parentHasCommonProjectFiles =
|
|
1194
|
-
fs.existsSync(path.join(parentDir, "docker-compose.yml")) ||
|
|
1195
|
-
fs.existsSync(path.join(parentDir, "docker-compose.yaml")) ||
|
|
1196
|
-
fs.existsSync(path.join(parentDir, ".env")) ||
|
|
1197
|
-
fs.existsSync(path.join(parentDir, "turbo.json")) ||
|
|
1198
|
-
fs.existsSync(path.join(parentDir, "pnpm-workspace.yaml"));
|
|
1199
|
-
|
|
1200
|
-
// If parent has no signs of being a project root, skip sibling scanning
|
|
1201
|
-
if (!parentHasPackageJson && !parentHasCommonProjectFiles) {
|
|
1202
|
-
// skip — parent is probably just a random folder like Desktop
|
|
1203
|
-
} else {
|
|
1204
|
-
let parentEntries;
|
|
1205
|
-
try {
|
|
1206
|
-
parentEntries = fs.readdirSync(parentDir);
|
|
1207
|
-
} catch {
|
|
1208
|
-
parentEntries = [];
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
for (const entry of parentEntries) {
|
|
1212
|
-
if (SKIP_DIRS.has(entry)) continue;
|
|
1213
|
-
|
|
1214
|
-
const sibling = path.join(parentDir, entry);
|
|
1215
|
-
if (sibling === cwd) continue; // skip cwd itself
|
|
1216
|
-
|
|
1217
|
-
let stat;
|
|
1218
|
-
try {
|
|
1219
|
-
stat = fs.statSync(sibling);
|
|
1220
|
-
} catch {
|
|
1221
|
-
continue;
|
|
1222
|
-
}
|
|
1223
|
-
if (!stat.isDirectory()) continue;
|
|
1224
|
-
|
|
1225
|
-
// Only add if it actually looks like a frontend project
|
|
1226
|
-
if (isFrontendDir(sibling) && !found.includes(sibling)) {
|
|
1227
|
-
found.push(sibling);
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
// Also check one level inside the sibling
|
|
1231
|
-
let siblingEntries;
|
|
1232
|
-
try {
|
|
1233
|
-
siblingEntries = fs.readdirSync(sibling);
|
|
1234
|
-
} catch {
|
|
1235
|
-
continue;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
for (const siblingEntry of siblingEntries) {
|
|
1239
|
-
if (SKIP_DIRS.has(siblingEntry)) continue;
|
|
1240
|
-
const siblingChild = path.join(sibling, siblingEntry);
|
|
1241
|
-
let siblingChildStat;
|
|
1242
|
-
try {
|
|
1243
|
-
siblingChildStat = fs.statSync(siblingChild);
|
|
1244
|
-
} catch {
|
|
1245
|
-
continue;
|
|
1246
|
-
}
|
|
1247
|
-
if (!siblingChildStat.isDirectory()) continue;
|
|
1248
|
-
if (isFrontendDir(siblingChild) && !found.includes(siblingChild)) {
|
|
1249
|
-
found.push(siblingChild);
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
}
|
|
1149
|
+
// Note: we intentionally do NOT walk up to sibling folders (e.g. a
|
|
1150
|
+
// separate frontend/ folder next to backend/) anymore. That only worked
|
|
1151
|
+
// in local dev monorepos where both folders live on the same disk. In
|
|
1152
|
+
// production, frontend and backend are frequently on completely separate
|
|
1153
|
+
// servers, so there is nothing to find outside cwd. If this install has
|
|
1154
|
+
// no frontend, classification (in index.js) reports that to the
|
|
1155
|
+
// dashboard instead of guessing at a folder that may not exist here.
|
|
1255
1156
|
|
|
1256
1157
|
// If nothing found, fall back to cwd
|
|
1257
1158
|
if (found.length === 0) {
|