Developer-Dashboard

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


That prepared state drives indicators. Indicators are the short status records
used by:

- the shell prompt rendered by `d2 ps1`
- the top-right status strip in the web interface
- CLI inspection commands such as `d2 indicator list`

This matters because prompt and browser status should be cheap to render. Instead of re-running a Docker check, VPN probe, or project health command
every time the prompt draws, a collector prepares the answer once and the rest
of the system reads the cached result.

When the status strip or indicator-list command reads indicators, the store
resolves the applicable runtime roots once for that listing and searches those
roots in precedence order. It still reads the indicator files on each request,
so updates and inherited-versus-local overrides remain visible.

During each collector
sync, the store now resolves ordered indicator roots once and passes that
snapshot through all collector comparisons and the final inventory. Decoded
indicator files are cached only for that sync; writes and deletions invalidate
the affected entry, and a later request rereads disk state. A Docker regression
checks one root resolution and one physical file read per indicator, next-sync
visibility of an external state change, and correct inventory after retirement.

Workspace sessions use a
two-line bottom status block: the first row is the d2 indicator strip
with the trailing date-time segment, and the second row keeps tmux's normal
session and indexed window list. Ordinary tmux sessions keep the normal
inline prompt.

The
workspace workflow seeds a dedicated
`DEVELOPER_DASHBOARD_TMUX_STATUS=1` session flag for that behaviour, and
Developer Dashboard also treats the older `TICKET_REF` session reference as a
fallback signal so older workspace sessions do not keep duplicating indicators in the
inline prompt.

Developer Dashboard updates tmux through session-local runtime
commands instead of editing any user tmux config file or changing unrelated
tmux sessions on the same server. Configured collector indicators now prefer the configured icon in both places,
and when a collector is renamed the old managed indicator is cleaned up
automatically so the prompt and top-right browser strip do not show both the
old and new names at the same time.

Those managed indicator records now also
preserve a newer live collector status during restart/config-sync windows, so
a healthy collector does not flicker back to `missing` after it has already
reported `ok`.

If `indicator.icon` contains Template Toolkit syntax such as `[% a %]`, the
collector runner now treats collector `stdout` as JSON, decodes it through
`JSON::XS`, exposes hash keys as direct template variables plus `data`, and
persists the rendered icon as the live indicator value. Invalid JSON or TT
render failures are explicit collector errors: the collector `stderr` records
the template problem and the indicator stays red instead of silently falling
back.

### System menu indicator configuration

`Developer::Dashboard::SystemMenu->items_for_platform` projects
configured indicator names and their current icons for the `macos`,
`windows`, or `ubuntu` selector. Each platform selector is opt-in; a missing
or false value disables that item. Invalid values for any supported selector
are rejected even when the current host is another platform. The projection
preserves configuration order and does not start a native menu by itself. The
private `web-foreground` runtime supplies merged configuration and the shared
indicator store to `Developer::Dashboard::SystemMenu::Runner`. The runner
starts the menu only when an indicator is enabled for the current host and
keeps the helper active for the foreground web-service lifetime. It stops and
joins the GoRoutine worker when the service returns or fails; disabled or
unsupported platform settings do not load the native adapter. The existing
`d2 ps1` output remains unchanged.

The native System::Menu adapter starts the platform helper in a controlled
GoRoutine worker. On Ubuntu, the helper uses Ayatana AppIndicator3 and a GTK
menu; rendered status icons are kept in a private temporary icon-theme
directory and removed when the helper shuts down. Building from source
requires the Ayatana AppIndicator3 and GTK3 development packages; runtime
requires a desktop session with AppIndicator support. The helper reports a
clear error when no desktop session is available. Source and compile tests do
not prove that a desktop shell visibly displayed the menu; hosted platform
verification is required for each supported operating system. Linux CI and
the published Docker image install those native development packages before
building the helper. The macOS helper uses ARC and treats deprecated AppKit APIs
as errors. The Windows full-suite job installs Test::Harness without
Devel::Cover, which does not configure on its supported Windows runner; the
four-metric coverage gate remains on Linux.

If optional watcher setup fails and watcher shutdown also fails, the dispatcher
reports the close failure even when that watcher has no `last_error` method.

## Why It Works As A Developer Home

The pieces are designed to reinforce each other:

- pages give you a browser home for links, notes, forms, and actions
- collectors prepare state for indicators and prompt rendering
- indicators summarise that state in both the browser and the shell
- path aliases, open-file helpers, and data query commands shorten the jump from
I know what I need to I am at the file or value now
- Docker Compose helpers keep recurring container workflows behind the same
`d2` entrypoint

That combination makes the dashboard useful as a real daily base instead of
just another utility script.

## Works Across Languages

Developer Dashboard supports mixed-language teams and polyglot repositories.
It provides common navigation, status, and repeatable workflows across a
project, regardless of the language used for its application code.

- a local browser home
- repeatable health checks and status indicators
- path shortcuts and file-opening helpers
- JSON, YAML, TOML, or properties inspection from the CLI
- a consistent Docker Compose wrapper

File helpers can locate source files, structured data, and project-local
container configuration alongside the browser and prompt tools.

Project-specific behaviour is added through configuration, saved pages, and
user CLI extensions.

# MODULE NAMESPACING

All project modules are scoped under the `Developer::Dashboard::` namespace
to prevent pollution of the CPAN ecosystem. Core helper modules are available
under this namespace:

- Developer::Dashboard::File

    File I/O helpers with alias support for older bookmark compatibility.

README.md  view on Meta::CPAN

    prove -lr t

The maintained end-to-end scenario plan defines expected routes, inputs, and
outputs. Hosted workflows provide additional platform checks and packaging
verification.

Tests that observe managed collector child output must wait for the asynchronous
log event with a bounded wall-clock timeout, then keep an explicit assertion
that the expected message arrived. In `t/07-core-units.t`, the wait belongs in
the `broken-loop` test before its child is stopped and the log is asserted; do
not put it in a neighboring collector test. This avoids assuming one fixed
sleep is enough on every hosted runner.

For local GitHub Actions runs executed through `act`, use:

    d2 github-workflow --container-options "--init"

The init process reaps orphaned child processes so process-group cleanup tests
observe the expected exit behavior. This option does not skip tests or change
their assertions.

Pull requests are checked by the shared Jenkins job `D2/testing-v1`, which
runs the full suite on macOS arm64, Linux amd64, Linux arm64, and Windows
amd64. Linux and macOS install `Devel::Cover` into the local
dependency tree and export that tree through `PERL5LIB` before running the
complete suite. Coverage-gate regression tests launch child Perl processes, so
those processes must resolve the same coverage serializer and project
dependencies as the parent test process.

When a MakeMaker build has created `blib/arch`, dashboard-managed Perl
environments put that directory ahead of installed Perl libraries. This keeps
source modules paired with the checkout's freshly built XS extension instead
of loading an older installed binary that may not provide the current XSUB
API. The coverage gate also includes `blib/arch` in its child-process
`PERL5LIB`, while the test suite continues loading its Perl modules from
`lib/`.

`Devel::Cover` is declared as a test prerequisite in the distribution
metadata. This lets a clean release-tarball test environment run its coverage
gate tests without an undeclared manual install. It is not an end-user runtime
dependency.

On macOS ARM64, the same workflow installs Homebrew `openssl@3`, verifies that
its headers and `libssl.dylib` are present for ARM64, and exports the formula
prefix as `OPENSSL_PREFIX` before building `Net::SSLeay`. This makes the
OpenSSL selection explicit for the native TLS dependency used by
`IO::Socket::SSL` and `LWP::Protocol::https`. The runner log now includes
verbose diagnostics from this focused `Net::SSLeay` build if it fails.

Each platform stage builds the Dashboard XS extension before running the
coverage suite. Unix build and coverage steps use Bash; Windows amd64 uses
PowerShell, and Windows arm64 uses the native CLANGARM64 Perl and toolchain. The
Windows jobs check their runner architectures and fail if the native target is
not available; they do not report skipped native tests as a pass.

Checkout dependencies are installed into `local/lib/perl5`. The Linux
workflow adds that directory to `PERL5LIB` before invoking `perl Makefile.PL`,
because the configure-time `File::ShareDir::Install` dependency is needed
before MakeMaker can create `blib`. Linux also installs
`libayatana-appindicator3-dev` and `libgtk-3-dev` before building the native
System Menu helper; these provide the pkg-config libraries and headers required
by `native/system_menu_helper_linux.c`. On Linux, `Makefile.PL` checks for
both pkg-config modules. If either is unavailable, it prints a notice and omits
the optional helper target so CPAN testers without desktop headers can still
build and test the distribution; invoking the System Menu without its helper
still fails clearly. Set `DD_REQUIRE_SYSTEM_MENU_HELPER=1` to require the
native helper, as the Linux coverage workflow does. The Windows builds use
Perl's configured path separator when assembling the same local library path.
Workflow regression tests check these setup requirements.

The Linux coverage gate passes `blib/arch` and the local dependency library
through `PERL5LIB` after compiling the extension. It instruments `lib/` rather
than copied `blib/lib` sources. This ensures child Perl processes load the
native extension built by the current checkout and keeps coverage from counting
duplicate source copies.

### Library coverage

Install Devel::Cover into the local development library and run the repository
gate:

    cpanm --no-wget --notest --local-lib-contained ./.perl5 Devel::Cover
    export PERL5LIB="$PWD/.perl5/lib/perl5${PERL5LIB:+:$PERL5LIB}"
    export PATH="$PWD/.perl5/bin:$PATH"
    perl script/coverage-gate

The gate requires 100.0% statement, subroutine, branch, and condition coverage
for `lib/`. Its report disables optional `gcov` output from compiled XS
artefacts: this gate measures Perl modules, while native XS behavior is checked
by functional tests, and extra C-file tables or diagnostics would invalidate
the single-table report parser. The instrumented run also excludes the
repository `t/` tree: test files are not coverage targets, and their dynamic
fixtures can cause Devel::Cover source-map warnings. This does not reduce
coverage because the report is explicitly scoped to `lib/`. The three
GoRoutine ithread tests (`t/231`, `t/237` and `t/238`) run in a separate,
uninstrumented `prove` process because Devel::Cover cannot safely instrument
ithreads. They remain mandatory tests, and a failure in either suite prevents a
coverage verdict. A passing run exits with status `0`. Run one coverage job at
a time on a host.

### Integration and release checks

For an installed-package check in a blank environment, run:

    integration/blank-env/run-host-integration.sh

After building a distribution, check its release metadata and kwalitee with:

    prove -lv t/36-release-kwalitee.t

Security-sensitive changes require the OWASP ASVS 5.0 review and a cross-check
against the OWASP Top 10, alongside repository security checks. The full
contribution and release sequence is documented in the contributor guide.

Push a `vX.XX` tag so the tag-triggered GitHub release workflow runs. It
publishes tarball, checksum, and detached signature assets. The release also
publishes a `.intoto.jsonl` provenance asset; build provenance, not merely a
signature, is required for the Signed-Releases Scorecard check.

Changing `dist.ini` alone does not create a GitHub Release. The pushed tag must
match the distribution version and point at the commit containing that version.
The release workflow runs tests and all-metric coverage before building or
publishing; if either gate fails, the previous successful GitHub Release remains
the latest. Check the tag's workflow run and its first failed step before
retrying.



( run in 0.684 second using v1.01-cache-2.11-cpan-60884a8df76 )