opencode-studio-server 1.24.0 → 1.25.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 +19 -10
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1163,7 +1163,6 @@ 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
1166
  const SKIP_EXT = ['.log', '.tmp', '.db', '.sqlite', '.cache', '.pack', '.idx'];
1168
1167
 
1169
1168
  for (const name of fs.readdirSync(dir)) {
@@ -1175,7 +1174,6 @@ function collectBlobs(rootDir, basePath = '', blobs = []) {
1175
1174
  collectBlobs(rootDir, fullPath, blobs);
1176
1175
  } else {
1177
1176
  if (SKIP_EXT.some(ext => name.endsWith(ext))) continue;
1178
- if (stat.size > MAX_FILE_SIZE) continue;
1179
1177
  try {
1180
1178
  const content = fs.readFileSync(fullPath, 'utf8');
1181
1179
  blobs.push({
@@ -1382,20 +1380,31 @@ app.post('/api/github/backup', async (req, res) => {
1382
1380
 
1383
1381
  const opencodeBlobs = collectBlobs(opencodeDir);
1384
1382
  const studioBlobs = collectBlobs(studioDir);
1383
+ const skipped = [];
1385
1384
 
1386
1385
  for (const blob of opencodeBlobs) {
1387
- blob.sha = await createGitHubBlob(token, repoName, blob);
1388
- blob.path = `opencode/${blob.path}`;
1389
- delete blob.content;
1386
+ try {
1387
+ blob.sha = await createGitHubBlob(token, repoName, blob);
1388
+ blob.path = `opencode/${blob.path}`;
1389
+ delete blob.content;
1390
+ } catch (e) {
1391
+ skipped.push({ path: `opencode/${blob.path}`, reason: e.message, size: Buffer.byteLength(blob.content) });
1392
+ blob.skip = true;
1393
+ }
1390
1394
  }
1391
1395
 
1392
1396
  for (const blob of studioBlobs) {
1393
- blob.sha = await createGitHubBlob(token, repoName, blob);
1394
- blob.path = `opencode-studio/${blob.path}`;
1395
- delete blob.content;
1397
+ try {
1398
+ blob.sha = await createGitHubBlob(token, repoName, blob);
1399
+ blob.path = `opencode-studio/${blob.path}`;
1400
+ delete blob.content;
1401
+ } catch (e) {
1402
+ skipped.push({ path: `opencode-studio/${blob.path}`, reason: e.message, size: Buffer.byteLength(blob.content) });
1403
+ blob.skip = true;
1404
+ }
1396
1405
  }
1397
1406
 
1398
- const allBlobs = [...opencodeBlobs, ...studioBlobs];
1407
+ const allBlobs = [...opencodeBlobs, ...studioBlobs].filter(b => !b.skip);
1399
1408
  const rootTreeSha = await createGitHubTree(token, repoName, allBlobs);
1400
1409
 
1401
1410
  const timestamp = new Date().toISOString();
@@ -1408,7 +1417,7 @@ app.post('/api/github/backup', async (req, res) => {
1408
1417
  studio.lastGithubBackup = timestamp;
1409
1418
  saveStudioConfig(studio);
1410
1419
 
1411
- res.json({ success: true, timestamp, commit: commitSha, url: `https://github.com/${repoName}` });
1420
+ res.json({ success: true, timestamp, commit: commitSha, url: `https://github.com/${repoName}`, skipped });
1412
1421
  } catch (err) {
1413
1422
  console.error('GitHub backup error:', err);
1414
1423
  res.status(500).json({ error: err.message });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-studio-server",
3
- "version": "1.24.0",
3
+ "version": "1.25.0",
4
4
  "description": "Backend server for OpenCode Studio - manages opencode configurations",
5
5
  "main": "index.js",
6
6
  "bin": {