gitarsenal-cli 1.3.8 → 1.3.10
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
@@ -46,8 +46,8 @@ try:
|
|
46
46
|
print(f"✅ Using tokens from proxy server or defaults")
|
47
47
|
except ImportError:
|
48
48
|
# If the module is not available, use hardcoded tokens
|
49
|
-
TOKEN_ID = "ak-sLhYqCjkvixiYcb9LAuCHp"
|
50
|
-
TOKEN_SECRET = "as-fPzD0Zm0dl6IFAEkhaH9pq" # Real token secret from fr8mafia profile
|
49
|
+
# TOKEN_ID = "ak-sLhYqCjkvixiYcb9LAuCHp"
|
50
|
+
# TOKEN_SECRET = "as-fPzD0Zm0dl6IFAEkhaH9pq" # Real token secret from fr8mafia profile
|
51
51
|
print(f"⚠️ Using default tokens")
|
52
52
|
|
53
53
|
print("🔧 Fixing Modal token (basic implementation)...")
|
@@ -0,0 +1,58 @@
|
|
1
|
+
def get_setup_commands_from_local_api(repo_url, gitingest_data):
|
2
|
+
"""Try to get setup commands from the API."""
|
3
|
+
# Use only online endpoints
|
4
|
+
api_endpoints = [
|
5
|
+
"https://www.gitarsenal.dev/api/analyze-with-gitingest" # Working endpoint with www prefix
|
6
|
+
]
|
7
|
+
|
8
|
+
# Prepare the request payload
|
9
|
+
payload = {
|
10
|
+
"repoUrl": repo_url,
|
11
|
+
"gitingestData": gitingest_data,
|
12
|
+
"userRequest": "Setup and run the repository"
|
13
|
+
}
|
14
|
+
|
15
|
+
# Try each API endpoint
|
16
|
+
for api_url in api_endpoints:
|
17
|
+
# Use the retry mechanism for more reliable requests
|
18
|
+
response = make_api_request_with_retry(
|
19
|
+
url=api_url,
|
20
|
+
payload=payload,
|
21
|
+
max_retries=2,
|
22
|
+
timeout=180 # 3 minute timeout
|
23
|
+
)
|
24
|
+
|
25
|
+
if response and response.status_code == 200:
|
26
|
+
try:
|
27
|
+
data = response.json()
|
28
|
+
print(f"📄 Response size: {len(response.text)} bytes")
|
29
|
+
print(f"📄 Response URL: {response.url}")
|
30
|
+
if "setupInstructions" in data and "commands" in data["setupInstructions"]:
|
31
|
+
commands = data["setupInstructions"]["commands"]
|
32
|
+
print(f"✅ Successfully fetched {len(commands)} setup commands from API at {api_url}")
|
33
|
+
|
34
|
+
# Print the original commands
|
35
|
+
print("📋 Original commands from API:")
|
36
|
+
for i, cmd in enumerate(commands, 1):
|
37
|
+
print(f" {i}. {cmd}")
|
38
|
+
|
39
|
+
# Fix the commands
|
40
|
+
fixed_commands = fix_setup_commands(commands)
|
41
|
+
|
42
|
+
# Print the fixed commands
|
43
|
+
print("\n📋 Fixed commands:")
|
44
|
+
for i, cmd in enumerate(fixed_commands, 1):
|
45
|
+
print(f" {i}. {cmd}")
|
46
|
+
|
47
|
+
return fixed_commands
|
48
|
+
else:
|
49
|
+
print("⚠️ API response did not contain setupInstructions.commands field")
|
50
|
+
except json.JSONDecodeError:
|
51
|
+
print(f"❌ Failed to parse API response as JSON")
|
52
|
+
elif response:
|
53
|
+
print(f"❌ API request failed with status code: {response.status_code}")
|
54
|
+
else:
|
55
|
+
print(f"❌ Failed to connect to {api_url}")
|
56
|
+
|
57
|
+
print("❌ All API endpoints failed")
|
58
|
+
return None
|