# Changelog

All notable changes to pi-automation are documented here.

## [0.2.0] - 2026-08-30

### Added
- **`ui_automation` tool upgrades** (`ui-automation.ts`):
  - New action `click_coords` — simulate a mouse click at absolute screen coordinates (`x`, `y`), with optional `button` (left/right/middle) and `click_count`.
  - New pattern actions:
    - `toggle` — TogglePattern (checkbox / switch / toggle button).
    - `set_range` / `get_range` — RangeValuePattern (sliders, numeric controls).
    - `get_text` — TextPattern (read a control's text content).
    - `scroll` — ScrollPattern (horizontal / vertical / both, with `amount` and `scroll_axis`).
    - `window_minimize` / `window_maximize` / `window_restore` / `window_close` / `window_move` — WindowPattern.
  - `find` / `list_controls` now report supported patterns for each control.
  - Control descriptions include `focusable`, `text`, and `patterns` fields.
  - Added a `NativeMouse` P/Invoke helper for cursor position + mouse events.
- **Package formalization**:
  - `package.json` upgraded to v0.2.0 with `repository` / `homepage` / `bugs` / `author`, richer `keywords`, `files`, and `bundledDependencies` for `pi-web-access`.
  - Added `CHANGELOG.md`.

### Added
- `click_coords` now supports **relative coordinates** via a `relative` flag and a `relative_to` selector:
  - `relative_to: "window"` — `x`/`y` are offsets from the target window's top-left (requires a window target).
  - `relative_to: "desktop"` (default) — `x`/`y` are offsets from the virtual desktop's top-left across all monitors; usable **without any window target**.

### Fixed
- Removed reliance on `LegacyIAccessiblePattern`, which is unavailable in some .NET/PowerShell runtime versions; `click` now falls back to focus + coordinate click.

### Changed
- Rewrote `ui_automation` PowerShell script with modular helpers (`Locate-Window`, `Build-Condition`, `Describe-Element`, `Get-Patterns`, `Find-One`).
