( targets: readonly AgentTarget[], location: Location, )
| 415 | * `uninstallTargets`. |
| 416 | */ |
| 417 | export function refreshTargets( |
| 418 | targets: readonly AgentTarget[], |
| 419 | location: Location, |
| 420 | ): RefreshReport[] { |
| 421 | return targets.map((target) => { |
| 422 | const base = { id: target.id, displayName: target.displayName, location }; |
| 423 | if (!target.supportsLocation(location)) { |
| 424 | return { ...base, status: 'unsupported' as const, changedPaths: [] }; |
| 425 | } |
| 426 | if (!target.detect(location).alreadyConfigured) { |
| 427 | return { ...base, status: 'not-configured' as const, changedPaths: [] }; |
| 428 | } |
| 429 | const result = target.install(location, { autoAllow: false, promptHook: undefined }); |
| 430 | const changedPaths = result.files |
| 431 | .filter((f) => f.action === 'created' || f.action === 'updated' || f.action === 'removed') |
| 432 | .map((f) => f.path); |
| 433 | return { |
| 434 | ...base, |
| 435 | status: changedPaths.length > 0 ? ('refreshed' as const) : ('unchanged' as const), |
| 436 | changedPaths, |
| 437 | }; |
| 438 | }); |
| 439 | } |
| 440 | |
| 441 | /** |
| 442 | * Interactive uninstaller — the inverse of `runInstallerWithOptions`. |
no test coverage detected