opencode-studio-server 1.23.0 → 1.24.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/index.js +14 -9
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1163,23 +1163,28 @@ async function bootstrapEmptyRepo(token, owner, repo) {
|
|
|
1163
1163
|
function collectBlobs(rootDir, basePath = '', blobs = []) {
|
|
1164
1164
|
const dir = basePath || rootDir;
|
|
1165
1165
|
if (!fs.existsSync(dir)) return blobs;
|
|
1166
|
+
const MAX_FILE_SIZE = 1024 * 1024;
|
|
1167
|
+
const SKIP_EXT = ['.log', '.tmp', '.db', '.sqlite', '.cache', '.pack', '.idx'];
|
|
1166
1168
|
|
|
1167
1169
|
for (const name of fs.readdirSync(dir)) {
|
|
1168
1170
|
const fullPath = path.join(dir, name);
|
|
1169
1171
|
const stat = fs.statSync(fullPath);
|
|
1170
1172
|
|
|
1171
1173
|
if (stat.isDirectory()) {
|
|
1172
|
-
if (name === 'node_modules' || name === '.git' || name === '.next') continue;
|
|
1174
|
+
if (name === 'node_modules' || name === '.git' || name === '.next' || name === 'cache') continue;
|
|
1173
1175
|
collectBlobs(rootDir, fullPath, blobs);
|
|
1174
1176
|
} else {
|
|
1175
|
-
if (
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1177
|
+
if (SKIP_EXT.some(ext => name.endsWith(ext))) continue;
|
|
1178
|
+
if (stat.size > MAX_FILE_SIZE) continue;
|
|
1179
|
+
try {
|
|
1180
|
+
const content = fs.readFileSync(fullPath, 'utf8');
|
|
1181
|
+
blobs.push({
|
|
1182
|
+
path: path.relative(rootDir, fullPath).replace(/\\/g, '/'),
|
|
1183
|
+
mode: '100644',
|
|
1184
|
+
type: 'blob',
|
|
1185
|
+
content
|
|
1186
|
+
});
|
|
1187
|
+
} catch (e) { }
|
|
1183
1188
|
}
|
|
1184
1189
|
}
|
|
1185
1190
|
return blobs;
|