NAME

Developer::Dashboard::SkillDispatcher - execute commands from installed skills

SYNOPSIS

use Developer::Dashboard::SkillDispatcher;
my $dispatcher = Developer::Dashboard::SkillDispatcher->new();

my $result = $dispatcher->dispatch('skill-name', 'cmd', 'arg1', 'arg2');
my $hooks = $dispatcher->execute_hooks('skill-name', 'cmd');
my $config = $dispatcher->get_skill_config('skill-name');
my $path = $dispatcher->get_skill_path('skill-name');

DESCRIPTION

Dispatches commands to and manages execution of installed dashboard skills. Handles: - Command execution with isolation - Hook file execution in sorted order - Configuration reading - Skill path resolution - Command output capture

PURPOSE

This module executes installed skill commands and serves skill bookmark routes. It resolves a skill command path, runs any sorted hook files under cli/<command>.d, prepares the isolated skill environment, captures stdout/stderr, and can render bookmarks under /skill/<repo>/bookmarks/... through the main page renderer.

WHY IT EXISTS

It exists because the skill system needs a boundary between skill installation and skill execution. Dispatching commands, hook chaining, isolated environment variables, and bookmark routing all belong in one module instead of being hand-built in the web layer or CLI wrappers.

WHEN TO USE

Use this file when changing skill command execution, hook order, the skill environment contract, or the bookmark route behavior exposed under the /skill/... URL space.

HOW TO USE

Construct it with a skill manager, call dispatch for one command invocation, or call route_response when the web app needs a bookmark response from a skill. Keep skill execution isolation here instead of folding it into generic command code.

WHAT USES IT

It is used by the dashboard skill command, by the skill bookmark web routes, by skill installation flows that later need execution, and by skill-system and web-route regression tests.

EXAMPLES

Example 1:

perl -Ilib -MDeveloper::Dashboard::SkillDispatcher -e 1

Do a direct compile-and-load check against the module from a source checkout.

Example 2:

prove -lv t/19-skill-system.t t/20-skill-web-routes.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.