Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
/**
* Normalize a provider command to its comparable binary basename.
*
* A toolkit-local twin of `commandBasename` in server/lib/providerModels.js —
* the vendored toolkit may not import out to sibling PortOS modules (see
* ../AGENTS.md), and this rule was previously inlined once per vendor predicate
* inside `internal/`. One copy inside the boundary is unavoidable; two were not.
*
* Strips the directory, lowercases, and drops a Windows `.exe` suffix so a
* provider configured as `/opt/homebrew/bin/agy`, `AGY`, or `cursor-agent.exe`
* still matches the bare name. Deliberately does NOT strip `.cmd`/`.bat`: those
* are npm shim wrappers whose behavior can differ from the native binary, so a
* predicate that wants them must say so.
*
* @param {string|null|undefined} command
* @returns {string} the normalized basename, or '' for a non-string/empty input
*/
export function commandBasename(command) {
if (typeof command !== 'string' || command === '') return '';
return command.split(/[\\/]/).pop().toLowerCase().replace(/\.exe$/, '');
}