gitarsenal-cli 1.9.54 → 1.9.56

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/.venv_status.json CHANGED
@@ -1 +1 @@
1
- {"created":"2025-08-12T17:07:28.249Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
1
+ {"created":"2025-08-12T17:17:32.356Z","packages":["modal","gitingest","requests","anthropic"],"uv_version":"uv 0.8.4 (Homebrew 2025-07-30)"}
package/bin/gitarsenal.js CHANGED
@@ -367,6 +367,62 @@ async function fetchFullSetupAndRecs(repoUrl) {
367
367
  return null;
368
368
  }
369
369
 
370
+ // Helper to derive a default volume name from the repository URL
371
+ function getDefaultVolumeName(repoUrl) {
372
+ try {
373
+ if (!repoUrl || typeof repoUrl !== 'string') return 'repo';
374
+ let url = repoUrl.trim();
375
+
376
+ // Remove trailing slash
377
+ if (url.endsWith('/')) url = url.slice(0, -1);
378
+
379
+ // Prefer everything after github.com/ (owner/repo)
380
+ if (url.toLowerCase().includes('github.com')) {
381
+ let after = url;
382
+ const markerIndex = after.toLowerCase().indexOf('github.com');
383
+ after = after.slice(markerIndex + 'github.com'.length); // e.g., '/owner/repo.git' or ':owner/repo.git'
384
+ // Strip leading separators
385
+ while (after.startsWith('/') || after.startsWith(':')) after = after.slice(1);
386
+ // Trim query/fragment if present
387
+ const stopIdx = Math.min(
388
+ ...[after.indexOf('?'), after.indexOf('#')].map(i => (i === -1 ? after.length : i))
389
+ );
390
+ after = after.slice(0, stopIdx);
391
+ // Remove .git suffix
392
+ if (after.toLowerCase().endsWith('.git')) after = after.slice(0, -4);
393
+ // Sanitize: replace '/' with '_' first, then keep docker-friendly chars
394
+ let vol = after.replace(/[\\/]+/g, '_')
395
+ .replace(/[^a-zA-Z0-9_.-]/g, '_')
396
+ .replace(/_+/g, '_')
397
+ .toLowerCase();
398
+ return vol || 'repo';
399
+ }
400
+
401
+ // Fallback behavior for non-GitHub URLs: use last path segment (repo name)
402
+ let repoName = null;
403
+ try {
404
+ const u = new URL(url);
405
+ const parts = u.pathname.split('/').filter(Boolean);
406
+ repoName = parts[parts.length - 1] || null;
407
+ } catch (_) {
408
+ const parts = url.split(/[/:]/).filter(Boolean);
409
+ repoName = parts[parts.length - 1] || null;
410
+ }
411
+
412
+ if (!repoName) return 'repo';
413
+ if (repoName.toLowerCase().endsWith('.git')) repoName = repoName.slice(0, -4);
414
+
415
+ repoName = repoName
416
+ .replace(/[^a-zA-Z0-9_.-]/g, '_')
417
+ .replace(/_+/g, '_')
418
+ .toLowerCase();
419
+
420
+ return repoName || 'repo';
421
+ } catch (_) {
422
+ return 'repo';
423
+ }
424
+ }
425
+
370
426
  // Function to send user data to web application
371
427
  async function sendUserData(userId, userName, userEmail) {
372
428
  try {
@@ -885,7 +941,7 @@ async function runContainerCommand(options) {
885
941
  type: 'input',
886
942
  name: 'volumeName',
887
943
  message: 'Enter volume name:',
888
- default: 'gitarsenal-volume',
944
+ default: getDefaultVolumeName(repoUrl),
889
945
  when: (answers) => answers.useVolume
890
946
  }
891
947
  ]);
@@ -895,7 +951,7 @@ async function runContainerCommand(options) {
895
951
  }
896
952
  } else if (!volumeName && skipConfirmation) {
897
953
  // If --yes flag is used and no volume specified, use default
898
- volumeName = 'gitarsenal-volume';
954
+ volumeName = getDefaultVolumeName(repoUrl);
899
955
  }
900
956
 
901
957
  // Ask about setup command detection if not specified via CLI
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitarsenal-cli",
3
- "version": "1.9.54",
3
+ "version": "1.9.56",
4
4
  "description": "CLI tool for creating Modal sandboxes with GitHub repositories",
5
5
  "main": "index.js",
6
6
  "bin": {