NAME
Developer::Dashboard::Prompt - prompt rendering for Developer Dashboard
SYNOPSIS
my $prompt = Developer::Dashboard::Prompt->new(
paths => $paths,
indicators => $indicators,
);
print $prompt->render(jobs => 1);
DESCRIPTION
This module renders the shell prompt from cached indicator state, current directory context, and git metadata. It is designed to stay fast enough for per-prompt execution. The prompt renderer is shared by every generated shell adapter, so branch labels are not shell-specific. Local branch names retain their complete slash-delimited names. A detached HEAD that matches an origin remote-tracking ref displays origin/branch unless the same-named local branch points to the same commit, in which case the redundant prefix is omitted. Other remote names are retained. Loose and packed refs are supported, but symlinked ref paths and packed-ref files are not followed. An unmatched detached HEAD keeps its short commit id.
METHODS
new
Construct a prompt renderer.
render
Return the full prompt string.
PURPOSE
This module renders the dashboard prompt fragment. It reads indicators, collector status, current cwd, job counts, and ticket context, then turns that state into the compact or extended prompt text used by shell bootstraps and prompt refresh commands.
WHY IT EXISTS
It exists because prompt rendering is a product feature with its own ordering and icon rules. Putting that logic in one module keeps bash, zsh, POSIX sh, and PowerShell prompt behavior aligned.
WHEN TO USE
Use this file when changing prompt shape, indicator ordering, icon/status rendering, compact versus extended prompt output, or the prompt command arguments exposed through dashboard ps1.
HOW TO USE
Construct it with the active paths and state stores, then call the prompt-rendering method that matches the requested mode. Shell helper scripts should consume the rendered string rather than rebuilding prompt logic in shell code.
WHAT USES IT
It is used by the dashboard ps1 helper, by generated shell bootstrap functions, by integration smoke runs that verify prompt text, and by prompt-focused regression tests.
EXAMPLES
Example 1:
perl -Ilib -MDeveloper::Dashboard::Prompt -e 1
Do a direct compile-and-load check against the module from a source checkout.
Example 2:
prove -lv t/02-indicator-collector.t
Run the focused regression tests that most directly exercise this module's behavior.
Example 3:
HARNESS_PERL_SWITCHES=-MDevel::Cover prove -lr t
Recheck the module under the repository coverage gate rather than relying on a load-only probe.
Example 4:
prove -lr t
Put any module-level change back through the entire repository suite before release.