Commit 3c71159
fix: normalize oclif v2 plugin hooks for v4 compatibility (#922)
* fix: normalize oclif v2 plugin hooks for v4 compatibility
When the global aio-cli (oclif v2) runs commands from this plugin
(oclif v4), v4's Config.load re-uses the v2 Plugin objects as-is.
Those objects store hooks as plain string arrays, but v4's runHook
expects {identifier, target} objects — causing hook.target to be
undefined and crashing path.extname() with ERR_INVALID_ARG_TYPE.
Normalize all plugin hooks to v4 format once in BaseCommand.init()
so every command that calls this.config.runHook works correctly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* test: add coverage for oclif v2 hook normalization in BaseCommand.init
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: normalize oclif v2 plugin hooks for v4 compatibility
When the global aio-cli (oclif v2) runs commands from this plugin
(oclif v4), v4's Config.load re-uses the v2 Plugin objects as-is.
Those objects store hooks as plain string arrays, but v4's runHook
expects {identifier, target} objects — causing hook.target to be
undefined and crashing path.extname() with ERR_INVALID_ARG_TYPE.
Normalize all plugin hooks to v4 format in BaseCommand.init(), but
only when string hooks are actually present to avoid unnecessary
mutation of already-normalized plugin objects.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: normalize oclif v2 plugin hooks for v4 compatibility
When the global aio-cli (oclif v2) runs commands from this plugin
(oclif v4), v4's Config.load re-uses the v2 Plugin objects as-is.
Those objects store hooks as plain string arrays, but v4's runHook
expects {identifier, target} objects — causing hook.target to be
undefined and crashing path.extname() with ERR_INVALID_ARG_TYPE.
Normalize all plugin hooks to v4 format in BaseCommand.init(), but
only when string hooks are actually present to avoid unnecessary
mutation of already-normalized plugin objects. Uses getPluginsList()
if available, falling back to this.config.plugins Map.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix lint issues
* Update src/BaseCommand.js
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Revert "Update src/BaseCommand.js"
This reverts commit cab6c55.
* fix: normalize oclif v2 plugin hooks for v4 compatibility
When the global aio-cli (oclif v2) runs commands from this plugin
(oclif v4), v4's Config.load re-uses the v2 Plugin objects as-is.
Those objects store hooks as plain string arrays, but v4's runHook
expects {identifier, target} objects — causing hook.target to be
undefined and crashing path.extname() with ERR_INVALID_ARG_TYPE.
Normalize all plugin hooks to v4 format in BaseCommand.init(), but
only when string hooks are actually present to avoid unnecessary
mutation of already-normalized plugin objects. Uses getPluginsList()
if available, falling back to this.config.plugins Map. Wraps
assignment in try/catch to handle frozen plugin hook objects.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>1 parent 7939e90 commit 3c71159
3 files changed
Lines changed: 101 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
43 | 68 | | |
44 | 69 | | |
45 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
291 | 366 | | |
292 | 367 | | |
293 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
0 commit comments