NAME
ask - private built-in command wrapper for Developer Dashboard
SYNOPSIS
d2 ask ...
DESCRIPTION
This private helper is staged under ~/.developer-dashboard/cli/dd/ so the public d2 entrypoint can stay a thin switchboard.
PURPOSE
This staged helper exposes d2 ask so an operator can put a question to an AI backend straight from the d2 shell and get a plain-text answer, with the running conversation remembered per workspace.
WHY IT EXISTS
It exists because the ask command needs a uniform surface over several assistant backends -- the Anthropic API, the local claude CLI, and the codex, copilot, and gemini command-line tools -- but the public switchboard should only dispatch to a staged helper instead of embedding backend-invocation logic directly in bin/d2.
WHEN TO USE
Use this file when changing how the d2 ask command is routed into the private runtime, or when the staged wrapper for the ask surface needs adjusting.
HOW TO USE
Users run d2 ask "question", optionally selecting a backend with --codex, --copilot, or --gemini (default --claude), attaching files with --file, or starting a fresh conversation with --new. The staged helper forwards the raw argv list into the private built-in runtime, which loads the ask CLI module and calls the selected backend.
WHAT USES IT
It is used by operators asking a coding assistant from the shell, by CLI smoke tests, and by staged-helper coverage tests.
EXAMPLES
Example 1:
d2 ask "How do I list collectors?"
Ask the default claude backend and print a plain-text answer through the public built-in command path.
Example 2:
d2 ask --codex "Explain this stack trace" --file trace.txt
Switch the workspace to the codex backend and inline a text attachment.
Example 3:
prove -lv t/05-cli-smoke.t t/30-dashboard-loader.t
Rerun the focused staged-helper and thin-loader tests after changing helper dispatch behavior.
Example 4:
prove -lr t
Verify that the helper still behaves correctly inside the complete repository suite.