( targets: readonly AgentTarget[], location: Location, )
| 350 | * across every target unconditionally. |
| 351 | */ |
| 352 | export function uninstallTargets( |
| 353 | targets: readonly AgentTarget[], |
| 354 | location: Location, |
| 355 | ): UninstallReport[] { |
| 356 | return targets.map((target) => { |
| 357 | if (!target.supportsLocation(location)) { |
| 358 | const only: Location = location === 'local' ? 'global' : 'local'; |
| 359 | return { |
| 360 | id: target.id, |
| 361 | displayName: target.displayName, |
| 362 | status: 'unsupported' as const, |
| 363 | removedPaths: [], |
| 364 | notes: [`no ${location} config — this agent is ${only}-only`], |
| 365 | }; |
| 366 | } |
| 367 | const result = target.uninstall(location); |
| 368 | const removedPaths = result.files |
| 369 | .filter((f) => f.action === 'removed') |
| 370 | .map((f) => f.path); |
| 371 | return { |
| 372 | id: target.id, |
| 373 | displayName: target.displayName, |
| 374 | status: removedPaths.length > 0 ? ('removed' as const) : ('not-configured' as const), |
| 375 | removedPaths, |
| 376 | notes: result.notes ?? [], |
| 377 | }; |
| 378 | }); |
| 379 | } |
| 380 | |
| 381 | export type RefreshStatus = 'refreshed' | 'unchanged' | 'not-configured' | 'unsupported'; |
| 382 |
no test coverage detected