gitarsenal-cli 1.3.2 → 1.3.4
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/gitarsenal.js +1 -11
- package/lib/sandbox.js +3 -10
- package/package.json +1 -1
- package/python/test_modalSandboxScript.py +22 -86
package/bin/gitarsenal.js
CHANGED
@@ -38,7 +38,6 @@ const containerCmd = program
|
|
38
38
|
.option('-s, --setup-commands <commands...>', 'Setup commands to run in the container')
|
39
39
|
.option('-y, --yes', 'Skip confirmation prompts')
|
40
40
|
.option('-m, --manual', 'Disable automatic setup command detection')
|
41
|
-
.option('-i, --interactive', 'Run in interactive mode with prompts')
|
42
41
|
.option('--show-examples', 'Show usage examples')
|
43
42
|
.action(async (options) => {
|
44
43
|
await runContainerCommand(options);
|
@@ -88,11 +87,10 @@ program
|
|
88
87
|
.option('-v, --volume <n>', 'Name of persistent volume')
|
89
88
|
.option('-y, --yes', 'Skip confirmation prompts')
|
90
89
|
.option('-m, --manual', 'Disable automatic setup command detection')
|
91
|
-
.option('-i, --interactive', 'Run in interactive mode with prompts')
|
92
90
|
.option('--show-examples', 'Show usage examples')
|
93
91
|
.action(async (options) => {
|
94
92
|
// If options are provided directly, run the container command
|
95
|
-
if (options.repo || options.
|
93
|
+
if (options.repo || options.showExamples || process.argv.length <= 3) {
|
96
94
|
await runContainerCommand(options);
|
97
95
|
}
|
98
96
|
});
|
@@ -119,14 +117,6 @@ async function runContainerCommand(options) {
|
|
119
117
|
}
|
120
118
|
spinner.succeed('Dependencies checked');
|
121
119
|
|
122
|
-
// If interactive mode is enabled, let the Python script handle the prompts
|
123
|
-
if (options.interactive) {
|
124
|
-
await runContainer({
|
125
|
-
interactive: true
|
126
|
-
});
|
127
|
-
return;
|
128
|
-
}
|
129
|
-
|
130
120
|
// If repo URL not provided, prompt for it
|
131
121
|
let repoUrl = options.repoUrl || options.repo;
|
132
122
|
let gpuType = options.gpu;
|
package/lib/sandbox.js
CHANGED
@@ -33,7 +33,6 @@ function getPythonScriptPath() {
|
|
33
33
|
* @param {string} options.volumeName - Volume name
|
34
34
|
* @param {Array<string>} options.setupCommands - Setup commands
|
35
35
|
* @param {boolean} options.useApi - Whether to use the API to fetch setup commands
|
36
|
-
* @param {boolean} options.interactive - Whether to run in interactive mode
|
37
36
|
* @param {boolean} options.showExamples - Whether to show usage examples
|
38
37
|
* @returns {Promise<void>}
|
39
38
|
*/
|
@@ -44,7 +43,6 @@ async function runContainer(options) {
|
|
44
43
|
volumeName,
|
45
44
|
setupCommands = [],
|
46
45
|
useApi = true,
|
47
|
-
interactive = false,
|
48
46
|
showExamples = false
|
49
47
|
} = options;
|
50
48
|
|
@@ -88,14 +86,9 @@ async function runContainer(options) {
|
|
88
86
|
});
|
89
87
|
}
|
90
88
|
|
91
|
-
// Add
|
92
|
-
if (
|
93
|
-
|
94
|
-
} else {
|
95
|
-
// Only add these arguments in non-interactive mode
|
96
|
-
if (gpuType) args.push('--gpu', gpuType);
|
97
|
-
if (repoUrl) args.push('--repo-url', repoUrl);
|
98
|
-
}
|
89
|
+
// Add normal arguments
|
90
|
+
if (gpuType) args.push('--gpu', gpuType);
|
91
|
+
if (repoUrl) args.push('--repo-url', repoUrl);
|
99
92
|
|
100
93
|
if (volumeName) {
|
101
94
|
args.push('--volume-name', volumeName);
|
package/package.json
CHANGED
@@ -3331,34 +3331,28 @@ def cleanup_modal_token():
|
|
3331
3331
|
print(f"❌ Error during Modal token cleanup: {e}")
|
3332
3332
|
|
3333
3333
|
def show_usage_examples():
|
3334
|
-
"""Display usage examples for the
|
3335
|
-
print("
|
3336
|
-
|
3337
|
-
print("
|
3338
|
-
print("
|
3339
|
-
print("
|
3340
|
-
print("
|
3341
|
-
|
3342
|
-
print("
|
3343
|
-
print("
|
3344
|
-
print("
|
3345
|
-
print("
|
3346
|
-
print("
|
3347
|
-
|
3348
|
-
print("
|
3349
|
-
print("
|
3350
|
-
print("
|
3351
|
-
print("
|
3352
|
-
print("
|
3353
|
-
|
3354
|
-
print("
|
3355
|
-
print("\033[90m┌────────────────────────────┐\033[0m")
|
3356
|
-
print("\033[90m│\033[0m \033[92mgitarsenal --interactive\033[0m \033[90m│\033[0m")
|
3357
|
-
print("\033[90m└────────────────────────────┘\033[0m")
|
3358
|
-
print("")
|
3359
|
-
print("\033[92mAvailable GPU Options:\033[0m")
|
3334
|
+
"""Display usage examples for the script."""
|
3335
|
+
print("Usage Examples\n")
|
3336
|
+
|
3337
|
+
print("Basic Container Creation")
|
3338
|
+
print("┌────────────────────────────────────────────────────────────────────────┐")
|
3339
|
+
print("│ gitarsenal --gpu A10G --repo-url https://github.com/username/repo.git │")
|
3340
|
+
print("└────────────────────────────────────────────────────────────────────────┘\n")
|
3341
|
+
|
3342
|
+
print("With Setup Commands")
|
3343
|
+
print("┌────────────────────────────────────────────────────────────────────────────────────────────────────┐")
|
3344
|
+
print("│ gitarsenal --gpu A100 --repo-url https://github.com/username/repo.git \\ │")
|
3345
|
+
print("│ --setup-commands \"pip install -r requirements.txt\" \"python setup.py install\" │")
|
3346
|
+
print("└────────────────────────────────────────────────────────────────────────────────────────────────────┘\n")
|
3347
|
+
|
3348
|
+
print("With Persistent Storage")
|
3349
|
+
print("┌────────────────────────────────────────────────────────────────────────────────────┐")
|
3350
|
+
print("│ gitarsenal --gpu A10G --repo-url https://github.com/username/repo.git \\ │")
|
3351
|
+
print("│ --volume-name my-persistent-volume │")
|
3352
|
+
print("└────────────────────────────────────────────────────────────────────────────────────┘\n")
|
3353
|
+
|
3354
|
+
print("Available GPU Options:")
|
3360
3355
|
print(" T4, L4, A10G, A100-40GB, A100-80GB, L40S, H100, H200, B200")
|
3361
|
-
print("")
|
3362
3356
|
|
3363
3357
|
if __name__ == "__main__":
|
3364
3358
|
# Parse command line arguments when script is run directly
|
@@ -3391,65 +3385,7 @@ if __name__ == "__main__":
|
|
3391
3385
|
# Get setup commands from file if specified
|
3392
3386
|
setup_commands = args.setup_commands or []
|
3393
3387
|
|
3394
|
-
# If
|
3395
|
-
if args.interactive:
|
3396
|
-
# If repo URL wasn't provided via command line, ask for it
|
3397
|
-
if not args.repo_url:
|
3398
|
-
args.repo_url = input("✔ Dependencies checked\n? Enter GitHub repository URL: ").strip()
|
3399
|
-
if not args.repo_url:
|
3400
|
-
print("❌ No repository URL provided. Exiting.")
|
3401
|
-
sys.exit(1)
|
3402
|
-
|
3403
|
-
# Ask about persistent volume
|
3404
|
-
use_volume = input("? Use persistent volume for faster installs? (Yes/No) [Yes]: ").strip().lower()
|
3405
|
-
if not use_volume or use_volume.startswith('y'):
|
3406
|
-
if not args.volume_name:
|
3407
|
-
args.volume_name = input("? Enter volume name [gitarsenal-volume]: ").strip()
|
3408
|
-
if not args.volume_name:
|
3409
|
-
args.volume_name = "gitarsenal-volume"
|
3410
|
-
else:
|
3411
|
-
args.volume_name = None
|
3412
|
-
|
3413
|
-
# Ask about auto-detecting setup commands
|
3414
|
-
use_api = input("? Automatically detect setup commands for this repository? (Yes/No) [Yes]: ").strip().lower()
|
3415
|
-
if not use_api or use_api.startswith('y'):
|
3416
|
-
args.use_api = True
|
3417
|
-
else:
|
3418
|
-
args.use_api = False
|
3419
|
-
|
3420
|
-
# GPU selection
|
3421
|
-
gpu_options = ['T4', 'L4', 'A10G', 'A100-40GB', 'A100-80GB', 'L40S', 'H100', 'H200', 'B200']
|
3422
|
-
print("\n? Select GPU type:")
|
3423
|
-
for i, gpu in enumerate(gpu_options, 1):
|
3424
|
-
print(f" {i}. {gpu}")
|
3425
|
-
|
3426
|
-
gpu_choice = input(f"Enter choice (1-{len(gpu_options)}) [default: 3 for A10G]: ").strip()
|
3427
|
-
if not gpu_choice:
|
3428
|
-
args.gpu = 'A10G' # Default
|
3429
|
-
else:
|
3430
|
-
try:
|
3431
|
-
gpu_index = int(gpu_choice) - 1
|
3432
|
-
if 0 <= gpu_index < len(gpu_options):
|
3433
|
-
args.gpu = gpu_options[gpu_index]
|
3434
|
-
else:
|
3435
|
-
print("⚠️ Invalid choice. Using default: A10G")
|
3436
|
-
args.gpu = 'A10G'
|
3437
|
-
except ValueError:
|
3438
|
-
print("⚠️ Invalid input. Using default: A10G")
|
3439
|
-
args.gpu = 'A10G'
|
3440
|
-
|
3441
|
-
# Show configuration summary
|
3442
|
-
print("\n📋 Container Configuration:")
|
3443
|
-
print(f"Repository URL: {args.repo_url}")
|
3444
|
-
print(f"GPU Type: {args.gpu}")
|
3445
|
-
print(f"Volume: {args.volume_name if args.volume_name else 'None'}")
|
3446
|
-
print(f"Setup Commands: {'Auto-detect from repository' if args.use_api else 'None'}")
|
3447
|
-
|
3448
|
-
# Confirm settings
|
3449
|
-
confirm = input("? Proceed with these settings? (Yes/No) [Yes]: ").strip().lower()
|
3450
|
-
if confirm and not confirm.startswith('y'):
|
3451
|
-
print("❌ Setup cancelled by user.")
|
3452
|
-
sys.exit(0)
|
3388
|
+
# If --use-api flag is set and repo_url is provided, fetch setup commands from API
|
3453
3389
|
|
3454
3390
|
# If --use-api flag is set and repo_url is provided, fetch setup commands from API
|
3455
3391
|
if args.use_api and args.repo_url:
|