gitarsenal-cli 1.6.14 ā 1.6.15
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/package.json
CHANGED
@@ -2364,9 +2364,39 @@ def get_setup_commands_from_gitingest(repo_url):
|
|
2364
2364
|
api_keys = result.get("requiredApiKeys", [])
|
2365
2365
|
if api_keys:
|
2366
2366
|
print(f"\nš Required API Keys ({len(api_keys)}):")
|
2367
|
+
# Load stored GitArsenal credentials
|
2368
|
+
stored_credentials = {}
|
2369
|
+
try:
|
2370
|
+
credentials_file = Path.home() / ".gitarsenal" / "credentials.json"
|
2371
|
+
if credentials_file.exists():
|
2372
|
+
with open(credentials_file, 'r') as f:
|
2373
|
+
stored_credentials = json.load(f)
|
2374
|
+
print(f"š Found {len(stored_credentials)} stored GitArsenal credentials")
|
2375
|
+
else:
|
2376
|
+
print("š No stored GitArsenal credentials found")
|
2377
|
+
except Exception as e:
|
2378
|
+
print(f"ā ļø Error loading stored credentials: {e}")
|
2379
|
+
|
2380
|
+
# Identify missing required API keys
|
2381
|
+
missing_required_keys = []
|
2382
|
+
available_keys = []
|
2383
|
+
|
2367
2384
|
for i, api_key in enumerate(api_keys, 1):
|
2368
|
-
|
2369
|
-
|
2385
|
+
key_name = api_key.get('name', 'Unknown')
|
2386
|
+
is_required = api_key.get("required", False)
|
2387
|
+
has_stored_key = key_name in stored_credentials
|
2388
|
+
|
2389
|
+
if is_required:
|
2390
|
+
if has_stored_key:
|
2391
|
+
status = "ā
Required (Available)"
|
2392
|
+
available_keys.append(key_name)
|
2393
|
+
else:
|
2394
|
+
status = "š“ Required (Missing)"
|
2395
|
+
missing_required_keys.append(api_key)
|
2396
|
+
else:
|
2397
|
+
status = "š” Optional"
|
2398
|
+
|
2399
|
+
print(f" {i}. {key_name} - {status}")
|
2370
2400
|
print(f" Service: {api_key.get('service', 'Unknown')}")
|
2371
2401
|
print(f" Description: {api_key.get('description', 'No description')}")
|
2372
2402
|
if api_key.get('example'):
|
@@ -2374,6 +2404,67 @@ def get_setup_commands_from_gitingest(repo_url):
|
|
2374
2404
|
if api_key.get('documentation_url'):
|
2375
2405
|
print(f" Docs: {api_key.get('documentation_url')}")
|
2376
2406
|
print()
|
2407
|
+
|
2408
|
+
# Prompt for missing required API keys
|
2409
|
+
if missing_required_keys:
|
2410
|
+
print("š§ Setting up missing required API keys...")
|
2411
|
+
print("Press Enter to continue or Ctrl+C to skip...")
|
2412
|
+
|
2413
|
+
for api_key in missing_required_keys:
|
2414
|
+
key_name = api_key.get('name', 'Unknown')
|
2415
|
+
service = api_key.get('service', 'Unknown')
|
2416
|
+
description = api_key.get('description', 'No description')
|
2417
|
+
example = api_key.get('example', '')
|
2418
|
+
docs_url = api_key.get('documentation_url', '')
|
2419
|
+
|
2420
|
+
print(f"\nš Setting up {key_name} for {service}:")
|
2421
|
+
print(f" Description: {description}")
|
2422
|
+
if example:
|
2423
|
+
print(f" Example: {example}")
|
2424
|
+
if docs_url:
|
2425
|
+
print(f" Documentation: {docs_url}")
|
2426
|
+
|
2427
|
+
# Prompt user for the API key
|
2428
|
+
try:
|
2429
|
+
import getpass
|
2430
|
+
print(f"\nPlease enter your {key_name}:")
|
2431
|
+
new_key = getpass.getpass("API Key (hidden): ").strip()
|
2432
|
+
|
2433
|
+
if new_key:
|
2434
|
+
# Save to credentials file
|
2435
|
+
credentials_file = Path.home() / ".gitarsenal" / "credentials.json"
|
2436
|
+
credentials_file.parent.mkdir(parents=True, exist_ok=True)
|
2437
|
+
|
2438
|
+
# Load existing credentials
|
2439
|
+
if credentials_file.exists():
|
2440
|
+
with open(credentials_file, 'r') as f:
|
2441
|
+
all_credentials = json.load(f)
|
2442
|
+
else:
|
2443
|
+
all_credentials = {}
|
2444
|
+
|
2445
|
+
# Add new key
|
2446
|
+
all_credentials[key_name] = new_key
|
2447
|
+
|
2448
|
+
# Save back to file
|
2449
|
+
with open(credentials_file, 'w') as f:
|
2450
|
+
json.dump(all_credentials, f, indent=2)
|
2451
|
+
|
2452
|
+
print(f"ā
{key_name} saved successfully!")
|
2453
|
+
available_keys.append(key_name)
|
2454
|
+
else:
|
2455
|
+
print(f"ā ļø Skipping {key_name} (no input provided)")
|
2456
|
+
except KeyboardInterrupt:
|
2457
|
+
print(f"\nā ļø Skipping {key_name} (cancelled by user)")
|
2458
|
+
except Exception as e:
|
2459
|
+
print(f"ā Error saving {key_name}: {e}")
|
2460
|
+
|
2461
|
+
# Show summary
|
2462
|
+
if available_keys:
|
2463
|
+
print(f"ā
Available API keys: {', '.join(available_keys)}")
|
2464
|
+
if missing_required_keys:
|
2465
|
+
print(f"ā ļø Missing required keys: {', '.join([k.get('name') for k in missing_required_keys])}")
|
2466
|
+
else:
|
2467
|
+
print("ā¹ļø All required API keys are already available.")
|
2377
2468
|
|
2378
2469
|
# Display setup complexity if available
|
2379
2470
|
if "setupComplexity" in result:
|
@@ -2364,9 +2364,39 @@ def get_setup_commands_from_gitingest(repo_url):
|
|
2364
2364
|
api_keys = result.get("requiredApiKeys", [])
|
2365
2365
|
if api_keys:
|
2366
2366
|
print(f"\nš Required API Keys ({len(api_keys)}):")
|
2367
|
+
# Load stored GitArsenal credentials
|
2368
|
+
stored_credentials = {}
|
2369
|
+
try:
|
2370
|
+
credentials_file = Path.home() / ".gitarsenal" / "credentials.json"
|
2371
|
+
if credentials_file.exists():
|
2372
|
+
with open(credentials_file, 'r') as f:
|
2373
|
+
stored_credentials = json.load(f)
|
2374
|
+
print(f"š Found {len(stored_credentials)} stored GitArsenal credentials")
|
2375
|
+
else:
|
2376
|
+
print("š No stored GitArsenal credentials found")
|
2377
|
+
except Exception as e:
|
2378
|
+
print(f"ā ļø Error loading stored credentials: {e}")
|
2379
|
+
|
2380
|
+
# Identify missing required API keys
|
2381
|
+
missing_required_keys = []
|
2382
|
+
available_keys = []
|
2383
|
+
|
2367
2384
|
for i, api_key in enumerate(api_keys, 1):
|
2368
|
-
|
2369
|
-
|
2385
|
+
key_name = api_key.get('name', 'Unknown')
|
2386
|
+
is_required = api_key.get("required", False)
|
2387
|
+
has_stored_key = key_name in stored_credentials
|
2388
|
+
|
2389
|
+
if is_required:
|
2390
|
+
if has_stored_key:
|
2391
|
+
status = "ā
Required (Available)"
|
2392
|
+
available_keys.append(key_name)
|
2393
|
+
else:
|
2394
|
+
status = "š“ Required (Missing)"
|
2395
|
+
missing_required_keys.append(api_key)
|
2396
|
+
else:
|
2397
|
+
status = "š” Optional"
|
2398
|
+
|
2399
|
+
print(f" {i}. {key_name} - {status}")
|
2370
2400
|
print(f" Service: {api_key.get('service', 'Unknown')}")
|
2371
2401
|
print(f" Description: {api_key.get('description', 'No description')}")
|
2372
2402
|
if api_key.get('example'):
|
@@ -2374,6 +2404,67 @@ def get_setup_commands_from_gitingest(repo_url):
|
|
2374
2404
|
if api_key.get('documentation_url'):
|
2375
2405
|
print(f" Docs: {api_key.get('documentation_url')}")
|
2376
2406
|
print()
|
2407
|
+
|
2408
|
+
# Prompt for missing required API keys
|
2409
|
+
if missing_required_keys:
|
2410
|
+
print("š§ Setting up missing required API keys...")
|
2411
|
+
print("Press Enter to continue or Ctrl+C to skip...")
|
2412
|
+
|
2413
|
+
for api_key in missing_required_keys:
|
2414
|
+
key_name = api_key.get('name', 'Unknown')
|
2415
|
+
service = api_key.get('service', 'Unknown')
|
2416
|
+
description = api_key.get('description', 'No description')
|
2417
|
+
example = api_key.get('example', '')
|
2418
|
+
docs_url = api_key.get('documentation_url', '')
|
2419
|
+
|
2420
|
+
print(f"\nš Setting up {key_name} for {service}:")
|
2421
|
+
print(f" Description: {description}")
|
2422
|
+
if example:
|
2423
|
+
print(f" Example: {example}")
|
2424
|
+
if docs_url:
|
2425
|
+
print(f" Documentation: {docs_url}")
|
2426
|
+
|
2427
|
+
# Prompt user for the API key
|
2428
|
+
try:
|
2429
|
+
import getpass
|
2430
|
+
print(f"\nPlease enter your {key_name}:")
|
2431
|
+
new_key = getpass.getpass("API Key (hidden): ").strip()
|
2432
|
+
|
2433
|
+
if new_key:
|
2434
|
+
# Save to credentials file
|
2435
|
+
credentials_file = Path.home() / ".gitarsenal" / "credentials.json"
|
2436
|
+
credentials_file.parent.mkdir(parents=True, exist_ok=True)
|
2437
|
+
|
2438
|
+
# Load existing credentials
|
2439
|
+
if credentials_file.exists():
|
2440
|
+
with open(credentials_file, 'r') as f:
|
2441
|
+
all_credentials = json.load(f)
|
2442
|
+
else:
|
2443
|
+
all_credentials = {}
|
2444
|
+
|
2445
|
+
# Add new key
|
2446
|
+
all_credentials[key_name] = new_key
|
2447
|
+
|
2448
|
+
# Save back to file
|
2449
|
+
with open(credentials_file, 'w') as f:
|
2450
|
+
json.dump(all_credentials, f, indent=2)
|
2451
|
+
|
2452
|
+
print(f"ā
{key_name} saved successfully!")
|
2453
|
+
available_keys.append(key_name)
|
2454
|
+
else:
|
2455
|
+
print(f"ā ļø Skipping {key_name} (no input provided)")
|
2456
|
+
except KeyboardInterrupt:
|
2457
|
+
print(f"\nā ļø Skipping {key_name} (cancelled by user)")
|
2458
|
+
except Exception as e:
|
2459
|
+
print(f"ā Error saving {key_name}: {e}")
|
2460
|
+
|
2461
|
+
# Show summary
|
2462
|
+
if available_keys:
|
2463
|
+
print(f"ā
Available API keys: {', '.join(available_keys)}")
|
2464
|
+
if missing_required_keys:
|
2465
|
+
print(f"ā ļø Missing required keys: {', '.join([k.get('name') for k in missing_required_keys])}")
|
2466
|
+
else:
|
2467
|
+
print("ā¹ļø All required API keys are already available.")
|
2377
2468
|
|
2378
2469
|
# Display setup complexity if available
|
2379
2470
|
if "setupComplexity" in result:
|