#!/usr/bin/env perl

use strict;
use warnings;

use File::Basename qw(basename);
use File::Spec;
use FindBin qw($Bin);

my $command = basename($0);
my $core = File::Spec->catfile( $Bin, '_dashboard-core' );
exec { $^X } $^X, $core, $command, @ARGV;
die "Unable to exec $core for $command: $!";

__END__

=pod

=head1 NAME

ask - private built-in command wrapper for Developer Dashboard

=head1 SYNOPSIS

  dashboard ask ...

=head1 DESCRIPTION

This private helper is staged under F<~/.developer-dashboard/cli/dd/> so the
public C<dashboard> entrypoint can stay a thin switchboard.

=for comment FULL-POD-DOC START

=head1 PURPOSE

This staged helper exposes C<dashboard ask> so an operator can put a question to
an AI backend straight from the dashboard shell and get a plain-text answer,
with the running conversation remembered per workspace.

=head1 WHY IT EXISTS

It exists because the ask command needs a uniform surface over several assistant
backends -- the Anthropic API, the local C<claude> CLI, and the C<codex>,
C<copilot>, and C<gemini> command-line tools -- but the public switchboard should
only dispatch to a staged helper instead of embedding backend-invocation logic
directly in C<bin/dashboard>.

=head1 WHEN TO USE

Use this file when changing how the C<dashboard ask> command is routed into the
private runtime, or when the staged wrapper for the ask surface needs adjusting.

=head1 HOW TO USE

Users run C<dashboard ask "question">, optionally selecting a backend with
C<--codex>, C<--copilot>, or C<--gemini> (default C<--claude>), attaching files
with C<--file>, or starting a fresh conversation with C<--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.

=head1 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.

=head1 EXAMPLES

Example 1:

  dashboard 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:

  dashboard 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.

=for comment FULL-POD-DOC END

=cut
