Define and enforce normalization rules for all user/client-facing inputs (CLI flags, request fields, option keys) so matching behavior is consistent with the documented interface contract—then harden implementations against dependency/API drift.
Apply:
Example (case-insensitive option matching):
async function formatOptionsList(moduleCode, discovered) {
const needle = moduleCode ? moduleCode.toLowerCase() : null;
const filtered = needle
? discovered.filter((d) => d.code.toLowerCase() === needle)
: discovered;
// ...render filtered results
}
Example (safe, isolated workaround pattern for UI behavior):
// Mark clearly: workaround for library private behavior; pin dependency version.
const originalIsActionKey = prompt._isActionKey.bind(prompt);
prompt._isActionKey = function (char, key) {
if (key && key.name === 'space') return true; // expected selection behavior
return originalIsActionKey(char, key);
};
// Add a SPACE handler only if needed; ensure no crashes and acceptable fallback.