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.
Files changed (2) hide show
  1. package/index.js +14 -9
  2. 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 (name.endsWith('.log') || name.endsWith('.tmp')) continue;
1176
- const content = fs.readFileSync(fullPath, 'utf8');
1177
- blobs.push({
1178
- path: path.relative(rootDir, fullPath).replace(/\\/g, '/'),
1179
- mode: '100644',
1180
- type: 'blob',
1181
- content
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-studio-server",
3
- "version": "1.23.0",
3
+ "version": "1.24.0",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {