2026.03.30 front és garázs logika
This commit is contained in:
@@ -125,7 +125,51 @@ def list_milestones():
|
||||
print(f"\n{'ID':<5} | {'Mérföldkő Címe':<40} | {'Haladás'}")
|
||||
print("-" * 65)
|
||||
for ms in milestones:
|
||||
print(f"#{ms['id']:<4} | {ms['title'][:40]:<40} | {ms['completeness']}%")
|
||||
open_issues = ms.get('open_issues', 0)
|
||||
closed_issues = ms.get('closed_issues', 0)
|
||||
total = open_issues + closed_issues
|
||||
if total > 0:
|
||||
completeness = int((closed_issues / total) * 100)
|
||||
else:
|
||||
completeness = 0
|
||||
print(f"#{ms['id']:<4} | {ms['title'][:40]:<40} | {completeness}%")
|
||||
|
||||
# --- PROJEKT (BOARD) KEZELÉS ---
|
||||
|
||||
def create_repo_project(title, board_type="kanban", description=""):
|
||||
"""Create a new project board in the repository."""
|
||||
payload = {
|
||||
"title": title,
|
||||
"board_type": board_type, # "kanban" or "basic"
|
||||
"description": description
|
||||
}
|
||||
res = requests.post(f"{BASE_URL}/repos/{OWNER}/{REPO}/projects", headers=HEADERS, json=payload)
|
||||
if res.status_code == 201:
|
||||
project_id = res.json()['id']
|
||||
print(f"✅ Projekt sikeresen létrehozva: '{title}' (ID: {project_id})")
|
||||
return project_id
|
||||
else:
|
||||
print(f"❌ Hiba a projekt létrehozásakor: {res.status_code} - {res.text}")
|
||||
return None
|
||||
|
||||
def list_repo_projects():
|
||||
"""List all projects in the repository."""
|
||||
projects = fetch_all_pages(f"/repos/{OWNER}/{REPO}/projects")
|
||||
print(f"\n{'ID':<5} | {'Projekt Címe':<40} | {'Típus'}")
|
||||
print("-" * 65)
|
||||
for proj in projects:
|
||||
print(f"#{proj['id']:<4} | {proj['title'][:40]:<40} | {proj.get('board_type', 'unknown')}")
|
||||
|
||||
def create_project_board(project_id, title):
|
||||
"""Create a column (board) within a project."""
|
||||
res = requests.post(f"{BASE_URL}/repos/{OWNER}/{REPO}/projects/{project_id}/columns", headers=HEADERS, json={"title": title})
|
||||
if res.status_code == 201:
|
||||
column_id = res.json()['id']
|
||||
print(f"✅ Projekt oszlop sikeresen létrehozva: '{title}' (ID: {column_id})")
|
||||
return column_id
|
||||
else:
|
||||
print(f"❌ Hiba az oszlop létrehozásakor: {res.status_code} - {res.text}")
|
||||
return None
|
||||
|
||||
# --- KÁRTYA (ISSUE) KEZELÉS ---
|
||||
|
||||
@@ -222,6 +266,9 @@ if __name__ == "__main__":
|
||||
print(" list closed - Lezárt kártyák listázása")
|
||||
print(" ms list - Mérföldkövek listázása")
|
||||
print(" ms create \"Név\" - Új mérföldkő létrehozása")
|
||||
print(" project list - Projekt táblák listázása")
|
||||
print(" project create \"Cím\" [board_type] [description] - Új projekt létrehozása")
|
||||
print(" board create <project_id> \"Oszlop neve\" - Új oszlop létrehozása projektben")
|
||||
print(" create \"Cím\" \"Leírás\" [Mérföldkő] [Címkék...] [--due YYYY-MM-DD] [--assign username]")
|
||||
print(" start <id> - Munka megkezdése")
|
||||
print(" finish <id> [msg] - Munka lezárása")
|
||||
@@ -264,6 +311,20 @@ if __name__ == "__main__":
|
||||
create_milestone(args[2], args[3] if len(args) > 3 else "", due_date)
|
||||
else:
|
||||
list_milestones()
|
||||
|
||||
elif action == "project":
|
||||
if len(args) > 1 and args[1].lower() == "create":
|
||||
title = args[2] if len(args) > 2 else "New Project"
|
||||
board_type = args[3] if len(args) > 3 else "kanban"
|
||||
description = args[4] if len(args) > 4 else ""
|
||||
create_repo_project(title, board_type, description)
|
||||
else:
|
||||
list_repo_projects()
|
||||
|
||||
elif action == "board" and len(args) > 2 and args[1].lower() == "create":
|
||||
project_id = args[2]
|
||||
column_title = args[3] if len(args) > 3 else "New Column"
|
||||
create_project_board(project_id, column_title)
|
||||
|
||||
elif action == "start" and len(args) > 1:
|
||||
start_issue(args[1])
|
||||
|
||||
Reference in New Issue
Block a user