NAME
Developer::Dashboard::CLI::API - layered API-key manager for dashboard api
SYNOPSIS
use Developer::Dashboard::CLI::API qw();
Developer::Dashboard::CLI::API::run_api_command( args => \@ARGV );
DESCRIPTION
This module powers the built-in dashboard api command. It manages the deepest writable config/api.json layer while listing the effective merged registry through DD-OOP-LAYERS.
METHODS
run_api_command
Dispatch the public dashboard api command.
PURPOSE
This module gives the dashboard a focused CLI for machine-auth API keys and their saved /ajax/... route allowlists. It owns the writable-layer update logic, including child-layer tombstones that can mask inherited API groups.
WHY IT EXISTS
It exists because the web backend now consumes layered config/api.json files, but operators still need a safe command surface that updates the right layer without hand-editing JSON and without breaking OOP inheritance rules.
WHEN TO USE
Use this file when changing dashboard api syntax, writable-layer update rules, API-key hashing behavior, or table and JSON output for API administration.
HOW TO USE
Call run_api_command(args => \@ARGV) from the staged helper. The module defaults dashboard api to ls, supports add and rm, hashes raw secrets from either --secret or --maybe-secret with SHA-256 before persistence, accepts repeated --route flags on add, and writes only to the deepest participating runtime layer under config/api.json.
WHAT USES IT
It is used by the staged private api helper, by CLI smoke tests, by module coverage tests, and by operators who need to manage saved Ajax machine-auth allowlists from the shell.
EXAMPLES
Example 1:
dashboard api
List the effective merged API registry as a table.
Example 2:
dashboard api add --key ci-bot --secret bot-secret --route /ajax/health
Create or update one writable-layer API key and allow it to call one saved Ajax route.
Example 3:
dashboard api rm --key ci-bot --route /ajax/health
Remove one route from the effective API group while preserving the current secret digest.
Example 4:
prove -lv t/05-cli-smoke.t t/15-cli-module-coverage.t
Rerun the focused CLI and module regression tests after changing this helper.