( targets: readonly AgentTarget[], location: Location, )
| 329 | * across every target unconditionally. |
| 330 | */ |
| 331 | export function uninstallTargets( |
| 332 | targets: readonly AgentTarget[], |
| 333 | location: Location, |
| 334 | ): UninstallReport[] { |
| 335 | return targets.map((target) => { |
| 336 | if (!target.supportsLocation(location)) { |
| 337 | const only: Location = location === 'local' ? 'global' : 'local'; |
| 338 | return { |
| 339 | id: target.id, |
| 340 | displayName: target.displayName, |
| 341 | status: 'unsupported' as const, |
| 342 | removedPaths: [], |
| 343 | notes: [`no ${location} config — this agent is ${only}-only`], |
| 344 | }; |
| 345 | } |
| 346 | const result = target.uninstall(location); |
| 347 | const removedPaths = result.files |
| 348 | .filter((f) => f.action === 'removed') |
| 349 | .map((f) => f.path); |
| 350 | return { |
| 351 | id: target.id, |
| 352 | displayName: target.displayName, |
| 353 | status: removedPaths.length > 0 ? ('removed' as const) : ('not-configured' as const), |
| 354 | removedPaths, |
| 355 | notes: result.notes ?? [], |
| 356 | }; |
| 357 | }); |
| 358 | } |
| 359 | |
| 360 | /** |
| 361 | * Interactive uninstaller — the inverse of `runInstallerWithOptions`. |
no test coverage detected