Skip to content

JordanGunn/nunchuck / skills/task/task-close

task-close

Verified

Close a task by setting state to closed, recording close_reason and closed_at. Recomputes intent hash and clears `.tasks/.active` if it pointed to this task.

scripts/include/task_close_cli.py

View on GitHub
#!/usr/bin/env python3
"""Task Close CLI - Close a task."""

import argparse
import sys

from task_hash import compute_intent_hash
from task_parse import (
    get_task_path,
    parse_task_file,
    read_active_task,
    serialize_task,
    write_active_task,
)
from task_time import now_utc, to_rfc3339


def cmd_close(args: argparse.Namespace) -> int:
    """Close a task."""
    task_id = args.id
    task_path = get_task_path(task_id)
    
    if not task_path.exists():
        print(f"error: task '{task_id}' not found", file=sys.stderr)
        return 1
    
    fm, body = parse_task_file(task_path)
    
    if fm.get("state") == "closed":
        print(f"error: task '{task_id}' is already closed", file=sys.stderr)
        return 1
    
    now = to_rfc3339(now_utc())
    
    fm["state"] = "closed"
    fm["close_reason"] = args.reason
    fm["closed_at"] = now
    fm["updated_at"] = now
    
    content = serialize_task(fm, body)
    intent_hash = compute_intent_hash(content)
    fm["intent_hash"] = intent_hash
    
    final_content = serialize_task(fm, body)
    task_path.write_text(final_content, encoding="utf-8")
    
    print(f"closed: {task_id} ({args.reason})")
    
    active_id = read_active_task()
    if active_id == task_id:
        write_active_task(None)
        print("cleared: .tasks/.active")
    
    return 0


def main() -> int:
    parser = argparse.ArgumentParser(prog="task-close", description="Close a task")
    parser.add_argument("id", help="Task ID to close")
    parser.add_argument("--reason", choices=["completed", "abandoned"], required=True)
    
    args = parser.parse_args()
    return cmd_close(args)


if __name__ == "__main__":
    sys.exit(main())
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall