website_audit
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesewebsite_audit
website_audit
描述
Description
对指定 URL 运行 Lighthouse 审计,产出结构化 JSON。返回 分数与完整原始报告,便于在代理、流水线或质量门禁中消费与比对。
performanceRun Lighthouse audit on the specified URL and generate structured JSON. Returns the score and complete original report, which is easy to consume and compare in proxies, pipelines or quality gates.
performance使用场景
Usage Scenarios
- 开发阶段快速评估页面性能
- PR/CI 中设定性能阈值做质量门禁
- 上线前建立/对比性能基线
- 定时巡检以发现性能回归
- 用户提出“审计网站性能/生成 Lighthouse 报告/检测页面速度”等需求时触发
- Quickly evaluate page performance during the development phase
- Set performance thresholds as quality gates in PR/CI
- Establish/compare performance baselines before going online
- Regular inspection to detect performance regression
- Triggered when users raise demands such as "audit website performance/generate Lighthouse report/detect page speed"
指令
Instructions
- 接收入参 ,校验为
{ url }且非空。http/https - 执行命令 获取审计结果。
npx lighthouse <url> --output=json- 在无头或 CI 环境可追加 。
--chrome-flags="--headless=new"
- 在无头或 CI 环境可追加
- 解析 stdout 为 JSON,读取 。
categories.performance.score - 构造并返回:
json
{ "score": <number>, "raw": { /* Lighthouse 完整 JSON */ } } - 异常处理:捕获执行/解析错误,返回错误信息或抛出异常以便上层处理。
- Receive input parameter , verify it is
{ url }and not empty.http/https - Execute the command to get audit results.
npx lighthouse <url> --output=json- In headless or CI environments, you can append .
--chrome-flags="--headless=new"
- In headless or CI environments, you can append
- Parse stdout to JSON, read .
categories.performance.score - Construct and return:
json
{ "score": <number>, "raw": { /* Complete Lighthouse JSON */ } } - Exception handling: Catch execution/parsing errors, return error information or throw exceptions for upper-layer processing.
示例(可选)
Example (Optional)
- CLI:
bash
node dist/cli.js --url https://example.com # 或:npm link && website-audit --url https://example.com - 代码:
ts
import { websiteAuditSkill } from "websiteauditskill_henry"; const res = await websiteAuditSkill({ url: "https://example.com" }); console.log(res.score); // { score: 0.92, raw: { ... } }
- CLI:
bash
node dist/cli.js --url https://example.com # Or: npm link && website-audit --url https://example.com - Code:
ts
import { websiteAuditSkill } from "websiteauditskill_henry"; const res = await websiteAuditSkill({ url: "https://example.com" }); console.log(res.score); // { score: 0.92, raw: { ... } }