Use plugin overrides to customize plugin behavior without editing vendor/*.
Source checkout default lookup:
<repo_root>/plugin-overrides<executable_dir>/plugin-overrides- packaged paths
Installed binary lookup:
<prefix>/share/openusage-cli/plugin-overrides/usr/share/openusage-cli/plugin-overrides
For plugin id <id>, first match wins:
<id>.js<id>.override.js<id>/override.js
Override scripts run after plugin code and get globalThis.__openusage_override:
pluginIdoriginalProbe(ctx)replaceProbe((ctx, originalProbe) => ...)wrapProbe((ctx, currentProbe, originalProbe) => ...)resetProbe()
Example wrapper:
// plugin-overrides/codex.js
globalThis.__openusage_override.wrapProbe(function (ctx, currentProbe) {
return currentProbe(ctx)
})You can patch non-exported plugin internals before eval by defining globalThis.__openusage_ast_patch:
globalThis.__openusage_ast_patch = {
functions: [
{ target: "loadAuth", with: "patchLoadAuth", mode: "wrap" },
{ target: "saveAuth", with: "patchSaveAuth", mode: "wrap" },
],
}
function patchLoadAuth(original, ctx) {
return original(ctx)
}
function patchSaveAuth(original, ctx, authState) {
return original(ctx, authState)
}When patching is applied, original functions are renamed to __openusage_original_<target>.