Skip to content

Headless toolkit: CLI, codegen, HTTP, SQL, waits, email, PDF#209

Open
JE-Chen wants to merge 8 commits into
devfrom
feat/headless-toolkit-extensions
Open

Headless toolkit: CLI, codegen, HTTP, SQL, waits, email, PDF#209
JE-Chen wants to merge 8 commits into
devfrom
feat/headless-toolkit-extensions

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 18, 2026

Copy link
Copy Markdown
Member

Summary

Extends the headless (no-GUI) surface with eight capabilities. Every
feature is wired through the full stack — headless core, package-facade
re-export, AC_* executor command, MCP tool, visual script-builder
schema, and headless tests — so each works from action files, the socket
server, the scheduler and MCP without ever importing PySide6.

Features (by commit)

8cb901d — CLI, codegen, HTTP, SQL, file-wait

  • CLI: register the je_auto_control console script; add
    validate/lint, list-commands, fmt, record, codegen,
    version subcommands.
  • codegen: turn recordings / action files into pytest, standalone
    Python, or Robot source (readable ac.<fn>(...) calls, executor
    fall-back for flow control).
  • HTTP/API: dependency-free http_request action (method, headers,
    JSON/raw body, basic/bearer auth, explicit timeout); http_to_var now
    shares it and can POST bodies.
  • SQL: read-only, parameterised SQLite AC_sql_to_var / AC_assert_db.
  • wait-for-file: block until a download exists and stops growing.

8184f80AC_wait_for_port: block until a TCP port accepts
connections (pairs with launch_process).

7cc39d7 — email + PDF

  • email: send_email / AC_send_email via stdlib smtplib, TLS on
    by default (verified context), attachments + multiple recipients.
  • PDF: extract_pdf_text / pdf_metadata / assert_pdf_text plus
    AC_pdf_to_var / AC_assert_pdf_text, backed by the optional pypdf
    extra (clear error when absent).

Safety

  • import je_auto_control stays Qt-free (verified in a subprocess test).
  • HTTP/SMTP: enforced http/https or TLS, verified SSL context, explicit
    timeouts, no verify=False, no hardcoded credentials.
  • SQL: read-only single-statement queries, values always parameter-bound.
  • File paths resolved via realpath before I/O.

Testing

  • New headless test modules for every feature (no PySide6, no network —
    HTTP/SMTP/PDF backends are monkeypatched or injected).
  • ruff, radon (CC < C) and bandit clean on all changed files.

JE-Chen added 3 commits June 18, 2026 18:30
Extend the no-GUI surface with five capabilities, each wired through the
full stack (headless core, facade re-export, AC_ executor command, MCP
tool, visual script-builder schema, headless tests) so they work from
action files, the socket server, the scheduler and MCP without the GUI:

- CLI: register the je_auto_control console script and add
  validate/lint, list-commands, fmt, record and codegen subcommands so
  action files are runnable and inspectable from CI.
- codegen: turn recordings or action files into pytest, standalone
  Python, or Robot source (readable ac.<fn>(...) calls, executor
  fall-back for flow control).
- HTTP/API: dependency-free http_request action (method, headers,
  JSON/raw body, basic/bearer auth, explicit timeout); http_to_var now
  shares it so it can POST bodies too.
- SQL: read-only, parameterised SQLite query-to-var and assert-db steps
  built on the existing data-source loader.
- wait-for-file: block until a download appears and stops growing.
Companion to launch_process: poll a host:port until a TCP connection
succeeds, replacing unreliable sleeps when waiting for a server to come
up. Follows the smart-waits pattern (injectable connector, WaitOutcome,
hard timeout) and is wired through the full stack: headless
wait_until_port, facade re-export, AC_wait_for_port executor command,
ac_wait_for_port MCP tool, and a script-builder entry.
Round out the headless toolkit with two integrations, each wired through
the full stack (headless core, facade, AC_ executor command, MCP tool,
script-builder schema, tests):

- email: send_email / AC_send_email sends mail via stdlib smtplib with
  TLS on by default (STARTTLS or implicit SSL, verified context),
  attachments and multiple recipients, so a flow can mail its report.
- PDF: extract_pdf_text / pdf_metadata / assert_pdf_text plus the
  AC_pdf_to_var and AC_assert_pdf_text commands, backed by the optional
  pypdf extra (clear error when absent), to verify generated documents.
@codacy-production

codacy-production Bot commented Jun 18, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 322 complexity · 1 duplication

Metric Results
Complexity 322
Duplication 1

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

JE-Chen added 5 commits June 18, 2026 19:52
- email: harden the SMTP TLS context (explicit TLS 1.2+ floor and
  certificate validation) to clear S4423/S4830.
- waits: hoist duplicated validation messages into module constants (S1192).
- cli: give cmd_codegen a single return path (S3516).
- mark the non-cryptographic random.Random seeds with # nosec B311
  (flow-control random var, humanized motion/typing jitter).
- tests: separate positional/keyword args (S5549/E1124), use
  pytest.approx for float comparisons (S1244), and NOSONAR the fake
  SMTP/HTTP test passwords (S2068).
Pass host/port and the timing kwargs as explicit positional/keyword
arguments instead of **params, so static analysers can see there is no
duplicate host/port argument (clears SonarCloud S5549 false positive).
The HTTP action allow-lists exactly http and https and rejects any other
scheme; plain http is required for internal/localhost automation targets.
Mark the reviewed clear-text-protocol hotspot with an inline NOSONAR
justification (the repo's established suppression convention).
Add a "What's new (2026-06-18)" section to the English and zh-TW/zh-CN
READMEs and a v5 new-features reference page (English + Traditional
Chinese), registered in both Sphinx toctrees, covering the CLI, codegen,
HTTP, SQL, email, PDF, and the file/port waits.
zh_index referenced doc/new_features/v4_features_doc but the Traditional
Chinese page was never created with the 2026-06-17 toolkit (only the
English one was), leaving a dangling toctree entry. Add the translated
page so the Chinese Sphinx build resolves.
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant