Signed-off-by: Max <ai-agent@topdoglabs.com>
This commit is contained in:
parent
5dcac7c9e6
commit
51ee798148
@ -49,7 +49,7 @@ Authenticate once:
|
|||||||
## `task.sh`
|
## `task.sh`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./task.sh list [status] [--status <v>] [--priority <v>] [--project <name-or-id>] [--assignee <name-or-id>] [--type <v>] [--limit <n>] [--json]
|
./task.sh list [status] [--status <v|v1,v2,...>] [--priority <v>] [--project <name-or-id>] [--assignee <name-or-id>] [--type <v>] [--limit <n>] [--json]
|
||||||
./task.sh get <task-id>
|
./task.sh get <task-id>
|
||||||
./task.sh current-sprint
|
./task.sh current-sprint
|
||||||
./task.sh create --title "<title>" [--description "..."] [--type <task|bug|research|plan|idea>] [--status <status>] [--priority <priority>] [--project <name-or-id>] [--sprint <name-or-id|current>] [--assignee <name-or-id>] [--due-date YYYY-MM-DD] [--tags "a,b"] [--comments "..."]
|
./task.sh create --title "<title>" [--description "..."] [--type <task|bug|research|plan|idea>] [--status <status>] [--priority <priority>] [--project <name-or-id>] [--sprint <name-or-id|current>] [--assignee <name-or-id>] [--due-date YYYY-MM-DD] [--tags "a,b"] [--comments "..."]
|
||||||
@ -64,6 +64,8 @@ Notes:
|
|||||||
|
|
||||||
- `--interactive` is not supported in passthrough mode.
|
- `--interactive` is not supported in passthrough mode.
|
||||||
- `--auto-create` is not supported in passthrough mode.
|
- `--auto-create` is not supported in passthrough mode.
|
||||||
|
- `task.sh list` requests `GET /api/tasks?scope=active-sprint` and only returns tasks in the current sprint.
|
||||||
|
- If there is no current sprint, `task.sh list --json` returns `[]`.
|
||||||
|
|
||||||
Bulk JSON format:
|
Bulk JSON format:
|
||||||
|
|
||||||
|
|||||||
@ -224,13 +224,16 @@ list_tasks() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
local response
|
local response
|
||||||
response=$(api_call GET "/tasks?scope=all")
|
response=$(api_call GET "/tasks?scope=active-sprint")
|
||||||
|
|
||||||
local tasks
|
local tasks
|
||||||
tasks=$(echo "$response" | jq '.tasks')
|
tasks=$(echo "$response" | jq '.tasks')
|
||||||
|
|
||||||
if [[ -n "$status_filter" ]]; then
|
if [[ -n "$status_filter" ]]; then
|
||||||
tasks=$(echo "$tasks" | jq --arg v "$status_filter" 'map(select(.status == $v))')
|
tasks=$(echo "$tasks" | jq --arg v "$status_filter" '
|
||||||
|
($v | split(",") | map(gsub("^\\s+|\\s+$"; "")) | map(select(length > 0))) as $statuses
|
||||||
|
| map(select(.status as $s | ($statuses | index($s))))
|
||||||
|
')
|
||||||
fi
|
fi
|
||||||
if [[ -n "$priority_filter" ]]; then
|
if [[ -n "$priority_filter" ]]; then
|
||||||
tasks=$(echo "$tasks" | jq --arg v "$priority_filter" 'map(select(.priority == $v))')
|
tasks=$(echo "$tasks" | jq --arg v "$priority_filter" 'map(select(.priority == $v))')
|
||||||
@ -259,6 +262,13 @@ list_tasks() {
|
|||||||
|
|
||||||
local count
|
local count
|
||||||
count=$(echo "$tasks" | jq 'length')
|
count=$(echo "$tasks" | jq 'length')
|
||||||
|
if [[ "$count" -eq 0 ]]; then
|
||||||
|
local current_sprint_id
|
||||||
|
current_sprint_id="$(get_current_sprint 2>/dev/null || true)"
|
||||||
|
if [[ -z "$current_sprint_id" ]]; then
|
||||||
|
log_warning "No current sprint found. Returning 0 tasks."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
log_success "Found $count task(s)"
|
log_success "Found $count task(s)"
|
||||||
|
|
||||||
printf "%-36s %-34s %-12s %-10s\n" "ID" "TITLE" "STATUS" "PRIORITY"
|
printf "%-36s %-34s %-12s %-10s\n" "ID" "TITLE" "STATUS" "PRIORITY"
|
||||||
|
|||||||
@ -128,7 +128,7 @@ case "${method} ${url}" in
|
|||||||
respond '{"success":true}' 200
|
respond '{"success":true}' 200
|
||||||
;;
|
;;
|
||||||
"GET http://localhost:3000/api/tasks"|\
|
"GET http://localhost:3000/api/tasks"|\
|
||||||
"GET http://localhost:3000/api/tasks?scope=all")
|
"GET http://localhost:3000/api/tasks?scope=active-sprint")
|
||||||
respond '{"tasks":[{"id":"t1","title":"Demo Task","status":"open","priority":"medium","type":"task","projectId":"p1","assigneeId":"u1","sprintId":"s1","comments":[],"tags":[],"attachments":[]}]}' 200
|
respond '{"tasks":[{"id":"t1","title":"Demo Task","status":"open","priority":"medium","type":"task","projectId":"p1","assigneeId":"u1","sprintId":"s1","comments":[],"tags":[],"attachments":[]}]}' 200
|
||||||
;;
|
;;
|
||||||
"GET http://localhost:3000/api/tasks?taskId=t1&include=detail")
|
"GET http://localhost:3000/api/tasks?taskId=t1&include=detail")
|
||||||
@ -186,6 +186,12 @@ cat > "$BULK_FILE" <<'BULK_EOF'
|
|||||||
BULK_EOF
|
BULK_EOF
|
||||||
|
|
||||||
"$ROOT_DIR/scripts/task.sh" list --json >/dev/null
|
"$ROOT_DIR/scripts/task.sh" list --json >/dev/null
|
||||||
|
task_csv_status_json=$("$ROOT_DIR/scripts/task.sh" list --status open,todo,in-progress --json)
|
||||||
|
if [[ "$(echo "$task_csv_status_json" | jq 'length')" -ne 1 ]]; then
|
||||||
|
echo "Expected comma-separated --status filter to match task list output" >&2
|
||||||
|
echo "$task_csv_status_json" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
"$ROOT_DIR/scripts/task.sh" get t1 >/dev/null
|
"$ROOT_DIR/scripts/task.sh" get t1 >/dev/null
|
||||||
"$ROOT_DIR/scripts/task.sh" current-sprint >/dev/null
|
"$ROOT_DIR/scripts/task.sh" current-sprint >/dev/null
|
||||||
"$ROOT_DIR/scripts/task.sh" create --title "API Task" --project "Proj" --assignee "Max" --sprint current --status todo --priority high >/dev/null
|
"$ROOT_DIR/scripts/task.sh" create --title "API Task" --project "Proj" --assignee "Max" --sprint current --status todo --priority high >/dev/null
|
||||||
@ -260,7 +266,7 @@ assert_log_contains "POST http://localhost:3000/api/sprints/close"
|
|||||||
assert_log_contains "DELETE http://localhost:3000/api/sprints"
|
assert_log_contains "DELETE http://localhost:3000/api/sprints"
|
||||||
|
|
||||||
assert_log_contains "GET http://localhost:3000/api/tasks"
|
assert_log_contains "GET http://localhost:3000/api/tasks"
|
||||||
assert_log_contains "GET http://localhost:3000/api/tasks?scope=all"
|
assert_log_contains "GET http://localhost:3000/api/tasks?scope=active-sprint"
|
||||||
assert_log_contains "GET http://localhost:3000/api/tasks?taskId=t1&include=detail"
|
assert_log_contains "GET http://localhost:3000/api/tasks?taskId=t1&include=detail"
|
||||||
assert_log_contains "POST http://localhost:3000/api/tasks"
|
assert_log_contains "POST http://localhost:3000/api/tasks"
|
||||||
assert_log_contains "DELETE http://localhost:3000/api/tasks"
|
assert_log_contains "DELETE http://localhost:3000/api/tasks"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user