From cc6486419e8162a0597219443986b3e373aaf1e2 Mon Sep 17 00:00:00 2001 From: alex2772 Date: Sat, 31 Oct 2026 08:34:19 +0300 Subject: [PATCH 1/6] Update AUI to feat/ai-slop, add the aui-remote skill for AI agents --- .claude/skills/aui-remote/SKILL.md | 116 +++++++++++++++++++++++++++++ AGENTS.md | 45 +++++++++++ CLAUDE.md | 1 + CMakeLists.txt | 2 +- aui.boot.cmake | 58 ++++++++++++++- 5 files changed, 219 insertions(+), 3 deletions(-) create mode 100644 .claude/skills/aui-remote/SKILL.md create mode 100644 AGENTS.md create mode 100644 CLAUDE.md diff --git a/.claude/skills/aui-remote/SKILL.md b/.claude/skills/aui-remote/SKILL.md new file mode 100644 index 0000000..7e115f8 --- /dev/null +++ b/.claude/skills/aui-remote/SKILL.md @@ -0,0 +1,116 @@ +--- +name: aui-remote +description: Build, run, look at, click and type into this AUI application through aui-remote. Load it before changing anything visible (views, buttons, layouts, styles) and whenever the user asks to run, test or verify the app, so the result is checked in the real window. +--- + +# Verifying the UI of this application + +Follow the steps in order. A UI change is not done until you have seen it work in the running application. + +## 1. Locate aui-remote + +Configure a Debug build if there is none, then ask AUI.Boot for the tool. Use the build directory the user has, if it +is not `build`: + +```bash +cmake -B build -DCMAKE_BUILD_TYPE=Debug +cmake -P aui.boot.cmake remote build +``` + +The command prints the path to `aui-remote`, nothing else. If it fails instead: + +- `aui-remote is not built yet`: AUI is pulled with `-DAUIB_AUI_AS=TRUE`, so `aui-remote` is a target of this build. + Run `cmake --build build --parallel 8 -t aui.remote` and repeat the command. +- `aui-remote is not found`: the distribution has no `aui-remote` because `AUI_VERSION` is too old. Tell the user. Do + not change `AUI_VERSION` on your own. + +Below, `aui-remote` stands for the printed path. Write the full path out in every command. + +## 2. Ask for permission to add remote debugging + +Run `grep -n ARemoteDebug src/*.cpp`. If there is a match and `CMakeLists.txt` links `aui::dev_extras`, go to step 4. + +Otherwise stop here, before you edit anything for it, and ask the user. Use the tool for asking questions, or, if you +have none, ask in your reply and end your turn. Say what you are going to add: `aui::dev_extras` linked to Debug builds +and an `ARemoteDebug::start` call under `#if AUI_DEBUG` in `src/main.cpp`, which lets you control the application over a +loopback port, take screenshots and verify the result. Release builds do not get it. + +If the user declines, do not add it. Finish with a build and `./build/bin/Tests`, and say that the UI was not verified. + +## 3. Add debug-only remote debugging + +In `CMakeLists.txt`, add `dev_extras` to `COMPONENTS` of `auib_import` and, after `aui_executable`: + +```cmake +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + # remote debugging for aui-remote; never ship aui::dev_extras + aui_link(${PROJECT_NAME} PRIVATE aui::dev_extras) +endif () +``` + +In `src/main.cpp`, next to the includes: + +```cpp +#if AUI_DEBUG && __has_include() +#include +#define APP_REMOTE_DEBUG 1 +#endif +``` + +and first thing in `AUI_ENTRY`: + +```cpp +#if APP_REMOTE_DEBUG + ARemoteDebug::start(ARemoteDebug::Options::fromEnvironment()); +#endif +``` + +Nothing else in the application changes. Configure and build as in `AGENTS.md`. + +## 4. Start a headless display + +Run the application in a headless environment, so that its window does not cover the user's work and their mouse does +not interfere with you. Do not start a window on the user's desktop without their permission. On Linux: + +```bash +mutter --headless --wayland --virtual-monitor 1280x800 --wayland-display aui-agent > mutter.log 2>&1 & +echo $! # remember the pid +grep 'public X11 display' mutter.log # gives :N +ls -t /run/user/$(id -u)/.mutter-Xwaylandauth.* | head -1 # gives the XAUTHORITY file +``` + +Prefix every `launch` with `env -u WAYLAND_DISPLAY DISPLAY=:N XAUTHORITY=`. The log may need a second to appear. +When you are done, kill mutter by its pid. Never kill it by name: the user's desktop can be mutter too. If there is no +headless environment (no mutter, macOS, Windows), ask the user whether to use their desktop. + +## 5. Drive the application + +```bash +aui-remote cli launch -- "$PWD/build/bin/example_app" # prints { pid, port, ... } +aui-remote cli screenshot --annotate --pid # numbered views, `marks` maps numbers to refs +aui-remote cli click --pid +aui-remote cli wait-idle --pid +aui-remote cli screenshot --pid # read the PNG at the printed path +aui-remote cli stop +``` + +`launch` passes a key to the application, so no pairing is needed. For an instance the user started themselves, run +`aui-remote cli pair ` and ask them for the 6-digit code shown in the window, then +`aui-remote cli pair --code `. Never guess a code. + +`aui-remote cli help` lists all commands (`tree`, `find`, `type`, `key`, `logs`, `resize` and more). + +Exercise the change the way a user would, and look at the PNG before and after: a counter is verified when its text +changes after clicking, not when the button exists. If it is wrong, fix the code, rebuild, `stop`, `launch` and check +again. In your report, say what you clicked and what the screenshot showed. + +## Rules + +- Always `wait-idle` after input, then `screenshot`. Otherwise you see the frame before the change. +- Every command prints one JSON object on the last line. On failure read `error.data.hint`. +- Refs (`v:`) go stale when the tree changes. On `STALE_REF`, run `find` again. +- Check `logs --level warn` when something does not react. +- Native dialogs are drawn by the OS: you can't see or click them. Don't click buttons that open a browser or a file + picker in an environment the user can see. +- `stop` what you launched and kill the headless display when you finish. +- Keep `aui::dev_extras` out of release builds. diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..fda05ea --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,45 @@ +# AGENTS.md + +Guidance for AI coding agents working on this AUI application (a consumer of the +[AUI Framework](https://github.com/aui-framework/aui)). + +## Layout + +- `src/` — sources, auto-globbed by `aui_executable`. Entry point is `AUI_ENTRY` (``). +- `tests/` — GTest/GMock tests, enabled by `aui_enable_tests`. +- `assets/` — compiled into the binary by `aui_compile_assets`. +- `aui.boot.cmake` — AUI.Boot package manager; `AUI_VERSION` in `CMakeLists.txt` selects the AUI release. + +Edit this project's files only. To read or change AUI itself, reconfigure with `-DAUIB_AUI_AS=TRUE`; AUI.Boot prints +where the editable sources are. + +## Build and test + +```bash +cmake -B build -GNinja +cmake --build build --parallel 8 +cmake --build build --target Tests && ./build/bin/Tests +``` + +## Code style + +4 spaces, max 120 columns, `mLikeThis` members, `lowerCamelCase` functions, `UPPER_SNAKE_CASE` constants, `A`-prefixed +public classes. Always put a trailing comma in UI DSL initializer lists: + +```cpp +setContents(Vertical { + Label { "Up" }, + Label { "Down" }, // <- trailing comma +}); +``` + +Use `_new(...)` / `_`, signal-slot `connect(...)` and properties for data binding. Formatting follows +`.clang-format`. Keep comments and docs plain: no filler, no AI-flavoured prose. + +## Looking at the running application + +Verify UI changes in the real window with the `aui-remote` skill in `.claude/skills`. It locates `aui-remote` (needs an +AUI version that has `aui::dev_extras`), asks the user before adding a debug-only `ARemoteDebug::start` to the +application and then drives the app: inspect views, click, type, take screenshots. + +> **Warning:** never link `aui::dev_extras` to release builds: the agent lets a client click, type and read the screen. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..43c994c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +@AGENTS.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 68b9318..4f7273c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ option(BUILD_SHARED_LIBS "Build shared libs" OFF) option(AUIB_FORCE_PRECOMPILED "AUI.Boot: force precompiled dependencies" OFF) option(AUIB_NO_PRECOMPILED "AUI.Boot: disable precompiled dependencies" OFF) -set(AUI_VERSION v8.0.0-rc.21) +set(AUI_VERSION 4aacd81122f7e1d63539d55d13acf18a052f3838) # Use AUI.Boot include(aui.boot.cmake) diff --git a/aui.boot.cmake b/aui.boot.cmake index 056600f..4cd8d45 100644 --- a/aui.boot.cmake +++ b/aui.boot.cmake @@ -73,6 +73,7 @@ Available commands: | `help` | Print help message | | `update [version]` | Update `aui.boot.cmake` to the specified version (default: `master`) | | `create` | Create a new project in the current directory (clones `example_app`) | +| `remote [build dir]` | Print the path to `aui-remote` of the AUI used by the project configured in `build dir` (default: `build`) | Example — updating to the latest release: ```shell @@ -84,6 +85,15 @@ Example — bootstrapping a new project: cmake -P aui.boot.cmake create ``` +Example — running `aui-remote` (see [agentic-development]) of the AUI a project is built with: +```shell +$(cmake -P aui.boot.cmake remote build) cli list +``` + +`remote` prints the path to stdout and nothing else. It is `bin/aui-remote` of the AUI package the project imports or, +with [AUIB_AUI_AS](#AUIB_LIB_AS), of the project's build directory; in the latter case it is built on demand with +`cmake --build build -t aui.remote`. + ## Prebuilt packages { #PREBUILT_PACKAGES } AUI Boot is a source-first package manager, however, it can pull precompiled packages instead of building them locally. @@ -810,6 +820,8 @@ if(CMAKE_SCRIPT_MODE_FILE) message(" update [version] Update aui.boot.cmake to the specified version") message(" (default: master branch)") message(" create Create a new project in the current directory") + message(" remote [build dir] Print the path to aui-remote of the AUI used by the project") + message(" configured in build dir (default: build)") message("") message("For more information, see https://aui-framework.github.io/master/getting-started") message("") @@ -861,6 +873,41 @@ if(CMAKE_SCRIPT_MODE_FILE) message(STATUS "") message(STATUS "Next steps:") message(STATUS " cmake -B build && cmake --build build") + elseif("${_auib_cli_command}" STREQUAL "remote") + if(NOT "${CMAKE_ARGV4}" STREQUAL "") + set(_auib_build_dir "${CMAKE_ARGV4}") + else() + set(_auib_build_dir "build") + endif() + get_filename_component(_auib_build_dir "${_auib_build_dir}" ABSOLUTE) + if(NOT EXISTS "${_auib_build_dir}/CMakeCache.txt") + message(FATAL_ERROR "${_auib_build_dir} is not a configured build directory; configure the project first " + "(cmake -B build) or pass its build directory: cmake -P aui.boot.cmake remote ") + endif() + load_cache("${_auib_build_dir}" READ_WITH_PREFIX _auib_cache_ aui_DIR AUIB_AUI_AS) + set(_auib_candidates "${_auib_build_dir}/bin") + if(_auib_cache_aui_DIR) + list(APPEND _auib_candidates "${_auib_cache_aui_DIR}/bin") + endif() + unset(_auib_remote) + foreach(_dir ${_auib_candidates}) + foreach(_name aui-remote aui-remote.exe) + if(EXISTS "${_dir}/${_name}" AND NOT _auib_remote) + set(_auib_remote "${_dir}/${_name}") + endif() + endforeach() + endforeach() + if(NOT _auib_remote) + if(_auib_cache_AUIB_AUI_AS) + message(FATAL_ERROR "aui-remote is not built yet: cmake --build ${_auib_build_dir} -t aui.remote") + endif() + string(REPLACE ";" ", " _auib_candidates "${_auib_candidates}") + message(FATAL_ERROR "aui-remote is not found in ${_auib_candidates}. It comes with AUI distributions " + "for the host platform that have the views, curl, json, image, crypt and network components; " + "older versions of AUI don't have it.") + endif() + # stdout, so that $(cmake -P aui.boot.cmake remote) gives the path alone + execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "${_auib_remote}") elseif("${_auib_cli_command}" STREQUAL "_auib_run_logged") # Internal, used by _auib_execute_logged: # cmake -P aui.boot.cmake _auib_run_logged -- @@ -1075,14 +1122,21 @@ if (NOT CMAKE_C_COMPILER_ID) message(FATAL_ERROR "CMAKE_C_COMPILER_ID is not set.\nnote: Please include aui.boot AFTER project() call.") endif() -if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)") +# CMAKE_SYSTEM_PROCESSOR reflects the *host* on Windows, which is wrong when e.g. an x86 toolchain is used on an ARM64 +# machine. MSVC reports the actual target in CMAKE__COMPILER_ARCHITECTURE_ID. +set(_aui_arch "${CMAKE_SYSTEM_PROCESSOR}") +if (MSVC AND CMAKE_C_COMPILER_ARCHITECTURE_ID) + set(_aui_arch "${CMAKE_C_COMPILER_ARCHITECTURE_ID}") +endif() + +if (_aui_arch MATCHES "(x86)|(X86)|(x64)|(amd64)|(AMD64)") if (CMAKE_SIZEOF_VOID_P EQUAL 8) set(_aui_target_arch "x86_64") elseif (CMAKE_SIZEOF_VOID_P EQUAL 4) set(_aui_target_arch "x86") endif() else() - string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" _aui_target_arch) + string(TOLOWER "${_aui_arch}" _aui_target_arch) endif() if (ANDROID) From 31fe675e056788ea78369028040c54dd5d3a8380 Mon Sep 17 00:00:00 2001 From: alex2772 Date: Sat, 31 Oct 2026 09:03:59 +0300 Subject: [PATCH 2/6] aui-remote skill: find aui-remote through package-lock.json, update AUI --- .claude/skills/aui-remote/SKILL.md | 20 ++++--- CMakeLists.txt | 2 +- aui.boot.cmake | 91 +++++++++++++----------------- 3 files changed, 51 insertions(+), 62 deletions(-) diff --git a/.claude/skills/aui-remote/SKILL.md b/.claude/skills/aui-remote/SKILL.md index 7e115f8..ad0c47a 100644 --- a/.claude/skills/aui-remote/SKILL.md +++ b/.claude/skills/aui-remote/SKILL.md @@ -9,22 +9,24 @@ Follow the steps in order. A UI change is not done until you have seen it work i ## 1. Locate aui-remote -Configure a Debug build if there is none, then ask AUI.Boot for the tool. Use the build directory the user has, if it -is not `build`: +Configure a Debug build if there is none. Use the build directory the user has, if it is not `build`: ```bash cmake -B build -DCMAKE_BUILD_TYPE=Debug -cmake -P aui.boot.cmake remote build ``` -The command prints the path to `aui-remote`, nothing else. If it fails instead: +On configure, AUI.Boot writes `build/package-lock.json`: what every dependency resolved to, with its `version`, +`source_dir`, `pin` and `as_subdirectory`, and `install_dir` for an installed package. Read it instead of guessing paths +under `~/.aui`. It is also the way to AUI's own sources (`source_dir`) when you need to check an API. -- `aui-remote is not built yet`: AUI is pulled with `-DAUIB_AUI_AS=TRUE`, so `aui-remote` is a target of this build. - Run `cmake --build build --parallel 8 -t aui.remote` and repeat the command. -- `aui-remote is not found`: the distribution has no `aui-remote` because `AUI_VERSION` is too old. Tell the user. Do - not change `AUI_VERSION` on your own. +Read the `aui` entry: -Below, `aui-remote` stands for the printed path. Write the full path out in every command. +- `as_subdirectory` is `false`: AUI is a distribution, the tool is `/bin/aui-remote`. If there is no such + file, `AUI_VERSION` is too old to have it. Tell the user. Do not change `AUI_VERSION` on your own. +- `as_subdirectory` is `true`: AUI is pulled with `-DAUIB_AUI_AS=TRUE`, so `aui-remote` is a target of this build. Run + `cmake --build build --parallel 8 -t aui.remote`; the tool is `build/bin/aui-remote`. + +Below, `aui-remote` stands for that path. Write the full path out in every command. ## 2. Ask for permission to add remote debugging diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f7273c..51d219c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ option(BUILD_SHARED_LIBS "Build shared libs" OFF) option(AUIB_FORCE_PRECOMPILED "AUI.Boot: force precompiled dependencies" OFF) option(AUIB_NO_PRECOMPILED "AUI.Boot: disable precompiled dependencies" OFF) -set(AUI_VERSION 4aacd81122f7e1d63539d55d13acf18a052f3838) +set(AUI_VERSION 64228384477d051a2860e74d0de103b4f4932533) # Use AUI.Boot include(aui.boot.cmake) diff --git a/aui.boot.cmake b/aui.boot.cmake index 4cd8d45..9523e91 100644 --- a/aui.boot.cmake +++ b/aui.boot.cmake @@ -73,7 +73,6 @@ Available commands: | `help` | Print help message | | `update [version]` | Update `aui.boot.cmake` to the specified version (default: `master`) | | `create` | Create a new project in the current directory (clones `example_app`) | -| `remote [build dir]` | Print the path to `aui-remote` of the AUI used by the project configured in `build dir` (default: `build`) | Example — updating to the latest release: ```shell @@ -85,14 +84,30 @@ Example — bootstrapping a new project: cmake -P aui.boot.cmake create ``` -Example — running `aui-remote` (see [agentic-development]) of the AUI a project is built with: -```shell -$(cmake -P aui.boot.cmake remote build) cli list +## package-lock.json { #AUIB_PACKAGE_LOCK } + +On configure, AUI Boot writes `package-lock.json` to the build directory: what each dependency resolved to. Read it +instead of guessing paths in the cache, for example to look at the sources of a dependency or to find a tool of AUI. + +```json +{ + "aui": { + "version": "v8.0.0-rc.21", + "source_dir": "/home/user/.aui/repo/aui-v8.0.0-rc.21", + "pin": "4aacd81", + "as_subdirectory": false, + "install_dir": "/home/user/.aui/prefix/aui/eb150bfbe0f5cb7c27de82f1dae4a920" + } +} ``` -`remote` prints the path to stdout and nothing else. It is `bin/aui-remote` of the AUI package the project imports or, -with [AUIB_AUI_AS](#AUIB_LIB_AS), of the project's build directory; in the latter case it is built on demand with -`cmake --build build -t aui.remote`. +| Field | Description | +|---|---| +| `version` | The version requested in `auib_import` | +| `source_dir` | The sources, if the package was built locally | +| `pin` | The commit the sources are at | +| `as_subdirectory` | `true` if the package is a part of the build tree: see [AUIB_LIB_AS](#AUIB_LIB_AS) | +| `install_dir` | The installed package, with `bin/`, `lib/` and `include/`. Absent if `as_subdirectory` is `true`: the executables are in `bin/` of the build directory | ## Prebuilt packages { #PREBUILT_PACKAGES } @@ -820,8 +835,6 @@ if(CMAKE_SCRIPT_MODE_FILE) message(" update [version] Update aui.boot.cmake to the specified version") message(" (default: master branch)") message(" create Create a new project in the current directory") - message(" remote [build dir] Print the path to aui-remote of the AUI used by the project") - message(" configured in build dir (default: build)") message("") message("For more information, see https://aui-framework.github.io/master/getting-started") message("") @@ -873,41 +886,6 @@ if(CMAKE_SCRIPT_MODE_FILE) message(STATUS "") message(STATUS "Next steps:") message(STATUS " cmake -B build && cmake --build build") - elseif("${_auib_cli_command}" STREQUAL "remote") - if(NOT "${CMAKE_ARGV4}" STREQUAL "") - set(_auib_build_dir "${CMAKE_ARGV4}") - else() - set(_auib_build_dir "build") - endif() - get_filename_component(_auib_build_dir "${_auib_build_dir}" ABSOLUTE) - if(NOT EXISTS "${_auib_build_dir}/CMakeCache.txt") - message(FATAL_ERROR "${_auib_build_dir} is not a configured build directory; configure the project first " - "(cmake -B build) or pass its build directory: cmake -P aui.boot.cmake remote ") - endif() - load_cache("${_auib_build_dir}" READ_WITH_PREFIX _auib_cache_ aui_DIR AUIB_AUI_AS) - set(_auib_candidates "${_auib_build_dir}/bin") - if(_auib_cache_aui_DIR) - list(APPEND _auib_candidates "${_auib_cache_aui_DIR}/bin") - endif() - unset(_auib_remote) - foreach(_dir ${_auib_candidates}) - foreach(_name aui-remote aui-remote.exe) - if(EXISTS "${_dir}/${_name}" AND NOT _auib_remote) - set(_auib_remote "${_dir}/${_name}") - endif() - endforeach() - endforeach() - if(NOT _auib_remote) - if(_auib_cache_AUIB_AUI_AS) - message(FATAL_ERROR "aui-remote is not built yet: cmake --build ${_auib_build_dir} -t aui.remote") - endif() - string(REPLACE ";" ", " _auib_candidates "${_auib_candidates}") - message(FATAL_ERROR "aui-remote is not found in ${_auib_candidates}. It comes with AUI distributions " - "for the host platform that have the views, curl, json, image, crypt and network components; " - "older versions of AUI don't have it.") - endif() - # stdout, so that $(cmake -P aui.boot.cmake remote) gives the path alone - execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "${_auib_remote}") elseif("${_auib_cli_command}" STREQUAL "_auib_run_logged") # Internal, used by _auib_execute_logged: # cmake -P aui.boot.cmake _auib_run_logged -- @@ -1685,7 +1663,7 @@ function(_auib_git_clone _url _version _source_dir) set(_auib_git_clone_ok TRUE PARENT_SCOPE) endfunction() -function(_auib_update_package_lock _module_name _tag_or_hash _source_dir _as_subdirectory) +function(_auib_update_package_lock _module_name _tag_or_hash _source_dir _as_subdirectory _install_dir) # Resolve the actual pinned commit hash if a git repo is available set(_pin "${_tag_or_hash}") if (GIT_EXECUTABLE AND EXISTS "${_source_dir}/.git") @@ -1712,33 +1690,41 @@ function(_auib_update_package_lock _module_name _tag_or_hash _source_dir _as_sub string(REPLACE "\"" "\\\"" _pin_esc "${_pin_esc}") string(REPLACE "\\" "\\\\" _src_esc "${_source_dir}") string(REPLACE "\"" "\\\"" _src_esc "${_src_esc}") + string(REPLACE "\\" "\\\\" _install_esc "${_install_dir}") + string(REPLACE "\"" "\\\"" _install_esc "${_install_esc}") if (_as_subdirectory) set(_as_sub_str "true") + set(_install_dir_field "") else() set(_as_sub_str "false") + set(_install_dir_field ",\n \"install_dir\": \"${_install_esc}\"") endif() - set(_new_entry " \"${_module_name_esc}\": {\n \"version\": \"${_tag_esc}\",\n \"source_dir\": \"${_src_esc}\",\n \"pin\": \"${_pin_esc}\",\n \"as_subdirectory\": ${_as_sub_str}\n }") + set(_new_entry " \"${_module_name_esc}\": {\n \"version\": \"${_tag_esc}\",\n \"source_dir\": \"${_src_esc}\",\n \"pin\": \"${_pin_esc}\",\n \"as_subdirectory\": ${_as_sub_str}${_install_dir_field}\n }") set(_lock_file "${CMAKE_BINARY_DIR}/package-lock.json") # Read existing file or start fresh if (EXISTS "${_lock_file}") file(READ "${_lock_file}" _contents) + # older versions of this function nested the braces; such a file can't be updated, every package rewrites it + if (_contents MATCHES "^[ \t\r\n]*\\{[ \t\r\n]*\\{") + set(_contents "{}") + endif() # Strip outer braces and trailing whitespace/newlines - string(REGEX REPLACE "^[[:space:]]*\\{" "" _contents "${_contents}") - string(REGEX REPLACE "}[[:space:]]*$" "" _contents "${_contents}") + string(REGEX REPLACE "^[ \t\r\n]*\\{" "" _contents "${_contents}") + string(REGEX REPLACE "}[ \t\r\n]*$" "" _contents "${_contents}") # Remove existing entry for this module (if present) so we can replace it # Match: optional comma before, the entry itself, optional trailing comma - string(REGEX REPLACE ",?[[:space:]]*\n?[[:space:]]*\"${_module_name_esc}\"[[:space:]]*:[[:space:]]*\\{[^}]*\\}" "" _contents "${_contents}") - string(REGEX REPLACE "^,[[:space:]]*\n" "" _contents "${_contents}") + string(REGEX REPLACE ",?[ \t\r\n]*\n?[ \t\r\n]*\"${_module_name_esc}\"[ \t\r\n]*:[ \t\r\n]*\\{[^}]*\\}" "" _contents "${_contents}") + string(REGEX REPLACE "^,[ \t\r\n]*\n" "" _contents "${_contents}") # Strip leading/trailing whitespace string(STRIP "${_contents}" _contents) if (_contents STREQUAL "") set(_body "${_new_entry}") else() - set(_body "${_contents},\n${_new_entry}") + set(_body " ${_contents},\n${_new_entry}") endif() else() set(_body "${_new_entry}") @@ -2347,7 +2333,8 @@ function(auib_import AUI_MODULE_NAME URL) set_property(GLOBAL APPEND PROPERTY AUI_BOOT_IMPORTED_MODULES ${AUI_MODULE_NAME_LOWER}) # write/update package-lock.json in the binary dir for LLM/human inspection - _auib_update_package_lock(${AUI_MODULE_NAME} "${TAG_OR_HASH}" "${DEP_SOURCE_DIR}" "${DEP_ADD_SUBDIRECTORY}") + _auib_update_package_lock(${AUI_MODULE_NAME} "${TAG_OR_HASH}" "${DEP_SOURCE_DIR}" "${DEP_ADD_SUBDIRECTORY}" + "${DEP_INSTALL_PREFIX}") # display the imported targets (available since CMake 3.21) if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.21) From c27eb37bb23809b881c42eba1093b35f59a18cb7 Mon Sep 17 00:00:00 2001 From: alex2772 Date: Sat, 31 Oct 2026 09:14:22 +0300 Subject: [PATCH 3/6] aui-remote skill: not Linux only, a headless environment is preferred, not required --- .claude/skills/aui-remote/SKILL.md | 53 +++++++++++++++++++----------- CMakeLists.txt | 2 +- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.claude/skills/aui-remote/SKILL.md b/.claude/skills/aui-remote/SKILL.md index ad0c47a..d3d844e 100644 --- a/.claude/skills/aui-remote/SKILL.md +++ b/.claude/skills/aui-remote/SKILL.md @@ -21,23 +21,26 @@ under `~/.aui`. It is also the way to AUI's own sources (`source_dir`) when you Read the `aui` entry: -- `as_subdirectory` is `false`: AUI is a distribution, the tool is `/bin/aui-remote`. If there is no such - file, `AUI_VERSION` is too old to have it. Tell the user. Do not change `AUI_VERSION` on your own. +- `as_subdirectory` is `false`: AUI is a distribution, the tool is `aui-remote` in `/bin`. If there is no + such file, `AUI_VERSION` is too old to have it. Tell the user. Do not change `AUI_VERSION` on your own. - `as_subdirectory` is `true`: AUI is pulled with `-DAUIB_AUI_AS=TRUE`, so `aui-remote` is a target of this build. Run - `cmake --build build --parallel 8 -t aui.remote`; the tool is `build/bin/aui-remote`. + `cmake --build build -t aui.remote`; the tool is in `build/bin`. + +The name depends on the platform: `aui-remote.exe` on Windows; on macOS, look for +`aui-remote.app/Contents/MacOS/aui-remote` as well. Below, `aui-remote` stands for that path. Write the full path out in every command. ## 2. Ask for permission to add remote debugging -Run `grep -n ARemoteDebug src/*.cpp`. If there is a match and `CMakeLists.txt` links `aui::dev_extras`, go to step 4. +Search `src/` for `ARemoteDebug`. If it is there and `CMakeLists.txt` links `aui::dev_extras`, go to step 4. Otherwise stop here, before you edit anything for it, and ask the user. Use the tool for asking questions, or, if you have none, ask in your reply and end your turn. Say what you are going to add: `aui::dev_extras` linked to Debug builds and an `ARemoteDebug::start` call under `#if AUI_DEBUG` in `src/main.cpp`, which lets you control the application over a loopback port, take screenshots and verify the result. Release builds do not get it. -If the user declines, do not add it. Finish with a build and `./build/bin/Tests`, and say that the UI was not verified. +If the user declines, do not add it. Finish with a build and the `Tests` target, and say that the UI was not verified. ## 3. Add debug-only remote debugging @@ -69,26 +72,36 @@ and first thing in `AUI_ENTRY`: Nothing else in the application changes. Configure and build as in `AGENTS.md`. -## 4. Start a headless display +## 4. Choose where to run the application -Run the application in a headless environment, so that its window does not cover the user's work and their mouse does -not interfere with you. Do not start a window on the user's desktop without their permission. On Linux: +Prefer a headless environment if you can get one: the window does not cover the user's work and their mouse does not +interfere with you. It is a preference, not a requirement. If there is none at hand, run the application on the user's +desktop and say so in your report. Input of `aui-remote` is injected into the application, so it does not move the +user's pointer or type into their other windows. Never send OS-level input (XTest and alike) to their session. -```bash -mutter --headless --wayland --virtual-monitor 1280x800 --wayland-display aui-agent > mutter.log 2>&1 & -echo $! # remember the pid -grep 'public X11 display' mutter.log # gives :N -ls -t /run/user/$(id -u)/.mutter-Xwaylandauth.* | head -1 # gives the XAUTHORITY file -``` +What is available depends on the platform: + +- Linux: check what is installed and use it, for example Xvfb or a headless mode of the compositor. With mutter (kill + it by its pid when you are done, never by name: the user's desktop can be mutter too): + + ```bash + mutter --headless --wayland --virtual-monitor 1280x800 --wayland-display aui-agent > mutter.log 2>&1 & + echo $! # remember the pid + grep 'public X11 display' mutter.log # gives :N, the log may need a second to appear + ls -t /run/user/$(id -u)/.mutter-Xwaylandauth.* | head -1 # gives the XAUTHORITY file + ``` -Prefix every `launch` with `env -u WAYLAND_DISPLAY DISPLAY=:N XAUTHORITY=`. The log may need a second to appear. -When you are done, kill mutter by its pid. Never kill it by name: the user's desktop can be mutter too. If there is no -headless environment (no mutter, macOS, Windows), ask the user whether to use their desktop. + Then prefix `launch` with `env -u WAYLAND_DISPLAY DISPLAY=:N XAUTHORITY=`. +- Windows and macOS: there is usually no headless environment, use the desktop. +- Android and iOS: the application runs on a device or an emulator and can't write a discovery file the host can read. + It needs `Options::writeDiscoveryFile = false` and a fixed port, forwarded to the host (`adb forward`). +- Emscripten and anything not listed: read `docs/agentic-development.md` in `source_dir` of AUI. If you can't reach + the application, tell the user. ## 5. Drive the application ```bash -aui-remote cli launch -- "$PWD/build/bin/example_app" # prints { pid, port, ... } +aui-remote cli launch -- # prints { pid, port, ... } aui-remote cli screenshot --annotate --pid # numbered views, `marks` maps numbers to refs aui-remote cli click --pid aui-remote cli wait-idle --pid @@ -96,7 +109,7 @@ aui-remote cli screenshot --pid # read the PNG at t aui-remote cli stop ``` -`launch` passes a key to the application, so no pairing is needed. For an instance the user started themselves, run +The application is in `build/bin` (`.exe` on Windows, an `.app` bundle on macOS). `launch` passes a key to the application, so no pairing is needed. For an instance the user started themselves, run `aui-remote cli pair ` and ask them for the 6-digit code shown in the window, then `aui-remote cli pair --code `. Never guess a code. @@ -114,5 +127,5 @@ again. In your report, say what you clicked and what the screenshot showed. - Check `logs --level warn` when something does not react. - Native dialogs are drawn by the OS: you can't see or click them. Don't click buttons that open a browser or a file picker in an environment the user can see. -- `stop` what you launched and kill the headless display when you finish. +- `stop` what you launched and shut down the headless environment you started, if any. - Keep `aui::dev_extras` out of release builds. diff --git a/CMakeLists.txt b/CMakeLists.txt index 51d219c..9192c7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ option(BUILD_SHARED_LIBS "Build shared libs" OFF) option(AUIB_FORCE_PRECOMPILED "AUI.Boot: force precompiled dependencies" OFF) option(AUIB_NO_PRECOMPILED "AUI.Boot: disable precompiled dependencies" OFF) -set(AUI_VERSION 64228384477d051a2860e74d0de103b4f4932533) +set(AUI_VERSION 43a733f42bfded2cb8054e099f7faebd2f6e4fa5) # Use AUI.Boot include(aui.boot.cmake) From 158c4cb5e37a6507fd072a69af2bf6f3e3a4322d Mon Sep 17 00:00:00 2001 From: Alex2772 Date: Sun, 1 Nov 2026 04:51:44 +0300 Subject: [PATCH 4/6] aui-remote skill: custom-drawn content, saving tokens, intermittent bugs --- .claude/skills/aui-remote/SKILL.md | 50 +++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/.claude/skills/aui-remote/SKILL.md b/.claude/skills/aui-remote/SKILL.md index d3d844e..d4b088a 100644 --- a/.claude/skills/aui-remote/SKILL.md +++ b/.claude/skills/aui-remote/SKILL.md @@ -119,9 +119,57 @@ Exercise the change the way a user would, and look at the PNG before and after: changes after clicking, not when the button exists. If it is wrong, fix the code, rebuild, `stop`, `launch` and check again. In your report, say what you clicked and what the screenshot showed. +Run the application with the arguments and the configuration the user runs it with. If they say "it works here" and it +does not work for you, compare those first. An application may keep state between runs, such as a signed-in account, +settings or a server to connect to: it is the user's real data. Ask before you delete it or before an action you can't +take back, and check which environment the application connected to before you go on. + +## 6. Applications that draw their own content + +An OpenGL canvas, a game or a video has one view in `tree`, `find` and `--annotate`, whatever it shows. It may also +produce frames all the time, and then `wait-idle` always ends with a timeout. For such content: + +- Find what you are clicking by coordinates. Set a fixed window size with `resize` first and keep the coordinates in + one place; they are only valid for that size. +- Wait for a line in the log, not for a pause. `launch` prints the paths of `stdout` and `stderr`. +- Look at the screen before you click a fixed point. A popup that opens only sometimes turns a blind click into a click + on whatever is under it. +- Ask the application instead of guessing from pixels. `ARemoteDebug::start()->registerFunction` exposes a function of + your own under `#if AUI_DEBUG`, `functions` lists them and `call` runs them. A function that reports the state under a + point or switches a feature at runtime answers in one call what screenshots do not answer at all. + +## 7. Spending less + +- Learn the state from the log. Take a screenshot only for what is visible to the eye alone. +- Crop or scale a screenshot before reading it: `--ref` crops to a view, and a smaller image is enough to see which + screen is open. Use the full size for small details only. +- `logs` returns JSON with every line. For a long session, filter the `stdout` file with `grep` instead. +- When the same steps are needed more than twice, such as getting past a sign-in or a loading screen, put them into a + script that ends with the result. One call is cheaper than a screenshot after each click, and a script does not forget + a step. + +## 8. Bugs that come and go + +Rendering and loading depend on the order of asynchronous work, so a single run proves nothing. + +- Do not write "fixed", "one-off" or "unrelated" until you have repeated the run. Compare how often the bug shows up in + the same conditions before and after the change, and keep the counts: build, arguments, result. +- Prefer a loop that checks the result by itself. Run the check on known good and bad images first: `compare` gives the + percentage of different pixels. If the check fails, the loop must stop, not continue without an answer. +- A bug that depends on order can often be forced: expose the order through `registerFunction` and shuffle it within one + run. That is faster than restarting and gives a reproduction instead of a chance of one. +- Add diagnostics before you guess further. Log the state at the moment of failure, and for OpenGL read `glGetError` + right after the call you suspect: when one thing renders wrong, the cause may be an earlier call that changed the state. +- If the user reports that a small change made the bug go away, take it as data about the cause, not as a fix. +- Before you stop an application with a reproduced bug, take a full screenshot and decide whether you still need it alive. +- The window gets no frames while the display is off, so the application looks hung and `screenshot` fails. Check that + first. On macOS, `caffeinate -d -w ` keeps the display on while the application runs. It can't wake a display that + is already off: ask the user. + ## Rules -- Always `wait-idle` after input, then `screenshot`. Otherwise you see the frame before the change. +- Always `wait-idle` after input, then `screenshot`. Otherwise you see the frame before the change. The exception is + content that never goes idle, see section 6. - Every command prints one JSON object on the last line. On failure read `error.data.hint`. - Refs (`v:`) go stale when the tree changes. On `STALE_REF`, run `find` again. - Check `logs --level warn` when something does not react. From c6b4c8f22a1a3697a5a2f535c117062d51f531ba Mon Sep 17 00:00:00 2001 From: alex2772 Date: Mon, 2 Nov 2026 12:09:08 +0300 Subject: [PATCH 5/6] update skill --- .claude/skills/aui-remote/SKILL.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.claude/skills/aui-remote/SKILL.md b/.claude/skills/aui-remote/SKILL.md index d4b088a..121bd76 100644 --- a/.claude/skills/aui-remote/SKILL.md +++ b/.claude/skills/aui-remote/SKILL.md @@ -141,8 +141,10 @@ produce frames all the time, and then `wait-idle` always ends with a timeout. Fo ## 7. Spending less - Learn the state from the log. Take a screenshot only for what is visible to the eye alone. -- Crop or scale a screenshot before reading it: `--ref` crops to a view, and a smaller image is enough to see which - screen is open. Use the full size for small details only. +- Crop or scale a screenshot before reading it: `--ref R` crops to a view, `--crop x,y,w,h` to an area of the window, + and `--scale 0.25` is enough to see which screen is open. Use the full size for small details only. +- `scale` in the result of `screenshot` includes `--scale`: screenshot pixels divided by it are window coordinates. On a + cropped screenshot, add the origin of `crop`. - `logs` returns JSON with every line. For a long session, filter the `stdout` file with `grep` instead. - When the same steps are needed more than twice, such as getting past a sign-in or a loading screen, put them into a script that ends with the result. One call is cheaper than a screenshot after each click, and a script does not forget From 690175d0a9ffd8bfb33d239e7addc48b5d466aff Mon Sep 17 00:00:00 2001 From: alex2772 Date: Wed, 4 Nov 2026 09:18:19 +0300 Subject: [PATCH 6/6] bump aui --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9192c7a..b8ab22a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ option(BUILD_SHARED_LIBS "Build shared libs" OFF) option(AUIB_FORCE_PRECOMPILED "AUI.Boot: force precompiled dependencies" OFF) option(AUIB_NO_PRECOMPILED "AUI.Boot: disable precompiled dependencies" OFF) -set(AUI_VERSION 43a733f42bfded2cb8054e099f7faebd2f6e4fa5) +set(AUI_VERSION 7f573c8dc9d14518d3cbacfc2a449bb1073d8d54) # Use AUI.Boot include(aui.boot.cmake)