#!/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

shell - private built-in command wrapper for Developer Dashboard

=head1 SYNOPSIS

  dashboard shell ...

=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 shell>, which prints the shell bootstrap snippet for bash, zsh, POSIX sh, PowerShell, or pwsh. It is the CLI surface for shell integration features such as C<cdr>, C<d2>, C<which_dir>, prompt wiring, and live tab completion for C<dashboard> and C<d2>.

=head1 WHY IT EXISTS

It exists because shell bootstrap generation is a built-in dashboard feature, but the generated code should come from the private helper runtime instead of from handwritten shell fragments in the public entrypoint.

=head1 WHEN TO USE

Use this file when changing supported shell names, generated bootstrap content, or the handoff into the shared shell-generation logic.

=head1 HOW TO USE

Users run C<dashboard shell bash>, C<dashboard shell zsh>, C<dashboard shell sh>, or the PowerShell variants, then evaluate the printed snippet in their shell startup flow. The generated snippet exposes C<d2> as a short shell shortcut for C<dashboard> and wires shell-native completion back into C<dashboard complete>.

=head1 WHAT USES IT

It is used by developers integrating the dashboard into their shell prompt and navigation flow, by shell smoke tests, and by docs showing how to enable C<cdr>, C<d2>, prompt rendering, and live command completion.

=head1 EXAMPLES

Example 1:

  dashboard shell bash

Run the public built-in command path that stages or re-enters this helper.

Example 2:

  ~/.developer-dashboard/cli/dd/shell --help

Inspect the staged helper directly after C<dashboard init> or helper extraction has populated the home runtime.

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
