Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 4.48 KB

tasks-cli.md

File metadata and controls

53 lines (37 loc) · 4.48 KB

Native tasks CLI

Pure-Python CRUD for the native task backend, exposed as cyclopsctl tasks for update-phase agents and debugging. On phased tags, next and list/show phase fields respect gate state in .cyclopsctl/tasks/phases.json — overview in docs/tasks/phase-gates.md, predicate details in docs/tasks/phase-selection.md. Optional cloud executor list/show display is documented in docs/tasks/cloud-cli-display.md.

Commands

cyclopsctl tasks list --project-root .
cyclopsctl tasks list pending --project-root .
cyclopsctl tasks list done --format json --project-root .
cyclopsctl tasks show <id> --format json --project-root .
cyclopsctl tasks next --format json --project-root .
cyclopsctl tasks set-status --id=<id> --status=done --project-root .
cyclopsctl tasks tags --project-root .
cyclopsctl tasks use-tag <name> --project-root .

Shared flags: --project-root (default cwd), --tag (default from .cyclopsctl/tasks/state.json), --format json|plain.

list-only and tags-only flags: --plain-table (fixed-width text instead of Rich; plain format only).

Behavior

Command Logic
list All parent tasks for the tag in a Rich table (ID, title, status, phase, complexity, dependencies), sorted by numeric id; phase column shows — when unset; Executor column appears only when any row in the filtered result has executor set (cloud on marked rows, — on local rows when the column is shown). Queues with no cloud tasks keep the legacy column set — see cloud-cli-display.md
list pending Non-done tasks (same table)
list done Only done tasks (same table)
list <status> Exact status match (in-progress, review, cancelled, blocked, deferred)
list all Same as bare list
next Lowest in-progress task (resumes work a crashed cycle left behind), else lowest pending task that passes task_eligible (docs/tasks/phase-selection.md: dependencies + open phases when phases.json defines the tag). When nothing is eligible, plain output appends Reason: … and JSON carries reason + blocked_task_ids (unsatisfied deps, phase gate waits, caller exclusions, or all-done counts)
show Full task record: JSON (found + task via _show_task_record) or plain fields; plain output adds Phase: … after status when the task has a non-empty phase (TaskShowDetail.phase); when executor is set, plain output adds Executor: cloud, Executor reason: …, Needs repo: yes|no, and Result path: … (default via default_result_path when unset) — local tasks omit those lines (cloud-cli-display.md)
set-status Validates allowed statuses, updates updatedAt (UTC ISO), persists via TaskStore
tags Every tag (phase) with total / done / pending counts; marks the active tag
use-tag Switch the active tag context to an existing tag (validates it exists)

JSON list output includes tasks, tag, and filter. Each task summary may include id, title, status, priority, complexity, dependencies, description, and phase (omitted when unset; _summary_task_dict).

tags JSON output includes activeTag and a tags array (name, total, done, pending, active). use-tag JSON output is {"activeTag": "<name>"}. Tags map one-to-one to PRDs/phases: each launch --prd <file> (or in-place prd.md change) starts a new tag and old phases stay browsable here. See launch-prd-change.md.

JSON shapes use shared parsers in tasks/types.py (parse_list_payload, parse_next_payload, parse_show_detail_payload) for consistent CLI and backend output.

Module

src/cyclopsctl/tasks/cli.py — CRUD helpers, JSON/plain formatters, argparse wiring via add_tasks_subparser().

NativeTaskBackend delegates CRUD to this module with lazy imports inside each method to avoid a circular import chain (backend → native_backend → cli → store → backend).

Tests

tests/test_tasks_cli.py — CLI integration, parser compatibility, dependency-aware and phase-aware next, list/show phase and cloud executor display, exit codes, tag selection (pytest tests/test_tasks_cli.py -k 'list or show or cloud').

tests/test_task_queue_fixes.py — in-progress preference, cancelled deps, empty-result reasons, post-update done reconciliation (loop._reconcile_task_status_after_update: warn + auto-set, or fail under --strict-handover), bootstrap --replace guard, parse/analyze error taxonomy.