Skip to content

Commit 0c63332

Browse files
committed
Show project task summary on take
1 parent 7e5e037 commit 0c63332

4 files changed

Lines changed: 34 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "codexapi"
7-
version = "0.5.13"
7+
version = "0.5.14"
88
description = "Minimal Python API for running the Codex CLI."
99
readme = "README.md"
1010
requires-python = ">=3.8"

src/codexapi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
"task",
1616
"task_result",
1717
]
18-
__version__ = "0.5.13"
18+
__version__ = "0.5.14"

src/codexapi/cli.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ def main(argv=None):
13701370
raise SystemExit("--name is required with --project.")
13711371
if not args.task_args:
13721372
raise SystemExit("task --project requires one or more task files.")
1373-
from .gh_integration import GhTaskRunner
1373+
from .gh_integration import GhTaskRunner, project_url
13741374
from gh_task.errors import TakeError
13751375

13761376
if args.loop:
@@ -1393,6 +1393,11 @@ def main(argv=None):
13931393
)
13941394
time.sleep(_PROJECT_LOOP_SLEEP)
13951395
continue
1396+
if not args.quiet:
1397+
title = task_runner.issue_title or "Untitled issue"
1398+
print(
1399+
f"Task {task_runner.task_name}: {title} on {project_url(task_runner.project)}"
1400+
)
13961401
result = task_runner(progress=not args.quiet)
13971402
if not result.success:
13981403
raise SystemExit(1)
@@ -1409,6 +1414,11 @@ def main(argv=None):
14091414
)
14101415
except TakeError as exc:
14111416
raise SystemExit(str(exc)) from None
1417+
if not args.quiet:
1418+
title = task_runner.issue_title or "Untitled issue"
1419+
print(
1420+
f"Task {task_runner.task_name}: {title} on {project_url(task_runner.project)}"
1421+
)
14121422
result = task_runner(progress=not args.quiet)
14131423
if not result.success:
14141424
raise SystemExit(1)

src/codexapi/gh_integration.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ def _canonical_task_name(path):
2323
return Path(path).stem
2424

2525

26+
def project_url(project):
27+
"""Return a GitHub URL for the Project board."""
28+
owner = project.owner
29+
number = project.number
30+
try:
31+
owner_type = project._get_owner_type()
32+
except Exception:
33+
owner_type = None
34+
if owner_type == "organization":
35+
prefix = "orgs"
36+
elif owner_type == "user":
37+
prefix = "users"
38+
else:
39+
prefix = None
40+
if prefix:
41+
return f"https://github.com/{prefix}/{owner}/projects/{number}"
42+
return f"https://github.com/{owner}/projects/{number}"
43+
44+
2645
def _task_file_map(task_files):
2746
mapping = {}
2847
for path in task_files:
@@ -211,6 +230,8 @@ def __init__(
211230
except Exception:
212231
self.project.release(self.issue)
213232
raise
233+
self.task_name = _canonical_task_name(task_path)
234+
self.issue_title = (self.issue.title or "").strip()
214235
body = self.project.get_issue_body(self.issue)
215236
description = _strip_progress_section(body)
216237
item_text = _format_item_text(self.issue, description)

0 commit comments

Comments
 (0)