From 1750c538ffe88d8daa8cf93bfd42ff7f119ee58e Mon Sep 17 00:00:00 2001 From: PeninsulaInd Date: Wed, 15 Apr 2026 12:54:21 -0500 Subject: [PATCH] Post pipeline stage comment on task creation New tasks with a Work Category now get a comment listing all stages, handlers, and the starting stage so the workflow is visible in ClickUp. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/create_clickup_task.py | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/scripts/create_clickup_task.py b/scripts/create_clickup_task.py index 127399b..ff9c61c 100644 --- a/scripts/create_clickup_task.py +++ b/scripts/create_clickup_task.py @@ -22,10 +22,26 @@ sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from dotenv import load_dotenv from cheddahbot.clickup import ClickUpClient +from clickup_runner.skill_map import SKILL_MAP DEFAULT_ASSIGNEE = 10765627 # Bryan Bigari +def _build_stage_comment(category: str) -> str: + """Build a pipeline stages comment from SKILL_MAP for a task type.""" + stages = SKILL_MAP.get(category) + if not stages: + return "" + lines = ["Pipeline stages for %s:" % category] + for i, (stage, route) in enumerate(stages.items(), 1): + handler = route.handler if route.handler != "claude" else "Claude" + lines.append( + " %d. %s (%s) -> %s" % (i, stage, handler, route.next_status) + ) + lines.append('Set Stage to "%s" to start.' % list(stages.keys())[0]) + return "\n".join(lines) + + def _date_to_unix_ms(date_str: str) -> int: """Convert YYYY-MM-DD to Unix milliseconds (noon UTC). @@ -97,6 +113,12 @@ def main(): default="", help="Time estimate (e.g. '2h', '30m', '1h30m')", ) + parser.add_argument( + "--dependency", + action="append", + default=[], + help="Task ID this task is blocked by (repeatable)", + ) args = parser.parse_args() api_token = os.environ.get("CLICKUP_API_TOKEN", "") @@ -158,6 +180,14 @@ def main(): task_id, list_id, "Work Category", args.category ) + # Add dependencies (blocked by) + for dep_id in args.dependency: + if not client.add_dependency(task_id, dep_id): + print( + f"Warning: Failed to add dependency on {dep_id}", + file=sys.stderr, + ) + # Set any additional custom fields for field_name, field_value in custom_fields.items(): ok = client.set_custom_field_smart( @@ -169,6 +199,12 @@ def main(): file=sys.stderr, ) + # Post pipeline stages comment if task type has stages + if args.category: + stage_comment = _build_stage_comment(args.category) + if stage_comment: + client.add_comment(task_id, stage_comment) + print(json.dumps({ "id": task_id, "name": args.name,