forked from coleam00/Linear-Coding-Agent-Harness
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogress.py
More file actions
81 lines (59 loc) · 2.23 KB
/
progress.py
File metadata and controls
81 lines (59 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
"""
Progress Tracking Utilities
===========================
Functions for tracking and displaying progress of the autonomous coding agent.
Progress is tracked via Linear issues, with local state cached in .linear_project.json.
"""
import json
from pathlib import Path
from linear_config import LINEAR_PROJECT_MARKER
def load_linear_project_state(project_dir: Path) -> dict | None:
"""
Load the Linear project state from the marker file.
Args:
project_dir: Directory containing .linear_project.json
Returns:
Project state dict or None if not initialized
"""
marker_file = project_dir / LINEAR_PROJECT_MARKER
if not marker_file.exists():
return None
try:
with open(marker_file, "r") as f:
return json.load(f)
except (json.JSONDecodeError, IOError):
return None
def is_linear_initialized(project_dir: Path) -> bool:
"""
Check if Linear project has been initialized.
Args:
project_dir: Directory to check
Returns:
True if .linear_project.json exists and is valid
"""
state = load_linear_project_state(project_dir)
return state is not None and state.get("initialized", False)
def print_session_header(session_num: int, is_initializer: bool) -> None:
"""Print a formatted header for the session."""
session_type = "INITIALIZER" if is_initializer else "CODING AGENT"
print("\n" + "=" * 70)
print(f" SESSION {session_num}: {session_type}")
print("=" * 70)
print()
def print_progress_summary(project_dir: Path) -> None:
"""
Print a summary of current progress.
Since actual progress is tracked in Linear, this reads the local
state file for cached information. The agent updates Linear directly
and reports progress in session comments.
"""
state = load_linear_project_state(project_dir)
if state is None:
print("\nProgress: Linear project not yet initialized")
return
total = state.get("total_issues", 0)
meta_issue = state.get("meta_issue_id", "unknown")
print(f"\nLinear Project Status:")
print(f" Total issues created: {total}")
print(f" META issue ID: {meta_issue}")
print(f" (Check Linear for current Done/In Progress/Todo counts)")