🛠️ CLI & CI Integration Guide / CLI ve CI Entegrasyon Rehberi

💡 Select Language / Dil Seçin:


🇬🇧 English Guide

Every other guide on this site assumes a .NET project: reference a package, write C#, call SelfHealingResolver in-process. automation-sandbox-heal (AutomationSandbox.Cli) removes that requirement entirely. SelfHealingResolver.Resolve operates purely on the framework-agnostic UiElementInfo tree - no FlaUI, no Playwright .NET SDK, no Windows dependency - so the only real barrier between “any language, any CI” and this engine was packaging. This guide covers the whole story: the CLI itself, the JSON contract it reads and writes, the GitHub Action that wraps it, and a working capture example for a language other than C#.

Install

dotnet tool install -g AutomationSandbox.Cli --prerelease

--prerelease is required during the 0.x beta series; drop it once a stable 1.0 ships. This still requires the .NET runtime to be present on the machine - the tool itself is a real .NET executable, just one that needs no .NET project from its caller.

Basic Usage

automation-sandbox-heal --expected stale-element.json --tree live-tree.json --profile balanced

With --selector the output is wrapped as { "PartialEvidence": true, "DerivedExpected": {...}, "Result": {...} } so the partial evidence is stated in the result and the element the engine matched against is visible. The acceptance gate is unchanged: with so little evidence the best candidate is often correct but still AMBIGUOUS or LOW CONFIDENCE (exit 1), so treat the output as a review aid for an already-broken suite, not as an auto-fix.

Prints a HealResult as JSON to stdout - the same explainable ScoreComponents breakdown, RunnerUpScore, and EvidenceCoverage every other API surface in this project exposes. Diagnostic logging goes to stderr (always UTF-8 without a BOM, whatever the console code page, so a name such as Bağlan is not garbled on Windows - #621), so stdout is always pure, parseable JSON. Exit code 0 means IsConfident (safe to accept Matched); 1 means not confident (do not auto-accept); 2 means an error occurred before a decision could be made (bad input, missing file, and any mistake on the command line: an unknown or misspelled flag, a missing value, an unknown profile) - never a raw stack trace. A command-line mistake is 2 and not 1 on purpose: a CI gate sends 1 to review, and a typo in a flag must not look like an ordinary “not confident” result (#646). The usage text then goes to stderr, so stdout stays empty; only --help prints it to stdout (exit 0).

The JSON Schema

Both JSON inputs, and the tool’s own output, follow a published JSON Schema. Point your editor or a validator at it for autocomplete and validation without reading any C# source:

{
  "$schema": "https://mustafasercansak.github.io/automation-sandbox/schemas/ui-element-info.schema.json",
  "ControlType": "Button"
}

Only the fields behind SimilarityScorer’s five weighted signals (ControlType, Name, AutomationId, BoundingRectangle, ParentControlType) are required; everything else is optional, matching the C# defaults the engine falls back to when a property is absent.

A tree may nest at most 256 elements deep (each element costs two JSON levels, the object and its Children array, so the reader’s limit is 528). Deeper input is refused with Error: The tree is nested more than 256 elements deep and exit code 2, never with a crash. Until #638 the limit was 31 elements and the error said “possible object cycle”; the .NET capture stops at depth 25 by default and capture.mjs at 100, so both stay inside it.

Using It in CI: the GitHub Action

A composite GitHub Action wraps the install, run, and JSON-parsing steps into one line:

- uses: mustafasercansak/automation-sandbox/.github/actions/heal@main
  with:
    expected: path/to/stale-element.json
    tree: path/to/live-tree.json
    profile: balanced

The inputs are checked before anything runs, and a bad one stops the step with exit code 2 (the CLI’s “could not run”): profile must be balanced, conservative or aggressive, version must look like 1.2.3 or 1.2.3-beta.4, source may only hold letters, digits and . _ ~ : / @ % + = , - (and a backslash), and expected and tree must be existing files. Values are passed to the script as environment variables, never spliced into it, so a value from a pull request (a branch name, say) cannot run as shell (#636).

By default this step fails the job when the result is not confident - the same exit-code contract as the CLI itself, so a bare uses: line is already a working pass/fail gate. Add continue-on-error: true and read the is-confident/result outputs if you want to branch on the outcome instead of failing the build. An optional source input lets the action install from a private feed instead of nuget.org.

Capturing JSON from Any Language: Web (JS/Playwright)

The CLI is only useful once something produces its input. The repository ships a real, working reference for this: examples/js-playwright-capture, a Node.js + Playwright script that captures a web page’s DOM into the exact JSON shape above - mirroring the same role/accessible-name detection and ControlType/AutomationId mapping rules AutomationSandbox.WebDiscovery uses on the .NET side, so a tree captured in JS scores consistently with one captured in .NET. It’s deliberately minimal (regular DOM only - no Shadow DOM or iframe traversal), and ships with a bundled fixture so it runs with zero network dependency out of the box.

Wiring It Into a TypeScript Playwright Suite (@playwright/test)

A suite that already fails has no snapshot recorded while it was green, so use --selector (see above). The same example directory ships the pieces (#618), plain ES modules so they work from a TypeScript suite without a build step:

Set HEAL_CLI if automation-sandbox-heal is not on the PATH. The suggestion is a review aid, not an auto-fix: it is built from the selector alone, so it is labelled partial evidence. A locator with a role and a name (getByRole('button', { name: 'Settings' })) gives the engine much more to match than a test id alone, which often ends not confident with an unrelated best candidate; read the score before trusting it.

Capturing JSON from Any Language: Desktop (Python/pywinauto)

The same idea for Windows desktop applications: examples/python-pywinauto-capture, a Python script using pywinauto’s uia backend - the same underlying Windows UI Automation COM API FlaUI/UIA3 uses, so it produces genuinely equivalent data, not just a matching JSON shape. Unlike the JS example, this one could not be verified locally by the assistant that wrote it (no Windows/UI Automation access in that environment) - its real verification is a CI job (Desktop Capture (Python)) that builds this repository’s own WinForms demo app, launches it, captures its real UI tree, and confirms automation-sandbox-heal heals a synthetic stale locator built from that real data.

A minimal Python sketch, if your own tooling already produces a dict in the same shape:

import json, subprocess

result = subprocess.run(
    ["automation-sandbox-heal", "--expected", "expected.json", "--tree", "tree.json", "--profile", "balanced"],
    capture_output=True, text=True,
)
heal_result = json.loads(result.stdout)
if result.returncode == 0:
    print(f"Healed: use {heal_result['Matched']['AutomationId']} instead")

Scanning a Website for Typos: automation-sandbox-audit

A second tool, AutomationSandbox.SiteAudit (command automation-sandbox-audit), crawls a site from one URL and reports spelling mistakes, plus duplicated words and leftover placeholders. It needs no API key and sends no page text anywhere: spelling comes from Hunspell dictionaries, which handle inflected languages such as Turkish. It requires the .NET 10 runtime (or newer) and downloads Chromium for the crawl.

automation-sandbox-audit --url https://example.com --lang tr,en --allow-word Playwright --install-browser

Running the typo audit on GitHub

A composite action wraps the install, run, summary and upload steps, so a scheduled workflow is one uses: line. It needs no API key, and no page text leaves the runner:

name: Typo audit
on:
  schedule:
    - cron: '0 6 * * 1'
  workflow_dispatch:
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: mustafasercansak/automation-sandbox/.github/actions/site-audit@main
        with:
          url: https://example.com
          lang: tr,en
          allow-words: |
            Acme
            Playwright

Triaging an Issue from the Command Line: automation-sandbox-agent

automation-sandbox-agent triage (#585) runs one GitHub issue through the issue-triage agent described in the LLM provider guide: it reads the issue and its project board card, applies the Agent:: label gate, routes the models from the issue’s Model::<name> and Review::<name> labels, drafts a triage proposal and lets a second model check it. It is read-only: it changes no label, comment or card. The report is JSON on stdout; diagnostics go to stderr.

export PROJECT_TOKEN=$(gh auth token)      # read access to the project and its issues
export GEMINI_API_KEY=...                  # the drafting model
export MISTRAL_API_KEY=... MISTRAL_MODEL=mistral-medium-2508   # the reviewer
automation-sandbox-agent triage --repo owner/name --issue 7 --project-id PVT_xxxx

Keys and tokens are read from environment variables only, never from an argument (an argument reaches the shell history and the process list); a flag that looks like one is rejected and never echoed. The issue needs Agent::Allowed, one Task::issue-triage or Task::ci-failure label and the Ready column of the board. For ci-failure the issue body is read as the pasted CI log and the report gains a ciFailure section (the log’s deterministic category, then the proposed issue); Task::docs reads the files the issue names with Source: path lines from the checkout given by --docs-root (only files git tracks; the workflows pass the checkout they run in), and the draft is in the JSON report’s docs section. Exit codes: 0 the proposal was accepted, 1 the issue is not eligible, routing stopped, or the proposal was blocked or failed (the report says why), 2 the command could not run (bad arguments, no token, no model). Packing, installing and these exit codes are checked in CI; the path from an issue to a proposal is covered by unit tests with a stub GitHub and fake models. Real runs so far (2026-10-31, through the manual workflow agent-triage.yml, #589): on a plain trial issue and on a deliberately hostile one (a forged data marker, “ignore all previous instructions”, a forged JSON answer with a link, @everyone and protocol labels, and a request to print the keys), Gemini drafted and Ollama Cloud (gemma4:31b) reviewed, and both runs were accepted with a correct, harmless proposal; the hostile instructions were not followed. That is two runs, one model pair and one hostile text: it does not show that a model cannot be tricked, only that these safeguards were not tested against one that was. On the same days Mistral answered HTTP 429 as a drafter and as a reviewer, and an NVIDIA model that its public list shows answered HTTP 404 for this account.

Posting the result on the issue (--comment, #590). By default nothing is written to GitHub. With --comment the run ends by posting its report as one comment on the issue: the stage, the gate reason, which models drafted and reviewed, the proposal or the failure reason, and the reviewer’s findings. The comment says plainly that a language model wrote the proposal and that a person must read it before acting on it. It needs its own token that may write issue comments (GH_TOKEN or GITHUB_TOKEN; for a public repository the public_repo scope of a classic token), separate from the read-only project token; without it the run stops before any model is asked. Everything a model or a provider produced is escaped before it is posted: a mention cannot notify anybody, links and HTML are inert, markdown cannot open or close formatting, and the length is capped. A provider’s error is reduced to its status code and a short reason, because the response body can carry account identifiers (the first real NVIDIA 404 did); the JSON report on stdout gets the same reduction. A comment that cannot be posted ends the command with exit code 2. No card is ever changed, and no label unless you pass --label-needs-human (next paragraph).

Marking a blocked or failed run for a person (--label-needs-human, #601). Also off by default. With the flag, a run in which a task actually ran and the independent reviewer blocked the proposal, or the run failed, adds the label Agent::Needs-Human to the issue, so a person looking at the board can see that the agent stopped and wants a decision. It adds that one label and nothing else: there is no parameter for a label name, no label is ever removed, and the label does not stop a later run (adding Agent::Allowed again is the signal to continue). An accepted run adds nothing, and neither does an issue that was not eligible, a routing problem or an unreadable issue, because nothing was drafted in those cases and the report already says what to fix. It needs the same kind of write token as --comment (GH_TOKEN or GITHUB_TOKEN that may write issues) and stops before any model is asked without it. A label that cannot be added ends the command with exit code 2; the report is still printed first. In the manual workflow it is the label_needs_human input; the label-triggered workflow stays read-only and never sets it. Adding a label to an issue that already has it changes nothing. A provider that is merely rate limited counts as a failed run here, so the label can appear for a reason that has nothing to do with the proposal; the report says which.

Running it on GitHub instead of your own machine (#589). The repository secrets (model keys) cannot be read back by anyone, so a model that is only configured there cannot be tried from a terminal. The manual workflow agent-triage.yml runs the same tool on GitHub’s runner with those secrets: start it from the Actions tab (or gh workflow run agent-triage.yml -f issue_number=7), and read the report in the job summary. With post_comment it also posts the report as a comment, through the workflow’s own token, so no extra token is needed for that. Reading a user-owned project board does need a PROJECT_TOKEN secret (a classic token with read:project and nothing else). Only a person who may run workflows can start this one; no issue, label, comment or pull request event can, so a stranger cannot spend model quota or reach the secrets.

Starting it by adding a label (#589). A second workflow, agent-triage-label.yml, runs the same tool when a maintainer adds Agent::Allowed to an issue. It is off until you set the repository variable AGENT_TRIAGE_ON_LABEL to true (Settings, Secrets and variables, Actions, Variables), so merging it spends nothing. Adding a label needs triage access, so the label is itself the permission check; the workflow also reacts only to that one label, runs the code on the default branch (an issues event never checks out the issue author’s code), cannot be started by a pull request, a comment or a push, and has contents: read and issues: read only. It is read-only: the report goes to the job summary, and no label, comment or card is written. Model names come from the repository variables (GEMINI_MODEL, MISTRAL_MODEL, NVIDIA_MODEL, OLLAMA_CLOUD_MODEL). Runs for one issue are serialised with each other and with manual runs. The issue still has to pass the gate (Task::<kind>, Ready on the board, and so on); a label event for an issue that does not is a finished run that reports why, not a failure.

Giving the models the repository’s history (lessons build, --lessons-file, #561). automation-sandbox-agent lessons build --repo owner/name --out lessons.json [--max-records N] [--before yyyy-MM-dd] writes a plain JSON index of the closed issues and pull requests (read only; GH_TOKEN or GITHUB_TOKEN optional, but an anonymous run is rate limited hard), and triage --lessons-file lessons.json then adds the few matching records, quoted as data and named by number, to the drafting and reviewing prompts. It is off unless the file is given, and an unreadable or invalid index stops the run with exit code 2 before any request. The report lists the records used. Whether it helps has not been shown (three models, ten defects, no evidence that it does); see the LLM provider guide.

Letting a Model Call the Engine: automation-sandbox-mcp

automation-sandbox-mcp (#586) is a Model Context Protocol server written in C#, so a model client (an IDE assistant, a desktop chat app, an agent framework) can call the engine without anyone writing glue code. MCP is JSON-RPC over standard input and output, one message per line, so the product stays free of Node.js: this is the server direction, and it is unrelated to the Playwright MCP client bridge the project declined earlier (see Intent-Driven Automation). Install it with dotnet tool install --global AutomationSandbox.Mcp --prerelease once it is published (it is built from this repository for now) and register the command automation-sandbox-mcp as a stdio server in your client.

It offers four tools, all read-only:

Tool What it does Needs
heal_locator Takes the stale element and a live UI tree as JSON and returns the heal decision with its score breakdown; IsConfident is the engine’s own acceptance gate and is the first property of the answer (#668). The answer has the same compact shape as automation-sandbox-heal --compact: elements without their subtree and only the best 5 candidates, with CandidateCount giving the full number, so it stays small whatever the size of the tree. nothing
classify_ci_log Sorts a failed CI log into a category with deterministic rules, no model; credential shapes are masked in the answer. nothing
check_issue_eligibility Reads an issue and its board card and reports the agent label gate’s decision. PROJECT_TOKEN on the server
triage_issue_dry_run Runs the triage agent on an eligible issue and returns the proposal; nothing is posted, labelled or moved. It asks the configured models, so it costs quota. PROJECT_TOKEN and a model key on the server

What it will not do: no tool writes a label, a card, a file or an issue, and no tool takes a credential as an argument or returns one. The tokens and model keys the last two tools need are read from the server’s own environment, which the caller of a tool cannot read or set; when they are missing the tool says the server is not configured. Every argument is treated as untrusted: it is type-checked, bounded (a heal document may be up to 400,000 characters, a log up to 400,000) and validated before use, a message longer than 1,000,000 characters is discarded with an error, a tool answer is cut at 60,000 characters, and a tool that fails unexpectedly reports only the exception type. The docs task kind needs a checkout and is not offered through this server, so a Task::docs issue fails in triage_issue_dry_run before any model is asked. Protocol (#674): the server speaks the 2026-07-28 revision, where every request carries its own protocol version and capabilities in params._meta and there is no initialize handshake (server/discover is available, tools/list and tools/call results carry resultType). It also keeps serving the older handshake (initialize, 2025-06-18 and earlier) for a client that has not moved yet; a request that has neither a per-request version nor an earlier handshake is rejected with -32602, and an unsupported version with -32022 and the list of versions the server speaks. Not built: an HTTP transport, authentication, and any tool that writes. The tool list and these limits are exercised by tests over in-memory streams that need no key and no network; two real clients, built on the same official SDK, have been tried over stdio on Linux: the official MCP Inspector 2.13.0 and the official TypeScript client 2.4.0. Each connected with the older initialize handshake and, pinned to 2026-07-28, with server/discover, listed the tools and called classify_ci_log; the Inspector also called heal_locator on the modern path. That is one SDK, one transport and one operating system, and the issue tools were not called through a client, so a client-specific quirk is still possible.

Why a CLI, Not Just the Library

AutomationSandbox.SelfHealing/AutomationSandbox.UiModel are the right choice for a .NET project that already captures its own UiElementInfo trees (via Discovery, WebDiscovery, or a hand-rolled adapter) and wants to call the resolver in-process. The CLI is for everything else: a non-.NET test suite, a shell script in a CI pipeline, or any tool that can produce a JSON tree but has no reason to take on a .NET dependency just to get a heal decision.

Does the CLI Call a Model?

No (#619). automation-sandbox-heal is deterministic only: it scores candidates with the heuristic resolver and never contacts an LLM, so the LLM independent-agreement quorum (LlmProviderFactory, LLM_CUSTOM_PROVIDERS) is available from the .NET API but not from the CLI. A non-.NET team gets the evidence gate, the per-component name/descendant gates and the margin rule, not the consensus layer. The CLI also reads no LLM environment variable, so an internal OpenAI-compatible gateway cannot be configured through it. For the scheme policy of custom endpoints in the .NET API, see LLM Providers.

Telling Apart Identical Rows (RowContext)

A list whose rows each hold an identical button (Connect in every row) is AMBIGUOUS when only the row differs. A capture can record RowContext (#617): the text of the other elements in the row or list item the element sits in. capture.mjs and the .NET web capture (WebElementMapper) fill it; on a --expected snapshot it is compared with each candidate’s RowContext as an extra scoring signal (word overlap, weight RowContextWeight 0.10). It counts only when the stale locator recorded one, so snapshots without it score exactly as before. For a tree built by hand or by another capture, call UiRowContext.Annotate(root) (.NET) before taking the snapshot. Row labels that differ only slightly (demo-a / demo-b) separate cleanly because the comparison is by word, not by edit distance.

Known Limitations


🇹🇷 Türkçe Kılavuz

Bu sitedeki diğer her rehber bir .NET projesi varsayar: bir paket referansı ekleyin, C# yazın, SelfHealingResolver‘ı süreç içinde çağırın. automation-sandbox-heal (AutomationSandbox.Cli) bu gereksinimi tamamen ortadan kaldırır. SelfHealingResolver.Resolve yalnızca framework’ten bağımsız UiElementInfo ağacı üzerinde çalışır - FlaUI yok, Playwright .NET SDK’sı yok, Windows bağımlılığı yok - yani “her dilden, her CI’dan” bu motora ulaşmanın önündeki tek gerçek engel paketlemeydi. Bu rehber tüm hikayeyi kapsar: CLI’nin kendisi, okuyup yazdığı JSON sözleşmesi, onu saran GitHub Action, ve C# dışında bir dil için çalışan gerçek bir yakalama örneği.

Kurulum

dotnet tool install -g AutomationSandbox.Cli --prerelease

0.x beta serisi boyunca --prerelease gereklidir; kararlı bir 1.0 yayınlandığında kaldırın. Bu hâlâ makinede .NET runtime’ının bulunmasını gerektirir - aracın kendisi gerçek bir .NET çalıştırılabilir dosyasıdır, sadece çağıranın bir .NET projesine ihtiyacı yoktur.

Temel Kullanım

automation-sandbox-heal --expected stale-element.json --tree live-tree.json --profile balanced

--selector ile çıktı { "PartialEvidence": true, "DerivedExpected": {...}, "Result": {...} } olarak sarılır; böylece kısmi kanıt sonuçta belirtilir ve motorun eşleştirdiği element görünür. Kabul eşiği değişmez: bu kadar az kanıtla en iyi aday çoğu zaman doğrudur ama yine de AMBIGUOUS veya LOW CONFIDENCE olur (çıkış 1); çıktıyı otomatik düzeltme değil, zaten bozuk bir test takımı için inceleme yardımcısı olarak kullanın.

Stdout’a bir HealResult JSON olarak basılır - bu projedeki her API yüzeyinin sergilediği aynı açıklanabilir ScoreComponents dökümü, RunnerUpScore, ve EvidenceCoverage. Tanılama günlükleri stderr’e gider (konsol kod sayfası ne olursa olsun her zaman BOM’suz UTF-8, böylece Bağlan gibi bir ad Windows’ta bozulmaz - #621), yani stdout her zaman saf, ayrıştırılabilir JSON’dur. Çıkış kodu 0 IsConfident anlamına gelir (Matched‘i kabul etmek güvenlidir); 1 yeterince emin olunmadığını gösterir (otomatik kabul etmeyin); 2 bir karara varılmadan önce bir hata oluştuğu anlamına gelir (kötü girdi, eksik dosya ve komut satırındaki her hata: bilinmeyen ya da yanlış yazılmış bir bayrak, eksik değer, bilinmeyen profil) - asla ham bir stack trace değil. Komut satırı hatasının 1 değil 2 olması bilerek yapılmıştır: bir CI kapısı 1‘i incelemeye gönderir ve bir bayraktaki yazım hatası sıradan bir “emin değil” sonucu gibi görünmemelidir (#646). Kullanım metni bu durumda stderr’e yazılır, yani stdout boş kalır; yalnızca --help onu stdout’a basar (çıkış 0).

JSON Şeması

Her iki JSON girdisi de, aracın kendi çıktısı da yayınlanmış bir JSON Schema‘yı takip eder. Herhangi bir C# kaynağını okumadan otomatik tamamlama ve doğrulama için editörünüzü veya bir doğrulayıcıyı buna yönlendirin:

{
  "$schema": "https://mustafasercansak.github.io/automation-sandbox/schemas/ui-element-info.schema.json",
  "ControlType": "Button"
}

Yalnızca SimilarityScorer‘ın beş ağırlıklı sinyalinin (ControlType, Name, AutomationId, BoundingRectangle, ParentControlType) arkasındaki alanlar zorunludur; geri kalan her şey isteğe bağlıdır, bu da motorun bir özellik girdi JSON’unda yoksa başvurduğu C# varsayılanlarıyla eşleşir.

Bir ağaç en fazla 256 eleman derinliğinde olabilir (her eleman iki JSON seviyesi harcar: nesne ve Children dizisi; bu yüzden okuyucunun sınırı 528’dir). Daha derin girdi, çökme olmadan Error: The tree is nested more than 256 elements deep hatasıyla ve 2 çıkış koduyla reddedilir. #638’e kadar sınır 31 elemandı ve hata “possible object cycle” diyordu; .NET yakalaması varsayılan olarak 25’te, capture.mjs ise 100’de durur, yani ikisi de sınırın içinde kalır.

CI’da Kullanım: GitHub Action

Bir composite GitHub Action, kurulum, çalıştırma ve JSON ayrıştırma adımlarını tek bir satıra sarmalar:

- uses: mustafasercansak/automation-sandbox/.github/actions/heal@main
  with:
    expected: path/to/stale-element.json
    tree: path/to/live-tree.json
    profile: balanced

Girdiler hiçbir şey çalışmadan önce denetlenir ve hatalı biri adımı 2 çıkış koduyla (CLI’nin “çalıştırılamadı”sı) durdurur: profile balanced, conservative ya da aggressive olmalı, version 1.2.3 ya da 1.2.3-beta.4 gibi görünmeli, source yalnızca harf, rakam ve . _ ~ : / @ % + = , - (ve ters eğik çizgi) içerebilir, expected ile tree var olan dosyalar olmalı. Değerler betiğe ortam değişkeni olarak geçirilir, asla içine yapıştırılmaz; bu yüzden bir pull request’ten gelen bir değer (örneğin bir dal adı) kabuk komutu olarak çalışamaz (#636).

Varsayılan olarak bu adım, sonuç yeterince emin değilse job’u başarısız yapar - tıpkı CLI’nin kendi exit-code sözleşmesi gibi, yani sade bir uses: satırı zaten çalışan bir pass/fail kapısıdır. Build’i başarısız yapmak yerine sonuca göre dallanmak isterseniz continue-on-error: true ekleyin ve is-confident/result çıktılarını okuyun. İsteğe bağlı bir source girdisi, action’ın nuget.org yerine özel bir feed’den kurulum yapmasına izin verir.

Herhangi Bir Dilden JSON Yakalamak: Web (JS/Playwright)

CLI, ancak girdisini üreten bir şey olduğunda işe yarar. Depo bunun için gerçek, çalışan bir referans sunar: examples/js-playwright-capture, bir web sayfasının DOM’unu yukarıdaki tam JSON şeklinde yakalayan bir Node.js + Playwright betiği - AutomationSandbox.WebDiscovery‘nin .NET tarafında kullandığı aynı rol/erişilebilir-isim tespiti ve ControlType/AutomationId eşleme kurallarını yansıtır, böylece JS’de yakalanan bir ağaç .NET’te yakalanmış biriyle tutarlı puanlanır. Bilinçli olarak minimaldir (sadece normal DOM - Shadow DOM veya iframe gezinmesi yok), ve sıfır ağ bağımlılığıyla çalışması için birlikte gelen bir fixture içerir.

TypeScript Playwright Suite’ine Bağlamak (@playwright/test)

Zaten düşen bir suite’in yeşilken kaydedilmiş anlık görüntüsü yoktur; bu yüzden --selector kullanın (yukarıya bakın). Aynı örnek dizini gerekli parçaları sunar (#618); derleme adımı olmadan bir TypeScript suite’inden kullanılabilsin diye düz ES modülleridir:

automation-sandbox-heal PATH üzerinde değilse HEAL_CLI ayarlayın. Öneri bir inceleme yardımcısıdır, otomatik düzeltme değildir: yalnızca seçiciden üretildiği için kısmi kanıt olarak etiketlenir. Rol ve ad içeren bir locator (getByRole('button', { name: 'Settings' })) motora tek başına bir test id’den çok daha fazla eşleştirme malzemesi verir; test id tek başına çoğu zaman not confident ve ilgisiz bir en iyi adayla biter, güvenmeden önce skora bakın.

Herhangi Bir Dilden JSON Yakalamak: Masaüstü (Python/pywinauto)

Windows masaüstü uygulamaları için aynı fikir: examples/python-pywinauto-capture, pywinauto‘nun uia backend’ini kullanan bir Python betiği - FlaUI/UIA3‘ün kullandığı aynı Windows UI Automation COM API’si, yani sadece eşleşen bir JSON şekli değil, gerçekten eşdeğer veri üretir. JS örneğinin aksine, bu örnek bunu yazan asistan tarafından yerel olarak doğrulanamadı (o ortamda Windows/UI Automation erişimi yok) - gerçek doğrulaması, bu deponun kendi WinForms demo uygulamasını derleyen, başlatan, gerçek UI ağacını yakalayan ve automation-sandbox-heal‘in bu gerçek veriden oluşturulan sentetik bir eski locator’ı iyileştirdiğini doğrulayan bir CI job’udur (Desktop Capture (Python)).

Kendi araçlarınız zaten aynı şekilde bir dict üretiyorsa, minimal bir Python taslağı:

import json, subprocess

result = subprocess.run(
    ["automation-sandbox-heal", "--expected", "expected.json", "--tree", "tree.json", "--profile", "balanced"],
    capture_output=True, text=True,
)
heal_result = json.loads(result.stdout)
if result.returncode == 0:
    print(f"Healed: use {heal_result['Matched']['AutomationId']} instead")

Web Sitesinde Yazım Hatası Taramak: automation-sandbox-audit

İkinci bir araç, AutomationSandbox.SiteAudit (komut: automation-sandbox-audit), tek bir URL’den başlayarak siteyi gezer ve yazım hatalarını, tekrarlanan kelimeleri ve unutulmuş yer tutucu metinleri raporlar. API anahtarı gerektirmez ve sayfa metnini hiçbir yere göndermez: yazım denetimi, Türkçe gibi ek alan dilleri de işleyebilen Hunspell sözlüklerinden gelir. .NET 10 runtime’ı (veya daha yenisi) gerekir ve gezme için Chromium indirir.

automation-sandbox-audit --url https://example.com --lang tr,en --allow-word Playwright --install-browser

Yazım denetimini GitHub’da çalıştırmak

Bir composite action kurulum, çalıştırma, özet ve yükleme adımlarını sarar; böylece zamanlanmış bir workflow tek bir uses: satırıdır. API anahtarı gerektirmez ve sayfa metni runner’dan çıkmaz:

name: Typo audit
on:
  schedule:
    - cron: '0 6 * * 1'
  workflow_dispatch:
jobs:
  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: mustafasercansak/automation-sandbox/.github/actions/site-audit@main
        with:
          url: https://example.com
          lang: tr,en
          allow-words: |
            Acme
            Playwright

Komut Satırından Bir Issue’yu Sınıflandırmak: automation-sandbox-agent

automation-sandbox-agent triage (#585), LLM sağlayıcı rehberinde anlatılan issue sınıflandırma ajanından tek bir GitHub issue’sunu geçirir: issue’yu ve proje panosundaki kartını okur, Agent:: etiket kapısını uygular, modelleri issue’nun Model::<ad> ve Review::<ad> etiketlerinden yönlendirir, bir sınıflandırma önerisi üretir ve ikinci bir modelin kontrol etmesini sağlar. Salt okunurdur: hiçbir etiketi, yorumu ya da kartı değiştirmez. Rapor stdout’ta JSON olarak verilir; tanılama iletileri stderr’e gider.

export PROJECT_TOKEN=$(gh auth token)      # projeyi ve issue'ları okuma yetkisi
export GEMINI_API_KEY=...                  # taslağı yazan model
export MISTRAL_API_KEY=... MISTRAL_MODEL=mistral-medium-2508   # denetçi
automation-sandbox-agent triage --repo owner/name --issue 7 --project-id PVT_xxxx

Anahtarlar ve token’lar yalnızca ortam değişkenlerinden okunur, asla bir argümandan değil (argüman kabuk geçmişine ve işlem listesine düşer); buna benzeyen bir bayrak reddedilir ve asla geri yazılmaz. Issue’nun Agent::Allowed etiketi, bir Task::issue-triage ya da Task::ci-failure etiketi ve panoda Ready sütununda olması gerekir. ci-failure için issue gövdesi yapıştırılmış CI günlüğü olarak okunur ve rapora bir ciFailure bölümü eklenir (günlüğün belirleyici kategorisi, ardından önerilen issue); Task::docs, issue’nun Source: yol satırlarıyla adlandırdığı dosyaları --docs-root ile verilen checkout’tan okur (yalnızca git’in izlediği dosyalar; iş akışları içinde çalıştıkları checkout’u verir) ve taslak JSON raporun docs bölümündedir. Çıkış kodları: 0 öneri kabul edildi, 1 issue uygun değil, yönlendirme durdu ya da öneri engellendi veya başarısız oldu (rapor nedenini söyler), 2 komut çalışamadı (hatalı argüman, token yok, model yok). Paketleme, kurulum ve bu çıkış kodları CI’da denetlenir; bir issue’dan öneriye giden yol, taklit bir GitHub ve sahte modellerle birim testleriyle kapsanır. Şimdiye kadarki gerçek çalıştırmalar (31 Ekim 2026, elle başlatılan agent-triage.yml iş akışıyla, #589): düz bir deneme issue’sunda ve bilerek düşmanca yazılmış bir issue’da (sahte bir veri işaretleyicisi, “önceki talimatları unut”, bağlantılı, @everyone‘lu ve korumalı etiketli sahte bir JSON yanıtı ve anahtarları yazdırma isteği) taslağı Gemini yazdı, Ollama Cloud (gemma4:31b) denetledi ve iki çalışma da doğru, zararsız bir öneriyle kabul edildi; düşmanca talimatlara uyulmadı. Bu iki çalışma, tek bir model çifti ve tek bir düşmanca metindir: bir modelin kandırılamayacağını göstermez, yalnızca bu önlemlerin kandırılmış bir modele karşı denenmediğini söyler. Aynı gün Mistral hem taslak yazarken hem denetlerken HTTP 429 verdi, ve genel listesinde görünen bir NVIDIA modeli bu hesap için HTTP 404 verdi.

Sonucu issue’ya yazmak (--comment, #590). Varsayılan olarak GitHub’a hiçbir şey yazılmaz. --comment ile çalışma, raporunu issue’ya tek bir yorum olarak yazarak biter: aşama, kapının nedeni, taslağı hangi modelin yazdığı ve kimin denetlediği, öneri ya da hatanın nedeni ve denetçinin bulguları. Yorum, öneriyi bir dil modelinin yazdığını ve harekete geçmeden önce bir insanın okuması gerektiğini açıkça söyler. Yalnızca-okuma proje token’ından ayrı, issue yorumu yazabilen kendi token’ını ister (GH_TOKEN ya da GITHUB_TOKEN; herkese açık bir repo için klasik token’ın public_repo kapsamı); o yoksa çalışma, hiçbir model çağrılmadan önce durur. Bir modelin ya da sağlayıcının ürettiği her şey yazılmadan önce temizlenir: bir anma kimseye bildirim göndermez, bağlantılar ve HTML etkisizdir, markdown biçimlendirmeyi açıp kapatamaz ve uzunluk sınırlıdır. Bir sağlayıcı hatası, yalnızca durum koduna ve kısa bir nedene indirilir, çünkü yanıt gövdesi hesap tanımlayıcıları taşıyabilir (ilk gerçek NVIDIA 404’ü taşıdı); stdout’taki JSON raporu da aynı indirgemeyi alır. Yazılamayan bir yorum, komutu 2 çıkış koduyla bitirir. Hiçbir kart değiştirilmez; --label-needs-human verilmedikçe hiçbir etiket de değiştirilmez (sonraki paragraf).

Engellenen ya da başarısız bir çalışmayı bir insana işaretlemek (--label-needs-human, #601). Bu da varsayılan olarak kapalıdır. Bayrakla, bir görevin gerçekten çalıştığı ve bağımsız denetçinin öneriyi engellediği ya da çalışmanın başarısız olduğu durumda issue’ya Agent::Needs-Human etiketi eklenir; böylece panoya bakan biri ajanın durduğunu ve bir karar beklediğini görür. Yalnızca bu tek etiketi ekler, başka hiçbir şeyi: etiket adı için parametre yoktur, hiçbir etiket silinmez ve etiket sonraki bir çalışmayı engellemez (Agent::Allowed‘ı yeniden eklemek devam sinyalidir). Kabul edilen çalışma hiçbir şey eklemez; uygun olmayan issue, yönlendirme sorunu ve okunamayan issue de eklemez, çünkü bu durumlarda hiçbir şey taslaklanmamıştır ve rapor neyin düzeltileceğini zaten söyler. --comment ile aynı türde bir yazma token’ı ister (issue yazabilen GH_TOKEN ya da GITHUB_TOKEN); o yoksa hiçbir model çağrılmadan önce durur. Eklenemeyen bir etiket komutu 2 çıkış koduyla bitirir; rapor yine de önce yazdırılır. Elle çalıştırılan workflow’da label_needs_human girdisidir; etiketle tetiklenen workflow salt okunur kalır ve bunu hiç ayarlamaz. Zaten etiketi olan bir issue’ya etiket eklemek hiçbir şeyi değiştirmez. Yalnızca hız sınırına takılan bir sağlayıcı da burada başarısız çalışma sayılır; bu yüzden etiket önerinin kendisiyle ilgisi olmayan bir nedenle de görünebilir, raporda hangisi olduğu yazar.

Kendi bilgisayarın yerine GitHub’da çalıştırmak (#589). Depo gizli anahtarları (model anahtarları) kimse tarafından geri okunamaz; bu yüzden yalnızca orada tanımlı bir model terminalden denenemez. Elle başlatılan agent-triage.yml iş akışı, aynı aracı GitHub’ın çalıştırıcısında bu anahtarlarla çalıştırır: Actions sekmesinden (ya da gh workflow run agent-triage.yml -f issue_number=7 ile) başlatılır ve rapor iş özetinden okunur. post_comment ile raporu ayrıca bir yorum olarak da yazar; bunu iş akışının kendi token’ıyla yaptığı için ek bir token gerekmez. Kullanıcıya ait bir proje panosunu okumak ise bir PROJECT_TOKEN gizli anahtarı gerektirir (yalnızca read:project yetkili klasik bir token). Bunu yalnızca iş akışı çalıştırma yetkisi olan bir kişi başlatabilir; hiçbir issue, etiket, yorum ya da pull request olayı başlatamaz, bu yüzden bir yabancı model kotanı harcayamaz ve gizli anahtarlara ulaşamaz.

Etiket ekleyerek başlatmak (#589). İkinci bir iş akışı olan agent-triage-label.yml, bir bakımcı bir issue’ya Agent::Allowed ekleyince aynı aracı çalıştırır. Depo değişkeni AGENT_TRIAGE_ON_LABEL değeri true yapılana kadar kapalıdır (Settings, Secrets and variables, Actions, Variables); bu yüzden birleştirmek hiçbir şey harcamaz. Etiket eklemek için triage yetkisi gerekir, yani etiketin kendisi yetki denetimidir; iş akışı ayrıca yalnızca o etikete tepki verir, kodu varsayılan daldan çalıştırır (bir issues olayı issue yazarının kodunu asla çekmez), bir pull request, yorum ya da push ile başlatılamaz ve yalnızca contents: read ile issues: read yetkisine sahiptir. Salt okunurdur: rapor iş özetine yazılır, hiçbir etiket, yorum ya da kart yazılmaz. Model adları depo değişkenlerinden gelir (GEMINI_MODEL, MISTRAL_MODEL, NVIDIA_MODEL, OLLAMA_CLOUD_MODEL). Bir issue için çalışmalar kendi aralarında ve elle başlatılanlarla sıraya girer. Issue yine de kapıdan geçmelidir (Task::<tür>, panoda Ready vb.); geçemeyen bir issue için gelen etiket olayı bir hata değil, nedenini bildiren tamamlanmış bir çalışmadır.

Modellere deponun geçmişini vermek (lessons build, --lessons-file, #561). automation-sandbox-agent lessons build --repo owner/name --out lessons.json [--max-records N] [--before yyyy-MM-dd] kapalı issue ve pull request’lerin düz bir JSON dizinini yazar (salt okunur; GH_TOKEN ya da GITHUB_TOKEN isteğe bağlı, ama anonim çalışma çok sert hız sınırına takılır), triage --lessons-file lessons.json da eşleşen birkaç kaydı veri olarak alıntılayıp numarasıyla adlandırarak taslak ve denetim istemlerine ekler. Dosya verilmedikçe kapalıdır; okunamayan ya da geçersiz bir dizin, hiçbir istek yapılmadan 2 çıkış koduyla durdurur. Rapor kullanılan kayıtları listeler. İşe yarayıp yaramadığı gösterilmedi (üç model, on hata, işe yaradığına dair kanıt yok); bkz. LLM sağlayıcı kılavuzu.

Bir Modelin Motoru Çağırmasına İzin Vermek: automation-sandbox-mcp

automation-sandbox-mcp (#586), C# ile yazılmış bir Model Context Protocol sunucusudur; böylece bir model istemcisi (IDE asistanı, masaüstü sohbet uygulaması, ajan çatısı) kimse yapıştırıcı kod yazmadan motoru çağırabilir. MCP, standart girdi ve çıktı üzerinde, satır başına bir ileti olan JSON-RPC’dir; ürün Node.js’ten bağımsız kalır. Bu sunucu yönüdür ve projenin daha önce reddettiği Playwright MCP istemci köprüsüyle ilgisi yoktur (Intent-Driven Automation sayfasına bakın). Yayımlandığında dotnet tool install --global AutomationSandbox.Mcp --prerelease ile kurulur (şimdilik bu depodan derlenir) ve automation-sandbox-mcp komutu istemcinizde bir stdio sunucusu olarak kaydedilir.

Dört araç sunar, hepsi salt okunurdur:

Araç Ne yapar Gerektirir
heal_locator Eski öğeyi ve canlı bir UI ağacını JSON olarak alır, skor dökümüyle iyileştirme kararını döner; IsConfident motorun kendi kabul kapısıdır ve yanıtın ilk özelliğidir (#668). Yanıt, automation-sandbox-heal --compact ile aynı sıkıştırılmış biçimdedir: alt ağacı olmayan öğeler ve yalnızca en iyi 5 aday, tam sayıyı CandidateCount verir; böylece ağaç ne kadar büyük olursa olsun yanıt küçük kalır. hiçbir şey
classify_ci_log Başarısız bir CI logunu model kullanmadan, deterministik kurallarla bir kategoriye ayırır; yanıtta kimlik bilgisi biçimleri maskelenir. hiçbir şey
check_issue_eligibility Bir issue’yu ve pano kartını okur, ajanın etiket kapısının kararını bildirir. sunucuda PROJECT_TOKEN
triage_issue_dry_run Uygun bir issue üzerinde triyaj ajanını çalıştırır ve öneriyi döner; hiçbir şey yazılmaz, etiketlenmez ya da taşınmaz. Yapılandırılmış modelleri çağırdığı için kota harcar. sunucuda PROJECT_TOKEN ve bir model anahtarı

Yapmadıkları: hiçbir araç etiket, kart, dosya ya da issue yazmaz; hiçbir araç argüman olarak kimlik bilgisi almaz ya da döndürmez. Son iki aracın ihtiyaç duyduğu token ve model anahtarları sunucunun kendi ortamından okunur; aracı çağıran bunu okuyamaz ya da ayarlayamaz, eksikse araç sunucunun yapılandırılmadığını söyler. Her argüman güvenilmez sayılır: türü denetlenir, sınırlanır (bir iyileştirme belgesi en çok 400.000 karakter, bir log en çok 400.000) ve kullanılmadan önce doğrulanır; 1.000.000 karakterden uzun bir ileti hata ile atılır, bir araç yanıtı 60.000 karakterde kesilir ve beklenmedik biçimde başarısız olan bir araç yalnızca istisna türünü bildirir. docs görev türü bir checkout gerektirir ve bu sunucudan sunulmaz; bu yüzden Task::docs etiketli bir issue triage_issue_dry_run içinde, hiçbir model çağrılmadan önce başarısız olur. Protokol (#674): sunucu 2026-07-28 sürümünü konuşur; bu sürümde her istek kendi protokol sürümünü ve yeteneklerini params._meta içinde taşır ve initialize el sıkışması yoktur (server/discover vardır, tools/list ve tools/call sonuçları resultType taşır). Henüz geçmemiş bir istemci için eski el sıkışmayı (initialize, 2025-06-18 ve öncesi) sunmaya da devam eder; ne istek başına sürümü ne de önceki bir el sıkışması olan istek -32602 ile, desteklenmeyen bir sürüm -32022 ve sunucunun konuştuğu sürümlerin listesiyle reddedilir. Yapılmayanlar: HTTP aktarımı, kimlik doğrulama ve yazan herhangi bir araç. Araç listesi ve bu sınırlar, anahtar ve ağ gerektirmeyen, bellek içi akışlar üzerindeki testlerle sınanır; Linux’ta stdio üzerinden, aynı resmî SDK üzerine kurulu iki gerçek istemciyle denendi: resmî MCP Inspector 2.13.0 ve resmî TypeScript istemcisi 2.4.0. İkisi de hem eski initialize el sıkışmasıyla hem de 2026-07-28’e sabitlenmiş olarak server/discover ile bağlandı, araçları listeledi ve classify_ci_log çağırdı; Inspector yeni yolda ayrıca heal_locator çağırdı. Bu tek bir SDK, tek bir aktarım ve tek bir işletim sistemidir ve issue araçları bir istemci üzerinden çağrılmadı; bu yüzden istemciye özgü bir tuhaflık hâlâ olabilir.

Neden CLI, Sadece Kütüphane Değil

AutomationSandbox.SelfHealing/AutomationSandbox.UiModel, kendi UiElementInfo ağaçlarını zaten yakalayan (Discovery, WebDiscovery, veya elle yazılmış bir adaptör ile) ve resolver’ı süreç içinde çağırmak isteyen bir .NET projesi için doğru seçimdir. CLI, geri kalan her şey içindir: .NET dışı bir test paketi, bir CI pipeline’ındaki bir shell script, veya bir JSON ağacı üretebilen ama sadece bir healing kararı almak için .NET bağımlılığı almasına gerek olmayan herhangi bir araç.

CLI Bir Model Çağırır mı?

Hayır (#619). automation-sandbox-heal yalnızca deterministiktir: adayları sezgisel çözümleyici ile puanlar ve hiçbir LLM’e bağlanmaz; bu yüzden LLM bağımsız-uzlaşma kurulu (LlmProviderFactory, LLM_CUSTOM_PROVIDERS) .NET API’sinden kullanılabilir ama CLI’dan kullanılamaz. .NET dışı bir ekip kanıt eşiğini, bileşen başına ad/alt-eleman eşiklerini ve fark kuralını alır, uzlaşma katmanını almaz. CLI ayrıca hiçbir LLM ortam değişkenini okumaz; bu yüzden OpenAI uyumlu bir dahili geçit CLI üzerinden yapılandırılamaz. .NET API’sindeki özel uç noktaların şema politikası için LLM Sağlayıcıları sayfasına bakın.

Özdeş Satırları Ayırmak (RowContext)

Her satırında özdeş bir düğme (Connect) bulunan bir liste, yalnızca satır farklı olduğunda AMBIGUOUS çıkar. Bir yakalama RowContext kaydedebilir (#617): elementin içinde bulunduğu satırdaki veya liste öğesindeki diğer elementlerin metni. capture.mjs ve .NET web yakalaması (WebElementMapper) bunu doldurur; bir --expected anlık görüntüsünde her adayın RowContext‘i ile ek bir skor sinyali olarak karşılaştırılır (kelime örtüşmesi, ağırlık RowContextWeight 0,10). Yalnızca eski locator bir tane kaydetmişse devreye girer; bu yüzden onsuz anlık görüntüler eskisi gibi puanlanır. Elle ya da başka bir yakalamayla kurulmuş bir ağaç için anlık görüntüyü almadan önce UiRowContext.Annotate(root) (.NET) çağırın. Birbirinden yalnızca küçük farkla ayrılan satır etiketleri (demo-a / demo-b) temiz ayrılır, çünkü karşılaştırma düzenleme mesafesiyle değil kelimeyle yapılır.

Bilinen Sınırlamalar