Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

## Table of Contents

- [What's new (2026-06-18)](#whats-new-2026-06-18)
- [What's new (2026-06-17)](#whats-new-2026-06-17)
- [What's new (2026-06)](#whats-new-2026-06)
- [What's new (2026-05)](#whats-new-2026-05)
Expand Down Expand Up @@ -57,6 +58,35 @@

---

## What's new (2026-06-18)

Eight headless capabilities that round out scripting, integration, and CI
use: a real command-line interface, recording-to-code generation, and
first-class HTTP / SQL / email / PDF / wait steps. Each ships a headless
Python API, an `AC_*` executor command, an MCP tool, and a visual Script
Builder entry, and is covered by headless tests (network / SMTP / PDF
backends are injected, so nothing touches the outside world). Full
reference page:
[`docs/source/Eng/doc/new_features/v5_features_doc.rst`](docs/source/Eng/doc/new_features/v5_features_doc.rst).

**Command-line interface**
- **`je_auto_control` console script** — run and inspect action files from a shell / CI: `run` (with `--var`, `--dry-run`), `validate` (alias `lint`), `list-commands`, `fmt`, `record`, `codegen`, `version`.

**Code generation**
- **Recording → code** — `generate_code` / `generate_code_file` (`AC_generate_code`, `je_auto_control codegen`) turn a recording or action file into a pytest test, standalone Python, or Robot suite. The default `calls` style emits readable `ac.<fn>(...)` statements, falling back to `ac.execute_action([...])` for flow control.

**Integrations**
- **HTTP / API** — `http_request` (`AC_http_request`): method, headers, JSON or raw body, basic / bearer auth, explicit timeout; non-2xx responses are returned (not raised) so you can assert on status. `AC_http_to_var` now shares the client and can POST bodies.
- **SQL** — `query_sqlite` (`AC_sql_to_var` / `AC_assert_db`): read-only, parameter-bound SQLite queries into a variable, or a scalar assertion (e.g. `SELECT COUNT(*) ... == 0`).
- **Email (SMTP)** — `send_email` (`AC_send_email`): stdlib SMTP with TLS on by default (STARTTLS or implicit SSL over a verified context), attachments, and multiple recipients.
- **PDF** — `extract_pdf_text` / `pdf_metadata` / `assert_pdf_text` (`AC_pdf_to_var` / `AC_assert_pdf_text`): text extraction and content assertions, backed by the optional `pypdf` extra (`pip install je_auto_control[pdf]`).

**Smart waits**
- **Wait for a file** — `wait_until_file` (`AC_wait_for_file`) blocks until a file exists and its size stops growing (a download finished writing).
- **Wait for a TCP port** — `wait_until_port` (`AC_wait_for_port`) blocks until `host:port` accepts connections (pairs with `launch_process`).

**Security** — HTTP / SMTP enforce http/https or TLS with verified certificates and explicit timeouts; SQL is read-only and parameter-bound; file paths are resolved before I/O.

## What's new (2026-06-17)

Thirty-plus automation primitives across input realism, vision, flow
Expand Down
24 changes: 24 additions & 0 deletions README/README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

## 目录

- [本次更新 (2026-06-18)](#本次更新-2026-06-18)
- [本次更新 (2026-06-17)](#本次更新-2026-06-17)
- [本次更新 (2026-06)](#本次更新-2026-06)
- [本次更新 (2026-05)](#本次更新-2026-05)
Expand Down Expand Up @@ -56,6 +57,29 @@

---

## 本次更新 (2026-06-18)

八项 headless 能力,补齐脚本化、集成与 CI 场景:真正的命令行界面、把录制转成代码,以及一级的 HTTP / SQL / Email / PDF / 等待步骤。每项都附带 headless API、`AC_*` 执行器指令、MCP 工具与可视化脚本构建器项目,并有 headless 测试(网络 / SMTP / PDF 后端均注入,不接触外部系统)。完整参考页:
[`docs/source/Eng/doc/new_features/v5_features_doc.rst`](../docs/source/Eng/doc/new_features/v5_features_doc.rst)。

**命令行界面**
- **`je_auto_control` console script** — 在 shell/CI 运行与检查动作文件:`run`(含 `--var`、`--dry-run`)、`validate`(别名 `lint`)、`list-commands`、`fmt`、`record`、`codegen`、`version`。

**代码生成**
- **录制 → 代码** — `generate_code` / `generate_code_file`(`AC_generate_code`、`je_auto_control codegen`):把录制或动作文件转成 pytest/独立 Python/Robot 脚本。默认 `calls` 风格生成可读的 `ac.<fn>(...)`,流程控制退回 `ac.execute_action([...])`。

**集成**
- **HTTP / API** — `http_request`(`AC_http_request`):method、headers、JSON/原始 body、basic/bearer 认证、明确超时;非 2xx 返回而非抛异常。`AC_http_to_var` 现共用此客户端,可发送 body。
- **SQL** — `query_sqlite`(`AC_sql_to_var` / `AC_assert_db`):只读、参数绑定的 SQLite 查询,存入变量或做标量断言。
- **Email(SMTP)** — `send_email`(`AC_send_email`):标准库 SMTP,默认 TLS(STARTTLS/SSL、已验证证书),支持附件与多收件人。
- **PDF** — `extract_pdf_text` / `pdf_metadata` / `assert_pdf_text`(`AC_pdf_to_var` / `AC_assert_pdf_text`):文本提取与内容断言,后端为可选 `pypdf`(`pip install je_auto_control[pdf]`)。

**智能等待**
- **等待文件** — `wait_until_file`(`AC_wait_for_file`):等到文件存在且大小停止增长(下载写完)。
- **等待 TCP 端口** — `wait_until_port`(`AC_wait_for_port`):等到 `host:port` 可连接(与 `launch_process` 互补)。

**安全性** — HTTP/SMTP 强制 http/https 或已验证 TLS 与明确超时;SQL 只读且参数绑定;文件路径 I/O 前以 `realpath` 解析。

## 本次更新 (2026-06-17)

新增 30+ 个自动化原语,涵盖输入拟真、视觉、流程控制、触发器、窗口管理与文件安全,
Expand Down
24 changes: 24 additions & 0 deletions README/README_zh-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

## 目錄

- [本次更新 (2026-06-18)](#本次更新-2026-06-18)
- [本次更新 (2026-06-17)](#本次更新-2026-06-17)
- [本次更新 (2026-06)](#本次更新-2026-06)
- [本次更新 (2026-05)](#本次更新-2026-05)
Expand Down Expand Up @@ -56,6 +57,29 @@

---

## 本次更新 (2026-06-18)

八項 headless 能力,補齊腳本化、整合與 CI 情境:真正的命令列介面、把錄製轉成程式碼,以及一級的 HTTP / SQL / Email / PDF / 等待步驟。每項都附帶 headless API、`AC_*` 執行器指令、MCP 工具與視覺化腳本建構器項目,並有 headless 測試(網路 / SMTP / PDF 後端皆注入,不碰外部系統)。完整參考頁:
[`docs/source/Zh/doc/new_features/v5_features_doc.rst`](../docs/source/Zh/doc/new_features/v5_features_doc.rst)。

**命令列介面**
- **`je_auto_control` console script** — 在 shell/CI 執行與檢查動作檔:`run`(含 `--var`、`--dry-run`)、`validate`(別名 `lint`)、`list-commands`、`fmt`、`record`、`codegen`、`version`。

**程式碼產生**
- **錄製 → 程式碼** — `generate_code` / `generate_code_file`(`AC_generate_code`、`je_auto_control codegen`):把錄製或動作檔轉成 pytest/獨立 Python/Robot 腳本。預設 `calls` 風格產生可讀的 `ac.<fn>(...)`,流程控制退回 `ac.execute_action([...])`。

**整合**
- **HTTP / API** — `http_request`(`AC_http_request`):method、headers、JSON/原始 body、basic/bearer 認證、明確逾時;非 2xx 回傳而非丟例外。`AC_http_to_var` 現共用此客戶端,可送 body。
- **SQL** — `query_sqlite`(`AC_sql_to_var` / `AC_assert_db`):唯讀、參數綁定的 SQLite 查詢,存入變數或做純量斷言。
- **Email(SMTP)** — `send_email`(`AC_send_email`):標準庫 SMTP,預設 TLS(STARTTLS/SSL、已驗證憑證),支援附件與多收件人。
- **PDF** — `extract_pdf_text` / `pdf_metadata` / `assert_pdf_text`(`AC_pdf_to_var` / `AC_assert_pdf_text`):文字抽取與內容斷言,後端為可選 `pypdf`(`pip install je_auto_control[pdf]`)。

**智慧等待**
- **等待檔案** — `wait_until_file`(`AC_wait_for_file`):等到檔案存在且大小停止增長(下載寫完)。
- **等待 TCP 連接埠** — `wait_until_port`(`AC_wait_for_port`):等到 `host:port` 可連線(與 `launch_process` 互補)。

**安全性** — HTTP/SMTP 強制 http/https 或已驗證 TLS 與明確逾時;SQL 唯讀且參數綁定;檔案路徑 I/O 前以 `realpath` 解析。

## 本次更新 (2026-06-17)

新增 30+ 個自動化原語,涵蓋輸入擬真、視覺、流程控制、觸發器、視窗管理與檔案安全,
Expand Down
162 changes: 162 additions & 0 deletions docs/source/Eng/doc/new_features/v5_features_doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
================================================
New Features (2026-06-18) — CLI & Integrations
================================================

Eight headless capabilities that round out scripting, integration, and
continuous-integration use: a real command-line interface,
recording-to-code generation, and first-class HTTP / SQL / email / PDF /
wait steps. Every feature ships a headless Python API, an ``AC_*``
executor command, an MCP tool, and a visual Script Builder entry, and is
covered by headless tests — the network, SMTP, and PDF backends are
injected, so nothing touches the outside world.

.. contents::
:local:
:depth: 2


Command-line interface
======================

The package now installs a ``je_auto_control`` console script for running
and inspecting action files from a shell or CI pipeline::

je_auto_control run script.json --var user=alice --dry-run
je_auto_control validate script.json # alias: lint
je_auto_control list-commands --filter mouse --json
je_auto_control fmt script.json --check
je_auto_control record out.json --duration 5
je_auto_control codegen script.json --target pytest -o test_flow.py
je_auto_control version

``run`` executes (``--dry-run`` validates and lists steps without acting),
``validate`` / ``lint`` checks structure and rejects unknown commands,
``fmt`` canonicalises the JSON, ``record`` captures input, ``codegen``
emits source (below), and ``list-commands`` prints the live executor
catalogue.


Code generation
===============

Turn a recording or an action file into committable, runnable source::

from je_auto_control import generate_code, generate_code_file

code = generate_code(actions, target="pytest", style="calls")
generate_code_file("flow.json", "test_flow.py", target="pytest")

``target`` is ``pytest`` / ``python`` / ``robot``. The default ``calls``
style maps each ``AC_*`` command to its facade call
(``ac.click_mouse(...)``) and falls back to ``ac.execute_action([...])``
for flow control and private adapters; the ``actions`` style embeds the
list and replays it through the executor.

Executor command: ``AC_generate_code``. CLI: ``je_auto_control codegen``.


HTTP / API
==========

A dependency-free HTTP(S) client for hybrid UI + API flows::

from je_auto_control import http_request

resp = http_request(
"https://api.example/items", method="POST",
json_body={"name": "Sam"},
headers={"X-Trace": "1"},
auth={"type": "bearer", "token": "..."},
timeout=30.0)
assert resp["status"] == 201

Returns ``{status, ok, headers, text, json, url}``; non-2xx responses are
returned rather than raised, so you can assert on the status code. Only
``http`` / ``https`` schemes are allowed. ``AC_http_to_var`` now shares
the same client, so it can POST bodies and send headers / auth.

Executor command: ``AC_http_request``.


SQL
===

Read-only, parameter-bound SQLite queries::

from je_auto_control import query_sqlite

rows = query_sqlite("app.db", "SELECT id, name FROM users")
count = query_sqlite("app.db",
"SELECT COUNT(*) FROM users WHERE active = ?",
params=[1], fetch="scalar")

Queries are restricted to a single read-only ``SELECT`` / ``WITH``
statement, run over a read-only connection, with values always bound as
parameters (never string-interpolated).

Executor commands: ``AC_sql_to_var`` (rows / one row / scalar into a
variable) and ``AC_assert_db`` (a scalar query asserted with
eq / ne / lt / gt / contains / ...).


Email (SMTP)
============

Send mail — for example a flow's report — over the standard library::

from je_auto_control import send_email

send_email(
{"sender": "bot@x.com", "to": ["qa@x.com"],
"subject": "Run passed", "body": "All green",
"attachments": ["report.html"]},
{"host": "smtp.x.com", "port": 587,
"username": "bot@x.com", "password": "..."})

TLS is enabled by default (STARTTLS, or implicit SSL when ``use_ssl`` is
set) over a verified default context; supports multiple recipients, CC,
HTML bodies, and file attachments.

Executor command: ``AC_send_email``.


PDF
===

Extract text from and assert on PDF documents (optional ``pypdf``
backend — ``pip install je_auto_control[pdf]``)::

from je_auto_control import extract_pdf_text, assert_pdf_text

text = extract_pdf_text("invoice.pdf", pages=1)
assert_pdf_text("invoice.pdf", "Total: $50.00")

Executor commands: ``AC_pdf_to_var`` (text into a variable) and
``AC_assert_pdf_text`` (text present / absent, optionally on a page).


Smart waits
===========

Two waits that replace unreliable ``sleep`` calls::

from je_auto_control import wait_until_file, wait_until_port

wait_until_file("~/Downloads/report.pdf", stable_for_s=1.0)
wait_until_port("127.0.0.1", 8080, timeout_s=30.0)

``wait_until_file`` returns once a file exists, is at least ``min_size``
bytes, and its size has held steady for ``stable_for_s`` (a download has
finished). ``wait_until_port`` returns once a TCP connection to
``host:port`` succeeds — the companion to launching a server. Both return
a ``WaitOutcome`` and honour a hard ``timeout_s`` cap.

Executor commands: ``AC_wait_for_file``, ``AC_wait_for_port``.


Security
========

HTTP and SMTP enforce ``http`` / ``https`` or TLS with verified
certificates and explicit timeouts; SQL is read-only and parameter-bound;
all user-supplied file paths are resolved with ``realpath`` before I/O.
1 change: 1 addition & 0 deletions docs/source/Eng/eng_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Comprehensive guides for all AutoControl features.
doc/new_features/v2_features_doc
doc/new_features/v3_features_doc
doc/new_features/v4_features_doc
doc/new_features/v5_features_doc
doc/ocr_backends/ocr_backends_doc
doc/observability/observability_doc
doc/operations_layer/operations_layer_doc
Expand Down
Loading
Loading