NAME

Developer::Dashboard::CLI::Ask - ask an AI backend from the dashboard CLI

SYNOPSIS

use Developer::Dashboard::CLI::Ask qw();
Developer::Dashboard::CLI::Ask::run_ask( args => \@ARGV );

DESCRIPTION

This module powers the built-in dashboard ask command. It sends a question to a selected AI backend and keeps a per-workspace conversation transcript so follow-up questions carry context.

METHODS

run_ask

Run one dashboard ask turn and return a process exit code.

PURPOSE

This module lets an operator ask a coding assistant a question straight from the dashboard shell and get a plain-text answer, while the dashboard remembers the running conversation per workspace so a later dashboard ask continues the same thread instead of starting over.

WHY IT EXISTS

It exists so the dashboard can offer one uniform ask surface over several assistant backends -- the direct Anthropic API, the local claude CLI, and the codex, copilot, and gemini command-line tools -- without the operator having to remember each tool's non-interactive invocation, sandbox flags, or attachment syntax. Routing every backend through one command also lets the dashboard enforce a safe read-only invocation and keep a shared transcript.

WHEN TO USE

Use this file when changing dashboard ask syntax, adding or adjusting an assistant backend, changing how the Anthropic API request is built, changing how attachments are inlined or encoded, or changing where and how the per-workspace conversation transcript is stored.

HOW TO USE

Call run_ask(args => \@ARGV) from the staged helper. The parser accepts a single backend flag (--claude, the default, or --codex, --copilot, --gemini), an optional --model, repeatable --file attachments, --new to start a fresh conversation, and --no-memory to skip the transcript for one turn. The chosen backend becomes sticky for the workspace. The claude backend prefers the Anthropic API when a key resolves from ANTHROPIC_API_KEY or the claude config domain, and otherwise falls back to the local claude CLI. The transcript is stored under the runtime state root keyed by WORKSPACE_REF (or the active project root) and secured to owner-only permissions.

WHAT USES IT

It is used by the staged private ask helper that hands the built-in ask command to the shared runtime, by CLI smoke tests, and by module coverage tests.

EXAMPLES

Example 1:

dashboard ask "How do I list collectors?"

Ask the default claude backend and print a plain-text answer, remembering the turn for this workspace.

Example 2:

dashboard ask --codex "Explain this stack trace" --file trace.txt

Switch the workspace to the codex backend (sticky) and inline a text attachment into the question.

Example 3:

dashboard ask --new --model claude-sonnet-5 "Start over: summarize the repo"

Start a fresh conversation for this workspace and override the model for the turn.

Example 4:

prove -lv t/48-ask.t

Rerun the focused ask regression tests after changing this module.