NAME

Developer::Dashboard::Platform - platform and shell helpers for Developer Dashboard

SYNOPSIS

use Developer::Dashboard::Platform qw(
  native_shell_name
  shell_command_argv
  command_argv_for_path
);

my $shell = native_shell_name();
my @cmd = shell_command_argv('git status');

DESCRIPTION

This module centralizes the small amount of operating-system and shell awareness needed by Developer Dashboard so prompt integration, command execution, and extension loading can work across Unix-style systems and Windows Strawberry Perl installs.

FUNCTIONS

is_windows, native_shell_name, normalize_shell_name, shell_command_argv, command_in_path, is_runnable_file, resolve_runnable_file, command_argv_for_path, shell_quote_for

Platform and shell helpers used by the CLI and runtime.

is_real_windows

Real-OS Windows detection, immune to the $OS_NAME simulation tests use. Use this for any branch that touches the real Windows filesystem or a Windows-only tool.

passwd_user_name, passwd_home_directory

Guarded passwd database accessors. Windows perl leaves the passwd functions unimplemented and dies when one is called, so both accessors report undef instead of a fatal error whenever the current runtime cannot answer the lookup. Callers use them as one step of an environment-first fallback chain.

effective_mode_octal, windows_acl_is_owner_only, windows_acl_set_owner_only

Windows owner-only permissions through real ACLs. Unix mode bits do not exist on Windows (chmod only toggles the read-only attribute and stat keeps reporting 0777/0666), so the setter replaces the DACL with one full-control ACE for the current user and disables inheritance, the checker reads the DACL back through icacls, and the mode helper reports 0700/0600 from the DACL instead of the meaningless stat bits. On Unix the mode helper is the stat mode unchanged.

PURPOSE

This module owns platform-specific command execution details. It resolves which file is runnable on the current operating system, decides how script paths should be turned into argv arrays, and smooths over Unix versus Windows command launch differences for the CLI and helper layers.

WHY IT EXISTS

It exists because command launch portability is a system concern. The dashboard has many staged helpers, hook scripts, skill commands, and Windows-oriented runners, and they all need one place that understands how to invoke a file correctly on the current host.

WHEN TO USE

Use this file when changing executable resolution, script-extension handling, PowerShell versus pwsh selection, or any bug where a helper runs on one platform but not another.

HOW TO USE

Call resolve_runnable_file, is_runnable_file, or command_argv_for_path before launching a file. Higher-level code should pass the resulting argv into system, exec, or open3 instead of guessing the platform rules itself.

WHAT USES IT

It is used by bin/d2, skill dispatch, hook execution, private helper staging, and platform-specific tests that cover Unix and Windows command launch semantics.

EXAMPLES

Example 1:

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

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

Example 2:

prove -lv t/07-core-units.t t/21-refactor-coverage.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.