webwright-to-intuned
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWebwright → Intuned
Webwright → Intuned
Port a Webwright Crafted CLI into a deployed Intuned project and verify
it end to end. The contract is a faithful 1:1 port: one craft function →
one Intuned API, re-fitted only at Intuned's boundary.
automation将Webwright Crafted CLI 移植为 已部署的Intuned项目 并进行端到端验证。本次移植遵循1:1忠实映射原则:一个craft函数对应一个Intuned API,仅在Intuned的边界处进行适配。
automationPrerequisites
前置条件
- The Intuned CLI is installed and authenticated. If the command isn't found, install it first:
intuned. Then confirm auth withnpm i -g @intuned/cli(it should show a workspace). The skill never logs the user in or creates accounts — ifintuned auth whoamifails, stop and ask the user to authenticate.whoami - Input is a Webwright craft output directory (contains with an
final_script.pywrapper,argparse,plan.md). If it isn't, stop and say so.task.json
- 已安装并认证Intuned CLI。若无法找到命令,请先执行安装:
intuned。随后通过npm i -g @intuned/cli确认认证状态(应显示一个工作区)。本流程不会为用户登录或创建账户——若intuned auth whoami命令执行失败,请停止操作并要求用户完成认证。whoami - 输入必须为Webwright craft输出目录(包含带有封装的
argparse、final_script.py、plan.md文件)。若不符合要求,请停止操作并告知用户。task.json
Read first
必读文档
Supporting docs live in beside this file.
resources/- — the step-by-step transform and gates.
resources/transformation-rules.md - — the exact target (API signature, SDK, CLI, manifest), all verified against real scaffolds.
resources/intuned-contract.md - — the hardening layer. Re-read before every port and add to it after every failure.
resources/gotchas.md - — canonical vocabulary.
resources/CONTEXT.md— why the key decisions hold.resources/DECISIONS.md
支持文档位于本文件旁的目录中:
resources/- —— 分步转换规则与验证关卡。
resources/transformation-rules.md - —— 明确的目标要求(API签名、SDK、CLI、清单),所有内容均已通过真实脚手架验证。
resources/intuned-contract.md - —— 加固层说明。每次移植前请重新阅读,并在每次失败后补充内容。
resources/gotchas.md - —— 标准术语表。
resources/CONTEXT.md—— 关键决策的依据。resources/DECISIONS.md
Workflow (one port)
工作流(单次移植)
- Validate the input is a real craft; else fail loudly.
- Scaffold into
intuned dev init <task_id> --template <python-starter | python-starter-auth> --language python --install-deps --non-interactive [--stealth].intuned_projects/<task_id>/ - Transform per :
resources/transformation-rules.md- strip the browser bootstrap + wrapper; the inner async body becomes
asyncio.run;async def automation(page, params=None, **_kwargs) - map surviving params (snake_case preserved, harness params dropped+logged)
into , a pydantic schema if needed, and
Paramsso empty params reproduce the task;.parameters/.../default.json - replace →
page.goto; drop screenshots/file-writes;go_to_url→log(); return substantive data minus harness fields;print() - set and the Playground default input in
apiAccess.enabled: true.Intuned.jsonc
- strip the browser bootstrap +
- Local gate: ; compare output to the craft's
intuned dev run api <name> '{}'known-good shape/count. If the run is blocked by anti-bot defenses, don't keep fighting it locally — stealth/captcha/proxy only apply on the deployed platform (see step 6 and the bot-detection note below).final_runs/ - Deploy: after the local gate passes, ask the user whether to deploy to
Intuned (surface the target workspace when you ask). Only on a yes, run
; otherwise stop here.
intuned dev deploy --non-interactive - Platform run (final gate): ; poll
intuned platform runs start '{"api":"<name>","parameters":{}}' -p <task_id>until terminal.intuned platform runs get <id> - On any failure, root-cause into a entry, fix, re-run.
resources/gotchas.md
- 验证输入是否为有效的craft项目;若无效,立即终止并提示。
- 搭建脚手架:执行命令,将项目生成到
intuned dev init <task_id> --template <python-starter | python-starter-auth> --language python --install-deps --non-interactive [--stealth]目录下。intuned_projects/<task_id>/ - 转换:按照执行:
resources/transformation-rules.md- 移除浏览器初始化代码和封装;内部异步代码主体将变为
asyncio.run;async def automation(page, params=None, **_kwargs) - 将保留的参数(保留蛇形命名snake_case,移除并记录工具相关参数)映射到(必要时使用pydantic schema),并写入
Params,确保空参数时可复现任务;.parameters/.../default.json - 将替换为
page.goto;移除截图/文件写入操作;将go_to_url替换为log();返回实质性数据,移除工具相关字段;print() - 在中设置
Intuned.jsonc,并配置Playground的默认输入。apiAccess.enabled: true
- 移除浏览器初始化代码和
- 本地验证关卡:执行;将输出与craft项目
intuned dev run api <name> '{}'目录下的已知正确输出的格式/数量进行对比。若运行被反机器人防御机制阻止,无需在本地继续尝试——隐身模式/验证码解决/代理仅在部署后的平台生效(参见步骤6及下方反机器人检测说明)。final_runs/ - 部署:本地验证通过后,询问用户是否要部署到Intuned(询问时需显示目标工作区)。仅在用户同意时,执行;否则在此处停止操作。
intuned dev deploy --non-interactive - 平台运行(最终验证关卡):执行;轮询
intuned platform runs start '{"api":"<name>","parameters":{}}' -p <task_id>命令,直到运行结束。intuned platform runs get <id> - 若出现任何失败,将根本原因记录到中,修复后重新运行。
resources/gotchas.md
Exceptions to faithful-port (decide deliberately)
忠实移植的例外情况(需谨慎决策)
- Auth craft → AuthSessions (resources/DECISIONS.md §2): decompose login into
+ a derived
auth-sessions/create.py, enablecheck.py; theauthSessionsassumes a valid session. Test withautomationthendev run authsession create.--auth-session - Bot-detection block (resources/DECISIONS.md §3): if a run is blocked by
anti-bot defenses, don't conclude the port is broken — stealth, captcha solving,
and proxies run only on the deployed platform. Set +
headfulin the manifest and verify with a deployed run; addstealthMode/captchaSolverif the deployed run is still walled. Configure per the Intuned docs: https://intunedhq.com/docs/main/02-features/stealth-mode-captcha-solving-proxiesproxy - No crawl fan-out by default — a crawl returns a flat list from one API;
is opt-in only.
extend_payload
- 认证类craft → AuthSessions(参考第2节):将登录流程拆分为
resources/DECISIONS.md+ 衍生的auth-sessions/create.py,启用check.py;authSessions函数将假定存在有效的会话。测试时先执行automation,再使用dev run authsession create参数。--auth-session - 反机器人检测拦截(参考第3节):若运行被反机器人防御机制阻止,不要判定移植失败——隐身模式、验证码解决和代理仅在部署后的平台生效。在清单中设置
resources/DECISIONS.md+headful,并通过部署后的运行进行验证;若部署后的运行仍被拦截,添加stealthMode/captchaSolver配置。请按照Intuned文档进行配置:https://intunedhq.com/docs/main/02-features/stealth-mode-captcha-solving-proxiesproxy - 默认不支持爬虫扩展——单次爬虫调用仅返回一个API的扁平列表;仅可选择启用。
extend_payload
Guardrails
防护规则
- Never launch a browser in (page is injected).
automation - Never invent Intuned APIs the craft didn't imply; this is a port, not a rewrite.
- Deploy goes to the user's own workspace — surface which workspace before first deploy.
- Don't try to beat bot-detection locally; that's what the deployed run is for.
- 切勿在函数中启动浏览器(页面将被注入)。
automation - 切勿创建craft未隐含的Intuned API;这是移植,而非重写。
- 部署将进入用户自己的工作区——首次部署前需明确告知用户目标工作区。
- 不要尝试在本地突破反机器人检测;部署后的运行才用于此目的。