From bef3cc7dd95745a5724d3569e45fe7be4aba02ee Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 24 Mar 2026 17:44:37 +0200 Subject: ask: add --json flag for machine-readable output List, ready, all, info, and urgency commands now output JSON arrays when --json is passed. This fixes pi agent-plan-mode extension which expects JSON from ask but was getting human-readable tables. Amp-Thread-ID: https://ampcode.com/threads/T-019d207c-b8e2-748d-af52-dd8f84fb2b32 Co-authored-by: Amp --- internal/askcli/command_info_add.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'internal/askcli/command_info_add.go') diff --git a/internal/askcli/command_info_add.go b/internal/askcli/command_info_add.go index 2680163..025b104 100644 --- a/internal/askcli/command_info_add.go +++ b/internal/askcli/command_info_add.go @@ -3,6 +3,8 @@ package askcli import ( "bytes" "context" + "encoding/json" + "fmt" "io" "strings" ) @@ -27,7 +29,17 @@ func (d Dispatcher) handleInfo(ctx context.Context, args []string, stdout, stder io.WriteString(stderr, "error: task not found\n") return 1, nil } - io.WriteString(stdout, FormatTaskInfo(tasks[0])) + if d.jsonOutput { + data, err := json.Marshal(tasks) + if err != nil { + fmt.Fprintf(stderr, "error: failed to marshal JSON: %v\n", err) + return 1, nil + } + stdout.Write(data) + io.WriteString(stdout, "\n") + } else { + io.WriteString(stdout, FormatTaskInfo(tasks[0])) + } return 0, nil } -- cgit v1.2.3